From cdbe5455ab0288a02e07a56408419bf5a76a9439 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 23:56:52 +0000 Subject: [PATCH 1/2] feat(api): api update --- .github/workflows/ci.yml | 48 + .github/workflows/publish-gem.yml | 31 + .github/workflows/release-doctor.yml | 22 + .gitignore | 10 + .release-please-manifest.json | 3 + .rubocop.yml | 296 ++ .ruby-version | 1 + .solargraph.yml | 11 + .stats.yml | 4 + .yardopts | 6 + CONTRIBUTING.md | 125 + Gemfile | 32 + Gemfile.lock | 228 + LICENSE | 201 + README.md | 231 +- Rakefile | 172 + SECURITY.md | 27 + Steepfile | 15 + bin/check-release-environment | 21 + bin/publish-gem | 9 + docker.gemspec | 29 + examples/.keep | 4 + lib/docker.rb | 114 + lib/docker/client.rb | 77 + lib/docker/errors.rb | 228 + lib/docker/file_part.rb | 58 + lib/docker/internal.rb | 20 + lib/docker/internal/transport/base_client.rb | 567 +++ .../transport/pooled_net_requester.rb | 210 + lib/docker/internal/type/array_of.rb | 168 + lib/docker/internal/type/base_model.rb | 529 ++ lib/docker/internal/type/base_page.rb | 55 + lib/docker/internal/type/boolean.rb | 77 + lib/docker/internal/type/converter.rb | 327 ++ lib/docker/internal/type/enum.rb | 131 + lib/docker/internal/type/file_input.rb | 111 + lib/docker/internal/type/hash_of.rb | 188 + .../internal/type/request_parameters.rb | 42 + lib/docker/internal/type/union.rb | 237 + lib/docker/internal/type/unknown.rb | 81 + lib/docker/internal/util.rb | 920 ++++ lib/docker/models.rb | 121 + lib/docker/models/auth_login_params.rb | 32 + lib/docker/models/auth_response.rb | 27 + lib/docker/models/config.rb | 302 ++ lib/docker/models/container.rb | 2461 +++++++++ lib/docker/models/container_create_params.rb | 1701 +++++++ lib/docker/models/container_delete_params.rb | 38 + lib/docker/models/container_inspect_params.rb | 22 + lib/docker/models/container_kill_params.rb | 25 + lib/docker/models/container_list_params.rb | 70 + lib/docker/models/container_list_response.rb | 8 + lib/docker/models/container_logs_params.rb | 74 + lib/docker/models/container_start_params.rb | 27 + lib/docker/models/container_stop_params.rb | 33 + lib/docker/models/create_request.rb | 347 ++ lib/docker/models/create_response.rb | 27 + lib/docker/models/error.rb | 18 + lib/docker/models/image.rb | 1382 +++++ lib/docker/models/image_delete_params.rb | 43 + lib/docker/models/image_delete_response.rb | 27 + lib/docker/models/image_inspect_params.rb | 22 + lib/docker/models/image_list_params.rb | 68 + lib/docker/models/image_list_response.rb | 8 + lib/docker/models/image_pull_params.rb | 115 + lib/docker/models/network.rb | 251 + lib/docker/models/network_create_params.rb | 206 + lib/docker/models/network_create_response.rb | 27 + lib/docker/models/network_delete_params.rb | 14 + lib/docker/models/network_inspect_params.rb | 30 + lib/docker/models/network_inspect_response.rb | 128 + lib/docker/models/network_list_params.rb | 40 + lib/docker/models/network_list_response.rb | 8 + lib/docker/models/service.rb | 518 ++ lib/docker/models/service_create_params.rb | 34 + lib/docker/models/service_create_response.rb | 32 + lib/docker/models/service_delete_params.rb | 14 + lib/docker/models/service_inspect_params.rb | 22 + lib/docker/models/service_list_params.rb | 41 + lib/docker/models/service_list_response.rb | 8 + lib/docker/models/spec.rb | 2266 +++++++++ lib/docker/models/summary.rb | 752 +++ lib/docker/models/system_info_params.rb | 14 + lib/docker/models/system_info_response.rb | 1863 +++++++ lib/docker/models/system_ping_params.rb | 14 + lib/docker/models/system_ping_response.rb | 7 + lib/docker/models/system_version_params.rb | 14 + lib/docker/models/system_version_response.rb | 164 + lib/docker/models/volume.rb | 639 +++ lib/docker/models/volume_create_params.rb | 14 + lib/docker/models/volume_delete_params.rb | 22 + lib/docker/models/volume_inspect_params.rb | 14 + lib/docker/models/volume_list_params.rb | 34 + lib/docker/models/volume_list_response.rb | 30 + lib/docker/request_options.rb | 77 + lib/docker/resources/auth.rb | 38 + lib/docker/resources/containers.rb | 258 + lib/docker/resources/images.rb | 156 + lib/docker/resources/networks.rb | 139 + lib/docker/resources/services.rb | 113 + lib/docker/resources/system.rb | 70 + lib/docker/resources/volumes.rb | 105 + lib/docker/version.rb | 5 + manifest.yaml | 17 + rbi/docker/client.rbi | 56 + rbi/docker/errors.rbi | 205 + rbi/docker/file_part.rbi | 37 + rbi/docker/internal.rbi | 16 + rbi/docker/internal/transport/base_client.rbi | 292 ++ .../transport/pooled_net_requester.rbi | 82 + rbi/docker/internal/type/array_of.rbi | 104 + rbi/docker/internal/type/base_model.rbi | 299 ++ rbi/docker/internal/type/base_page.rbi | 42 + rbi/docker/internal/type/boolean.rbi | 58 + rbi/docker/internal/type/converter.rbi | 204 + rbi/docker/internal/type/enum.rbi | 82 + rbi/docker/internal/type/file_input.rbi | 59 + rbi/docker/internal/type/hash_of.rbi | 104 + .../internal/type/request_parameters.rbi | 29 + rbi/docker/internal/type/union.rbi | 126 + rbi/docker/internal/type/unknown.rbi | 58 + rbi/docker/internal/util.rbi | 484 ++ rbi/docker/models.rbi | 83 + rbi/docker/models/auth_login_params.rbi | 62 + rbi/docker/models/auth_response.rbi | 37 + rbi/docker/models/config.rbi | 434 ++ rbi/docker/models/container.rbi | 4422 ++++++++++++++++ rbi/docker/models/container_create_params.rbi | 3287 ++++++++++++ rbi/docker/models/container_delete_params.rbi | 68 + .../models/container_inspect_params.rbi | 43 + rbi/docker/models/container_kill_params.rbi | 43 + rbi/docker/models/container_list_params.rbi | 121 + rbi/docker/models/container_list_response.rbi | 11 + rbi/docker/models/container_logs_params.rbi | 114 + rbi/docker/models/container_start_params.rbi | 47 + rbi/docker/models/container_stop_params.rbi | 57 + rbi/docker/models/create_request.rbi | 695 +++ rbi/docker/models/create_response.rbi | 36 + rbi/docker/models/error.rbi | 25 + rbi/docker/models/image.rbi | 2239 +++++++++ rbi/docker/models/image_delete_params.rbi | 72 + rbi/docker/models/image_delete_response.rbi | 52 + rbi/docker/models/image_inspect_params.rbi | 43 + rbi/docker/models/image_list_params.rbi | 112 + rbi/docker/models/image_list_response.rbi | 11 + rbi/docker/models/image_pull_params.rbi | 186 + rbi/docker/models/network.rbi | 405 ++ rbi/docker/models/network_create_params.rbi | 354 ++ rbi/docker/models/network_create_response.rbi | 37 + rbi/docker/models/network_delete_params.rbi | 27 + rbi/docker/models/network_inspect_params.rbi | 57 + .../models/network_inspect_response.rbi | 320 ++ rbi/docker/models/network_list_params.rbi | 73 + rbi/docker/models/network_list_response.rbi | 11 + rbi/docker/models/service.rbi | 999 ++++ rbi/docker/models/service_create_params.rbi | 71 + rbi/docker/models/service_create_response.rbi | 50 + rbi/docker/models/service_delete_params.rbi | 27 + rbi/docker/models/service_inspect_params.rbi | 46 + rbi/docker/models/service_list_params.rbi | 73 + rbi/docker/models/service_list_response.rbi | 11 + rbi/docker/models/spec.rbi | 4456 +++++++++++++++++ rbi/docker/models/summary.rbi | 1244 +++++ rbi/docker/models/system_info_params.rbi | 27 + rbi/docker/models/system_info_response.rbi | 3523 +++++++++++++ rbi/docker/models/system_ping_params.rbi | 27 + rbi/docker/models/system_ping_response.rbi | 7 + rbi/docker/models/system_version_params.rbi | 27 + rbi/docker/models/system_version_response.rbi | 272 + rbi/docker/models/volume.rbi | 1187 +++++ rbi/docker/models/volume_create_params.rbi | 27 + rbi/docker/models/volume_delete_params.rbi | 43 + rbi/docker/models/volume_inspect_params.rbi | 27 + rbi/docker/models/volume_list_params.rbi | 61 + rbi/docker/models/volume_list_response.rbi | 49 + rbi/docker/request_options.rbi | 55 + rbi/docker/resources/auth.rbi | 30 + rbi/docker/resources/containers.rbi | 231 + rbi/docker/resources/images.rbi | 164 + rbi/docker/resources/networks.rbi | 130 + rbi/docker/resources/services.rbi | 85 + rbi/docker/resources/system.rbi | 38 + rbi/docker/resources/volumes.rbi | 80 + rbi/docker/version.rbi | 5 + release-please-config.json | 70 + scripts/bootstrap | 24 + scripts/fast-format | 18 + scripts/format | 9 + scripts/lint | 9 + scripts/mock | 41 + scripts/test | 56 + sig/docker/client.rbs | 33 + sig/docker/errors.rbs | 117 + sig/docker/file_part.rbs | 21 + sig/docker/internal.rbs | 9 + sig/docker/internal/transport/base_client.rbs | 131 + .../transport/pooled_net_requester.rbs | 48 + sig/docker/internal/type/array_of.rbs | 48 + sig/docker/internal/type/base_model.rbs | 102 + sig/docker/internal/type/base_page.rbs | 24 + sig/docker/internal/type/boolean.rbs | 26 + sig/docker/internal/type/converter.rbs | 79 + sig/docker/internal/type/enum.rbs | 32 + sig/docker/internal/type/file_input.rbs | 25 + sig/docker/internal/type/hash_of.rbs | 48 + .../internal/type/request_parameters.rbs | 17 + sig/docker/internal/type/union.rbs | 52 + sig/docker/internal/type/unknown.rbs | 26 + sig/docker/internal/util.rbs | 185 + sig/docker/models.rbs | 81 + sig/docker/models/auth_login_params.rbs | 38 + sig/docker/models/auth_response.rbs | 17 + sig/docker/models/config.rbs | 225 + sig/docker/models/container.rbs | 1969 ++++++++ sig/docker/models/container_create_params.rbs | 1352 +++++ sig/docker/models/container_delete_params.rbs | 38 + .../models/container_inspect_params.rbs | 22 + sig/docker/models/container_kill_params.rbs | 25 + sig/docker/models/container_list_params.rbs | 44 + sig/docker/models/container_list_response.rbs | 7 + sig/docker/models/container_logs_params.rbs | 70 + sig/docker/models/container_start_params.rbs | 25 + sig/docker/models/container_stop_params.rbs | 32 + sig/docker/models/create_request.rbs | 255 + sig/docker/models/create_response.rbs | 15 + sig/docker/models/error.rbs | 13 + sig/docker/models/image.rbs | 1032 ++++ sig/docker/models/image_delete_params.rbs | 38 + sig/docker/models/image_delete_response.rbs | 24 + sig/docker/models/image_inspect_params.rbs | 25 + sig/docker/models/image_list_params.rbs | 56 + sig/docker/models/image_list_response.rbs | 7 + sig/docker/models/image_pull_params.rbs | 84 + sig/docker/models/network.rbs | 236 + sig/docker/models/network_create_params.rbs | 203 + sig/docker/models/network_create_response.rbs | 15 + sig/docker/models/network_delete_params.rbs | 15 + sig/docker/models/network_inspect_params.rbs | 32 + .../models/network_inspect_response.rbs | 149 + sig/docker/models/network_list_params.rbs | 25 + sig/docker/models/network_list_response.rbs | 7 + sig/docker/models/service.rbs | 467 ++ sig/docker/models/service_create_params.rbs | 38 + sig/docker/models/service_create_response.rbs | 17 + sig/docker/models/service_delete_params.rbs | 15 + sig/docker/models/service_inspect_params.rbs | 25 + sig/docker/models/service_list_params.rbs | 32 + sig/docker/models/service_list_response.rbs | 7 + sig/docker/models/spec.rbs | 1984 ++++++++ sig/docker/models/summary.rbs | 630 +++ sig/docker/models/system_info_params.rbs | 14 + sig/docker/models/system_info_response.rbs | 1380 +++++ sig/docker/models/system_ping_params.rbs | 14 + sig/docker/models/system_ping_response.rbs | 5 + sig/docker/models/system_version_params.rbs | 15 + sig/docker/models/system_version_response.rbs | 127 + sig/docker/models/volume.rbs | 478 ++ sig/docker/models/volume_create_params.rbs | 15 + sig/docker/models/volume_delete_params.rbs | 22 + sig/docker/models/volume_inspect_params.rbs | 15 + sig/docker/models/volume_list_params.rbs | 25 + sig/docker/models/volume_list_response.rbs | 26 + sig/docker/request_options.rbs | 34 + sig/docker/resources/auth.rbs | 14 + sig/docker/resources/containers.rbs | 67 + sig/docker/resources/images.rbs | 43 + sig/docker/resources/networks.rbs | 38 + sig/docker/resources/services.rbs | 27 + sig/docker/resources/system.rbs | 17 + sig/docker/resources/volumes.rbs | 28 + sig/docker/version.rbs | 3 + sorbet/config | 2 + sorbet/rbi/.gitignore | 2 + test/docker/client_test.rb | 286 ++ test/docker/file_part_test.rb | 13 + .../internal/sorbet_runtime_support_test.rb | 52 + test/docker/internal/type/base_model_test.rb | 727 +++ test/docker/internal/util_test.rb | 675 +++ test/docker/resource_namespaces.rb | 8 + test/docker/resources/auth_test.rb | 22 + test/docker/resources/containers_test.rb | 124 + test/docker/resources/images_test.rb | 68 + test/docker/resources/networks_test.rb | 52 + test/docker/resources/services_test.rb | 66 + test/docker/resources/shared_test.rb | 6 + test/docker/resources/system_test.rb | 119 + test/docker/resources/volumes_test.rb | 82 + test/docker/test_helper.rb | 87 + 288 files changed, 65293 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish-gem.yml create mode 100644 .github/workflows/release-doctor.yml create mode 100644 .gitignore create mode 100644 .release-please-manifest.json create mode 100644 .rubocop.yml create mode 100644 .ruby-version create mode 100644 .solargraph.yml create mode 100644 .stats.yml create mode 100644 .yardopts create mode 100644 CONTRIBUTING.md create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 LICENSE create mode 100644 Rakefile create mode 100644 SECURITY.md create mode 100644 Steepfile create mode 100644 bin/check-release-environment create mode 100644 bin/publish-gem create mode 100644 docker.gemspec create mode 100644 examples/.keep create mode 100644 lib/docker.rb create mode 100644 lib/docker/client.rb create mode 100644 lib/docker/errors.rb create mode 100644 lib/docker/file_part.rb create mode 100644 lib/docker/internal.rb create mode 100644 lib/docker/internal/transport/base_client.rb create mode 100644 lib/docker/internal/transport/pooled_net_requester.rb create mode 100644 lib/docker/internal/type/array_of.rb create mode 100644 lib/docker/internal/type/base_model.rb create mode 100644 lib/docker/internal/type/base_page.rb create mode 100644 lib/docker/internal/type/boolean.rb create mode 100644 lib/docker/internal/type/converter.rb create mode 100644 lib/docker/internal/type/enum.rb create mode 100644 lib/docker/internal/type/file_input.rb create mode 100644 lib/docker/internal/type/hash_of.rb create mode 100644 lib/docker/internal/type/request_parameters.rb create mode 100644 lib/docker/internal/type/union.rb create mode 100644 lib/docker/internal/type/unknown.rb create mode 100644 lib/docker/internal/util.rb create mode 100644 lib/docker/models.rb create mode 100644 lib/docker/models/auth_login_params.rb create mode 100644 lib/docker/models/auth_response.rb create mode 100644 lib/docker/models/config.rb create mode 100644 lib/docker/models/container.rb create mode 100644 lib/docker/models/container_create_params.rb create mode 100644 lib/docker/models/container_delete_params.rb create mode 100644 lib/docker/models/container_inspect_params.rb create mode 100644 lib/docker/models/container_kill_params.rb create mode 100644 lib/docker/models/container_list_params.rb create mode 100644 lib/docker/models/container_list_response.rb create mode 100644 lib/docker/models/container_logs_params.rb create mode 100644 lib/docker/models/container_start_params.rb create mode 100644 lib/docker/models/container_stop_params.rb create mode 100644 lib/docker/models/create_request.rb create mode 100644 lib/docker/models/create_response.rb create mode 100644 lib/docker/models/error.rb create mode 100644 lib/docker/models/image.rb create mode 100644 lib/docker/models/image_delete_params.rb create mode 100644 lib/docker/models/image_delete_response.rb create mode 100644 lib/docker/models/image_inspect_params.rb create mode 100644 lib/docker/models/image_list_params.rb create mode 100644 lib/docker/models/image_list_response.rb create mode 100644 lib/docker/models/image_pull_params.rb create mode 100644 lib/docker/models/network.rb create mode 100644 lib/docker/models/network_create_params.rb create mode 100644 lib/docker/models/network_create_response.rb create mode 100644 lib/docker/models/network_delete_params.rb create mode 100644 lib/docker/models/network_inspect_params.rb create mode 100644 lib/docker/models/network_inspect_response.rb create mode 100644 lib/docker/models/network_list_params.rb create mode 100644 lib/docker/models/network_list_response.rb create mode 100644 lib/docker/models/service.rb create mode 100644 lib/docker/models/service_create_params.rb create mode 100644 lib/docker/models/service_create_response.rb create mode 100644 lib/docker/models/service_delete_params.rb create mode 100644 lib/docker/models/service_inspect_params.rb create mode 100644 lib/docker/models/service_list_params.rb create mode 100644 lib/docker/models/service_list_response.rb create mode 100644 lib/docker/models/spec.rb create mode 100644 lib/docker/models/summary.rb create mode 100644 lib/docker/models/system_info_params.rb create mode 100644 lib/docker/models/system_info_response.rb create mode 100644 lib/docker/models/system_ping_params.rb create mode 100644 lib/docker/models/system_ping_response.rb create mode 100644 lib/docker/models/system_version_params.rb create mode 100644 lib/docker/models/system_version_response.rb create mode 100644 lib/docker/models/volume.rb create mode 100644 lib/docker/models/volume_create_params.rb create mode 100644 lib/docker/models/volume_delete_params.rb create mode 100644 lib/docker/models/volume_inspect_params.rb create mode 100644 lib/docker/models/volume_list_params.rb create mode 100644 lib/docker/models/volume_list_response.rb create mode 100644 lib/docker/request_options.rb create mode 100644 lib/docker/resources/auth.rb create mode 100644 lib/docker/resources/containers.rb create mode 100644 lib/docker/resources/images.rb create mode 100644 lib/docker/resources/networks.rb create mode 100644 lib/docker/resources/services.rb create mode 100644 lib/docker/resources/system.rb create mode 100644 lib/docker/resources/volumes.rb create mode 100644 lib/docker/version.rb create mode 100644 manifest.yaml create mode 100644 rbi/docker/client.rbi create mode 100644 rbi/docker/errors.rbi create mode 100644 rbi/docker/file_part.rbi create mode 100644 rbi/docker/internal.rbi create mode 100644 rbi/docker/internal/transport/base_client.rbi create mode 100644 rbi/docker/internal/transport/pooled_net_requester.rbi create mode 100644 rbi/docker/internal/type/array_of.rbi create mode 100644 rbi/docker/internal/type/base_model.rbi create mode 100644 rbi/docker/internal/type/base_page.rbi create mode 100644 rbi/docker/internal/type/boolean.rbi create mode 100644 rbi/docker/internal/type/converter.rbi create mode 100644 rbi/docker/internal/type/enum.rbi create mode 100644 rbi/docker/internal/type/file_input.rbi create mode 100644 rbi/docker/internal/type/hash_of.rbi create mode 100644 rbi/docker/internal/type/request_parameters.rbi create mode 100644 rbi/docker/internal/type/union.rbi create mode 100644 rbi/docker/internal/type/unknown.rbi create mode 100644 rbi/docker/internal/util.rbi create mode 100644 rbi/docker/models.rbi create mode 100644 rbi/docker/models/auth_login_params.rbi create mode 100644 rbi/docker/models/auth_response.rbi create mode 100644 rbi/docker/models/config.rbi create mode 100644 rbi/docker/models/container.rbi create mode 100644 rbi/docker/models/container_create_params.rbi create mode 100644 rbi/docker/models/container_delete_params.rbi create mode 100644 rbi/docker/models/container_inspect_params.rbi create mode 100644 rbi/docker/models/container_kill_params.rbi create mode 100644 rbi/docker/models/container_list_params.rbi create mode 100644 rbi/docker/models/container_list_response.rbi create mode 100644 rbi/docker/models/container_logs_params.rbi create mode 100644 rbi/docker/models/container_start_params.rbi create mode 100644 rbi/docker/models/container_stop_params.rbi create mode 100644 rbi/docker/models/create_request.rbi create mode 100644 rbi/docker/models/create_response.rbi create mode 100644 rbi/docker/models/error.rbi create mode 100644 rbi/docker/models/image.rbi create mode 100644 rbi/docker/models/image_delete_params.rbi create mode 100644 rbi/docker/models/image_delete_response.rbi create mode 100644 rbi/docker/models/image_inspect_params.rbi create mode 100644 rbi/docker/models/image_list_params.rbi create mode 100644 rbi/docker/models/image_list_response.rbi create mode 100644 rbi/docker/models/image_pull_params.rbi create mode 100644 rbi/docker/models/network.rbi create mode 100644 rbi/docker/models/network_create_params.rbi create mode 100644 rbi/docker/models/network_create_response.rbi create mode 100644 rbi/docker/models/network_delete_params.rbi create mode 100644 rbi/docker/models/network_inspect_params.rbi create mode 100644 rbi/docker/models/network_inspect_response.rbi create mode 100644 rbi/docker/models/network_list_params.rbi create mode 100644 rbi/docker/models/network_list_response.rbi create mode 100644 rbi/docker/models/service.rbi create mode 100644 rbi/docker/models/service_create_params.rbi create mode 100644 rbi/docker/models/service_create_response.rbi create mode 100644 rbi/docker/models/service_delete_params.rbi create mode 100644 rbi/docker/models/service_inspect_params.rbi create mode 100644 rbi/docker/models/service_list_params.rbi create mode 100644 rbi/docker/models/service_list_response.rbi create mode 100644 rbi/docker/models/spec.rbi create mode 100644 rbi/docker/models/summary.rbi create mode 100644 rbi/docker/models/system_info_params.rbi create mode 100644 rbi/docker/models/system_info_response.rbi create mode 100644 rbi/docker/models/system_ping_params.rbi create mode 100644 rbi/docker/models/system_ping_response.rbi create mode 100644 rbi/docker/models/system_version_params.rbi create mode 100644 rbi/docker/models/system_version_response.rbi create mode 100644 rbi/docker/models/volume.rbi create mode 100644 rbi/docker/models/volume_create_params.rbi create mode 100644 rbi/docker/models/volume_delete_params.rbi create mode 100644 rbi/docker/models/volume_inspect_params.rbi create mode 100644 rbi/docker/models/volume_list_params.rbi create mode 100644 rbi/docker/models/volume_list_response.rbi create mode 100644 rbi/docker/request_options.rbi create mode 100644 rbi/docker/resources/auth.rbi create mode 100644 rbi/docker/resources/containers.rbi create mode 100644 rbi/docker/resources/images.rbi create mode 100644 rbi/docker/resources/networks.rbi create mode 100644 rbi/docker/resources/services.rbi create mode 100644 rbi/docker/resources/system.rbi create mode 100644 rbi/docker/resources/volumes.rbi create mode 100644 rbi/docker/version.rbi create mode 100644 release-please-config.json create mode 100755 scripts/bootstrap create mode 100755 scripts/fast-format create mode 100755 scripts/format create mode 100755 scripts/lint create mode 100755 scripts/mock create mode 100755 scripts/test create mode 100644 sig/docker/client.rbs create mode 100644 sig/docker/errors.rbs create mode 100644 sig/docker/file_part.rbs create mode 100644 sig/docker/internal.rbs create mode 100644 sig/docker/internal/transport/base_client.rbs create mode 100644 sig/docker/internal/transport/pooled_net_requester.rbs create mode 100644 sig/docker/internal/type/array_of.rbs create mode 100644 sig/docker/internal/type/base_model.rbs create mode 100644 sig/docker/internal/type/base_page.rbs create mode 100644 sig/docker/internal/type/boolean.rbs create mode 100644 sig/docker/internal/type/converter.rbs create mode 100644 sig/docker/internal/type/enum.rbs create mode 100644 sig/docker/internal/type/file_input.rbs create mode 100644 sig/docker/internal/type/hash_of.rbs create mode 100644 sig/docker/internal/type/request_parameters.rbs create mode 100644 sig/docker/internal/type/union.rbs create mode 100644 sig/docker/internal/type/unknown.rbs create mode 100644 sig/docker/internal/util.rbs create mode 100644 sig/docker/models.rbs create mode 100644 sig/docker/models/auth_login_params.rbs create mode 100644 sig/docker/models/auth_response.rbs create mode 100644 sig/docker/models/config.rbs create mode 100644 sig/docker/models/container.rbs create mode 100644 sig/docker/models/container_create_params.rbs create mode 100644 sig/docker/models/container_delete_params.rbs create mode 100644 sig/docker/models/container_inspect_params.rbs create mode 100644 sig/docker/models/container_kill_params.rbs create mode 100644 sig/docker/models/container_list_params.rbs create mode 100644 sig/docker/models/container_list_response.rbs create mode 100644 sig/docker/models/container_logs_params.rbs create mode 100644 sig/docker/models/container_start_params.rbs create mode 100644 sig/docker/models/container_stop_params.rbs create mode 100644 sig/docker/models/create_request.rbs create mode 100644 sig/docker/models/create_response.rbs create mode 100644 sig/docker/models/error.rbs create mode 100644 sig/docker/models/image.rbs create mode 100644 sig/docker/models/image_delete_params.rbs create mode 100644 sig/docker/models/image_delete_response.rbs create mode 100644 sig/docker/models/image_inspect_params.rbs create mode 100644 sig/docker/models/image_list_params.rbs create mode 100644 sig/docker/models/image_list_response.rbs create mode 100644 sig/docker/models/image_pull_params.rbs create mode 100644 sig/docker/models/network.rbs create mode 100644 sig/docker/models/network_create_params.rbs create mode 100644 sig/docker/models/network_create_response.rbs create mode 100644 sig/docker/models/network_delete_params.rbs create mode 100644 sig/docker/models/network_inspect_params.rbs create mode 100644 sig/docker/models/network_inspect_response.rbs create mode 100644 sig/docker/models/network_list_params.rbs create mode 100644 sig/docker/models/network_list_response.rbs create mode 100644 sig/docker/models/service.rbs create mode 100644 sig/docker/models/service_create_params.rbs create mode 100644 sig/docker/models/service_create_response.rbs create mode 100644 sig/docker/models/service_delete_params.rbs create mode 100644 sig/docker/models/service_inspect_params.rbs create mode 100644 sig/docker/models/service_list_params.rbs create mode 100644 sig/docker/models/service_list_response.rbs create mode 100644 sig/docker/models/spec.rbs create mode 100644 sig/docker/models/summary.rbs create mode 100644 sig/docker/models/system_info_params.rbs create mode 100644 sig/docker/models/system_info_response.rbs create mode 100644 sig/docker/models/system_ping_params.rbs create mode 100644 sig/docker/models/system_ping_response.rbs create mode 100644 sig/docker/models/system_version_params.rbs create mode 100644 sig/docker/models/system_version_response.rbs create mode 100644 sig/docker/models/volume.rbs create mode 100644 sig/docker/models/volume_create_params.rbs create mode 100644 sig/docker/models/volume_delete_params.rbs create mode 100644 sig/docker/models/volume_inspect_params.rbs create mode 100644 sig/docker/models/volume_list_params.rbs create mode 100644 sig/docker/models/volume_list_response.rbs create mode 100644 sig/docker/request_options.rbs create mode 100644 sig/docker/resources/auth.rbs create mode 100644 sig/docker/resources/containers.rbs create mode 100644 sig/docker/resources/images.rbs create mode 100644 sig/docker/resources/networks.rbs create mode 100644 sig/docker/resources/services.rbs create mode 100644 sig/docker/resources/system.rbs create mode 100644 sig/docker/resources/volumes.rbs create mode 100644 sig/docker/version.rbs create mode 100644 sorbet/config create mode 100644 sorbet/rbi/.gitignore create mode 100644 test/docker/client_test.rb create mode 100644 test/docker/file_part_test.rb create mode 100644 test/docker/internal/sorbet_runtime_support_test.rb create mode 100644 test/docker/internal/type/base_model_test.rb create mode 100644 test/docker/internal/util_test.rb create mode 100644 test/docker/resource_namespaces.rb create mode 100644 test/docker/resources/auth_test.rb create mode 100644 test/docker/resources/containers_test.rb create mode 100644 test/docker/resources/images_test.rb create mode 100644 test/docker/resources/networks_test.rb create mode 100644 test/docker/resources/services_test.rb create mode 100644 test/docker/resources/shared_test.rb create mode 100644 test/docker/resources/system_test.rb create mode 100644 test/docker/resources/volumes_test.rb create mode 100644 test/docker/test_helper.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f39b22b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: CI +on: + push: + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'stl-preview-head/**' + - 'stl-preview-base/**' + pull_request: + branches-ignore: + - 'stl-preview-head/**' + - 'stl-preview-base/**' + +jobs: + lint: + timeout-minutes: 10 + name: lint + runs-on: ${{ github.repository == 'stainless-sdks/docker-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + + steps: + - uses: actions/checkout@v6 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: false + - run: |- + bundle install + + - name: Run lints + run: ./scripts/lint + test: + timeout-minutes: 10 + name: test + runs-on: ${{ github.repository == 'stainless-sdks/docker-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + steps: + - uses: actions/checkout@v6 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: false + - run: |- + bundle install + + - name: Run tests + run: ./scripts/test diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml new file mode 100644 index 0000000..99a2a84 --- /dev/null +++ b/.github/workflows/publish-gem.yml @@ -0,0 +1,31 @@ +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to rubygems.org in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/Hexlet/docker-ruby/actions/workflows/publish-gem.yml +name: Publish Gem +on: + workflow_dispatch: + + release: + types: [published] + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: false + - run: |- + bundle install + + - name: Publish to RubyGems.org + run: | + bash ./bin/publish-gem + env: + # `RUBYGEMS_HOST` is only required for private gem repositories, not https://rubygems.org + RUBYGEMS_HOST: ${{ secrets.DOCKER_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }} + GEM_HOST_API_KEY: ${{ secrets.DOCKER_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 0000000..7fbbe9e --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,22 @@ +name: Release Doctor +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + runs-on: ubuntu-latest + if: github.repository == 'Hexlet/docker-ruby' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + + steps: + - uses: actions/checkout@v6 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + RUBYGEMS_HOST: ${{ secrets.DOCKER_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }} + GEM_HOST_API_KEY: ${{ secrets.DOCKER_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3d26cee --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +*.gem +.idea/ +.ignore +.prism.log +.ruby-lsp/ +.yardoc/ +bin/tapioca +Brewfile.lock.json +doc/ +sorbet/tapioca/* diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..1332969 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1" +} \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..7e3ba11 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,296 @@ +# yaml-language-server: $schema=https://www.rubyschema.org/rubocop.json +--- +# Explicitly disable pending cops for now. This is the default behaviour but +# this avoids a large warning every time we run it. +# Stop RuboCop nagging about rubocop-rake. +# Ensure that RuboCop validates according to the lowest version of Ruby that we support. +AllCops: + Exclude: + - "bin/*" + NewCops: enable + SuggestExtensions: false + TargetRubyVersion: 3.2 + +# Whether MFA is required or not should be left to the token configuration. +Gemspec/RequireMFA: + Enabled: false + +# Don't require this extra line break, it can be excessive. +Layout/EmptyLineAfterGuardClause: + Enabled: false + +# Don't leave complex assignment values hanging off to the right. +Layout/EndAlignment: + EnforcedStyleAlignWith: variable + +Layout/FirstArrayElementLineBreak: + Enabled: true + +Layout/FirstHashElementLineBreak: + Enabled: true + +Layout/FirstMethodArgumentLineBreak: + Enabled: true + +Layout/FirstMethodParameterLineBreak: + Enabled: true + +# Set a reasonable line length; rely on other cops to correct long lines. +Layout/LineLength: + AllowedPatterns: + - "^\\s*#.*$" + - ^require(_relative)? + - "Docker::Internal::Type::BaseModel$" + - "^\\s*[A-Z0-9_]+ = :" + - "Docker::(Models|Resources|Test)::" + Max: 110 + +Layout/MultilineArrayLineBreaks: + Enabled: true + +# Start the assignment on the same line variable is mentioned. +Layout/MultilineAssignmentLayout: + EnforcedStyle: same_line + +Layout/MultilineHashKeyLineBreaks: + Enabled: true + +Layout/MultilineMethodArgumentLineBreaks: + Enabled: true + +Layout/MultilineMethodParameterLineBreaks: + Enabled: true + +# Prefer compact hash literals. +Layout/SpaceInsideHashLiteralBraces: + EnforcedStyle: no_space + Exclude: + - "**/*.rbi" + +Lint/BooleanSymbol: + Enabled: false + +# This option occasionally mangles identifier names +Lint/DeprecatedConstants: + Exclude: + - "**/*.rbi" + +# We use pattern assertion in tests to ensure correctness. +Lint/DuplicateMatchPattern: + Exclude: + - "test/**/*" + +# Fairly useful in tests for pattern assertions. +Lint/EmptyInPattern: + Exclude: + - "test/**/*" + +Lint/MissingCopEnableDirective: + Exclude: + - "examples/**/*.rb" + +Lint/MissingSuper: + Exclude: + - "**/*.rbi" + +Lint/SymbolConversion: + Exclude: + - "**/*.rbi" + +# Disabled for safety reasons, this option changes code semantics. +Lint/UnusedMethodArgument: + AutoCorrect: false + +# This option is prone to causing accidental bugs. +Lint/UselessAssignment: + AutoCorrect: false + Exclude: + - "examples/**/*.rb" + +Metrics/AbcSize: + Enabled: false + +Metrics/BlockLength: + AllowedPatterns: + - assert_pattern + - type_alias + - define_sorbet_constant! + Exclude: + - "**/*.rbi" + +Metrics/ClassLength: + Enabled: false + +Metrics/CollectionLiteralLength: + Exclude: + - "test/**/*" + +Metrics/CyclomaticComplexity: + Enabled: false + +Metrics/MethodLength: + Enabled: false + +Metrics/ModuleLength: + Enabled: false + +Metrics/ParameterLists: + Enabled: false + +Metrics/PerceivedComplexity: + Enabled: false + +Naming/AccessorMethodName: + Enabled: false + +# Need to preserve block identifier for documentation. +Naming/BlockForwarding: + Enabled: false + +# Underscores are generally useful for disambiguation. +Naming/ClassAndModuleCamelCase: + Enabled: false + +Naming/MethodParameterName: + Enabled: false + +Naming/PredicatePrefix: + Exclude: + - "**/*.rbi" + +Naming/VariableNumber: + Enabled: false + +# Nothing wrong with inline private methods. +Style/AccessModifierDeclarations: + Enabled: false + +Style/AccessorGrouping: + Exclude: + - "**/*.rbi" + +# Behaviour of alias_method is more predictable. +Style/Alias: + EnforcedStyle: prefer_alias_method + +# And/or have confusing precedence, avoid them. +Style/AndOr: + EnforcedStyle: always + +Style/ArgumentsForwarding: + Enabled: false + +Style/BisectedAttrAccessor: + Exclude: + - "**/*.rbi" + +# We prefer nested modules in lib/, but are currently using compact style for tests. +Style/ClassAndModuleChildren: + Exclude: + - "test/**/*" + +Style/CommentAnnotation: + Enabled: false + +# We should go back and add these docs, but ignore for now. +Style/Documentation: + Enabled: false + +# Allow explicit empty elses, for clarity. +Style/EmptyElse: + Enabled: false + +Style/EmptyMethod: + Exclude: + - "**/*.rbi" + +# We commonly use ENV['KEY'], it's OK. +Style/FetchEnvVar: + Enabled: false + +# Just to be safe, ensure nobody is mutating our internal strings. +Style/FrozenStringLiteralComment: + EnforcedStyle: always + Exclude: + - "**/*.rbi" + +# Nothing wrong with clear if statements. +Style/IfUnlessModifier: + Enabled: false + +# Rubocop is pretty bad about mangling single line lambdas. +Style/Lambda: + Enabled: false + +# Prefer consistency in method calling syntax. +Style/MethodCallWithArgsParentheses: + AllowedMethods: + - raise + Enabled: true + Exclude: + - "**/*.gemspec" + +Style/MultilineBlockChain: + Enabled: false + +# Perfectly fine. +Style/MultipleComparison: + Enabled: false + +Style/MutableConstant: + Exclude: + - "**/*.rbi" + +# Not all parameters should be named. +Style/NumberedParameters: + Enabled: false + +Style/NumberedParametersLimit: + Max: 2 + +# Reasonable to use brackets for errors with long messages. +Style/RaiseArgs: + Enabled: false + +# Be explicit about `RuntimeError`s. +Style/RedundantException: + Enabled: false + +Style/RedundantInitialize: + Exclude: + - "**/*.rbi" + +Style/RedundantParentheses: + Exclude: + - "**/*.rbi" + +# Prefer slashes for regex literals. +Style/RegexpLiteral: + EnforcedStyle: slashes + +# Allow explicit ifs, especially for imperative use. +Style/SafeNavigation: + Enabled: false + +Style/SignalException: + Exclude: + - Rakefile + - "**/*.rake" + +# We use these sparingly, where we anticipate future branches for the +# inner conditional. +Style/SoleNestedConditional: + Enabled: false + +# Prefer double quotes so that interpolation can be easily added. +Style/StringLiterals: + EnforcedStyle: double_quotes + +# Prefer explicit symbols for clarity; you can search for `:the_symbol`. +Style/SymbolArray: + EnforcedStyle: brackets + +# This option makes examples harder to read for ruby novices. +Style/SymbolProc: + Exclude: + - "examples/**/*.rb" diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..944880f --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.0 diff --git a/.solargraph.yml b/.solargraph.yml new file mode 100644 index 0000000..f6b4f15 --- /dev/null +++ b/.solargraph.yml @@ -0,0 +1,11 @@ +--- +max_files: 0 +include: + - '*.gemspec' + - 'Rakefile' + - 'examples/**/*.rb' + - 'lib/**/*.rb' + - 'test/docker/resource_namespaces.rb' + - 'test/docker/test_helper.rb' +exclude: + - 'rbi/**/*' diff --git a/.stats.yml b/.stats.yml new file mode 100644 index 0000000..b132ad5 --- /dev/null +++ b/.stats.yml @@ -0,0 +1,4 @@ +configured_endpoints: 28 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hexlet%2Fdocker-831637d06c77b321653e17824ad6b59ce6563420966569b6d0b160eadf26847d.yml +openapi_spec_hash: def40420cdc7605c5e680fea13454867 +config_hash: 1d5dcc7de2ba45bf32235f8bf8597e58 diff --git a/.yardopts b/.yardopts new file mode 100644 index 0000000..84c12f2 --- /dev/null +++ b/.yardopts @@ -0,0 +1,6 @@ +--type-name-tag generic:Generic +--default-return void +--markup markdown +--markup-provider redcarpet +--exclude /rbi +--exclude /sig diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5df090f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,125 @@ +## Setting up the environment + +This repository contains a `.ruby-version` file, which should work with either [rbenv](https://github.com/rbenv/rbenv) or [asdf](https://github.com/asdf-vm/asdf) with the [ruby plugin](https://github.com/asdf-vm/asdf-ruby). + +Please follow the instructions for your preferred version manager to install the Ruby version specified in the `.ruby-version` file. + +To set up the repository, run: + +```bash +$ ./scripts/bootstrap +``` + +This will install all the required dependencies. + +## Modifying/Adding code + +Most of the SDK is generated code. Modifications to code will be persisted between generations, but may result in merge conflicts between manual patches and changes from the generator. The generator will never modify the contents of `lib/docker/helpers/` and `examples/` directory. + +## Adding and running examples + +All files in the `examples/` directory are not modified by the generator and can be freely edited or added to. + +```ruby +#!/usr/bin/env ruby +# frozen_string_literal: true + +require_relative "../lib/docker" + +# ... +``` + +```bash +$ chmod +x './examples/.rb' + +# run the example against your api +$ ruby './examples/.rb' +``` + +## Using the repository from source + +If you’d like to use the repository from source, you can either install from git or reference a cloned repository: + +To install via git in your `Gemfile`: + +```ruby +gem "docker", git: "https://github.com/Hexlet/docker-ruby" +``` + +Alternatively, reference local copy of the repo: + +```bash +$ git clone -- 'https://github.com/Hexlet/docker-ruby' '' +``` + +```ruby +gem "docker", path: "" +``` + +## Running commands + +Running `rake` by itself will show all runnable commands. + +```bash +$ bundle exec rake +``` + +## Running tests + +Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. + +```bash +$ npx prism mock path/to/your/openapi.yml +``` + +```bash +$ bundle exec rake test +``` + +## Linting and formatting + +This repository uses [rubocop](https://github.com/rubocop/rubocop) for linting and formatting of `*.rb` files; And [syntax_tree](https://github.com/ruby-syntax-tree/syntax_tree) is used for formatting of both `*.rbi` and `*.rbs` files. + +There are two separate type checkers supported by this library: [sorbet](https://github.com/sorbet/sorbet) and [steep](https://github.com/soutaro/steep) are used for verifying `*.rbi` and `*.rbs` files respectively. + +To lint and typecheck: + +```bash +$ bundle exec rake lint +``` + +To format and fix all lint issues automatically: + +```bash +$ bundle exec rake format +``` + +## Editor Support + +### Ruby LSP + +[Ruby LSP](https://github.com/Shopify/ruby-lsp) has quite good support for go to definition, but not auto-completion. + +This can be installed along side Solargraph. + +### Solargraph + +[Solargraph](https://solargraph.org) has quite good support for auto-completion, but not go to definition. + +This can be installed along side Ruby LSP. + +### Sorbet + +[Sorbet](https://sorbet.org) should mostly work out of the box when editing this library directly. However, there are a some caveats due to the colocation of `*.rb` and `*.rbi` files in the same project. These issues should not otherwise manifest when this library is used as a dependency. + +1. For go to definition usages, sorbet might get confused and may not always navigate to the correct location. + +2. For each generic type in `*.rbi` files, a spurious "Duplicate type member" error is present. + +## Documentation Preview + +To preview the documentation, run: + +```bash +$ bundle exec rake docs:preview [PORT=8808] +``` diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..1be178c --- /dev/null +++ b/Gemfile @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gemspec + +group :development do + gem "rake" + gem "rbs" + gem "rubocop" + gem "sorbet" + gem "steep" + gem "syntax_tree" + gem "syntax_tree-rbs", github: "ruby-syntax-tree/syntax_tree-rbs", branch: "main" + gem "tapioca" +end + +group :development, :test do + gem "async" + gem "minitest" + gem "minitest-focus" + gem "minitest-hooks" + gem "minitest-proveit" + gem "minitest-rg" + gem "webmock" +end + +group :development, :docs do + gem "redcarpet" + gem "webrick" + gem "yard" +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..5accc37 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,228 @@ +GIT + remote: https://github.com/ruby-syntax-tree/syntax_tree-rbs.git + revision: f94bc3060682ffbd126e4d5086ffedc89073d626 + branch: main + specs: + syntax_tree-rbs (1.0.0) + prettier_print + rbs + syntax_tree (>= 2.0.1) + +PATH + remote: . + specs: + docker (0.0.1) + cgi + connection_pool + +GEM + remote: https://rubygems.org/ + specs: + activesupport (8.1.1) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + json + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + ast (2.4.3) + async (2.34.0) + console (~> 1.29) + fiber-annotation + io-event (~> 1.11) + metrics (~> 0.12) + traces (~> 0.18) + base64 (0.3.0) + benchmark (0.5.0) + bigdecimal (3.3.1) + cgi (0.5.1) + concurrent-ruby (1.3.5) + connection_pool (2.5.4) + console (1.34.2) + fiber-annotation + fiber-local (~> 1.1) + json + crack (1.0.1) + bigdecimal + rexml + csv (3.3.5) + drb (2.2.3) + erubi (1.13.1) + ffi (1.17.2-aarch64-linux-gnu) + ffi (1.17.2-aarch64-linux-musl) + ffi (1.17.2-arm64-darwin) + ffi (1.17.2-x86_64-darwin) + ffi (1.17.2-x86_64-linux-gnu) + ffi (1.17.2-x86_64-linux-musl) + fiber-annotation (0.2.0) + fiber-local (1.1.0) + fiber-storage + fiber-storage (1.0.1) + fileutils (1.8.0) + hashdiff (1.2.1) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + io-event (1.11.2) + json (2.15.2) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + listen (3.9.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + logger (1.7.0) + metrics (0.15.0) + minitest (5.26.0) + minitest-focus (1.4.0) + minitest (>= 4, < 6) + minitest-hooks (1.5.2) + minitest (> 5.3) + minitest-proveit (1.0.0) + minitest (> 5, < 7) + minitest-rg (5.3.0) + minitest (~> 5.0) + mutex_m (0.3.0) + netrc (0.11.0) + parallel (1.27.0) + parser (3.3.10.0) + ast (~> 2.4.1) + racc + prettier_print (1.2.1) + prism (1.6.0) + public_suffix (6.0.2) + racc (1.8.1) + rainbow (3.1.1) + rake (13.3.1) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) + ffi (~> 1.0) + rbi (0.3.7) + prism (~> 1.0) + rbs (>= 3.4.4) + rbs (3.9.5) + logger + redcarpet (3.6.1) + regexp_parser (2.11.3) + rexml (3.4.4) + rubocop (1.81.7) + json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.47.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.47.1) + parser (>= 3.3.7.2) + prism (~> 1.4) + ruby-progressbar (1.13.0) + securerandom (0.4.1) + sorbet (0.6.12690) + sorbet-static (= 0.6.12690) + sorbet-runtime (0.6.12690) + sorbet-static (0.6.12690-aarch64-linux) + sorbet-static (0.6.12690-universal-darwin) + sorbet-static (0.6.12690-x86_64-linux) + sorbet-static-and-runtime (0.6.12690) + sorbet (= 0.6.12690) + sorbet-runtime (= 0.6.12690) + spoom (1.6.3) + erubi (>= 1.10.0) + prism (>= 0.28.0) + rbi (>= 0.3.3) + rexml (>= 3.2.6) + sorbet-static-and-runtime (>= 0.5.10187) + thor (>= 0.19.2) + steep (1.10.0) + activesupport (>= 5.1) + concurrent-ruby (>= 1.1.10) + csv (>= 3.0.9) + fileutils (>= 1.1.0) + json (>= 2.1.0) + language_server-protocol (>= 3.17.0.4, < 4.0) + listen (~> 3.0) + logger (>= 1.3.0) + mutex_m (>= 0.3.0) + parser (>= 3.1) + rainbow (>= 2.2.2, < 4.0) + rbs (~> 3.9) + securerandom (>= 0.1) + strscan (>= 1.0.0) + terminal-table (>= 2, < 5) + uri (>= 0.12.0) + strscan (3.1.5) + syntax_tree (6.3.0) + prettier_print (>= 1.2.0) + tapioca (0.16.11) + benchmark + bundler (>= 2.2.25) + netrc (>= 0.11.0) + parallel (>= 1.21.0) + rbi (~> 0.2) + sorbet-static-and-runtime (>= 0.5.11087) + spoom (>= 1.2.0) + thor (>= 1.2.0) + yard-sorbet + terminal-table (4.0.0) + unicode-display_width (>= 1.1.1, < 4) + thor (1.4.0) + traces (0.18.2) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) + uri (1.1.0) + webmock (3.26.1) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.1) + yard (0.9.37) + yard-sorbet (0.9.0) + sorbet-runtime + yard + +PLATFORMS + aarch64-linux + aarch64-linux-gnu + aarch64-linux-musl + arm64-darwin + universal-darwin + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + async + docker! + minitest + minitest-focus + minitest-hooks + minitest-proveit + minitest-rg + rake + rbs + redcarpet + rubocop + sorbet + steep + syntax_tree + syntax_tree-rbs! + tapioca + webmock + webrick + yard + +BUNDLED WITH + 2.4.1 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..45aaad9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2026 Docker + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index ec3d52f..e8b5211 100644 --- a/README.md +++ b/README.md @@ -1 +1,230 @@ -# docker-ruby \ No newline at end of file +# Docker Ruby API library + +The Docker Ruby library provides convenient access to the Docker REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/Hexlet/docker-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem. + +It is generated with [Stainless](https://www.stainless.com/). + +## Documentation + +Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/docker). + +The REST API documentation can be found on [docs.docker.com](https://docs.docker.com/engine/api/latest/). + +## Installation + +To use this gem, install via Bundler by adding the following to your application's `Gemfile`: + + + +```ruby +gem "docker", "~> 0.0.1" +``` + + + +## Usage + +```ruby +require "bundler/setup" +require "docker" + +docker = Docker::Client.new + +create_response = docker.containers.create(name: "sample-container") + +puts(create_response.Id) +``` + +### Handling errors + +When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Docker::Errors::APIError` will be thrown: + +```ruby +begin + container = docker.containers.list +rescue Docker::Errors::APIConnectionError => e + puts("The server could not be reached") + puts(e.cause) # an underlying Exception, likely raised within `net/http` +rescue Docker::Errors::RateLimitError => e + puts("A 429 status code was received; we should back off a bit.") +rescue Docker::Errors::APIStatusError => e + puts("Another non-200-range status code was received") + puts(e.status) +end +``` + +Error codes are as follows: + +| Cause | Error Type | +| ---------------- | -------------------------- | +| HTTP 400 | `BadRequestError` | +| HTTP 401 | `AuthenticationError` | +| HTTP 403 | `PermissionDeniedError` | +| HTTP 404 | `NotFoundError` | +| HTTP 409 | `ConflictError` | +| HTTP 422 | `UnprocessableEntityError` | +| HTTP 429 | `RateLimitError` | +| HTTP >= 500 | `InternalServerError` | +| Other HTTP error | `APIStatusError` | +| Timeout | `APITimeoutError` | +| Network error | `APIConnectionError` | + +### Retries + +Certain errors will be automatically retried 2 times by default, with a short exponential backoff. + +Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default. + +You can use the `max_retries` option to configure or disable this: + +```ruby +# Configure the default for all requests: +docker = Docker::Client.new( + max_retries: 0 # default is 2 +) + +# Or, configure per-request: +docker.containers.list(request_options: {max_retries: 5}) +``` + +### Timeouts + +By default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this: + +```ruby +# Configure the default for all requests: +docker = Docker::Client.new( + timeout: nil # default is 60 +) + +# Or, configure per-request: +docker.containers.list(request_options: {timeout: 5}) +``` + +On timeout, `Docker::Errors::APITimeoutError` is raised. + +Note that requests that time out are retried by default. + +## Advanced concepts + +### BaseModel + +All parameter and response objects inherit from `Docker::Internal::Type::BaseModel`, which provides several conveniences, including: + +1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax. + +2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true. + +3. Both instances and the classes themselves can be pretty-printed. + +4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`. + +### Making custom or undocumented requests + +#### Undocumented properties + +You can send undocumented parameters to any endpoint, and read undocumented response properties, like so: + +Note: the `extra_` parameters of the same name overrides the documented parameters. + +```ruby +summaries = + docker.containers.list( + request_options: { + extra_query: {my_query_parameter: value}, + extra_body: {my_body_parameter: value}, + extra_headers: {"my-header": value} + } + ) + +puts(summaries[:my_undocumented_property]) +``` + +#### Undocumented request params + +If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above. + +#### Undocumented endpoints + +To make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so: + +```ruby +response = client.request( + method: :post, + path: '/undocumented/endpoint', + query: {"dog": "woof"}, + headers: {"useful-header": "interesting-value"}, + body: {"hello": "world"} +) +``` + +### Concurrency & connection pooling + +The `Docker::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests. + +Each instance of `Docker::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings. + +When all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout. + +Unless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure. + +## Sorbet + +This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime. + +You can provide typesafe request parameters like so: + +```ruby +docker.containers.create(name: "sample-container") +``` + +Or, equivalently: + +```ruby +# Hashes work, but are not typesafe: +docker.containers.create(name: "sample-container") + +# You can also splat a full Params class: +params = Docker::ContainerCreateParams.new(name: "sample-container") +docker.containers.create(**params) +``` + +### Enums + +Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime: + +```ruby +# :created +puts(Docker::Summary::State::CREATED) + +# Revealed type: `T.all(Docker::Summary::State, Symbol)` +T.reveal_type(Docker::Summary::State::CREATED) +``` + +Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value: + +```ruby +Docker::Summary.new( + state: Docker::Summary::State::CREATED, + # … +) + +Docker::Summary.new( + state: :created, + # … +) +``` + +## Versioning + +This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time. + +This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes. + +## Requirements + +Ruby 3.2.0 or higher. + +## Contributing + +See [the contributing documentation](https://github.com/Hexlet/docker-ruby/tree/main/CONTRIBUTING.md). diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..da6cfc7 --- /dev/null +++ b/Rakefile @@ -0,0 +1,172 @@ +# frozen_string_literal: true + +require "pathname" +require "securerandom" +require "shellwords" + +require "minitest/test_task" +require "rake/clean" +require "rubocop/rake_task" + +tapioca = "sorbet/tapioca" +examples = "examples" +ignore_file = ".ignore" + +FILES_ENV = "FORMAT_FILE" + +CLEAN.push(*%w[.idea/ .ruby-lsp/ .yardoc/ doc/], *FileList["*.gem"], ignore_file) + +CLOBBER.push(*%w[sorbet/rbi/annotations/ sorbet/rbi/gems/], tapioca) + +multitask(:default) do + sh(*%w[rake --tasks]) +end + +desc("Preview docs; use `PORT=` to change the port") +multitask(:"docs:preview") do + sh(*%w[yard server --reload --quiet --bind [::] --port], ENV.fetch("PORT", "8808")) +end + +desc("Run test suites; use `TEST=path/to/test.rb` to run a specific test file") +multitask(:test) do + rb = + FileList[ENV.fetch("TEST", "./test/**/*_test.rb")] + .map { "require_relative(#{_1.dump});" } + .join + + ruby(*%w[-w -e], rb, verbose: false) { fail unless _1 } +end + +xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --] +ruby_opt = {"RUBYOPT" => [ENV["RUBYOPT"], "--encoding=UTF-8"].compact.join(" ")} + +filtered = ->(ext, dirs) do + if ENV.key?(FILES_ENV) + %w[sed -E -n -e] << "/\\.#{ext}$/p" << "--" << ENV.fetch(FILES_ENV) + else + (%w[find] + dirs + %w[-type f -and -name]) << "*.#{ext}" << "-print0" + end +end + +desc("Lint `*.rb(i)`") +multitask(:"lint:rubocop") do + find = %w[find ./lib ./test ./rbi ./examples -type f -and ( -name *.rb -or -name *.rbi ) -print0] + + rubocop = %w[rubocop] + rubocop += %w[--format github] if ENV.key?("CI") + + # some lines cannot be shortened + rubocop += %w[--except Lint/RedundantCopDisableDirective,Layout/LineLength] + + lint = xargs + rubocop + sh("#{find.shelljoin} | #{lint.shelljoin}") +end + +norm_lines = %w[tr -- \n \0].shelljoin + +desc("Format `*.rb`") +multitask(:"format:rb") do + # while `syntax_tree` is much faster than `rubocop`, `rubocop` is the only formatter with full syntax support + files = filtered["rb", %w[./lib ./test ./examples]] + fmt = xargs + %w[rubocop --fail-level F --autocorrect --format simple --] + sh("#{files.shelljoin} | #{norm_lines} | #{fmt.shelljoin}") +end + +desc("Format `*.rbi`") +multitask(:"format:rbi") do + files = filtered["rbi", %w[./rbi]] + fmt = xargs + %w[stree write --] + sh(ruby_opt, "#{files.shelljoin} | #{norm_lines} | #{fmt.shelljoin}") +end + +desc("Format `*.rbs`") +multitask(:"format:rbs") do + files = filtered["rbs", %w[./sig]] + inplace = /darwin|bsd/ =~ RUBY_PLATFORM ? ["-i", ""] : %w[-i] + uuid = SecureRandom.uuid + + # `syntax_tree` has trouble with `rbs`'s class & module aliases + + sed_bin = /darwin/ =~ RUBY_PLATFORM ? "/usr/bin/sed" : "sed" + sed = xargs + [sed_bin, "-E", *inplace, "-e"] + # annotate unprocessable aliases with a unique comment + pre = sed + ["s/(class|module) ([^ ]+) = (.+$)/# \\1 #{uuid}\\n\\2: \\3/", "--"] + fmt = xargs + %w[stree write --plugin=rbs --] + # remove the unique comment and unprocessable aliases to type aliases + subst = <<~SED + s/# (class|module) #{uuid}/\\1/ + t l1 + b + + : l1 + N + s/\\n *([^:]+): (.+)$/ \\1 = \\2/ + SED + # for each line: + # 1. try transform the unique comment into `class | module`, if successful, branch to label `l1`. + # 2. at label `l1`, join previously annotated line with `class | module` information. + pst = sed + [subst, "--"] + + success = false + + # transform class aliases to type aliases, which syntax tree has no trouble with + sh("#{files.shelljoin} | #{norm_lines} | #{pre.shelljoin}") + # run syntax tree to format `*.rbs` files + sh(ruby_opt, "#{files.shelljoin} | #{norm_lines} | #{fmt.shelljoin}") do + success = _1 + end + # transform type aliases back to class aliases + sh("#{files.shelljoin} | #{norm_lines} | #{pst.shelljoin}") + + # always run post-processing to remove comment marker + fail unless success +end + +desc("Format everything") +multitask(format: [:"format:rb", :"format:rbi", :"format:rbs"]) + +desc("Typecheck `*.rbs`") +multitask(:"typecheck:steep") do + sh(*%w[steep check]) +end + +directory(examples) + +desc("Typecheck `*.rbi`") +multitask("typecheck:sorbet": examples) do + sh(*%w[srb typecheck --dir], examples) +end + +directory(tapioca) do + sh(*%w[tapioca init]) +end + +desc("Typecheck everything") +multitask(typecheck: [:"typecheck:steep", :"typecheck:sorbet"]) + +desc("Lint and typecheck") +multitask(lint: [:"lint:rubocop", :typecheck]) + +desc("Build yard docs") +multitask(:"build:docs") do + sh(*%w[yard]) +end + +desc("Build ruby gem") +multitask(:"build:gem") do + # optimizing for grepping through the gem bundle: many tools honour `.ignore` files, including VSCode + # + # both `rbi` and `sig` directories are navigable by their respective tool chains and therefore can be ignored by tools such as `rg` + Pathname(ignore_file).write(<<~GLOB) + rbi/* + sig/* + GLOB + + sh(*%w[gem build -- docker.gemspec]) + rm_rf(ignore_file) +end + +desc("Release ruby gem") +multitask(release: [:"build:gem"]) do + sh(*%w[gem push], *FileList["*.gem"]) +end diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..fb270fc --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,27 @@ +# Security Policy + +## Reporting Security Issues + +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. + +To report a security issue, please contact the Stainless team at security@stainless.com. + +## Responsible Disclosure + +We appreciate the efforts of security researchers and individuals who help us maintain the security of +SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible +disclosure practices by allowing us a reasonable amount of time to investigate and address the issue +before making any information public. + +## Reporting Non-SDK Related Security Issues + +If you encounter security issues that are not directly related to SDKs but pertain to the services +or products provided by Docker, please follow the respective company's security reporting guidelines. + +### Docker Terms and Policies + +Please contact support@docker.com for any questions or concerns regarding the security of our services. + +--- + +Thank you for helping us keep the SDKs and systems they interact with secure. diff --git a/Steepfile b/Steepfile new file mode 100644 index 0000000..528b48c --- /dev/null +++ b/Steepfile @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "yaml" + +target(:lib) do + configure_code_diagnostics(Steep::Diagnostic::Ruby.strict) + + signature("sig") + + YAML.safe_load_file("./manifest.yaml", symbolize_names: true) => {dependencies:} + # currently these libraries lack the `*.rbs` annotations required by `steep` + stdlibs = dependencies - %w[English etc net/http rbconfig set stringio] + + stdlibs.each { library(_1) } +end diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 0000000..c05436e --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +errors=() + +if [ -z "${GEM_HOST_API_KEY}" ]; then + errors+=("The GEM_HOST_API_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +lenErrors=${#errors[@]} + +if [[ lenErrors -gt 0 ]]; then + echo -e "Found the following errors in the release environment:\n" + + for error in "${errors[@]}"; do + echo -e "- $error\n" + done + + exit 1 +fi + +echo "The environment is ready to push releases!" diff --git a/bin/publish-gem b/bin/publish-gem new file mode 100644 index 0000000..8444af2 --- /dev/null +++ b/bin/publish-gem @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + +cd -- "$(dirname -- "$0")/.." + +bundle +find . -maxdepth 1 -type f -name "*.gem" -delete +rake release \ No newline at end of file diff --git a/docker.gemspec b/docker.gemspec new file mode 100644 index 0000000..1c73d45 --- /dev/null +++ b/docker.gemspec @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require_relative "lib/docker/version" + +Gem::Specification.new do |s| + s.name = "docker" + s.version = Docker::VERSION + s.summary = "Ruby library to access the Docker API" + s.authors = ["Docker"] + s.email = "support@docker.com" + s.homepage = "https://gemdocs.org/gems/docker" + s.metadata["homepage_uri"] = s.homepage + s.metadata["source_code_uri"] = "https://github.com/Hexlet/docker-ruby" + s.metadata["rubygems_mfa_required"] = false.to_s + s.required_ruby_version = ">= 3.2.0" + + s.files = Dir[ + "lib/**/*.rb", + "rbi/**/*.rbi", + "sig/**/*.rbs", + "manifest.yaml", + "SECURITY.md", + "CHANGELOG.md", + ".ignore" + ] + s.extra_rdoc_files = ["README.md"] + s.add_dependency "cgi" + s.add_dependency "connection_pool" +end diff --git a/examples/.keep b/examples/.keep new file mode 100644 index 0000000..d8c73e9 --- /dev/null +++ b/examples/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store example files demonstrating usage of this SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/lib/docker.rb b/lib/docker.rb new file mode 100644 index 0000000..2a99ea4 --- /dev/null +++ b/lib/docker.rb @@ -0,0 +1,114 @@ +# frozen_string_literal: true + +# Standard libraries. +# rubocop:disable Lint/RedundantRequireStatement +require "English" +require "base64" +require "cgi" +require "date" +require "erb" +require "etc" +require "json" +require "net/http" +require "openssl" +require "pathname" +require "rbconfig" +require "securerandom" +require "set" +require "stringio" +require "time" +require "uri" +# rubocop:enable Lint/RedundantRequireStatement + +# We already ship the preferred sorbet manifests in the package itself. +# `tapioca` currently does not offer us a way to opt out of unnecessary compilation. +if Object.const_defined?(:Tapioca) && + caller.chain([$PROGRAM_NAME]).chain(ARGV).any?(/tapioca/) && + ARGV.none?(/dsl/) + return +end + +# Gems. +require "connection_pool" + +# Package files. +require_relative "docker/version" +require_relative "docker/internal/util" +require_relative "docker/internal/type/converter" +require_relative "docker/internal/type/unknown" +require_relative "docker/internal/type/boolean" +require_relative "docker/internal/type/file_input" +require_relative "docker/internal/type/enum" +require_relative "docker/internal/type/union" +require_relative "docker/internal/type/array_of" +require_relative "docker/internal/type/hash_of" +require_relative "docker/internal/type/base_model" +require_relative "docker/internal/type/base_page" +require_relative "docker/internal/type/request_parameters" +require_relative "docker/internal" +require_relative "docker/request_options" +require_relative "docker/file_part" +require_relative "docker/errors" +require_relative "docker/internal/transport/base_client" +require_relative "docker/internal/transport/pooled_net_requester" +require_relative "docker/client" +require_relative "docker/models/config" +require_relative "docker/models/network" +require_relative "docker/models/spec" +require_relative "docker/models/create_request" +require_relative "docker/models/auth_login_params" +require_relative "docker/models/auth_response" +require_relative "docker/models/container" +require_relative "docker/models/container_create_params" +require_relative "docker/models/container_delete_params" +require_relative "docker/models/container_inspect_params" +require_relative "docker/models/container_kill_params" +require_relative "docker/models/container_list_params" +require_relative "docker/models/container_list_response" +require_relative "docker/models/container_logs_params" +require_relative "docker/models/container_start_params" +require_relative "docker/models/container_stop_params" +require_relative "docker/models/create_response" +require_relative "docker/models/error" +require_relative "docker/models/image" +require_relative "docker/models/image_delete_params" +require_relative "docker/models/image_delete_response" +require_relative "docker/models/image_inspect_params" +require_relative "docker/models/image_list_params" +require_relative "docker/models/image_list_response" +require_relative "docker/models/image_pull_params" +require_relative "docker/models/network_create_params" +require_relative "docker/models/network_create_response" +require_relative "docker/models/network_delete_params" +require_relative "docker/models/network_inspect_params" +require_relative "docker/models/network_inspect_response" +require_relative "docker/models/network_list_params" +require_relative "docker/models/network_list_response" +require_relative "docker/models/service" +require_relative "docker/models/service_create_params" +require_relative "docker/models/service_create_response" +require_relative "docker/models/service_delete_params" +require_relative "docker/models/service_inspect_params" +require_relative "docker/models/service_list_params" +require_relative "docker/models/service_list_response" +require_relative "docker/models/summary" +require_relative "docker/models/system_info_params" +require_relative "docker/models/system_info_response" +require_relative "docker/models/system_ping_params" +require_relative "docker/models/system_ping_response" +require_relative "docker/models/system_version_params" +require_relative "docker/models/system_version_response" +require_relative "docker/models/volume" +require_relative "docker/models/volume_create_params" +require_relative "docker/models/volume_delete_params" +require_relative "docker/models/volume_inspect_params" +require_relative "docker/models/volume_list_params" +require_relative "docker/models/volume_list_response" +require_relative "docker/models" +require_relative "docker/resources/auth" +require_relative "docker/resources/containers" +require_relative "docker/resources/images" +require_relative "docker/resources/networks" +require_relative "docker/resources/services" +require_relative "docker/resources/system" +require_relative "docker/resources/volumes" diff --git a/lib/docker/client.rb b/lib/docker/client.rb new file mode 100644 index 0000000..4cdfa96 --- /dev/null +++ b/lib/docker/client.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module Docker + class Client < Docker::Internal::Transport::BaseClient + # Default max number of retries to attempt after a failed retryable request. + DEFAULT_MAX_RETRIES = 2 + + # Default per-request timeout. + DEFAULT_TIMEOUT_IN_SECONDS = 60.0 + + # Default initial retry delay in seconds. + # Overall delay is calculated using exponential backoff + jitter. + DEFAULT_INITIAL_RETRY_DELAY = 0.5 + + # Default max retry delay in seconds. + DEFAULT_MAX_RETRY_DELAY = 8.0 + + # @return [Docker::Resources::Auth] + attr_reader :auth + + # @return [Docker::Resources::System] + attr_reader :system_ + + # @return [Docker::Resources::Containers] + attr_reader :containers + + # @return [Docker::Resources::Images] + attr_reader :images + + # @return [Docker::Resources::Networks] + attr_reader :networks + + # @return [Docker::Resources::Volumes] + attr_reader :volumes + + # @return [Docker::Resources::Services] + attr_reader :services + + # Creates and returns a new client for interacting with the API. + # + # @param base_url [String, nil] Override the default base URL for the API, e.g., + # `"https://api.example.com/v2/"`. Defaults to `ENV["DOCKER_BASE_URL"]` + # + # @param max_retries [Integer] Max number of retries to attempt after a failed retryable request. + # + # @param timeout [Float] + # + # @param initial_retry_delay [Float] + # + # @param max_retry_delay [Float] + 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 = Docker::Resources::Auth.new(client: self) + @system_ = Docker::Resources::System.new(client: self) + @containers = Docker::Resources::Containers.new(client: self) + @images = Docker::Resources::Images.new(client: self) + @networks = Docker::Resources::Networks.new(client: self) + @volumes = Docker::Resources::Volumes.new(client: self) + @services = Docker::Resources::Services.new(client: self) + end + end +end diff --git a/lib/docker/errors.rb b/lib/docker/errors.rb new file mode 100644 index 0000000..465ae86 --- /dev/null +++ b/lib/docker/errors.rb @@ -0,0 +1,228 @@ +# frozen_string_literal: true + +module Docker + module Errors + class Error < StandardError + # @!attribute cause + # + # @return [StandardError, nil] + end + + class ConversionError < Docker::Errors::Error + # @return [StandardError, nil] + def cause = @cause.nil? ? super : @cause + + # @api private + # + # @param on [Class] + # @param method [Symbol] + # @param target [Object] + # @param value [Object] + # @param cause [StandardError, nil] + def initialize(on:, method:, target:, value:, cause: nil) + cls = on.name.split("::").last + + message = [ + "Failed to parse #{cls}.#{method} from #{value.class} to #{target.inspect}.", + "To get the unparsed API response, use #{cls}[#{method.inspect}].", + cause && "Cause: #{cause.message}" + ].filter(&:itself).join(" ") + + @cause = cause + super(message) + end + end + + class APIError < Docker::Errors::Error + # @return [URI::Generic] + attr_accessor :url + + # @return [Integer, nil] + attr_accessor :status + + # @return [Hash{String=>String}, nil] + attr_accessor :headers + + # @return [Object, nil] + attr_accessor :body + + # @api private + # + # @param url [URI::Generic] + # @param status [Integer, nil] + # @param headers [Hash{String=>String}, nil] + # @param body [Object, nil] + # @param request [nil] + # @param response [nil] + # @param message [String, nil] + def initialize(url:, status: nil, headers: nil, body: nil, request: nil, response: nil, message: nil) + @url = url + @status = status + @headers = headers + @body = body + @request = request + @response = response + super(message) + end + end + + class APIConnectionError < Docker::Errors::APIError + # @!attribute status + # + # @return [nil] + + # @!attribute body + # + # @return [nil] + + # @api private + # + # @param url [URI::Generic] + # @param status [nil] + # @param headers [Hash{String=>String}, nil] + # @param body [nil] + # @param request [nil] + # @param response [nil] + # @param message [String, nil] + def initialize( + url:, + status: nil, + headers: nil, + body: nil, + request: nil, + response: nil, + message: "Connection error." + ) + super + end + end + + class APITimeoutError < Docker::Errors::APIConnectionError + # @api private + # + # @param url [URI::Generic] + # @param status [nil] + # @param headers [Hash{String=>String}, nil] + # @param body [nil] + # @param request [nil] + # @param response [nil] + # @param message [String, nil] + def initialize( + url:, + status: nil, + headers: nil, + body: nil, + request: nil, + response: nil, + message: "Request timed out." + ) + super + end + end + + class APIStatusError < Docker::Errors::APIError + # @api private + # + # @param url [URI::Generic] + # @param status [Integer] + # @param headers [Hash{String=>String}, nil] + # @param body [Object, nil] + # @param request [nil] + # @param response [nil] + # @param message [String, nil] + # + # @return [self] + def self.for(url:, status:, headers:, body:, request:, response:, message: nil) + kwargs = + { + url: url, + status: status, + headers: headers, + body: body, + request: request, + response: response, + message: message + } + + case status + in 400 + Docker::Errors::BadRequestError.new(**kwargs) + in 401 + Docker::Errors::AuthenticationError.new(**kwargs) + in 403 + Docker::Errors::PermissionDeniedError.new(**kwargs) + in 404 + Docker::Errors::NotFoundError.new(**kwargs) + in 409 + Docker::Errors::ConflictError.new(**kwargs) + in 422 + Docker::Errors::UnprocessableEntityError.new(**kwargs) + in 429 + Docker::Errors::RateLimitError.new(**kwargs) + in (500..) + Docker::Errors::InternalServerError.new(**kwargs) + else + Docker::Errors::APIStatusError.new(**kwargs) + end + end + + # @!parse + # # @return [Integer] + # attr_accessor :status + + # @api private + # + # @param url [URI::Generic] + # @param status [Integer] + # @param headers [Hash{String=>String}, nil] + # @param body [Object, nil] + # @param request [nil] + # @param response [nil] + # @param message [String, nil] + def initialize(url:, status:, headers:, body:, request:, response:, message: nil) + message ||= {url: url.to_s, status: status, body: body} + super( + url: url, + status: status, + headers: headers, + body: body, + request: request, + response: response, + message: message&.to_s + ) + end + end + + class BadRequestError < Docker::Errors::APIStatusError + HTTP_STATUS = 400 + end + + class AuthenticationError < Docker::Errors::APIStatusError + HTTP_STATUS = 401 + end + + class PermissionDeniedError < Docker::Errors::APIStatusError + HTTP_STATUS = 403 + end + + class NotFoundError < Docker::Errors::APIStatusError + HTTP_STATUS = 404 + end + + class ConflictError < Docker::Errors::APIStatusError + HTTP_STATUS = 409 + end + + class UnprocessableEntityError < Docker::Errors::APIStatusError + HTTP_STATUS = 422 + end + + class RateLimitError < Docker::Errors::APIStatusError + HTTP_STATUS = 429 + end + + class InternalServerError < Docker::Errors::APIStatusError + HTTP_STATUS = (500..) + end + end +end diff --git a/lib/docker/file_part.rb b/lib/docker/file_part.rb new file mode 100644 index 0000000..448c46c --- /dev/null +++ b/lib/docker/file_part.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +module Docker + class FilePart + # @return [Pathname, StringIO, IO, String] + attr_reader :content + + # @return [String, nil] + attr_reader :content_type + + # @return [String, nil] + attr_reader :filename + + # @api private + # + # @return [String] + private def read + case content + in Pathname + content.read(binmode: true) + in StringIO + content.string + in IO + content.read + in String + content + end + end + + # @param a [Object] + # + # @return [String] + def to_json(*a) = read.to_json(*a) + + # @param a [Object] + # + # @return [String] + def to_yaml(*a) = read.to_yaml(*a) + + # @param content [Pathname, StringIO, IO, String] + # @param filename [Pathname, String, nil] + # @param content_type [String, nil] + def initialize(content, filename: nil, content_type: nil) + @content_type = content_type + @filename = + case [filename, (@content = content)] + in [String | Pathname, _] + ::File.basename(filename) + in [nil, Pathname] + content.basename.to_path + in [nil, IO] + content.to_path + else + filename + end + end + end +end diff --git a/lib/docker/internal.rb b/lib/docker/internal.rb new file mode 100644 index 0000000..b3f5e7e --- /dev/null +++ b/lib/docker/internal.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Docker + module Internal + extend Docker::Internal::Util::SorbetRuntimeSupport + + OMIT = + Object.new.tap do + _1.define_singleton_method(:inspect) { "#<#{Docker::Internal}::OMIT>" } + end + .freeze + + define_sorbet_constant!(:AnyHash) do + T.type_alias { T::Hash[Symbol, T.anything] } + end + define_sorbet_constant!(:FileInput) do + T.type_alias { T.any(Pathname, StringIO, IO, String, Docker::FilePart) } + end + end +end diff --git a/lib/docker/internal/transport/base_client.rb b/lib/docker/internal/transport/base_client.rb new file mode 100644 index 0000000..87cb878 --- /dev/null +++ b/lib/docker/internal/transport/base_client.rb @@ -0,0 +1,567 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Transport + # @api private + # + # @abstract + class BaseClient + extend Docker::Internal::Util::SorbetRuntimeSupport + + # from whatwg fetch spec + MAX_REDIRECTS = 20 + + # rubocop:disable Style/MutableConstant + PLATFORM_HEADERS = + { + "x-stainless-arch" => Docker::Internal::Util.arch, + "x-stainless-lang" => "ruby", + "x-stainless-os" => Docker::Internal::Util.os, + "x-stainless-package-version" => Docker::VERSION, + "x-stainless-runtime" => ::RUBY_ENGINE, + "x-stainless-runtime-version" => ::RUBY_ENGINE_VERSION + } + # rubocop:enable Style/MutableConstant + + class << self + # @api private + # + # @param req [Hash{Symbol=>Object}] + # + # @raise [ArgumentError] + def validate!(req) + keys = [:method, :path, :query, :headers, :body, :unwrap, :page, :stream, :model, :options] + case req + in Hash + req.each_key do |k| + unless keys.include?(k) + raise ArgumentError.new("Request `req` keys must be one of #{keys}, got #{k.inspect}") + end + end + else + raise ArgumentError.new("Request `req` must be a Hash or RequestOptions, got #{req.inspect}") + end + end + + # @api private + # + # @param status [Integer] + # @param headers [Hash{String=>String}] + # + # @return [Boolean] + def should_retry?(status, headers:) + coerced = Docker::Internal::Util.coerce_boolean(headers["x-should-retry"]) + case [coerced, status] + in [true | false, _] + coerced + in [_, 408 | 409 | 429 | (500..)] + # retry on: + # 408: timeouts + # 409: locks + # 429: rate limits + # 500+: unknown errors + true + else + false + end + end + + # @api private + # + # @param request [Hash{Symbol=>Object}] . + # + # @option request [Symbol] :method + # + # @option request [URI::Generic] :url + # + # @option request [Hash{String=>String}] :headers + # + # @option request [Object] :body + # + # @option request [Integer] :max_retries + # + # @option request [Float] :timeout + # + # @param status [Integer] + # + # @param response_headers [Hash{String=>String}] + # + # @return [Hash{Symbol=>Object}] + def follow_redirect(request, status:, response_headers:) + method, url, headers = request.fetch_values(:method, :url, :headers) + location = + Kernel.then do + URI.join(url, response_headers["location"]) + rescue ArgumentError + message = "Server responded with status #{status} but no valid location header." + raise Docker::Errors::APIConnectionError.new( + url: url, + response: response_headers, + message: message + ) + end + + request = {**request, url: location} + + case [url.scheme, location.scheme] + in ["https", "http"] + message = "Tried to redirect to a insecure URL" + raise Docker::Errors::APIConnectionError.new( + url: url, + response: response_headers, + message: message + ) + else + nil + end + + # from whatwg fetch spec + case [status, method] + in [301 | 302, :post] | [303, _] + drop = %w[content-encoding content-language content-length content-location content-type] + request = { + **request, + method: method == :head ? :head : :get, + headers: headers.except(*drop), + body: nil + } + else + end + + # from undici + if Docker::Internal::Util.uri_origin(url) != Docker::Internal::Util.uri_origin(location) + drop = %w[authorization cookie host proxy-authorization] + request = {**request, headers: request.fetch(:headers).except(*drop)} + end + + request + end + + # @api private + # + # @param status [Integer, Docker::Errors::APIConnectionError] + # @param stream [Enumerable, nil] + def reap_connection!(status, stream:) + case status + in (..199) | (300..499) + stream&.each { next } + in Docker::Errors::APIConnectionError | (500..) + Docker::Internal::Util.close_fused!(stream) + else + end + end + end + + # @return [URI::Generic] + attr_reader :base_url + + # @return [Float] + attr_reader :timeout + + # @return [Integer] + attr_reader :max_retries + + # @return [Float] + attr_reader :initial_retry_delay + + # @return [Float] + attr_reader :max_retry_delay + + # @return [Hash{String=>String}] + attr_reader :headers + + # @return [String, nil] + attr_reader :idempotency_header + + # @api private + # @return [Docker::Internal::Transport::PooledNetRequester] + attr_reader :requester + + # @api private + # + # @param base_url [String] + # @param timeout [Float] + # @param max_retries [Integer] + # @param initial_retry_delay [Float] + # @param max_retry_delay [Float] + # @param headers [Hash{String=>String, Integer, Array, nil}] + # @param idempotency_header [String, nil] + def initialize( + base_url:, + timeout: 0.0, + max_retries: 0, + initial_retry_delay: 0.0, + max_retry_delay: 0.0, + headers: {}, + idempotency_header: nil + ) + @requester = Docker::Internal::Transport::PooledNetRequester.new + @headers = Docker::Internal::Util.normalized_headers( + self.class::PLATFORM_HEADERS, + { + "accept" => "application/json", + "content-type" => "application/json", + "user-agent" => user_agent + }, + headers + ) + @base_url_components = Docker::Internal::Util.parse_uri(base_url) + @base_url = Docker::Internal::Util.unparse_uri(@base_url_components) + @idempotency_header = idempotency_header&.to_s&.downcase + @timeout = timeout + @max_retries = max_retries + @initial_retry_delay = initial_retry_delay + @max_retry_delay = max_retry_delay + end + + # @api private + # + # @return [String] + private def user_agent = "#{self.class.name}/Ruby #{Docker::VERSION}" + + # @api private + # + # @return [String] + private def generate_idempotency_key = "stainless-ruby-retry-#{SecureRandom.uuid}" + + # @api private + # + # @param req [Hash{Symbol=>Object}] . + # + # @option req [Symbol] :method + # + # @option req [String, Array] :path + # + # @option req [Hash{String=>Array, String, nil}, nil] :query + # + # @option req [Hash{String=>String, Integer, Array, nil}, nil] :headers + # + # @option req [Object, nil] :body + # + # @option req [Symbol, Integer, Array, Proc, nil] :unwrap + # + # @option req [Class, nil] :page + # + # @option req [Class, nil] :stream + # + # @option req [Docker::Internal::Type::Converter, Class, nil] :model + # + # @param opts [Hash{Symbol=>Object}] . + # + # @option opts [String, nil] :idempotency_key + # + # @option opts [Hash{String=>Array, String, nil}, nil] :extra_query + # + # @option opts [Hash{String=>String, nil}, nil] :extra_headers + # + # @option opts [Object, nil] :extra_body + # + # @option opts [Integer, nil] :max_retries + # + # @option opts [Float, nil] :timeout + # + # @return [Hash{Symbol=>Object}] + private def build_request(req, opts) + method, uninterpolated_path = req.fetch_values(:method, :path) + + path = Docker::Internal::Util.interpolate_path(uninterpolated_path) + + query = Docker::Internal::Util.deep_merge(req[:query].to_h, opts[:extra_query].to_h) + + headers = Docker::Internal::Util.normalized_headers( + @headers, + req[:headers].to_h, + opts[:extra_headers].to_h + ) + + if @idempotency_header && + !headers.key?(@idempotency_header) && + (!Net::HTTP::IDEMPOTENT_METHODS_.include?(method.to_s.upcase) || opts.key?(:idempotency_key)) + headers[@idempotency_header] = opts.fetch(:idempotency_key) { generate_idempotency_key } + end + + unless headers.key?("x-stainless-retry-count") + headers["x-stainless-retry-count"] = "0" + end + + timeout = opts.fetch(:timeout, @timeout).to_f.clamp(0..) + unless headers.key?("x-stainless-timeout") || timeout.zero? + headers["x-stainless-timeout"] = timeout.to_s + end + + headers.reject! { |_, v| v.to_s.empty? } + + body = + case method + in :get | :head | :options | :trace + nil + else + Docker::Internal::Util.deep_merge(*[req[:body], opts[:extra_body]].compact) + end + + url = Docker::Internal::Util.join_parsed_uri( + @base_url_components, + {**req, path: path, query: query} + ) + headers, encoded = Docker::Internal::Util.encode_content(headers, body) + { + method: method, + url: url, + headers: headers, + body: encoded, + max_retries: opts.fetch(:max_retries, @max_retries), + timeout: timeout + } + end + + # @api private + # + # @param headers [Hash{String=>String}] + # @param retry_count [Integer] + # + # @return [Float] + private def retry_delay(headers, retry_count:) + # Non-standard extension + span = Float(headers["retry-after-ms"], exception: false)&.then { _1 / 1000 } + return span if span + + retry_header = headers["retry-after"] + return span if (span = Float(retry_header, exception: false)) + + span = retry_header&.then do + Time.httpdate(_1) - Time.now + rescue ArgumentError + nil + end + return span if span + + scale = retry_count**2 + jitter = 1 - (0.25 * rand) + (@initial_retry_delay * scale * jitter).clamp(0, @max_retry_delay) + end + + # @api private + # + # @param request [Hash{Symbol=>Object}] . + # + # @option request [Symbol] :method + # + # @option request [URI::Generic] :url + # + # @option request [Hash{String=>String}] :headers + # + # @option request [Object] :body + # + # @option request [Integer] :max_retries + # + # @option request [Float] :timeout + # + # @param redirect_count [Integer] + # + # @param retry_count [Integer] + # + # @param send_retry_header [Boolean] + # + # @raise [Docker::Errors::APIError] + # @return [Array(Integer, Net::HTTPResponse, Enumerable)] + def send_request(request, redirect_count:, retry_count:, send_retry_header:) + url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout) + input = {**request.except(:timeout), deadline: Docker::Internal::Util.monotonic_secs + timeout} + + if send_retry_header + headers["x-stainless-retry-count"] = retry_count.to_s + end + + begin + status, response, stream = @requester.execute(input) + rescue Docker::Errors::APIConnectionError => e + status = e + end + headers = Docker::Internal::Util.normalized_headers(response&.each_header&.to_h) + + case status + in ..299 + [status, response, stream] + in 300..399 if redirect_count >= self.class::MAX_REDIRECTS + self.class.reap_connection!(status, stream: stream) + + message = "Failed to complete the request within #{self.class::MAX_REDIRECTS} redirects." + raise Docker::Errors::APIConnectionError.new(url: url, response: response, message: message) + in 300..399 + self.class.reap_connection!(status, stream: stream) + + request = self.class.follow_redirect(request, status: status, response_headers: headers) + send_request( + request, + redirect_count: redirect_count + 1, + retry_count: retry_count, + send_retry_header: send_retry_header + ) + in Docker::Errors::APIConnectionError if retry_count >= max_retries + raise status + in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: headers) + decoded = Kernel.then do + Docker::Internal::Util.decode_content(headers, stream: stream, suppress_error: true) + ensure + self.class.reap_connection!(status, stream: stream) + end + + raise Docker::Errors::APIStatusError.for( + url: url, + status: status, + headers: headers, + body: decoded, + request: nil, + response: response + ) + in (400..) | Docker::Errors::APIConnectionError + self.class.reap_connection!(status, stream: stream) + + delay = retry_delay(response || {}, retry_count: retry_count) + sleep(delay) + + send_request( + request, + redirect_count: redirect_count, + retry_count: retry_count + 1, + send_retry_header: send_retry_header + ) + end + end + + # Execute the request specified by `req`. This is the method that all resource + # methods call into. + # + # @overload request(method, path, query: {}, headers: {}, body: nil, unwrap: nil, page: nil, stream: nil, model: Docker::Internal::Type::Unknown, options: {}) + # + # @param method [Symbol] + # + # @param path [String, Array] + # + # @param query [Hash{String=>Array, String, nil}, nil] + # + # @param headers [Hash{String=>String, Integer, Array, nil}, nil] + # + # @param body [Object, nil] + # + # @param unwrap [Symbol, Integer, Array, Proc, nil] + # + # @param page [Class, nil] + # + # @param stream [Class, nil] + # + # @param model [Docker::Internal::Type::Converter, Class, nil] + # + # @param options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] . + # + # @option options [String, nil] :idempotency_key + # + # @option options [Hash{String=>Array, String, nil}, nil] :extra_query + # + # @option options [Hash{String=>String, nil}, nil] :extra_headers + # + # @option options [Object, nil] :extra_body + # + # @option options [Integer, nil] :max_retries + # + # @option options [Float, nil] :timeout + # + # @raise [Docker::Errors::APIError] + # @return [Object] + def request(req) + self.class.validate!(req) + model = req.fetch(:model) { Docker::Internal::Type::Unknown } + opts = req[:options].to_h + unwrap = req[:unwrap] + Docker::RequestOptions.validate!(opts) + request = build_request(req.except(:options), opts) + url = request.fetch(:url) + + # Don't send the current retry count in the headers if the caller modified the header defaults. + send_retry_header = request.fetch(:headers)["x-stainless-retry-count"] == "0" + status, response, stream = send_request( + request, + redirect_count: 0, + retry_count: 0, + send_retry_header: send_retry_header + ) + + headers = Docker::Internal::Util.normalized_headers(response.each_header.to_h) + decoded = Docker::Internal::Util.decode_content(headers, stream: stream) + case req + in {stream: Class => st} + st.new( + model: model, + url: url, + status: status, + headers: headers, + response: response, + unwrap: unwrap, + stream: decoded + ) + in {page: Class => page} + page.new(client: self, req: req, headers: headers, page_data: decoded) + else + unwrapped = Docker::Internal::Util.dig(decoded, unwrap) + Docker::Internal::Type::Converter.coerce(model, unwrapped) + end + end + + # @api private + # + # @return [String] + def inspect + # rubocop:disable Layout/LineLength + "#<#{self.class.name}:0x#{object_id.to_s(16)} base_url=#{@base_url} max_retries=#{@max_retries} timeout=#{@timeout}>" + # rubocop:enable Layout/LineLength + end + + define_sorbet_constant!(:RequestComponents) do + T.type_alias do + { + method: Symbol, + path: T.any(String, T::Array[String]), + query: T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))]), + headers: T.nilable( + T::Hash[String, + T.nilable( + T.any( + String, + Integer, + T::Array[T.nilable(T.any(String, Integer))] + ) + )] + ), + body: T.nilable(T.anything), + unwrap: T.nilable( + T.any( + Symbol, + Integer, + T::Array[T.any(Symbol, Integer)], + T.proc.params(arg0: T.anything).returns(T.anything) + ) + ), + page: T.nilable(T::Class[Docker::Internal::Type::BasePage[Docker::Internal::Type::BaseModel]]), + stream: T.nilable(T::Class[T.anything]), + model: T.nilable(Docker::Internal::Type::Converter::Input), + options: T.nilable(Docker::RequestOptions::OrHash) + } + end + end + define_sorbet_constant!(:RequestInput) do + T.type_alias do + { + method: Symbol, + url: URI::Generic, + headers: T::Hash[String, String], + body: T.anything, + max_retries: Integer, + timeout: Float + } + end + end + end + end + end +end diff --git a/lib/docker/internal/transport/pooled_net_requester.rb b/lib/docker/internal/transport/pooled_net_requester.rb new file mode 100644 index 0000000..5eec0cf --- /dev/null +++ b/lib/docker/internal/transport/pooled_net_requester.rb @@ -0,0 +1,210 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Transport + # @api private + class PooledNetRequester + extend Docker::Internal::Util::SorbetRuntimeSupport + + # from the golang stdlib + # https://github.com/golang/go/blob/c8eced8580028328fde7c03cbfcb720ce15b2358/src/net/http/transport.go#L49 + KEEP_ALIVE_TIMEOUT = 30 + + DEFAULT_MAX_CONNECTIONS = [Etc.nprocessors, 99].max + + class << self + # @api private + # + # @param cert_store [OpenSSL::X509::Store] + # @param url [URI::Generic] + # + # @return [Net::HTTP] + def connect(cert_store:, url:) + port = + case [url.port, url.scheme] + in [Integer, _] + url.port + in [nil, "http" | "ws"] + Net::HTTP.http_default_port + in [nil, "https" | "wss"] + Net::HTTP.https_default_port + end + + Net::HTTP.new(url.host, port).tap do + _1.use_ssl = %w[https wss].include?(url.scheme) + _1.max_retries = 0 + + (_1.cert_store = cert_store) if _1.use_ssl? + end + end + + # @api private + # + # @param conn [Net::HTTP] + # @param deadline [Float] + def calibrate_socket_timeout(conn, deadline) + timeout = deadline - Docker::Internal::Util.monotonic_secs + conn.open_timeout = conn.read_timeout = conn.write_timeout = conn.continue_timeout = timeout + end + + # @api private + # + # @param request [Hash{Symbol=>Object}] . + # + # @option request [Symbol] :method + # + # @option request [URI::Generic] :url + # + # @option request [Hash{String=>String}] :headers + # + # @param blk [Proc] + # + # @yieldparam [String] + # @return [Array(Net::HTTPGenericRequest, Proc)] + def build_request(request, &blk) + method, url, headers, body = request.fetch_values(:method, :url, :headers, :body) + req = Net::HTTPGenericRequest.new( + method.to_s.upcase, + !body.nil?, + method != :head, + URI(url.to_s) # ensure we construct a URI class of the right scheme + ) + + headers.each { req[_1] = _2 } + + case body + in nil + req["content-length"] ||= 0 unless req["transfer-encoding"] + in String + req["content-length"] ||= body.bytesize.to_s unless req["transfer-encoding"] + req.body_stream = Docker::Internal::Util::ReadIOAdapter.new(body, &blk) + in StringIO + req["content-length"] ||= body.size.to_s unless req["transfer-encoding"] + req.body_stream = Docker::Internal::Util::ReadIOAdapter.new(body, &blk) + in Pathname | IO | Enumerator + req["transfer-encoding"] ||= "chunked" unless req["content-length"] + req.body_stream = Docker::Internal::Util::ReadIOAdapter.new(body, &blk) + end + + [req, req.body_stream&.method(:close)] + end + end + + # @api private + # + # @param url [URI::Generic] + # @param deadline [Float] + # @param blk [Proc] + # + # @raise [Timeout::Error] + # @yieldparam [Net::HTTP] + private def with_pool(url, deadline:, &blk) + origin = Docker::Internal::Util.uri_origin(url) + timeout = deadline - Docker::Internal::Util.monotonic_secs + pool = + @mutex.synchronize do + @pools[origin] ||= ConnectionPool.new(size: @size) do + self.class.connect(cert_store: @cert_store, url: url) + end + end + + pool.with(timeout: timeout, &blk) + end + + # @api private + # + # @param request [Hash{Symbol=>Object}] . + # + # @option request [Symbol] :method + # + # @option request [URI::Generic] :url + # + # @option request [Hash{String=>String}] :headers + # + # @option request [Object] :body + # + # @option request [Float] :deadline + # + # @return [Array(Integer, Net::HTTPResponse, Enumerable)] + def execute(request) + url, deadline = request.fetch_values(:url, :deadline) + + req = nil + finished = false + + # rubocop:disable Metrics/BlockLength + enum = Enumerator.new do |y| + next if finished + + with_pool(url, deadline: deadline) do |conn| + eof = false + closing = nil + ::Thread.handle_interrupt(Object => :never) do + ::Thread.handle_interrupt(Object => :immediate) do + req, closing = self.class.build_request(request) do + self.class.calibrate_socket_timeout(conn, deadline) + end + + self.class.calibrate_socket_timeout(conn, deadline) + unless conn.started? + conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT + conn.start + end + + self.class.calibrate_socket_timeout(conn, deadline) + ::Kernel.catch(:jump) do + conn.request(req) do |rsp| + y << [req, rsp] + ::Kernel.throw(:jump) if finished + + rsp.read_body do |bytes| + y << bytes.force_encoding(Encoding::BINARY) + ::Kernel.throw(:jump) if finished + + self.class.calibrate_socket_timeout(conn, deadline) + end + eof = true + end + end + end + ensure + begin + conn.finish if !eof && conn&.started? + ensure + closing&.call + end + end + end + rescue Timeout::Error + raise Docker::Errors::APITimeoutError.new(url: url, request: req) + rescue StandardError + raise Docker::Errors::APIConnectionError.new(url: url, request: req) + end + # rubocop:enable Metrics/BlockLength + + _, response = enum.next + body = Docker::Internal::Util.fused_enum(enum, external: true) do + finished = true + loop { enum.next } + end + [Integer(response.code), response, body] + end + + # @api private + # + # @param size [Integer] + def initialize(size: self.class::DEFAULT_MAX_CONNECTIONS) + @mutex = Mutex.new + @size = size + @cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths) + @pools = {} + end + + define_sorbet_constant!(:Request) do + T.type_alias { {method: Symbol, url: URI::Generic, headers: T::Hash[String, String], body: T.anything, deadline: Float} } + end + end + end + end +end diff --git a/lib/docker/internal/type/array_of.rb b/lib/docker/internal/type/array_of.rb new file mode 100644 index 0000000..3f1ed44 --- /dev/null +++ b/lib/docker/internal/type/array_of.rb @@ -0,0 +1,168 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Type + # @api private + # + # @abstract + # + # @generic Elem + # + # Array of items of a given type. + class ArrayOf + include Docker::Internal::Type::Converter + include Docker::Internal::Util::SorbetRuntimeSupport + + private_class_method :new + + # @overload [](type_info, spec = {}) + # + # @param type_info [Hash{Symbol=>Object}, Proc, Docker::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + # + # @return [self] + def self.[](...) = new(...) + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ===(other) = other.is_a?(Array) && other.all?(item_type) + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ==(other) + # rubocop:disable Layout/LineLength + other.is_a?(Docker::Internal::Type::ArrayOf) && other.nilable? == nilable? && other.item_type == item_type + # rubocop:enable Layout/LineLength + end + + # @api public + # + # @return [Integer] + def hash = [self.class, item_type].hash + + # @api private + # + # @param value [Array, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Array, Object] + def coerce(value, state:) + exactness = state.fetch(:exactness) + + unless value.is_a?(Array) + exactness[:no] += 1 + state[:error] = TypeError.new("#{value.class} can't be coerced into #{Array}") + return value + end + + target = item_type + exactness[:yes] += 1 + value + .map do |item| + case [nilable?, item] + in [true, nil] + exactness[:yes] += 1 + nil + else + Docker::Internal::Type::Converter.coerce(target, item, state: state) + end + end + end + + # @api private + # + # @param value [Array, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Array, Object] + def dump(value, state:) + target = item_type + if value.is_a?(Array) + value.map do + Docker::Internal::Type::Converter.dump(target, _1, state: state) + end + else + super + end + end + + # @api private + # + # @return [Object] + def to_sorbet_type + T::Array[Docker::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(item_type)] + end + + # @api private + # + # @return [generic] + protected def item_type = @item_type_fn.call + + # @api private + # + # @return [Boolean] + protected def nilable? = @nilable + + # @api private + # + # @param type_info [Hash{Symbol=>Object}, Proc, Docker::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + def initialize(type_info, spec = {}) + @item_type_fn = Docker::Internal::Type::Converter.type_info(type_info || spec) + @meta = Docker::Internal::Type::Converter.meta_info(type_info, spec) + @nilable = spec.fetch(:nil?, false) + end + + # @api private + # + # @param depth [Integer] + # + # @return [String] + def inspect(depth: 0) + items = Docker::Internal::Type::Converter.inspect(item_type, depth: depth.succ) + + "#{self.class}[#{[items, nilable? ? 'nil' : nil].compact.join(' | ')}]" + end + end + end + end +end diff --git a/lib/docker/internal/type/base_model.rb b/lib/docker/internal/type/base_model.rb new file mode 100644 index 0000000..10c6679 --- /dev/null +++ b/lib/docker/internal/type/base_model.rb @@ -0,0 +1,529 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Type + # @abstract + class BaseModel + extend Docker::Internal::Type::Converter + extend Docker::Internal::Util::SorbetRuntimeSupport + + class << self + # @api private + # + # Assumes superclass fields are totally defined before fields are accessed / + # defined on subclasses. + # + # @param child [Class] + def inherited(child) + super + child.known_fields.replace(known_fields.dup) + end + + # @api private + # + # @return [Hash{Symbol=>Hash{Symbol=>Object}}] + def known_fields = @known_fields ||= {} + + # @api private + # + # @return [Hash{Symbol=>Hash{Symbol=>Object}}] + def fields + known_fields.transform_values do |field| + {**field.except(:type_fn), type: field.fetch(:type_fn).call} + end + end + + # @api private + # + # @param name_sym [Symbol] + # + # @param required [Boolean] + # + # @param type_info [Hash{Symbol=>Object}, Proc, Docker::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + private def add_field(name_sym, required:, type_info:, spec:) + meta = Docker::Internal::Type::Converter.meta_info(type_info, spec) + type_fn, info = + case type_info + in Proc | Docker::Internal::Type::Converter | Class + [Docker::Internal::Type::Converter.type_info({**spec, union: type_info}), spec] + in Hash + [Docker::Internal::Type::Converter.type_info(type_info), type_info] + end + + setter = :"#{name_sym}=" + api_name = info.fetch(:api_name, name_sym) + nilable = info.fetch(:nil?, false) + const = required && !nilable ? info.fetch(:const, Docker::Internal::OMIT) : Docker::Internal::OMIT + + [name_sym, setter].each { undef_method(_1) } if known_fields.key?(name_sym) + + known_fields[name_sym] = + { + mode: @mode, + api_name: api_name, + required: required, + nilable: nilable, + const: const, + type_fn: type_fn, + meta: meta + } + + define_method(setter) do |value| + target = type_fn.call + state = Docker::Internal::Type::Converter.new_coerce_state(translate_names: false) + coerced = Docker::Internal::Type::Converter.coerce(target, value, state: state) + status = @coerced.store(name_sym, state.fetch(:error) || true) + stored = + case [target, status] + in [Docker::Internal::Type::Converter | Symbol, true] + coerced + else + value + end + @data.store(name_sym, stored) + end + + # rubocop:disable Style/CaseEquality + # rubocop:disable Metrics/BlockLength + define_method(name_sym) do + target = type_fn.call + + case @coerced[name_sym] + in true | false if Docker::Internal::Type::Converter === target + @data.fetch(name_sym) + in ::StandardError => e + raise Docker::Errors::ConversionError.new( + on: self.class, + method: __method__, + target: target, + value: @data.fetch(name_sym), + cause: e + ) + else + Kernel.then do + value = @data.fetch(name_sym) { const == Docker::Internal::OMIT ? nil : const } + state = Docker::Internal::Type::Converter.new_coerce_state(translate_names: false) + if (nilable || !required) && value.nil? + nil + else + Docker::Internal::Type::Converter.coerce( + target, value, state: state + ) + end + rescue StandardError => e + raise Docker::Errors::ConversionError.new( + on: self.class, + method: __method__, + target: target, + value: value, + cause: e + ) + end + end + end + # rubocop:enable Metrics/BlockLength + # rubocop:enable Style/CaseEquality + end + + # @api private + # + # @param name_sym [Symbol] + # + # @param type_info [Hash{Symbol=>Object}, Proc, Docker::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + def required(name_sym, type_info, spec = {}) + add_field(name_sym, required: true, type_info: type_info, spec: spec) + end + + # @api private + # + # @param name_sym [Symbol] + # + # @param type_info [Hash{Symbol=>Object}, Proc, Docker::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + def optional(name_sym, type_info, spec = {}) + add_field(name_sym, required: false, type_info: type_info, spec: spec) + end + + # @api private + # + # `request_only` attributes not excluded from `.#coerce` when receiving responses + # even if well behaved servers should not send them + # + # @param blk [Proc] + private def request_only(&blk) + @mode = :dump + blk.call + ensure + @mode = nil + end + + # @api private + # + # `response_only` attributes are omitted from `.#dump` when making requests + # + # @param blk [Proc] + private def response_only(&blk) + @mode = :coerce + blk.call + ensure + @mode = nil + end + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ==(other) + other.is_a?(Class) && other <= Docker::Internal::Type::BaseModel && other.fields == fields + end + + # @api public + # + # @return [Integer] + def hash = fields.hash + end + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ==(other) = self.class == other.class && @data == other.to_h + + # @api public + # + # @return [Integer] + def hash = [self.class, @data].hash + + class << self + # @api private + # + # @param value [Docker::Internal::Type::BaseModel, Hash{Object=>Object}, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [self, Object] + def coerce(value, state:) + exactness = state.fetch(:exactness) + + if value.is_a?(self) + exactness[:yes] += 1 + return value + end + + unless (val = Docker::Internal::Util.coerce_hash(value)).is_a?(Hash) + exactness[:no] += 1 + state[:error] = TypeError.new("#{value.class} can't be coerced into #{Hash}") + return value + end + exactness[:yes] += 1 + + keys = val.keys.to_set + instance = new + data = instance.to_h + status = instance.instance_variable_get(:@coerced) + + # rubocop:disable Metrics/BlockLength + fields.each do |name, field| + mode, required, target = field.fetch_values(:mode, :required, :type) + api_name, nilable, const = field.fetch_values(:api_name, :nilable, :const) + src_name = state.fetch(:translate_names) ? api_name : name + + unless val.key?(src_name) + if required && mode != :dump && const == Docker::Internal::OMIT + exactness[nilable ? :maybe : :no] += 1 + else + exactness[:yes] += 1 + end + next + end + + item = val.fetch(src_name) + keys.delete(src_name) + + state[:error] = nil + converted = + if item.nil? && (nilable || !required) + exactness[nilable ? :yes : :maybe] += 1 + nil + else + coerced = Docker::Internal::Type::Converter.coerce(target, item, state: state) + case target + in Docker::Internal::Type::Converter | Symbol + coerced + else + item + end + end + + status.store(name, state.fetch(:error) || true) + data.store(name, converted) + end + # rubocop:enable Metrics/BlockLength + + keys.each { data.store(_1, val.fetch(_1)) } + instance + end + + # @api private + # + # @param value [self, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Hash{Object=>Object}, Object] + def dump(value, state:) + unless (coerced = Docker::Internal::Util.coerce_hash(value)).is_a?(Hash) + return super + end + + acc = {} + + coerced.each do |key, val| + name = key.is_a?(String) ? key.to_sym : key + case (field = known_fields[name]) + in nil + acc.store(name, super(val, state: state)) + else + api_name, mode, type_fn = field.fetch_values(:api_name, :mode, :type_fn) + case mode + in :coerce + next + else + target = type_fn.call + acc.store(api_name, Docker::Internal::Type::Converter.dump(target, val, state: state)) + end + end + end + + known_fields.each_value do |field| + api_name, mode, const = field.fetch_values(:api_name, :mode, :const) + next if mode == :coerce || acc.key?(api_name) || const == Docker::Internal::OMIT + acc.store(api_name, const) + end + + acc + end + + # @api private + # + # @return [Object] + def to_sorbet_type + self + end + end + + class << self + # @api private + # + # @param model [Docker::Internal::Type::BaseModel] + # @param convert [Boolean] + # + # @return [Hash{Symbol=>Object}] + def recursively_to_h(model, convert:) + rec = ->(x) do + case x + in Docker::Internal::Type::BaseModel + if convert + fields = x.class.known_fields + x.to_h.to_h do |key, val| + [key, rec.call(fields.key?(key) ? x.public_send(key) : val)] + rescue Docker::Errors::ConversionError + [key, rec.call(val)] + end + else + rec.call(x.to_h) + end + in Hash + x.transform_values(&rec) + in Array + x.map(&rec) + else + x + end + end + rec.call(model) + end + end + + # @api public + # + # Returns the raw value associated with the given key, if found. Otherwise, nil is + # returned. + # + # It is valid to lookup keys that are not in the API spec, for example to access + # undocumented features. This method does not parse response data into + # higher-level types. Lookup by anything other than a Symbol is an ArgumentError. + # + # @param key [Symbol] + # + # @return [Object, nil] + def [](key) + unless key.instance_of?(Symbol) + raise ArgumentError.new("Expected symbol key for lookup, got #{key.inspect}") + end + + @data[key] + end + + # @api public + # + # Returns a Hash of the data underlying this object. O(1) + # + # Keys are Symbols and values are the raw values from the response. The return + # value indicates which values were ever set on the object. i.e. there will be a + # key in this hash if they ever were, even if the set value was nil. + # + # This method is not recursive. The returned value is shared by the object, so it + # should not be mutated. + # + # @return [Hash{Symbol=>Object}] + def to_h = @data + + alias_method :to_hash, :to_h + + # @api public + # + # In addition to the behaviour of `#to_h`, this method will recursively call + # `#to_h` on nested models. + # + # @return [Hash{Symbol=>Object}] + def deep_to_h = self.class.recursively_to_h(@data, convert: false) + + # @param keys [Array, nil] + # + # @return [Hash{Symbol=>Object}] + # + # @example + # # `error` is a `Docker::Error` + # error => { + # message: message + # } + def deconstruct_keys(keys) + (keys || self.class.known_fields.keys) + .filter_map do |k| + unless self.class.known_fields.key?(k) + next + end + + [k, public_send(k)] + end + .to_h + end + + # @api public + # + # @param a [Object] + # + # @return [String] + def to_json(*a) = Docker::Internal::Type::Converter.dump(self.class, self).to_json(*a) + + # @api public + # + # @param a [Object] + # + # @return [String] + def to_yaml(*a) = Docker::Internal::Type::Converter.dump(self.class, self).to_yaml(*a) + + # Create a new instance of a model. + # + # @param data [Hash{Symbol=>Object}, self] + def initialize(data = {}) + @data = {} + @coerced = {} + Docker::Internal::Util.coerce_hash!(data).each do + if self.class.known_fields.key?(_1) + public_send(:"#{_1}=", _2) + else + @data.store(_1, _2) + @coerced.store(_1, false) + end + end + end + + class << self + # @api private + # + # @param depth [Integer] + # + # @return [String] + def inspect(depth: 0) + return super() if depth.positive? + + depth = depth.succ + deferred = fields.transform_values do |field| + type, required, nilable = field.fetch_values(:type, :required, :nilable) + inspected = [ + Docker::Internal::Type::Converter.inspect(type, depth: depth), + !required || nilable ? "nil" : nil + ].compact.join(" | ") + -> { inspected }.tap { _1.define_singleton_method(:inspect) { call } } + end + + "#{name}[#{deferred.inspect}]" + end + end + + # @api public + # + # @return [String] + def to_s = deep_to_h.to_s + + # @api private + # + # @return [String] + def inspect + converted = self.class.recursively_to_h(self, convert: true) + "#<#{self.class}:0x#{object_id.to_s(16)} #{converted}>" + end + + define_sorbet_constant!(:KnownField) do + T.type_alias { {mode: T.nilable(Symbol), required: T::Boolean, nilable: T::Boolean} } + end + end + end + end +end diff --git a/lib/docker/internal/type/base_page.rb b/lib/docker/internal/type/base_page.rb new file mode 100644 index 0000000..94d9558 --- /dev/null +++ b/lib/docker/internal/type/base_page.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Type + # @api private + # + # @generic Elem + # + # This module provides a base implementation for paginated responses in the SDK. + module BasePage + # rubocop:disable Lint/UnusedMethodArgument + + # @api public + # + # @return [Boolean] + def next_page? = (raise NotImplementedError) + + # @api public + # + # @raise [Docker::Errors::APIError] + # @return [self] + def next_page = (raise NotImplementedError) + + # @api public + # + # @param blk [Proc] + # + # @yieldparam [generic] + # @return [void] + def auto_paging_each(&blk) = (raise NotImplementedError) + + # @return [Enumerable>] + def to_enum = super(:auto_paging_each) + + alias_method :enum_for, :to_enum + + # @api private + # + # @param client [Docker::Internal::Transport::BaseClient] + # @param req [Hash{Symbol=>Object}] + # @param headers [Hash{String=>String}] + # @param page_data [Object] + def initialize(client:, req:, headers:, page_data:) + @client = client + @req = req + @model = req.fetch(:model) + super() + end + + # rubocop:enable Lint/UnusedMethodArgument + end + end + end +end diff --git a/lib/docker/internal/type/boolean.rb b/lib/docker/internal/type/boolean.rb new file mode 100644 index 0000000..b4a7471 --- /dev/null +++ b/lib/docker/internal/type/boolean.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Type + # @api private + # + # @abstract + # + # Ruby has no Boolean class; this is something for models to refer to. + class Boolean + extend Docker::Internal::Type::Converter + extend Docker::Internal::Util::SorbetRuntimeSupport + + private_class_method :new + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def self.===(other) = other == true || other == false + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def self.==(other) = other.is_a?(Class) && other <= Docker::Internal::Type::Boolean + + class << self + # @api private + # + # Coerce value to Boolean if possible, otherwise return the original value. + # + # @param value [Boolean, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Boolean, Object] + def coerce(value, state:) + state.fetch(:exactness)[value == true || value == false ? :yes : :no] += 1 + value + end + + # @!method dump(value, state:) + # @api private + # + # @param value [Boolean, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Boolean, Object] + + # @api private + # + # @return [Object] + def to_sorbet_type + T::Boolean + end + end + end + end + end +end diff --git a/lib/docker/internal/type/converter.rb b/lib/docker/internal/type/converter.rb new file mode 100644 index 0000000..5942b86 --- /dev/null +++ b/lib/docker/internal/type/converter.rb @@ -0,0 +1,327 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Type + # @api private + module Converter + extend Docker::Internal::Util::SorbetRuntimeSupport + + # rubocop:disable Lint/UnusedMethodArgument + + # @api private + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Object] + def coerce(value, state:) = (raise NotImplementedError) + + # @api private + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Object] + def dump(value, state:) + case value + in Array + value.map { Docker::Internal::Type::Unknown.dump(_1, state: state) } + in Hash + value.transform_values { Docker::Internal::Type::Unknown.dump(_1, state: state) } + in Docker::Internal::Type::BaseModel + value.class.dump(value, state: state) + in StringIO + value.string + in Pathname | IO + state[:can_retry] = false if value.is_a?(IO) + Docker::FilePart.new(value) + in Docker::FilePart + state[:can_retry] = false if value.content.is_a?(IO) + value + else + value + end + end + + # @api private + # + # @param depth [Integer] + # + # @return [String] + def inspect(depth: 0) + super() + end + + # rubocop:enable Lint/UnusedMethodArgument + + class << self + # @api private + # + # @param spec [Hash{Symbol=>Object}, Proc, Docker::Internal::Type::Converter, Class] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + # + # @return [Proc] + def type_info(spec) + case spec + in Proc + spec + in Hash + type_info(spec.slice(:const, :enum, :union).first&.last) + in true | false + -> { Docker::Internal::Type::Boolean } + in Docker::Internal::Type::Converter | Class | Symbol + -> { spec } + in NilClass | Integer | Float + -> { spec.class } + end + end + + # @api private + # + # @param type_info [Hash{Symbol=>Object}, Proc, Docker::Internal::Type::Converter, Class] . + # + # @option type_info [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option type_info [Proc] :enum + # + # @option type_info [Proc] :union + # + # @option type_info [Boolean] :"nil?" + # + # @param spec [Hash{Symbol=>Object}, Proc, Docker::Internal::Type::Converter, Class] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + # + # @return [Hash{Symbol=>Object}] + def meta_info(type_info, spec) + [spec, type_info].grep(Hash).first.to_h.except(:const, :enum, :union, :nil?) + end + + # @api private + # + # @param translate_names [Boolean] + # + # @return [Hash{Symbol=>Object}] + def new_coerce_state(translate_names: true) + { + translate_names: translate_names, + strictness: true, + exactness: {yes: 0, no: 0, maybe: 0}, + error: nil, + branched: 0 + } + end + + # @api private + # + # Based on `target`, transform `value` into `target`, to the extent possible: + # + # 1. if the given `value` conforms to `target` already, return the given `value` + # 2. if it's possible and safe to convert the given `value` to `target`, then the + # converted value + # 3. otherwise, the given `value` unaltered + # + # The coercion process is subject to improvement between minor release versions. + # See https://docs.pydantic.dev/latest/concepts/unions/#smart-mode + # + # @param target [Docker::Internal::Type::Converter, Class] + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] The `strictness` is one of `true`, `false`. This informs the coercion strategy + # when we have to decide between multiple possible conversion targets: + # + # - `true`: the conversion must be exact, with minimum coercion. + # - `false`: the conversion can be approximate, with some coercion. + # + # The `exactness` is `Hash` with keys being one of `yes`, `no`, or `maybe`. For + # any given conversion attempt, the exactness will be updated based on how closely + # the value recursively matches the target type: + # + # - `yes`: the value can be converted to the target type with minimum coercion. + # - `maybe`: the value can be converted to the target type with some reasonable + # coercion. + # - `no`: the value cannot be converted to the target type. + # + # See implementation below for more details. + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Object] + def coerce(target, value, state: Docker::Internal::Type::Converter.new_coerce_state) + # rubocop:disable Metrics/BlockNesting + exactness = state.fetch(:exactness) + + case target + in Docker::Internal::Type::Converter + return target.coerce(value, state: state) + in Class + if value.is_a?(target) + exactness[:yes] += 1 + return value + end + + case target + in -> { _1 <= NilClass } + exactness[value.nil? ? :yes : :maybe] += 1 + return nil + in -> { _1 <= Integer } + case value + in Integer + exactness[:yes] += 1 + return value + else + Kernel.then do + return Integer(value).tap { exactness[:maybe] += 1 } + rescue ArgumentError, TypeError => e + state[:error] = e + end + end + in -> { _1 <= Float } + if value.is_a?(Numeric) + exactness[:yes] += 1 + return Float(value) + else + Kernel.then do + return Float(value).tap { exactness[:maybe] += 1 } + rescue ArgumentError, TypeError => e + state[:error] = e + end + end + in -> { _1 <= String } + case value + in String | Symbol | Numeric + exactness[value.is_a?(Numeric) ? :maybe : :yes] += 1 + return value.to_s + in StringIO + exactness[:yes] += 1 + return value.string + else + state[:error] = TypeError.new("#{value.class} can't be coerced into #{String}") + end + in -> { _1 <= Date || _1 <= Time } + Kernel.then do + return target.parse(value).tap { exactness[:yes] += 1 } + rescue ArgumentError, TypeError => e + state[:error] = e + end + in -> { _1 <= StringIO } if value.is_a?(String) + exactness[:yes] += 1 + return StringIO.new(value.b) + else + end + in Symbol + case value + in Symbol | String + if value.to_sym == target + exactness[:yes] += 1 + return target + else + exactness[:maybe] += 1 + return value + end + else + message = "cannot convert non-matching #{value.class} into #{target.inspect}" + state[:error] = ArgumentError.new(message) + end + else + end + + exactness[:no] += 1 + value + # rubocop:enable Metrics/BlockNesting + end + + # @api private + # + # @param target [Docker::Internal::Type::Converter, Class] + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Object] + def dump(target, value, state: {can_retry: true}) + case target + in Docker::Internal::Type::Converter + target.dump(value, state: state) + else + Docker::Internal::Type::Unknown.dump(value, state: state) + end + end + + # @api private + # + # @param target [Object] + # @param depth [Integer] + # + # @return [String] + def inspect(target, depth:) + case target + in Docker::Internal::Type::Converter + target.inspect(depth: depth.succ) + else + target.inspect + end + end + end + + define_sorbet_constant!(:Input) do + T.type_alias { T.any(Docker::Internal::Type::Converter, T::Class[T.anything]) } + end + define_sorbet_constant!(:CoerceState) do + T.type_alias do + { + translate_names: T::Boolean, + strictness: T::Boolean, + exactness: {yes: Integer, no: Integer, maybe: Integer}, + error: T::Class[StandardError], + branched: Integer + } + end + end + define_sorbet_constant!(:DumpState) do + T.type_alias { {can_retry: T::Boolean} } + end + end + end + end +end diff --git a/lib/docker/internal/type/enum.rb b/lib/docker/internal/type/enum.rb new file mode 100644 index 0000000..f76add7 --- /dev/null +++ b/lib/docker/internal/type/enum.rb @@ -0,0 +1,131 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Type + # @api private + # + # A value from among a specified list of options. OpenAPI enum values map to Ruby + # values in the SDK as follows: + # + # 1. boolean => true | false + # 2. integer => Integer + # 3. float => Float + # 4. string => Symbol + # + # We can therefore convert string values to Symbols, but can't convert other + # values safely. + module Enum + include Docker::Internal::Type::Converter + include Docker::Internal::Util::SorbetRuntimeSupport + + # All of the valid Symbol values for this enum. + # + # @return [Array] + def values = constants.map { const_get(_1) } + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ===(other) = values.include?(other) + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ==(other) + # rubocop:disable Style/CaseEquality + Docker::Internal::Type::Enum === other && other.values.to_set == values.to_set + # rubocop:enable Style/CaseEquality + end + + # @api public + # + # @return [Integer] + def hash = values.to_set.hash + + # @api private + # + # Unlike with primitives, `Enum` additionally validates that the value is a member + # of the enum. + # + # @param value [String, Symbol, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Symbol, Object] + def coerce(value, state:) + exactness = state.fetch(:exactness) + val = value.is_a?(String) ? value.to_sym : value + + if values.include?(val) + exactness[:yes] += 1 + val + elsif values.first&.class == val.class + exactness[:maybe] += 1 + value + else + exactness[:no] += 1 + state[:error] = TypeError.new("#{value.class} can't be coerced into #{self}") + value + end + end + + # @!method dump(value, state:) + # @api private + # + # @param value [Symbol, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Symbol, Object] + + # @api private + # + # @return [Object] + def to_sorbet_type + types = values.map { Docker::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) }.uniq + case types + in [] + T.noreturn + in [type] + type + else + T.any(*types) + end + end + + # @api private + # + # @param depth [Integer] + # + # @return [String] + def inspect(depth: 0) + if depth.positive? + return is_a?(Module) ? super() : self.class.name + end + + members = values.map { Docker::Internal::Type::Converter.inspect(_1, depth: depth.succ) } + prefix = is_a?(Module) ? name : self.class.name + + "#{prefix}[#{members.join(' | ')}]" + end + end + end + end +end diff --git a/lib/docker/internal/type/file_input.rb b/lib/docker/internal/type/file_input.rb new file mode 100644 index 0000000..3cd4b6d --- /dev/null +++ b/lib/docker/internal/type/file_input.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Type + # @api private + # + # @abstract + # + # Either `Pathname` or `StringIO`, or `IO`, or + # `Docker::Internal::Type::FileInput`. + # + # Note: when `IO` is used, all retries are disabled, since many IO` streams are + # not rewindable. + class FileInput + extend Docker::Internal::Type::Converter + + private_class_method :new + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def self.===(other) + case other + in Pathname | StringIO | IO | String | Docker::FilePart + true + else + false + end + end + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def self.==(other) = other.is_a?(Class) && other <= Docker::Internal::Type::FileInput + + class << self + # @api private + # + # @param value [StringIO, String, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [StringIO, Object] + def coerce(value, state:) + exactness = state.fetch(:exactness) + case value + in String + exactness[:yes] += 1 + StringIO.new(value) + in StringIO + exactness[:yes] += 1 + value + else + state[:error] = TypeError.new("#{value.class} can't be coerced into #{StringIO}") + exactness[:no] += 1 + value + end + end + + # @api private + # + # @param value [Pathname, StringIO, IO, String, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Pathname, StringIO, IO, String, Object] + def dump(value, state:) + case value + in StringIO | String + # https://datatracker.ietf.org/doc/html/rfc7578#section-4.2 + # while not required, a filename is recommended, and in practice many servers do expect this + Docker::FilePart.new(value, filename: "upload") + in IO + state[:can_retry] = false + value.to_path.nil? ? Docker::FilePart.new(value, filename: "upload") : value + in Docker::FilePart if value.content.is_a?(IO) + state[:can_retry] = false + value + else + value + end + end + + # @api private + # + # @return [Object] + def to_sorbet_type + T.any(Pathname, StringIO, IO, String, Docker::FilePart) + end + end + end + end + end +end diff --git a/lib/docker/internal/type/hash_of.rb b/lib/docker/internal/type/hash_of.rb new file mode 100644 index 0000000..1dc844e --- /dev/null +++ b/lib/docker/internal/type/hash_of.rb @@ -0,0 +1,188 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Type + # @api private + # + # @abstract + # + # @generic Elem + # + # Hash of items of a given type. + class HashOf + include Docker::Internal::Type::Converter + include Docker::Internal::Util::SorbetRuntimeSupport + + private_class_method :new + + # @overload [](type_info, spec = {}) + # + # @param type_info [Hash{Symbol=>Object}, Proc, Docker::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + # + # @return [self] + def self.[](...) = new(...) + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ===(other) + type = item_type + case other + in Hash + other.all? do |key, val| + case [key, val] + in [Symbol | String, ^type] + true + else + false + end + end + else + false + end + end + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ==(other) + # rubocop:disable Layout/LineLength + other.is_a?(Docker::Internal::Type::HashOf) && other.nilable? == nilable? && other.item_type == item_type + # rubocop:enable Layout/LineLength + end + + # @api public + # + # @return [Integer] + def hash = [self.class, item_type].hash + + # @api private + # + # @param value [Hash{Object=>Object}, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Hash{Symbol=>Object}, Object] + def coerce(value, state:) + exactness = state.fetch(:exactness) + + unless value.is_a?(Hash) + exactness[:no] += 1 + state[:error] = TypeError.new("#{value.class} can't be coerced into #{Hash}") + return value + end + + target = item_type + exactness[:yes] += 1 + value + .to_h do |key, val| + k = key.is_a?(String) ? key.to_sym : key + v = + case [nilable?, val] + in [true, nil] + exactness[:yes] += 1 + nil + else + Docker::Internal::Type::Converter.coerce(target, val, state: state) + end + + exactness[:no] += 1 unless k.is_a?(Symbol) + [k, v] + end + end + + # @api private + # + # @param value [Hash{Object=>Object}, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Hash{Symbol=>Object}, Object] + def dump(value, state:) + target = item_type + if value.is_a?(Hash) + value.transform_values do + Docker::Internal::Type::Converter.dump(target, _1, state: state) + end + else + super + end + end + + # @api private + # + # @return [Object] + def to_sorbet_type + T::Hash[Docker::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(item_type)] + end + + # @api private + # + # @return [generic] + protected def item_type = @item_type_fn.call + + # @api private + # + # @return [Boolean] + protected def nilable? = @nilable + + # @api private + # + # @param type_info [Hash{Symbol=>Object}, Proc, Docker::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + def initialize(type_info, spec = {}) + @item_type_fn = Docker::Internal::Type::Converter.type_info(type_info || spec) + @meta = Docker::Internal::Type::Converter.meta_info(type_info, spec) + @nilable = spec.fetch(:nil?, false) + end + + # @api private + # + # @param depth [Integer] + # + # @return [String] + def inspect(depth: 0) + items = Docker::Internal::Type::Converter.inspect(item_type, depth: depth.succ) + + "#{self.class}[#{[items, nilable? ? 'nil' : nil].compact.join(' | ')}]" + end + end + end + end +end diff --git a/lib/docker/internal/type/request_parameters.rb b/lib/docker/internal/type/request_parameters.rb new file mode 100644 index 0000000..c2289e4 --- /dev/null +++ b/lib/docker/internal/type/request_parameters.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Type + # @api private + module RequestParameters + # @!attribute request_options + # Options to specify HTTP behaviour for this request. + # + # @return [Docker::RequestOptions, Hash{Symbol=>Object}] + + # @param mod [Module] + def self.included(mod) + raise ArgumentError.new(mod) unless mod <= Docker::Internal::Type::BaseModel + + mod.optional(:request_options, Docker::RequestOptions) + end + + # @api private + module Converter + # @api private + # + # @param params [Object] + # + # @return [Array(Object, Hash{Symbol=>Object})] + def dump_request(params) + state = {can_retry: true} + case (dumped = dump(params, state: state)) + in Hash + options = Docker::Internal::Util.coerce_hash!(dumped[:request_options]).to_h + request_options = state.fetch(:can_retry) ? options : {**options, max_retries: 0} + [dumped.except(:request_options), request_options] + else + [dumped, nil] + end + end + end + end + end + end +end diff --git a/lib/docker/internal/type/union.rb b/lib/docker/internal/type/union.rb new file mode 100644 index 0000000..432b2a2 --- /dev/null +++ b/lib/docker/internal/type/union.rb @@ -0,0 +1,237 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Type + # @api private + module Union + include Docker::Internal::Type::Converter + include Docker::Internal::Util::SorbetRuntimeSupport + + # @api private + # + # All of the specified variant info for this union. + # + # @return [ArrayObject})>] + private def known_variants = (@known_variants ||= []) + + # @api private + # + # @return [ArrayObject})>] + protected def derefed_variants + known_variants.map { |key, variant_fn, meta| [key, variant_fn.call, meta] } + end + + # All of the specified variants for this union. + # + # @return [Array] + def variants = derefed_variants.map { _2 } + + # @api private + # + # @param property [Symbol] + private def discriminator(property) + case property + in Symbol + @discriminator = property + end + end + + # @api private + # + # @param key [Symbol, Hash{Symbol=>Object}, Proc, Docker::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}, Proc, Docker::Internal::Type::Converter, Class] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + private def variant(key, spec = nil) + meta = Docker::Internal::Type::Converter.meta_info(nil, spec) + variant_info = + case key + in Symbol + [key, Docker::Internal::Type::Converter.type_info(spec), meta] + in Proc | Docker::Internal::Type::Converter | Class | Hash + [nil, Docker::Internal::Type::Converter.type_info(key), meta] + end + + known_variants << variant_info + end + + # @api private + # + # @param value [Object] + # + # @return [Docker::Internal::Type::Converter, Class, nil] + private def resolve_variant(value) + case [@discriminator, value] + in [_, Docker::Internal::Type::BaseModel] + value.class + in [Symbol, Hash] + key = value.fetch(@discriminator) do + value.fetch(@discriminator.to_s, Docker::Internal::OMIT) + end + + return nil if key == Docker::Internal::OMIT + + key = key.to_sym if key.is_a?(String) + _, found = known_variants.find { |k,| k == key } + found&.call + else + nil + end + end + + # rubocop:disable Style/HashEachMethods + # rubocop:disable Style/CaseEquality + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ===(other) + known_variants.any? do |_, variant_fn| + variant_fn.call === other + end + end + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ==(other) + Docker::Internal::Type::Union === other && other.derefed_variants == derefed_variants + end + + # @api public + # + # @return [Integer] + def hash = variants.hash + + # @api private + # + # Tries to efficiently coerce the given value to one of the known variants. + # + # If the value cannot match any of the known variants, the coercion is considered + # non-viable and returns the original value. + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Object] + def coerce(value, state:) + if (target = resolve_variant(value)) + return Docker::Internal::Type::Converter.coerce(target, value, state: state) + end + + strictness = state.fetch(:strictness) + exactness = state.fetch(:exactness) + + alternatives = [] + known_variants.each do |_, variant_fn| + target = variant_fn.call + exact = state[:exactness] = {yes: 0, no: 0, maybe: 0} + state[:branched] += 1 + + coerced = Docker::Internal::Type::Converter.coerce(target, value, state: state) + yes, no, maybe = exact.values + if (no + maybe).zero? || (!strictness && yes.positive?) + exact.each { exactness[_1] += _2 } + state[:exactness] = exactness + return coerced + elsif maybe.positive? + alternatives << [[-yes, -maybe, no], exact, coerced] + end + end + + case alternatives.sort_by!(&:first) + in [] + exactness[:no] += 1 + state[:error] = ArgumentError.new("no matching variant for #{value.inspect}") + value + in [[_, exact, coerced], *] + exact.each { exactness[_1] += _2 } + coerced + end + .tap { state[:exactness] = exactness } + ensure + state[:strictness] = strictness + end + + # @api private + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Object] + def dump(value, state:) + if (target = resolve_variant(value)) + return Docker::Internal::Type::Converter.dump(target, value, state: state) + end + + known_variants.each do + target = _2.call + return Docker::Internal::Type::Converter.dump(target, value, state: state) if target === value + end + + super + end + + # @api private + # + # @return [Object] + def to_sorbet_type + types = variants.map { Docker::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) }.uniq + case types + in [] + T.noreturn + in [type] + type + else + T.any(*types) + end + end + + # rubocop:enable Style/CaseEquality + # rubocop:enable Style/HashEachMethods + + # @api private + # + # @param depth [Integer] + # + # @return [String] + def inspect(depth: 0) + if depth.positive? + return is_a?(Module) ? super() : self.class.name + end + + members = variants.map { Docker::Internal::Type::Converter.inspect(_1, depth: depth.succ) } + prefix = is_a?(Module) ? name : self.class.name + + "#{prefix}[#{members.join(' | ')}]" + end + end + end + end +end diff --git a/lib/docker/internal/type/unknown.rb b/lib/docker/internal/type/unknown.rb new file mode 100644 index 0000000..df09b3b --- /dev/null +++ b/lib/docker/internal/type/unknown.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +module Docker + module Internal + module Type + # @api private + # + # @abstract + # + # When we don't know what to expect for the value. + class Unknown + extend Docker::Internal::Type::Converter + extend Docker::Internal::Util::SorbetRuntimeSupport + + # rubocop:disable Lint/UnusedMethodArgument + + private_class_method :new + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def self.===(other) = true + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def self.==(other) = other.is_a?(Class) && other <= Docker::Internal::Type::Unknown + + class << self + # @api private + # + # No coercion needed for Unknown type. + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Object] + def coerce(value, state:) + state.fetch(:exactness)[:yes] += 1 + value + end + + # @!method dump(value, state:) + # @api private + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Object] + + # @api private + # + # @return [Object] + def to_sorbet_type + T.anything + end + end + + # rubocop:enable Lint/UnusedMethodArgument + end + end + end +end diff --git a/lib/docker/internal/util.rb b/lib/docker/internal/util.rb new file mode 100644 index 0000000..d70a491 --- /dev/null +++ b/lib/docker/internal/util.rb @@ -0,0 +1,920 @@ +# frozen_string_literal: true + +module Docker + module Internal + # @api private + module Util + # @api private + # + # @return [Float] + def self.monotonic_secs = Process.clock_gettime(Process::CLOCK_MONOTONIC) + + # @api private + # + # @param ns [Module, Class] + # + # @return [Enumerable] + def self.walk_namespaces(ns) + ns.constants(false).lazy.flat_map do + case (c = ns.const_get(_1, false)) + in Module | Class + walk_namespaces(c) + else + [] + end + end + .chain([ns]) + end + + class << self + # @api private + # + # @return [String] + def arch + case (arch = RbConfig::CONFIG["arch"])&.downcase + in nil + "unknown" + in /aarch64|arm64/ + "arm64" + in /x86_64/ + "x64" + in /arm/ + "arm" + else + "other:#{arch}" + end + end + + # @api private + # + # @return [String] + def os + case (host = RbConfig::CONFIG["host_os"])&.downcase + in nil + "Unknown" + in /linux/ + "Linux" + in /darwin/ + "MacOS" + in /freebsd/ + "FreeBSD" + in /openbsd/ + "OpenBSD" + in /mswin|mingw|cygwin|ucrt/ + "Windows" + else + "Other:#{host}" + end + end + end + + class << self + # @api private + # + # @param input [Object] + # + # @return [Boolean] + def primitive?(input) + case input + in true | false | Numeric | Symbol | String + true + else + false + end + end + + # @api private + # + # @param input [String, Boolean] + # + # @return [Boolean, Object] + def coerce_boolean(input) + case input.is_a?(String) ? input.downcase : input + in "true" + true + in "false" + false + else + input + end + end + + # @api private + # + # @param input [String, Boolean] + # + # @raise [ArgumentError] + # @return [Boolean, nil] + def coerce_boolean!(input) + case coerce_boolean(input) + in true | false | nil => coerced + coerced + else + raise ArgumentError.new("Unable to coerce #{input.inspect} into boolean value") + end + end + + # @api private + # + # @param input [String, Integer] + # + # @return [Integer, Object] + def coerce_integer(input) + Integer(input, exception: false) || input + end + + # @api private + # + # @param input [String, Integer, Float] + # + # @return [Float, Object] + def coerce_float(input) + Float(input, exception: false) || input + end + + # @api private + # + # @param input [Object] + # + # @return [Hash{Object=>Object}, Object] + def coerce_hash(input) + case input + in NilClass | Array | Set | Enumerator | StringIO | IO + input + else + input.respond_to?(:to_h) ? input.to_h : input + end + end + + # @api private + # + # @param input [Object] + # + # @raise [ArgumentError] + # @return [Hash{Object=>Object}, nil] + def coerce_hash!(input) + case coerce_hash(input) + in Hash | nil => coerced + coerced + else + message = "Expected a #{Hash} or #{Docker::Internal::Type::BaseModel}, got #{data.inspect}" + raise ArgumentError.new(message) + end + end + end + + class << self + # @api private + # + # @param lhs [Object] + # @param rhs [Object] + # @param concat [Boolean] + # + # @return [Object] + private def deep_merge_lr(lhs, rhs, concat: false) + case [lhs, rhs, concat] + in [Hash, Hash, _] + lhs.merge(rhs) { deep_merge_lr(_2, _3, concat: concat) } + in [Array, Array, true] + lhs.concat(rhs) + else + rhs + end + end + + # @api private + # + # Recursively merge one hash with another. If the values at a given key are not + # both hashes, just take the new value. + # + # @param values [Array] + # + # @param sentinel [Object, nil] the value to return if no values are provided. + # + # @param concat [Boolean] whether to merge sequences by concatenation. + # + # @return [Object] + def deep_merge(*values, sentinel: nil, concat: false) + case values + in [value, *values] + values.reduce(value) do |acc, val| + deep_merge_lr(acc, val, concat: concat) + end + else + sentinel + end + end + + # @api private + # + # @param data [Hash{Symbol=>Object}, Array, Object] + # @param pick [Symbol, Integer, Array, Proc, nil] + # @param blk [Proc, nil] + # + # @return [Object, nil] + def dig(data, pick, &blk) + case [data, pick] + in [_, nil] + data + in [Hash, Symbol] | [Array, Integer] + data.fetch(pick) { blk&.call } + in [Hash | Array, Array] + pick.reduce(data) do |acc, key| + case acc + in Hash if acc.key?(key) + acc.fetch(key) + in Array if key.is_a?(Integer) && key < acc.length + acc[key] + else + return blk&.call + end + end + in [_, Proc] + pick.call(data) + else + blk&.call + end + end + end + + class << self + # @api private + # + # @param uri [URI::Generic] + # + # @return [String] + def uri_origin(uri) + "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}" + end + + # @api private + # + # @param path [String, Array] + # + # @return [String] + def interpolate_path(path) + case path + in String + path + in [] + "" + in [String => p, *interpolations] + encoded = interpolations.map { ERB::Util.url_encode(_1) } + format(p, *encoded) + end + end + end + + class << self + # @api private + # + # @param query [String, nil] + # + # @return [Hash{String=>Array}] + def decode_query(query) + CGI.parse(query.to_s) + end + + # @api private + # + # @param query [Hash{String=>Array, String, nil}, nil] + # + # @return [String, nil] + def encode_query(query) + query.to_h.empty? ? nil : URI.encode_www_form(query) + end + end + + class << self + # @api private + # + # @param url [URI::Generic, String] + # + # @return [Hash{Symbol=>String, Integer, nil}] + def parse_uri(url) + parsed = URI::Generic.component.zip(URI.split(url)).to_h + {**parsed, query: decode_query(parsed.fetch(:query))} + end + + # @api private + # + # @param parsed [Hash{Symbol=>String, Integer, nil}] . + # + # @option parsed [String, nil] :scheme + # + # @option parsed [String, nil] :host + # + # @option parsed [Integer, nil] :port + # + # @option parsed [String, nil] :path + # + # @option parsed [Hash{String=>Array}] :query + # + # @return [URI::Generic] + def unparse_uri(parsed) + URI::Generic.build(**parsed, query: encode_query(parsed.fetch(:query))) + end + + # @api private + # + # @param lhs [Hash{Symbol=>String, Integer, nil}] . + # + # @option lhs [String, nil] :scheme + # + # @option lhs [String, nil] :host + # + # @option lhs [Integer, nil] :port + # + # @option lhs [String, nil] :path + # + # @option lhs [Hash{String=>Array}] :query + # + # @param rhs [Hash{Symbol=>String, Integer, nil}] . + # + # @option rhs [String, nil] :scheme + # + # @option rhs [String, nil] :host + # + # @option rhs [Integer, nil] :port + # + # @option rhs [String, nil] :path + # + # @option rhs [Hash{String=>Array}] :query + # + # @return [URI::Generic] + def join_parsed_uri(lhs, rhs) + base_path, base_query = lhs.fetch_values(:path, :query) + slashed = base_path.end_with?("/") ? base_path : "#{base_path}/" + + merged = {**parse_uri(rhs.fetch(:path)), **rhs.except(:path, :query)} + parsed_path, parsed_query = merged.fetch_values(:path, :query) + override = URI::Generic.build(**merged.slice(:scheme, :host, :port), path: parsed_path) + + joined = URI.join(URI::Generic.build(lhs.except(:path, :query)), slashed, override) + query = deep_merge( + joined.path == base_path ? base_query : {}, + parsed_query, + rhs[:query].to_h, + concat: true + ) + + joined.query = encode_query(query) + joined + end + end + + class << self + # @api private + # + # @param headers [Hash{String=>String, Integer, Array, nil}] + # + # @return [Hash{String=>String}] + def normalized_headers(*headers) + {}.merge(*headers.compact).to_h do |key, val| + value = + case val + in Array + val.filter_map { _1&.to_s&.strip }.join(", ") + else + val&.to_s&.strip + end + [key.downcase, value] + end + end + end + + # @api private + # + # An adapter that satisfies the IO interface required by `::IO.copy_stream` + class ReadIOAdapter + # @api private + # + # @return [Boolean, nil] + def close? = @closing + + # @api private + def close + case @stream + in Enumerator + Docker::Internal::Util.close_fused!(@stream) + in IO if close? + @stream.close + else + end + end + + # @api private + # + # @param max_len [Integer, nil] + # + # @return [String] + private def read_enum(max_len) + case max_len + in nil + @stream.to_a.join + in Integer + @buf << @stream.next while @buf.length < max_len + @buf.slice!(..max_len) + end + rescue StopIteration + @stream = nil + @buf.slice!(0..) + end + + # @api private + # + # @param max_len [Integer, nil] + # @param out_string [String, nil] + # + # @return [String, nil] + def read(max_len = nil, out_string = nil) + case @stream + in nil + nil + in IO | StringIO + @stream.read(max_len, out_string) + in Enumerator + read = read_enum(max_len) + case out_string + in String + out_string.replace(read) + in nil + read + end + end + .tap(&@blk) + end + + # @api private + # + # @param src [String, Pathname, StringIO, Enumerable] + # @param blk [Proc] + # + # @yieldparam [String] + def initialize(src, &blk) + @stream = + case src + in String + StringIO.new(src) + in Pathname + @closing = true + src.open(binmode: true) + else + src + end + @buf = String.new + @blk = blk + end + end + + class << self + # @param blk [Proc] + # + # @yieldparam [Enumerator::Yielder] + # @return [Enumerable] + def writable_enum(&blk) + Enumerator.new do |y| + y.define_singleton_method(:write) do + self << _1.dup + _1.bytesize + end + + blk.call(y) + end + end + end + + # @type [Regexp] + JSON_CONTENT = %r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)} + # @type [Regexp] + JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)} + + class << self + # @api private + # + # @param y [Enumerator::Yielder] + # @param val [Object] + # @param closing [Array] + # @param content_type [String, nil] + private def write_multipart_content(y, val:, closing:, content_type: nil) + content_line = "Content-Type: %s\r\n\r\n" + + case val + in Docker::FilePart + return write_multipart_content( + y, + val: val.content, + closing: closing, + content_type: val.content_type + ) + in Pathname + y << format(content_line, content_type || "application/octet-stream") + io = val.open(binmode: true) + closing << io.method(:close) + IO.copy_stream(io, y) + in IO + y << format(content_line, content_type || "application/octet-stream") + IO.copy_stream(val, y) + in StringIO + y << format(content_line, content_type || "application/octet-stream") + y << val.string + in -> { primitive?(_1) } + y << format(content_line, content_type || "text/plain") + y << val.to_s + else + y << format(content_line, content_type || "application/json") + y << JSON.generate(val) + end + y << "\r\n" + end + + # @api private + # + # @param y [Enumerator::Yielder] + # @param boundary [String] + # @param key [Symbol, String] + # @param val [Object] + # @param closing [Array] + private def write_multipart_chunk(y, boundary:, key:, val:, closing:) + y << "--#{boundary}\r\n" + y << "Content-Disposition: form-data" + + unless key.nil? + name = ERB::Util.url_encode(key.to_s) + y << "; name=\"#{name}\"" + end + + case val + in Docker::FilePart unless val.filename.nil? + filename = ERB::Util.url_encode(val.filename) + y << "; filename=\"#{filename}\"" + in Pathname | IO + filename = ERB::Util.url_encode(::File.basename(val.to_path)) + y << "; filename=\"#{filename}\"" + else + end + y << "\r\n" + + write_multipart_content(y, val: val, closing: closing) + end + + # @api private + # + # https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#special-considerations-for-multipart-content + # + # @param body [Object] + # + # @return [Array(String, Enumerable)] + private def encode_multipart_streaming(body) + # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length + boundary = SecureRandom.urlsafe_base64(46) + + closing = [] + strio = writable_enum do |y| + case body + in Hash + body.each do |key, val| + case val + in Array if val.all? { primitive?(_1) } + val.each do |v| + write_multipart_chunk(y, boundary: boundary, key: key, val: v, closing: closing) + end + else + write_multipart_chunk(y, boundary: boundary, key: key, val: val, closing: closing) + end + end + else + write_multipart_chunk(y, boundary: boundary, key: nil, val: body, closing: closing) + end + y << "--#{boundary}--\r\n" + end + + fused_io = fused_enum(strio) { closing.each(&:call) } + [boundary, fused_io] + end + + # @api private + # + # @param headers [Hash{String=>String}] + # @param body [Object] + # + # @return [Object] + def encode_content(headers, body) + # rubocop:disable Style/CaseEquality + # rubocop:disable Layout/LineLength + content_type = headers["content-type"] + case [content_type, body] + in [Docker::Internal::Util::JSON_CONTENT, Hash | Array | -> { primitive?(_1) }] + [headers, JSON.generate(body)] + in [Docker::Internal::Util::JSONL_CONTENT, Enumerable] unless Docker::Internal::Type::FileInput === body + [headers, body.lazy.map { JSON.generate(_1) }] + in [%r{^multipart/form-data}, Hash | Docker::Internal::Type::FileInput] + boundary, strio = encode_multipart_streaming(body) + headers = {**headers, "content-type" => "#{content_type}; boundary=#{boundary}"} + [headers, strio] + in [_, Symbol | Numeric] + [headers, body.to_s] + in [_, StringIO] + [headers, body.string] + in [_, Docker::FilePart] + [headers, body.content] + else + [headers, body] + end + # rubocop:enable Layout/LineLength + # rubocop:enable Style/CaseEquality + end + + # @api private + # + # https://www.iana.org/assignments/character-sets/character-sets.xhtml + # + # @param content_type [String] + # @param text [String] + def force_charset!(content_type, text:) + charset = /charset=([^;\s]+)/.match(content_type)&.captures&.first + + return unless charset + + begin + encoding = Encoding.find(charset) + text.force_encoding(encoding) + rescue ArgumentError + nil + end + end + + # @api private + # + # Assumes each chunk in stream has `Encoding::BINARY`. + # + # @param headers [Hash{String=>String}] + # @param stream [Enumerable] + # @param suppress_error [Boolean] + # + # @raise [JSON::ParserError] + # @return [Object] + def decode_content(headers, stream:, suppress_error: false) + case (content_type = headers["content-type"]) + in Docker::Internal::Util::JSON_CONTENT + return nil if (json = stream.to_a.join).empty? + + begin + JSON.parse(json, symbolize_names: true) + rescue JSON::ParserError => e + raise e unless suppress_error + json + end + in Docker::Internal::Util::JSONL_CONTENT + lines = decode_lines(stream) + chain_fused(lines) do |y| + lines.each do + next if _1.empty? + + y << JSON.parse(_1, symbolize_names: true) + end + end + in %r{^text/event-stream} + lines = decode_lines(stream) + decode_sse(lines) + else + text = stream.to_a.join + force_charset!(content_type, text: text) + StringIO.new(text) + end + end + end + + class << self + # @api private + # + # https://doc.rust-lang.org/std/iter/trait.FusedIterator.html + # + # @param enum [Enumerable] + # @param external [Boolean] + # @param close [Proc] + # + # @return [Enumerable] + def fused_enum(enum, external: false, &close) + fused = false + iter = Enumerator.new do |y| + next if fused + + fused = true + if external + loop { y << enum.next } + else + enum.each(&y) + end + ensure + close&.call + close = nil + end + + iter.define_singleton_method(:rewind) do + fused = true + self + end + iter + end + + # @api private + # + # @param enum [Enumerable, nil] + def close_fused!(enum) + return unless enum.is_a?(Enumerator) + + # rubocop:disable Lint/UnreachableLoop + enum.rewind.each { break } + # rubocop:enable Lint/UnreachableLoop + end + + # @api private + # + # @param enum [Enumerable, nil] + # @param blk [Proc] + # + # @yieldparam [Enumerator::Yielder] + # @return [Enumerable] + def chain_fused(enum, &blk) + iter = Enumerator.new { blk.call(_1) } + fused_enum(iter) { close_fused!(enum) } + end + end + + class << self + # @api private + # + # Assumes Strings have been forced into having `Encoding::BINARY`. + # + # This decoder is responsible for reassembling lines split across multiple + # fragments. + # + # @param enum [Enumerable] + # + # @return [Enumerable] + def decode_lines(enum) + re = /(\r\n|\r|\n)/ + buffer = String.new + cr_seen = nil + + chain_fused(enum) do |y| + enum.each do |row| + offset = buffer.bytesize + buffer << row + while (match = re.match(buffer, cr_seen&.to_i || offset)) + case [match.captures.first, cr_seen] + in ["\r", nil] + cr_seen = match.end(1) + next + in ["\r" | "\r\n", Integer] + y << buffer.slice!(..(cr_seen.pred)) + else + y << buffer.slice!(..(match.end(1).pred)) + end + offset = 0 + cr_seen = nil + end + end + + y << buffer.slice!(..(cr_seen.pred)) unless cr_seen.nil? + y << buffer unless buffer.empty? + end + end + + # @api private + # + # https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream + # + # Assumes that `lines` has been decoded with `#decode_lines`. + # + # @param lines [Enumerable] + # + # @return [EnumerableObject}>] + def decode_sse(lines) + # rubocop:disable Metrics/BlockLength + chain_fused(lines) do |y| + blank = {event: nil, data: nil, id: nil, retry: nil} + current = {} + + lines.each do |line| + case line.sub(/\R$/, "") + in "" + next if current.empty? + y << {**blank, **current} + current = {} + in /^:/ + next + in /^([^:]+):\s?(.*)$/ + field, value = Regexp.last_match.captures + case field + in "event" + current.merge!(event: value) + in "data" + (current[:data] ||= String.new) << (value << "\n") + in "id" unless value.include?("\0") + current.merge!(id: value) + in "retry" if /^\d+$/ =~ value + current.merge!(retry: Integer(value)) + else + end + else + end + end + # rubocop:enable Metrics/BlockLength + + y << {**blank, **current} unless current.empty? + end + end + end + + # @api private + module SorbetRuntimeSupport + class MissingSorbetRuntimeError < ::RuntimeError + end + + # @api private + # + # @return [Hash{Symbol=>Object}] + private def sorbet_runtime_constants = @sorbet_runtime_constants ||= {} + + # @api private + # + # @param name [Symbol] + def const_missing(name) + super unless sorbet_runtime_constants.key?(name) + + unless Object.const_defined?(:T) + message = "Trying to access a Sorbet constant #{name.inspect} without `sorbet-runtime`." + raise MissingSorbetRuntimeError.new(message) + end + + sorbet_runtime_constants.fetch(name).call + end + + # @api private + # + # @param name [Symbol] + # + # @return [Boolean] + def sorbet_constant_defined?(name) = sorbet_runtime_constants.key?(name) + + # @api private + # + # @param name [Symbol] + # @param blk [Proc] + def define_sorbet_constant!(name, &blk) = sorbet_runtime_constants.store(name, blk) + + # @api private + # + # @return [Object] + def to_sorbet_type = raise NotImplementedError + + class << self + # @api private + # + # @param type [Docker::Internal::Util::SorbetRuntimeSupport, Object] + # + # @return [Object] + def to_sorbet_type(type) + case type + in Docker::Internal::Util::SorbetRuntimeSupport + type.to_sorbet_type + in Class | Module + type + in true | false + T::Boolean + else + type.class + end + end + end + end + + extend Docker::Internal::Util::SorbetRuntimeSupport + + define_sorbet_constant!(:ParsedUri) do + T.type_alias do + { + scheme: T.nilable(String), + host: T.nilable(String), + port: T.nilable(Integer), + path: T.nilable(String), + query: T::Hash[String, T::Array[String]] + } + end + end + + define_sorbet_constant!(:ServerSentEvent) do + T.type_alias do + { + event: T.nilable(String), + data: T.nilable(String), + id: T.nilable(String), + retry: T.nilable(Integer) + } + end + end + end + end +end diff --git a/lib/docker/models.rb b/lib/docker/models.rb new file mode 100644 index 0000000..a42172e --- /dev/null +++ b/lib/docker/models.rb @@ -0,0 +1,121 @@ +# frozen_string_literal: true + +module Docker + [Docker::Internal::Type::BaseModel, *Docker::Internal::Type::BaseModel.subclasses].each do |cls| + cls.define_sorbet_constant!(:OrHash) { T.type_alias { T.any(cls, Docker::Internal::AnyHash) } } + end + + Docker::Internal::Util.walk_namespaces(Docker::Models).each do |mod| + case mod + in Docker::Internal::Type::Enum | Docker::Internal::Type::Union + mod.constants.each do |name| + case mod.const_get(name) + in true | false + mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } } + mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } } + in Integer + mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } } + mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } } + in Float + mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } } + mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } } + in Symbol + mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } } + mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } } + else + end + end + else + end + end + + Docker::Internal::Util.walk_namespaces(Docker::Models) + .lazy + .grep(Docker::Internal::Type::Union) + .each do |mod| + const = :Variants + next if mod.sorbet_constant_defined?(const) + + mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } } + end + + AuthLoginParams = Docker::Models::AuthLoginParams + + AuthResponse = Docker::Models::AuthResponse + + Config = Docker::Models::Config + + Container = Docker::Models::Container + + ContainerCreateParams = Docker::Models::ContainerCreateParams + + ContainerDeleteParams = Docker::Models::ContainerDeleteParams + + ContainerInspectParams = Docker::Models::ContainerInspectParams + + ContainerKillParams = Docker::Models::ContainerKillParams + + ContainerListParams = Docker::Models::ContainerListParams + + ContainerLogsParams = Docker::Models::ContainerLogsParams + + ContainerStartParams = Docker::Models::ContainerStartParams + + ContainerStopParams = Docker::Models::ContainerStopParams + + CreateRequest = Docker::Models::CreateRequest + + CreateResponse = Docker::Models::CreateResponse + + Error = Docker::Models::Error + + Image = Docker::Models::Image + + ImageDeleteParams = Docker::Models::ImageDeleteParams + + ImageInspectParams = Docker::Models::ImageInspectParams + + ImageListParams = Docker::Models::ImageListParams + + ImagePullParams = Docker::Models::ImagePullParams + + Network = Docker::Models::Network + + NetworkCreateParams = Docker::Models::NetworkCreateParams + + NetworkDeleteParams = Docker::Models::NetworkDeleteParams + + NetworkInspectParams = Docker::Models::NetworkInspectParams + + NetworkListParams = Docker::Models::NetworkListParams + + Service = Docker::Models::Service + + ServiceCreateParams = Docker::Models::ServiceCreateParams + + ServiceDeleteParams = Docker::Models::ServiceDeleteParams + + ServiceInspectParams = Docker::Models::ServiceInspectParams + + ServiceListParams = Docker::Models::ServiceListParams + + Spec = Docker::Models::Spec + + Summary = Docker::Models::Summary + + SystemInfoParams = Docker::Models::SystemInfoParams + + SystemPingParams = Docker::Models::SystemPingParams + + SystemVersionParams = Docker::Models::SystemVersionParams + + Volume = Docker::Models::Volume + + VolumeCreateParams = Docker::Models::VolumeCreateParams + + VolumeDeleteParams = Docker::Models::VolumeDeleteParams + + VolumeInspectParams = Docker::Models::VolumeInspectParams + + VolumeListParams = Docker::Models::VolumeListParams +end diff --git a/lib/docker/models/auth_login_params.rb b/lib/docker/models/auth_login_params.rb new file mode 100644 index 0000000..8f12d3b --- /dev/null +++ b/lib/docker/models/auth_login_params.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Auth#login + class AuthLoginParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute password + # + # @return [String, nil] + optional :password, String + + # @!attribute serveraddress + # + # @return [String, nil] + optional :serveraddress, String + + # @!attribute username + # + # @return [String, nil] + optional :username, String + + # @!method initialize(password: nil, serveraddress: nil, username: nil, request_options: {}) + # @param password [String] + # @param serveraddress [String] + # @param username [String] + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/auth_response.rb b/lib/docker/models/auth_response.rb new file mode 100644 index 0000000..2698013 --- /dev/null +++ b/lib/docker/models/auth_response.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Auth#login + class AuthResponse < Docker::Internal::Type::BaseModel + # @!attribute status + # The status of the authentication + # + # @return [String] + required :status, String, api_name: :Status + + # @!attribute identity_token + # An opaque token used to authenticate a user after a successful login + # + # @return [String, nil] + optional :identity_token, String, api_name: :IdentityToken + + # @!method initialize(status:, identity_token: nil) + # An identity token was generated successfully. + # + # @param status [String] The status of the authentication + # + # @param identity_token [String] An opaque token used to authenticate a user after a successful login + end + end +end diff --git a/lib/docker/models/config.rb b/lib/docker/models/config.rb new file mode 100644 index 0000000..388a775 --- /dev/null +++ b/lib/docker/models/config.rb @@ -0,0 +1,302 @@ +# frozen_string_literal: true + +module Docker + module Models + class Config < Docker::Internal::Type::BaseModel + # @!attribute args_escaped + # Command is already escaped (Windows only) + # + # @return [Boolean, nil] + optional :args_escaped, Docker::Internal::Type::Boolean, api_name: :ArgsEscaped, nil?: true + + # @!attribute attach_stderr + # Whether to attach to `stderr`. + # + # @return [Boolean, nil] + optional :attach_stderr, Docker::Internal::Type::Boolean, api_name: :AttachStderr + + # @!attribute attach_stdin + # Whether to attach to `stdin`. + # + # @return [Boolean, nil] + optional :attach_stdin, Docker::Internal::Type::Boolean, api_name: :AttachStdin + + # @!attribute attach_stdout + # Whether to attach to `stdout`. + # + # @return [Boolean, nil] + optional :attach_stdout, Docker::Internal::Type::Boolean, api_name: :AttachStdout + + # @!attribute cmd + # Command to run specified as a string or an array of strings. + # + # @return [Array, nil] + optional :cmd, Docker::Internal::Type::ArrayOf[String], api_name: :Cmd + + # @!attribute domainname + # The domain name to use for the container. + # + # @return [String, nil] + optional :domainname, String, api_name: :Domainname + + # @!attribute entrypoint + # The entry point for the container as a string or an array of strings. + # + # If the array consists of exactly one empty string (`[""]`) then the entry point + # is reset to system default (i.e., the entry point used by docker when there is + # no `ENTRYPOINT` instruction in the `Dockerfile`). + # + # @return [Array, nil] + optional :entrypoint, Docker::Internal::Type::ArrayOf[String], api_name: :Entrypoint + + # @!attribute env + # A list of environment variables to set inside the container in the form + # `["VAR=value", ...]`. A variable without `=` is removed from the environment, + # rather than to have an empty value. + # + # @return [Array, nil] + optional :env, Docker::Internal::Type::ArrayOf[String], api_name: :Env + + # @!attribute exposed_ports + # An object mapping ports to an empty object in the form: + # + # `{"/": {}}` + # + # @return [Hash{Symbol=>Object}, nil] + optional :exposed_ports, + Docker::Internal::Type::HashOf[Docker::Internal::Type::Unknown], + api_name: :ExposedPorts, + nil?: true + + # @!attribute healthcheck + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + # + # @return [Docker::Models::Config::Healthcheck, nil] + optional :healthcheck, -> { Docker::Config::Healthcheck }, api_name: :Healthcheck + + # @!attribute hostname + # The hostname to use for the container, as a valid RFC 1123 hostname. + # + # @return [String, nil] + optional :hostname, String, api_name: :Hostname + + # @!attribute image + # The name (or reference) of the image to use when creating the container, or + # which was used when the container was created. + # + # @return [String, nil] + optional :image, String, api_name: :Image + + # @!attribute labels + # User-defined key/value metadata. + # + # @return [Hash{Symbol=>String}, nil] + optional :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute network_disabled + # Disable networking for the container. + # + # @return [Boolean, nil] + optional :network_disabled, Docker::Internal::Type::Boolean, api_name: :NetworkDisabled, nil?: true + + # @!attribute on_build + # `ONBUILD` metadata that were defined in the image's `Dockerfile`. + # + # @return [Array, nil] + optional :on_build, Docker::Internal::Type::ArrayOf[String], api_name: :OnBuild, nil?: true + + # @!attribute open_stdin + # Open `stdin` + # + # @return [Boolean, nil] + optional :open_stdin, Docker::Internal::Type::Boolean, api_name: :OpenStdin + + # @!attribute shell + # Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + # + # @return [Array, nil] + optional :shell, Docker::Internal::Type::ArrayOf[String], api_name: :Shell, nil?: true + + # @!attribute stdin_once + # Close `stdin` after one attached client disconnects + # + # @return [Boolean, nil] + optional :stdin_once, Docker::Internal::Type::Boolean, api_name: :StdinOnce + + # @!attribute stop_signal + # Signal to stop a container as a string or unsigned integer. + # + # @return [String, nil] + optional :stop_signal, String, api_name: :StopSignal, nil?: true + + # @!attribute stop_timeout + # Timeout to stop a container in seconds. + # + # @return [Integer, nil] + optional :stop_timeout, Integer, api_name: :StopTimeout, nil?: true + + # @!attribute tty + # Attach standard streams to a TTY, including `stdin` if it is not closed. + # + # @return [Boolean, nil] + optional :tty, Docker::Internal::Type::Boolean, api_name: :Tty + + # @!attribute user + # Commands run as this user inside the container. If omitted, commands run as the + # user specified in the image the container was started from. + # + # Can be either user-name or UID, and optional group-name or GID, separated by a + # colon (`[<:group-name|GID>]`). + # + # @return [String, nil] + optional :user, String, api_name: :User + + # @!attribute volumes + # An object mapping mount point paths inside the container to empty objects. + # + # @return [Hash{Symbol=>Object}, nil] + optional :volumes, Docker::Internal::Type::HashOf[Docker::Internal::Type::Unknown], api_name: :Volumes + + # @!attribute working_dir + # The working directory for commands to run in. + # + # @return [String, nil] + optional :working_dir, String, api_name: :WorkingDir + + # @!method initialize(args_escaped: nil, attach_stderr: nil, attach_stdin: nil, attach_stdout: nil, cmd: nil, domainname: nil, entrypoint: nil, env: nil, exposed_ports: nil, healthcheck: nil, hostname: nil, image: nil, labels: nil, network_disabled: nil, on_build: nil, open_stdin: nil, shell: nil, stdin_once: nil, stop_signal: nil, stop_timeout: nil, tty: nil, user: nil, volumes: nil, working_dir: nil) + # Some parameter documentations has been truncated, see {Docker::Models::Config} + # for more details. + # + # Configuration for a container that is portable between hosts. + # + # @param args_escaped [Boolean, nil] Command is already escaped (Windows only) + # + # @param attach_stderr [Boolean] Whether to attach to `stderr`. + # + # @param attach_stdin [Boolean] Whether to attach to `stdin`. + # + # @param attach_stdout [Boolean] Whether to attach to `stdout`. + # + # @param cmd [Array] Command to run specified as a string or an array of strings. + # + # @param domainname [String] The domain name to use for the container. + # + # @param entrypoint [Array] The entry point for the container as a string or an array of strings. + # + # @param env [Array] A list of environment variables to set inside the container in the + # + # @param exposed_ports [Hash{Symbol=>Object}, nil] An object mapping ports to an empty object in the form: + # + # @param healthcheck [Docker::Models::Config::Healthcheck] A test to perform to check that the container is healthy. + # + # @param hostname [String] The hostname to use for the container, as a valid RFC 1123 hostname. + # + # @param image [String] The name (or reference) of the image to use when creating the container, + # + # @param labels [Hash{Symbol=>String}] User-defined key/value metadata. + # + # @param network_disabled [Boolean, nil] Disable networking for the container. + # + # @param on_build [Array, nil] `ONBUILD` metadata that were defined in the image's `Dockerfile`. + # + # @param open_stdin [Boolean] Open `stdin` + # + # @param shell [Array, nil] Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + # + # @param stdin_once [Boolean] Close `stdin` after one attached client disconnects + # + # @param stop_signal [String, nil] Signal to stop a container as a string or unsigned integer. + # + # @param stop_timeout [Integer, nil] Timeout to stop a container in seconds. + # + # @param tty [Boolean] Attach standard streams to a TTY, including `stdin` if it is not closed. + # + # @param user [String] Commands run as this user inside the container. If omitted, commands + # + # @param volumes [Hash{Symbol=>Object}] An object mapping mount point paths inside the container to empty + # + # @param working_dir [String] The working directory for commands to run in. + + # @see Docker::Models::Config#healthcheck + class Healthcheck < Docker::Internal::Type::BaseModel + # @!attribute interval + # The time to wait between checks in nanoseconds. It should be 0 or at least + # 1000000 (1 ms). 0 means inherit. + # + # @return [Integer, nil] + optional :interval, Integer, api_name: :Interval + + # @!attribute retries + # The number of consecutive failures needed to consider a container as unhealthy. + # 0 means inherit. + # + # @return [Integer, nil] + optional :retries, Integer, api_name: :Retries + + # @!attribute start_interval + # The time to wait between checks in nanoseconds during the start period. It + # should be 0 or at least 1000000 (1 ms). 0 means inherit. + # + # @return [Integer, nil] + optional :start_interval, Integer, api_name: :StartInterval + + # @!attribute start_period + # Start period for the container to initialize before starting health-retries + # countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means + # inherit. + # + # @return [Integer, nil] + optional :start_period, Integer, api_name: :StartPeriod + + # @!attribute test_ + # The test to perform. Possible values are: + # + # - `[]` inherit healthcheck from image or parent image + # - `["NONE"]` disable healthcheck + # - `["CMD", args...]` exec arguments directly + # - `["CMD-SHELL", command]` run command with system's default shell + # + # A non-zero exit code indicates a failed healthcheck: + # + # - `0` healthy + # - `1` unhealthy + # - `2` reserved (treated as unhealthy) + # - other values: error running probe + # + # @return [Array, nil] + optional :test_, Docker::Internal::Type::ArrayOf[String], api_name: :Test + + # @!attribute timeout + # The time to wait before considering the check to have hung. It should be 0 or at + # least 1000000 (1 ms). 0 means inherit. + # + # If the health check command does not complete within this timeout, the check is + # considered failed and the health check process is forcibly terminated without a + # graceful shutdown. + # + # @return [Integer, nil] + optional :timeout, Integer, api_name: :Timeout + + # @!method initialize(interval: nil, retries: nil, start_interval: nil, start_period: nil, test_: nil, timeout: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Config::Healthcheck} for more details. + # + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + # + # @param interval [Integer] The time to wait between checks in nanoseconds. It should be 0 or at + # + # @param retries [Integer] The number of consecutive failures needed to consider a container as + # + # @param start_interval [Integer] The time to wait between checks in nanoseconds during the start period. + # + # @param start_period [Integer] Start period for the container to initialize before starting + # + # @param test_ [Array] The test to perform. Possible values are: + # + # @param timeout [Integer] The time to wait before considering the check to have hung. It should + end + end + end +end diff --git a/lib/docker/models/container.rb b/lib/docker/models/container.rb new file mode 100644 index 0000000..e0e30f8 --- /dev/null +++ b/lib/docker/models/container.rb @@ -0,0 +1,2461 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Containers#inspect_ + class Container < Docker::Internal::Type::BaseModel + # @!attribute app_armor_profile + # The AppArmor profile set for the container. + # + # @return [String, nil] + optional :app_armor_profile, String, api_name: :AppArmorProfile + + # @!attribute args + # The arguments to the command being run + # + # @return [Array, nil] + optional :args, Docker::Internal::Type::ArrayOf[String], api_name: :Args + + # @!attribute config + # Configuration for a container that is portable between hosts. + # + # @return [Docker::Models::Config, nil] + optional :config, -> { Docker::Config }, api_name: :Config + + # @!attribute created + # Date and time at which the container was created, formatted in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + # + # @return [String, nil] + optional :created, String, api_name: :Created, nil?: true + + # @!attribute driver + # The storage-driver used for the container's filesystem (graph-driver or + # snapshotter). + # + # @return [String, nil] + optional :driver, String, api_name: :Driver + + # @!attribute exec_ids + # IDs of exec instances that are running in the container. + # + # @return [Array, nil] + optional :exec_ids, Docker::Internal::Type::ArrayOf[String], api_name: :ExecIDs, nil?: true + + # @!attribute graph_driver + # Information about the storage driver used to store the container's and image's + # filesystem. + # + # @return [Docker::Models::Container::GraphDriver, nil] + optional :graph_driver, -> { Docker::Container::GraphDriver }, api_name: :GraphDriver + + # @!attribute host_config + # Container configuration that depends on the host we are running on + # + # @return [Docker::Models::Container::HostConfig, nil] + optional :host_config, -> { Docker::Container::HostConfig }, api_name: :HostConfig + + # @!attribute hostname_path + # Location of the `/etc/hostname` generated for the container on the host. + # + # This file is managed through the docker daemon, and should not be accessed or + # modified by other tools. + # + # @return [String, nil] + optional :hostname_path, String, api_name: :HostnamePath + + # @!attribute hosts_path + # Location of the `/etc/hosts` generated for the container on the host. + # + # This file is managed through the docker daemon, and should not be accessed or + # modified by other tools. + # + # @return [String, nil] + optional :hosts_path, String, api_name: :HostsPath + + # @!attribute id + # The ID of this container as a 128-bit (64-character) hexadecimal string (32 + # bytes). + # + # @return [String, nil] + optional :id, String, api_name: :Id + + # @!attribute image + # The ID (digest) of the image that this container was created from. + # + # @return [String, nil] + optional :image, String, api_name: :Image + + # @!attribute image_manifest_descriptor + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + # + # @return [Docker::Models::Container::ImageManifestDescriptor, nil] + optional :image_manifest_descriptor, + -> { Docker::Container::ImageManifestDescriptor }, + api_name: :ImageManifestDescriptor + + # @!attribute log_path + # Location of the file used to buffer the container's logs. Depending on the + # logging-driver used for the container, this field may be omitted. + # + # This file is managed through the docker daemon, and should not be accessed or + # modified by other tools. + # + # @return [String, nil] + optional :log_path, String, api_name: :LogPath, nil?: true + + # @!attribute mount_label + # SELinux mount label set for the container. + # + # @return [String, nil] + optional :mount_label, String, api_name: :MountLabel + + # @!attribute mounts + # List of mounts used by the container. + # + # @return [Array, nil] + optional :mounts, -> { Docker::Internal::Type::ArrayOf[Docker::Container::Mount] }, api_name: :Mounts + + # @!attribute name + # The name associated with this container. + # + # For historic reasons, the name may be prefixed with a forward-slash (`/`). + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute network_settings + # NetworkSettings exposes the network settings in the API + # + # @return [Docker::Models::Container::NetworkSettings, nil] + optional :network_settings, -> { Docker::Container::NetworkSettings }, api_name: :NetworkSettings + + # @!attribute path + # The path to the command being run + # + # @return [String, nil] + optional :path, String, api_name: :Path + + # @!attribute platform + # The platform (operating system) for which the container was created. + # + # This field was introduced for the experimental "LCOW" (Linux Containers On + # Windows) features, which has been removed. In most cases, this field is equal to + # the host's operating system (`linux` or `windows`). + # + # @return [String, nil] + optional :platform, String, api_name: :Platform + + # @!attribute process_label + # SELinux process label set for the container. + # + # @return [String, nil] + optional :process_label, String, api_name: :ProcessLabel + + # @!attribute resolv_conf_path + # Location of the `/etc/resolv.conf` generated for the container on the host. + # + # This file is managed through the docker daemon, and should not be accessed or + # modified by other tools. + # + # @return [String, nil] + optional :resolv_conf_path, String, api_name: :ResolvConfPath + + # @!attribute restart_count + # Number of times the container was restarted since it was created, or since + # daemon was started. + # + # @return [Integer, nil] + optional :restart_count, Integer, api_name: :RestartCount + + # @!attribute size_root_fs + # The total size of all files in the read-only layers from the image that the + # container uses. These layers can be shared between containers. + # + # This field is omitted by default, and only set when size is requested in the API + # request. + # + # @return [Integer, nil] + optional :size_root_fs, Integer, api_name: :SizeRootFs, nil?: true + + # @!attribute size_rw + # The size of files that have been created or changed by this container. + # + # This field is omitted by default, and only set when size is requested in the API + # request. + # + # @return [Integer, nil] + optional :size_rw, Integer, api_name: :SizeRw, nil?: true + + # @!attribute state + # ContainerState stores container's running state. It's part of ContainerJSONBase + # and will be returned by the "inspect" command. + # + # @return [Docker::Models::Container::State, nil] + optional :state, -> { Docker::Container::State }, api_name: :State, nil?: true + + # @!attribute storage + # Information about the storage used by the container. + # + # @return [Docker::Models::Container::Storage, nil] + optional :storage, -> { Docker::Container::Storage }, api_name: :Storage + + # @!method initialize(app_armor_profile: nil, args: nil, config: nil, created: nil, driver: nil, exec_ids: nil, graph_driver: nil, host_config: nil, hostname_path: nil, hosts_path: nil, id: nil, image: nil, image_manifest_descriptor: nil, log_path: nil, mount_label: nil, mounts: nil, name: nil, network_settings: nil, path: nil, platform: nil, process_label: nil, resolv_conf_path: nil, restart_count: nil, size_root_fs: nil, size_rw: nil, state: nil, storage: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container} for more details. + # + # @param app_armor_profile [String] The AppArmor profile set for the container. + # + # @param args [Array] The arguments to the command being run + # + # @param config [Docker::Models::Config] Configuration for a container that is portable between hosts. + # + # @param created [String, nil] Date and time at which the container was created, formatted in + # + # @param driver [String] The storage-driver used for the container's filesystem (graph-driver + # + # @param exec_ids [Array, nil] IDs of exec instances that are running in the container. + # + # @param graph_driver [Docker::Models::Container::GraphDriver] Information about the storage driver used to store the container's and + # + # @param host_config [Docker::Models::Container::HostConfig] Container configuration that depends on the host we are running on + # + # @param hostname_path [String] Location of the `/etc/hostname` generated for the container on the + # + # @param hosts_path [String] Location of the `/etc/hosts` generated for the container on the + # + # @param id [String] The ID of this container as a 128-bit (64-character) hexadecimal string (32 byte + # + # @param image [String] The ID (digest) of the image that this container was created from. + # + # @param image_manifest_descriptor [Docker::Models::Container::ImageManifestDescriptor] A descriptor struct containing digest, media type, and size, as defined in + # + # @param log_path [String, nil] Location of the file used to buffer the container's logs. Depending on + # + # @param mount_label [String] SELinux mount label set for the container. + # + # @param mounts [Array] List of mounts used by the container. + # + # @param name [String] The name associated with this container. + # + # @param network_settings [Docker::Models::Container::NetworkSettings] NetworkSettings exposes the network settings in the API + # + # @param path [String] The path to the command being run + # + # @param platform [String] The platform (operating system) for which the container was created. + # + # @param process_label [String] SELinux process label set for the container. + # + # @param resolv_conf_path [String] Location of the `/etc/resolv.conf` generated for the container on the + # + # @param restart_count [Integer] Number of times the container was restarted since it was created, + # + # @param size_root_fs [Integer, nil] The total size of all files in the read-only layers from the image + # + # @param size_rw [Integer, nil] The size of files that have been created or changed by this container. + # + # @param state [Docker::Models::Container::State, nil] ContainerState stores container's running state. It's part of ContainerJSONBase + # + # @param storage [Docker::Models::Container::Storage] Information about the storage used by the container. + + # @see Docker::Models::Container#graph_driver + class GraphDriver < Docker::Internal::Type::BaseModel + # @!attribute data + # Low-level storage metadata, provided as key/value pairs. + # + # This information is driver-specific, and depends on the storage-driver in use, + # and should be used for informational purposes only. + # + # @return [Hash{Symbol=>String}] + required :data, Docker::Internal::Type::HashOf[String], api_name: :Data + + # @!attribute name + # Name of the storage driver. + # + # @return [String] + required :name, String, api_name: :Name + + # @!method initialize(data:, name:) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::GraphDriver} for more details. + # + # Information about the storage driver used to store the container's and image's + # filesystem. + # + # @param data [Hash{Symbol=>String}] Low-level storage metadata, provided as key/value pairs. + # + # @param name [String] Name of the storage driver. + end + + # @see Docker::Models::Container#host_config + class HostConfig < Docker::Internal::Type::BaseModel + # @!attribute annotations + # Arbitrary non-identifying metadata attached to container and provided to the + # runtime when the container is started. + # + # @return [Hash{Symbol=>String}, nil] + optional :annotations, Docker::Internal::Type::HashOf[String], api_name: :Annotations + + # @!attribute auto_remove + # Automatically remove the container when the container's process exits. This has + # no effect if `RestartPolicy` is set. + # + # @return [Boolean, nil] + optional :auto_remove, Docker::Internal::Type::Boolean, api_name: :AutoRemove + + # @!attribute binds + # A list of volume bindings for this container. Each volume binding is a string in + # one of these forms: + # + # - `host-src:container-dest[:options]` to bind-mount a host path into the + # container. Both `host-src`, and `container-dest` must be an _absolute_ path. + # - `volume-name:container-dest[:options]` to bind-mount a volume managed by a + # volume driver into the container. `container-dest` must be an _absolute_ path. + # + # `options` is an optional, comma-delimited list of: + # + # - `nocopy` disables automatic copying of data from the container path to the + # volume. The `nocopy` flag only applies to named volumes. + # - `[ro|rw]` mounts a volume read-only or read-write, respectively. If omitted or + # set to `rw`, volumes are mounted read-write. + # - `[z|Z]` applies SELinux labels to allow or deny multiple containers to read + # and write to the same volume. + # - `z`: a _shared_ content label is applied to the content. This label + # indicates that multiple containers can share the volume content, for both + # reading and writing. + # - `Z`: a _private unshared_ label is applied to the content. This label + # indicates that only the current container can use a private volume. Labeling + # systems such as SELinux require proper labels to be placed on volume content + # that is mounted into a container. Without a label, the security system can + # prevent a container's processes from using the content. By default, the + # labels set by the host operating system are not modified. + # - `[[r]shared|[r]slave|[r]private]` specifies mount + # [propagation behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt). + # This only applies to bind-mounted volumes, not internal volumes or named + # volumes. Mount propagation requires the source mount point (the location where + # the source directory is mounted in the host operating system) to have the + # correct propagation properties. For shared volumes, the source mount point + # must be set to `shared`. For slave volumes, the mount must be set to either + # `shared` or `slave`. + # + # @return [Array, nil] + optional :binds, Docker::Internal::Type::ArrayOf[String], api_name: :Binds + + # @!attribute blkio_device_read_bps + # Limit read rate (bytes per second) from a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + # + # @return [Array, nil] + optional :blkio_device_read_bps, + -> { Docker::Internal::Type::ArrayOf[Docker::Container::HostConfig::BlkioDeviceReadBp] }, + api_name: :BlkioDeviceReadBps + + # @!attribute blkio_device_read_i_ops + # Limit read rate (IO per second) from a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + # + # @return [Array, nil] + optional :blkio_device_read_i_ops, + -> { Docker::Internal::Type::ArrayOf[Docker::Container::HostConfig::BlkioDeviceReadIOp] }, + api_name: :BlkioDeviceReadIOps + + # @!attribute blkio_device_write_bps + # Limit write rate (bytes per second) to a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + # + # @return [Array, nil] + optional :blkio_device_write_bps, + -> { Docker::Internal::Type::ArrayOf[Docker::Container::HostConfig::BlkioDeviceWriteBp] }, + api_name: :BlkioDeviceWriteBps + + # @!attribute blkio_device_write_i_ops + # Limit write rate (IO per second) to a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + # + # @return [Array, nil] + optional :blkio_device_write_i_ops, + -> { Docker::Internal::Type::ArrayOf[Docker::Container::HostConfig::BlkioDeviceWriteIOp] }, + api_name: :BlkioDeviceWriteIOps + + # @!attribute blkio_weight + # Block IO weight (relative weight). + # + # @return [Integer, nil] + optional :blkio_weight, Integer, api_name: :BlkioWeight + + # @!attribute blkio_weight_device + # Block IO weight (relative device weight) in the form: + # + # ``` + # [{"Path": "device_path", "Weight": weight}] + # ``` + # + # @return [Array, nil] + optional :blkio_weight_device, + -> { Docker::Internal::Type::ArrayOf[Docker::Container::HostConfig::BlkioWeightDevice] }, + api_name: :BlkioWeightDevice + + # @!attribute cap_add + # A list of kernel capabilities to add to the container. Conflicts with option + # 'Capabilities'. + # + # @return [Array, nil] + optional :cap_add, Docker::Internal::Type::ArrayOf[String], api_name: :CapAdd + + # @!attribute cap_drop + # A list of kernel capabilities to drop from the container. Conflicts with option + # 'Capabilities'. + # + # @return [Array, nil] + optional :cap_drop, Docker::Internal::Type::ArrayOf[String], api_name: :CapDrop + + # @!attribute cgroup + # Cgroup to use for the container. + # + # @return [String, nil] + optional :cgroup, String, api_name: :Cgroup + + # @!attribute cgroupns_mode + # cgroup namespace mode for the container. Possible values are: + # + # - `"private"`: the container runs in its own private cgroup namespace + # - `"host"`: use the host system's cgroup namespace + # + # If not specified, the daemon default is used, which can either be `"private"` or + # `"host"`, depending on daemon version, kernel support and configuration. + # + # @return [Symbol, Docker::Models::Container::HostConfig::CgroupnsMode, nil] + optional :cgroupns_mode, + enum: -> { + Docker::Container::HostConfig::CgroupnsMode + }, + api_name: :CgroupnsMode + + # @!attribute cgroup_parent + # Path to `cgroups` under which the container's `cgroup` is created. If the path + # is not absolute, the path is considered to be relative to the `cgroups` path of + # the init process. Cgroups are created if they do not already exist. + # + # @return [String, nil] + optional :cgroup_parent, String, api_name: :CgroupParent + + # @!attribute console_size + # Initial console size, as an `[height, width]` array. + # + # @return [Array, nil] + optional :console_size, Docker::Internal::Type::ArrayOf[Integer], api_name: :ConsoleSize, nil?: true + + # @!attribute container_id_file + # Path to a file where the container ID is written + # + # @return [String, nil] + optional :container_id_file, String, api_name: :ContainerIDFile + + # @!attribute cpu_count + # The number of usable CPUs (Windows only). + # + # On Windows Server containers, the processor resource controls are mutually + # exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and + # `CPUPercent` last. + # + # @return [Integer, nil] + optional :cpu_count, Integer, api_name: :CpuCount + + # @!attribute cpu_percent + # The usable percentage of the available CPUs (Windows only). + # + # On Windows Server containers, the processor resource controls are mutually + # exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and + # `CPUPercent` last. + # + # @return [Integer, nil] + optional :cpu_percent, Integer, api_name: :CpuPercent + + # @!attribute cpu_period + # The length of a CPU period in microseconds. + # + # @return [Integer, nil] + optional :cpu_period, Integer, api_name: :CpuPeriod + + # @!attribute cpu_quota + # Microseconds of CPU time that the container can get in a CPU period. + # + # @return [Integer, nil] + optional :cpu_quota, Integer, api_name: :CpuQuota + + # @!attribute cpu_realtime_period + # The length of a CPU real-time period in microseconds. Set to 0 to allocate no + # time allocated to real-time tasks. + # + # @return [Integer, nil] + optional :cpu_realtime_period, Integer, api_name: :CpuRealtimePeriod + + # @!attribute cpu_realtime_runtime + # The length of a CPU real-time runtime in microseconds. Set to 0 to allocate no + # time allocated to real-time tasks. + # + # @return [Integer, nil] + optional :cpu_realtime_runtime, Integer, api_name: :CpuRealtimeRuntime + + # @!attribute cpuset_cpus + # CPUs in which to allow execution (e.g., `0-3`, `0,1`). + # + # @return [String, nil] + optional :cpuset_cpus, String, api_name: :CpusetCpus + + # @!attribute cpuset_mems + # Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on + # NUMA systems. + # + # @return [String, nil] + optional :cpuset_mems, String, api_name: :CpusetMems + + # @!attribute cpu_shares + # An integer value representing this container's relative CPU weight versus other + # containers. + # + # @return [Integer, nil] + optional :cpu_shares, Integer, api_name: :CpuShares + + # @!attribute device_cgroup_rules + # a list of cgroup rules to apply to the container + # + # @return [Array, nil] + optional :device_cgroup_rules, Docker::Internal::Type::ArrayOf[String], api_name: :DeviceCgroupRules + + # @!attribute device_requests + # A list of requests for devices to be sent to device drivers. + # + # @return [Array, nil] + optional :device_requests, + -> { Docker::Internal::Type::ArrayOf[Docker::Container::HostConfig::DeviceRequest] }, + api_name: :DeviceRequests + + # @!attribute devices + # A list of devices to add to the container. + # + # @return [Array, nil] + optional :devices, + -> { Docker::Internal::Type::ArrayOf[Docker::Container::HostConfig::Device] }, + api_name: :Devices + + # @!attribute dns + # A list of DNS servers for the container to use. + # + # @return [Array, nil] + optional :dns, Docker::Internal::Type::ArrayOf[String], api_name: :Dns + + # @!attribute dns_options + # A list of DNS options. + # + # @return [Array, nil] + optional :dns_options, Docker::Internal::Type::ArrayOf[String], api_name: :DnsOptions + + # @!attribute dns_search + # A list of DNS search domains. + # + # @return [Array, nil] + optional :dns_search, Docker::Internal::Type::ArrayOf[String], api_name: :DnsSearch + + # @!attribute extra_hosts + # A list of hostnames/IP mappings to add to the container's `/etc/hosts` file. + # Specified in the form `["hostname:IP"]`. + # + # @return [Array, nil] + optional :extra_hosts, Docker::Internal::Type::ArrayOf[String], api_name: :ExtraHosts + + # @!attribute group_add + # A list of additional groups that the container process will run as. + # + # @return [Array, nil] + optional :group_add, Docker::Internal::Type::ArrayOf[String], api_name: :GroupAdd + + # @!attribute init + # Run an init inside the container that forwards signals and reaps processes. This + # field is omitted if empty, and the default (as configured on the daemon) is + # used. + # + # @return [Boolean, nil] + optional :init, Docker::Internal::Type::Boolean, api_name: :Init, nil?: true + + # @!attribute io_maximum_bandwidth + # Maximum IO in bytes per second for the container system drive (Windows only). + # + # @return [Integer, nil] + optional :io_maximum_bandwidth, Integer, api_name: :IOMaximumBandwidth + + # @!attribute io_maximum_i_ops + # Maximum IOps for the container system drive (Windows only) + # + # @return [Integer, nil] + optional :io_maximum_i_ops, Integer, api_name: :IOMaximumIOps + + # @!attribute ipc_mode + # IPC sharing mode for the container. Possible values are: + # + # - `"none"`: own private IPC namespace, with /dev/shm not mounted + # - `"private"`: own private IPC namespace + # - `"shareable"`: own private IPC namespace, with a possibility to share it with + # other containers + # - `"container:"`: join another (shareable) container's IPC namespace + # - `"host"`: use the host system's IPC namespace + # + # If not specified, daemon default is used, which can either be `"private"` or + # `"shareable"`, depending on daemon version and configuration. + # + # @return [String, nil] + optional :ipc_mode, String, api_name: :IpcMode + + # @!attribute isolation + # Isolation technology of the container. (Windows only) + # + # @return [Symbol, Docker::Models::Container::HostConfig::Isolation, nil] + optional :isolation, enum: -> { Docker::Container::HostConfig::Isolation }, api_name: :Isolation + + # @!attribute links + # A list of links for the container in the form `container_name:alias`. + # + # @return [Array, nil] + optional :links, Docker::Internal::Type::ArrayOf[String], api_name: :Links + + # @!attribute log_config + # The logging configuration for this container + # + # @return [Docker::Models::Container::HostConfig::LogConfig, nil] + optional :log_config, -> { Docker::Container::HostConfig::LogConfig }, api_name: :LogConfig + + # @!attribute masked_paths + # The list of paths to be masked inside the container (this overrides the default + # set of paths). + # + # @return [Array, nil] + optional :masked_paths, Docker::Internal::Type::ArrayOf[String], api_name: :MaskedPaths + + # @!attribute memory + # Memory limit in bytes. + # + # @return [Integer, nil] + optional :memory, Integer, api_name: :Memory + + # @!attribute memory_reservation + # Memory soft limit in bytes. + # + # @return [Integer, nil] + optional :memory_reservation, Integer, api_name: :MemoryReservation + + # @!attribute memory_swap + # Total memory limit (memory + swap). Set as `-1` to enable unlimited swap. + # + # @return [Integer, nil] + optional :memory_swap, Integer, api_name: :MemorySwap + + # @!attribute memory_swappiness + # Tune a container's memory swappiness behavior. Accepts an integer between 0 + # and 100. + # + # @return [Integer, nil] + optional :memory_swappiness, Integer, api_name: :MemorySwappiness + + # @!attribute mounts + # Specification for mounts to be added to the container. + # + # @return [Array, nil] + optional :mounts, + -> { Docker::Internal::Type::ArrayOf[Docker::Container::HostConfig::Mount] }, + api_name: :Mounts + + # @!attribute nano_cpus + # CPU quota in units of 10-9 CPUs. + # + # @return [Integer, nil] + optional :nano_cpus, Integer, api_name: :NanoCpus + + # @!attribute network_mode + # Network mode to use for this container. Supported standard values are: `bridge`, + # `host`, `none`, and `container:`. Any other value is taken as a custom + # network's name to which this container should connect to. + # + # @return [String, nil] + optional :network_mode, String, api_name: :NetworkMode + + # @!attribute oom_kill_disable + # Disable OOM Killer for the container. + # + # @return [Boolean, nil] + optional :oom_kill_disable, Docker::Internal::Type::Boolean, api_name: :OomKillDisable + + # @!attribute oom_score_adj + # An integer value containing the score given to the container in order to tune + # OOM killer preferences. + # + # @return [Integer, nil] + optional :oom_score_adj, Integer, api_name: :OomScoreAdj + + # @!attribute pid_mode + # Set the PID (Process) Namespace mode for the container. It can be either: + # + # - `"container:"`: joins another container's PID namespace + # - `"host"`: use the host's PID namespace inside the container + # + # @return [String, nil] + optional :pid_mode, String, api_name: :PidMode + + # @!attribute pids_limit + # Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` to not + # change. + # + # @return [Integer, nil] + optional :pids_limit, Integer, api_name: :PidsLimit, nil?: true + + # @!attribute port_bindings + # PortMap describes the mapping of container ports to host ports, using the + # container's port-number and protocol as key in the format `/`, + # for example, `80/udp`. + # + # If a container's port is mapped for multiple protocols, separate entries are + # added to the mapping table. + # + # @return [Hash{Symbol=>Array}, nil] + optional :port_bindings, + -> { + Docker::Internal::Type::HashOf[Docker::Internal::Type::ArrayOf[Docker::Container::HostConfig::PortBinding]] + }, + api_name: :PortBindings + + # @!attribute privileged + # Gives the container full access to the host. + # + # @return [Boolean, nil] + optional :privileged, Docker::Internal::Type::Boolean, api_name: :Privileged + + # @!attribute publish_all_ports + # Allocates an ephemeral host port for all of a container's exposed ports. + # + # Ports are de-allocated when the container stops and allocated when the container + # starts. The allocated port might be changed when restarting the container. + # + # The port is selected from the ephemeral port range that depends on the kernel. + # For example, on Linux the range is defined by + # `/proc/sys/net/ipv4/ip_local_port_range`. + # + # @return [Boolean, nil] + optional :publish_all_ports, Docker::Internal::Type::Boolean, api_name: :PublishAllPorts + + # @!attribute readonly_paths + # The list of paths to be set as read-only inside the container (this overrides + # the default set of paths). + # + # @return [Array, nil] + optional :readonly_paths, Docker::Internal::Type::ArrayOf[String], api_name: :ReadonlyPaths + + # @!attribute readonly_rootfs + # Mount the container's root filesystem as read only. + # + # @return [Boolean, nil] + optional :readonly_rootfs, Docker::Internal::Type::Boolean, api_name: :ReadonlyRootfs + + # @!attribute restart_policy + # The behavior to apply when the container exits. The default is not to restart. + # + # An ever increasing delay (double the previous delay, starting at 100ms) is added + # before each restart to prevent flooding the server. + # + # @return [Docker::Models::Container::HostConfig::RestartPolicy, nil] + optional :restart_policy, + -> { + Docker::Container::HostConfig::RestartPolicy + }, + api_name: :RestartPolicy + + # @!attribute runtime + # Runtime to use with this container. + # + # @return [String, nil] + optional :runtime, String, api_name: :Runtime, nil?: true + + # @!attribute security_opt + # A list of string values to customize labels for MLS systems, such as SELinux. + # + # @return [Array, nil] + optional :security_opt, Docker::Internal::Type::ArrayOf[String], api_name: :SecurityOpt + + # @!attribute shm_size + # Size of `/dev/shm` in bytes. If omitted, the system uses 64MB. + # + # @return [Integer, nil] + optional :shm_size, Integer, api_name: :ShmSize + + # @!attribute storage_opt + # Storage driver options for this container, in the form `{"size": "120G"}`. + # + # @return [Hash{Symbol=>String}, nil] + optional :storage_opt, Docker::Internal::Type::HashOf[String], api_name: :StorageOpt + + # @!attribute sysctls + # A list of kernel parameters (sysctls) to set in the container. + # + # This field is omitted if not set. + # + # @return [Hash{Symbol=>String}, nil] + optional :sysctls, Docker::Internal::Type::HashOf[String], api_name: :Sysctls, nil?: true + + # @!attribute tmpfs + # A map of container directories which should be replaced by tmpfs mounts, and + # their corresponding mount options. For example: + # + # ``` + # { "/run": "rw,noexec,nosuid,size=65536k" } + # ``` + # + # @return [Hash{Symbol=>String}, nil] + optional :tmpfs, Docker::Internal::Type::HashOf[String], api_name: :Tmpfs + + # @!attribute ulimits + # A list of resource limits to set in the container. For example: + # + # ``` + # {"Name": "nofile", "Soft": 1024, "Hard": 2048} + # ``` + # + # @return [Array, nil] + optional :ulimits, + -> { Docker::Internal::Type::ArrayOf[Docker::Container::HostConfig::Ulimit] }, + api_name: :Ulimits + + # @!attribute userns_mode + # Sets the usernamespace mode for the container when usernamespace remapping + # option is enabled. + # + # @return [String, nil] + optional :userns_mode, String, api_name: :UsernsMode + + # @!attribute uts_mode + # UTS namespace to use for the container. + # + # @return [String, nil] + optional :uts_mode, String, api_name: :UTSMode + + # @!attribute volume_driver + # Driver that this container uses to mount volumes. + # + # @return [String, nil] + optional :volume_driver, String, api_name: :VolumeDriver + + # @!attribute volumes_from + # A list of volumes to inherit from another container, specified in the form + # `[:]`. + # + # @return [Array, nil] + optional :volumes_from, Docker::Internal::Type::ArrayOf[String], api_name: :VolumesFrom + + # @!method initialize(annotations: nil, auto_remove: nil, binds: nil, blkio_device_read_bps: nil, blkio_device_read_i_ops: nil, blkio_device_write_bps: nil, blkio_device_write_i_ops: nil, blkio_weight: nil, blkio_weight_device: nil, cap_add: nil, cap_drop: nil, cgroup: nil, cgroupns_mode: nil, cgroup_parent: nil, console_size: nil, container_id_file: nil, cpu_count: nil, cpu_percent: nil, cpu_period: nil, cpu_quota: nil, cpu_realtime_period: nil, cpu_realtime_runtime: nil, cpuset_cpus: nil, cpuset_mems: nil, cpu_shares: nil, device_cgroup_rules: nil, device_requests: nil, devices: nil, dns: nil, dns_options: nil, dns_search: nil, extra_hosts: nil, group_add: nil, init: nil, io_maximum_bandwidth: nil, io_maximum_i_ops: nil, ipc_mode: nil, isolation: nil, links: nil, log_config: nil, masked_paths: nil, memory: nil, memory_reservation: nil, memory_swap: nil, memory_swappiness: nil, mounts: nil, nano_cpus: nil, network_mode: nil, oom_kill_disable: nil, oom_score_adj: nil, pid_mode: nil, pids_limit: nil, port_bindings: nil, privileged: nil, publish_all_ports: nil, readonly_paths: nil, readonly_rootfs: nil, restart_policy: nil, runtime: nil, security_opt: nil, shm_size: nil, storage_opt: nil, sysctls: nil, tmpfs: nil, ulimits: nil, userns_mode: nil, uts_mode: nil, volume_driver: nil, volumes_from: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::HostConfig} for more details. + # + # Container configuration that depends on the host we are running on + # + # @param annotations [Hash{Symbol=>String}] Arbitrary non-identifying metadata attached to container and + # + # @param auto_remove [Boolean] Automatically remove the container when the container's process + # + # @param binds [Array] A list of volume bindings for this container. Each volume binding + # + # @param blkio_device_read_bps [Array] Limit read rate (bytes per second) from a device, in the form: + # + # @param blkio_device_read_i_ops [Array] Limit read rate (IO per second) from a device, in the form: + # + # @param blkio_device_write_bps [Array] Limit write rate (bytes per second) to a device, in the form: + # + # @param blkio_device_write_i_ops [Array] Limit write rate (IO per second) to a device, in the form: + # + # @param blkio_weight [Integer] Block IO weight (relative weight). + # + # @param blkio_weight_device [Array] Block IO weight (relative device weight) in the form: + # + # @param cap_add [Array] A list of kernel capabilities to add to the container. Conflicts + # + # @param cap_drop [Array] A list of kernel capabilities to drop from the container. Conflicts + # + # @param cgroup [String] Cgroup to use for the container. + # + # @param cgroupns_mode [Symbol, Docker::Models::Container::HostConfig::CgroupnsMode] cgroup namespace mode for the container. Possible values are: + # + # @param cgroup_parent [String] Path to `cgroups` under which the container's `cgroup` is created. If + # + # @param console_size [Array, nil] Initial console size, as an `[height, width]` array. + # + # @param container_id_file [String] Path to a file where the container ID is written + # + # @param cpu_count [Integer] The number of usable CPUs (Windows only). + # + # @param cpu_percent [Integer] The usable percentage of the available CPUs (Windows only). + # + # @param cpu_period [Integer] The length of a CPU period in microseconds. + # + # @param cpu_quota [Integer] Microseconds of CPU time that the container can get in a CPU period. + # + # @param cpu_realtime_period [Integer] The length of a CPU real-time period in microseconds. Set to 0 to + # + # @param cpu_realtime_runtime [Integer] The length of a CPU real-time runtime in microseconds. Set to 0 to + # + # @param cpuset_cpus [String] CPUs in which to allow execution (e.g., `0-3`, `0,1`). + # + # @param cpuset_mems [String] Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only + # + # @param cpu_shares [Integer] An integer value representing this container's relative CPU weight + # + # @param device_cgroup_rules [Array] a list of cgroup rules to apply to the container + # + # @param device_requests [Array] A list of requests for devices to be sent to device drivers. + # + # @param devices [Array] A list of devices to add to the container. + # + # @param dns [Array] A list of DNS servers for the container to use. + # + # @param dns_options [Array] A list of DNS options. + # + # @param dns_search [Array] A list of DNS search domains. + # + # @param extra_hosts [Array] A list of hostnames/IP mappings to add to the container's `/etc/hosts` + # + # @param group_add [Array] A list of additional groups that the container process will run as. + # + # @param init [Boolean, nil] Run an init inside the container that forwards signals and reaps + # + # @param io_maximum_bandwidth [Integer] Maximum IO in bytes per second for the container system drive + # + # @param io_maximum_i_ops [Integer] Maximum IOps for the container system drive (Windows only) + # + # @param ipc_mode [String] IPC sharing mode for the container. Possible values are: + # + # @param isolation [Symbol, Docker::Models::Container::HostConfig::Isolation] Isolation technology of the container. (Windows only) + # + # @param links [Array] A list of links for the container in the form `container_name:alias`. + # + # @param log_config [Docker::Models::Container::HostConfig::LogConfig] The logging configuration for this container + # + # @param masked_paths [Array] The list of paths to be masked inside the container (this overrides + # + # @param memory [Integer] Memory limit in bytes. + # + # @param memory_reservation [Integer] Memory soft limit in bytes. + # + # @param memory_swap [Integer] Total memory limit (memory + swap). Set as `-1` to enable unlimited + # + # @param memory_swappiness [Integer] Tune a container's memory swappiness behavior. Accepts an integer + # + # @param mounts [Array] Specification for mounts to be added to the container. + # + # @param nano_cpus [Integer] CPU quota in units of 10-9 CPUs. + # + # @param network_mode [String] Network mode to use for this container. Supported standard values + # + # @param oom_kill_disable [Boolean] Disable OOM Killer for the container. + # + # @param oom_score_adj [Integer] An integer value containing the score given to the container in + # + # @param pid_mode [String] Set the PID (Process) Namespace mode for the container. It can be + # + # @param pids_limit [Integer, nil] Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` + # + # @param port_bindings [Hash{Symbol=>Array}] PortMap describes the mapping of container ports to host ports, using the + # + # @param privileged [Boolean] Gives the container full access to the host. + # + # @param publish_all_ports [Boolean] Allocates an ephemeral host port for all of a container's + # + # @param readonly_paths [Array] The list of paths to be set as read-only inside the container + # + # @param readonly_rootfs [Boolean] Mount the container's root filesystem as read only. + # + # @param restart_policy [Docker::Models::Container::HostConfig::RestartPolicy] The behavior to apply when the container exits. The default is not to + # + # @param runtime [String, nil] Runtime to use with this container. + # + # @param security_opt [Array] A list of string values to customize labels for MLS systems, such + # + # @param shm_size [Integer] Size of `/dev/shm` in bytes. If omitted, the system uses 64MB. + # + # @param storage_opt [Hash{Symbol=>String}] Storage driver options for this container, in the form `{"size": "120G"}`. + # + # @param sysctls [Hash{Symbol=>String}, nil] A list of kernel parameters (sysctls) to set in the container. + # + # @param tmpfs [Hash{Symbol=>String}] A map of container directories which should be replaced by tmpfs + # + # @param ulimits [Array] A list of resource limits to set in the container. For example: + # + # @param userns_mode [String] Sets the usernamespace mode for the container when usernamespace + # + # @param uts_mode [String] UTS namespace to use for the container. + # + # @param volume_driver [String] Driver that this container uses to mount volumes. + # + # @param volumes_from [Array] A list of volumes to inherit from another container, specified in + + class BlkioDeviceReadBp < Docker::Internal::Type::BaseModel + # @!attribute path + # Device path + # + # @return [String, nil] + optional :path, String, api_name: :Path + + # @!attribute rate + # Rate + # + # @return [Integer, nil] + optional :rate, Integer, api_name: :Rate + + # @!method initialize(path: nil, rate: nil) + # @param path [String] Device path + # + # @param rate [Integer] Rate + end + + class BlkioDeviceReadIOp < Docker::Internal::Type::BaseModel + # @!attribute path + # Device path + # + # @return [String, nil] + optional :path, String, api_name: :Path + + # @!attribute rate + # Rate + # + # @return [Integer, nil] + optional :rate, Integer, api_name: :Rate + + # @!method initialize(path: nil, rate: nil) + # @param path [String] Device path + # + # @param rate [Integer] Rate + end + + class BlkioDeviceWriteBp < Docker::Internal::Type::BaseModel + # @!attribute path + # Device path + # + # @return [String, nil] + optional :path, String, api_name: :Path + + # @!attribute rate + # Rate + # + # @return [Integer, nil] + optional :rate, Integer, api_name: :Rate + + # @!method initialize(path: nil, rate: nil) + # @param path [String] Device path + # + # @param rate [Integer] Rate + end + + class BlkioDeviceWriteIOp < Docker::Internal::Type::BaseModel + # @!attribute path + # Device path + # + # @return [String, nil] + optional :path, String, api_name: :Path + + # @!attribute rate + # Rate + # + # @return [Integer, nil] + optional :rate, Integer, api_name: :Rate + + # @!method initialize(path: nil, rate: nil) + # @param path [String] Device path + # + # @param rate [Integer] Rate + end + + class BlkioWeightDevice < Docker::Internal::Type::BaseModel + # @!attribute path + # + # @return [String, nil] + optional :path, String, api_name: :Path + + # @!attribute weight + # + # @return [Integer, nil] + optional :weight, Integer, api_name: :Weight + + # @!method initialize(path: nil, weight: nil) + # @param path [String] + # @param weight [Integer] + end + + # cgroup namespace mode for the container. Possible values are: + # + # - `"private"`: the container runs in its own private cgroup namespace + # - `"host"`: use the host system's cgroup namespace + # + # If not specified, the daemon default is used, which can either be `"private"` or + # `"host"`, depending on daemon version, kernel support and configuration. + # + # @see Docker::Models::Container::HostConfig#cgroupns_mode + module CgroupnsMode + extend Docker::Internal::Type::Enum + + PRIVATE = :private + HOST = :host + + # @!method self.values + # @return [Array] + end + + class DeviceRequest < Docker::Internal::Type::BaseModel + # @!attribute capabilities + # A list of capabilities; an OR list of AND lists of capabilities. + # + # Note that if a driver is specified the capabilities have no effect on selecting + # a driver as the driver name is used directly. + # + # Note that if no driver is specified the capabilities are used to select a driver + # with the required capabilities. + # + # @return [Array>, nil] + optional :capabilities, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::ArrayOf[String]], + api_name: :Capabilities + + # @!attribute count + # + # @return [Integer, nil] + optional :count, Integer, api_name: :Count + + # @!attribute device_ids + # + # @return [Array, nil] + optional :device_ids, Docker::Internal::Type::ArrayOf[String], api_name: :DeviceIDs + + # @!attribute driver + # The name of the device driver to use for this request. + # + # Note that if this is specified the capabilities are ignored when selecting a + # device driver. + # + # @return [String, nil] + optional :driver, String, api_name: :Driver + + # @!attribute options + # Driver-specific options, specified as a key/value pairs. These options are + # passed directly to the driver. + # + # @return [Hash{Symbol=>String}, nil] + optional :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!method initialize(capabilities: nil, count: nil, device_ids: nil, driver: nil, options: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::HostConfig::DeviceRequest} for more details. + # + # A request for devices to be sent to device drivers + # + # @param capabilities [Array>] A list of capabilities; an OR list of AND lists of capabilities. + # + # @param count [Integer] + # + # @param device_ids [Array] + # + # @param driver [String] The name of the device driver to use for this request. + # + # @param options [Hash{Symbol=>String}] Driver-specific options, specified as a key/value pairs. These options + end + + class Device < Docker::Internal::Type::BaseModel + # @!attribute cgroup_permissions + # + # @return [String, nil] + optional :cgroup_permissions, String, api_name: :CgroupPermissions + + # @!attribute path_in_container + # + # @return [String, nil] + optional :path_in_container, String, api_name: :PathInContainer + + # @!attribute path_on_host + # + # @return [String, nil] + optional :path_on_host, String, api_name: :PathOnHost + + # @!method initialize(cgroup_permissions: nil, path_in_container: nil, path_on_host: nil) + # A device mapping between the host and container + # + # @param cgroup_permissions [String] + # @param path_in_container [String] + # @param path_on_host [String] + end + + # Isolation technology of the container. (Windows only) + # + # @see Docker::Models::Container::HostConfig#isolation + module Isolation + extend Docker::Internal::Type::Enum + + DEFAULT = :default + PROCESS = :process + HYPERV = :hyperv + EMPTY = :"" + + # @!method self.values + # @return [Array] + end + + # @see Docker::Models::Container::HostConfig#log_config + class LogConfig < Docker::Internal::Type::BaseModel + # @!attribute config + # Driver-specific configuration options for the logging driver. + # + # @return [Hash{Symbol=>String}, nil] + optional :config, Docker::Internal::Type::HashOf[String], api_name: :Config + + # @!attribute type + # Name of the logging driver used for the container or "none" if logging is + # disabled. + # + # @return [Symbol, Docker::Models::Container::HostConfig::LogConfig::Type, nil] + optional :type, enum: -> { Docker::Container::HostConfig::LogConfig::Type }, api_name: :Type + + # @!method initialize(config: nil, type: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::HostConfig::LogConfig} for more details. + # + # The logging configuration for this container + # + # @param config [Hash{Symbol=>String}] Driver-specific configuration options for the logging driver. + # + # @param type [Symbol, Docker::Models::Container::HostConfig::LogConfig::Type] Name of the logging driver used for the container or "none" + + # Name of the logging driver used for the container or "none" if logging is + # disabled. + # + # @see Docker::Models::Container::HostConfig::LogConfig#type + module Type + extend Docker::Internal::Type::Enum + + LOCAL = :local + JSON_FILE = :"json-file" + SYSLOG = :syslog + JOURNALD = :journald + GELF = :gelf + FLUENTD = :fluentd + AWSLOGS = :awslogs + SPLUNK = :splunk + ETWLOGS = :etwlogs + NONE = :none + + # @!method self.values + # @return [Array] + end + end + + class Mount < Docker::Internal::Type::BaseModel + # @!attribute bind_options + # Optional configuration for the `bind` type. + # + # @return [Docker::Models::Container::HostConfig::Mount::BindOptions, nil] + optional :bind_options, + -> { + Docker::Container::HostConfig::Mount::BindOptions + }, + api_name: :BindOptions + + # @!attribute consistency + # The consistency requirement for the mount: `default`, `consistent`, `cached`, or + # `delegated`. + # + # @return [String, nil] + optional :consistency, String, api_name: :Consistency + + # @!attribute image_options + # Optional configuration for the `image` type. + # + # @return [Docker::Models::Container::HostConfig::Mount::ImageOptions, nil] + optional :image_options, + -> { Docker::Container::HostConfig::Mount::ImageOptions }, + api_name: :ImageOptions + + # @!attribute read_only + # Whether the mount should be read-only. + # + # @return [Boolean, nil] + optional :read_only, Docker::Internal::Type::Boolean, api_name: :ReadOnly + + # @!attribute source + # Mount source (e.g. a volume name, a host path). The source cannot be specified + # when using `Type=tmpfs`. For `Type=bind`, the source path must either exist, or + # the `CreateMountpoint` must be set to `true` to create the source path on the + # host if missing. + # + # For `Type=npipe`, the pipe must exist prior to creating the container. + # + # @return [String, nil] + optional :source, String, api_name: :Source + + # @!attribute target + # Container path. + # + # @return [String, nil] + optional :target, String, api_name: :Target + + # @!attribute tmpfs_options + # Optional configuration for the `tmpfs` type. + # + # @return [Docker::Models::Container::HostConfig::Mount::TmpfsOptions, nil] + optional :tmpfs_options, + -> { Docker::Container::HostConfig::Mount::TmpfsOptions }, + api_name: :TmpfsOptions + + # @!attribute type + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + # + # @return [Symbol, Docker::Models::Container::HostConfig::Mount::Type, nil] + optional :type, enum: -> { Docker::Container::HostConfig::Mount::Type }, api_name: :Type + + # @!attribute volume_options + # Optional configuration for the `volume` type. + # + # @return [Docker::Models::Container::HostConfig::Mount::VolumeOptions, nil] + optional :volume_options, + -> { Docker::Container::HostConfig::Mount::VolumeOptions }, + api_name: :VolumeOptions + + # @!method initialize(bind_options: nil, consistency: nil, image_options: nil, read_only: nil, source: nil, target: nil, tmpfs_options: nil, type: nil, volume_options: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::HostConfig::Mount} for more details. + # + # @param bind_options [Docker::Models::Container::HostConfig::Mount::BindOptions] Optional configuration for the `bind` type. + # + # @param consistency [String] The consistency requirement for the mount: `default`, `consistent`, `cached`, or + # + # @param image_options [Docker::Models::Container::HostConfig::Mount::ImageOptions] Optional configuration for the `image` type. + # + # @param read_only [Boolean] Whether the mount should be read-only. + # + # @param source [String] Mount source (e.g. a volume name, a host path). The source cannot be + # + # @param target [String] Container path. + # + # @param tmpfs_options [Docker::Models::Container::HostConfig::Mount::TmpfsOptions] Optional configuration for the `tmpfs` type. + # + # @param type [Symbol, Docker::Models::Container::HostConfig::Mount::Type] The mount type. Available types: + # + # @param volume_options [Docker::Models::Container::HostConfig::Mount::VolumeOptions] Optional configuration for the `volume` type. + + # @see Docker::Models::Container::HostConfig::Mount#bind_options + class BindOptions < Docker::Internal::Type::BaseModel + # @!attribute create_mountpoint + # Create mount point on host if missing + # + # @return [Boolean, nil] + optional :create_mountpoint, Docker::Internal::Type::Boolean, api_name: :CreateMountpoint + + # @!attribute non_recursive + # Disable recursive bind mount. + # + # @return [Boolean, nil] + optional :non_recursive, Docker::Internal::Type::Boolean, api_name: :NonRecursive + + # @!attribute propagation + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + # + # @return [Symbol, Docker::Models::Container::HostConfig::Mount::BindOptions::Propagation, nil] + optional :propagation, + enum: -> { Docker::Container::HostConfig::Mount::BindOptions::Propagation }, + api_name: :Propagation + + # @!attribute read_only_force_recursive + # Raise an error if the mount cannot be made recursively read-only. + # + # @return [Boolean, nil] + optional :read_only_force_recursive, + Docker::Internal::Type::Boolean, + api_name: :ReadOnlyForceRecursive + + # @!attribute read_only_non_recursive + # Make the mount non-recursively read-only, but still leave the mount recursive + # (unless NonRecursive is set to `true` in conjunction). + # + # Added in v1.44, before that version all read-only mounts were non-recursive by + # default. To match the previous behaviour this will default to `true` for clients + # on versions prior to v1.44. + # + # @return [Boolean, nil] + optional :read_only_non_recursive, + Docker::Internal::Type::Boolean, + api_name: :ReadOnlyNonRecursive + + # @!method initialize(create_mountpoint: nil, non_recursive: nil, propagation: nil, read_only_force_recursive: nil, read_only_non_recursive: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::HostConfig::Mount::BindOptions} for more details. + # + # Optional configuration for the `bind` type. + # + # @param create_mountpoint [Boolean] Create mount point on host if missing + # + # @param non_recursive [Boolean] Disable recursive bind mount. + # + # @param propagation [Symbol, Docker::Models::Container::HostConfig::Mount::BindOptions::Propagation] A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + # + # @param read_only_force_recursive [Boolean] Raise an error if the mount cannot be made recursively read-only. + # + # @param read_only_non_recursive [Boolean] Make the mount non-recursively read-only, but still leave the mount recursive + + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + # + # @see Docker::Models::Container::HostConfig::Mount::BindOptions#propagation + module Propagation + extend Docker::Internal::Type::Enum + + PRIVATE = :private + RPRIVATE = :rprivate + SHARED = :shared + RSHARED = :rshared + SLAVE = :slave + RSLAVE = :rslave + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::Container::HostConfig::Mount#image_options + class ImageOptions < Docker::Internal::Type::BaseModel + # @!attribute subpath + # Source path inside the image. Must be relative without any back traversals. + # + # @return [String, nil] + optional :subpath, String, api_name: :Subpath + + # @!method initialize(subpath: nil) + # Optional configuration for the `image` type. + # + # @param subpath [String] Source path inside the image. Must be relative without any back traversals. + end + + # @see Docker::Models::Container::HostConfig::Mount#tmpfs_options + class TmpfsOptions < Docker::Internal::Type::BaseModel + # @!attribute mode + # The permission mode for the tmpfs mount in an integer. The value must not be in + # octal format (e.g. 755) but rather the decimal representation of the octal value + # (e.g. 493). + # + # @return [Integer, nil] + optional :mode, Integer, api_name: :Mode + + # @!attribute options + # The options to be passed to the tmpfs mount. An array of arrays. Flag options + # should be provided as 1-length arrays. Other types should be provided as as + # 2-length arrays, where the first item is the key and the second the value. + # + # @return [Array>, nil] + optional :options, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::ArrayOf[String]], + api_name: :Options + + # @!attribute size_bytes + # The size for the tmpfs mount in bytes. + # + # @return [Integer, nil] + optional :size_bytes, Integer, api_name: :SizeBytes + + # @!method initialize(mode: nil, options: nil, size_bytes: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::HostConfig::Mount::TmpfsOptions} for more details. + # + # Optional configuration for the `tmpfs` type. + # + # @param mode [Integer] The permission mode for the tmpfs mount in an integer. + # + # @param options [Array>] The options to be passed to the tmpfs mount. An array of arrays. + # + # @param size_bytes [Integer] The size for the tmpfs mount in bytes. + end + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + # + # @see Docker::Models::Container::HostConfig::Mount#type + module Type + extend Docker::Internal::Type::Enum + + BIND = :bind + CLUSTER = :cluster + IMAGE = :image + NPIPE = :npipe + TMPFS = :tmpfs + VOLUME = :volume + + # @!method self.values + # @return [Array] + end + + # @see Docker::Models::Container::HostConfig::Mount#volume_options + class VolumeOptions < Docker::Internal::Type::BaseModel + # @!attribute driver_config + # Map of driver specific options + # + # @return [Docker::Models::Container::HostConfig::Mount::VolumeOptions::DriverConfig, nil] + optional :driver_config, + -> { Docker::Container::HostConfig::Mount::VolumeOptions::DriverConfig }, + api_name: :DriverConfig + + # @!attribute labels + # User-defined key/value metadata. + # + # @return [Hash{Symbol=>String}, nil] + optional :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute no_copy + # Populate volume with data from the target. + # + # @return [Boolean, nil] + optional :no_copy, Docker::Internal::Type::Boolean, api_name: :NoCopy + + # @!attribute subpath + # Source path inside the volume. Must be relative without any back traversals. + # + # @return [String, nil] + optional :subpath, String, api_name: :Subpath + + # @!method initialize(driver_config: nil, labels: nil, no_copy: nil, subpath: nil) + # Optional configuration for the `volume` type. + # + # @param driver_config [Docker::Models::Container::HostConfig::Mount::VolumeOptions::DriverConfig] Map of driver specific options + # + # @param labels [Hash{Symbol=>String}] User-defined key/value metadata. + # + # @param no_copy [Boolean] Populate volume with data from the target. + # + # @param subpath [String] Source path inside the volume. Must be relative without any back traversals. + + # @see Docker::Models::Container::HostConfig::Mount::VolumeOptions#driver_config + class DriverConfig < Docker::Internal::Type::BaseModel + # @!attribute name + # Name of the driver to use to create the volume. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute options + # key/value map of driver specific options. + # + # @return [Hash{Symbol=>String}, nil] + optional :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!method initialize(name: nil, options: nil) + # Map of driver specific options + # + # @param name [String] Name of the driver to use to create the volume. + # + # @param options [Hash{Symbol=>String}] key/value map of driver specific options. + end + end + end + + class PortBinding < Docker::Internal::Type::BaseModel + # @!attribute host_ip + # Host IP address that the container's port is mapped to. + # + # @return [String, nil] + optional :host_ip, String, api_name: :HostIp + + # @!attribute host_port + # Host port number that the container's port is mapped to. + # + # @return [String, nil] + optional :host_port, String, api_name: :HostPort + + # @!method initialize(host_ip: nil, host_port: nil) + # PortBinding represents a binding between a host IP address and a host port. + # + # @param host_ip [String] Host IP address that the container's port is mapped to. + # + # @param host_port [String] Host port number that the container's port is mapped to. + end + + # @see Docker::Models::Container::HostConfig#restart_policy + class RestartPolicy < Docker::Internal::Type::BaseModel + # @!attribute maximum_retry_count + # If `on-failure` is used, the number of times to retry before giving up. + # + # @return [Integer, nil] + optional :maximum_retry_count, Integer, api_name: :MaximumRetryCount + + # @!attribute name + # - Empty string means not to restart + # - `no` Do not automatically restart + # - `always` Always restart + # - `unless-stopped` Restart always except when the user has manually stopped the + # container + # - `on-failure` Restart only when the container exit code is non-zero + # + # @return [Symbol, Docker::Models::Container::HostConfig::RestartPolicy::Name, nil] + optional :name, enum: -> { Docker::Container::HostConfig::RestartPolicy::Name }, api_name: :Name + + # @!method initialize(maximum_retry_count: nil, name: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::HostConfig::RestartPolicy} for more details. + # + # The behavior to apply when the container exits. The default is not to restart. + # + # An ever increasing delay (double the previous delay, starting at 100ms) is added + # before each restart to prevent flooding the server. + # + # @param maximum_retry_count [Integer] If `on-failure` is used, the number of times to retry before giving up. + # + # @param name [Symbol, Docker::Models::Container::HostConfig::RestartPolicy::Name] - Empty string means not to restart + + # - Empty string means not to restart + # - `no` Do not automatically restart + # - `always` Always restart + # - `unless-stopped` Restart always except when the user has manually stopped the + # container + # - `on-failure` Restart only when the container exit code is non-zero + # + # @see Docker::Models::Container::HostConfig::RestartPolicy#name + module Name + extend Docker::Internal::Type::Enum + + EMPTY = :"" + NO = :no + ALWAYS = :always + UNLESS_STOPPED = :"unless-stopped" + ON_FAILURE = :"on-failure" + + # @!method self.values + # @return [Array] + end + end + + class Ulimit < Docker::Internal::Type::BaseModel + # @!attribute hard + # Hard limit + # + # @return [Integer, nil] + optional :hard, Integer, api_name: :Hard + + # @!attribute name + # Name of ulimit + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute soft + # Soft limit + # + # @return [Integer, nil] + optional :soft, Integer, api_name: :Soft + + # @!method initialize(hard: nil, name: nil, soft: nil) + # @param hard [Integer] Hard limit + # + # @param name [String] Name of ulimit + # + # @param soft [Integer] Soft limit + end + end + + # @see Docker::Models::Container#image_manifest_descriptor + class ImageManifestDescriptor < Docker::Internal::Type::BaseModel + # @!attribute annotations + # Arbitrary metadata relating to the targeted content. + # + # @return [Hash{Symbol=>String}, nil] + optional :annotations, Docker::Internal::Type::HashOf[String], nil?: true + + # @!attribute artifact_type + # ArtifactType is the IANA media type of this artifact. + # + # @return [String, nil] + optional :artifact_type, String, api_name: :artifactType, nil?: true + + # @!attribute data + # Data is an embedding of the targeted content. This is encoded as a base64 string + # when marshalled to JSON (automatically, by encoding/json). If present, Data can + # be used directly to avoid fetching the targeted content. + # + # @return [String, nil] + optional :data, String, nil?: true + + # @!attribute digest + # The digest of the targeted content. + # + # @return [String, nil] + optional :digest, String + + # @!attribute media_type + # The media type of the object this schema refers to. + # + # @return [String, nil] + optional :media_type, String, api_name: :mediaType + + # @!attribute platform + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + # + # @return [Docker::Models::Container::ImageManifestDescriptor::Platform, nil] + optional :platform, -> { Docker::Container::ImageManifestDescriptor::Platform }, nil?: true + + # @!attribute size + # The size in bytes of the blob. + # + # @return [Integer, nil] + optional :size, Integer + + # @!attribute urls + # List of URLs from which this object MAY be downloaded. + # + # @return [Array, nil] + optional :urls, Docker::Internal::Type::ArrayOf[String], nil?: true + + # @!method initialize(annotations: nil, artifact_type: nil, data: nil, digest: nil, media_type: nil, platform: nil, size: nil, urls: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::ImageManifestDescriptor} for more details. + # + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + # + # @param annotations [Hash{Symbol=>String}, nil] Arbitrary metadata relating to the targeted content. + # + # @param artifact_type [String, nil] ArtifactType is the IANA media type of this artifact. + # + # @param data [String, nil] Data is an embedding of the targeted content. This is encoded as a base64 + # + # @param digest [String] The digest of the targeted content. + # + # @param media_type [String] The media type of the object this schema refers to. + # + # @param platform [Docker::Models::Container::ImageManifestDescriptor::Platform, nil] Describes the platform which the image in the manifest runs on, as defined + # + # @param size [Integer] The size in bytes of the blob. + # + # @param urls [Array, nil] List of URLs from which this object MAY be downloaded. + + # @see Docker::Models::Container::ImageManifestDescriptor#platform + class Platform < Docker::Internal::Type::BaseModel + # @!attribute architecture + # The CPU architecture, for example `amd64` or `ppc64`. + # + # @return [String, nil] + optional :architecture, String + + # @!attribute os + # The operating system, for example `linux` or `windows`. + # + # @return [String, nil] + optional :os, String + + # @!attribute os_features + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + # + # @return [Array, nil] + optional :os_features, Docker::Internal::Type::ArrayOf[String], api_name: :"os.features" + + # @!attribute os_version + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + # + # @return [String, nil] + optional :os_version, String, api_name: :"os.version" + + # @!attribute variant + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + # + # @return [String, nil] + optional :variant, String + + # @!method initialize(architecture: nil, os: nil, os_features: nil, os_version: nil, variant: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::ImageManifestDescriptor::Platform} for more details. + # + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + # + # @param architecture [String] The CPU architecture, for example `amd64` or `ppc64`. + # + # @param os [String] The operating system, for example `linux` or `windows`. + # + # @param os_features [Array] Optional field specifying an array of strings, each listing a required + # + # @param os_version [String] Optional field specifying the operating system version, for example on + # + # @param variant [String] Optional field specifying a variant of the CPU, for example `v7` to + end + end + + class Mount < Docker::Internal::Type::BaseModel + # @!attribute destination + # Destination is the path relative to the container root (`/`) where the `Source` + # is mounted inside the container. + # + # @return [String, nil] + optional :destination, String, api_name: :Destination + + # @!attribute driver + # Driver is the volume driver used to create the volume (if it is a volume). + # + # @return [String, nil] + optional :driver, String, api_name: :Driver + + # @!attribute mode + # Mode is a comma separated list of options supplied by the user when creating the + # bind/volume mount. + # + # The default is platform-specific (`"z"` on Linux, empty on Windows). + # + # @return [String, nil] + optional :mode, String, api_name: :Mode + + # @!attribute name + # Name is the name reference to the underlying data defined by `Source` e.g., the + # volume name. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute propagation + # Propagation describes how mounts are propagated from the host into the mount + # point, and vice-versa. Refer to the + # [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + # for details. This field is not used on Windows. + # + # @return [String, nil] + optional :propagation, String, api_name: :Propagation + + # @!attribute rw + # Whether the mount is mounted writable (read-write). + # + # @return [Boolean, nil] + optional :rw, Docker::Internal::Type::Boolean, api_name: :RW + + # @!attribute source + # Source location of the mount. + # + # For volumes, this contains the storage location of the volume (within + # `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains the + # source (host) part of the bind-mount. For `tmpfs` mount points, this field is + # empty. + # + # @return [String, nil] + optional :source, String, api_name: :Source + + # @!attribute type + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + # + # @return [Symbol, Docker::Models::Container::Mount::Type, nil] + optional :type, enum: -> { Docker::Container::Mount::Type }, api_name: :Type + + # @!method initialize(destination: nil, driver: nil, mode: nil, name: nil, propagation: nil, rw: nil, source: nil, type: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::Mount} for more details. + # + # MountPoint represents a mount point configuration inside the container. This is + # used for reporting the mountpoints in use by a container. + # + # @param destination [String] Destination is the path relative to the container root (`/`) where + # + # @param driver [String] Driver is the volume driver used to create the volume (if it is a volume). + # + # @param mode [String] Mode is a comma separated list of options supplied by the user when + # + # @param name [String] Name is the name reference to the underlying data defined by `Source` + # + # @param propagation [String] Propagation describes how mounts are propagated from the host into the + # + # @param rw [Boolean] Whether the mount is mounted writable (read-write). + # + # @param source [String] Source location of the mount. + # + # @param type [Symbol, Docker::Models::Container::Mount::Type] The mount type. Available types: + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + # + # @see Docker::Models::Container::Mount#type + module Type + extend Docker::Internal::Type::Enum + + BIND = :bind + CLUSTER = :cluster + IMAGE = :image + NPIPE = :npipe + TMPFS = :tmpfs + VOLUME = :volume + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::Container#network_settings + class NetworkSettings < Docker::Internal::Type::BaseModel + # @!attribute networks + # Information about all networks that the container is connected to. + # + # @return [Hash{Symbol=>Docker::Models::Container::NetworkSettings::Network}, nil] + optional :networks, + -> { Docker::Internal::Type::HashOf[Docker::Container::NetworkSettings::Network] }, + api_name: :Networks + + # @!attribute ports + # PortMap describes the mapping of container ports to host ports, using the + # container's port-number and protocol as key in the format `/`, + # for example, `80/udp`. + # + # If a container's port is mapped for multiple protocols, separate entries are + # added to the mapping table. + # + # @return [Hash{Symbol=>Array}, nil] + optional :ports, + -> { + Docker::Internal::Type::HashOf[Docker::Internal::Type::ArrayOf[Docker::Container::NetworkSettings::Port]] + }, + api_name: :Ports + + # @!attribute sandbox_id + # SandboxID uniquely represents a container's network stack. + # + # @return [String, nil] + optional :sandbox_id, String, api_name: :SandboxID + + # @!attribute sandbox_key + # SandboxKey is the full path of the netns handle + # + # @return [String, nil] + optional :sandbox_key, String, api_name: :SandboxKey + + # @!method initialize(networks: nil, ports: nil, sandbox_id: nil, sandbox_key: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::NetworkSettings} for more details. + # + # NetworkSettings exposes the network settings in the API + # + # @param networks [Hash{Symbol=>Docker::Models::Container::NetworkSettings::Network}] Information about all networks that the container is connected to. + # + # @param ports [Hash{Symbol=>Array}] PortMap describes the mapping of container ports to host ports, using the + # + # @param sandbox_id [String] SandboxID uniquely represents a container's network stack. + # + # @param sandbox_key [String] SandboxKey is the full path of the netns handle + + class Network < Docker::Internal::Type::BaseModel + # @!attribute aliases + # + # @return [Array, nil] + optional :aliases, Docker::Internal::Type::ArrayOf[String], api_name: :Aliases + + # @!attribute dns_names + # List of all DNS names an endpoint has on a specific network. This list is based + # on the container name, network aliases, container short ID, and hostname. + # + # These DNS names are non-fully qualified but can contain several dots. You can + # get fully qualified DNS names by appending `.`. For instance, if + # container name is `my.ctr` and the network is named `testnet`, `DNSNames` will + # contain `my.ctr` and the FQDN will be `my.ctr.testnet`. + # + # @return [Array, nil] + optional :dns_names, Docker::Internal::Type::ArrayOf[String], api_name: :DNSNames + + # @!attribute driver_opts + # DriverOpts is a mapping of driver options and values. These options are passed + # directly to the driver and are driver specific. + # + # @return [Hash{Symbol=>String}, nil] + optional :driver_opts, Docker::Internal::Type::HashOf[String], api_name: :DriverOpts, nil?: true + + # @!attribute endpoint_id + # Unique ID for the service endpoint in a Sandbox. + # + # @return [String, nil] + optional :endpoint_id, String, api_name: :EndpointID + + # @!attribute gateway + # Gateway address for this network. + # + # @return [String, nil] + optional :gateway, String, api_name: :Gateway + + # @!attribute global_i_pv6_address + # Global IPv6 address. + # + # @return [String, nil] + optional :global_i_pv6_address, String, api_name: :GlobalIPv6Address + + # @!attribute global_i_pv6_prefix_len + # Mask length of the global IPv6 address. + # + # @return [Integer, nil] + optional :global_i_pv6_prefix_len, Integer, api_name: :GlobalIPv6PrefixLen + + # @!attribute gw_priority + # This property determines which endpoint will provide the default gateway for a + # container. The endpoint with the highest priority will be used. If multiple + # endpoints have the same priority, endpoints are lexicographically sorted based + # on their network name, and the one that sorts first is picked. + # + # @return [Integer, nil] + optional :gw_priority, Integer, api_name: :GwPriority + + # @!attribute ip_address + # IPv4 address. + # + # @return [String, nil] + optional :ip_address, String, api_name: :IPAddress + + # @!attribute ipam_config + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + # + # @return [Docker::Models::Container::NetworkSettings::Network::IpamConfig, nil] + optional :ipam_config, + -> { Docker::Container::NetworkSettings::Network::IpamConfig }, + api_name: :IPAMConfig, + nil?: true + + # @!attribute ip_prefix_len + # Mask length of the IPv4 address. + # + # @return [Integer, nil] + optional :ip_prefix_len, Integer, api_name: :IPPrefixLen + + # @!attribute i_pv6_gateway + # IPv6 gateway address. + # + # @return [String, nil] + optional :i_pv6_gateway, String, api_name: :IPv6Gateway + + # @!attribute links + # + # @return [Array, nil] + optional :links, Docker::Internal::Type::ArrayOf[String], api_name: :Links + + # @!attribute mac_address + # MAC address for the endpoint on this network. The network driver might ignore + # this parameter. + # + # @return [String, nil] + optional :mac_address, String, api_name: :MacAddress + + # @!attribute network_id + # Unique ID of the network. + # + # @return [String, nil] + optional :network_id, String, api_name: :NetworkID + + # @!method initialize(aliases: nil, dns_names: nil, driver_opts: nil, endpoint_id: nil, gateway: nil, global_i_pv6_address: nil, global_i_pv6_prefix_len: nil, gw_priority: nil, ip_address: nil, ipam_config: nil, ip_prefix_len: nil, i_pv6_gateway: nil, links: nil, mac_address: nil, network_id: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::NetworkSettings::Network} for more details. + # + # Configuration for a network endpoint. + # + # @param aliases [Array] + # + # @param dns_names [Array] List of all DNS names an endpoint has on a specific network. This + # + # @param driver_opts [Hash{Symbol=>String}, nil] DriverOpts is a mapping of driver options and values. These options + # + # @param endpoint_id [String] Unique ID for the service endpoint in a Sandbox. + # + # @param gateway [String] Gateway address for this network. + # + # @param global_i_pv6_address [String] Global IPv6 address. + # + # @param global_i_pv6_prefix_len [Integer] Mask length of the global IPv6 address. + # + # @param gw_priority [Integer] This property determines which endpoint will provide the default + # + # @param ip_address [String] IPv4 address. + # + # @param ipam_config [Docker::Models::Container::NetworkSettings::Network::IpamConfig, nil] EndpointIPAMConfig represents an endpoint's IPAM configuration. + # + # @param ip_prefix_len [Integer] Mask length of the IPv4 address. + # + # @param i_pv6_gateway [String] IPv6 gateway address. + # + # @param links [Array] + # + # @param mac_address [String] MAC address for the endpoint on this network. The network driver might ignore th + # + # @param network_id [String] Unique ID of the network. + + # @see Docker::Models::Container::NetworkSettings::Network#ipam_config + class IpamConfig < Docker::Internal::Type::BaseModel + # @!attribute i_pv4_address + # + # @return [String, nil] + optional :i_pv4_address, String, api_name: :IPv4Address + + # @!attribute i_pv6_address + # + # @return [String, nil] + optional :i_pv6_address, String, api_name: :IPv6Address + + # @!attribute link_local_ips + # + # @return [Array, nil] + optional :link_local_ips, Docker::Internal::Type::ArrayOf[String], api_name: :LinkLocalIPs + + # @!method initialize(i_pv4_address: nil, i_pv6_address: nil, link_local_ips: nil) + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + # + # @param i_pv4_address [String] + # @param i_pv6_address [String] + # @param link_local_ips [Array] + end + end + + class Port < Docker::Internal::Type::BaseModel + # @!attribute host_ip + # Host IP address that the container's port is mapped to. + # + # @return [String, nil] + optional :host_ip, String, api_name: :HostIp + + # @!attribute host_port + # Host port number that the container's port is mapped to. + # + # @return [String, nil] + optional :host_port, String, api_name: :HostPort + + # @!method initialize(host_ip: nil, host_port: nil) + # PortBinding represents a binding between a host IP address and a host port. + # + # @param host_ip [String] Host IP address that the container's port is mapped to. + # + # @param host_port [String] Host port number that the container's port is mapped to. + end + end + + # @see Docker::Models::Container#state + class State < Docker::Internal::Type::BaseModel + # @!attribute dead + # + # @return [Boolean, nil] + optional :dead, Docker::Internal::Type::Boolean, api_name: :Dead + + # @!attribute error + # + # @return [String, nil] + optional :error, String, api_name: :Error + + # @!attribute exit_code + # The last exit code of this container + # + # @return [Integer, nil] + optional :exit_code, Integer, api_name: :ExitCode + + # @!attribute finished_at + # The time when this container last exited. + # + # @return [String, nil] + optional :finished_at, String, api_name: :FinishedAt + + # @!attribute health + # Health stores information about the container's healthcheck results. + # + # @return [Docker::Models::Container::State::Health, nil] + optional :health, -> { Docker::Container::State::Health }, api_name: :Health, nil?: true + + # @!attribute oom_killed + # Whether a process within this container has been killed because it ran out of + # memory since the container was last started. + # + # @return [Boolean, nil] + optional :oom_killed, Docker::Internal::Type::Boolean, api_name: :OOMKilled + + # @!attribute paused + # Whether this container is paused. + # + # @return [Boolean, nil] + optional :paused, Docker::Internal::Type::Boolean, api_name: :Paused + + # @!attribute pid + # The process ID of this container + # + # @return [Integer, nil] + optional :pid, Integer, api_name: :Pid + + # @!attribute restarting + # Whether this container is restarting. + # + # @return [Boolean, nil] + optional :restarting, Docker::Internal::Type::Boolean, api_name: :Restarting + + # @!attribute running + # Whether this container is running. + # + # Note that a running container can be _paused_. The `Running` and `Paused` + # booleans are not mutually exclusive: + # + # When pausing a container (on Linux), the freezer cgroup is used to suspend all + # processes in the container. Freezing the process requires the process to be + # running. As a result, paused containers are both `Running` _and_ `Paused`. + # + # Use the `Status` field instead to determine if a container's state is "running". + # + # @return [Boolean, nil] + optional :running, Docker::Internal::Type::Boolean, api_name: :Running + + # @!attribute started_at + # The time when this container was last started. + # + # @return [String, nil] + optional :started_at, String, api_name: :StartedAt + + # @!attribute status + # String representation of the container state. Can be one of "created", + # "running", "paused", "restarting", "removing", "exited", or "dead". + # + # @return [Symbol, Docker::Models::Container::State::Status, nil] + optional :status, enum: -> { Docker::Container::State::Status }, api_name: :Status + + # @!method initialize(dead: nil, error: nil, exit_code: nil, finished_at: nil, health: nil, oom_killed: nil, paused: nil, pid: nil, restarting: nil, running: nil, started_at: nil, status: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::State} for more details. + # + # ContainerState stores container's running state. It's part of ContainerJSONBase + # and will be returned by the "inspect" command. + # + # @param dead [Boolean] + # + # @param error [String] + # + # @param exit_code [Integer] The last exit code of this container + # + # @param finished_at [String] The time when this container last exited. + # + # @param health [Docker::Models::Container::State::Health, nil] Health stores information about the container's healthcheck results. + # + # @param oom_killed [Boolean] Whether a process within this container has been killed because it ran + # + # @param paused [Boolean] Whether this container is paused. + # + # @param pid [Integer] The process ID of this container + # + # @param restarting [Boolean] Whether this container is restarting. + # + # @param running [Boolean] Whether this container is running. + # + # @param started_at [String] The time when this container was last started. + # + # @param status [Symbol, Docker::Models::Container::State::Status] String representation of the container state. Can be one of "created", + + # @see Docker::Models::Container::State#health + class Health < Docker::Internal::Type::BaseModel + # @!attribute failing_streak + # FailingStreak is the number of consecutive failures + # + # @return [Integer, nil] + optional :failing_streak, Integer, api_name: :FailingStreak + + # @!attribute log + # Log contains the last few results (oldest first) + # + # @return [Array, nil] + optional :log, + -> { Docker::Internal::Type::ArrayOf[Docker::Container::State::Health::Log, nil?: true] }, + api_name: :Log + + # @!attribute status + # Status is one of `none`, `starting`, `healthy` or `unhealthy` + # + # - "none" Indicates there is no healthcheck + # - "starting" Starting indicates that the container is not yet ready + # - "healthy" Healthy indicates that the container is running correctly + # - "unhealthy" Unhealthy indicates that the container has a problem + # + # @return [Symbol, Docker::Models::Container::State::Health::Status, nil] + optional :status, enum: -> { Docker::Container::State::Health::Status }, api_name: :Status + + # @!method initialize(failing_streak: nil, log: nil, status: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::State::Health} for more details. + # + # Health stores information about the container's healthcheck results. + # + # @param failing_streak [Integer] FailingStreak is the number of consecutive failures + # + # @param log [Array] Log contains the last few results (oldest first) + # + # @param status [Symbol, Docker::Models::Container::State::Health::Status] Status is one of `none`, `starting`, `healthy` or `unhealthy` + + class Log < Docker::Internal::Type::BaseModel + # @!attribute end_ + # Date and time at which this check ended in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + # + # @return [String, nil] + optional :end_, String, api_name: :End + + # @!attribute exit_code + # ExitCode meanings: + # + # - `0` healthy + # - `1` unhealthy + # - `2` reserved (considered unhealthy) + # - other values: error running probe + # + # @return [Integer, nil] + optional :exit_code, Integer, api_name: :ExitCode + + # @!attribute output + # Output from last check + # + # @return [String, nil] + optional :output, String, api_name: :Output + + # @!attribute start + # Date and time at which this check started in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + # + # @return [Time, nil] + optional :start, Time, api_name: :Start + + # @!method initialize(end_: nil, exit_code: nil, output: nil, start: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::State::Health::Log} for more details. + # + # HealthcheckResult stores information about a single run of a healthcheck probe + # + # @param end_ [String] Date and time at which this check ended in + # + # @param exit_code [Integer] ExitCode meanings: + # + # @param output [String] Output from last check + # + # @param start [Time] Date and time at which this check started in + end + + # Status is one of `none`, `starting`, `healthy` or `unhealthy` + # + # - "none" Indicates there is no healthcheck + # - "starting" Starting indicates that the container is not yet ready + # - "healthy" Healthy indicates that the container is running correctly + # - "unhealthy" Unhealthy indicates that the container has a problem + # + # @see Docker::Models::Container::State::Health#status + module Status + extend Docker::Internal::Type::Enum + + NONE = :none + STARTING = :starting + HEALTHY = :healthy + UNHEALTHY = :unhealthy + + # @!method self.values + # @return [Array] + end + end + + # String representation of the container state. Can be one of "created", + # "running", "paused", "restarting", "removing", "exited", or "dead". + # + # @see Docker::Models::Container::State#status + module Status + extend Docker::Internal::Type::Enum + + CREATED = :created + RUNNING = :running + PAUSED = :paused + RESTARTING = :restarting + REMOVING = :removing + EXITED = :exited + DEAD = :dead + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::Container#storage + class Storage < Docker::Internal::Type::BaseModel + # @!attribute root_fs + # Information about the storage used for the container's root filesystem. + # + # @return [Docker::Models::Container::Storage::RootFs, nil] + optional :root_fs, -> { Docker::Container::Storage::RootFs }, api_name: :RootFS + + # @!method initialize(root_fs: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::Storage} for more details. + # + # Information about the storage used by the container. + # + # @param root_fs [Docker::Models::Container::Storage::RootFs] Information about the storage used for the container's root filesystem. + + # @see Docker::Models::Container::Storage#root_fs + class RootFs < Docker::Internal::Type::BaseModel + # @!attribute snapshot + # Information about a snapshot backend of the container's root filesystem. + # + # @return [Docker::Models::Container::Storage::RootFs::Snapshot, nil] + optional :snapshot, -> { Docker::Container::Storage::RootFs::Snapshot }, api_name: :Snapshot + + # @!method initialize(snapshot: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Container::Storage::RootFs} for more details. + # + # Information about the storage used for the container's root filesystem. + # + # @param snapshot [Docker::Models::Container::Storage::RootFs::Snapshot] Information about a snapshot backend of the container's root filesystem. + + # @see Docker::Models::Container::Storage::RootFs#snapshot + class Snapshot < Docker::Internal::Type::BaseModel + # @!attribute name + # Name of the snapshotter. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!method initialize(name: nil) + # Information about a snapshot backend of the container's root filesystem. + # + # @param name [String] Name of the snapshotter. + end + end + end + end + end +end diff --git a/lib/docker/models/container_create_params.rb b/lib/docker/models/container_create_params.rb new file mode 100644 index 0000000..88257d8 --- /dev/null +++ b/lib/docker/models/container_create_params.rb @@ -0,0 +1,1701 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Containers#create + class ContainerCreateParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute config + # Configuration for a container that is portable between hosts. + # + # @return [Docker::Models::ContainerCreateParams::Config] + required :config, -> { Docker::ContainerCreateParams::Config } + + # @!attribute name + # Assign the specified name to the container. Must match + # `/?[a-zA-Z0-9][a-zA-Z0-9_.-]+`. + # + # @return [String, nil] + optional :name, String + + # @!attribute platform + # Platform in the format `os[/arch[/variant]]` used for image lookup. + # + # When specified, the daemon checks if the requested image is present in the local + # image cache with the given OS and Architecture, and otherwise returns a `404` + # status. + # + # If the option is not set, the host's native OS and Architecture are used to look + # up the image in the image cache. However, if no platform is passed and the given + # image does exist in the local image cache, but its OS or architecture does not + # match, the container is created with the available image, and a warning is added + # to the `Warnings` field in the response, for example; + # + # WARNING: The requested image's platform (linux/arm64/v8) does not + # match the detected host platform (linux/amd64) and no + # specific platform was requested + # + # @return [String, nil] + optional :platform, String + + # @!method initialize(config:, name: nil, platform: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerCreateParams} for more details. + # + # @param config [Docker::Models::ContainerCreateParams::Config] Configuration for a container that is portable between hosts. + # + # @param name [String] Assign the specified name to the container. Must match + # + # @param platform [String] Platform in the format `os[/arch[/variant]]` used for image lookup. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + + class Config < Docker::Models::Config + # @!attribute host_config + # Container configuration that depends on the host we are running on + # + # @return [Docker::Models::ContainerCreateParams::Config::HostConfig, nil] + optional :host_config, -> { Docker::ContainerCreateParams::Config::HostConfig }, api_name: :HostConfig + + # @!attribute networking_config + # NetworkingConfig represents the container's networking configuration for each of + # its interfaces. It is used for the networking configs specified in the + # `docker create` and `docker network connect` commands. + # + # @return [Docker::Models::ContainerCreateParams::Config::NetworkingConfig, nil] + optional :networking_config, + -> { Docker::ContainerCreateParams::Config::NetworkingConfig }, + api_name: :NetworkingConfig + + # @!method initialize(host_config: nil, networking_config: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerCreateParams::Config} for more details. + # + # Configuration for a container that is portable between hosts. + # + # @param host_config [Docker::Models::ContainerCreateParams::Config::HostConfig] Container configuration that depends on the host we are running on + # + # @param networking_config [Docker::Models::ContainerCreateParams::Config::NetworkingConfig] NetworkingConfig represents the container's networking configuration for + + class HostConfig < Docker::Internal::Type::BaseModel + # @!attribute annotations + # Arbitrary non-identifying metadata attached to container and provided to the + # runtime when the container is started. + # + # @return [Hash{Symbol=>String}, nil] + optional :annotations, Docker::Internal::Type::HashOf[String], api_name: :Annotations + + # @!attribute auto_remove + # Automatically remove the container when the container's process exits. This has + # no effect if `RestartPolicy` is set. + # + # @return [Boolean, nil] + optional :auto_remove, Docker::Internal::Type::Boolean, api_name: :AutoRemove + + # @!attribute binds + # A list of volume bindings for this container. Each volume binding is a string in + # one of these forms: + # + # - `host-src:container-dest[:options]` to bind-mount a host path into the + # container. Both `host-src`, and `container-dest` must be an _absolute_ path. + # - `volume-name:container-dest[:options]` to bind-mount a volume managed by a + # volume driver into the container. `container-dest` must be an _absolute_ path. + # + # `options` is an optional, comma-delimited list of: + # + # - `nocopy` disables automatic copying of data from the container path to the + # volume. The `nocopy` flag only applies to named volumes. + # - `[ro|rw]` mounts a volume read-only or read-write, respectively. If omitted or + # set to `rw`, volumes are mounted read-write. + # - `[z|Z]` applies SELinux labels to allow or deny multiple containers to read + # and write to the same volume. + # - `z`: a _shared_ content label is applied to the content. This label + # indicates that multiple containers can share the volume content, for both + # reading and writing. + # - `Z`: a _private unshared_ label is applied to the content. This label + # indicates that only the current container can use a private volume. Labeling + # systems such as SELinux require proper labels to be placed on volume content + # that is mounted into a container. Without a label, the security system can + # prevent a container's processes from using the content. By default, the + # labels set by the host operating system are not modified. + # - `[[r]shared|[r]slave|[r]private]` specifies mount + # [propagation behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt). + # This only applies to bind-mounted volumes, not internal volumes or named + # volumes. Mount propagation requires the source mount point (the location where + # the source directory is mounted in the host operating system) to have the + # correct propagation properties. For shared volumes, the source mount point + # must be set to `shared`. For slave volumes, the mount must be set to either + # `shared` or `slave`. + # + # @return [Array, nil] + optional :binds, Docker::Internal::Type::ArrayOf[String], api_name: :Binds + + # @!attribute blkio_device_read_bps + # Limit read rate (bytes per second) from a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + # + # @return [Array, nil] + optional :blkio_device_read_bps, + -> { + Docker::Internal::Type::ArrayOf[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadBp] + }, + api_name: :BlkioDeviceReadBps + + # @!attribute blkio_device_read_i_ops + # Limit read rate (IO per second) from a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + # + # @return [Array, nil] + optional :blkio_device_read_i_ops, + -> { + Docker::Internal::Type::ArrayOf[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadIOp] + }, + api_name: :BlkioDeviceReadIOps + + # @!attribute blkio_device_write_bps + # Limit write rate (bytes per second) to a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + # + # @return [Array, nil] + optional :blkio_device_write_bps, + -> { + Docker::Internal::Type::ArrayOf[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteBp] + }, + api_name: :BlkioDeviceWriteBps + + # @!attribute blkio_device_write_i_ops + # Limit write rate (IO per second) to a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + # + # @return [Array, nil] + optional :blkio_device_write_i_ops, + -> { + Docker::Internal::Type::ArrayOf[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteIOp] + }, + api_name: :BlkioDeviceWriteIOps + + # @!attribute blkio_weight + # Block IO weight (relative weight). + # + # @return [Integer, nil] + optional :blkio_weight, Integer, api_name: :BlkioWeight + + # @!attribute blkio_weight_device + # Block IO weight (relative device weight) in the form: + # + # ``` + # [{"Path": "device_path", "Weight": weight}] + # ``` + # + # @return [Array, nil] + optional :blkio_weight_device, + -> { + Docker::Internal::Type::ArrayOf[Docker::ContainerCreateParams::Config::HostConfig::BlkioWeightDevice] + }, + api_name: :BlkioWeightDevice + + # @!attribute cap_add + # A list of kernel capabilities to add to the container. Conflicts with option + # 'Capabilities'. + # + # @return [Array, nil] + optional :cap_add, Docker::Internal::Type::ArrayOf[String], api_name: :CapAdd + + # @!attribute cap_drop + # A list of kernel capabilities to drop from the container. Conflicts with option + # 'Capabilities'. + # + # @return [Array, nil] + optional :cap_drop, Docker::Internal::Type::ArrayOf[String], api_name: :CapDrop + + # @!attribute cgroup + # Cgroup to use for the container. + # + # @return [String, nil] + optional :cgroup, String, api_name: :Cgroup + + # @!attribute cgroupns_mode + # cgroup namespace mode for the container. Possible values are: + # + # - `"private"`: the container runs in its own private cgroup namespace + # - `"host"`: use the host system's cgroup namespace + # + # If not specified, the daemon default is used, which can either be `"private"` or + # `"host"`, depending on daemon version, kernel support and configuration. + # + # @return [Symbol, Docker::Models::ContainerCreateParams::Config::HostConfig::CgroupnsMode, nil] + optional :cgroupns_mode, + enum: -> { Docker::ContainerCreateParams::Config::HostConfig::CgroupnsMode }, + api_name: :CgroupnsMode + + # @!attribute cgroup_parent + # Path to `cgroups` under which the container's `cgroup` is created. If the path + # is not absolute, the path is considered to be relative to the `cgroups` path of + # the init process. Cgroups are created if they do not already exist. + # + # @return [String, nil] + optional :cgroup_parent, String, api_name: :CgroupParent + + # @!attribute console_size + # Initial console size, as an `[height, width]` array. + # + # @return [Array, nil] + optional :console_size, Docker::Internal::Type::ArrayOf[Integer], api_name: :ConsoleSize, nil?: true + + # @!attribute container_id_file + # Path to a file where the container ID is written + # + # @return [String, nil] + optional :container_id_file, String, api_name: :ContainerIDFile + + # @!attribute cpu_count + # The number of usable CPUs (Windows only). + # + # On Windows Server containers, the processor resource controls are mutually + # exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and + # `CPUPercent` last. + # + # @return [Integer, nil] + optional :cpu_count, Integer, api_name: :CpuCount + + # @!attribute cpu_percent + # The usable percentage of the available CPUs (Windows only). + # + # On Windows Server containers, the processor resource controls are mutually + # exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and + # `CPUPercent` last. + # + # @return [Integer, nil] + optional :cpu_percent, Integer, api_name: :CpuPercent + + # @!attribute cpu_period + # The length of a CPU period in microseconds. + # + # @return [Integer, nil] + optional :cpu_period, Integer, api_name: :CpuPeriod + + # @!attribute cpu_quota + # Microseconds of CPU time that the container can get in a CPU period. + # + # @return [Integer, nil] + optional :cpu_quota, Integer, api_name: :CpuQuota + + # @!attribute cpu_realtime_period + # The length of a CPU real-time period in microseconds. Set to 0 to allocate no + # time allocated to real-time tasks. + # + # @return [Integer, nil] + optional :cpu_realtime_period, Integer, api_name: :CpuRealtimePeriod + + # @!attribute cpu_realtime_runtime + # The length of a CPU real-time runtime in microseconds. Set to 0 to allocate no + # time allocated to real-time tasks. + # + # @return [Integer, nil] + optional :cpu_realtime_runtime, Integer, api_name: :CpuRealtimeRuntime + + # @!attribute cpuset_cpus + # CPUs in which to allow execution (e.g., `0-3`, `0,1`). + # + # @return [String, nil] + optional :cpuset_cpus, String, api_name: :CpusetCpus + + # @!attribute cpuset_mems + # Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on + # NUMA systems. + # + # @return [String, nil] + optional :cpuset_mems, String, api_name: :CpusetMems + + # @!attribute cpu_shares + # An integer value representing this container's relative CPU weight versus other + # containers. + # + # @return [Integer, nil] + optional :cpu_shares, Integer, api_name: :CpuShares + + # @!attribute device_cgroup_rules + # a list of cgroup rules to apply to the container + # + # @return [Array, nil] + optional :device_cgroup_rules, Docker::Internal::Type::ArrayOf[String], api_name: :DeviceCgroupRules + + # @!attribute device_requests + # A list of requests for devices to be sent to device drivers. + # + # @return [Array, nil] + optional :device_requests, + -> { + Docker::Internal::Type::ArrayOf[Docker::ContainerCreateParams::Config::HostConfig::DeviceRequest] + }, + api_name: :DeviceRequests + + # @!attribute devices + # A list of devices to add to the container. + # + # @return [Array, nil] + optional :devices, + -> { + Docker::Internal::Type::ArrayOf[Docker::ContainerCreateParams::Config::HostConfig::Device] + }, + api_name: :Devices + + # @!attribute dns + # A list of DNS servers for the container to use. + # + # @return [Array, nil] + optional :dns, Docker::Internal::Type::ArrayOf[String], api_name: :Dns + + # @!attribute dns_options + # A list of DNS options. + # + # @return [Array, nil] + optional :dns_options, Docker::Internal::Type::ArrayOf[String], api_name: :DnsOptions + + # @!attribute dns_search + # A list of DNS search domains. + # + # @return [Array, nil] + optional :dns_search, Docker::Internal::Type::ArrayOf[String], api_name: :DnsSearch + + # @!attribute extra_hosts + # A list of hostnames/IP mappings to add to the container's `/etc/hosts` file. + # Specified in the form `["hostname:IP"]`. + # + # @return [Array, nil] + optional :extra_hosts, Docker::Internal::Type::ArrayOf[String], api_name: :ExtraHosts + + # @!attribute group_add + # A list of additional groups that the container process will run as. + # + # @return [Array, nil] + optional :group_add, Docker::Internal::Type::ArrayOf[String], api_name: :GroupAdd + + # @!attribute init + # Run an init inside the container that forwards signals and reaps processes. This + # field is omitted if empty, and the default (as configured on the daemon) is + # used. + # + # @return [Boolean, nil] + optional :init, Docker::Internal::Type::Boolean, api_name: :Init, nil?: true + + # @!attribute io_maximum_bandwidth + # Maximum IO in bytes per second for the container system drive (Windows only). + # + # @return [Integer, nil] + optional :io_maximum_bandwidth, Integer, api_name: :IOMaximumBandwidth + + # @!attribute io_maximum_i_ops + # Maximum IOps for the container system drive (Windows only) + # + # @return [Integer, nil] + optional :io_maximum_i_ops, Integer, api_name: :IOMaximumIOps + + # @!attribute ipc_mode + # IPC sharing mode for the container. Possible values are: + # + # - `"none"`: own private IPC namespace, with /dev/shm not mounted + # - `"private"`: own private IPC namespace + # - `"shareable"`: own private IPC namespace, with a possibility to share it with + # other containers + # - `"container:"`: join another (shareable) container's IPC namespace + # - `"host"`: use the host system's IPC namespace + # + # If not specified, daemon default is used, which can either be `"private"` or + # `"shareable"`, depending on daemon version and configuration. + # + # @return [String, nil] + optional :ipc_mode, String, api_name: :IpcMode + + # @!attribute isolation + # Isolation technology of the container. (Windows only) + # + # @return [Symbol, Docker::Models::ContainerCreateParams::Config::HostConfig::Isolation, nil] + optional :isolation, + enum: -> { Docker::ContainerCreateParams::Config::HostConfig::Isolation }, + api_name: :Isolation + + # @!attribute links + # A list of links for the container in the form `container_name:alias`. + # + # @return [Array, nil] + optional :links, Docker::Internal::Type::ArrayOf[String], api_name: :Links + + # @!attribute log_config + # The logging configuration for this container + # + # @return [Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig, nil] + optional :log_config, + -> { Docker::ContainerCreateParams::Config::HostConfig::LogConfig }, + api_name: :LogConfig + + # @!attribute masked_paths + # The list of paths to be masked inside the container (this overrides the default + # set of paths). + # + # @return [Array, nil] + optional :masked_paths, Docker::Internal::Type::ArrayOf[String], api_name: :MaskedPaths + + # @!attribute memory + # Memory limit in bytes. + # + # @return [Integer, nil] + optional :memory, Integer, api_name: :Memory + + # @!attribute memory_reservation + # Memory soft limit in bytes. + # + # @return [Integer, nil] + optional :memory_reservation, Integer, api_name: :MemoryReservation + + # @!attribute memory_swap + # Total memory limit (memory + swap). Set as `-1` to enable unlimited swap. + # + # @return [Integer, nil] + optional :memory_swap, Integer, api_name: :MemorySwap + + # @!attribute memory_swappiness + # Tune a container's memory swappiness behavior. Accepts an integer between 0 + # and 100. + # + # @return [Integer, nil] + optional :memory_swappiness, Integer, api_name: :MemorySwappiness + + # @!attribute mounts + # Specification for mounts to be added to the container. + # + # @return [Array, nil] + optional :mounts, + -> { + Docker::Internal::Type::ArrayOf[Docker::ContainerCreateParams::Config::HostConfig::Mount] + }, + api_name: :Mounts + + # @!attribute nano_cpus + # CPU quota in units of 10-9 CPUs. + # + # @return [Integer, nil] + optional :nano_cpus, Integer, api_name: :NanoCpus + + # @!attribute network_mode + # Network mode to use for this container. Supported standard values are: `bridge`, + # `host`, `none`, and `container:`. Any other value is taken as a custom + # network's name to which this container should connect to. + # + # @return [String, nil] + optional :network_mode, String, api_name: :NetworkMode + + # @!attribute oom_kill_disable + # Disable OOM Killer for the container. + # + # @return [Boolean, nil] + optional :oom_kill_disable, Docker::Internal::Type::Boolean, api_name: :OomKillDisable + + # @!attribute oom_score_adj + # An integer value containing the score given to the container in order to tune + # OOM killer preferences. + # + # @return [Integer, nil] + optional :oom_score_adj, Integer, api_name: :OomScoreAdj + + # @!attribute pid_mode + # Set the PID (Process) Namespace mode for the container. It can be either: + # + # - `"container:"`: joins another container's PID namespace + # - `"host"`: use the host's PID namespace inside the container + # + # @return [String, nil] + optional :pid_mode, String, api_name: :PidMode + + # @!attribute pids_limit + # Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` to not + # change. + # + # @return [Integer, nil] + optional :pids_limit, Integer, api_name: :PidsLimit, nil?: true + + # @!attribute port_bindings + # PortMap describes the mapping of container ports to host ports, using the + # container's port-number and protocol as key in the format `/`, + # for example, `80/udp`. + # + # If a container's port is mapped for multiple protocols, separate entries are + # added to the mapping table. + # + # @return [Hash{Symbol=>Array}, nil] + optional :port_bindings, + -> { + Docker::Internal::Type::HashOf[Docker::Internal::Type::ArrayOf[Docker::ContainerCreateParams::Config::HostConfig::PortBinding]] + }, + api_name: :PortBindings + + # @!attribute privileged + # Gives the container full access to the host. + # + # @return [Boolean, nil] + optional :privileged, Docker::Internal::Type::Boolean, api_name: :Privileged + + # @!attribute publish_all_ports + # Allocates an ephemeral host port for all of a container's exposed ports. + # + # Ports are de-allocated when the container stops and allocated when the container + # starts. The allocated port might be changed when restarting the container. + # + # The port is selected from the ephemeral port range that depends on the kernel. + # For example, on Linux the range is defined by + # `/proc/sys/net/ipv4/ip_local_port_range`. + # + # @return [Boolean, nil] + optional :publish_all_ports, Docker::Internal::Type::Boolean, api_name: :PublishAllPorts + + # @!attribute readonly_paths + # The list of paths to be set as read-only inside the container (this overrides + # the default set of paths). + # + # @return [Array, nil] + optional :readonly_paths, Docker::Internal::Type::ArrayOf[String], api_name: :ReadonlyPaths + + # @!attribute readonly_rootfs + # Mount the container's root filesystem as read only. + # + # @return [Boolean, nil] + optional :readonly_rootfs, Docker::Internal::Type::Boolean, api_name: :ReadonlyRootfs + + # @!attribute restart_policy + # The behavior to apply when the container exits. The default is not to restart. + # + # An ever increasing delay (double the previous delay, starting at 100ms) is added + # before each restart to prevent flooding the server. + # + # @return [Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy, nil] + optional :restart_policy, + -> { Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy }, + api_name: :RestartPolicy + + # @!attribute runtime + # Runtime to use with this container. + # + # @return [String, nil] + optional :runtime, String, api_name: :Runtime, nil?: true + + # @!attribute security_opt + # A list of string values to customize labels for MLS systems, such as SELinux. + # + # @return [Array, nil] + optional :security_opt, Docker::Internal::Type::ArrayOf[String], api_name: :SecurityOpt + + # @!attribute shm_size + # Size of `/dev/shm` in bytes. If omitted, the system uses 64MB. + # + # @return [Integer, nil] + optional :shm_size, Integer, api_name: :ShmSize + + # @!attribute storage_opt + # Storage driver options for this container, in the form `{"size": "120G"}`. + # + # @return [Hash{Symbol=>String}, nil] + optional :storage_opt, Docker::Internal::Type::HashOf[String], api_name: :StorageOpt + + # @!attribute sysctls + # A list of kernel parameters (sysctls) to set in the container. + # + # This field is omitted if not set. + # + # @return [Hash{Symbol=>String}, nil] + optional :sysctls, Docker::Internal::Type::HashOf[String], api_name: :Sysctls, nil?: true + + # @!attribute tmpfs + # A map of container directories which should be replaced by tmpfs mounts, and + # their corresponding mount options. For example: + # + # ``` + # { "/run": "rw,noexec,nosuid,size=65536k" } + # ``` + # + # @return [Hash{Symbol=>String}, nil] + optional :tmpfs, Docker::Internal::Type::HashOf[String], api_name: :Tmpfs + + # @!attribute ulimits + # A list of resource limits to set in the container. For example: + # + # ``` + # {"Name": "nofile", "Soft": 1024, "Hard": 2048} + # ``` + # + # @return [Array, nil] + optional :ulimits, + -> { + Docker::Internal::Type::ArrayOf[Docker::ContainerCreateParams::Config::HostConfig::Ulimit] + }, + api_name: :Ulimits + + # @!attribute userns_mode + # Sets the usernamespace mode for the container when usernamespace remapping + # option is enabled. + # + # @return [String, nil] + optional :userns_mode, String, api_name: :UsernsMode + + # @!attribute uts_mode + # UTS namespace to use for the container. + # + # @return [String, nil] + optional :uts_mode, String, api_name: :UTSMode + + # @!attribute volume_driver + # Driver that this container uses to mount volumes. + # + # @return [String, nil] + optional :volume_driver, String, api_name: :VolumeDriver + + # @!attribute volumes_from + # A list of volumes to inherit from another container, specified in the form + # `[:]`. + # + # @return [Array, nil] + optional :volumes_from, Docker::Internal::Type::ArrayOf[String], api_name: :VolumesFrom + + # @!method initialize(annotations: nil, auto_remove: nil, binds: nil, blkio_device_read_bps: nil, blkio_device_read_i_ops: nil, blkio_device_write_bps: nil, blkio_device_write_i_ops: nil, blkio_weight: nil, blkio_weight_device: nil, cap_add: nil, cap_drop: nil, cgroup: nil, cgroupns_mode: nil, cgroup_parent: nil, console_size: nil, container_id_file: nil, cpu_count: nil, cpu_percent: nil, cpu_period: nil, cpu_quota: nil, cpu_realtime_period: nil, cpu_realtime_runtime: nil, cpuset_cpus: nil, cpuset_mems: nil, cpu_shares: nil, device_cgroup_rules: nil, device_requests: nil, devices: nil, dns: nil, dns_options: nil, dns_search: nil, extra_hosts: nil, group_add: nil, init: nil, io_maximum_bandwidth: nil, io_maximum_i_ops: nil, ipc_mode: nil, isolation: nil, links: nil, log_config: nil, masked_paths: nil, memory: nil, memory_reservation: nil, memory_swap: nil, memory_swappiness: nil, mounts: nil, nano_cpus: nil, network_mode: nil, oom_kill_disable: nil, oom_score_adj: nil, pid_mode: nil, pids_limit: nil, port_bindings: nil, privileged: nil, publish_all_ports: nil, readonly_paths: nil, readonly_rootfs: nil, restart_policy: nil, runtime: nil, security_opt: nil, shm_size: nil, storage_opt: nil, sysctls: nil, tmpfs: nil, ulimits: nil, userns_mode: nil, uts_mode: nil, volume_driver: nil, volumes_from: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerCreateParams::Config::HostConfig} for more details. + # + # Container configuration that depends on the host we are running on + # + # @param annotations [Hash{Symbol=>String}] Arbitrary non-identifying metadata attached to container and + # + # @param auto_remove [Boolean] Automatically remove the container when the container's process + # + # @param binds [Array] A list of volume bindings for this container. Each volume binding + # + # @param blkio_device_read_bps [Array] Limit read rate (bytes per second) from a device, in the form: + # + # @param blkio_device_read_i_ops [Array] Limit read rate (IO per second) from a device, in the form: + # + # @param blkio_device_write_bps [Array] Limit write rate (bytes per second) to a device, in the form: + # + # @param blkio_device_write_i_ops [Array] Limit write rate (IO per second) to a device, in the form: + # + # @param blkio_weight [Integer] Block IO weight (relative weight). + # + # @param blkio_weight_device [Array] Block IO weight (relative device weight) in the form: + # + # @param cap_add [Array] A list of kernel capabilities to add to the container. Conflicts + # + # @param cap_drop [Array] A list of kernel capabilities to drop from the container. Conflicts + # + # @param cgroup [String] Cgroup to use for the container. + # + # @param cgroupns_mode [Symbol, Docker::Models::ContainerCreateParams::Config::HostConfig::CgroupnsMode] cgroup namespace mode for the container. Possible values are: + # + # @param cgroup_parent [String] Path to `cgroups` under which the container's `cgroup` is created. If + # + # @param console_size [Array, nil] Initial console size, as an `[height, width]` array. + # + # @param container_id_file [String] Path to a file where the container ID is written + # + # @param cpu_count [Integer] The number of usable CPUs (Windows only). + # + # @param cpu_percent [Integer] The usable percentage of the available CPUs (Windows only). + # + # @param cpu_period [Integer] The length of a CPU period in microseconds. + # + # @param cpu_quota [Integer] Microseconds of CPU time that the container can get in a CPU period. + # + # @param cpu_realtime_period [Integer] The length of a CPU real-time period in microseconds. Set to 0 to + # + # @param cpu_realtime_runtime [Integer] The length of a CPU real-time runtime in microseconds. Set to 0 to + # + # @param cpuset_cpus [String] CPUs in which to allow execution (e.g., `0-3`, `0,1`). + # + # @param cpuset_mems [String] Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only + # + # @param cpu_shares [Integer] An integer value representing this container's relative CPU weight + # + # @param device_cgroup_rules [Array] a list of cgroup rules to apply to the container + # + # @param device_requests [Array] A list of requests for devices to be sent to device drivers. + # + # @param devices [Array] A list of devices to add to the container. + # + # @param dns [Array] A list of DNS servers for the container to use. + # + # @param dns_options [Array] A list of DNS options. + # + # @param dns_search [Array] A list of DNS search domains. + # + # @param extra_hosts [Array] A list of hostnames/IP mappings to add to the container's `/etc/hosts` + # + # @param group_add [Array] A list of additional groups that the container process will run as. + # + # @param init [Boolean, nil] Run an init inside the container that forwards signals and reaps + # + # @param io_maximum_bandwidth [Integer] Maximum IO in bytes per second for the container system drive + # + # @param io_maximum_i_ops [Integer] Maximum IOps for the container system drive (Windows only) + # + # @param ipc_mode [String] IPC sharing mode for the container. Possible values are: + # + # @param isolation [Symbol, Docker::Models::ContainerCreateParams::Config::HostConfig::Isolation] Isolation technology of the container. (Windows only) + # + # @param links [Array] A list of links for the container in the form `container_name:alias`. + # + # @param log_config [Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig] The logging configuration for this container + # + # @param masked_paths [Array] The list of paths to be masked inside the container (this overrides + # + # @param memory [Integer] Memory limit in bytes. + # + # @param memory_reservation [Integer] Memory soft limit in bytes. + # + # @param memory_swap [Integer] Total memory limit (memory + swap). Set as `-1` to enable unlimited + # + # @param memory_swappiness [Integer] Tune a container's memory swappiness behavior. Accepts an integer + # + # @param mounts [Array] Specification for mounts to be added to the container. + # + # @param nano_cpus [Integer] CPU quota in units of 10-9 CPUs. + # + # @param network_mode [String] Network mode to use for this container. Supported standard values + # + # @param oom_kill_disable [Boolean] Disable OOM Killer for the container. + # + # @param oom_score_adj [Integer] An integer value containing the score given to the container in + # + # @param pid_mode [String] Set the PID (Process) Namespace mode for the container. It can be + # + # @param pids_limit [Integer, nil] Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` + # + # @param port_bindings [Hash{Symbol=>Array}] PortMap describes the mapping of container ports to host ports, using the + # + # @param privileged [Boolean] Gives the container full access to the host. + # + # @param publish_all_ports [Boolean] Allocates an ephemeral host port for all of a container's + # + # @param readonly_paths [Array] The list of paths to be set as read-only inside the container + # + # @param readonly_rootfs [Boolean] Mount the container's root filesystem as read only. + # + # @param restart_policy [Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy] The behavior to apply when the container exits. The default is not to + # + # @param runtime [String, nil] Runtime to use with this container. + # + # @param security_opt [Array] A list of string values to customize labels for MLS systems, such + # + # @param shm_size [Integer] Size of `/dev/shm` in bytes. If omitted, the system uses 64MB. + # + # @param storage_opt [Hash{Symbol=>String}] Storage driver options for this container, in the form `{"size": "120G"}`. + # + # @param sysctls [Hash{Symbol=>String}, nil] A list of kernel parameters (sysctls) to set in the container. + # + # @param tmpfs [Hash{Symbol=>String}] A map of container directories which should be replaced by tmpfs + # + # @param ulimits [Array] A list of resource limits to set in the container. For example: + # + # @param userns_mode [String] Sets the usernamespace mode for the container when usernamespace + # + # @param uts_mode [String] UTS namespace to use for the container. + # + # @param volume_driver [String] Driver that this container uses to mount volumes. + # + # @param volumes_from [Array] A list of volumes to inherit from another container, specified in + + class BlkioDeviceReadBp < Docker::Internal::Type::BaseModel + # @!attribute path + # Device path + # + # @return [String, nil] + optional :path, String, api_name: :Path + + # @!attribute rate + # Rate + # + # @return [Integer, nil] + optional :rate, Integer, api_name: :Rate + + # @!method initialize(path: nil, rate: nil) + # @param path [String] Device path + # + # @param rate [Integer] Rate + end + + class BlkioDeviceReadIOp < Docker::Internal::Type::BaseModel + # @!attribute path + # Device path + # + # @return [String, nil] + optional :path, String, api_name: :Path + + # @!attribute rate + # Rate + # + # @return [Integer, nil] + optional :rate, Integer, api_name: :Rate + + # @!method initialize(path: nil, rate: nil) + # @param path [String] Device path + # + # @param rate [Integer] Rate + end + + class BlkioDeviceWriteBp < Docker::Internal::Type::BaseModel + # @!attribute path + # Device path + # + # @return [String, nil] + optional :path, String, api_name: :Path + + # @!attribute rate + # Rate + # + # @return [Integer, nil] + optional :rate, Integer, api_name: :Rate + + # @!method initialize(path: nil, rate: nil) + # @param path [String] Device path + # + # @param rate [Integer] Rate + end + + class BlkioDeviceWriteIOp < Docker::Internal::Type::BaseModel + # @!attribute path + # Device path + # + # @return [String, nil] + optional :path, String, api_name: :Path + + # @!attribute rate + # Rate + # + # @return [Integer, nil] + optional :rate, Integer, api_name: :Rate + + # @!method initialize(path: nil, rate: nil) + # @param path [String] Device path + # + # @param rate [Integer] Rate + end + + class BlkioWeightDevice < Docker::Internal::Type::BaseModel + # @!attribute path + # + # @return [String, nil] + optional :path, String, api_name: :Path + + # @!attribute weight + # + # @return [Integer, nil] + optional :weight, Integer, api_name: :Weight + + # @!method initialize(path: nil, weight: nil) + # @param path [String] + # @param weight [Integer] + end + + # cgroup namespace mode for the container. Possible values are: + # + # - `"private"`: the container runs in its own private cgroup namespace + # - `"host"`: use the host system's cgroup namespace + # + # If not specified, the daemon default is used, which can either be `"private"` or + # `"host"`, depending on daemon version, kernel support and configuration. + # + # @see Docker::Models::ContainerCreateParams::Config::HostConfig#cgroupns_mode + module CgroupnsMode + extend Docker::Internal::Type::Enum + + PRIVATE = :private + HOST = :host + + # @!method self.values + # @return [Array] + end + + class DeviceRequest < Docker::Internal::Type::BaseModel + # @!attribute capabilities + # A list of capabilities; an OR list of AND lists of capabilities. + # + # Note that if a driver is specified the capabilities have no effect on selecting + # a driver as the driver name is used directly. + # + # Note that if no driver is specified the capabilities are used to select a driver + # with the required capabilities. + # + # @return [Array>, nil] + optional :capabilities, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::ArrayOf[String]], + api_name: :Capabilities + + # @!attribute count + # + # @return [Integer, nil] + optional :count, Integer, api_name: :Count + + # @!attribute device_ids + # + # @return [Array, nil] + optional :device_ids, Docker::Internal::Type::ArrayOf[String], api_name: :DeviceIDs + + # @!attribute driver + # The name of the device driver to use for this request. + # + # Note that if this is specified the capabilities are ignored when selecting a + # device driver. + # + # @return [String, nil] + optional :driver, String, api_name: :Driver + + # @!attribute options + # Driver-specific options, specified as a key/value pairs. These options are + # passed directly to the driver. + # + # @return [Hash{Symbol=>String}, nil] + optional :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!method initialize(capabilities: nil, count: nil, device_ids: nil, driver: nil, options: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerCreateParams::Config::HostConfig::DeviceRequest} for + # more details. + # + # A request for devices to be sent to device drivers + # + # @param capabilities [Array>] A list of capabilities; an OR list of AND lists of capabilities. + # + # @param count [Integer] + # + # @param device_ids [Array] + # + # @param driver [String] The name of the device driver to use for this request. + # + # @param options [Hash{Symbol=>String}] Driver-specific options, specified as a key/value pairs. These options + end + + class Device < Docker::Internal::Type::BaseModel + # @!attribute cgroup_permissions + # + # @return [String, nil] + optional :cgroup_permissions, String, api_name: :CgroupPermissions + + # @!attribute path_in_container + # + # @return [String, nil] + optional :path_in_container, String, api_name: :PathInContainer + + # @!attribute path_on_host + # + # @return [String, nil] + optional :path_on_host, String, api_name: :PathOnHost + + # @!method initialize(cgroup_permissions: nil, path_in_container: nil, path_on_host: nil) + # A device mapping between the host and container + # + # @param cgroup_permissions [String] + # @param path_in_container [String] + # @param path_on_host [String] + end + + # Isolation technology of the container. (Windows only) + # + # @see Docker::Models::ContainerCreateParams::Config::HostConfig#isolation + module Isolation + extend Docker::Internal::Type::Enum + + DEFAULT = :default + PROCESS = :process + HYPERV = :hyperv + EMPTY = :"" + + # @!method self.values + # @return [Array] + end + + # @see Docker::Models::ContainerCreateParams::Config::HostConfig#log_config + class LogConfig < Docker::Internal::Type::BaseModel + # @!attribute config + # Driver-specific configuration options for the logging driver. + # + # @return [Hash{Symbol=>String}, nil] + optional :config, Docker::Internal::Type::HashOf[String], api_name: :Config + + # @!attribute type + # Name of the logging driver used for the container or "none" if logging is + # disabled. + # + # @return [Symbol, Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig::Type, nil] + optional :type, + enum: -> { Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type }, + api_name: :Type + + # @!method initialize(config: nil, type: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig} for more + # details. + # + # The logging configuration for this container + # + # @param config [Hash{Symbol=>String}] Driver-specific configuration options for the logging driver. + # + # @param type [Symbol, Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig::Type] Name of the logging driver used for the container or "none" + + # Name of the logging driver used for the container or "none" if logging is + # disabled. + # + # @see Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig#type + module Type + extend Docker::Internal::Type::Enum + + LOCAL = :local + JSON_FILE = :"json-file" + SYSLOG = :syslog + JOURNALD = :journald + GELF = :gelf + FLUENTD = :fluentd + AWSLOGS = :awslogs + SPLUNK = :splunk + ETWLOGS = :etwlogs + NONE = :none + + # @!method self.values + # @return [Array] + end + end + + class Mount < Docker::Internal::Type::BaseModel + # @!attribute bind_options + # Optional configuration for the `bind` type. + # + # @return [Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions, nil] + optional :bind_options, + -> { Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions }, + api_name: :BindOptions + + # @!attribute consistency + # The consistency requirement for the mount: `default`, `consistent`, `cached`, or + # `delegated`. + # + # @return [String, nil] + optional :consistency, String, api_name: :Consistency + + # @!attribute image_options + # Optional configuration for the `image` type. + # + # @return [Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions, nil] + optional :image_options, + -> { Docker::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions }, + api_name: :ImageOptions + + # @!attribute read_only + # Whether the mount should be read-only. + # + # @return [Boolean, nil] + optional :read_only, Docker::Internal::Type::Boolean, api_name: :ReadOnly + + # @!attribute source + # Mount source (e.g. a volume name, a host path). The source cannot be specified + # when using `Type=tmpfs`. For `Type=bind`, the source path must either exist, or + # the `CreateMountpoint` must be set to `true` to create the source path on the + # host if missing. + # + # For `Type=npipe`, the pipe must exist prior to creating the container. + # + # @return [String, nil] + optional :source, String, api_name: :Source + + # @!attribute target + # Container path. + # + # @return [String, nil] + optional :target, String, api_name: :Target + + # @!attribute tmpfs_options + # Optional configuration for the `tmpfs` type. + # + # @return [Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions, nil] + optional :tmpfs_options, + -> { Docker::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions }, + api_name: :TmpfsOptions + + # @!attribute type + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + # + # @return [Symbol, Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::Type, nil] + optional :type, + enum: -> { Docker::ContainerCreateParams::Config::HostConfig::Mount::Type }, + api_name: :Type + + # @!attribute volume_options + # Optional configuration for the `volume` type. + # + # @return [Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions, nil] + optional :volume_options, + -> { Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions }, + api_name: :VolumeOptions + + # @!method initialize(bind_options: nil, consistency: nil, image_options: nil, read_only: nil, source: nil, target: nil, tmpfs_options: nil, type: nil, volume_options: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerCreateParams::Config::HostConfig::Mount} for more + # details. + # + # @param bind_options [Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions] Optional configuration for the `bind` type. + # + # @param consistency [String] The consistency requirement for the mount: `default`, `consistent`, `cached`, or + # + # @param image_options [Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions] Optional configuration for the `image` type. + # + # @param read_only [Boolean] Whether the mount should be read-only. + # + # @param source [String] Mount source (e.g. a volume name, a host path). The source cannot be + # + # @param target [String] Container path. + # + # @param tmpfs_options [Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions] Optional configuration for the `tmpfs` type. + # + # @param type [Symbol, Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::Type] The mount type. Available types: + # + # @param volume_options [Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions] Optional configuration for the `volume` type. + + # @see Docker::Models::ContainerCreateParams::Config::HostConfig::Mount#bind_options + class BindOptions < Docker::Internal::Type::BaseModel + # @!attribute create_mountpoint + # Create mount point on host if missing + # + # @return [Boolean, nil] + optional :create_mountpoint, Docker::Internal::Type::Boolean, api_name: :CreateMountpoint + + # @!attribute non_recursive + # Disable recursive bind mount. + # + # @return [Boolean, nil] + optional :non_recursive, Docker::Internal::Type::Boolean, api_name: :NonRecursive + + # @!attribute propagation + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + # + # @return [Symbol, Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation, nil] + optional :propagation, + enum: -> { + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation + }, + api_name: :Propagation + + # @!attribute read_only_force_recursive + # Raise an error if the mount cannot be made recursively read-only. + # + # @return [Boolean, nil] + optional :read_only_force_recursive, + Docker::Internal::Type::Boolean, + api_name: :ReadOnlyForceRecursive + + # @!attribute read_only_non_recursive + # Make the mount non-recursively read-only, but still leave the mount recursive + # (unless NonRecursive is set to `true` in conjunction). + # + # Added in v1.44, before that version all read-only mounts were non-recursive by + # default. To match the previous behaviour this will default to `true` for clients + # on versions prior to v1.44. + # + # @return [Boolean, nil] + optional :read_only_non_recursive, + Docker::Internal::Type::Boolean, + api_name: :ReadOnlyNonRecursive + + # @!method initialize(create_mountpoint: nil, non_recursive: nil, propagation: nil, read_only_force_recursive: nil, read_only_non_recursive: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions} + # for more details. + # + # Optional configuration for the `bind` type. + # + # @param create_mountpoint [Boolean] Create mount point on host if missing + # + # @param non_recursive [Boolean] Disable recursive bind mount. + # + # @param propagation [Symbol, Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation] A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + # + # @param read_only_force_recursive [Boolean] Raise an error if the mount cannot be made recursively read-only. + # + # @param read_only_non_recursive [Boolean] Make the mount non-recursively read-only, but still leave the mount recursive + + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + # + # @see Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions#propagation + module Propagation + extend Docker::Internal::Type::Enum + + PRIVATE = :private + RPRIVATE = :rprivate + SHARED = :shared + RSHARED = :rshared + SLAVE = :slave + RSLAVE = :rslave + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::ContainerCreateParams::Config::HostConfig::Mount#image_options + class ImageOptions < Docker::Internal::Type::BaseModel + # @!attribute subpath + # Source path inside the image. Must be relative without any back traversals. + # + # @return [String, nil] + optional :subpath, String, api_name: :Subpath + + # @!method initialize(subpath: nil) + # Optional configuration for the `image` type. + # + # @param subpath [String] Source path inside the image. Must be relative without any back traversals. + end + + # @see Docker::Models::ContainerCreateParams::Config::HostConfig::Mount#tmpfs_options + class TmpfsOptions < Docker::Internal::Type::BaseModel + # @!attribute mode + # The permission mode for the tmpfs mount in an integer. The value must not be in + # octal format (e.g. 755) but rather the decimal representation of the octal value + # (e.g. 493). + # + # @return [Integer, nil] + optional :mode, Integer, api_name: :Mode + + # @!attribute options + # The options to be passed to the tmpfs mount. An array of arrays. Flag options + # should be provided as 1-length arrays. Other types should be provided as as + # 2-length arrays, where the first item is the key and the second the value. + # + # @return [Array>, nil] + optional :options, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::ArrayOf[String]], + api_name: :Options + + # @!attribute size_bytes + # The size for the tmpfs mount in bytes. + # + # @return [Integer, nil] + optional :size_bytes, Integer, api_name: :SizeBytes + + # @!method initialize(mode: nil, options: nil, size_bytes: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions} + # for more details. + # + # Optional configuration for the `tmpfs` type. + # + # @param mode [Integer] The permission mode for the tmpfs mount in an integer. + # + # @param options [Array>] The options to be passed to the tmpfs mount. An array of arrays. + # + # @param size_bytes [Integer] The size for the tmpfs mount in bytes. + end + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + # + # @see Docker::Models::ContainerCreateParams::Config::HostConfig::Mount#type + module Type + extend Docker::Internal::Type::Enum + + BIND = :bind + CLUSTER = :cluster + IMAGE = :image + NPIPE = :npipe + TMPFS = :tmpfs + VOLUME = :volume + + # @!method self.values + # @return [Array] + end + + # @see Docker::Models::ContainerCreateParams::Config::HostConfig::Mount#volume_options + class VolumeOptions < Docker::Internal::Type::BaseModel + # @!attribute driver_config + # Map of driver specific options + # + # @return [Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig, nil] + optional :driver_config, + -> { + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig + }, + api_name: :DriverConfig + + # @!attribute labels + # User-defined key/value metadata. + # + # @return [Hash{Symbol=>String}, nil] + optional :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute no_copy + # Populate volume with data from the target. + # + # @return [Boolean, nil] + optional :no_copy, Docker::Internal::Type::Boolean, api_name: :NoCopy + + # @!attribute subpath + # Source path inside the volume. Must be relative without any back traversals. + # + # @return [String, nil] + optional :subpath, String, api_name: :Subpath + + # @!method initialize(driver_config: nil, labels: nil, no_copy: nil, subpath: nil) + # Optional configuration for the `volume` type. + # + # @param driver_config [Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig] Map of driver specific options + # + # @param labels [Hash{Symbol=>String}] User-defined key/value metadata. + # + # @param no_copy [Boolean] Populate volume with data from the target. + # + # @param subpath [String] Source path inside the volume. Must be relative without any back traversals. + + # @see Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions#driver_config + class DriverConfig < Docker::Internal::Type::BaseModel + # @!attribute name + # Name of the driver to use to create the volume. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute options + # key/value map of driver specific options. + # + # @return [Hash{Symbol=>String}, nil] + optional :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!method initialize(name: nil, options: nil) + # Map of driver specific options + # + # @param name [String] Name of the driver to use to create the volume. + # + # @param options [Hash{Symbol=>String}] key/value map of driver specific options. + end + end + end + + class PortBinding < Docker::Internal::Type::BaseModel + # @!attribute host_ip + # Host IP address that the container's port is mapped to. + # + # @return [String, nil] + optional :host_ip, String, api_name: :HostIp + + # @!attribute host_port + # Host port number that the container's port is mapped to. + # + # @return [String, nil] + optional :host_port, String, api_name: :HostPort + + # @!method initialize(host_ip: nil, host_port: nil) + # PortBinding represents a binding between a host IP address and a host port. + # + # @param host_ip [String] Host IP address that the container's port is mapped to. + # + # @param host_port [String] Host port number that the container's port is mapped to. + end + + # @see Docker::Models::ContainerCreateParams::Config::HostConfig#restart_policy + class RestartPolicy < Docker::Internal::Type::BaseModel + # @!attribute maximum_retry_count + # If `on-failure` is used, the number of times to retry before giving up. + # + # @return [Integer, nil] + optional :maximum_retry_count, Integer, api_name: :MaximumRetryCount + + # @!attribute name + # - Empty string means not to restart + # - `no` Do not automatically restart + # - `always` Always restart + # - `unless-stopped` Restart always except when the user has manually stopped the + # container + # - `on-failure` Restart only when the container exit code is non-zero + # + # @return [Symbol, Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name, nil] + optional :name, + enum: -> { Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name }, + api_name: :Name + + # @!method initialize(maximum_retry_count: nil, name: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy} for + # more details. + # + # The behavior to apply when the container exits. The default is not to restart. + # + # An ever increasing delay (double the previous delay, starting at 100ms) is added + # before each restart to prevent flooding the server. + # + # @param maximum_retry_count [Integer] If `on-failure` is used, the number of times to retry before giving up. + # + # @param name [Symbol, Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name] - Empty string means not to restart + + # - Empty string means not to restart + # - `no` Do not automatically restart + # - `always` Always restart + # - `unless-stopped` Restart always except when the user has manually stopped the + # container + # - `on-failure` Restart only when the container exit code is non-zero + # + # @see Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy#name + module Name + extend Docker::Internal::Type::Enum + + EMPTY = :"" + NO = :no + ALWAYS = :always + UNLESS_STOPPED = :"unless-stopped" + ON_FAILURE = :"on-failure" + + # @!method self.values + # @return [Array] + end + end + + class Ulimit < Docker::Internal::Type::BaseModel + # @!attribute hard + # Hard limit + # + # @return [Integer, nil] + optional :hard, Integer, api_name: :Hard + + # @!attribute name + # Name of ulimit + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute soft + # Soft limit + # + # @return [Integer, nil] + optional :soft, Integer, api_name: :Soft + + # @!method initialize(hard: nil, name: nil, soft: nil) + # @param hard [Integer] Hard limit + # + # @param name [String] Name of ulimit + # + # @param soft [Integer] Soft limit + end + end + + class NetworkingConfig < Docker::Internal::Type::BaseModel + # @!attribute endpoints_config + # A mapping of network name to endpoint configuration for that network. The + # endpoint configuration can be left empty to connect to that network with no + # particular endpoint configuration. + # + # @return [Hash{Symbol=>Docker::Models::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig}, nil] + optional :endpoints_config, + -> { + Docker::Internal::Type::HashOf[Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig] + }, + api_name: :EndpointsConfig + + # @!method initialize(endpoints_config: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerCreateParams::Config::NetworkingConfig} for more + # details. + # + # NetworkingConfig represents the container's networking configuration for each of + # its interfaces. It is used for the networking configs specified in the + # `docker create` and `docker network connect` commands. + # + # @param endpoints_config [Hash{Symbol=>Docker::Models::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig}] A mapping of network name to endpoint configuration for that network. + + class EndpointsConfig < Docker::Internal::Type::BaseModel + # @!attribute aliases + # + # @return [Array, nil] + optional :aliases, Docker::Internal::Type::ArrayOf[String], api_name: :Aliases + + # @!attribute dns_names + # List of all DNS names an endpoint has on a specific network. This list is based + # on the container name, network aliases, container short ID, and hostname. + # + # These DNS names are non-fully qualified but can contain several dots. You can + # get fully qualified DNS names by appending `.`. For instance, if + # container name is `my.ctr` and the network is named `testnet`, `DNSNames` will + # contain `my.ctr` and the FQDN will be `my.ctr.testnet`. + # + # @return [Array, nil] + optional :dns_names, Docker::Internal::Type::ArrayOf[String], api_name: :DNSNames + + # @!attribute driver_opts + # DriverOpts is a mapping of driver options and values. These options are passed + # directly to the driver and are driver specific. + # + # @return [Hash{Symbol=>String}, nil] + optional :driver_opts, Docker::Internal::Type::HashOf[String], api_name: :DriverOpts, nil?: true + + # @!attribute endpoint_id + # Unique ID for the service endpoint in a Sandbox. + # + # @return [String, nil] + optional :endpoint_id, String, api_name: :EndpointID + + # @!attribute gateway + # Gateway address for this network. + # + # @return [String, nil] + optional :gateway, String, api_name: :Gateway + + # @!attribute global_i_pv6_address + # Global IPv6 address. + # + # @return [String, nil] + optional :global_i_pv6_address, String, api_name: :GlobalIPv6Address + + # @!attribute global_i_pv6_prefix_len + # Mask length of the global IPv6 address. + # + # @return [Integer, nil] + optional :global_i_pv6_prefix_len, Integer, api_name: :GlobalIPv6PrefixLen + + # @!attribute gw_priority + # This property determines which endpoint will provide the default gateway for a + # container. The endpoint with the highest priority will be used. If multiple + # endpoints have the same priority, endpoints are lexicographically sorted based + # on their network name, and the one that sorts first is picked. + # + # @return [Integer, nil] + optional :gw_priority, Integer, api_name: :GwPriority + + # @!attribute ip_address + # IPv4 address. + # + # @return [String, nil] + optional :ip_address, String, api_name: :IPAddress + + # @!attribute ipam_config + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + # + # @return [Docker::Models::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::IpamConfig, nil] + optional :ipam_config, + -> { + Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::IpamConfig + }, + api_name: :IPAMConfig, + nil?: true + + # @!attribute ip_prefix_len + # Mask length of the IPv4 address. + # + # @return [Integer, nil] + optional :ip_prefix_len, Integer, api_name: :IPPrefixLen + + # @!attribute i_pv6_gateway + # IPv6 gateway address. + # + # @return [String, nil] + optional :i_pv6_gateway, String, api_name: :IPv6Gateway + + # @!attribute links + # + # @return [Array, nil] + optional :links, Docker::Internal::Type::ArrayOf[String], api_name: :Links + + # @!attribute mac_address + # MAC address for the endpoint on this network. The network driver might ignore + # this parameter. + # + # @return [String, nil] + optional :mac_address, String, api_name: :MacAddress + + # @!attribute network_id + # Unique ID of the network. + # + # @return [String, nil] + optional :network_id, String, api_name: :NetworkID + + # @!method initialize(aliases: nil, dns_names: nil, driver_opts: nil, endpoint_id: nil, gateway: nil, global_i_pv6_address: nil, global_i_pv6_prefix_len: nil, gw_priority: nil, ip_address: nil, ipam_config: nil, ip_prefix_len: nil, i_pv6_gateway: nil, links: nil, mac_address: nil, network_id: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig} + # for more details. + # + # Configuration for a network endpoint. + # + # @param aliases [Array] + # + # @param dns_names [Array] List of all DNS names an endpoint has on a specific network. This + # + # @param driver_opts [Hash{Symbol=>String}, nil] DriverOpts is a mapping of driver options and values. These options + # + # @param endpoint_id [String] Unique ID for the service endpoint in a Sandbox. + # + # @param gateway [String] Gateway address for this network. + # + # @param global_i_pv6_address [String] Global IPv6 address. + # + # @param global_i_pv6_prefix_len [Integer] Mask length of the global IPv6 address. + # + # @param gw_priority [Integer] This property determines which endpoint will provide the default + # + # @param ip_address [String] IPv4 address. + # + # @param ipam_config [Docker::Models::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::IpamConfig, nil] EndpointIPAMConfig represents an endpoint's IPAM configuration. + # + # @param ip_prefix_len [Integer] Mask length of the IPv4 address. + # + # @param i_pv6_gateway [String] IPv6 gateway address. + # + # @param links [Array] + # + # @param mac_address [String] MAC address for the endpoint on this network. The network driver might ignore th + # + # @param network_id [String] Unique ID of the network. + + # @see Docker::Models::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig#ipam_config + class IpamConfig < Docker::Internal::Type::BaseModel + # @!attribute i_pv4_address + # + # @return [String, nil] + optional :i_pv4_address, String, api_name: :IPv4Address + + # @!attribute i_pv6_address + # + # @return [String, nil] + optional :i_pv6_address, String, api_name: :IPv6Address + + # @!attribute link_local_ips + # + # @return [Array, nil] + optional :link_local_ips, Docker::Internal::Type::ArrayOf[String], api_name: :LinkLocalIPs + + # @!method initialize(i_pv4_address: nil, i_pv6_address: nil, link_local_ips: nil) + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + # + # @param i_pv4_address [String] + # @param i_pv6_address [String] + # @param link_local_ips [Array] + end + end + end + end + end + end +end diff --git a/lib/docker/models/container_delete_params.rb b/lib/docker/models/container_delete_params.rb new file mode 100644 index 0000000..0af5d0a --- /dev/null +++ b/lib/docker/models/container_delete_params.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Containers#delete + class ContainerDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute force + # If the container is running, kill it before removing it. + # + # @return [Boolean, nil] + optional :force, Docker::Internal::Type::Boolean + + # @!attribute link + # Remove the specified link associated with the container. + # + # @return [Boolean, nil] + optional :link, Docker::Internal::Type::Boolean + + # @!attribute v + # Remove anonymous volumes associated with the container. + # + # @return [Boolean, nil] + optional :v, Docker::Internal::Type::Boolean + + # @!method initialize(force: nil, link: nil, v: nil, request_options: {}) + # @param force [Boolean] If the container is running, kill it before removing it. + # + # @param link [Boolean] Remove the specified link associated with the container. + # + # @param v [Boolean] Remove anonymous volumes associated with the container. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/container_inspect_params.rb b/lib/docker/models/container_inspect_params.rb new file mode 100644 index 0000000..f06e6ef --- /dev/null +++ b/lib/docker/models/container_inspect_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Containers#inspect_ + class ContainerInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute size + # Return the size of container as fields `SizeRw` and `SizeRootFs` + # + # @return [Boolean, nil] + optional :size, Docker::Internal::Type::Boolean + + # @!method initialize(size: nil, request_options: {}) + # @param size [Boolean] Return the size of container as fields `SizeRw` and `SizeRootFs` + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/container_kill_params.rb b/lib/docker/models/container_kill_params.rb new file mode 100644 index 0000000..a535ec8 --- /dev/null +++ b/lib/docker/models/container_kill_params.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Containers#kill + class ContainerKillParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute signal + # Signal to send to the container as an integer or string (e.g. `SIGINT`). + # + # @return [String, nil] + optional :signal, String + + # @!method initialize(signal: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerKillParams} for more details. + # + # @param signal [String] Signal to send to the container as an integer or string (e.g. `SIGINT`). + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/container_list_params.rb b/lib/docker/models/container_list_params.rb new file mode 100644 index 0000000..77ff5ca --- /dev/null +++ b/lib/docker/models/container_list_params.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Containers#list + class ContainerListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute all + # Return all containers. By default, only running containers are shown. + # + # @return [Boolean, nil] + optional :all, Docker::Internal::Type::Boolean + + # @!attribute filters + # Filters to process on the container list, encoded as JSON (a + # `map[string][]string`). For example, `{"status": ["paused"]}` will only return + # paused containers. + # + # Available filters: + # + # - `ancestor`=(`[:]`, ``, or ``) + # - `before`=(`` or ``) + # - `expose`=(`[/]`|`/[]`) + # - `exited=` containers with exit code of `` + # - `health`=(`starting`|`healthy`|`unhealthy`|`none`) + # - `id=` a container's ID + # - `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only) + # - `is-task=`(`true`|`false`) + # - `label=key` or `label="key=value"` of a container label + # - `name=` a container's name + # - `network`=(`` or ``) + # - `publish`=(`[/]`|`/[]`) + # - `since`=(`` or ``) + # - `status=`(`created`|`restarting`|`running`|`removing`|`paused`|`exited`|`dead`) + # - `volume`=(`` or ``) + # + # @return [String, nil] + optional :filters, String + + # @!attribute limit + # Return this number of most recently created containers, including non-running + # ones. + # + # @return [Integer, nil] + optional :limit, Integer + + # @!attribute size + # Return the size of container as fields `SizeRw` and `SizeRootFs`. + # + # @return [Boolean, nil] + optional :size, Docker::Internal::Type::Boolean + + # @!method initialize(all: nil, filters: nil, limit: nil, size: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerListParams} for more details. + # + # @param all [Boolean] Return all containers. By default, only running containers are shown. + # + # @param filters [String] Filters to process on the container list, encoded as JSON (a + # + # @param limit [Integer] Return this number of most recently created containers, including + # + # @param size [Boolean] Return the size of container as fields `SizeRw` and `SizeRootFs`. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/container_list_response.rb b/lib/docker/models/container_list_response.rb new file mode 100644 index 0000000..f76bca0 --- /dev/null +++ b/lib/docker/models/container_list_response.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Docker + module Models + # @type [Docker::Internal::Type::Converter] + ContainerListResponse = Docker::Internal::Type::ArrayOf[-> { Docker::Summary }] + end +end diff --git a/lib/docker/models/container_logs_params.rb b/lib/docker/models/container_logs_params.rb new file mode 100644 index 0000000..b93fa26 --- /dev/null +++ b/lib/docker/models/container_logs_params.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Containers#logs + class ContainerLogsParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute follow + # Keep connection after returning logs. + # + # @return [Boolean, nil] + optional :follow, Docker::Internal::Type::Boolean + + # @!attribute since + # Only return logs since this time, as a UNIX timestamp + # + # @return [Integer, nil] + optional :since, Integer + + # @!attribute stderr + # Return logs from `stderr` + # + # @return [Boolean, nil] + optional :stderr, Docker::Internal::Type::Boolean + + # @!attribute stdout + # Return logs from `stdout` + # + # @return [Boolean, nil] + optional :stdout, Docker::Internal::Type::Boolean + + # @!attribute tail + # Only return this number of log lines from the end of the logs. Specify as an + # integer or `all` to output all log lines. + # + # @return [String, nil] + optional :tail, String + + # @!attribute timestamps + # Add timestamps to every log line + # + # @return [Boolean, nil] + optional :timestamps, Docker::Internal::Type::Boolean + + # @!attribute until_ + # Only return logs before this time, as a UNIX timestamp + # + # @return [Integer, nil] + optional :until_, Integer + + # @!method initialize(follow: nil, since: nil, stderr: nil, stdout: nil, tail: nil, timestamps: nil, until_: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerLogsParams} for more details. + # + # @param follow [Boolean] Keep connection after returning logs. + # + # @param since [Integer] Only return logs since this time, as a UNIX timestamp + # + # @param stderr [Boolean] Return logs from `stderr` + # + # @param stdout [Boolean] Return logs from `stdout` + # + # @param tail [String] Only return this number of log lines from the end of the logs. + # + # @param timestamps [Boolean] Add timestamps to every log line + # + # @param until_ [Integer] Only return logs before this time, as a UNIX timestamp + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/container_start_params.rb b/lib/docker/models/container_start_params.rb new file mode 100644 index 0000000..708bf75 --- /dev/null +++ b/lib/docker/models/container_start_params.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Containers#start + class ContainerStartParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute detach_keys + # Override the key sequence for detaching a container. Format is a single + # character `[a-Z]` or `ctrl-` where `` is one of: `a-z`, `@`, `^`, + # `[`, `,` or `_`. + # + # @return [String, nil] + optional :detach_keys, String + + # @!method initialize(detach_keys: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerStartParams} for more details. + # + # @param detach_keys [String] Override the key sequence for detaching a container. Format is a + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/container_stop_params.rb b/lib/docker/models/container_stop_params.rb new file mode 100644 index 0000000..d5417dd --- /dev/null +++ b/lib/docker/models/container_stop_params.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Containers#stop + class ContainerStopParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute signal + # Signal to send to the container as an integer or string (e.g. `SIGINT`). + # + # @return [String, nil] + optional :signal, String + + # @!attribute t + # Number of seconds to wait before killing the container + # + # @return [Integer, nil] + optional :t, Integer + + # @!method initialize(signal: nil, t: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerStopParams} for more details. + # + # @param signal [String] Signal to send to the container as an integer or string (e.g. `SIGINT`). + # + # @param t [Integer] Number of seconds to wait before killing the container + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/create_request.rb b/lib/docker/models/create_request.rb new file mode 100644 index 0000000..85a6cfc --- /dev/null +++ b/lib/docker/models/create_request.rb @@ -0,0 +1,347 @@ +# frozen_string_literal: true + +module Docker + module Models + class CreateRequest < Docker::Internal::Type::BaseModel + # @!attribute cluster_volume_spec + # Cluster-specific options used to create the volume. + # + # @return [Docker::Models::CreateRequest::ClusterVolumeSpec, nil] + optional :cluster_volume_spec, + -> { Docker::CreateRequest::ClusterVolumeSpec }, + api_name: :ClusterVolumeSpec + + # @!attribute driver + # Name of the volume driver to use. + # + # @return [String, nil] + optional :driver, String, api_name: :Driver + + # @!attribute driver_opts + # A mapping of driver options and values. These options are passed directly to the + # driver and are driver specific. + # + # @return [Hash{Symbol=>String}, nil] + optional :driver_opts, Docker::Internal::Type::HashOf[String], api_name: :DriverOpts + + # @!attribute labels + # User-defined key/value metadata. + # + # @return [Hash{Symbol=>String}, nil] + optional :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute name + # The new volume's name. If not specified, Docker generates a name. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!method initialize(cluster_volume_spec: nil, driver: nil, driver_opts: nil, labels: nil, name: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::CreateRequest} for more details. + # + # Volume configuration + # + # @param cluster_volume_spec [Docker::Models::CreateRequest::ClusterVolumeSpec] Cluster-specific options used to create the volume. + # + # @param driver [String] Name of the volume driver to use. + # + # @param driver_opts [Hash{Symbol=>String}] A mapping of driver options and values. These options are + # + # @param labels [Hash{Symbol=>String}] User-defined key/value metadata. + # + # @param name [String] The new volume's name. If not specified, Docker generates a name. + + # @see Docker::Models::CreateRequest#cluster_volume_spec + class ClusterVolumeSpec < Docker::Internal::Type::BaseModel + # @!attribute access_mode + # Defines how the volume is used by tasks. + # + # @return [Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode, nil] + optional :access_mode, + -> { + Docker::CreateRequest::ClusterVolumeSpec::AccessMode + }, + api_name: :AccessMode + + # @!attribute group + # Group defines the volume group of this volume. Volumes belonging to the same + # group can be referred to by group name when creating Services. Referring to a + # volume by group instructs Swarm to treat volumes in that group interchangeably + # for the purpose of scheduling. Volumes with an empty string for a group + # technically all belong to the same, emptystring group. + # + # @return [String, nil] + optional :group, String, api_name: :Group + + # @!method initialize(access_mode: nil, group: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::CreateRequest::ClusterVolumeSpec} for more details. + # + # Cluster-specific options used to create the volume. + # + # @param access_mode [Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode] Defines how the volume is used by tasks. + # + # @param group [String] Group defines the volume group of this volume. Volumes belonging to + + # @see Docker::Models::CreateRequest::ClusterVolumeSpec#access_mode + class AccessMode < Docker::Internal::Type::BaseModel + # @!attribute accessibility_requirements + # Requirements for the accessible topology of the volume. These fields are + # optional. For an in-depth description of what these fields mean, see the CSI + # specification. + # + # @return [Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements, nil] + optional :accessibility_requirements, + -> { Docker::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements }, + api_name: :AccessibilityRequirements + + # @!attribute availability + # The availability of the volume for use in tasks. + # + # - `active` The volume is fully available for scheduling on the cluster + # - `pause` No new workloads should use the volume, but existing workloads are not + # stopped. + # - `drain` All workloads using this volume should be stopped and rescheduled, and + # no new ones should be started. + # + # @return [Symbol, Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::Availability, nil] + optional :availability, + enum: -> { Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Availability }, + api_name: :Availability + + # @!attribute capacity_range + # The desired capacity that the volume should be created with. If empty, the + # plugin will decide the capacity. + # + # @return [Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange, nil] + optional :capacity_range, + -> { Docker::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange }, + api_name: :CapacityRange + + # @!attribute mount_volume + # Options for using this volume as a Mount-type volume. + # + # Either MountVolume or BlockVolume, but not both, must be + # present. + # + # properties: FsType: type: "string" description: | Specifies the filesystem type + # for the mount volume. Optional. MountFlags: type: "array" description: | Flags + # to pass when mounting the volume. Optional. items: type: "string" BlockVolume: + # type: "object" description: | Options for using this volume as a Block-type + # volume. Intentionally empty. + # + # @return [Object, nil] + optional :mount_volume, Docker::Internal::Type::Unknown, api_name: :MountVolume + + # @!attribute scope + # The set of nodes this volume can be used on at one time. + # + # - `single` The volume may only be scheduled to one node at a time. + # - `multi` the volume may be scheduled to any supported number of nodes at a + # time. + # + # @return [Symbol, Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::Scope, nil] + optional :scope, + enum: -> { Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Scope }, + api_name: :Scope + + # @!attribute secrets + # Swarm Secrets that are passed to the CSI storage plugin when operating on this + # volume. + # + # @return [Array, nil] + optional :secrets, + -> { + Docker::Internal::Type::ArrayOf[Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Secret] + }, + api_name: :Secrets + + # @!attribute sharing + # The number and way that different tasks can use this volume at one time. + # + # - `none` The volume may only be used by one task at a time. + # - `readonly` The volume may be used by any number of tasks, but they all must + # mount the volume as readonly + # - `onewriter` The volume may be used by any number of tasks, but only one may + # mount it as read/write. + # - `all` The volume may have any number of readers and writers. + # + # @return [Symbol, Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing, nil] + optional :sharing, + enum: -> { Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing }, + api_name: :Sharing + + # @!method initialize(accessibility_requirements: nil, availability: nil, capacity_range: nil, mount_volume: nil, scope: nil, secrets: nil, sharing: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode} for more details. + # + # Defines how the volume is used by tasks. + # + # @param accessibility_requirements [Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements] Requirements for the accessible topology of the volume. These + # + # @param availability [Symbol, Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::Availability] The availability of the volume for use in tasks. + # + # @param capacity_range [Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange] The desired capacity that the volume should be created with. If + # + # @param mount_volume [Object] Options for using this volume as a Mount-type volume. + # + # @param scope [Symbol, Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::Scope] The set of nodes this volume can be used on at one time. + # + # @param secrets [Array] Swarm Secrets that are passed to the CSI storage plugin when + # + # @param sharing [Symbol, Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing] The number and way that different tasks can use this volume + + # @see Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode#accessibility_requirements + class AccessibilityRequirements < Docker::Internal::Type::BaseModel + # @!attribute preferred + # A list of topologies that the volume should attempt to be provisioned in. + # + # @return [ArrayString}>, nil] + optional :preferred, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::HashOf[String]], + api_name: :Preferred + + # @!attribute requisite + # A list of required topologies, at least one of which the volume must be + # accessible from. + # + # @return [ArrayString}>, nil] + optional :requisite, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::HashOf[String]], + api_name: :Requisite + + # @!method initialize(preferred: nil, requisite: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements} + # for more details. + # + # Requirements for the accessible topology of the volume. These fields are + # optional. For an in-depth description of what these fields mean, see the CSI + # specification. + # + # @param preferred [ArrayString}>] A list of topologies that the volume should attempt to be + # + # @param requisite [ArrayString}>] A list of required topologies, at least one of which the + end + + # The availability of the volume for use in tasks. + # + # - `active` The volume is fully available for scheduling on the cluster + # - `pause` No new workloads should use the volume, but existing workloads are not + # stopped. + # - `drain` All workloads using this volume should be stopped and rescheduled, and + # no new ones should be started. + # + # @see Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode#availability + module Availability + extend Docker::Internal::Type::Enum + + ACTIVE = :active + PAUSE = :pause + DRAIN = :drain + + # @!method self.values + # @return [Array] + end + + # @see Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode#capacity_range + class CapacityRange < Docker::Internal::Type::BaseModel + # @!attribute limit_bytes + # The volume must not be bigger than this. The value of 0 indicates an unspecified + # maximum. + # + # @return [Integer, nil] + optional :limit_bytes, Integer, api_name: :LimitBytes + + # @!attribute required_bytes + # The volume must be at least this big. The value of 0 indicates an unspecified + # minimum + # + # @return [Integer, nil] + optional :required_bytes, Integer, api_name: :RequiredBytes + + # @!method initialize(limit_bytes: nil, required_bytes: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange} + # for more details. + # + # The desired capacity that the volume should be created with. If empty, the + # plugin will decide the capacity. + # + # @param limit_bytes [Integer] The volume must not be bigger than this. The value of 0 + # + # @param required_bytes [Integer] The volume must be at least this big. The value of 0 + end + + # The set of nodes this volume can be used on at one time. + # + # - `single` The volume may only be scheduled to one node at a time. + # - `multi` the volume may be scheduled to any supported number of nodes at a + # time. + # + # @see Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode#scope + module Scope + extend Docker::Internal::Type::Enum + + SINGLE = :single + MULTI = :multi + + # @!method self.values + # @return [Array] + end + + class Secret < Docker::Internal::Type::BaseModel + # @!attribute key + # Key is the name of the key of the key-value pair passed to the plugin. + # + # @return [String, nil] + optional :key, String, api_name: :Key + + # @!attribute secret + # Secret is the swarm Secret object from which to read data. This can be a Secret + # name or ID. The Secret data is retrieved by swarm and used as the value of the + # key-value pair passed to the plugin. + # + # @return [String, nil] + optional :secret, String, api_name: :Secret + + # @!method initialize(key: nil, secret: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::Secret} for more + # details. + # + # One cluster volume secret entry. Defines a key-value pair that is passed to the + # plugin. + # + # @param key [String] Key is the name of the key of the key-value pair passed to + # + # @param secret [String] Secret is the swarm Secret object from which to read data. + end + + # The number and way that different tasks can use this volume at one time. + # + # - `none` The volume may only be used by one task at a time. + # - `readonly` The volume may be used by any number of tasks, but they all must + # mount the volume as readonly + # - `onewriter` The volume may be used by any number of tasks, but only one may + # mount it as read/write. + # - `all` The volume may have any number of readers and writers. + # + # @see Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode#sharing + module Sharing + extend Docker::Internal::Type::Enum + + NONE = :none + READONLY = :readonly + ONEWRITER = :onewriter + ALL = :all + + # @!method self.values + # @return [Array] + end + end + end + end + end +end diff --git a/lib/docker/models/create_response.rb b/lib/docker/models/create_response.rb new file mode 100644 index 0000000..4c6d3a4 --- /dev/null +++ b/lib/docker/models/create_response.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Containers#create + class CreateResponse < Docker::Internal::Type::BaseModel + # @!attribute id + # The ID of the created container + # + # @return [String] + required :id, String, api_name: :Id + + # @!attribute warnings + # Warnings encountered when creating the container + # + # @return [Array] + required :warnings, Docker::Internal::Type::ArrayOf[String], api_name: :Warnings + + # @!method initialize(id:, warnings:) + # OK response to ContainerCreate operation + # + # @param id [String] The ID of the created container + # + # @param warnings [Array] Warnings encountered when creating the container + end + end +end diff --git a/lib/docker/models/error.rb b/lib/docker/models/error.rb new file mode 100644 index 0000000..708bcbe --- /dev/null +++ b/lib/docker/models/error.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Docker + module Models + class Error < Docker::Internal::Type::BaseModel + # @!attribute message + # The error message. + # + # @return [String] + required :message, String + + # @!method initialize(message:) + # Represents an error. + # + # @param message [String] The error message. + end + end +end diff --git a/lib/docker/models/image.rb b/lib/docker/models/image.rb new file mode 100644 index 0000000..0478f7a --- /dev/null +++ b/lib/docker/models/image.rb @@ -0,0 +1,1382 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Images#inspect_ + class Image < Docker::Internal::Type::BaseModel + # @!attribute architecture + # Hardware CPU architecture that the image runs on. + # + # @return [String, nil] + optional :architecture, String, api_name: :Architecture + + # @!attribute author + # Name of the author that was specified when committing the image, or as specified + # through MAINTAINER (deprecated) in the Dockerfile. + # + # @return [String, nil] + optional :author, String, api_name: :Author, nil?: true + + # @!attribute comment + # Optional message that was set when committing or importing the image. + # + # @return [String, nil] + optional :comment, String, api_name: :Comment, nil?: true + + # @!attribute config + # Configuration of the image. These fields are used as defaults when starting a + # container from the image. + # + # @return [Docker::Models::Image::Config, nil] + optional :config, -> { Docker::Image::Config }, api_name: :Config + + # @!attribute created + # Date and time at which the image was created, formatted in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + # + # This information is only available if present in the image, and omitted + # otherwise. + # + # @return [String, nil] + optional :created, String, api_name: :Created, nil?: true + + # @!attribute descriptor + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + # + # @return [Docker::Models::Image::Descriptor, nil] + optional :descriptor, -> { Docker::Image::Descriptor }, api_name: :Descriptor + + # @!attribute graph_driver + # Information about the storage driver used to store the container's and image's + # filesystem. + # + # @return [Docker::Models::Image::GraphDriver, nil] + optional :graph_driver, -> { Docker::Image::GraphDriver }, api_name: :GraphDriver + + # @!attribute id + # ID is the content-addressable ID of an image. + # + # This identifier is a content-addressable digest calculated from the image's + # configuration (which includes the digests of layers used by the image). + # + # Note that this digest differs from the `RepoDigests` below, which holds digests + # of image manifests that reference the image. + # + # @return [String, nil] + optional :id, String, api_name: :Id + + # @!attribute identity + # Identity holds information about the identity and origin of the image. This is + # trusted information verified by the daemon and cannot be modified by tagging an + # image to a different name. + # + # @return [Docker::Models::Image::Identity, nil] + optional :identity, -> { Docker::Image::Identity }, api_name: :Identity + + # @!attribute manifests + # Manifests is a list of image manifests available in this image. It provides a + # more detailed view of the platform-specific image manifests or other + # image-attached data like build attestations. + # + # Only available if the daemon provides a multi-platform image store and the + # `manifests` option is set in the inspect request. + # + # WARNING: This is experimental and may change at any time without any backward + # compatibility. + # + # @return [Array, nil] + optional :manifests, + -> { Docker::Internal::Type::ArrayOf[Docker::Image::Manifest] }, + api_name: :Manifests, + nil?: true + + # @!attribute metadata + # Additional metadata of the image in the local cache. This information is local + # to the daemon, and not part of the image itself. + # + # @return [Docker::Models::Image::Metadata, nil] + optional :metadata, -> { Docker::Image::Metadata }, api_name: :Metadata + + # @!attribute os + # Operating System the image is built to run on. + # + # @return [String, nil] + optional :os, String, api_name: :Os + + # @!attribute os_version + # Operating System version the image is built to run on (especially for Windows). + # + # @return [String, nil] + optional :os_version, String, api_name: :OsVersion, nil?: true + + # @!attribute repo_digests + # List of content-addressable digests of locally available image manifests that + # the image is referenced from. Multiple manifests can refer to the same image. + # + # These digests are usually only available if the image was either pulled from a + # registry, or if the image was pushed to a registry, which is when the manifest + # is generated and its digest calculated. + # + # @return [Array, nil] + optional :repo_digests, Docker::Internal::Type::ArrayOf[String], api_name: :RepoDigests + + # @!attribute repo_tags + # List of image names/tags in the local image cache that reference this image. + # + # Multiple image tags can refer to the same image, and this list may be empty if + # no tags reference the image, in which case the image is "untagged", in which + # case it can still be referenced by its ID. + # + # @return [Array, nil] + optional :repo_tags, Docker::Internal::Type::ArrayOf[String], api_name: :RepoTags + + # @!attribute root_fs + # Information about the image's RootFS, including the layer IDs. + # + # @return [Docker::Models::Image::RootFs, nil] + optional :root_fs, -> { Docker::Image::RootFs }, api_name: :RootFS + + # @!attribute size + # Total size of the image including all layers it is composed of. + # + # @return [Integer, nil] + optional :size, Integer, api_name: :Size + + # @!attribute variant + # CPU architecture variant (presently ARM-only). + # + # @return [String, nil] + optional :variant, String, api_name: :Variant, nil?: true + + # @!method initialize(architecture: nil, author: nil, comment: nil, config: nil, created: nil, descriptor: nil, graph_driver: nil, id: nil, identity: nil, manifests: nil, metadata: nil, os: nil, os_version: nil, repo_digests: nil, repo_tags: nil, root_fs: nil, size: nil, variant: nil) + # Some parameter documentations has been truncated, see {Docker::Models::Image} + # for more details. + # + # Information about an image in the local image cache. + # + # @param architecture [String] Hardware CPU architecture that the image runs on. + # + # @param author [String, nil] Name of the author that was specified when committing the image, or as + # + # @param comment [String, nil] Optional message that was set when committing or importing the image. + # + # @param config [Docker::Models::Image::Config] Configuration of the image. These fields are used as defaults + # + # @param created [String, nil] Date and time at which the image was created, formatted in + # + # @param descriptor [Docker::Models::Image::Descriptor] A descriptor struct containing digest, media type, and size, as defined in + # + # @param graph_driver [Docker::Models::Image::GraphDriver] Information about the storage driver used to store the container's and + # + # @param id [String] ID is the content-addressable ID of an image. + # + # @param identity [Docker::Models::Image::Identity] Identity holds information about the identity and origin of the image. + # + # @param manifests [Array, nil] Manifests is a list of image manifests available in this image. It + # + # @param metadata [Docker::Models::Image::Metadata] Additional metadata of the image in the local cache. This information + # + # @param os [String] Operating System the image is built to run on. + # + # @param os_version [String, nil] Operating System version the image is built to run on (especially + # + # @param repo_digests [Array] List of content-addressable digests of locally available image manifests + # + # @param repo_tags [Array] List of image names/tags in the local image cache that reference this + # + # @param root_fs [Docker::Models::Image::RootFs] Information about the image's RootFS, including the layer IDs. + # + # @param size [Integer] Total size of the image including all layers it is composed of. + # + # @param variant [String, nil] CPU architecture variant (presently ARM-only). + + # @see Docker::Models::Image#config + class Config < Docker::Internal::Type::BaseModel + # @!attribute args_escaped + # Command is already escaped (Windows only) + # + # @return [Boolean, nil] + optional :args_escaped, Docker::Internal::Type::Boolean, api_name: :ArgsEscaped, nil?: true + + # @!attribute cmd + # Command to run specified as a string or an array of strings. + # + # @return [Array, nil] + optional :cmd, Docker::Internal::Type::ArrayOf[String], api_name: :Cmd + + # @!attribute entrypoint + # The entry point for the container as a string or an array of strings. + # + # If the array consists of exactly one empty string (`[""]`) then the entry point + # is reset to system default (i.e., the entry point used by docker when there is + # no `ENTRYPOINT` instruction in the `Dockerfile`). + # + # @return [Array, nil] + optional :entrypoint, Docker::Internal::Type::ArrayOf[String], api_name: :Entrypoint + + # @!attribute env + # A list of environment variables to set inside the container in the form + # `["VAR=value", ...]`. A variable without `=` is removed from the environment, + # rather than to have an empty value. + # + # @return [Array, nil] + optional :env, Docker::Internal::Type::ArrayOf[String], api_name: :Env + + # @!attribute exposed_ports + # An object mapping ports to an empty object in the form: + # + # `{"/": {}}` + # + # @return [Hash{Symbol=>Object}, nil] + optional :exposed_ports, + Docker::Internal::Type::HashOf[Docker::Internal::Type::Unknown], + api_name: :ExposedPorts, + nil?: true + + # @!attribute healthcheck + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + # + # @return [Docker::Models::Image::Config::Healthcheck, nil] + optional :healthcheck, -> { Docker::Image::Config::Healthcheck }, api_name: :Healthcheck + + # @!attribute labels + # User-defined key/value metadata. + # + # @return [Hash{Symbol=>String}, nil] + optional :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute on_build + # `ONBUILD` metadata that were defined in the image's `Dockerfile`. + # + # @return [Array, nil] + optional :on_build, Docker::Internal::Type::ArrayOf[String], api_name: :OnBuild, nil?: true + + # @!attribute shell + # Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + # + # @return [Array, nil] + optional :shell, Docker::Internal::Type::ArrayOf[String], api_name: :Shell, nil?: true + + # @!attribute stop_signal + # Signal to stop a container as a string or unsigned integer. + # + # @return [String, nil] + optional :stop_signal, String, api_name: :StopSignal, nil?: true + + # @!attribute user + # The user that commands are run as inside the container. + # + # @return [String, nil] + optional :user, String, api_name: :User + + # @!attribute volumes + # An object mapping mount point paths inside the container to empty objects. + # + # @return [Hash{Symbol=>Object}, nil] + optional :volumes, Docker::Internal::Type::HashOf[Docker::Internal::Type::Unknown], api_name: :Volumes + + # @!attribute working_dir + # The working directory for commands to run in. + # + # @return [String, nil] + optional :working_dir, String, api_name: :WorkingDir + + # @!method initialize(args_escaped: nil, cmd: nil, entrypoint: nil, env: nil, exposed_ports: nil, healthcheck: nil, labels: nil, on_build: nil, shell: nil, stop_signal: nil, user: nil, volumes: nil, working_dir: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Config} for more details. + # + # Configuration of the image. These fields are used as defaults when starting a + # container from the image. + # + # @param args_escaped [Boolean, nil] Command is already escaped (Windows only) + # + # @param cmd [Array] Command to run specified as a string or an array of strings. + # + # @param entrypoint [Array] The entry point for the container as a string or an array of strings. + # + # @param env [Array] A list of environment variables to set inside the container in the + # + # @param exposed_ports [Hash{Symbol=>Object}, nil] An object mapping ports to an empty object in the form: + # + # @param healthcheck [Docker::Models::Image::Config::Healthcheck] A test to perform to check that the container is healthy. + # + # @param labels [Hash{Symbol=>String}] User-defined key/value metadata. + # + # @param on_build [Array, nil] `ONBUILD` metadata that were defined in the image's `Dockerfile`. + # + # @param shell [Array, nil] Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + # + # @param stop_signal [String, nil] Signal to stop a container as a string or unsigned integer. + # + # @param user [String] The user that commands are run as inside the container. + # + # @param volumes [Hash{Symbol=>Object}] An object mapping mount point paths inside the container to empty + # + # @param working_dir [String] The working directory for commands to run in. + + # @see Docker::Models::Image::Config#healthcheck + class Healthcheck < Docker::Internal::Type::BaseModel + # @!attribute interval + # The time to wait between checks in nanoseconds. It should be 0 or at least + # 1000000 (1 ms). 0 means inherit. + # + # @return [Integer, nil] + optional :interval, Integer, api_name: :Interval + + # @!attribute retries + # The number of consecutive failures needed to consider a container as unhealthy. + # 0 means inherit. + # + # @return [Integer, nil] + optional :retries, Integer, api_name: :Retries + + # @!attribute start_interval + # The time to wait between checks in nanoseconds during the start period. It + # should be 0 or at least 1000000 (1 ms). 0 means inherit. + # + # @return [Integer, nil] + optional :start_interval, Integer, api_name: :StartInterval + + # @!attribute start_period + # Start period for the container to initialize before starting health-retries + # countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means + # inherit. + # + # @return [Integer, nil] + optional :start_period, Integer, api_name: :StartPeriod + + # @!attribute test_ + # The test to perform. Possible values are: + # + # - `[]` inherit healthcheck from image or parent image + # - `["NONE"]` disable healthcheck + # - `["CMD", args...]` exec arguments directly + # - `["CMD-SHELL", command]` run command with system's default shell + # + # A non-zero exit code indicates a failed healthcheck: + # + # - `0` healthy + # - `1` unhealthy + # - `2` reserved (treated as unhealthy) + # - other values: error running probe + # + # @return [Array, nil] + optional :test_, Docker::Internal::Type::ArrayOf[String], api_name: :Test + + # @!attribute timeout + # The time to wait before considering the check to have hung. It should be 0 or at + # least 1000000 (1 ms). 0 means inherit. + # + # If the health check command does not complete within this timeout, the check is + # considered failed and the health check process is forcibly terminated without a + # graceful shutdown. + # + # @return [Integer, nil] + optional :timeout, Integer, api_name: :Timeout + + # @!method initialize(interval: nil, retries: nil, start_interval: nil, start_period: nil, test_: nil, timeout: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Config::Healthcheck} for more details. + # + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + # + # @param interval [Integer] The time to wait between checks in nanoseconds. It should be 0 or at + # + # @param retries [Integer] The number of consecutive failures needed to consider a container as + # + # @param start_interval [Integer] The time to wait between checks in nanoseconds during the start period. + # + # @param start_period [Integer] Start period for the container to initialize before starting + # + # @param test_ [Array] The test to perform. Possible values are: + # + # @param timeout [Integer] The time to wait before considering the check to have hung. It should + end + end + + # @see Docker::Models::Image#descriptor + class Descriptor < Docker::Internal::Type::BaseModel + # @!attribute annotations + # Arbitrary metadata relating to the targeted content. + # + # @return [Hash{Symbol=>String}, nil] + optional :annotations, Docker::Internal::Type::HashOf[String], nil?: true + + # @!attribute artifact_type + # ArtifactType is the IANA media type of this artifact. + # + # @return [String, nil] + optional :artifact_type, String, api_name: :artifactType, nil?: true + + # @!attribute data + # Data is an embedding of the targeted content. This is encoded as a base64 string + # when marshalled to JSON (automatically, by encoding/json). If present, Data can + # be used directly to avoid fetching the targeted content. + # + # @return [String, nil] + optional :data, String, nil?: true + + # @!attribute digest + # The digest of the targeted content. + # + # @return [String, nil] + optional :digest, String + + # @!attribute media_type + # The media type of the object this schema refers to. + # + # @return [String, nil] + optional :media_type, String, api_name: :mediaType + + # @!attribute platform + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + # + # @return [Docker::Models::Image::Descriptor::Platform, nil] + optional :platform, -> { Docker::Image::Descriptor::Platform }, nil?: true + + # @!attribute size + # The size in bytes of the blob. + # + # @return [Integer, nil] + optional :size, Integer + + # @!attribute urls + # List of URLs from which this object MAY be downloaded. + # + # @return [Array, nil] + optional :urls, Docker::Internal::Type::ArrayOf[String], nil?: true + + # @!method initialize(annotations: nil, artifact_type: nil, data: nil, digest: nil, media_type: nil, platform: nil, size: nil, urls: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Descriptor} for more details. + # + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + # + # @param annotations [Hash{Symbol=>String}, nil] Arbitrary metadata relating to the targeted content. + # + # @param artifact_type [String, nil] ArtifactType is the IANA media type of this artifact. + # + # @param data [String, nil] Data is an embedding of the targeted content. This is encoded as a base64 + # + # @param digest [String] The digest of the targeted content. + # + # @param media_type [String] The media type of the object this schema refers to. + # + # @param platform [Docker::Models::Image::Descriptor::Platform, nil] Describes the platform which the image in the manifest runs on, as defined + # + # @param size [Integer] The size in bytes of the blob. + # + # @param urls [Array, nil] List of URLs from which this object MAY be downloaded. + + # @see Docker::Models::Image::Descriptor#platform + class Platform < Docker::Internal::Type::BaseModel + # @!attribute architecture + # The CPU architecture, for example `amd64` or `ppc64`. + # + # @return [String, nil] + optional :architecture, String + + # @!attribute os + # The operating system, for example `linux` or `windows`. + # + # @return [String, nil] + optional :os, String + + # @!attribute os_features + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + # + # @return [Array, nil] + optional :os_features, Docker::Internal::Type::ArrayOf[String], api_name: :"os.features" + + # @!attribute os_version + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + # + # @return [String, nil] + optional :os_version, String, api_name: :"os.version" + + # @!attribute variant + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + # + # @return [String, nil] + optional :variant, String + + # @!method initialize(architecture: nil, os: nil, os_features: nil, os_version: nil, variant: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Descriptor::Platform} for more details. + # + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + # + # @param architecture [String] The CPU architecture, for example `amd64` or `ppc64`. + # + # @param os [String] The operating system, for example `linux` or `windows`. + # + # @param os_features [Array] Optional field specifying an array of strings, each listing a required + # + # @param os_version [String] Optional field specifying the operating system version, for example on + # + # @param variant [String] Optional field specifying a variant of the CPU, for example `v7` to + end + end + + # @see Docker::Models::Image#graph_driver + class GraphDriver < Docker::Internal::Type::BaseModel + # @!attribute data + # Low-level storage metadata, provided as key/value pairs. + # + # This information is driver-specific, and depends on the storage-driver in use, + # and should be used for informational purposes only. + # + # @return [Hash{Symbol=>String}] + required :data, Docker::Internal::Type::HashOf[String], api_name: :Data + + # @!attribute name + # Name of the storage driver. + # + # @return [String] + required :name, String, api_name: :Name + + # @!method initialize(data:, name:) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::GraphDriver} for more details. + # + # Information about the storage driver used to store the container's and image's + # filesystem. + # + # @param data [Hash{Symbol=>String}] Low-level storage metadata, provided as key/value pairs. + # + # @param name [String] Name of the storage driver. + end + + # @see Docker::Models::Image#identity + class Identity < Docker::Internal::Type::BaseModel + # @!attribute build + # Build contains build reference information if image was created via build. + # + # @return [Array, nil] + optional :build, + -> { + Docker::Internal::Type::ArrayOf[Docker::Image::Identity::Build] + }, + api_name: :Build + + # @!attribute pull + # Pull contains remote location information if image was created via pull. If + # image was pulled via mirror, this contains the original repository location. + # After successful push this images also contains the pushed repository location. + # + # @return [Array, nil] + optional :pull, -> { Docker::Internal::Type::ArrayOf[Docker::Image::Identity::Pull] }, api_name: :Pull + + # @!attribute signature + # Signature contains the properties of verified signatures for the image. + # + # @return [Array, nil] + optional :signature, + -> { Docker::Internal::Type::ArrayOf[Docker::Image::Identity::Signature] }, + api_name: :Signature + + # @!method initialize(build: nil, pull: nil, signature: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Identity} for more details. + # + # Identity holds information about the identity and origin of the image. This is + # trusted information verified by the daemon and cannot be modified by tagging an + # image to a different name. + # + # @param build [Array] Build contains build reference information if image was created via build. + # + # @param pull [Array] Pull contains remote location information if image was created via pull. + # + # @param signature [Array] Signature contains the properties of verified signatures for the image. + + class Build < Docker::Internal::Type::BaseModel + # @!attribute created_at + # CreatedAt is the time when the build ran. + # + # @return [Time, nil] + optional :created_at, Time, api_name: :CreatedAt + + # @!attribute ref + # Ref is the identifier for the build request. This reference can be used to look + # up the build details in BuildKit history API. + # + # @return [String, nil] + optional :ref, String, api_name: :Ref + + # @!method initialize(created_at: nil, ref: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Identity::Build} for more details. + # + # BuildIdentity contains build reference information if image was created via + # build. + # + # @param created_at [Time] CreatedAt is the time when the build ran. + # + # @param ref [String] Ref is the identifier for the build request. This reference can be used to + end + + class Pull < Docker::Internal::Type::BaseModel + # @!attribute repository + # Repository is the remote repository location the image was pulled from. + # + # @return [String, nil] + optional :repository, String, api_name: :Repository + + # @!method initialize(repository: nil) + # PullIdentity contains remote location information if image was created via pull. + # If image was pulled via mirror, this contains the original repository location. + # + # @param repository [String] Repository is the remote repository location the image was pulled from. + end + + class Signature < Docker::Internal::Type::BaseModel + # @!attribute docker_reference + # DockerReference is the Docker image reference associated with the signature. + # This is an optional field only present in older hashedrecord signatures. + # + # @return [String, nil] + optional :docker_reference, String, api_name: :DockerReference + + # @!attribute error + # Error contains error information if signature verification failed. Other fields + # will be empty in this case. + # + # @return [String, nil] + optional :error, String, api_name: :Error + + # @!attribute known_signer + # KnownSignerIdentity is an identifier for a special signer identity that is known + # to the implementation. + # + # @return [Symbol, Docker::Models::Image::Identity::Signature::KnownSigner, nil] + optional :known_signer, + enum: -> { Docker::Image::Identity::Signature::KnownSigner }, + api_name: :KnownSigner + + # @!attribute name + # Name is a textual description summarizing the type of signature. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute signature_type + # SignatureType is the type of signature format. + # + # @return [Symbol, Docker::Models::Image::Identity::Signature::SignatureType, nil] + optional :signature_type, + enum: -> { Docker::Image::Identity::Signature::SignatureType }, + api_name: :SignatureType + + # @!attribute signer + # SignerIdentity contains information about the signer certificate used to sign + # the image. + # + # @return [Docker::Models::Image::Identity::Signature::Signer, nil] + optional :signer, -> { Docker::Image::Identity::Signature::Signer }, api_name: :Signer + + # @!attribute timestamps + # Timestamps contains a list of verified signed timestamps for the signature. + # + # @return [Array, nil] + optional :timestamps, + -> { Docker::Internal::Type::ArrayOf[Docker::Image::Identity::Signature::Timestamp] }, + api_name: :Timestamps + + # @!attribute warnings + # Warnings contains any warnings that occurred during signature verification. For + # example, if there was no internet connectivity and cached trust roots were used. + # Warning does not indicate a failed verification but may point to configuration + # issues. + # + # @return [Array, nil] + optional :warnings, Docker::Internal::Type::ArrayOf[String], api_name: :Warnings + + # @!method initialize(docker_reference: nil, error: nil, known_signer: nil, name: nil, signature_type: nil, signer: nil, timestamps: nil, warnings: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Identity::Signature} for more details. + # + # SignatureIdentity contains the properties of verified signatures for the image. + # + # @param docker_reference [String] DockerReference is the Docker image reference associated with the signature. + # + # @param error [String] Error contains error information if signature verification failed. + # + # @param known_signer [Symbol, Docker::Models::Image::Identity::Signature::KnownSigner] KnownSignerIdentity is an identifier for a special signer identity that is known + # + # @param name [String] Name is a textual description summarizing the type of signature. + # + # @param signature_type [Symbol, Docker::Models::Image::Identity::Signature::SignatureType] SignatureType is the type of signature format. + # + # @param signer [Docker::Models::Image::Identity::Signature::Signer] SignerIdentity contains information about the signer certificate used to sign th + # + # @param timestamps [Array] Timestamps contains a list of verified signed timestamps for the signature. + # + # @param warnings [Array] Warnings contains any warnings that occurred during signature verification. + + # KnownSignerIdentity is an identifier for a special signer identity that is known + # to the implementation. + # + # @see Docker::Models::Image::Identity::Signature#known_signer + module KnownSigner + extend Docker::Internal::Type::Enum + + DHI = :DHI + + # @!method self.values + # @return [Array] + end + + # SignatureType is the type of signature format. + # + # @see Docker::Models::Image::Identity::Signature#signature_type + module SignatureType + extend Docker::Internal::Type::Enum + + BUNDLE_V0_3 = :"bundle-v0.3" + SIMPLESIGNING_V1 = :"simplesigning-v1" + + # @!method self.values + # @return [Array] + end + + # @see Docker::Models::Image::Identity::Signature#signer + class Signer < Docker::Internal::Type::BaseModel + # @!attribute build_config_digest + # Immutable reference to the specific version of the top-level/initiating build + # instructions. + # + # @return [String, nil] + optional :build_config_digest, String, api_name: :BuildConfigDigest + + # @!attribute build_config_uri + # Build Config URL to the top-level/initiating build instructions. + # + # @return [String, nil] + optional :build_config_uri, String, api_name: :BuildConfigURI + + # @!attribute build_signer_digest + # Immutable reference to the specific version of the build instructions that is + # responsible for signing. + # + # @return [String, nil] + optional :build_signer_digest, String, api_name: :BuildSignerDigest + + # @!attribute build_signer_uri + # Reference to specific build instructions that are responsible for signing. + # + # @return [String, nil] + optional :build_signer_uri, String, api_name: :BuildSignerURI + + # @!attribute build_trigger + # Event or action that initiated the build. + # + # @return [String, nil] + optional :build_trigger, String, api_name: :BuildTrigger + + # @!attribute certificate_issuer + # CertificateIssuer is the certificate issuer. + # + # @return [String, nil] + optional :certificate_issuer, String, api_name: :CertificateIssuer + + # @!attribute issuer + # The OIDC issuer. Should match `iss` claim of ID token or, in the case of a + # federated login like Dex it should match the issuer URL of the upstream issuer. + # The issuer is not set the extensions are invalid and will fail to render. + # + # @return [String, nil] + optional :issuer, String, api_name: :Issuer + + # @!attribute run_invocation_uri + # Run Invocation URL to uniquely identify the build execution. + # + # @return [String, nil] + optional :run_invocation_uri, String, api_name: :RunInvocationURI + + # @!attribute runner_environment + # Specifies whether the build took place in platform-hosted cloud infrastructure + # or customer/self-hosted infrastructure. + # + # @return [String, nil] + optional :runner_environment, String, api_name: :RunnerEnvironment + + # @!attribute source_repository_digest + # Immutable reference to a specific version of the source code that the build was + # based upon. + # + # @return [String, nil] + optional :source_repository_digest, String, api_name: :SourceRepositoryDigest + + # @!attribute source_repository_identifier + # Immutable identifier for the source repository the workflow was based upon. + # + # @return [String, nil] + optional :source_repository_identifier, String, api_name: :SourceRepositoryIdentifier + + # @!attribute source_repository_owner_identifier + # Immutable identifier for the owner of the source repository that the workflow + # was based upon. + # + # @return [String, nil] + optional :source_repository_owner_identifier, String, api_name: :SourceRepositoryOwnerIdentifier + + # @!attribute source_repository_owner_uri + # Source repository owner URL of the owner of the source repository that the build + # was based on. + # + # @return [String, nil] + optional :source_repository_owner_uri, String, api_name: :SourceRepositoryOwnerURI + + # @!attribute source_repository_ref + # Source Repository Ref that the build run was based upon. + # + # @return [String, nil] + optional :source_repository_ref, String, api_name: :SourceRepositoryRef + + # @!attribute source_repository_uri + # Source repository URL that the build was based on. + # + # @return [String, nil] + optional :source_repository_uri, String, api_name: :SourceRepositoryURI + + # @!attribute source_repository_visibility_at_signing + # Source repository visibility at the time of signing the certificate. + # + # @return [String, nil] + optional :source_repository_visibility_at_signing, + String, + api_name: :SourceRepositoryVisibilityAtSigning + + # @!attribute subject_alternative_name + # SubjectAlternativeName is the certificate subject alternative name. + # + # @return [String, nil] + optional :subject_alternative_name, String, api_name: :SubjectAlternativeName + + # @!method initialize(build_config_digest: nil, build_config_uri: nil, build_signer_digest: nil, build_signer_uri: nil, build_trigger: nil, certificate_issuer: nil, issuer: nil, run_invocation_uri: nil, runner_environment: nil, source_repository_digest: nil, source_repository_identifier: nil, source_repository_owner_identifier: nil, source_repository_owner_uri: nil, source_repository_ref: nil, source_repository_uri: nil, source_repository_visibility_at_signing: nil, subject_alternative_name: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Identity::Signature::Signer} for more details. + # + # SignerIdentity contains information about the signer certificate used to sign + # the image. + # + # @param build_config_digest [String] Immutable reference to the specific version of the top-level/initiating build in + # + # @param build_config_uri [String] Build Config URL to the top-level/initiating build instructions. + # + # @param build_signer_digest [String] Immutable reference to the specific version of the build instructions that is re + # + # @param build_signer_uri [String] Reference to specific build instructions that are responsible for signing. + # + # @param build_trigger [String] Event or action that initiated the build. + # + # @param certificate_issuer [String] CertificateIssuer is the certificate issuer. + # + # @param issuer [String] The OIDC issuer. Should match `iss` claim of ID token or, in the case of + # + # @param run_invocation_uri [String] Run Invocation URL to uniquely identify the build execution. + # + # @param runner_environment [String] Specifies whether the build took place in platform-hosted cloud infrastructure o + # + # @param source_repository_digest [String] Immutable reference to a specific version of the source code that the build was + # + # @param source_repository_identifier [String] Immutable identifier for the source repository the workflow was based upon. + # + # @param source_repository_owner_identifier [String] Immutable identifier for the owner of the source repository that the workflow wa + # + # @param source_repository_owner_uri [String] Source repository owner URL of the owner of the source repository that the build + # + # @param source_repository_ref [String] Source Repository Ref that the build run was based upon. + # + # @param source_repository_uri [String] Source repository URL that the build was based on. + # + # @param source_repository_visibility_at_signing [String] Source repository visibility at the time of signing the certificate. + # + # @param subject_alternative_name [String] SubjectAlternativeName is the certificate subject alternative name. + end + + class Timestamp < Docker::Internal::Type::BaseModel + # @!attribute timestamp + # + # @return [Time, nil] + optional :timestamp, Time, api_name: :Timestamp + + # @!attribute type + # SignatureTimestampType is the type of timestamp used in the signature. + # + # @return [Symbol, Docker::Models::Image::Identity::Signature::Timestamp::Type, nil] + optional :type, enum: -> { Docker::Image::Identity::Signature::Timestamp::Type }, api_name: :Type + + # @!attribute uri + # + # @return [String, nil] + optional :uri, String, api_name: :URI + + # @!method initialize(timestamp: nil, type: nil, uri: nil) + # SignatureTimestamp contains information about a verified signed timestamp for an + # image signature. + # + # @param timestamp [Time] + # + # @param type [Symbol, Docker::Models::Image::Identity::Signature::Timestamp::Type] SignatureTimestampType is the type of timestamp used in the signature. + # + # @param uri [String] + + # SignatureTimestampType is the type of timestamp used in the signature. + # + # @see Docker::Models::Image::Identity::Signature::Timestamp#type + module Type + extend Docker::Internal::Type::Enum + + TLOG = :Tlog + TIMESTAMP_AUTHORITY = :TimestampAuthority + + # @!method self.values + # @return [Array] + end + end + end + end + + class Manifest < Docker::Internal::Type::BaseModel + # @!attribute available + # Indicates whether all the child content (image config, layers) is fully + # available locally. + # + # @return [Boolean] + required :available, Docker::Internal::Type::Boolean, api_name: :Available + + # @!attribute descriptor + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + # + # @return [Docker::Models::Image::Manifest::Descriptor] + required :descriptor, -> { Docker::Image::Manifest::Descriptor }, api_name: :Descriptor + + # @!attribute id + # ID is the content-addressable ID of an image and is the same as the digest of + # the image manifest. + # + # @return [String] + required :id, String, api_name: :ID + + # @!attribute kind + # The kind of the manifest. + # + # | kind | description | + # | ----------- | ------------------------------------------------------------------------------------ | + # | image | Image manifest that can be used to start a container. | + # | attestation | Attestation manifest produced by the Buildkit builder for a specific image manifest. | + # + # @return [Symbol, Docker::Models::Image::Manifest::Kind] + required :kind, enum: -> { Docker::Image::Manifest::Kind }, api_name: :Kind + + # @!attribute size + # + # @return [Docker::Models::Image::Manifest::Size] + required :size, -> { Docker::Image::Manifest::Size }, api_name: :Size + + # @!attribute attestation_data + # The image data for the attestation manifest. This field is only populated when + # Kind is "attestation". + # + # @return [Docker::Models::Image::Manifest::AttestationData, nil] + optional :attestation_data, + -> { Docker::Image::Manifest::AttestationData }, + api_name: :AttestationData, + nil?: true + + # @!attribute image_data + # The image data for the image manifest. This field is only populated when Kind is + # "image". + # + # @return [Docker::Models::Image::Manifest::ImageData, nil] + optional :image_data, -> { Docker::Image::Manifest::ImageData }, api_name: :ImageData, nil?: true + + # @!method initialize(available:, descriptor:, id:, kind:, size:, attestation_data: nil, image_data: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Manifest} for more details. + # + # ImageManifestSummary represents a summary of an image manifest. + # + # @param available [Boolean] Indicates whether all the child content (image config, layers) is fully availabl + # + # @param descriptor [Docker::Models::Image::Manifest::Descriptor] A descriptor struct containing digest, media type, and size, as defined in + # + # @param id [String] ID is the content-addressable ID of an image and is the same as the + # + # @param kind [Symbol, Docker::Models::Image::Manifest::Kind] The kind of the manifest. + # + # @param size [Docker::Models::Image::Manifest::Size] + # + # @param attestation_data [Docker::Models::Image::Manifest::AttestationData, nil] The image data for the attestation manifest. + # + # @param image_data [Docker::Models::Image::Manifest::ImageData, nil] The image data for the image manifest. + + # @see Docker::Models::Image::Manifest#descriptor + class Descriptor < Docker::Internal::Type::BaseModel + # @!attribute annotations + # Arbitrary metadata relating to the targeted content. + # + # @return [Hash{Symbol=>String}, nil] + optional :annotations, Docker::Internal::Type::HashOf[String], nil?: true + + # @!attribute artifact_type + # ArtifactType is the IANA media type of this artifact. + # + # @return [String, nil] + optional :artifact_type, String, api_name: :artifactType, nil?: true + + # @!attribute data + # Data is an embedding of the targeted content. This is encoded as a base64 string + # when marshalled to JSON (automatically, by encoding/json). If present, Data can + # be used directly to avoid fetching the targeted content. + # + # @return [String, nil] + optional :data, String, nil?: true + + # @!attribute digest + # The digest of the targeted content. + # + # @return [String, nil] + optional :digest, String + + # @!attribute media_type + # The media type of the object this schema refers to. + # + # @return [String, nil] + optional :media_type, String, api_name: :mediaType + + # @!attribute platform + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + # + # @return [Docker::Models::Image::Manifest::Descriptor::Platform, nil] + optional :platform, -> { Docker::Image::Manifest::Descriptor::Platform }, nil?: true + + # @!attribute size + # The size in bytes of the blob. + # + # @return [Integer, nil] + optional :size, Integer + + # @!attribute urls + # List of URLs from which this object MAY be downloaded. + # + # @return [Array, nil] + optional :urls, Docker::Internal::Type::ArrayOf[String], nil?: true + + # @!method initialize(annotations: nil, artifact_type: nil, data: nil, digest: nil, media_type: nil, platform: nil, size: nil, urls: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Manifest::Descriptor} for more details. + # + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + # + # @param annotations [Hash{Symbol=>String}, nil] Arbitrary metadata relating to the targeted content. + # + # @param artifact_type [String, nil] ArtifactType is the IANA media type of this artifact. + # + # @param data [String, nil] Data is an embedding of the targeted content. This is encoded as a base64 + # + # @param digest [String] The digest of the targeted content. + # + # @param media_type [String] The media type of the object this schema refers to. + # + # @param platform [Docker::Models::Image::Manifest::Descriptor::Platform, nil] Describes the platform which the image in the manifest runs on, as defined + # + # @param size [Integer] The size in bytes of the blob. + # + # @param urls [Array, nil] List of URLs from which this object MAY be downloaded. + + # @see Docker::Models::Image::Manifest::Descriptor#platform + class Platform < Docker::Internal::Type::BaseModel + # @!attribute architecture + # The CPU architecture, for example `amd64` or `ppc64`. + # + # @return [String, nil] + optional :architecture, String + + # @!attribute os + # The operating system, for example `linux` or `windows`. + # + # @return [String, nil] + optional :os, String + + # @!attribute os_features + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + # + # @return [Array, nil] + optional :os_features, Docker::Internal::Type::ArrayOf[String], api_name: :"os.features" + + # @!attribute os_version + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + # + # @return [String, nil] + optional :os_version, String, api_name: :"os.version" + + # @!attribute variant + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + # + # @return [String, nil] + optional :variant, String + + # @!method initialize(architecture: nil, os: nil, os_features: nil, os_version: nil, variant: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Manifest::Descriptor::Platform} for more details. + # + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + # + # @param architecture [String] The CPU architecture, for example `amd64` or `ppc64`. + # + # @param os [String] The operating system, for example `linux` or `windows`. + # + # @param os_features [Array] Optional field specifying an array of strings, each listing a required + # + # @param os_version [String] Optional field specifying the operating system version, for example on + # + # @param variant [String] Optional field specifying a variant of the CPU, for example `v7` to + end + end + + # The kind of the manifest. + # + # | kind | description | + # | ----------- | ------------------------------------------------------------------------------------ | + # | image | Image manifest that can be used to start a container. | + # | attestation | Attestation manifest produced by the Buildkit builder for a specific image manifest. | + # + # @see Docker::Models::Image::Manifest#kind + module Kind + extend Docker::Internal::Type::Enum + + IMAGE = :image + ATTESTATION = :attestation + UNKNOWN = :unknown + + # @!method self.values + # @return [Array] + end + + # @see Docker::Models::Image::Manifest#size + class Size < Docker::Internal::Type::BaseModel + # @!attribute content + # Content is the size (in bytes) of all the locally present content in the content + # store (e.g. image config, layers) referenced by this manifest and its children. + # This only includes blobs in the content store. + # + # @return [Integer] + required :content, Integer, api_name: :Content + + # @!attribute total + # Total is the total size (in bytes) of all the locally present data (both + # distributable and non-distributable) that's related to this manifest and its + # children. This equal to the sum of [Content] size AND all the sizes in the + # [Size] struct present in the Kind-specific data struct. For example, for an + # image kind (Kind == "image") this would include the size of the image content + # and unpacked image snapshots ([Size.Content] + [ImageData.Size.Unpacked]). + # + # @return [Integer] + required :total, Integer, api_name: :Total + + # @!method initialize(content:, total:) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Manifest::Size} for more details. + # + # @param content [Integer] Content is the size (in bytes) of all the locally present + # + # @param total [Integer] Total is the total size (in bytes) of all the locally present + end + + # @see Docker::Models::Image::Manifest#attestation_data + class AttestationData < Docker::Internal::Type::BaseModel + # @!attribute for_ + # The digest of the image manifest that this attestation is for. + # + # @return [String] + required :for_, String, api_name: :For + + # @!method initialize(for_:) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Manifest::AttestationData} for more details. + # + # The image data for the attestation manifest. This field is only populated when + # Kind is "attestation". + # + # @param for_ [String] The digest of the image manifest that this attestation is for. + end + + # @see Docker::Models::Image::Manifest#image_data + class ImageData < Docker::Internal::Type::BaseModel + # @!attribute containers + # The IDs of the containers that are using this image. + # + # @return [Array] + required :containers, Docker::Internal::Type::ArrayOf[String], api_name: :Containers + + # @!attribute platform + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + # + # @return [Docker::Models::Image::Manifest::ImageData::Platform, nil] + required :platform, + -> { + Docker::Image::Manifest::ImageData::Platform + }, + api_name: :Platform, + nil?: true + + # @!attribute size + # + # @return [Docker::Models::Image::Manifest::ImageData::Size] + required :size, -> { Docker::Image::Manifest::ImageData::Size }, api_name: :Size + + # @!method initialize(containers:, platform:, size:) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Manifest::ImageData} for more details. + # + # The image data for the image manifest. This field is only populated when Kind is + # "image". + # + # @param containers [Array] The IDs of the containers that are using this image. + # + # @param platform [Docker::Models::Image::Manifest::ImageData::Platform, nil] Describes the platform which the image in the manifest runs on, as defined + # + # @param size [Docker::Models::Image::Manifest::ImageData::Size] + + # @see Docker::Models::Image::Manifest::ImageData#platform + class Platform < Docker::Internal::Type::BaseModel + # @!attribute architecture + # The CPU architecture, for example `amd64` or `ppc64`. + # + # @return [String, nil] + optional :architecture, String + + # @!attribute os + # The operating system, for example `linux` or `windows`. + # + # @return [String, nil] + optional :os, String + + # @!attribute os_features + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + # + # @return [Array, nil] + optional :os_features, Docker::Internal::Type::ArrayOf[String], api_name: :"os.features" + + # @!attribute os_version + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + # + # @return [String, nil] + optional :os_version, String, api_name: :"os.version" + + # @!attribute variant + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + # + # @return [String, nil] + optional :variant, String + + # @!method initialize(architecture: nil, os: nil, os_features: nil, os_version: nil, variant: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Manifest::ImageData::Platform} for more details. + # + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + # + # @param architecture [String] The CPU architecture, for example `amd64` or `ppc64`. + # + # @param os [String] The operating system, for example `linux` or `windows`. + # + # @param os_features [Array] Optional field specifying an array of strings, each listing a required + # + # @param os_version [String] Optional field specifying the operating system version, for example on + # + # @param variant [String] Optional field specifying a variant of the CPU, for example `v7` to + end + + # @see Docker::Models::Image::Manifest::ImageData#size + class Size < Docker::Internal::Type::BaseModel + # @!attribute unpacked + # Unpacked is the size (in bytes) of the locally unpacked (uncompressed) image + # content that's directly usable by the containers running this image. It's + # independent of the distributable content - e.g. the image might still have an + # unpacked data that's still used by some container even when the + # distributable/compressed content is already gone. + # + # @return [Integer] + required :unpacked, Integer, api_name: :Unpacked + + # @!method initialize(unpacked:) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Manifest::ImageData::Size} for more details. + # + # @param unpacked [Integer] Unpacked is the size (in bytes) of the locally unpacked + end + end + end + + # @see Docker::Models::Image#metadata + class Metadata < Docker::Internal::Type::BaseModel + # @!attribute last_tag_time + # Date and time at which the image was last tagged in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + # + # This information is only available if the image was tagged locally, and omitted + # otherwise. + # + # @return [String, nil] + optional :last_tag_time, String, api_name: :LastTagTime, nil?: true + + # @!method initialize(last_tag_time: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Image::Metadata} for more details. + # + # Additional metadata of the image in the local cache. This information is local + # to the daemon, and not part of the image itself. + # + # @param last_tag_time [String, nil] Date and time at which the image was last tagged in + end + + # @see Docker::Models::Image#root_fs + class RootFs < Docker::Internal::Type::BaseModel + # @!attribute type + # + # @return [String] + required :type, String, api_name: :Type + + # @!attribute layers + # + # @return [Array, nil] + optional :layers, Docker::Internal::Type::ArrayOf[String], api_name: :Layers + + # @!method initialize(type:, layers: nil) + # Information about the image's RootFS, including the layer IDs. + # + # @param type [String] + # @param layers [Array] + end + end + end +end diff --git a/lib/docker/models/image_delete_params.rb b/lib/docker/models/image_delete_params.rb new file mode 100644 index 0000000..69c4010 --- /dev/null +++ b/lib/docker/models/image_delete_params.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Images#delete + class ImageDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute force + # Remove the image even if it is being used by stopped containers or has other + # tags + # + # @return [Boolean, nil] + optional :force, Docker::Internal::Type::Boolean + + # @!attribute noprune + # Do not delete untagged parent images + # + # @return [Boolean, nil] + optional :noprune, Docker::Internal::Type::Boolean + + # @!attribute platforms + # Select platform-specific content to delete. Multiple values are accepted. Each + # platform is a OCI platform encoded as a JSON string. + # + # @return [Array, nil] + optional :platforms, Docker::Internal::Type::ArrayOf[String] + + # @!method initialize(force: nil, noprune: nil, platforms: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::ImageDeleteParams} for more details. + # + # @param force [Boolean] Remove the image even if it is being used by stopped containers or has other tag + # + # @param noprune [Boolean] Do not delete untagged parent images + # + # @param platforms [Array] Select platform-specific content to delete. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/image_delete_response.rb b/lib/docker/models/image_delete_response.rb new file mode 100644 index 0000000..ba9d333 --- /dev/null +++ b/lib/docker/models/image_delete_response.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Docker + module Models + class ImageDeleteResponseItem < Docker::Internal::Type::BaseModel + # @!attribute deleted + # The image ID of an image that was deleted + # + # @return [String, nil] + optional :deleted, String, api_name: :Deleted + + # @!attribute untagged + # The image ID of an image that was untagged + # + # @return [String, nil] + optional :untagged, String, api_name: :Untagged + + # @!method initialize(deleted: nil, untagged: nil) + # @param deleted [String] The image ID of an image that was deleted + # + # @param untagged [String] The image ID of an image that was untagged + end + + # @type [Docker::Internal::Type::Converter] + ImageDeleteResponse = Docker::Internal::Type::ArrayOf[-> { Docker::Models::ImageDeleteResponseItem }] + end +end diff --git a/lib/docker/models/image_inspect_params.rb b/lib/docker/models/image_inspect_params.rb new file mode 100644 index 0000000..c65f33e --- /dev/null +++ b/lib/docker/models/image_inspect_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Images#inspect_ + class ImageInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute manifests + # Include Manifests in the image summary. + # + # @return [Boolean, nil] + optional :manifests, Docker::Internal::Type::Boolean + + # @!method initialize(manifests: nil, request_options: {}) + # @param manifests [Boolean] Include Manifests in the image summary. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/image_list_params.rb b/lib/docker/models/image_list_params.rb new file mode 100644 index 0000000..7b8a3c9 --- /dev/null +++ b/lib/docker/models/image_list_params.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Images#list + class ImageListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute all + # Show all images. Only images from a final layer (no children) are shown by + # default. + # + # @return [Boolean, nil] + optional :all, Docker::Internal::Type::Boolean + + # @!attribute digests + # Show digest information as a `RepoDigests` field on each image. + # + # @return [Boolean, nil] + optional :digests, Docker::Internal::Type::Boolean + + # @!attribute filters + # A JSON encoded value of the filters (a `map[string][]string`) to process on the + # images list. + # + # Available filters: + # + # - `before`=(`[:]`, `` or ``) + # - `dangling=true` + # - `label=key` or `label="key=value"` of an image label + # - `reference`=(`[:]`) + # - `since`=(`[:]`, `` or ``) + # - `until=` + # + # @return [String, nil] + optional :filters, String + + # @!attribute manifests + # Include `Manifests` in the image summary. + # + # @return [Boolean, nil] + optional :manifests, Docker::Internal::Type::Boolean + + # @!attribute shared_size + # Compute and show shared size as a `SharedSize` field on each image. + # + # @return [Boolean, nil] + optional :shared_size, Docker::Internal::Type::Boolean + + # @!method initialize(all: nil, digests: nil, filters: nil, manifests: nil, shared_size: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::ImageListParams} for more details. + # + # @param all [Boolean] Show all images. Only images from a final layer (no children) are shown by defau + # + # @param digests [Boolean] Show digest information as a `RepoDigests` field on each image. + # + # @param filters [String] A JSON encoded value of the filters (a `map[string][]string`) to + # + # @param manifests [Boolean] Include `Manifests` in the image summary. + # + # @param shared_size [Boolean] Compute and show shared size as a `SharedSize` field on each image. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/image_list_response.rb b/lib/docker/models/image_list_response.rb new file mode 100644 index 0000000..58efac0 --- /dev/null +++ b/lib/docker/models/image_list_response.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Docker + module Models + # @type [Docker::Internal::Type::Converter] + ImageListResponse = Docker::Internal::Type::ArrayOf[-> { Docker::Summary }] + end +end diff --git a/lib/docker/models/image_pull_params.rb b/lib/docker/models/image_pull_params.rb new file mode 100644 index 0000000..01f16e0 --- /dev/null +++ b/lib/docker/models/image_pull_params.rb @@ -0,0 +1,115 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Images#pull + class ImagePullParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute changes + # Apply `Dockerfile` instructions to the image that is created, for example: + # `changes=ENV DEBUG=true`. Note that `ENV DEBUG=true` should be URI component + # encoded. + # + # Supported `Dockerfile` instructions: + # `CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR` + # + # @return [Array, nil] + optional :changes, Docker::Internal::Type::ArrayOf[String] + + # @!attribute from_image + # Name of the image to pull. If the name includes a tag or digest, specific + # behavior applies: + # + # - If only `fromImage` includes a tag, that tag is used. + # - If both `fromImage` and `tag` are provided, `tag` takes precedence. + # - If `fromImage` includes a digest, the image is pulled by digest, and `tag` is + # ignored. + # - If neither a tag nor digest is specified, all tags are pulled. + # + # @return [String, nil] + optional :from_image, String + + # @!attribute from_src + # Source to import. The value may be a URL from which the image can be retrieved + # or `-` to read the image from the request body. This parameter may only be used + # when importing an image. + # + # @return [String, nil] + optional :from_src, String + + # @!attribute message + # Set commit message for imported image. + # + # @return [String, nil] + optional :message, String + + # @!attribute platform + # Platform in the format os[/arch[/variant]]. + # + # When used in combination with the `fromImage` option, the daemon checks if the + # given image is present in the local image cache with the given OS and + # Architecture, and otherwise attempts to pull the image. If the option is not + # set, the host's native OS and Architecture are used. If the given image does not + # exist in the local image cache, the daemon attempts to pull the image with the + # host's native OS and Architecture. If the given image does exists in the local + # image cache, but its OS or architecture does not match, a warning is produced. + # + # When used with the `fromSrc` option to import an image from an archive, this + # option sets the platform information for the imported image. If the option is + # not set, the host's native OS and Architecture are used for the imported image. + # + # @return [String, nil] + optional :platform, String + + # @!attribute repo + # Repository name given to an image when it is imported. The repo may include a + # tag. This parameter may only be used when importing an image. + # + # @return [String, nil] + optional :repo, String + + # @!attribute tag + # Tag or digest. If empty when pulling an image, this causes all tags for the + # given image to be pulled. + # + # @return [String, nil] + optional :tag, String + + # @!attribute body + # + # @return [String, nil] + optional :body, String + + # @!attribute x_registry_auth + # + # @return [String, nil] + optional :x_registry_auth, String + + # @!method initialize(changes: nil, from_image: nil, from_src: nil, message: nil, platform: nil, repo: nil, tag: nil, body: nil, x_registry_auth: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::ImagePullParams} for more details. + # + # @param changes [Array] Apply `Dockerfile` instructions to the image that is created, + # + # @param from_image [String] Name of the image to pull. If the name includes a tag or digest, specific behavi + # + # @param from_src [String] Source to import. The value may be a URL from which the image can be retrieved o + # + # @param message [String] Set commit message for imported image. + # + # @param platform [String] Platform in the format os[/arch[/variant]]. + # + # @param repo [String] Repository name given to an image when it is imported. The repo may include a ta + # + # @param tag [String] Tag or digest. If empty when pulling an image, this causes all tags for the give + # + # @param body [String] + # + # @param x_registry_auth [String] + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/network.rb b/lib/docker/models/network.rb new file mode 100644 index 0000000..1d5be8b --- /dev/null +++ b/lib/docker/models/network.rb @@ -0,0 +1,251 @@ +# frozen_string_literal: true + +module Docker + module Models + class Network < Docker::Internal::Type::BaseModel + # @!attribute attachable + # Whether a global / swarm scope network is manually attachable by regular + # containers from workers in swarm mode. + # + # @return [Boolean, nil] + optional :attachable, Docker::Internal::Type::Boolean, api_name: :Attachable + + # @!attribute config_from + # The config-only network source to provide the configuration for this network. + # + # @return [Docker::Models::Network::ConfigFrom, nil] + optional :config_from, -> { Docker::Network::ConfigFrom }, api_name: :ConfigFrom + + # @!attribute config_only + # Whether the network is a config-only network. Config-only networks are + # placeholder networks for network configurations to be used by other networks. + # Config-only networks cannot be used directly to run containers or services. + # + # @return [Boolean, nil] + optional :config_only, Docker::Internal::Type::Boolean, api_name: :ConfigOnly + + # @!attribute created + # Date and time at which the network was created in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + # + # @return [String, nil] + optional :created, String, api_name: :Created + + # @!attribute driver + # The name of the driver used to create the network (e.g. `bridge`, `overlay`). + # + # @return [String, nil] + optional :driver, String, api_name: :Driver + + # @!attribute enable_i_pv4 + # Whether the network was created with IPv4 enabled. + # + # @return [Boolean, nil] + optional :enable_i_pv4, Docker::Internal::Type::Boolean, api_name: :EnableIPv4 + + # @!attribute enable_i_pv6 + # Whether the network was created with IPv6 enabled. + # + # @return [Boolean, nil] + optional :enable_i_pv6, Docker::Internal::Type::Boolean, api_name: :EnableIPv6 + + # @!attribute id + # ID that uniquely identifies a network on a single machine. + # + # @return [String, nil] + optional :id, String, api_name: :Id + + # @!attribute ingress + # Whether the network is providing the routing-mesh for the swarm cluster. + # + # @return [Boolean, nil] + optional :ingress, Docker::Internal::Type::Boolean, api_name: :Ingress + + # @!attribute internal + # Whether the network is created to only allow internal networking connectivity. + # + # @return [Boolean, nil] + optional :internal, Docker::Internal::Type::Boolean, api_name: :Internal + + # @!attribute ipam + # + # @return [Docker::Models::Network::Ipam, nil] + optional :ipam, -> { Docker::Network::Ipam }, api_name: :IPAM + + # @!attribute labels + # Metadata specific to the network being created. + # + # @return [Hash{Symbol=>String}, nil] + optional :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute name + # Name of the network. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute options + # Network-specific options uses when creating the network. + # + # @return [Hash{Symbol=>String}, nil] + optional :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!attribute peers + # List of peer nodes for an overlay network. This field is only present for + # overlay networks, and omitted for other network types. + # + # @return [Array, nil] + optional :peers, -> { Docker::Internal::Type::ArrayOf[Docker::Network::Peer] }, api_name: :Peers + + # @!attribute scope + # The level at which the network exists (e.g. `swarm` for cluster-wide or `local` + # for machine level) + # + # @return [String, nil] + optional :scope, String, api_name: :Scope + + # @!method initialize(attachable: nil, config_from: nil, config_only: nil, created: nil, driver: nil, enable_i_pv4: nil, enable_i_pv6: nil, id: nil, ingress: nil, internal: nil, ipam: nil, labels: nil, name: nil, options: nil, peers: nil, scope: nil) + # Some parameter documentations has been truncated, see {Docker::Models::Network} + # for more details. + # + # @param attachable [Boolean] Whether a global / swarm scope network is manually attachable by regular + # + # @param config_from [Docker::Models::Network::ConfigFrom] The config-only network source to provide the configuration for + # + # @param config_only [Boolean] Whether the network is a config-only network. Config-only networks are + # + # @param created [String] Date and time at which the network was created in + # + # @param driver [String] The name of the driver used to create the network (e.g. `bridge`, + # + # @param enable_i_pv4 [Boolean] Whether the network was created with IPv4 enabled. + # + # @param enable_i_pv6 [Boolean] Whether the network was created with IPv6 enabled. + # + # @param id [String] ID that uniquely identifies a network on a single machine. + # + # @param ingress [Boolean] Whether the network is providing the routing-mesh for the swarm cluster. + # + # @param internal [Boolean] Whether the network is created to only allow internal networking + # + # @param ipam [Docker::Models::Network::Ipam] + # + # @param labels [Hash{Symbol=>String}] Metadata specific to the network being created. + # + # @param name [String] Name of the network. + # + # @param options [Hash{Symbol=>String}] Network-specific options uses when creating the network. + # + # @param peers [Array] List of peer nodes for an overlay network. This field is only present + # + # @param scope [String] The level at which the network exists (e.g. `swarm` for cluster-wide + + # @see Docker::Models::Network#config_from + class ConfigFrom < Docker::Internal::Type::BaseModel + # @!attribute network + # The name of the config-only network that provides the network's configuration. + # The specified network must be an existing config-only network. Only network + # names are allowed, not network IDs. + # + # @return [String, nil] + optional :network, String, api_name: :Network + + # @!method initialize(network: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Network::ConfigFrom} for more details. + # + # The config-only network source to provide the configuration for this network. + # + # @param network [String] The name of the config-only network that provides the network's + end + + # @see Docker::Models::Network#ipam + class Ipam < Docker::Internal::Type::BaseModel + # @!attribute config + # List of IPAM configuration options, specified as a map: + # + # ``` + # {"Subnet": , "IPRange": , "Gateway": , "AuxAddress": } + # ``` + # + # @return [Array, nil] + optional :config, + -> { + Docker::Internal::Type::ArrayOf[Docker::Network::Ipam::Config] + }, + api_name: :Config + + # @!attribute driver + # Name of the IPAM driver to use. + # + # @return [String, nil] + optional :driver, String, api_name: :Driver + + # @!attribute options + # Driver-specific options, specified as a map. + # + # @return [Hash{Symbol=>String}, nil] + optional :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!method initialize(config: nil, driver: nil, options: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Network::Ipam} for more details. + # + # @param config [Array] List of IPAM configuration options, specified as a map: + # + # @param driver [String] Name of the IPAM driver to use. + # + # @param options [Hash{Symbol=>String}] Driver-specific options, specified as a map. + + class Config < Docker::Internal::Type::BaseModel + # @!attribute auxiliary_addresses + # + # @return [Hash{Symbol=>String}, nil] + optional :auxiliary_addresses, Docker::Internal::Type::HashOf[String], api_name: :AuxiliaryAddresses + + # @!attribute gateway + # + # @return [String, nil] + optional :gateway, String, api_name: :Gateway + + # @!attribute ip_range + # + # @return [String, nil] + optional :ip_range, String, api_name: :IPRange + + # @!attribute subnet + # + # @return [String, nil] + optional :subnet, String, api_name: :Subnet + + # @!method initialize(auxiliary_addresses: nil, gateway: nil, ip_range: nil, subnet: nil) + # @param auxiliary_addresses [Hash{Symbol=>String}] + # @param gateway [String] + # @param ip_range [String] + # @param subnet [String] + end + end + + class Peer < Docker::Internal::Type::BaseModel + # @!attribute ip + # IP-address of the peer-node in the Swarm cluster. + # + # @return [String, nil] + optional :ip, String, api_name: :IP + + # @!attribute name + # ID of the peer-node in the Swarm cluster. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!method initialize(ip: nil, name: nil) + # represents one peer of an overlay network. + # + # @param ip [String] IP-address of the peer-node in the Swarm cluster. + # + # @param name [String] ID of the peer-node in the Swarm cluster. + end + end + end +end diff --git a/lib/docker/models/network_create_params.rb b/lib/docker/models/network_create_params.rb new file mode 100644 index 0000000..e9c9990 --- /dev/null +++ b/lib/docker/models/network_create_params.rb @@ -0,0 +1,206 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Networks#create + class NetworkCreateParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute name + # The network's name. + # + # @return [String] + required :name, String, api_name: :Name + + # @!attribute attachable + # Globally scoped network is manually attachable by regular containers from + # workers in swarm mode. + # + # @return [Boolean, nil] + optional :attachable, Docker::Internal::Type::Boolean, api_name: :Attachable + + # @!attribute config_from + # The config-only network source to provide the configuration for this network. + # + # @return [Docker::Models::NetworkCreateParams::ConfigFrom, nil] + optional :config_from, -> { Docker::NetworkCreateParams::ConfigFrom }, api_name: :ConfigFrom + + # @!attribute config_only + # Creates a config-only network. Config-only networks are placeholder networks for + # network configurations to be used by other networks. Config-only networks cannot + # be used directly to run containers or services. + # + # @return [Boolean, nil] + optional :config_only, Docker::Internal::Type::Boolean, api_name: :ConfigOnly + + # @!attribute driver + # Name of the network driver plugin to use. + # + # @return [String, nil] + optional :driver, String, api_name: :Driver + + # @!attribute enable_i_pv4 + # Enable IPv4 on the network. + # + # @return [Boolean, nil] + optional :enable_i_pv4, Docker::Internal::Type::Boolean, api_name: :EnableIPv4 + + # @!attribute enable_i_pv6 + # Enable IPv6 on the network. + # + # @return [Boolean, nil] + optional :enable_i_pv6, Docker::Internal::Type::Boolean, api_name: :EnableIPv6 + + # @!attribute ingress + # Ingress network is the network which provides the routing-mesh in swarm mode. + # + # @return [Boolean, nil] + optional :ingress, Docker::Internal::Type::Boolean, api_name: :Ingress + + # @!attribute internal + # Restrict external access to the network. + # + # @return [Boolean, nil] + optional :internal, Docker::Internal::Type::Boolean, api_name: :Internal + + # @!attribute ipam + # + # @return [Docker::Models::NetworkCreateParams::Ipam, nil] + optional :ipam, -> { Docker::NetworkCreateParams::Ipam }, api_name: :IPAM + + # @!attribute labels + # User-defined key/value metadata. + # + # @return [Hash{Symbol=>String}, nil] + optional :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute options + # Network specific options to be used by the drivers. + # + # @return [Hash{Symbol=>String}, nil] + optional :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!attribute scope + # The level at which the network exists (e.g. `swarm` for cluster-wide or `local` + # for machine level). + # + # @return [String, nil] + optional :scope, String, api_name: :Scope + + # @!method initialize(name:, attachable: nil, config_from: nil, config_only: nil, driver: nil, enable_i_pv4: nil, enable_i_pv6: nil, ingress: nil, internal: nil, ipam: nil, labels: nil, options: nil, scope: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::NetworkCreateParams} for more details. + # + # @param name [String] The network's name. + # + # @param attachable [Boolean] Globally scoped network is manually attachable by regular + # + # @param config_from [Docker::Models::NetworkCreateParams::ConfigFrom] The config-only network source to provide the configuration for + # + # @param config_only [Boolean] Creates a config-only network. Config-only networks are placeholder + # + # @param driver [String] Name of the network driver plugin to use. + # + # @param enable_i_pv4 [Boolean] Enable IPv4 on the network. + # + # @param enable_i_pv6 [Boolean] Enable IPv6 on the network. + # + # @param ingress [Boolean] Ingress network is the network which provides the routing-mesh + # + # @param internal [Boolean] Restrict external access to the network. + # + # @param ipam [Docker::Models::NetworkCreateParams::Ipam] + # + # @param labels [Hash{Symbol=>String}] User-defined key/value metadata. + # + # @param options [Hash{Symbol=>String}] Network specific options to be used by the drivers. + # + # @param scope [String] The level at which the network exists (e.g. `swarm` for cluster-wide + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + + class ConfigFrom < Docker::Internal::Type::BaseModel + # @!attribute network + # The name of the config-only network that provides the network's configuration. + # The specified network must be an existing config-only network. Only network + # names are allowed, not network IDs. + # + # @return [String, nil] + optional :network, String, api_name: :Network + + # @!method initialize(network: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::NetworkCreateParams::ConfigFrom} for more details. + # + # The config-only network source to provide the configuration for this network. + # + # @param network [String] The name of the config-only network that provides the network's + end + + class Ipam < Docker::Internal::Type::BaseModel + # @!attribute config + # List of IPAM configuration options, specified as a map: + # + # ``` + # {"Subnet": , "IPRange": , "Gateway": , "AuxAddress": } + # ``` + # + # @return [Array, nil] + optional :config, + -> { Docker::Internal::Type::ArrayOf[Docker::NetworkCreateParams::Ipam::Config] }, + api_name: :Config + + # @!attribute driver + # Name of the IPAM driver to use. + # + # @return [String, nil] + optional :driver, String, api_name: :Driver + + # @!attribute options + # Driver-specific options, specified as a map. + # + # @return [Hash{Symbol=>String}, nil] + optional :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!method initialize(config: nil, driver: nil, options: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::NetworkCreateParams::Ipam} for more details. + # + # @param config [Array] List of IPAM configuration options, specified as a map: + # + # @param driver [String] Name of the IPAM driver to use. + # + # @param options [Hash{Symbol=>String}] Driver-specific options, specified as a map. + + class Config < Docker::Internal::Type::BaseModel + # @!attribute auxiliary_addresses + # + # @return [Hash{Symbol=>String}, nil] + optional :auxiliary_addresses, Docker::Internal::Type::HashOf[String], api_name: :AuxiliaryAddresses + + # @!attribute gateway + # + # @return [String, nil] + optional :gateway, String, api_name: :Gateway + + # @!attribute ip_range + # + # @return [String, nil] + optional :ip_range, String, api_name: :IPRange + + # @!attribute subnet + # + # @return [String, nil] + optional :subnet, String, api_name: :Subnet + + # @!method initialize(auxiliary_addresses: nil, gateway: nil, ip_range: nil, subnet: nil) + # @param auxiliary_addresses [Hash{Symbol=>String}] + # @param gateway [String] + # @param ip_range [String] + # @param subnet [String] + end + end + end + end +end diff --git a/lib/docker/models/network_create_response.rb b/lib/docker/models/network_create_response.rb new file mode 100644 index 0000000..227f30a --- /dev/null +++ b/lib/docker/models/network_create_response.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Networks#create + class NetworkCreateResponse < Docker::Internal::Type::BaseModel + # @!attribute id + # The ID of the created network. + # + # @return [String] + required :id, String, api_name: :Id + + # @!attribute warning + # Warnings encountered when creating the container + # + # @return [String] + required :warning, String, api_name: :Warning + + # @!method initialize(id:, warning:) + # OK response to NetworkCreate operation + # + # @param id [String] The ID of the created network. + # + # @param warning [String] Warnings encountered when creating the container + end + end +end diff --git a/lib/docker/models/network_delete_params.rb b/lib/docker/models/network_delete_params.rb new file mode 100644 index 0000000..821a261 --- /dev/null +++ b/lib/docker/models/network_delete_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Networks#delete + class NetworkDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/network_inspect_params.rb b/lib/docker/models/network_inspect_params.rb new file mode 100644 index 0000000..62c0b6f --- /dev/null +++ b/lib/docker/models/network_inspect_params.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Networks#inspect_ + class NetworkInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute scope + # Filter the network by scope (swarm, global, or local) + # + # @return [String, nil] + optional :scope, String + + # @!attribute verbose + # Detailed inspect output for troubleshooting + # + # @return [Boolean, nil] + optional :verbose, Docker::Internal::Type::Boolean + + # @!method initialize(scope: nil, verbose: nil, request_options: {}) + # @param scope [String] Filter the network by scope (swarm, global, or local) + # + # @param verbose [Boolean] Detailed inspect output for troubleshooting + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/network_inspect_response.rb b/lib/docker/models/network_inspect_response.rb new file mode 100644 index 0000000..78768fc --- /dev/null +++ b/lib/docker/models/network_inspect_response.rb @@ -0,0 +1,128 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Networks#inspect_ + class NetworkInspectResponse < Docker::Models::Network + # @!attribute containers + # Contains endpoints attached to the network. + # + # @return [Hash{Symbol=>Docker::Models::NetworkInspectResponse::Container}, nil] + optional :containers, + -> { Docker::Internal::Type::HashOf[Docker::Models::NetworkInspectResponse::Container] }, + api_name: :Containers + + # @!attribute services + # List of services using the network. This field is only present for swarm scope + # networks, and omitted for local scope networks. + # + # @return [Hash{Symbol=>Object}, nil] + optional :services, Docker::Internal::Type::HashOf[Docker::Internal::Type::Unknown], api_name: :Services + + # @!attribute status + # provides runtime information about the network such as the number of allocated + # IPs. + # + # @return [Docker::Models::NetworkInspectResponse::Status, nil] + optional :status, -> { Docker::Models::NetworkInspectResponse::Status }, api_name: :Status + + # @!method initialize(containers: nil, services: nil, status: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::NetworkInspectResponse} for more details. + # + # The body of the "get network" http response message. + # + # @param containers [Hash{Symbol=>Docker::Models::NetworkInspectResponse::Container}] Contains endpoints attached to the network. + # + # @param services [Hash{Symbol=>Object}] List of services using the network. This field is only present for + # + # @param status [Docker::Models::NetworkInspectResponse::Status] provides runtime information about the network such as the number of allocated I + + class Container < Docker::Internal::Type::BaseModel + # @!attribute endpoint_id + # + # @return [String, nil] + optional :endpoint_id, String, api_name: :EndpointID + + # @!attribute i_pv4_address + # + # @return [String, nil] + optional :i_pv4_address, String, api_name: :IPv4Address + + # @!attribute i_pv6_address + # + # @return [String, nil] + optional :i_pv6_address, String, api_name: :IPv6Address + + # @!attribute mac_address + # + # @return [String, nil] + optional :mac_address, String, api_name: :MacAddress + + # @!attribute name + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!method initialize(endpoint_id: nil, i_pv4_address: nil, i_pv6_address: nil, mac_address: nil, name: nil) + # contains network resources allocated and used for a container in a network. + # + # @param endpoint_id [String] + # @param i_pv4_address [String] + # @param i_pv6_address [String] + # @param mac_address [String] + # @param name [String] + end + + class Status < Docker::Internal::Type::BaseModel + # @!attribute ipam + # + # @return [Docker::Models::NetworkInspectResponse::Status::Ipam, nil] + optional :ipam, -> { Docker::Models::NetworkInspectResponse::Status::Ipam }, api_name: :IPAM + + # @!method initialize(ipam: nil) + # provides runtime information about the network such as the number of allocated + # IPs. + # + # @param ipam [Docker::Models::NetworkInspectResponse::Status::Ipam] + + # @see Docker::Models::NetworkInspectResponse::Status#ipam + class Ipam < Docker::Internal::Type::BaseModel + # @!attribute subnets + # + # @return [Hash{Symbol=>Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet}, nil] + optional :subnets, + -> { Docker::Internal::Type::HashOf[Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet] }, + api_name: :Subnets + + # @!method initialize(subnets: nil) + # @param subnets [Hash{Symbol=>Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet}] + + class Subnet < Docker::Internal::Type::BaseModel + # @!attribute dynamic_ips_available + # Number of IP addresses within the network's IPRange for the subnet that are + # available for allocation, saturating at 264 - 1. + # + # @return [Integer, nil] + optional :dynamic_ips_available, Integer, api_name: :DynamicIPsAvailable + + # @!attribute ips_in_use + # Number of IP addresses in the subnet that are in use or reserved and are + # therefore unavailable for allocation, saturating at 264 - 1. + # + # @return [Integer, nil] + optional :ips_in_use, Integer, api_name: :IPsInUse + + # @!method initialize(dynamic_ips_available: nil, ips_in_use: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet} for more details. + # + # @param dynamic_ips_available [Integer] Number of IP addresses within the network's IPRange for the subnet that are avai + # + # @param ips_in_use [Integer] Number of IP addresses in the subnet that are in use or reserved and are therefo + end + end + end + end + end +end diff --git a/lib/docker/models/network_list_params.rb b/lib/docker/models/network_list_params.rb new file mode 100644 index 0000000..b33817a --- /dev/null +++ b/lib/docker/models/network_list_params.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Networks#list + class NetworkListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute filters + # JSON encoded value of the filters (a `map[string][]string`) to process on the + # networks list. + # + # Available filters: + # + # - `dangling=` When set to `true` (or `1`), returns all networks that + # are not in use by a container. When set to `false` (or `0`), only networks + # that are in use by one or more containers are returned. + # - `driver=` Matches a network's driver. + # - `id=` Matches all or part of a network ID. + # - `label=` or `label==` of a network label. + # - `name=` Matches all or part of a network name. + # - `scope=["swarm"|"global"|"local"]` Filters networks by scope (`swarm`, + # `global`, or `local`). + # - `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword + # returns all user-defined networks. + # + # @return [String, nil] + optional :filters, String + + # @!method initialize(filters: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::NetworkListParams} for more details. + # + # @param filters [String] JSON encoded value of the filters (a `map[string][]string`) to process + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/network_list_response.rb b/lib/docker/models/network_list_response.rb new file mode 100644 index 0000000..40d62d1 --- /dev/null +++ b/lib/docker/models/network_list_response.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Docker + module Models + # @type [Docker::Internal::Type::Converter] + NetworkListResponse = Docker::Internal::Type::ArrayOf[-> { Docker::Summary }] + end +end diff --git a/lib/docker/models/service.rb b/lib/docker/models/service.rb new file mode 100644 index 0000000..0de180d --- /dev/null +++ b/lib/docker/models/service.rb @@ -0,0 +1,518 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Services#inspect_ + class Service < Docker::Internal::Type::BaseModel + # @!attribute created_at + # + # @return [String, nil] + optional :created_at, String, api_name: :CreatedAt + + # @!attribute endpoint + # + # @return [Docker::Models::Service::Endpoint, nil] + optional :endpoint, -> { Docker::Service::Endpoint }, api_name: :Endpoint + + # @!attribute id + # + # @return [String, nil] + optional :id, String, api_name: :ID + + # @!attribute job_status + # The status of the service when it is in one of ReplicatedJob or GlobalJob modes. + # Absent on Replicated and Global mode services. The JobIteration is an + # ObjectVersion, but unlike the Service's version, does not need to be sent with + # an update request. + # + # @return [Docker::Models::Service::JobStatus, nil] + optional :job_status, -> { Docker::Service::JobStatus }, api_name: :JobStatus + + # @!attribute service_status + # The status of the service's tasks. Provided only when requested as part of a + # ServiceList operation. + # + # @return [Docker::Models::Service::ServiceStatus, nil] + optional :service_status, -> { Docker::Service::ServiceStatus }, api_name: :ServiceStatus + + # @!attribute spec + # User modifiable configuration for a service. + # + # @return [Docker::Models::Spec, nil] + optional :spec, -> { Docker::Spec }, api_name: :Spec + + # @!attribute updated_at + # + # @return [String, nil] + optional :updated_at, String, api_name: :UpdatedAt + + # @!attribute update_status + # The status of a service update. + # + # @return [Docker::Models::Service::UpdateStatus, nil] + optional :update_status, -> { Docker::Service::UpdateStatus }, api_name: :UpdateStatus + + # @!attribute version + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + # + # @return [Docker::Models::Service::Version, nil] + optional :version, -> { Docker::Service::Version }, api_name: :Version + + # @!method initialize(created_at: nil, endpoint: nil, id: nil, job_status: nil, service_status: nil, spec: nil, updated_at: nil, update_status: nil, version: nil) + # Some parameter documentations has been truncated, see {Docker::Models::Service} + # for more details. + # + # @param created_at [String] + # + # @param endpoint [Docker::Models::Service::Endpoint] + # + # @param id [String] + # + # @param job_status [Docker::Models::Service::JobStatus] The status of the service when it is in one of ReplicatedJob or + # + # @param service_status [Docker::Models::Service::ServiceStatus] The status of the service's tasks. Provided only when requested as + # + # @param spec [Docker::Models::Spec] User modifiable configuration for a service. + # + # @param updated_at [String] + # + # @param update_status [Docker::Models::Service::UpdateStatus] The status of a service update. + # + # @param version [Docker::Models::Service::Version] The version number of the object such as node, service, etc. This is needed + + # @see Docker::Models::Service#endpoint + class Endpoint < Docker::Internal::Type::BaseModel + # @!attribute ports + # + # @return [Array, nil] + optional :ports, + -> { + Docker::Internal::Type::ArrayOf[Docker::Service::Endpoint::Port] + }, + api_name: :Ports + + # @!attribute spec + # Properties that can be configured to access and load balance a service. + # + # @return [Docker::Models::Service::Endpoint::Spec, nil] + optional :spec, -> { Docker::Service::Endpoint::Spec }, api_name: :Spec + + # @!attribute virtual_ips + # + # @return [Array, nil] + optional :virtual_ips, + -> { Docker::Internal::Type::ArrayOf[Docker::Service::Endpoint::VirtualIP] }, + api_name: :VirtualIPs + + # @!method initialize(ports: nil, spec: nil, virtual_ips: nil) + # @param ports [Array] + # + # @param spec [Docker::Models::Service::Endpoint::Spec] Properties that can be configured to access and load balance a service. + # + # @param virtual_ips [Array] + + class Port < Docker::Internal::Type::BaseModel + # @!attribute name + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute protocol + # + # @return [Symbol, Docker::Models::Service::Endpoint::Port::Protocol, nil] + optional :protocol, enum: -> { Docker::Service::Endpoint::Port::Protocol }, api_name: :Protocol + + # @!attribute published_port + # The port on the swarm hosts. + # + # @return [Integer, nil] + optional :published_port, Integer, api_name: :PublishedPort + + # @!attribute publish_mode + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + # + # @return [Symbol, Docker::Models::Service::Endpoint::Port::PublishMode, nil] + optional :publish_mode, + enum: -> { + Docker::Service::Endpoint::Port::PublishMode + }, + api_name: :PublishMode + + # @!attribute target_port + # The port inside the container. + # + # @return [Integer, nil] + optional :target_port, Integer, api_name: :TargetPort + + # @!method initialize(name: nil, protocol: nil, published_port: nil, publish_mode: nil, target_port: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Service::Endpoint::Port} for more details. + # + # @param name [String] + # + # @param protocol [Symbol, Docker::Models::Service::Endpoint::Port::Protocol] + # + # @param published_port [Integer] The port on the swarm hosts. + # + # @param publish_mode [Symbol, Docker::Models::Service::Endpoint::Port::PublishMode] The mode in which port is published. + # + # @param target_port [Integer] The port inside the container. + + # @see Docker::Models::Service::Endpoint::Port#protocol + module Protocol + extend Docker::Internal::Type::Enum + + TCP = :tcp + UDP = :udp + SCTP = :sctp + + # @!method self.values + # @return [Array] + end + + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + # + # @see Docker::Models::Service::Endpoint::Port#publish_mode + module PublishMode + extend Docker::Internal::Type::Enum + + INGRESS = :ingress + HOST = :host + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::Service::Endpoint#spec + class Spec < Docker::Internal::Type::BaseModel + # @!attribute mode + # The mode of resolution to use for internal load balancing between tasks. + # + # @return [Symbol, Docker::Models::Service::Endpoint::Spec::Mode, nil] + optional :mode, enum: -> { Docker::Service::Endpoint::Spec::Mode }, api_name: :Mode + + # @!attribute ports + # List of exposed ports that this service is accessible on from the outside. Ports + # can only be provided if `vip` resolution mode is used. + # + # @return [Array, nil] + optional :ports, + -> { Docker::Internal::Type::ArrayOf[Docker::Service::Endpoint::Spec::Port] }, + api_name: :Ports + + # @!method initialize(mode: nil, ports: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Service::Endpoint::Spec} for more details. + # + # Properties that can be configured to access and load balance a service. + # + # @param mode [Symbol, Docker::Models::Service::Endpoint::Spec::Mode] The mode of resolution to use for internal load balancing between tasks. + # + # @param ports [Array] List of exposed ports that this service is accessible on from the + + # The mode of resolution to use for internal load balancing between tasks. + # + # @see Docker::Models::Service::Endpoint::Spec#mode + module Mode + extend Docker::Internal::Type::Enum + + VIP = :vip + DNSRR = :dnsrr + + # @!method self.values + # @return [Array] + end + + class Port < Docker::Internal::Type::BaseModel + # @!attribute name + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute protocol + # + # @return [Symbol, Docker::Models::Service::Endpoint::Spec::Port::Protocol, nil] + optional :protocol, + enum: -> { + Docker::Service::Endpoint::Spec::Port::Protocol + }, + api_name: :Protocol + + # @!attribute published_port + # The port on the swarm hosts. + # + # @return [Integer, nil] + optional :published_port, Integer, api_name: :PublishedPort + + # @!attribute publish_mode + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + # + # @return [Symbol, Docker::Models::Service::Endpoint::Spec::Port::PublishMode, nil] + optional :publish_mode, + enum: -> { Docker::Service::Endpoint::Spec::Port::PublishMode }, + api_name: :PublishMode + + # @!attribute target_port + # The port inside the container. + # + # @return [Integer, nil] + optional :target_port, Integer, api_name: :TargetPort + + # @!method initialize(name: nil, protocol: nil, published_port: nil, publish_mode: nil, target_port: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Service::Endpoint::Spec::Port} for more details. + # + # @param name [String] + # + # @param protocol [Symbol, Docker::Models::Service::Endpoint::Spec::Port::Protocol] + # + # @param published_port [Integer] The port on the swarm hosts. + # + # @param publish_mode [Symbol, Docker::Models::Service::Endpoint::Spec::Port::PublishMode] The mode in which port is published. + # + # @param target_port [Integer] The port inside the container. + + # @see Docker::Models::Service::Endpoint::Spec::Port#protocol + module Protocol + extend Docker::Internal::Type::Enum + + TCP = :tcp + UDP = :udp + SCTP = :sctp + + # @!method self.values + # @return [Array] + end + + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + # + # @see Docker::Models::Service::Endpoint::Spec::Port#publish_mode + module PublishMode + extend Docker::Internal::Type::Enum + + INGRESS = :ingress + HOST = :host + + # @!method self.values + # @return [Array] + end + end + end + + class VirtualIP < Docker::Internal::Type::BaseModel + # @!attribute addr + # + # @return [String, nil] + optional :addr, String, api_name: :Addr + + # @!attribute network_id + # + # @return [String, nil] + optional :network_id, String, api_name: :NetworkID + + # @!method initialize(addr: nil, network_id: nil) + # @param addr [String] + # @param network_id [String] + end + end + + # @see Docker::Models::Service#job_status + class JobStatus < Docker::Internal::Type::BaseModel + # @!attribute job_iteration + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + # + # @return [Docker::Models::Service::JobStatus::JobIteration, nil] + optional :job_iteration, -> { Docker::Service::JobStatus::JobIteration }, api_name: :JobIteration + + # @!attribute last_execution + # The last time, as observed by the server, that this job was started. + # + # @return [String, nil] + optional :last_execution, String, api_name: :LastExecution + + # @!method initialize(job_iteration: nil, last_execution: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Service::JobStatus} for more details. + # + # The status of the service when it is in one of ReplicatedJob or GlobalJob modes. + # Absent on Replicated and Global mode services. The JobIteration is an + # ObjectVersion, but unlike the Service's version, does not need to be sent with + # an update request. + # + # @param job_iteration [Docker::Models::Service::JobStatus::JobIteration] The version number of the object such as node, service, etc. This is needed + # + # @param last_execution [String] The last time, as observed by the server, that this job was + + # @see Docker::Models::Service::JobStatus#job_iteration + class JobIteration < Docker::Internal::Type::BaseModel + # @!attribute index + # + # @return [Integer, nil] + optional :index, Integer, api_name: :Index + + # @!method initialize(index: nil) + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + # + # @param index [Integer] + end + end + + # @see Docker::Models::Service#service_status + class ServiceStatus < Docker::Internal::Type::BaseModel + # @!attribute completed_tasks + # The number of tasks for a job that are in the Completed state. This field must + # be cross-referenced with the service type, as the value of 0 may mean the + # service is not in a job mode, or it may mean the job-mode service has no tasks + # yet Completed. + # + # @return [Integer, nil] + optional :completed_tasks, Integer, api_name: :CompletedTasks + + # @!attribute desired_tasks + # The number of tasks for the service desired to be running. For replicated + # services, this is the replica count from the service spec. For global services, + # this is computed by taking count of all tasks for the service with a Desired + # State other than Shutdown. + # + # @return [Integer, nil] + optional :desired_tasks, Integer, api_name: :DesiredTasks + + # @!attribute running_tasks + # The number of tasks for the service currently in the Running state. + # + # @return [Integer, nil] + optional :running_tasks, Integer, api_name: :RunningTasks + + # @!method initialize(completed_tasks: nil, desired_tasks: nil, running_tasks: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Service::ServiceStatus} for more details. + # + # The status of the service's tasks. Provided only when requested as part of a + # ServiceList operation. + # + # @param completed_tasks [Integer] The number of tasks for a job that are in the Completed state. + # + # @param desired_tasks [Integer] The number of tasks for the service desired to be running. + # + # @param running_tasks [Integer] The number of tasks for the service currently in the Running state. + end + + # @see Docker::Models::Service#update_status + class UpdateStatus < Docker::Internal::Type::BaseModel + # @!attribute completed_at + # + # @return [String, nil] + optional :completed_at, String, api_name: :CompletedAt + + # @!attribute message + # + # @return [String, nil] + optional :message, String, api_name: :Message + + # @!attribute started_at + # + # @return [String, nil] + optional :started_at, String, api_name: :StartedAt + + # @!attribute state + # + # @return [Symbol, Docker::Models::Service::UpdateStatus::State, nil] + optional :state, enum: -> { Docker::Service::UpdateStatus::State }, api_name: :State + + # @!method initialize(completed_at: nil, message: nil, started_at: nil, state: nil) + # The status of a service update. + # + # @param completed_at [String] + # @param message [String] + # @param started_at [String] + # @param state [Symbol, Docker::Models::Service::UpdateStatus::State] + + # @see Docker::Models::Service::UpdateStatus#state + module State + extend Docker::Internal::Type::Enum + + UPDATING = :updating + PAUSED = :paused + COMPLETED = :completed + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::Service#version + class Version < Docker::Internal::Type::BaseModel + # @!attribute index + # + # @return [Integer, nil] + optional :index, Integer, api_name: :Index + + # @!method initialize(index: nil) + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + # + # @param index [Integer] + end + end + end +end diff --git a/lib/docker/models/service_create_params.rb b/lib/docker/models/service_create_params.rb new file mode 100644 index 0000000..02e69cf --- /dev/null +++ b/lib/docker/models/service_create_params.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Services#create + class ServiceCreateParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute spec + # User modifiable configuration for a service. + # + # @return [Docker::Models::ServiceCreateParams::Spec] + required :spec, -> { Docker::ServiceCreateParams::Spec } + + # @!attribute x_registry_auth + # + # @return [String, nil] + optional :x_registry_auth, String + + # @!method initialize(spec:, x_registry_auth: nil, request_options: {}) + # @param spec [Docker::Models::ServiceCreateParams::Spec] User modifiable configuration for a service. + # + # @param x_registry_auth [String] + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + + class Spec < Docker::Models::Spec + # @!method initialize + # User modifiable configuration for a service. + end + end + end +end diff --git a/lib/docker/models/service_create_response.rb b/lib/docker/models/service_create_response.rb new file mode 100644 index 0000000..cc15821 --- /dev/null +++ b/lib/docker/models/service_create_response.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Services#create + class ServiceCreateResponse < Docker::Internal::Type::BaseModel + # @!attribute id + # The ID of the created service. + # + # @return [String, nil] + optional :id, String, api_name: :ID + + # @!attribute warnings + # Optional warning message. + # + # FIXME(thaJeztah): this should have "omitempty" in the generated type. + # + # @return [Array, nil] + optional :warnings, Docker::Internal::Type::ArrayOf[String], api_name: :Warnings, nil?: true + + # @!method initialize(id: nil, warnings: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::ServiceCreateResponse} for more details. + # + # contains the information returned to a client on the creation of a new service. + # + # @param id [String] The ID of the created service. + # + # @param warnings [Array, nil] Optional warning message. + end + end +end diff --git a/lib/docker/models/service_delete_params.rb b/lib/docker/models/service_delete_params.rb new file mode 100644 index 0000000..02a3188 --- /dev/null +++ b/lib/docker/models/service_delete_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Services#delete + class ServiceDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/service_inspect_params.rb b/lib/docker/models/service_inspect_params.rb new file mode 100644 index 0000000..ff426a8 --- /dev/null +++ b/lib/docker/models/service_inspect_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Services#inspect_ + class ServiceInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute insert_defaults + # Fill empty fields with default values. + # + # @return [Boolean, nil] + optional :insert_defaults, Docker::Internal::Type::Boolean + + # @!method initialize(insert_defaults: nil, request_options: {}) + # @param insert_defaults [Boolean] Fill empty fields with default values. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/service_list_params.rb b/lib/docker/models/service_list_params.rb new file mode 100644 index 0000000..a259c3a --- /dev/null +++ b/lib/docker/models/service_list_params.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Services#list + class ServiceListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute filters + # A JSON encoded value of the filters (a `map[string][]string`) to process on the + # services list. + # + # Available filters: + # + # - `id=` + # - `label=` + # - `mode=["replicated"|"global"]` + # - `name=` + # + # @return [String, nil] + optional :filters, String + + # @!attribute status + # Include service status, with count of running and desired tasks. + # + # @return [Boolean, nil] + optional :status, Docker::Internal::Type::Boolean + + # @!method initialize(filters: nil, status: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::ServiceListParams} for more details. + # + # @param filters [String] A JSON encoded value of the filters (a `map[string][]string`) to + # + # @param status [Boolean] Include service status, with count of running and desired tasks. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/service_list_response.rb b/lib/docker/models/service_list_response.rb new file mode 100644 index 0000000..cb28f83 --- /dev/null +++ b/lib/docker/models/service_list_response.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Docker + module Models + # @type [Docker::Internal::Type::Converter] + ServiceListResponse = Docker::Internal::Type::ArrayOf[-> { Docker::Service }] + end +end diff --git a/lib/docker/models/spec.rb b/lib/docker/models/spec.rb new file mode 100644 index 0000000..6913653 --- /dev/null +++ b/lib/docker/models/spec.rb @@ -0,0 +1,2266 @@ +# frozen_string_literal: true + +module Docker + module Models + class Spec < Docker::Internal::Type::BaseModel + # @!attribute endpoint_spec + # Properties that can be configured to access and load balance a service. + # + # @return [Docker::Models::Spec::EndpointSpec, nil] + optional :endpoint_spec, -> { Docker::Spec::EndpointSpec }, api_name: :EndpointSpec + + # @!attribute labels + # User-defined key/value metadata. + # + # @return [Hash{Symbol=>String}, nil] + optional :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute mode + # Scheduling mode for the service. + # + # @return [Docker::Models::Spec::Mode, nil] + optional :mode, -> { Docker::Spec::Mode }, api_name: :Mode + + # @!attribute name + # Name of the service. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute networks + # Specifies which networks the service should attach to. + # + # Deprecated: This field is deprecated since v1.44. The Networks field in TaskSpec + # should be used instead. + # + # @return [Array, nil] + optional :networks, -> { Docker::Internal::Type::ArrayOf[Docker::Spec::Network] }, api_name: :Networks + + # @!attribute rollback_config + # Specification for the rollback strategy of the service. + # + # @return [Docker::Models::Spec::RollbackConfig, nil] + optional :rollback_config, -> { Docker::Spec::RollbackConfig }, api_name: :RollbackConfig + + # @!attribute task_template + # User modifiable task configuration. + # + # @return [Docker::Models::Spec::TaskTemplate, nil] + optional :task_template, -> { Docker::Spec::TaskTemplate }, api_name: :TaskTemplate + + # @!attribute update_config + # Specification for the update strategy of the service. + # + # @return [Docker::Models::Spec::UpdateConfig, nil] + optional :update_config, -> { Docker::Spec::UpdateConfig }, api_name: :UpdateConfig + + # @!method initialize(endpoint_spec: nil, labels: nil, mode: nil, name: nil, networks: nil, rollback_config: nil, task_template: nil, update_config: nil) + # Some parameter documentations has been truncated, see {Docker::Models::Spec} for + # more details. + # + # User modifiable configuration for a service. + # + # @param endpoint_spec [Docker::Models::Spec::EndpointSpec] Properties that can be configured to access and load balance a service. + # + # @param labels [Hash{Symbol=>String}] User-defined key/value metadata. + # + # @param mode [Docker::Models::Spec::Mode] Scheduling mode for the service. + # + # @param name [String] Name of the service. + # + # @param networks [Array] Specifies which networks the service should attach to. + # + # @param rollback_config [Docker::Models::Spec::RollbackConfig] Specification for the rollback strategy of the service. + # + # @param task_template [Docker::Models::Spec::TaskTemplate] User modifiable task configuration. + # + # @param update_config [Docker::Models::Spec::UpdateConfig] Specification for the update strategy of the service. + + # @see Docker::Models::Spec#endpoint_spec + class EndpointSpec < Docker::Internal::Type::BaseModel + # @!attribute mode + # The mode of resolution to use for internal load balancing between tasks. + # + # @return [Symbol, Docker::Models::Spec::EndpointSpec::Mode, nil] + optional :mode, enum: -> { Docker::Spec::EndpointSpec::Mode }, api_name: :Mode + + # @!attribute ports + # List of exposed ports that this service is accessible on from the outside. Ports + # can only be provided if `vip` resolution mode is used. + # + # @return [Array, nil] + optional :ports, + -> { Docker::Internal::Type::ArrayOf[Docker::Spec::EndpointSpec::Port] }, + api_name: :Ports + + # @!method initialize(mode: nil, ports: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::EndpointSpec} for more details. + # + # Properties that can be configured to access and load balance a service. + # + # @param mode [Symbol, Docker::Models::Spec::EndpointSpec::Mode] The mode of resolution to use for internal load balancing between tasks. + # + # @param ports [Array] List of exposed ports that this service is accessible on from the + + # The mode of resolution to use for internal load balancing between tasks. + # + # @see Docker::Models::Spec::EndpointSpec#mode + module Mode + extend Docker::Internal::Type::Enum + + VIP = :vip + DNSRR = :dnsrr + + # @!method self.values + # @return [Array] + end + + class Port < Docker::Internal::Type::BaseModel + # @!attribute name + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute protocol + # + # @return [Symbol, Docker::Models::Spec::EndpointSpec::Port::Protocol, nil] + optional :protocol, enum: -> { Docker::Spec::EndpointSpec::Port::Protocol }, api_name: :Protocol + + # @!attribute published_port + # The port on the swarm hosts. + # + # @return [Integer, nil] + optional :published_port, Integer, api_name: :PublishedPort + + # @!attribute publish_mode + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + # + # @return [Symbol, Docker::Models::Spec::EndpointSpec::Port::PublishMode, nil] + optional :publish_mode, + enum: -> { + Docker::Spec::EndpointSpec::Port::PublishMode + }, + api_name: :PublishMode + + # @!attribute target_port + # The port inside the container. + # + # @return [Integer, nil] + optional :target_port, Integer, api_name: :TargetPort + + # @!method initialize(name: nil, protocol: nil, published_port: nil, publish_mode: nil, target_port: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::EndpointSpec::Port} for more details. + # + # @param name [String] + # + # @param protocol [Symbol, Docker::Models::Spec::EndpointSpec::Port::Protocol] + # + # @param published_port [Integer] The port on the swarm hosts. + # + # @param publish_mode [Symbol, Docker::Models::Spec::EndpointSpec::Port::PublishMode] The mode in which port is published. + # + # @param target_port [Integer] The port inside the container. + + # @see Docker::Models::Spec::EndpointSpec::Port#protocol + module Protocol + extend Docker::Internal::Type::Enum + + TCP = :tcp + UDP = :udp + SCTP = :sctp + + # @!method self.values + # @return [Array] + end + + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + # + # @see Docker::Models::Spec::EndpointSpec::Port#publish_mode + module PublishMode + extend Docker::Internal::Type::Enum + + INGRESS = :ingress + HOST = :host + + # @!method self.values + # @return [Array] + end + end + end + + # @see Docker::Models::Spec#mode + class Mode < Docker::Internal::Type::BaseModel + # @!attribute global + # + # @return [Object, nil] + optional :global, Docker::Internal::Type::Unknown, api_name: :Global + + # @!attribute global_job + # The mode used for services which run a task to the completed state on each valid + # node. + # + # @return [Object, nil] + optional :global_job, Docker::Internal::Type::Unknown, api_name: :GlobalJob + + # @!attribute replicated + # + # @return [Docker::Models::Spec::Mode::Replicated, nil] + optional :replicated, -> { Docker::Spec::Mode::Replicated }, api_name: :Replicated + + # @!attribute replicated_job + # The mode used for services with a finite number of tasks that run to a completed + # state. + # + # @return [Docker::Models::Spec::Mode::ReplicatedJob, nil] + optional :replicated_job, -> { Docker::Spec::Mode::ReplicatedJob }, api_name: :ReplicatedJob + + # @!method initialize(global: nil, global_job: nil, replicated: nil, replicated_job: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::Mode} for more details. + # + # Scheduling mode for the service. + # + # @param global [Object] + # + # @param global_job [Object] The mode used for services which run a task to the completed state + # + # @param replicated [Docker::Models::Spec::Mode::Replicated] + # + # @param replicated_job [Docker::Models::Spec::Mode::ReplicatedJob] The mode used for services with a finite number of tasks that run + + # @see Docker::Models::Spec::Mode#replicated + class Replicated < Docker::Internal::Type::BaseModel + # @!attribute replicas + # + # @return [Integer, nil] + optional :replicas, Integer, api_name: :Replicas + + # @!method initialize(replicas: nil) + # @param replicas [Integer] + end + + # @see Docker::Models::Spec::Mode#replicated_job + class ReplicatedJob < Docker::Internal::Type::BaseModel + # @!attribute max_concurrent + # The maximum number of replicas to run simultaneously. + # + # @return [Integer, nil] + optional :max_concurrent, Integer, api_name: :MaxConcurrent + + # @!attribute total_completions + # The total number of replicas desired to reach the Completed state. If unset, + # will default to the value of `MaxConcurrent` + # + # @return [Integer, nil] + optional :total_completions, Integer, api_name: :TotalCompletions + + # @!method initialize(max_concurrent: nil, total_completions: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::Mode::ReplicatedJob} for more details. + # + # The mode used for services with a finite number of tasks that run to a completed + # state. + # + # @param max_concurrent [Integer] The maximum number of replicas to run simultaneously. + # + # @param total_completions [Integer] The total number of replicas desired to reach the Completed + end + end + + class Network < Docker::Internal::Type::BaseModel + # @!attribute aliases + # Discoverable alternate names for the service on this network. + # + # @return [Array, nil] + optional :aliases, Docker::Internal::Type::ArrayOf[String], api_name: :Aliases + + # @!attribute driver_opts + # Driver attachment options for the network target. + # + # @return [Hash{Symbol=>String}, nil] + optional :driver_opts, Docker::Internal::Type::HashOf[String], api_name: :DriverOpts + + # @!attribute target + # The target network for attachment. Must be a network name or ID. + # + # @return [String, nil] + optional :target, String, api_name: :Target + + # @!method initialize(aliases: nil, driver_opts: nil, target: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::Network} for more details. + # + # Specifies how a service should be attached to a particular network. + # + # @param aliases [Array] Discoverable alternate names for the service on this network. + # + # @param driver_opts [Hash{Symbol=>String}] Driver attachment options for the network target. + # + # @param target [String] The target network for attachment. Must be a network name or ID. + end + + # @see Docker::Models::Spec#rollback_config + class RollbackConfig < Docker::Internal::Type::BaseModel + # @!attribute delay + # Amount of time between rollback iterations, in nanoseconds. + # + # @return [Integer, nil] + optional :delay, Integer, api_name: :Delay + + # @!attribute failure_action + # Action to take if an rolled back task fails to run, or stops running during the + # rollback. + # + # @return [Symbol, Docker::Models::Spec::RollbackConfig::FailureAction, nil] + optional :failure_action, + enum: -> { Docker::Spec::RollbackConfig::FailureAction }, + api_name: :FailureAction + + # @!attribute max_failure_ratio + # The fraction of tasks that may fail during a rollback before the failure action + # is invoked, specified as a floating point number between 0 and 1. + # + # @return [Float, nil] + optional :max_failure_ratio, Float, api_name: :MaxFailureRatio + + # @!attribute monitor + # Amount of time to monitor each rolled back task for failures, in nanoseconds. + # + # @return [Integer, nil] + optional :monitor, Integer, api_name: :Monitor + + # @!attribute order + # The order of operations when rolling back a task. Either the old task is shut + # down before the new task is started, or the new task is started before the old + # task is shut down. + # + # @return [Symbol, Docker::Models::Spec::RollbackConfig::Order, nil] + optional :order, enum: -> { Docker::Spec::RollbackConfig::Order }, api_name: :Order + + # @!attribute parallelism + # Maximum number of tasks to be rolled back in one iteration (0 means unlimited + # parallelism). + # + # @return [Integer, nil] + optional :parallelism, Integer, api_name: :Parallelism + + # @!method initialize(delay: nil, failure_action: nil, max_failure_ratio: nil, monitor: nil, order: nil, parallelism: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::RollbackConfig} for more details. + # + # Specification for the rollback strategy of the service. + # + # @param delay [Integer] Amount of time between rollback iterations, in nanoseconds. + # + # @param failure_action [Symbol, Docker::Models::Spec::RollbackConfig::FailureAction] Action to take if an rolled back task fails to run, or stops + # + # @param max_failure_ratio [Float] The fraction of tasks that may fail during a rollback before the + # + # @param monitor [Integer] Amount of time to monitor each rolled back task for failures, in + # + # @param order [Symbol, Docker::Models::Spec::RollbackConfig::Order] The order of operations when rolling back a task. Either the old + # + # @param parallelism [Integer] Maximum number of tasks to be rolled back in one iteration (0 means + + # Action to take if an rolled back task fails to run, or stops running during the + # rollback. + # + # @see Docker::Models::Spec::RollbackConfig#failure_action + module FailureAction + extend Docker::Internal::Type::Enum + + CONTINUE = :continue + PAUSE = :pause + + # @!method self.values + # @return [Array] + end + + # The order of operations when rolling back a task. Either the old task is shut + # down before the new task is started, or the new task is started before the old + # task is shut down. + # + # @see Docker::Models::Spec::RollbackConfig#order + module Order + extend Docker::Internal::Type::Enum + + STOP_FIRST = :"stop-first" + START_FIRST = :"start-first" + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::Spec#task_template + class TaskTemplate < Docker::Internal::Type::BaseModel + # @!attribute container_spec + # Container spec for the service. + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec, nil] + optional :container_spec, -> { Docker::Spec::TaskTemplate::ContainerSpec }, api_name: :ContainerSpec + + # @!attribute force_update + # A counter that triggers an update even if no relevant parameters have been + # changed. + # + # @return [Integer, nil] + optional :force_update, Integer, api_name: :ForceUpdate + + # @!attribute log_driver + # Specifies the log driver to use for tasks created from this spec. If not + # present, the default one for the swarm will be used, finally falling back to the + # engine default if not specified. + # + # @return [Docker::Models::Spec::TaskTemplate::LogDriver, nil] + optional :log_driver, -> { Docker::Spec::TaskTemplate::LogDriver }, api_name: :LogDriver + + # @!attribute network_attachment_spec + # Read-only spec type for non-swarm containers attached to swarm overlay networks. + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + # + # @return [Docker::Models::Spec::TaskTemplate::NetworkAttachmentSpec, nil] + optional :network_attachment_spec, + -> { Docker::Spec::TaskTemplate::NetworkAttachmentSpec }, + api_name: :NetworkAttachmentSpec + + # @!attribute networks + # Specifies which networks the service should attach to. + # + # @return [Array, nil] + optional :networks, + -> { Docker::Internal::Type::ArrayOf[Docker::Spec::TaskTemplate::Network] }, + api_name: :Networks + + # @!attribute placement + # + # @return [Docker::Models::Spec::TaskTemplate::Placement, nil] + optional :placement, -> { Docker::Spec::TaskTemplate::Placement }, api_name: :Placement + + # @!attribute plugin_spec + # Plugin spec for the service. _(Experimental release only.)_ + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + # + # @return [Docker::Models::Spec::TaskTemplate::PluginSpec, nil] + optional :plugin_spec, -> { Docker::Spec::TaskTemplate::PluginSpec }, api_name: :PluginSpec + + # @!attribute resources + # Resource requirements which apply to each individual container created as part + # of the service. + # + # @return [Docker::Models::Spec::TaskTemplate::Resources, nil] + optional :resources, -> { Docker::Spec::TaskTemplate::Resources }, api_name: :Resources + + # @!attribute restart_policy + # Specification for the restart policy which applies to containers created as part + # of this service. + # + # @return [Docker::Models::Spec::TaskTemplate::RestartPolicy, nil] + optional :restart_policy, -> { Docker::Spec::TaskTemplate::RestartPolicy }, api_name: :RestartPolicy + + # @!attribute runtime + # Runtime is the type of runtime specified for the task executor. + # + # @return [String, nil] + optional :runtime, String, api_name: :Runtime + + # @!method initialize(container_spec: nil, force_update: nil, log_driver: nil, network_attachment_spec: nil, networks: nil, placement: nil, plugin_spec: nil, resources: nil, restart_policy: nil, runtime: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate} for more details. + # + # User modifiable task configuration. + # + # @param container_spec [Docker::Models::Spec::TaskTemplate::ContainerSpec] Container spec for the service. + # + # @param force_update [Integer] A counter that triggers an update even if no relevant parameters have + # + # @param log_driver [Docker::Models::Spec::TaskTemplate::LogDriver] Specifies the log driver to use for tasks created from this spec. If + # + # @param network_attachment_spec [Docker::Models::Spec::TaskTemplate::NetworkAttachmentSpec] Read-only spec type for non-swarm containers attached to swarm overlay + # + # @param networks [Array] Specifies which networks the service should attach to. + # + # @param placement [Docker::Models::Spec::TaskTemplate::Placement] + # + # @param plugin_spec [Docker::Models::Spec::TaskTemplate::PluginSpec] Plugin spec for the service. _(Experimental release only.)_ + # + # @param resources [Docker::Models::Spec::TaskTemplate::Resources] Resource requirements which apply to each individual container created + # + # @param restart_policy [Docker::Models::Spec::TaskTemplate::RestartPolicy] Specification for the restart policy which applies to containers + # + # @param runtime [String] Runtime is the type of runtime specified for the task executor. + + # @see Docker::Models::Spec::TaskTemplate#container_spec + class ContainerSpec < Docker::Internal::Type::BaseModel + # @!attribute args + # Arguments to the command. + # + # @return [Array, nil] + optional :args, Docker::Internal::Type::ArrayOf[String], api_name: :Args + + # @!attribute capability_add + # A list of kernel capabilities to add to the default set for the container. + # + # @return [Array, nil] + optional :capability_add, Docker::Internal::Type::ArrayOf[String], api_name: :CapabilityAdd + + # @!attribute capability_drop + # A list of kernel capabilities to drop from the default set for the container. + # + # @return [Array, nil] + optional :capability_drop, Docker::Internal::Type::ArrayOf[String], api_name: :CapabilityDrop + + # @!attribute command + # The command to be run in the image. + # + # @return [Array, nil] + optional :command, Docker::Internal::Type::ArrayOf[String], api_name: :Command + + # @!attribute configs + # Configs contains references to zero or more configs that will be exposed to the + # service. + # + # @return [Array, nil] + optional :configs, + -> { Docker::Internal::Type::ArrayOf[Docker::Spec::TaskTemplate::ContainerSpec::Config] }, + api_name: :Configs + + # @!attribute dir + # The working directory for commands to run in. + # + # @return [String, nil] + optional :dir, String, api_name: :Dir + + # @!attribute dns_config + # Specification for DNS related configurations in resolver configuration file + # (`resolv.conf`). + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::DNSConfig, nil] + optional :dns_config, + -> { + Docker::Spec::TaskTemplate::ContainerSpec::DNSConfig + }, + api_name: :DNSConfig + + # @!attribute env + # A list of environment variables in the form `VAR=value`. + # + # @return [Array, nil] + optional :env, Docker::Internal::Type::ArrayOf[String], api_name: :Env + + # @!attribute groups + # A list of additional groups that the container process will run as. + # + # @return [Array, nil] + optional :groups, Docker::Internal::Type::ArrayOf[String], api_name: :Groups + + # @!attribute health_check + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::HealthCheck, nil] + optional :health_check, + -> { Docker::Spec::TaskTemplate::ContainerSpec::HealthCheck }, + api_name: :HealthCheck + + # @!attribute hostname + # The hostname to use for the container, as a valid + # [RFC 1123](https://tools.ietf.org/html/rfc1123) hostname. + # + # @return [String, nil] + optional :hostname, String, api_name: :Hostname + + # @!attribute hosts + # A list of hostname/IP mappings to add to the container's `hosts` file. The + # format of extra hosts is specified in the + # [hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html) man page: + # + # IP_address canonical_hostname [aliases...] + # + # @return [Array, nil] + optional :hosts, Docker::Internal::Type::ArrayOf[String], api_name: :Hosts + + # @!attribute image + # The image name to use for the container + # + # @return [String, nil] + optional :image, String, api_name: :Image + + # @!attribute init + # Run an init inside the container that forwards signals and reaps processes. This + # field is omitted if empty, and the default (as configured on the daemon) is + # used. + # + # @return [Boolean, nil] + optional :init, Docker::Internal::Type::Boolean, api_name: :Init, nil?: true + + # @!attribute isolation + # Isolation technology of the containers running the service. (Windows only) + # + # @return [Symbol, Docker::Models::Spec::TaskTemplate::ContainerSpec::Isolation, nil] + optional :isolation, + enum: -> { Docker::Spec::TaskTemplate::ContainerSpec::Isolation }, + api_name: :Isolation + + # @!attribute labels + # User-defined key/value data. + # + # @return [Hash{Symbol=>String}, nil] + optional :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute mounts + # Specification for mounts to be added to containers created as part of the + # service. + # + # @return [Array, nil] + optional :mounts, + -> { Docker::Internal::Type::ArrayOf[Docker::Spec::TaskTemplate::ContainerSpec::Mount] }, + api_name: :Mounts + + # @!attribute oom_score_adj + # An integer value containing the score given to the container in order to tune + # OOM killer preferences. + # + # @return [Integer, nil] + optional :oom_score_adj, Integer, api_name: :OomScoreAdj + + # @!attribute open_stdin + # Open `stdin` + # + # @return [Boolean, nil] + optional :open_stdin, Docker::Internal::Type::Boolean, api_name: :OpenStdin + + # @!attribute privileges + # Security options for the container + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges, nil] + optional :privileges, + -> { + Docker::Spec::TaskTemplate::ContainerSpec::Privileges + }, + api_name: :Privileges + + # @!attribute read_only + # Mount the container's root filesystem as read only. + # + # @return [Boolean, nil] + optional :read_only, Docker::Internal::Type::Boolean, api_name: :ReadOnly + + # @!attribute secrets + # Secrets contains references to zero or more secrets that will be exposed to the + # service. + # + # @return [Array, nil] + optional :secrets, + -> { Docker::Internal::Type::ArrayOf[Docker::Spec::TaskTemplate::ContainerSpec::Secret] }, + api_name: :Secrets + + # @!attribute stop_grace_period + # Amount of time to wait for the container to terminate before forcefully killing + # it. + # + # @return [Integer, nil] + optional :stop_grace_period, Integer, api_name: :StopGracePeriod + + # @!attribute stop_signal + # Signal to stop the container. + # + # @return [String, nil] + optional :stop_signal, String, api_name: :StopSignal + + # @!attribute sysctls + # Set kernel namedspaced parameters (sysctls) in the container. The Sysctls option + # on services accepts the same sysctls as the are supported on containers. Note + # that while the same sysctls are supported, no guarantees or checks are made + # about their suitability for a clustered environment, and it's up to the user to + # determine whether a given sysctl will work properly in a Service. + # + # @return [Hash{Symbol=>String}, nil] + optional :sysctls, Docker::Internal::Type::HashOf[String], api_name: :Sysctls + + # @!attribute tty + # Whether a pseudo-TTY should be allocated. + # + # @return [Boolean, nil] + optional :tty, Docker::Internal::Type::Boolean, api_name: :TTY + + # @!attribute ulimits + # A list of resource limits to set in the container. For example: + # `{"Name": "nofile", "Soft": 1024, "Hard": 2048}`" + # + # @return [Array, nil] + optional :ulimits, + -> { Docker::Internal::Type::ArrayOf[Docker::Spec::TaskTemplate::ContainerSpec::Ulimit] }, + api_name: :Ulimits + + # @!attribute user + # The user inside the container. + # + # @return [String, nil] + optional :user, String, api_name: :User + + # @!method initialize(args: nil, capability_add: nil, capability_drop: nil, command: nil, configs: nil, dir: nil, dns_config: nil, env: nil, groups: nil, health_check: nil, hostname: nil, hosts: nil, image: nil, init: nil, isolation: nil, labels: nil, mounts: nil, oom_score_adj: nil, open_stdin: nil, privileges: nil, read_only: nil, secrets: nil, stop_grace_period: nil, stop_signal: nil, sysctls: nil, tty: nil, ulimits: nil, user: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::ContainerSpec} for more details. + # + # Container spec for the service. + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + # + # @param args [Array] Arguments to the command. + # + # @param capability_add [Array] A list of kernel capabilities to add to the default set + # + # @param capability_drop [Array] A list of kernel capabilities to drop from the default set + # + # @param command [Array] The command to be run in the image. + # + # @param configs [Array] Configs contains references to zero or more configs that will be + # + # @param dir [String] The working directory for commands to run in. + # + # @param dns_config [Docker::Models::Spec::TaskTemplate::ContainerSpec::DNSConfig] Specification for DNS related configurations in resolver configuration + # + # @param env [Array] A list of environment variables in the form `VAR=value`. + # + # @param groups [Array] A list of additional groups that the container process will run as. + # + # @param health_check [Docker::Models::Spec::TaskTemplate::ContainerSpec::HealthCheck] A test to perform to check that the container is healthy. + # + # @param hostname [String] The hostname to use for the container, as a valid + # + # @param hosts [Array] A list of hostname/IP mappings to add to the container's `hosts` + # + # @param image [String] The image name to use for the container + # + # @param init [Boolean, nil] Run an init inside the container that forwards signals and reaps + # + # @param isolation [Symbol, Docker::Models::Spec::TaskTemplate::ContainerSpec::Isolation] Isolation technology of the containers running the service. + # + # @param labels [Hash{Symbol=>String}] User-defined key/value data. + # + # @param mounts [Array] Specification for mounts to be added to containers created as part + # + # @param oom_score_adj [Integer] An integer value containing the score given to the container in + # + # @param open_stdin [Boolean] Open `stdin` + # + # @param privileges [Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges] Security options for the container + # + # @param read_only [Boolean] Mount the container's root filesystem as read only. + # + # @param secrets [Array] Secrets contains references to zero or more secrets that will be + # + # @param stop_grace_period [Integer] Amount of time to wait for the container to terminate before + # + # @param stop_signal [String] Signal to stop the container. + # + # @param sysctls [Hash{Symbol=>String}] Set kernel namedspaced parameters (sysctls) in the container. + # + # @param tty [Boolean] Whether a pseudo-TTY should be allocated. + # + # @param ulimits [Array] A list of resource limits to set in the container. For example: `{"Name": "nofil + # + # @param user [String] The user inside the container. + + class Config < Docker::Internal::Type::BaseModel + # @!attribute config_id + # ConfigID represents the ID of the specific config that we're referencing. + # + # @return [String, nil] + optional :config_id, String, api_name: :ConfigID + + # @!attribute config_name + # ConfigName is the name of the config that this references, but this is just + # provided for lookup/display purposes. The config in the reference will be + # identified by its ID. + # + # @return [String, nil] + optional :config_name, String, api_name: :ConfigName + + # @!attribute file + # File represents a specific target that is backed by a file. + # + #


+ # + # > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::Config::File, nil] + optional :file, -> { Docker::Spec::TaskTemplate::ContainerSpec::Config::File }, api_name: :File + + # @!attribute runtime + # Runtime represents a target that is not mounted into the container but is used + # by the task + # + #


+ # + # > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + # + # @return [Object, nil] + optional :runtime, Docker::Internal::Type::Unknown, api_name: :Runtime + + # @!method initialize(config_id: nil, config_name: nil, file: nil, runtime: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::ContainerSpec::Config} for more details. + # + # @param config_id [String] ConfigID represents the ID of the specific config that we're + # + # @param config_name [String] ConfigName is the name of the config that this references, + # + # @param file [Docker::Models::Spec::TaskTemplate::ContainerSpec::Config::File] File represents a specific target that is backed by a file. + # + # @param runtime [Object] Runtime represents a target that is not mounted into the + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Config#file + class File < Docker::Internal::Type::BaseModel + # @!attribute gid + # GID represents the file GID. + # + # @return [String, nil] + optional :gid, String, api_name: :GID + + # @!attribute mode + # Mode represents the FileMode of the file. + # + # @return [Integer, nil] + optional :mode, Integer, api_name: :Mode + + # @!attribute name + # Name represents the final filename in the filesystem. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute uid + # UID represents the file UID. + # + # @return [String, nil] + optional :uid, String, api_name: :UID + + # @!method initialize(gid: nil, mode: nil, name: nil, uid: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::ContainerSpec::Config::File} for more + # details. + # + # File represents a specific target that is backed by a file. + # + #


+ # + # > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + # + # @param gid [String] GID represents the file GID. + # + # @param mode [Integer] Mode represents the FileMode of the file. + # + # @param name [String] Name represents the final filename in the filesystem. + # + # @param uid [String] UID represents the file UID. + end + end + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec#dns_config + class DNSConfig < Docker::Internal::Type::BaseModel + # @!attribute nameservers + # The IP addresses of the name servers. + # + # @return [Array, nil] + optional :nameservers, Docker::Internal::Type::ArrayOf[String], api_name: :Nameservers + + # @!attribute options + # A list of internal resolver variables to be modified (e.g., `debug`, `ndots:3`, + # etc.). + # + # @return [Array, nil] + optional :options, Docker::Internal::Type::ArrayOf[String], api_name: :Options + + # @!attribute search + # A search list for host-name lookup. + # + # @return [Array, nil] + optional :search, Docker::Internal::Type::ArrayOf[String], api_name: :Search + + # @!method initialize(nameservers: nil, options: nil, search: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::ContainerSpec::DNSConfig} for more details. + # + # Specification for DNS related configurations in resolver configuration file + # (`resolv.conf`). + # + # @param nameservers [Array] The IP addresses of the name servers. + # + # @param options [Array] A list of internal resolver variables to be modified (e.g., + # + # @param search [Array] A search list for host-name lookup. + end + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec#health_check + class HealthCheck < Docker::Internal::Type::BaseModel + # @!attribute interval + # The time to wait between checks in nanoseconds. It should be 0 or at least + # 1000000 (1 ms). 0 means inherit. + # + # @return [Integer, nil] + optional :interval, Integer, api_name: :Interval + + # @!attribute retries + # The number of consecutive failures needed to consider a container as unhealthy. + # 0 means inherit. + # + # @return [Integer, nil] + optional :retries, Integer, api_name: :Retries + + # @!attribute start_interval + # The time to wait between checks in nanoseconds during the start period. It + # should be 0 or at least 1000000 (1 ms). 0 means inherit. + # + # @return [Integer, nil] + optional :start_interval, Integer, api_name: :StartInterval + + # @!attribute start_period + # Start period for the container to initialize before starting health-retries + # countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means + # inherit. + # + # @return [Integer, nil] + optional :start_period, Integer, api_name: :StartPeriod + + # @!attribute test_ + # The test to perform. Possible values are: + # + # - `[]` inherit healthcheck from image or parent image + # - `["NONE"]` disable healthcheck + # - `["CMD", args...]` exec arguments directly + # - `["CMD-SHELL", command]` run command with system's default shell + # + # A non-zero exit code indicates a failed healthcheck: + # + # - `0` healthy + # - `1` unhealthy + # - `2` reserved (treated as unhealthy) + # - other values: error running probe + # + # @return [Array, nil] + optional :test_, Docker::Internal::Type::ArrayOf[String], api_name: :Test + + # @!attribute timeout + # The time to wait before considering the check to have hung. It should be 0 or at + # least 1000000 (1 ms). 0 means inherit. + # + # If the health check command does not complete within this timeout, the check is + # considered failed and the health check process is forcibly terminated without a + # graceful shutdown. + # + # @return [Integer, nil] + optional :timeout, Integer, api_name: :Timeout + + # @!method initialize(interval: nil, retries: nil, start_interval: nil, start_period: nil, test_: nil, timeout: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::ContainerSpec::HealthCheck} for more + # details. + # + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + # + # @param interval [Integer] The time to wait between checks in nanoseconds. It should be 0 or at + # + # @param retries [Integer] The number of consecutive failures needed to consider a container as + # + # @param start_interval [Integer] The time to wait between checks in nanoseconds during the start period. + # + # @param start_period [Integer] Start period for the container to initialize before starting + # + # @param test_ [Array] The test to perform. Possible values are: + # + # @param timeout [Integer] The time to wait before considering the check to have hung. It should + end + + # Isolation technology of the containers running the service. (Windows only) + # + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec#isolation + module Isolation + extend Docker::Internal::Type::Enum + + DEFAULT = :default + PROCESS = :process + HYPERV = :hyperv + EMPTY = :"" + + # @!method self.values + # @return [Array] + end + + class Mount < Docker::Internal::Type::BaseModel + # @!attribute bind_options + # Optional configuration for the `bind` type. + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions, nil] + optional :bind_options, + -> { Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions }, + api_name: :BindOptions + + # @!attribute consistency + # The consistency requirement for the mount: `default`, `consistent`, `cached`, or + # `delegated`. + # + # @return [String, nil] + optional :consistency, String, api_name: :Consistency + + # @!attribute image_options + # Optional configuration for the `image` type. + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions, nil] + optional :image_options, + -> { Docker::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions }, + api_name: :ImageOptions + + # @!attribute read_only + # Whether the mount should be read-only. + # + # @return [Boolean, nil] + optional :read_only, Docker::Internal::Type::Boolean, api_name: :ReadOnly + + # @!attribute source + # Mount source (e.g. a volume name, a host path). The source cannot be specified + # when using `Type=tmpfs`. For `Type=bind`, the source path must either exist, or + # the `CreateMountpoint` must be set to `true` to create the source path on the + # host if missing. + # + # For `Type=npipe`, the pipe must exist prior to creating the container. + # + # @return [String, nil] + optional :source, String, api_name: :Source + + # @!attribute target + # Container path. + # + # @return [String, nil] + optional :target, String, api_name: :Target + + # @!attribute tmpfs_options + # Optional configuration for the `tmpfs` type. + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions, nil] + optional :tmpfs_options, + -> { Docker::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions }, + api_name: :TmpfsOptions + + # @!attribute type + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + # + # @return [Symbol, Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::Type, nil] + optional :type, + enum: -> { + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type + }, + api_name: :Type + + # @!attribute volume_options + # Optional configuration for the `volume` type. + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions, nil] + optional :volume_options, + -> { Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions }, + api_name: :VolumeOptions + + # @!method initialize(bind_options: nil, consistency: nil, image_options: nil, read_only: nil, source: nil, target: nil, tmpfs_options: nil, type: nil, volume_options: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount} for more details. + # + # @param bind_options [Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions] Optional configuration for the `bind` type. + # + # @param consistency [String] The consistency requirement for the mount: `default`, `consistent`, `cached`, or + # + # @param image_options [Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions] Optional configuration for the `image` type. + # + # @param read_only [Boolean] Whether the mount should be read-only. + # + # @param source [String] Mount source (e.g. a volume name, a host path). The source cannot be + # + # @param target [String] Container path. + # + # @param tmpfs_options [Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions] Optional configuration for the `tmpfs` type. + # + # @param type [Symbol, Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::Type] The mount type. Available types: + # + # @param volume_options [Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions] Optional configuration for the `volume` type. + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount#bind_options + class BindOptions < Docker::Internal::Type::BaseModel + # @!attribute create_mountpoint + # Create mount point on host if missing + # + # @return [Boolean, nil] + optional :create_mountpoint, Docker::Internal::Type::Boolean, api_name: :CreateMountpoint + + # @!attribute non_recursive + # Disable recursive bind mount. + # + # @return [Boolean, nil] + optional :non_recursive, Docker::Internal::Type::Boolean, api_name: :NonRecursive + + # @!attribute propagation + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + # + # @return [Symbol, Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation, nil] + optional :propagation, + enum: -> { + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation + }, + api_name: :Propagation + + # @!attribute read_only_force_recursive + # Raise an error if the mount cannot be made recursively read-only. + # + # @return [Boolean, nil] + optional :read_only_force_recursive, + Docker::Internal::Type::Boolean, + api_name: :ReadOnlyForceRecursive + + # @!attribute read_only_non_recursive + # Make the mount non-recursively read-only, but still leave the mount recursive + # (unless NonRecursive is set to `true` in conjunction). + # + # Added in v1.44, before that version all read-only mounts were non-recursive by + # default. To match the previous behaviour this will default to `true` for clients + # on versions prior to v1.44. + # + # @return [Boolean, nil] + optional :read_only_non_recursive, + Docker::Internal::Type::Boolean, + api_name: :ReadOnlyNonRecursive + + # @!method initialize(create_mountpoint: nil, non_recursive: nil, propagation: nil, read_only_force_recursive: nil, read_only_non_recursive: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions} for more + # details. + # + # Optional configuration for the `bind` type. + # + # @param create_mountpoint [Boolean] Create mount point on host if missing + # + # @param non_recursive [Boolean] Disable recursive bind mount. + # + # @param propagation [Symbol, Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation] A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + # + # @param read_only_force_recursive [Boolean] Raise an error if the mount cannot be made recursively read-only. + # + # @param read_only_non_recursive [Boolean] Make the mount non-recursively read-only, but still leave the mount recursive + + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + # + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions#propagation + module Propagation + extend Docker::Internal::Type::Enum + + PRIVATE = :private + RPRIVATE = :rprivate + SHARED = :shared + RSHARED = :rshared + SLAVE = :slave + RSLAVE = :rslave + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount#image_options + class ImageOptions < Docker::Internal::Type::BaseModel + # @!attribute subpath + # Source path inside the image. Must be relative without any back traversals. + # + # @return [String, nil] + optional :subpath, String, api_name: :Subpath + + # @!method initialize(subpath: nil) + # Optional configuration for the `image` type. + # + # @param subpath [String] Source path inside the image. Must be relative without any back traversals. + end + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount#tmpfs_options + class TmpfsOptions < Docker::Internal::Type::BaseModel + # @!attribute mode + # The permission mode for the tmpfs mount in an integer. The value must not be in + # octal format (e.g. 755) but rather the decimal representation of the octal value + # (e.g. 493). + # + # @return [Integer, nil] + optional :mode, Integer, api_name: :Mode + + # @!attribute options + # The options to be passed to the tmpfs mount. An array of arrays. Flag options + # should be provided as 1-length arrays. Other types should be provided as as + # 2-length arrays, where the first item is the key and the second the value. + # + # @return [Array>, nil] + optional :options, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::ArrayOf[String]], + api_name: :Options + + # @!attribute size_bytes + # The size for the tmpfs mount in bytes. + # + # @return [Integer, nil] + optional :size_bytes, Integer, api_name: :SizeBytes + + # @!method initialize(mode: nil, options: nil, size_bytes: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions} for + # more details. + # + # Optional configuration for the `tmpfs` type. + # + # @param mode [Integer] The permission mode for the tmpfs mount in an integer. + # + # @param options [Array>] The options to be passed to the tmpfs mount. An array of arrays. + # + # @param size_bytes [Integer] The size for the tmpfs mount in bytes. + end + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + # + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount#type + module Type + extend Docker::Internal::Type::Enum + + BIND = :bind + CLUSTER = :cluster + IMAGE = :image + NPIPE = :npipe + TMPFS = :tmpfs + VOLUME = :volume + + # @!method self.values + # @return [Array] + end + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount#volume_options + class VolumeOptions < Docker::Internal::Type::BaseModel + # @!attribute driver_config + # Map of driver specific options + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig, nil] + optional :driver_config, + -> { Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig }, + api_name: :DriverConfig + + # @!attribute labels + # User-defined key/value metadata. + # + # @return [Hash{Symbol=>String}, nil] + optional :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute no_copy + # Populate volume with data from the target. + # + # @return [Boolean, nil] + optional :no_copy, Docker::Internal::Type::Boolean, api_name: :NoCopy + + # @!attribute subpath + # Source path inside the volume. Must be relative without any back traversals. + # + # @return [String, nil] + optional :subpath, String, api_name: :Subpath + + # @!method initialize(driver_config: nil, labels: nil, no_copy: nil, subpath: nil) + # Optional configuration for the `volume` type. + # + # @param driver_config [Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig] Map of driver specific options + # + # @param labels [Hash{Symbol=>String}] User-defined key/value metadata. + # + # @param no_copy [Boolean] Populate volume with data from the target. + # + # @param subpath [String] Source path inside the volume. Must be relative without any back traversals. + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions#driver_config + class DriverConfig < Docker::Internal::Type::BaseModel + # @!attribute name + # Name of the driver to use to create the volume. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute options + # key/value map of driver specific options. + # + # @return [Hash{Symbol=>String}, nil] + optional :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!method initialize(name: nil, options: nil) + # Map of driver specific options + # + # @param name [String] Name of the driver to use to create the volume. + # + # @param options [Hash{Symbol=>String}] key/value map of driver specific options. + end + end + end + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec#privileges + class Privileges < Docker::Internal::Type::BaseModel + # @!attribute app_armor + # Options for configuring AppArmor on the container + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor, nil] + optional :app_armor, + -> { Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor }, + api_name: :AppArmor + + # @!attribute credential_spec + # CredentialSpec for managed service account (Windows only) + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec, nil] + optional :credential_spec, + -> { Docker::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec }, + api_name: :CredentialSpec + + # @!attribute no_new_privileges + # Configuration of the no_new_privs bit in the container + # + # @return [Boolean, nil] + optional :no_new_privileges, Docker::Internal::Type::Boolean, api_name: :NoNewPrivileges + + # @!attribute seccomp + # Options for configuring seccomp on the container + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp, nil] + optional :seccomp, + -> { Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp }, + api_name: :Seccomp + + # @!attribute se_linux_context + # SELinux labels of the container + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext, nil] + optional :se_linux_context, + -> { Docker::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext }, + api_name: :SELinuxContext + + # @!method initialize(app_armor: nil, credential_spec: nil, no_new_privileges: nil, seccomp: nil, se_linux_context: nil) + # Security options for the container + # + # @param app_armor [Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor] Options for configuring AppArmor on the container + # + # @param credential_spec [Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec] CredentialSpec for managed service account (Windows only) + # + # @param no_new_privileges [Boolean] Configuration of the no_new_privs bit in the container + # + # @param seccomp [Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp] Options for configuring seccomp on the container + # + # @param se_linux_context [Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext] SELinux labels of the container + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges#app_armor + class AppArmor < Docker::Internal::Type::BaseModel + # @!attribute mode + # + # @return [Symbol, Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::Mode, nil] + optional :mode, + enum: -> { Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::Mode }, + api_name: :Mode + + # @!method initialize(mode: nil) + # Options for configuring AppArmor on the container + # + # @param mode [Symbol, Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::Mode] + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor#mode + module Mode + extend Docker::Internal::Type::Enum + + DEFAULT = :default + DISABLED = :disabled + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges#credential_spec + class CredentialSpec < Docker::Internal::Type::BaseModel + # @!attribute config + # Load credential spec from a Swarm Config with the given ID. The specified config + # must also be present in the Configs field with the Runtime property set. + # + #


+ # + # > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, and + # > `CredentialSpec.Config` are mutually exclusive. + # + # @return [String, nil] + optional :config, String, api_name: :Config + + # @!attribute file + # Load credential spec from this file. The file is read by the daemon, and must be + # present in the `CredentialSpecs` subdirectory in the docker data directory, + # which defaults to `C:\ProgramData\Docker\` on Windows. + # + # For example, specifying `spec.json` loads + # `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + # + #


+ # + # > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, and + # > `CredentialSpec.Config` are mutually exclusive. + # + # @return [String, nil] + optional :file, String, api_name: :File + + # @!attribute registry + # Load credential spec from this value in the Windows registry. The specified + # registry value must be located in: + # + # `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\CredentialSpecs` + # + #


+ # + # > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, and + # > `CredentialSpec.Config` are mutually exclusive. + # + # @return [String, nil] + optional :registry, String, api_name: :Registry + + # @!method initialize(config: nil, file: nil, registry: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec} + # for more details. + # + # CredentialSpec for managed service account (Windows only) + # + # @param config [String] Load credential spec from a Swarm Config with the given ID. + # + # @param file [String] Load credential spec from this file. The file is read by + # + # @param registry [String] Load credential spec from this value in the Windows + end + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges#seccomp + class Seccomp < Docker::Internal::Type::BaseModel + # @!attribute mode + # + # @return [Symbol, Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::Mode, nil] + optional :mode, + enum: -> { Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::Mode }, + api_name: :Mode + + # @!attribute profile + # The custom seccomp profile as a json object + # + # @return [String, nil] + optional :profile, String, api_name: :Profile + + # @!method initialize(mode: nil, profile: nil) + # Options for configuring seccomp on the container + # + # @param mode [Symbol, Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::Mode] + # + # @param profile [String] The custom seccomp profile as a json object + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp#mode + module Mode + extend Docker::Internal::Type::Enum + + DEFAULT = :default + UNCONFINED = :unconfined + CUSTOM = :custom + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges#se_linux_context + class SeLinuxContext < Docker::Internal::Type::BaseModel + # @!attribute disable + # Disable SELinux + # + # @return [Boolean, nil] + optional :disable, Docker::Internal::Type::Boolean, api_name: :Disable + + # @!attribute level + # SELinux level label + # + # @return [String, nil] + optional :level, String, api_name: :Level + + # @!attribute role + # SELinux role label + # + # @return [String, nil] + optional :role, String, api_name: :Role + + # @!attribute type + # SELinux type label + # + # @return [String, nil] + optional :type, String, api_name: :Type + + # @!attribute user + # SELinux user label + # + # @return [String, nil] + optional :user, String, api_name: :User + + # @!method initialize(disable: nil, level: nil, role: nil, type: nil, user: nil) + # SELinux labels of the container + # + # @param disable [Boolean] Disable SELinux + # + # @param level [String] SELinux level label + # + # @param role [String] SELinux role label + # + # @param type [String] SELinux type label + # + # @param user [String] SELinux user label + end + end + + class Secret < Docker::Internal::Type::BaseModel + # @!attribute file + # File represents a specific target that is backed by a file. + # + # @return [Docker::Models::Spec::TaskTemplate::ContainerSpec::Secret::File, nil] + optional :file, -> { Docker::Spec::TaskTemplate::ContainerSpec::Secret::File }, api_name: :File + + # @!attribute secret_id + # SecretID represents the ID of the specific secret that we're referencing. + # + # @return [String, nil] + optional :secret_id, String, api_name: :SecretID + + # @!attribute secret_name + # SecretName is the name of the secret that this references, but this is just + # provided for lookup/display purposes. The secret in the reference will be + # identified by its ID. + # + # @return [String, nil] + optional :secret_name, String, api_name: :SecretName + + # @!method initialize(file: nil, secret_id: nil, secret_name: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::ContainerSpec::Secret} for more details. + # + # @param file [Docker::Models::Spec::TaskTemplate::ContainerSpec::Secret::File] File represents a specific target that is backed by a file. + # + # @param secret_id [String] SecretID represents the ID of the specific secret that we're + # + # @param secret_name [String] SecretName is the name of the secret that this references, + + # @see Docker::Models::Spec::TaskTemplate::ContainerSpec::Secret#file + class File < Docker::Internal::Type::BaseModel + # @!attribute gid + # GID represents the file GID. + # + # @return [String, nil] + optional :gid, String, api_name: :GID + + # @!attribute mode + # Mode represents the FileMode of the file. + # + # @return [Integer, nil] + optional :mode, Integer, api_name: :Mode + + # @!attribute name + # Name represents the final filename in the filesystem. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute uid + # UID represents the file UID. + # + # @return [String, nil] + optional :uid, String, api_name: :UID + + # @!method initialize(gid: nil, mode: nil, name: nil, uid: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::ContainerSpec::Secret::File} for more + # details. + # + # File represents a specific target that is backed by a file. + # + # @param gid [String] GID represents the file GID. + # + # @param mode [Integer] Mode represents the FileMode of the file. + # + # @param name [String] Name represents the final filename in the filesystem. + # + # @param uid [String] UID represents the file UID. + end + end + + class Ulimit < Docker::Internal::Type::BaseModel + # @!attribute hard + # Hard limit + # + # @return [Integer, nil] + optional :hard, Integer, api_name: :Hard + + # @!attribute name + # Name of ulimit + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute soft + # Soft limit + # + # @return [Integer, nil] + optional :soft, Integer, api_name: :Soft + + # @!method initialize(hard: nil, name: nil, soft: nil) + # @param hard [Integer] Hard limit + # + # @param name [String] Name of ulimit + # + # @param soft [Integer] Soft limit + end + end + + # @see Docker::Models::Spec::TaskTemplate#log_driver + class LogDriver < Docker::Internal::Type::BaseModel + # @!attribute name + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute options + # + # @return [Hash{Symbol=>String}, nil] + optional :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!method initialize(name: nil, options: nil) + # Specifies the log driver to use for tasks created from this spec. If not + # present, the default one for the swarm will be used, finally falling back to the + # engine default if not specified. + # + # @param name [String] + # @param options [Hash{Symbol=>String}] + end + + # @see Docker::Models::Spec::TaskTemplate#network_attachment_spec + class NetworkAttachmentSpec < Docker::Internal::Type::BaseModel + # @!attribute container_id + # ID of the container represented by this task + # + # @return [String, nil] + optional :container_id, String, api_name: :ContainerID + + # @!method initialize(container_id: nil) + # Read-only spec type for non-swarm containers attached to swarm overlay networks. + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + # + # @param container_id [String] ID of the container represented by this task + end + + class Network < Docker::Internal::Type::BaseModel + # @!attribute aliases + # Discoverable alternate names for the service on this network. + # + # @return [Array, nil] + optional :aliases, Docker::Internal::Type::ArrayOf[String], api_name: :Aliases + + # @!attribute driver_opts + # Driver attachment options for the network target. + # + # @return [Hash{Symbol=>String}, nil] + optional :driver_opts, Docker::Internal::Type::HashOf[String], api_name: :DriverOpts + + # @!attribute target + # The target network for attachment. Must be a network name or ID. + # + # @return [String, nil] + optional :target, String, api_name: :Target + + # @!method initialize(aliases: nil, driver_opts: nil, target: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::Network} for more details. + # + # Specifies how a service should be attached to a particular network. + # + # @param aliases [Array] Discoverable alternate names for the service on this network. + # + # @param driver_opts [Hash{Symbol=>String}] Driver attachment options for the network target. + # + # @param target [String] The target network for attachment. Must be a network name or ID. + end + + # @see Docker::Models::Spec::TaskTemplate#placement + class Placement < Docker::Internal::Type::BaseModel + # @!attribute constraints + # An array of constraint expressions to limit the set of nodes where a task can be + # scheduled. Constraint expressions can either use a _match_ (`==`) or _exclude_ + # (`!=`) rule. Multiple constraints find nodes that satisfy every expression (AND + # match). Constraints can match node or Docker Engine labels as follows: + # + # | node attribute | matches | example | + # | -------------------- | ------------------------------ | --------------------------------------------- | + # | `node.id` | Node ID | `node.id==2ivku8v2gvtg4` | + # | `node.hostname` | Node hostname | `node.hostname!=node-2` | + # | `node.role` | Node role (`manager`/`worker`) | `node.role==manager` | + # | `node.platform.os` | Node operating system | `node.platform.os==windows` | + # | `node.platform.arch` | Node architecture | `node.platform.arch==x86_64` | + # | `node.labels` | User-defined node labels | `node.labels.security==high` | + # | `engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-24.04` | + # + # `engine.labels` apply to Docker Engine labels like operating system, drivers, + # etc. Swarm administrators add `node.labels` for operational purposes by using + # the [`node update endpoint`](#operation/NodeUpdate). + # + # @return [Array, nil] + optional :constraints, Docker::Internal::Type::ArrayOf[String], api_name: :Constraints + + # @!attribute max_replicas + # Maximum number of replicas for per node (default value is 0, which is unlimited) + # + # @return [Integer, nil] + optional :max_replicas, Integer, api_name: :MaxReplicas + + # @!attribute platforms + # Platforms stores all the platforms that the service's image can run on. This + # field is used in the platform filter for scheduling. If empty, then the platform + # filter is off, meaning there are no scheduling restrictions. + # + # @return [Array, nil] + optional :platforms, + -> { Docker::Internal::Type::ArrayOf[Docker::Spec::TaskTemplate::Placement::Platform] }, + api_name: :Platforms + + # @!attribute preferences + # Preferences provide a way to make the scheduler aware of factors such as + # topology. They are provided in order from highest to lowest precedence. + # + # @return [Array, nil] + optional :preferences, + -> { Docker::Internal::Type::ArrayOf[Docker::Spec::TaskTemplate::Placement::Preference] }, + api_name: :Preferences + + # @!method initialize(constraints: nil, max_replicas: nil, platforms: nil, preferences: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::Placement} for more details. + # + # @param constraints [Array] An array of constraint expressions to limit the set of nodes where + # + # @param max_replicas [Integer] Maximum number of replicas for per node (default value is 0, which + # + # @param platforms [Array] Platforms stores all the platforms that the service's image can + # + # @param preferences [Array] Preferences provide a way to make the scheduler aware of factors + + class Platform < Docker::Internal::Type::BaseModel + # @!attribute architecture + # Architecture represents the hardware architecture (for example, `x86_64`). + # + # @return [String, nil] + optional :architecture, String, api_name: :Architecture + + # @!attribute os + # OS represents the Operating System (for example, `linux` or `windows`). + # + # @return [String, nil] + optional :os, String, api_name: :OS + + # @!method initialize(architecture: nil, os: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::Placement::Platform} for more details. + # + # Platform represents the platform (Arch/OS). + # + # @param architecture [String] Architecture represents the hardware architecture (for example, + # + # @param os [String] OS represents the Operating System (for example, `linux` or `windows`). + end + + class Preference < Docker::Internal::Type::BaseModel + # @!attribute spread + # + # @return [Docker::Models::Spec::TaskTemplate::Placement::Preference::Spread, nil] + optional :spread, + -> { + Docker::Spec::TaskTemplate::Placement::Preference::Spread + }, + api_name: :Spread + + # @!method initialize(spread: nil) + # @param spread [Docker::Models::Spec::TaskTemplate::Placement::Preference::Spread] + + # @see Docker::Models::Spec::TaskTemplate::Placement::Preference#spread + class Spread < Docker::Internal::Type::BaseModel + # @!attribute spread_descriptor + # label descriptor, such as `engine.labels.az`. + # + # @return [String, nil] + optional :spread_descriptor, String, api_name: :SpreadDescriptor + + # @!method initialize(spread_descriptor: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::Placement::Preference::Spread} for more + # details. + # + # @param spread_descriptor [String] label descriptor, such as `engine.labels.az`. + end + end + end + + # @see Docker::Models::Spec::TaskTemplate#plugin_spec + class PluginSpec < Docker::Internal::Type::BaseModel + # @!attribute disabled + # Disable the plugin once scheduled. + # + # @return [Boolean, nil] + optional :disabled, Docker::Internal::Type::Boolean, api_name: :Disabled + + # @!attribute name + # The name or 'alias' to use for the plugin. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute plugin_privilege + # + # @return [Array, nil] + optional :plugin_privilege, + -> { + Docker::Internal::Type::ArrayOf[Docker::Spec::TaskTemplate::PluginSpec::PluginPrivilege] + }, + api_name: :PluginPrivilege + + # @!attribute remote + # The plugin image reference to use. + # + # @return [String, nil] + optional :remote, String, api_name: :Remote + + # @!method initialize(disabled: nil, name: nil, plugin_privilege: nil, remote: nil) + # Plugin spec for the service. _(Experimental release only.)_ + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + # + # @param disabled [Boolean] Disable the plugin once scheduled. + # + # @param name [String] The name or 'alias' to use for the plugin. + # + # @param plugin_privilege [Array] + # + # @param remote [String] The plugin image reference to use. + + class PluginPrivilege < Docker::Internal::Type::BaseModel + # @!attribute description + # + # @return [String, nil] + optional :description, String, api_name: :Description + + # @!attribute name + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute value + # + # @return [Array, nil] + optional :value, Docker::Internal::Type::ArrayOf[String], api_name: :Value + + # @!method initialize(description: nil, name: nil, value: nil) + # Describes a permission the user has to accept upon installing the plugin. + # + # @param description [String] + # @param name [String] + # @param value [Array] + end + end + + # @see Docker::Models::Spec::TaskTemplate#resources + class Resources < Docker::Internal::Type::BaseModel + # @!attribute limits + # An object describing a limit on resources which can be requested by a task. + # + # @return [Docker::Models::Spec::TaskTemplate::Resources::Limits, nil] + optional :limits, -> { Docker::Spec::TaskTemplate::Resources::Limits }, api_name: :Limits + + # @!attribute memory_swappiness + # Tune the service's containers' memory swappiness (0 to 100). If not specified, + # defaults to the containers' OS' default, generally 60, or whatever value was + # predefined in the image. Set to -1 to unset a previously set value. + # + # @return [Integer, nil] + optional :memory_swappiness, Integer, api_name: :MemorySwappiness, nil?: true + + # @!attribute reservations + # An object describing the resources which can be advertised by a node and + # requested by a task. + # + # @return [Docker::Models::Spec::TaskTemplate::Resources::Reservations, nil] + optional :reservations, + -> { Docker::Spec::TaskTemplate::Resources::Reservations }, + api_name: :Reservations + + # @!attribute swap_bytes + # Amount of swap in bytes - can only be used together with a memory limit. If not + # specified, the default behaviour is to grant a swap space twice as big as the + # memory limit. Set to -1 to enable unlimited swap. + # + # @return [Integer, nil] + optional :swap_bytes, Integer, api_name: :SwapBytes, nil?: true + + # @!method initialize(limits: nil, memory_swappiness: nil, reservations: nil, swap_bytes: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::Resources} for more details. + # + # Resource requirements which apply to each individual container created as part + # of the service. + # + # @param limits [Docker::Models::Spec::TaskTemplate::Resources::Limits] An object describing a limit on resources which can be requested by a task. + # + # @param memory_swappiness [Integer, nil] Tune the service's containers' memory swappiness (0 to 100). + # + # @param reservations [Docker::Models::Spec::TaskTemplate::Resources::Reservations] An object describing the resources which can be advertised by a node and + # + # @param swap_bytes [Integer, nil] Amount of swap in bytes - can only be used together with a memory limit. + + # @see Docker::Models::Spec::TaskTemplate::Resources#limits + class Limits < Docker::Internal::Type::BaseModel + # @!attribute memory_bytes + # + # @return [Integer, nil] + optional :memory_bytes, Integer, api_name: :MemoryBytes + + # @!attribute nano_cpus + # + # @return [Integer, nil] + optional :nano_cpus, Integer, api_name: :NanoCPUs + + # @!attribute pids + # Limits the maximum number of PIDs in the container. Set `0` for unlimited. + # + # @return [Integer, nil] + optional :pids, Integer, api_name: :Pids + + # @!method initialize(memory_bytes: nil, nano_cpus: nil, pids: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::Resources::Limits} for more details. + # + # An object describing a limit on resources which can be requested by a task. + # + # @param memory_bytes [Integer] + # + # @param nano_cpus [Integer] + # + # @param pids [Integer] Limits the maximum number of PIDs in the container. Set `0` for unlimited. + end + + # @see Docker::Models::Spec::TaskTemplate::Resources#reservations + class Reservations < Docker::Internal::Type::BaseModel + # @!attribute generic_resources + # User-defined resources can be either Integer resources (e.g, `SSD=3`) or String + # resources (e.g, `GPU=UUID1`). + # + # @return [Array, nil] + optional :generic_resources, + -> { + Docker::Internal::Type::ArrayOf[Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource] + }, + api_name: :GenericResources + + # @!attribute memory_bytes + # + # @return [Integer, nil] + optional :memory_bytes, Integer, api_name: :MemoryBytes + + # @!attribute nano_cpus + # + # @return [Integer, nil] + optional :nano_cpus, Integer, api_name: :NanoCPUs + + # @!method initialize(generic_resources: nil, memory_bytes: nil, nano_cpus: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::Resources::Reservations} for more details. + # + # An object describing the resources which can be advertised by a node and + # requested by a task. + # + # @param generic_resources [Array] User-defined resources can be either Integer resources (e.g, `SSD=3`) or + # + # @param memory_bytes [Integer] + # + # @param nano_cpus [Integer] + + class GenericResource < Docker::Internal::Type::BaseModel + # @!attribute discrete_resource_spec + # + # @return [Docker::Models::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec, nil] + optional :discrete_resource_spec, + -> { + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec + }, + api_name: :DiscreteResourceSpec + + # @!attribute named_resource_spec + # + # @return [Docker::Models::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec, nil] + optional :named_resource_spec, + -> { + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec + }, + api_name: :NamedResourceSpec + + # @!method initialize(discrete_resource_spec: nil, named_resource_spec: nil) + # @param discrete_resource_spec [Docker::Models::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec] + # @param named_resource_spec [Docker::Models::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec] + + # @see Docker::Models::Spec::TaskTemplate::Resources::Reservations::GenericResource#discrete_resource_spec + class DiscreteResourceSpec < Docker::Internal::Type::BaseModel + # @!attribute kind + # + # @return [String, nil] + optional :kind, String, api_name: :Kind + + # @!attribute value + # + # @return [Integer, nil] + optional :value, Integer, api_name: :Value + + # @!method initialize(kind: nil, value: nil) + # @param kind [String] + # @param value [Integer] + end + + # @see Docker::Models::Spec::TaskTemplate::Resources::Reservations::GenericResource#named_resource_spec + class NamedResourceSpec < Docker::Internal::Type::BaseModel + # @!attribute kind + # + # @return [String, nil] + optional :kind, String, api_name: :Kind + + # @!attribute value + # + # @return [String, nil] + optional :value, String, api_name: :Value + + # @!method initialize(kind: nil, value: nil) + # @param kind [String] + # @param value [String] + end + end + end + end + + # @see Docker::Models::Spec::TaskTemplate#restart_policy + class RestartPolicy < Docker::Internal::Type::BaseModel + # @!attribute condition + # Condition for restart. + # + # @return [Symbol, Docker::Models::Spec::TaskTemplate::RestartPolicy::Condition, nil] + optional :condition, + enum: -> { Docker::Spec::TaskTemplate::RestartPolicy::Condition }, + api_name: :Condition + + # @!attribute delay + # Delay between restart attempts. + # + # @return [Integer, nil] + optional :delay, Integer, api_name: :Delay + + # @!attribute max_attempts + # Maximum attempts to restart a given container before giving up (default value is + # 0, which is ignored). + # + # @return [Integer, nil] + optional :max_attempts, Integer, api_name: :MaxAttempts + + # @!attribute window + # Windows is the time window used to evaluate the restart policy (default value is + # 0, which is unbounded). + # + # @return [Integer, nil] + optional :window, Integer, api_name: :Window + + # @!method initialize(condition: nil, delay: nil, max_attempts: nil, window: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::TaskTemplate::RestartPolicy} for more details. + # + # Specification for the restart policy which applies to containers created as part + # of this service. + # + # @param condition [Symbol, Docker::Models::Spec::TaskTemplate::RestartPolicy::Condition] Condition for restart. + # + # @param delay [Integer] Delay between restart attempts. + # + # @param max_attempts [Integer] Maximum attempts to restart a given container before giving up + # + # @param window [Integer] Windows is the time window used to evaluate the restart policy + + # Condition for restart. + # + # @see Docker::Models::Spec::TaskTemplate::RestartPolicy#condition + module Condition + extend Docker::Internal::Type::Enum + + NONE = :none + ON_FAILURE = :"on-failure" + ANY = :any + + # @!method self.values + # @return [Array] + end + end + end + + # @see Docker::Models::Spec#update_config + class UpdateConfig < Docker::Internal::Type::BaseModel + # @!attribute delay + # Amount of time between updates, in nanoseconds. + # + # @return [Integer, nil] + optional :delay, Integer, api_name: :Delay + + # @!attribute failure_action + # Action to take if an updated task fails to run, or stops running during the + # update. + # + # @return [Symbol, Docker::Models::Spec::UpdateConfig::FailureAction, nil] + optional :failure_action, + enum: -> { + Docker::Spec::UpdateConfig::FailureAction + }, + api_name: :FailureAction + + # @!attribute max_failure_ratio + # The fraction of tasks that may fail during an update before the failure action + # is invoked, specified as a floating point number between 0 and 1. + # + # @return [Float, nil] + optional :max_failure_ratio, Float, api_name: :MaxFailureRatio + + # @!attribute monitor + # Amount of time to monitor each updated task for failures, in nanoseconds. + # + # @return [Integer, nil] + optional :monitor, Integer, api_name: :Monitor + + # @!attribute order + # The order of operations when rolling out an updated task. Either the old task is + # shut down before the new task is started, or the new task is started before the + # old task is shut down. + # + # @return [Symbol, Docker::Models::Spec::UpdateConfig::Order, nil] + optional :order, enum: -> { Docker::Spec::UpdateConfig::Order }, api_name: :Order + + # @!attribute parallelism + # Maximum number of tasks to be updated in one iteration (0 means unlimited + # parallelism). + # + # @return [Integer, nil] + optional :parallelism, Integer, api_name: :Parallelism + + # @!method initialize(delay: nil, failure_action: nil, max_failure_ratio: nil, monitor: nil, order: nil, parallelism: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Spec::UpdateConfig} for more details. + # + # Specification for the update strategy of the service. + # + # @param delay [Integer] Amount of time between updates, in nanoseconds. + # + # @param failure_action [Symbol, Docker::Models::Spec::UpdateConfig::FailureAction] Action to take if an updated task fails to run, or stops running + # + # @param max_failure_ratio [Float] The fraction of tasks that may fail during an update before the + # + # @param monitor [Integer] Amount of time to monitor each updated task for failures, in + # + # @param order [Symbol, Docker::Models::Spec::UpdateConfig::Order] The order of operations when rolling out an updated task. Either + # + # @param parallelism [Integer] Maximum number of tasks to be updated in one iteration (0 means + + # Action to take if an updated task fails to run, or stops running during the + # update. + # + # @see Docker::Models::Spec::UpdateConfig#failure_action + module FailureAction + extend Docker::Internal::Type::Enum + + CONTINUE = :continue + PAUSE = :pause + ROLLBACK = :rollback + + # @!method self.values + # @return [Array] + end + + # The order of operations when rolling out an updated task. Either the old task is + # shut down before the new task is started, or the new task is started before the + # old task is shut down. + # + # @see Docker::Models::Spec::UpdateConfig#order + module Order + extend Docker::Internal::Type::Enum + + STOP_FIRST = :"stop-first" + START_FIRST = :"start-first" + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/docker/models/summary.rb b/lib/docker/models/summary.rb new file mode 100644 index 0000000..dc0aecb --- /dev/null +++ b/lib/docker/models/summary.rb @@ -0,0 +1,752 @@ +# frozen_string_literal: true + +module Docker + module Models + class Summary < Docker::Internal::Type::BaseModel + # @!attribute command + # Command to run when starting the container + # + # @return [String, nil] + optional :command, String, api_name: :Command + + # @!attribute created + # Date and time at which the container was created as a Unix timestamp (number of + # seconds since EPOCH). + # + # @return [Integer, nil] + optional :created, Integer, api_name: :Created + + # @!attribute health + # Summary of health status + # + # Added in v1.52, before that version all container summary not include Health. + # After this attribute introduced, it includes containers with no health checks + # configured, or containers that are not running with none + # + # @return [Docker::Models::Summary::Health, nil] + optional :health, -> { Docker::Summary::Health }, api_name: :Health + + # @!attribute host_config + # Summary of host-specific runtime information of the container. This is a reduced + # set of information in the container's "HostConfig" as available in the container + # "inspect" response. + # + # @return [Docker::Models::Summary::HostConfig, nil] + optional :host_config, -> { Docker::Summary::HostConfig }, api_name: :HostConfig + + # @!attribute id + # The ID of this container as a 128-bit (64-character) hexadecimal string (32 + # bytes). + # + # @return [String, nil] + optional :id, String, api_name: :Id + + # @!attribute image + # The name or ID of the image used to create the container. + # + # This field shows the image reference as was specified when creating the + # container, which can be in its canonical form (e.g., + # `docker.io/library/ubuntu:latest` or + # `docker.io/library/ubuntu@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782`), + # short form (e.g., `ubuntu:latest`)), or the ID(-prefix) of the image (e.g., + # `72297848456d`). + # + # The content of this field can be updated at runtime if the image used to create + # the container is untagged, in which case the field is updated to contain the the + # image ID (digest) it was resolved to in its canonical, non-truncated form (e.g., + # `sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782`). + # + # @return [String, nil] + optional :image, String, api_name: :Image + + # @!attribute image_id + # The ID (digest) of the image that this container was created from. + # + # @return [String, nil] + optional :image_id, String, api_name: :ImageID + + # @!attribute image_manifest_descriptor + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + # + # @return [Docker::Models::Summary::ImageManifestDescriptor, nil] + optional :image_manifest_descriptor, + -> { Docker::Summary::ImageManifestDescriptor }, + api_name: :ImageManifestDescriptor + + # @!attribute labels + # User-defined key/value metadata. + # + # @return [Hash{Symbol=>String}, nil] + optional :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute mounts + # List of mounts used by the container. + # + # @return [Array, nil] + optional :mounts, -> { Docker::Internal::Type::ArrayOf[Docker::Summary::Mount] }, api_name: :Mounts + + # @!attribute names + # The names associated with this container. Most containers have a single name, + # but when using legacy "links", the container can have multiple names. + # + # For historic reasons, names are prefixed with a forward-slash (`/`). + # + # @return [Array, nil] + optional :names, Docker::Internal::Type::ArrayOf[String], api_name: :Names + + # @!attribute network_settings + # Summary of the container's network settings + # + # @return [Docker::Models::Summary::NetworkSettings, nil] + optional :network_settings, -> { Docker::Summary::NetworkSettings }, api_name: :NetworkSettings + + # @!attribute ports + # Port-mappings for the container. + # + # @return [Array, nil] + optional :ports, -> { Docker::Internal::Type::ArrayOf[Docker::Summary::Port] }, api_name: :Ports + + # @!attribute size_root_fs + # The total size of all files in the read-only layers from the image that the + # container uses. These layers can be shared between containers. + # + # This field is omitted by default, and only set when size is requested in the API + # request. + # + # @return [Integer, nil] + optional :size_root_fs, Integer, api_name: :SizeRootFs, nil?: true + + # @!attribute size_rw + # The size of files that have been created or changed by this container. + # + # This field is omitted by default, and only set when size is requested in the API + # request. + # + # @return [Integer, nil] + optional :size_rw, Integer, api_name: :SizeRw, nil?: true + + # @!attribute state + # The state of this container. + # + # @return [Symbol, Docker::Models::Summary::State, nil] + optional :state, enum: -> { Docker::Summary::State }, api_name: :State + + # @!attribute status + # Additional human-readable status of this container (e.g. `Exit 0`) + # + # @return [String, nil] + optional :status, String, api_name: :Status + + # @!method initialize(command: nil, created: nil, health: nil, host_config: nil, id: nil, image: nil, image_id: nil, image_manifest_descriptor: nil, labels: nil, mounts: nil, names: nil, network_settings: nil, ports: nil, size_root_fs: nil, size_rw: nil, state: nil, status: nil) + # Some parameter documentations has been truncated, see {Docker::Models::Summary} + # for more details. + # + # @param command [String] Command to run when starting the container + # + # @param created [Integer] Date and time at which the container was created as a Unix timestamp + # + # @param health [Docker::Models::Summary::Health] Summary of health status + # + # @param host_config [Docker::Models::Summary::HostConfig] Summary of host-specific runtime information of the container. This + # + # @param id [String] The ID of this container as a 128-bit (64-character) hexadecimal string (32 byte + # + # @param image [String] The name or ID of the image used to create the container. + # + # @param image_id [String] The ID (digest) of the image that this container was created from. + # + # @param image_manifest_descriptor [Docker::Models::Summary::ImageManifestDescriptor] A descriptor struct containing digest, media type, and size, as defined in + # + # @param labels [Hash{Symbol=>String}] User-defined key/value metadata. + # + # @param mounts [Array] List of mounts used by the container. + # + # @param names [Array] The names associated with this container. Most containers have a single + # + # @param network_settings [Docker::Models::Summary::NetworkSettings] Summary of the container's network settings + # + # @param ports [Array] Port-mappings for the container. + # + # @param size_root_fs [Integer, nil] The total size of all files in the read-only layers from the image + # + # @param size_rw [Integer, nil] The size of files that have been created or changed by this container. + # + # @param state [Symbol, Docker::Models::Summary::State] The state of this container. + # + # @param status [String] Additional human-readable status of this container (e.g. `Exit 0`) + + # @see Docker::Models::Summary#health + class Health < Docker::Internal::Type::BaseModel + # @!attribute failing_streak + # FailingStreak is the number of consecutive failures + # + # @return [Integer, nil] + optional :failing_streak, Integer, api_name: :FailingStreak + + # @!attribute status + # the health status of the container + # + # @return [Symbol, Docker::Models::Summary::Health::Status, nil] + optional :status, enum: -> { Docker::Summary::Health::Status }, api_name: :Status + + # @!method initialize(failing_streak: nil, status: nil) + # Summary of health status + # + # Added in v1.52, before that version all container summary not include Health. + # After this attribute introduced, it includes containers with no health checks + # configured, or containers that are not running with none + # + # @param failing_streak [Integer] FailingStreak is the number of consecutive failures + # + # @param status [Symbol, Docker::Models::Summary::Health::Status] the health status of the container + + # the health status of the container + # + # @see Docker::Models::Summary::Health#status + module Status + extend Docker::Internal::Type::Enum + + NONE = :none + STARTING = :starting + HEALTHY = :healthy + UNHEALTHY = :unhealthy + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::Summary#host_config + class HostConfig < Docker::Internal::Type::BaseModel + # @!attribute annotations + # Arbitrary key-value metadata attached to the container. + # + # @return [Hash{Symbol=>String}, nil] + optional :annotations, Docker::Internal::Type::HashOf[String], api_name: :Annotations, nil?: true + + # @!attribute network_mode + # Networking mode (`host`, `none`, `container:`) or name of the primary + # network the container is using. + # + # This field is primarily for backward compatibility. The container can be + # connected to multiple networks for which information can be found in the + # `NetworkSettings.Networks` field, which enumerates settings per network. + # + # @return [String, nil] + optional :network_mode, String, api_name: :NetworkMode + + # @!method initialize(annotations: nil, network_mode: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Summary::HostConfig} for more details. + # + # Summary of host-specific runtime information of the container. This is a reduced + # set of information in the container's "HostConfig" as available in the container + # "inspect" response. + # + # @param annotations [Hash{Symbol=>String}, nil] Arbitrary key-value metadata attached to the container. + # + # @param network_mode [String] Networking mode (`host`, `none`, `container:`) or name of the + end + + # @see Docker::Models::Summary#image_manifest_descriptor + class ImageManifestDescriptor < Docker::Internal::Type::BaseModel + # @!attribute annotations + # Arbitrary metadata relating to the targeted content. + # + # @return [Hash{Symbol=>String}, nil] + optional :annotations, Docker::Internal::Type::HashOf[String], nil?: true + + # @!attribute artifact_type + # ArtifactType is the IANA media type of this artifact. + # + # @return [String, nil] + optional :artifact_type, String, api_name: :artifactType, nil?: true + + # @!attribute data + # Data is an embedding of the targeted content. This is encoded as a base64 string + # when marshalled to JSON (automatically, by encoding/json). If present, Data can + # be used directly to avoid fetching the targeted content. + # + # @return [String, nil] + optional :data, String, nil?: true + + # @!attribute digest + # The digest of the targeted content. + # + # @return [String, nil] + optional :digest, String + + # @!attribute media_type + # The media type of the object this schema refers to. + # + # @return [String, nil] + optional :media_type, String, api_name: :mediaType + + # @!attribute platform + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + # + # @return [Docker::Models::Summary::ImageManifestDescriptor::Platform, nil] + optional :platform, -> { Docker::Summary::ImageManifestDescriptor::Platform }, nil?: true + + # @!attribute size + # The size in bytes of the blob. + # + # @return [Integer, nil] + optional :size, Integer + + # @!attribute urls + # List of URLs from which this object MAY be downloaded. + # + # @return [Array, nil] + optional :urls, Docker::Internal::Type::ArrayOf[String], nil?: true + + # @!method initialize(annotations: nil, artifact_type: nil, data: nil, digest: nil, media_type: nil, platform: nil, size: nil, urls: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Summary::ImageManifestDescriptor} for more details. + # + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + # + # @param annotations [Hash{Symbol=>String}, nil] Arbitrary metadata relating to the targeted content. + # + # @param artifact_type [String, nil] ArtifactType is the IANA media type of this artifact. + # + # @param data [String, nil] Data is an embedding of the targeted content. This is encoded as a base64 + # + # @param digest [String] The digest of the targeted content. + # + # @param media_type [String] The media type of the object this schema refers to. + # + # @param platform [Docker::Models::Summary::ImageManifestDescriptor::Platform, nil] Describes the platform which the image in the manifest runs on, as defined + # + # @param size [Integer] The size in bytes of the blob. + # + # @param urls [Array, nil] List of URLs from which this object MAY be downloaded. + + # @see Docker::Models::Summary::ImageManifestDescriptor#platform + class Platform < Docker::Internal::Type::BaseModel + # @!attribute architecture + # The CPU architecture, for example `amd64` or `ppc64`. + # + # @return [String, nil] + optional :architecture, String + + # @!attribute os + # The operating system, for example `linux` or `windows`. + # + # @return [String, nil] + optional :os, String + + # @!attribute os_features + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + # + # @return [Array, nil] + optional :os_features, Docker::Internal::Type::ArrayOf[String], api_name: :"os.features" + + # @!attribute os_version + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + # + # @return [String, nil] + optional :os_version, String, api_name: :"os.version" + + # @!attribute variant + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + # + # @return [String, nil] + optional :variant, String + + # @!method initialize(architecture: nil, os: nil, os_features: nil, os_version: nil, variant: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Summary::ImageManifestDescriptor::Platform} for more details. + # + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + # + # @param architecture [String] The CPU architecture, for example `amd64` or `ppc64`. + # + # @param os [String] The operating system, for example `linux` or `windows`. + # + # @param os_features [Array] Optional field specifying an array of strings, each listing a required + # + # @param os_version [String] Optional field specifying the operating system version, for example on + # + # @param variant [String] Optional field specifying a variant of the CPU, for example `v7` to + end + end + + class Mount < Docker::Internal::Type::BaseModel + # @!attribute destination + # Destination is the path relative to the container root (`/`) where the `Source` + # is mounted inside the container. + # + # @return [String, nil] + optional :destination, String, api_name: :Destination + + # @!attribute driver + # Driver is the volume driver used to create the volume (if it is a volume). + # + # @return [String, nil] + optional :driver, String, api_name: :Driver + + # @!attribute mode + # Mode is a comma separated list of options supplied by the user when creating the + # bind/volume mount. + # + # The default is platform-specific (`"z"` on Linux, empty on Windows). + # + # @return [String, nil] + optional :mode, String, api_name: :Mode + + # @!attribute name + # Name is the name reference to the underlying data defined by `Source` e.g., the + # volume name. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute propagation + # Propagation describes how mounts are propagated from the host into the mount + # point, and vice-versa. Refer to the + # [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + # for details. This field is not used on Windows. + # + # @return [String, nil] + optional :propagation, String, api_name: :Propagation + + # @!attribute rw + # Whether the mount is mounted writable (read-write). + # + # @return [Boolean, nil] + optional :rw, Docker::Internal::Type::Boolean, api_name: :RW + + # @!attribute source + # Source location of the mount. + # + # For volumes, this contains the storage location of the volume (within + # `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains the + # source (host) part of the bind-mount. For `tmpfs` mount points, this field is + # empty. + # + # @return [String, nil] + optional :source, String, api_name: :Source + + # @!attribute type + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + # + # @return [Symbol, Docker::Models::Summary::Mount::Type, nil] + optional :type, enum: -> { Docker::Summary::Mount::Type }, api_name: :Type + + # @!method initialize(destination: nil, driver: nil, mode: nil, name: nil, propagation: nil, rw: nil, source: nil, type: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Summary::Mount} for more details. + # + # MountPoint represents a mount point configuration inside the container. This is + # used for reporting the mountpoints in use by a container. + # + # @param destination [String] Destination is the path relative to the container root (`/`) where + # + # @param driver [String] Driver is the volume driver used to create the volume (if it is a volume). + # + # @param mode [String] Mode is a comma separated list of options supplied by the user when + # + # @param name [String] Name is the name reference to the underlying data defined by `Source` + # + # @param propagation [String] Propagation describes how mounts are propagated from the host into the + # + # @param rw [Boolean] Whether the mount is mounted writable (read-write). + # + # @param source [String] Source location of the mount. + # + # @param type [Symbol, Docker::Models::Summary::Mount::Type] The mount type. Available types: + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + # + # @see Docker::Models::Summary::Mount#type + module Type + extend Docker::Internal::Type::Enum + + BIND = :bind + CLUSTER = :cluster + IMAGE = :image + NPIPE = :npipe + TMPFS = :tmpfs + VOLUME = :volume + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::Summary#network_settings + class NetworkSettings < Docker::Internal::Type::BaseModel + # @!attribute networks + # Summary of network-settings for each network the container is attached to. + # + # @return [Hash{Symbol=>Docker::Models::Summary::NetworkSettings::Network}, nil] + optional :networks, + -> { Docker::Internal::Type::HashOf[Docker::Summary::NetworkSettings::Network] }, + api_name: :Networks + + # @!method initialize(networks: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Summary::NetworkSettings} for more details. + # + # Summary of the container's network settings + # + # @param networks [Hash{Symbol=>Docker::Models::Summary::NetworkSettings::Network}] Summary of network-settings for each network the container is + + class Network < Docker::Internal::Type::BaseModel + # @!attribute aliases + # + # @return [Array, nil] + optional :aliases, Docker::Internal::Type::ArrayOf[String], api_name: :Aliases + + # @!attribute dns_names + # List of all DNS names an endpoint has on a specific network. This list is based + # on the container name, network aliases, container short ID, and hostname. + # + # These DNS names are non-fully qualified but can contain several dots. You can + # get fully qualified DNS names by appending `.`. For instance, if + # container name is `my.ctr` and the network is named `testnet`, `DNSNames` will + # contain `my.ctr` and the FQDN will be `my.ctr.testnet`. + # + # @return [Array, nil] + optional :dns_names, Docker::Internal::Type::ArrayOf[String], api_name: :DNSNames + + # @!attribute driver_opts + # DriverOpts is a mapping of driver options and values. These options are passed + # directly to the driver and are driver specific. + # + # @return [Hash{Symbol=>String}, nil] + optional :driver_opts, Docker::Internal::Type::HashOf[String], api_name: :DriverOpts, nil?: true + + # @!attribute endpoint_id + # Unique ID for the service endpoint in a Sandbox. + # + # @return [String, nil] + optional :endpoint_id, String, api_name: :EndpointID + + # @!attribute gateway + # Gateway address for this network. + # + # @return [String, nil] + optional :gateway, String, api_name: :Gateway + + # @!attribute global_i_pv6_address + # Global IPv6 address. + # + # @return [String, nil] + optional :global_i_pv6_address, String, api_name: :GlobalIPv6Address + + # @!attribute global_i_pv6_prefix_len + # Mask length of the global IPv6 address. + # + # @return [Integer, nil] + optional :global_i_pv6_prefix_len, Integer, api_name: :GlobalIPv6PrefixLen + + # @!attribute gw_priority + # This property determines which endpoint will provide the default gateway for a + # container. The endpoint with the highest priority will be used. If multiple + # endpoints have the same priority, endpoints are lexicographically sorted based + # on their network name, and the one that sorts first is picked. + # + # @return [Integer, nil] + optional :gw_priority, Integer, api_name: :GwPriority + + # @!attribute ip_address + # IPv4 address. + # + # @return [String, nil] + optional :ip_address, String, api_name: :IPAddress + + # @!attribute ipam_config + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + # + # @return [Docker::Models::Summary::NetworkSettings::Network::IpamConfig, nil] + optional :ipam_config, + -> { Docker::Summary::NetworkSettings::Network::IpamConfig }, + api_name: :IPAMConfig, + nil?: true + + # @!attribute ip_prefix_len + # Mask length of the IPv4 address. + # + # @return [Integer, nil] + optional :ip_prefix_len, Integer, api_name: :IPPrefixLen + + # @!attribute i_pv6_gateway + # IPv6 gateway address. + # + # @return [String, nil] + optional :i_pv6_gateway, String, api_name: :IPv6Gateway + + # @!attribute links + # + # @return [Array, nil] + optional :links, Docker::Internal::Type::ArrayOf[String], api_name: :Links + + # @!attribute mac_address + # MAC address for the endpoint on this network. The network driver might ignore + # this parameter. + # + # @return [String, nil] + optional :mac_address, String, api_name: :MacAddress + + # @!attribute network_id + # Unique ID of the network. + # + # @return [String, nil] + optional :network_id, String, api_name: :NetworkID + + # @!method initialize(aliases: nil, dns_names: nil, driver_opts: nil, endpoint_id: nil, gateway: nil, global_i_pv6_address: nil, global_i_pv6_prefix_len: nil, gw_priority: nil, ip_address: nil, ipam_config: nil, ip_prefix_len: nil, i_pv6_gateway: nil, links: nil, mac_address: nil, network_id: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Summary::NetworkSettings::Network} for more details. + # + # Configuration for a network endpoint. + # + # @param aliases [Array] + # + # @param dns_names [Array] List of all DNS names an endpoint has on a specific network. This + # + # @param driver_opts [Hash{Symbol=>String}, nil] DriverOpts is a mapping of driver options and values. These options + # + # @param endpoint_id [String] Unique ID for the service endpoint in a Sandbox. + # + # @param gateway [String] Gateway address for this network. + # + # @param global_i_pv6_address [String] Global IPv6 address. + # + # @param global_i_pv6_prefix_len [Integer] Mask length of the global IPv6 address. + # + # @param gw_priority [Integer] This property determines which endpoint will provide the default + # + # @param ip_address [String] IPv4 address. + # + # @param ipam_config [Docker::Models::Summary::NetworkSettings::Network::IpamConfig, nil] EndpointIPAMConfig represents an endpoint's IPAM configuration. + # + # @param ip_prefix_len [Integer] Mask length of the IPv4 address. + # + # @param i_pv6_gateway [String] IPv6 gateway address. + # + # @param links [Array] + # + # @param mac_address [String] MAC address for the endpoint on this network. The network driver might ignore th + # + # @param network_id [String] Unique ID of the network. + + # @see Docker::Models::Summary::NetworkSettings::Network#ipam_config + class IpamConfig < Docker::Internal::Type::BaseModel + # @!attribute i_pv4_address + # + # @return [String, nil] + optional :i_pv4_address, String, api_name: :IPv4Address + + # @!attribute i_pv6_address + # + # @return [String, nil] + optional :i_pv6_address, String, api_name: :IPv6Address + + # @!attribute link_local_ips + # + # @return [Array, nil] + optional :link_local_ips, Docker::Internal::Type::ArrayOf[String], api_name: :LinkLocalIPs + + # @!method initialize(i_pv4_address: nil, i_pv6_address: nil, link_local_ips: nil) + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + # + # @param i_pv4_address [String] + # @param i_pv6_address [String] + # @param link_local_ips [Array] + end + end + end + + class Port < Docker::Internal::Type::BaseModel + # @!attribute private_port + # Port on the container + # + # @return [Integer] + required :private_port, Integer, api_name: :PrivatePort + + # @!attribute type + # + # @return [Symbol, Docker::Models::Summary::Port::Type] + required :type, enum: -> { Docker::Summary::Port::Type }, api_name: :Type + + # @!attribute ip + # Host IP address that the container's port is mapped to + # + # @return [String, nil] + optional :ip, String, api_name: :IP + + # @!attribute public_port + # Port exposed on the host + # + # @return [Integer, nil] + optional :public_port, Integer, api_name: :PublicPort + + # @!method initialize(private_port:, type:, ip: nil, public_port: nil) + # Describes a port-mapping between the container and the host. + # + # @param private_port [Integer] Port on the container + # + # @param type [Symbol, Docker::Models::Summary::Port::Type] + # + # @param ip [String] Host IP address that the container's port is mapped to + # + # @param public_port [Integer] Port exposed on the host + + # @see Docker::Models::Summary::Port#type + module Type + extend Docker::Internal::Type::Enum + + TCP = :tcp + UDP = :udp + SCTP = :sctp + + # @!method self.values + # @return [Array] + end + end + + # The state of this container. + # + # @see Docker::Models::Summary#state + module State + extend Docker::Internal::Type::Enum + + CREATED = :created + RUNNING = :running + PAUSED = :paused + RESTARTING = :restarting + EXITED = :exited + REMOVING = :removing + DEAD = :dead + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/docker/models/system_info_params.rb b/lib/docker/models/system_info_params.rb new file mode 100644 index 0000000..e9d7ebe --- /dev/null +++ b/lib/docker/models/system_info_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::System#info + class SystemInfoParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/system_info_response.rb b/lib/docker/models/system_info_response.rb new file mode 100644 index 0000000..3470678 --- /dev/null +++ b/lib/docker/models/system_info_response.rb @@ -0,0 +1,1863 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::System#info + class SystemInfoResponse < Docker::Internal::Type::BaseModel + # @!attribute architecture + # Hardware architecture of the host, as returned by the operating system. This is + # equivalent to the output of `uname -m` on Linux. + # + # Unlike `Arch` (from `/version`), this reports the machine's native architecture, + # which can differ from the Go runtime architecture when running a binary compiled + # for a different architecture (for example, a 32-bit binary running on 64-bit + # hardware). + # + # @return [String, nil] + optional :architecture, String, api_name: :Architecture + + # @!attribute cdi_spec_dirs + # List of directories where (Container Device Interface) CDI specifications are + # located. + # + # These specifications define vendor-specific modifications to an OCI runtime + # specification for a container being created. + # + # An empty list indicates that CDI device injection is disabled. + # + # Note that since using CDI device injection requires the daemon to have + # experimental enabled. For non-experimental daemons an empty list will always be + # returned. + # + # @return [Array, nil] + optional :cdi_spec_dirs, Docker::Internal::Type::ArrayOf[String], api_name: :CDISpecDirs + + # @!attribute cgroup_driver + # The driver to use for managing cgroups. + # + # @return [Symbol, Docker::Models::SystemInfoResponse::CgroupDriver, nil] + optional :cgroup_driver, + enum: -> { Docker::Models::SystemInfoResponse::CgroupDriver }, + api_name: :CgroupDriver + + # @!attribute cgroup_version + # The version of the cgroup. + # + # @return [Symbol, Docker::Models::SystemInfoResponse::CgroupVersion, nil] + optional :cgroup_version, + enum: -> { Docker::Models::SystemInfoResponse::CgroupVersion }, + api_name: :CgroupVersion + + # @!attribute containerd + # Information for connecting to the containerd instance that is used by the + # daemon. This is included for debugging purposes only. + # + # @return [Docker::Models::SystemInfoResponse::Containerd, nil] + optional :containerd, + -> { Docker::Models::SystemInfoResponse::Containerd }, + api_name: :Containerd, + nil?: true + + # @!attribute containerd_commit + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + # + # @return [Docker::Models::SystemInfoResponse::ContainerdCommit, nil] + optional :containerd_commit, + -> { Docker::Models::SystemInfoResponse::ContainerdCommit }, + api_name: :ContainerdCommit + + # @!attribute containers + # Total number of containers on the host. + # + # @return [Integer, nil] + optional :containers, Integer, api_name: :Containers + + # @!attribute containers_paused + # Number of containers with status `"paused"`. + # + # @return [Integer, nil] + optional :containers_paused, Integer, api_name: :ContainersPaused + + # @!attribute containers_running + # Number of containers with status `"running"`. + # + # @return [Integer, nil] + optional :containers_running, Integer, api_name: :ContainersRunning + + # @!attribute containers_stopped + # Number of containers with status `"stopped"`. + # + # @return [Integer, nil] + optional :containers_stopped, Integer, api_name: :ContainersStopped + + # @!attribute cpu_cfs_period + # Indicates if CPU CFS(Completely Fair Scheduler) period is supported by the host. + # + # @return [Boolean, nil] + optional :cpu_cfs_period, Docker::Internal::Type::Boolean, api_name: :CpuCfsPeriod + + # @!attribute cpu_cfs_quota + # Indicates if CPU CFS(Completely Fair Scheduler) quota is supported by the host. + # + # @return [Boolean, nil] + optional :cpu_cfs_quota, Docker::Internal::Type::Boolean, api_name: :CpuCfsQuota + + # @!attribute cpu_set + # Indicates if CPUsets (cpuset.cpus, cpuset.mems) are supported by the host. + # + # See [cpuset(7)](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt) + # + # @return [Boolean, nil] + optional :cpu_set, Docker::Internal::Type::Boolean, api_name: :CPUSet + + # @!attribute cpu_shares + # Indicates if CPU Shares limiting is supported by the host. + # + # @return [Boolean, nil] + optional :cpu_shares, Docker::Internal::Type::Boolean, api_name: :CPUShares + + # @!attribute debug + # Indicates if the daemon is running in debug-mode / with debug-level logging + # enabled. + # + # @return [Boolean, nil] + optional :debug, Docker::Internal::Type::Boolean, api_name: :Debug + + # @!attribute default_address_pools + # List of custom default address pools for local networks, which can be specified + # in the daemon.json file or dockerd option. + # + # Example: a Base "10.10.0.0/16" with Size 24 will define the set of 256 + # 10.10.[0-255].0/24 address pools. + # + # @return [Array, nil] + optional :default_address_pools, + -> { Docker::Internal::Type::ArrayOf[Docker::Models::SystemInfoResponse::DefaultAddressPool] }, + api_name: :DefaultAddressPools + + # @!attribute default_runtime + # Name of the default OCI runtime that is used when starting containers. + # + # The default can be overridden per-container at create time. + # + # @return [String, nil] + optional :default_runtime, String, api_name: :DefaultRuntime + + # @!attribute discovered_devices + # List of devices discovered by device drivers. + # + # Each device includes information about its source driver, kind, name, and + # additional driver-specific attributes. + # + # @return [Array, nil] + optional :discovered_devices, + -> { Docker::Internal::Type::ArrayOf[Docker::Models::SystemInfoResponse::DiscoveredDevice] }, + api_name: :DiscoveredDevices + + # @!attribute docker_root_dir + # Root directory of persistent Docker state. + # + # Defaults to `/var/lib/docker` on Linux, and `C:\ProgramData\docker` on Windows. + # + # @return [String, nil] + optional :docker_root_dir, String, api_name: :DockerRootDir + + # @!attribute driver + # Name of the storage driver in use. + # + # @return [String, nil] + optional :driver, String, api_name: :Driver + + # @!attribute driver_status + # Information specific to the storage driver, provided as "label" / "value" pairs. + # + # This information is provided by the storage driver, and formatted in a way + # consistent with the output of `docker info` on the command line. + # + #


+ # + # > **Note**: The information returned in this field, including the formatting of + # > values and labels, should not be considered stable, and may change without + # > notice. + # + # @return [Array>, nil] + optional :driver_status, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::ArrayOf[String]], + api_name: :DriverStatus + + # @!attribute experimental_build + # Indicates if experimental features are enabled on the daemon. + # + # @return [Boolean, nil] + optional :experimental_build, Docker::Internal::Type::Boolean, api_name: :ExperimentalBuild + + # @!attribute firewall_backend + # Information about the daemon's firewalling configuration. + # + # This field is currently only used on Linux, and omitted on other platforms. + # + # @return [Docker::Models::SystemInfoResponse::FirewallBackend, nil] + optional :firewall_backend, + -> { Docker::Models::SystemInfoResponse::FirewallBackend }, + api_name: :FirewallBackend, + nil?: true + + # @!attribute generic_resources + # User-defined resources can be either Integer resources (e.g, `SSD=3`) or String + # resources (e.g, `GPU=UUID1`). + # + # @return [Array, nil] + optional :generic_resources, + -> { Docker::Internal::Type::ArrayOf[Docker::Models::SystemInfoResponse::GenericResource] }, + api_name: :GenericResources + + # @!attribute http_proxy + # HTTP-proxy configured for the daemon. This value is obtained from the + # [`HTTP_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + # environment variable. Credentials + # ([user info component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in + # the proxy URL are masked in the API response. + # + # Containers do not automatically inherit this configuration. + # + # @return [String, nil] + optional :http_proxy, String, api_name: :HttpProxy + + # @!attribute https_proxy + # HTTPS-proxy configured for the daemon. This value is obtained from the + # [`HTTPS_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + # environment variable. Credentials + # ([user info component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in + # the proxy URL are masked in the API response. + # + # Containers do not automatically inherit this configuration. + # + # @return [String, nil] + optional :https_proxy, String, api_name: :HttpsProxy + + # @!attribute id + # Unique identifier of the daemon. + # + #


+ # + # > **Note**: The format of the ID itself is not part of the API, and should not + # > be considered stable. + # + # @return [String, nil] + optional :id, String, api_name: :ID + + # @!attribute images + # Total number of images on the host. + # + # Both _tagged_ and _untagged_ (dangling) images are counted. + # + # @return [Integer, nil] + optional :images, Integer, api_name: :Images + + # @!attribute index_server_address + # Address / URL of the index server that is used for image search, and as a + # default for user authentication for Docker Hub and Docker Cloud. + # + # @return [String, nil] + optional :index_server_address, String, api_name: :IndexServerAddress + + # @!attribute init_binary + # Name and, optional, path of the `docker-init` binary. + # + # If the path is omitted, the daemon searches the host's `$PATH` for the binary + # and uses the first result. + # + # @return [String, nil] + optional :init_binary, String, api_name: :InitBinary + + # @!attribute init_commit + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + # + # @return [Docker::Models::SystemInfoResponse::InitCommit, nil] + optional :init_commit, -> { Docker::Models::SystemInfoResponse::InitCommit }, api_name: :InitCommit + + # @!attribute i_pv4_forwarding + # Indicates IPv4 forwarding is enabled. + # + # @return [Boolean, nil] + optional :i_pv4_forwarding, Docker::Internal::Type::Boolean, api_name: :IPv4Forwarding + + # @!attribute isolation + # Represents the isolation technology to use as a default for containers. The + # supported values are platform-specific. + # + # If no isolation value is specified on daemon start, on Windows client, the + # default is `hyperv`, and on Windows server, the default is `process`. + # + # This option is currently not used on other platforms. + # + # @return [Symbol, Docker::Models::SystemInfoResponse::Isolation, nil] + optional :isolation, enum: -> { Docker::Models::SystemInfoResponse::Isolation }, api_name: :Isolation + + # @!attribute kernel_version + # Kernel version of the host. + # + # On Linux, this information obtained from `uname`. On Windows this information is + # queried from the HKEY*LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows + # NT\\CurrentVersion\\ registry value, for example *"10.0 14393 + # (14393.1198.amd64fre.rs1*release_sec.170427-1353)"*. + # + # @return [String, nil] + optional :kernel_version, String, api_name: :KernelVersion + + # @!attribute labels + # User-defined labels (key/value metadata) as set on the daemon. + # + #


+ # + # > **Note**: When part of a Swarm, nodes can both have _daemon_ labels, set + # > through the daemon configuration, and _node_ labels, set from a manager node + # > in the Swarm. Node labels are not included in this field. Node labels can be + # > retrieved using the `/nodes/(id)` endpoint on a manager node in the Swarm. + # + # @return [Array, nil] + optional :labels, Docker::Internal::Type::ArrayOf[String], api_name: :Labels + + # @!attribute live_restore_enabled + # Indicates if live restore is enabled. + # + # If enabled, containers are kept running when the daemon is shutdown or upon + # daemon start if running containers are detected. + # + # @return [Boolean, nil] + optional :live_restore_enabled, Docker::Internal::Type::Boolean, api_name: :LiveRestoreEnabled + + # @!attribute logging_driver + # The logging driver to use as a default for new containers. + # + # @return [String, nil] + optional :logging_driver, String, api_name: :LoggingDriver + + # @!attribute memory_limit + # Indicates if the host has memory limit support enabled. + # + # @return [Boolean, nil] + optional :memory_limit, Docker::Internal::Type::Boolean, api_name: :MemoryLimit + + # @!attribute mem_total + # Total amount of physical memory available on the host, in bytes. + # + # @return [Integer, nil] + optional :mem_total, Integer, api_name: :MemTotal + + # @!attribute name + # Hostname of the host. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute ncpu + # The number of logical CPUs usable by the daemon. + # + # The number of available CPUs is checked by querying the operating system when + # the daemon starts. Changes to operating system CPU allocation after the daemon + # is started are not reflected. + # + # @return [Integer, nil] + optional :ncpu, Integer, api_name: :NCPU + + # @!attribute n_events_listener + # Number of event listeners subscribed. + # + # @return [Integer, nil] + optional :n_events_listener, Integer, api_name: :NEventsListener + + # @!attribute n_fd + # The total number of file Descriptors in use by the daemon process. + # + # This information is only returned if debug-mode is enabled. + # + # @return [Integer, nil] + optional :n_fd, Integer, api_name: :NFd + + # @!attribute n_goroutines + # The number of goroutines that currently exist. + # + # This information is only returned if debug-mode is enabled. + # + # @return [Integer, nil] + optional :n_goroutines, Integer, api_name: :NGoroutines + + # @!attribute no_proxy + # Comma-separated list of domain extensions for which no proxy should be used. + # This value is obtained from the + # [`NO_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + # environment variable. + # + # Containers do not automatically inherit this configuration. + # + # @return [String, nil] + optional :no_proxy, String, api_name: :NoProxy + + # @!attribute nri + # Information about the Node Resource Interface (NRI). + # + # This field is only present if NRI is enabled. + # + # @return [Docker::Models::SystemInfoResponse::Nri, nil] + optional :nri, -> { Docker::Models::SystemInfoResponse::Nri }, api_name: :NRI, nil?: true + + # @!attribute oom_kill_disable + # Indicates if OOM killer disable is supported on the host. + # + # @return [Boolean, nil] + optional :oom_kill_disable, Docker::Internal::Type::Boolean, api_name: :OomKillDisable + + # @!attribute operating_system + # Name of the host's operating system, for example: "Ubuntu 24.04 LTS" or "Windows + # Server 2016 Datacenter" + # + # @return [String, nil] + optional :operating_system, String, api_name: :OperatingSystem + + # @!attribute os_type + # Generic type of the operating system of the host, as returned by the Go runtime + # (`GOOS`). + # + # Currently returned values are "linux" and "windows". A full list of possible + # values can be found in the + # [Go documentation](https://go.dev/doc/install/source#environment). + # + # @return [String, nil] + optional :os_type, String, api_name: :OSType + + # @!attribute os_version + # Version of the host's operating system + # + #


+ # + # > **Note**: The information returned in this field, including its very + # > existence, and the formatting of values, should not be considered stable, and + # > may change without notice. + # + # @return [String, nil] + optional :os_version, String, api_name: :OSVersion + + # @!attribute pids_limit + # Indicates if the host kernel has PID limit support enabled. + # + # @return [Boolean, nil] + optional :pids_limit, Docker::Internal::Type::Boolean, api_name: :PidsLimit + + # @!attribute plugins + # Available plugins per type. + # + #


+ # + # > **Note**: Only unmanaged (V1) plugins are included in this list. V1 plugins + # > are "lazily" loaded, and are not returned in this list if there is no resource + # > using the plugin. + # + # @return [Docker::Models::SystemInfoResponse::Plugins, nil] + optional :plugins, -> { Docker::Models::SystemInfoResponse::Plugins }, api_name: :Plugins + + # @!attribute product_license + # Reports a summary of the product license on the daemon. + # + # If a commercial license has been applied to the daemon, information such as + # number of nodes, and expiration are included. + # + # @return [String, nil] + optional :product_license, String, api_name: :ProductLicense + + # @!attribute registry_config + # RegistryServiceConfig stores daemon registry services configuration. + # + # @return [Docker::Models::SystemInfoResponse::RegistryConfig, nil] + optional :registry_config, + -> { Docker::Models::SystemInfoResponse::RegistryConfig }, + api_name: :RegistryConfig, + nil?: true + + # @!attribute runc_commit + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + # + # @return [Docker::Models::SystemInfoResponse::RuncCommit, nil] + optional :runc_commit, -> { Docker::Models::SystemInfoResponse::RuncCommit }, api_name: :RuncCommit + + # @!attribute runtimes + # List of [OCI compliant](https://github.com/opencontainers/runtime-spec) runtimes + # configured on the daemon. Keys hold the "name" used to reference the runtime. + # + # The Docker daemon relies on an OCI compliant runtime (invoked via the + # `containerd` daemon) as its interface to the Linux kernel namespaces, cgroups, + # and SELinux. + # + # The default runtime is `runc`, and automatically configured. Additional runtimes + # can be configured by the user and will be listed here. + # + # @return [Hash{Symbol=>Docker::Models::SystemInfoResponse::Runtime}, nil] + optional :runtimes, + -> { Docker::Internal::Type::HashOf[Docker::Models::SystemInfoResponse::Runtime] }, + api_name: :Runtimes + + # @!attribute security_options + # List of security features that are enabled on the daemon, such as apparmor, + # seccomp, SELinux, user-namespaces (userns), rootless and no-new-privileges. + # + # Additional configuration options for each security feature may be present, and + # are included as a comma-separated list of key/value pairs. + # + # @return [Array, nil] + optional :security_options, Docker::Internal::Type::ArrayOf[String], api_name: :SecurityOptions + + # @!attribute server_version + # Version string of the daemon. + # + # @return [String, nil] + optional :server_version, String, api_name: :ServerVersion + + # @!attribute swap_limit + # Indicates if the host has memory swap limit support enabled. + # + # @return [Boolean, nil] + optional :swap_limit, Docker::Internal::Type::Boolean, api_name: :SwapLimit + + # @!attribute swarm + # Represents generic information about swarm. + # + # @return [Docker::Models::SystemInfoResponse::Swarm, nil] + optional :swarm, -> { Docker::Models::SystemInfoResponse::Swarm }, api_name: :Swarm + + # @!attribute system_time + # Current system-time in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format + # with nano-seconds. + # + # @return [String, nil] + optional :system_time, String, api_name: :SystemTime + + # @!attribute warnings + # List of warnings / informational messages about missing features, or issues + # related to the daemon configuration. + # + # These messages can be printed by the client as information to the user. + # + # @return [Array, nil] + optional :warnings, Docker::Internal::Type::ArrayOf[String], api_name: :Warnings + + # @!method initialize(architecture: nil, cdi_spec_dirs: nil, cgroup_driver: nil, cgroup_version: nil, containerd: nil, containerd_commit: nil, containers: nil, containers_paused: nil, containers_running: nil, containers_stopped: nil, cpu_cfs_period: nil, cpu_cfs_quota: nil, cpu_set: nil, cpu_shares: nil, debug: nil, default_address_pools: nil, default_runtime: nil, discovered_devices: nil, docker_root_dir: nil, driver: nil, driver_status: nil, experimental_build: nil, firewall_backend: nil, generic_resources: nil, http_proxy: nil, https_proxy: nil, id: nil, images: nil, index_server_address: nil, init_binary: nil, init_commit: nil, i_pv4_forwarding: nil, isolation: nil, kernel_version: nil, labels: nil, live_restore_enabled: nil, logging_driver: nil, memory_limit: nil, mem_total: nil, name: nil, ncpu: nil, n_events_listener: nil, n_fd: nil, n_goroutines: nil, no_proxy: nil, nri: nil, oom_kill_disable: nil, operating_system: nil, os_type: nil, os_version: nil, pids_limit: nil, plugins: nil, product_license: nil, registry_config: nil, runc_commit: nil, runtimes: nil, security_options: nil, server_version: nil, swap_limit: nil, swarm: nil, system_time: nil, warnings: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse} for more details. + # + # @param architecture [String] Hardware architecture of the host, as returned by the operating system. + # + # @param cdi_spec_dirs [Array] List of directories where (Container Device Interface) CDI + # + # @param cgroup_driver [Symbol, Docker::Models::SystemInfoResponse::CgroupDriver] The driver to use for managing cgroups. + # + # @param cgroup_version [Symbol, Docker::Models::SystemInfoResponse::CgroupVersion] The version of the cgroup. + # + # @param containerd [Docker::Models::SystemInfoResponse::Containerd, nil] Information for connecting to the containerd instance that is used by the daemon + # + # @param containerd_commit [Docker::Models::SystemInfoResponse::ContainerdCommit] Commit holds the Git-commit (SHA1) that a binary was built from, as + # + # @param containers [Integer] Total number of containers on the host. + # + # @param containers_paused [Integer] Number of containers with status `"paused"`. + # + # @param containers_running [Integer] Number of containers with status `"running"`. + # + # @param containers_stopped [Integer] Number of containers with status `"stopped"`. + # + # @param cpu_cfs_period [Boolean] Indicates if CPU CFS(Completely Fair Scheduler) period is supported by + # + # @param cpu_cfs_quota [Boolean] Indicates if CPU CFS(Completely Fair Scheduler) quota is supported by + # + # @param cpu_set [Boolean] Indicates if CPUsets (cpuset.cpus, cpuset.mems) are supported by the host. + # + # @param cpu_shares [Boolean] Indicates if CPU Shares limiting is supported by the host. + # + # @param debug [Boolean] Indicates if the daemon is running in debug-mode / with debug-level + # + # @param default_address_pools [Array] List of custom default address pools for local networks, which can be + # + # @param default_runtime [String] Name of the default OCI runtime that is used when starting containers. + # + # @param discovered_devices [Array] List of devices discovered by device drivers. + # + # @param docker_root_dir [String] Root directory of persistent Docker state. + # + # @param driver [String] Name of the storage driver in use. + # + # @param driver_status [Array>] Information specific to the storage driver, provided as + # + # @param experimental_build [Boolean] Indicates if experimental features are enabled on the daemon. + # + # @param firewall_backend [Docker::Models::SystemInfoResponse::FirewallBackend, nil] Information about the daemon's firewalling configuration. + # + # @param generic_resources [Array] User-defined resources can be either Integer resources (e.g, `SSD=3`) or + # + # @param http_proxy [String] HTTP-proxy configured for the daemon. This value is obtained from the + # + # @param https_proxy [String] HTTPS-proxy configured for the daemon. This value is obtained from the + # + # @param id [String] Unique identifier of the daemon. + # + # @param images [Integer] Total number of images on the host. + # + # @param index_server_address [String] Address / URL of the index server that is used for image search, + # + # @param init_binary [String] Name and, optional, path of the `docker-init` binary. + # + # @param init_commit [Docker::Models::SystemInfoResponse::InitCommit] Commit holds the Git-commit (SHA1) that a binary was built from, as + # + # @param i_pv4_forwarding [Boolean] Indicates IPv4 forwarding is enabled. + # + # @param isolation [Symbol, Docker::Models::SystemInfoResponse::Isolation] Represents the isolation technology to use as a default for containers. + # + # @param kernel_version [String] Kernel version of the host. + # + # @param labels [Array] User-defined labels (key/value metadata) as set on the daemon. + # + # @param live_restore_enabled [Boolean] Indicates if live restore is enabled. + # + # @param logging_driver [String] The logging driver to use as a default for new containers. + # + # @param memory_limit [Boolean] Indicates if the host has memory limit support enabled. + # + # @param mem_total [Integer] Total amount of physical memory available on the host, in bytes. + # + # @param name [String] Hostname of the host. + # + # @param ncpu [Integer] The number of logical CPUs usable by the daemon. + # + # @param n_events_listener [Integer] Number of event listeners subscribed. + # + # @param n_fd [Integer] The total number of file Descriptors in use by the daemon process. + # + # @param n_goroutines [Integer] The number of goroutines that currently exist. + # + # @param no_proxy [String] Comma-separated list of domain extensions for which no proxy should be + # + # @param nri [Docker::Models::SystemInfoResponse::Nri, nil] Information about the Node Resource Interface (NRI). + # + # @param oom_kill_disable [Boolean] Indicates if OOM killer disable is supported on the host. + # + # @param operating_system [String] Name of the host's operating system, for example: "Ubuntu 24.04 LTS" + # + # @param os_type [String] Generic type of the operating system of the host, as returned by the + # + # @param os_version [String] Version of the host's operating system + # + # @param pids_limit [Boolean] Indicates if the host kernel has PID limit support enabled. + # + # @param plugins [Docker::Models::SystemInfoResponse::Plugins] Available plugins per type. + # + # @param product_license [String] Reports a summary of the product license on the daemon. + # + # @param registry_config [Docker::Models::SystemInfoResponse::RegistryConfig, nil] RegistryServiceConfig stores daemon registry services configuration. + # + # @param runc_commit [Docker::Models::SystemInfoResponse::RuncCommit] Commit holds the Git-commit (SHA1) that a binary was built from, as + # + # @param runtimes [Hash{Symbol=>Docker::Models::SystemInfoResponse::Runtime}] List of [OCI compliant](https://github.com/opencontainers/runtime-spec) + # + # @param security_options [Array] List of security features that are enabled on the daemon, such as + # + # @param server_version [String] Version string of the daemon. + # + # @param swap_limit [Boolean] Indicates if the host has memory swap limit support enabled. + # + # @param swarm [Docker::Models::SystemInfoResponse::Swarm] Represents generic information about swarm. + # + # @param system_time [String] Current system-time in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) + # + # @param warnings [Array] List of warnings / informational messages about missing features, or + + # The driver to use for managing cgroups. + # + # @see Docker::Models::SystemInfoResponse#cgroup_driver + module CgroupDriver + extend Docker::Internal::Type::Enum + + CGROUPFS = :cgroupfs + SYSTEMD = :systemd + NONE = :none + + # @!method self.values + # @return [Array] + end + + # The version of the cgroup. + # + # @see Docker::Models::SystemInfoResponse#cgroup_version + module CgroupVersion + extend Docker::Internal::Type::Enum + + CGROUP_VERSION_1 = :"1" + CGROUP_VERSION_2 = :"2" + + # @!method self.values + # @return [Array] + end + + # @see Docker::Models::SystemInfoResponse#containerd + class Containerd < Docker::Internal::Type::BaseModel + # @!attribute address + # The address of the containerd socket. + # + # @return [String, nil] + optional :address, String, api_name: :Address + + # @!attribute namespaces + # The namespaces that the daemon uses for running containers and plugins in + # containerd. These namespaces can be configured in the daemon configuration, and + # are considered to be used exclusively by the daemon, Tampering with the + # containerd instance may cause unexpected behavior. + # + # As these namespaces are considered to be exclusively accessed by the daemon, it + # is not recommended to change these values, or to change them to a value that is + # used by other systems, such as cri-containerd. + # + # @return [Docker::Models::SystemInfoResponse::Containerd::Namespaces, nil] + optional :namespaces, + -> { Docker::Models::SystemInfoResponse::Containerd::Namespaces }, + api_name: :Namespaces + + # @!method initialize(address: nil, namespaces: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Containerd} for more details. + # + # Information for connecting to the containerd instance that is used by the + # daemon. This is included for debugging purposes only. + # + # @param address [String] The address of the containerd socket. + # + # @param namespaces [Docker::Models::SystemInfoResponse::Containerd::Namespaces] The namespaces that the daemon uses for running containers and + + # @see Docker::Models::SystemInfoResponse::Containerd#namespaces + class Namespaces < Docker::Internal::Type::BaseModel + # @!attribute containers + # The default containerd namespace used for containers managed by the daemon. + # + # The default namespace for containers is "moby", but will be suffixed with the + # `.` of the remapped `root` if user-namespaces are enabled and the + # containerd image-store is used. + # + # @return [String, nil] + optional :containers, String, api_name: :Containers + + # @!attribute plugins + # The default containerd namespace used for plugins managed by the daemon. + # + # The default namespace for plugins is "plugins.moby", but will be suffixed with + # the `.` of the remapped `root` if user-namespaces are enabled and the + # containerd image-store is used. + # + # @return [String, nil] + optional :plugins, String, api_name: :Plugins + + # @!method initialize(containers: nil, plugins: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Containerd::Namespaces} for more details. + # + # The namespaces that the daemon uses for running containers and plugins in + # containerd. These namespaces can be configured in the daemon configuration, and + # are considered to be used exclusively by the daemon, Tampering with the + # containerd instance may cause unexpected behavior. + # + # As these namespaces are considered to be exclusively accessed by the daemon, it + # is not recommended to change these values, or to change them to a value that is + # used by other systems, such as cri-containerd. + # + # @param containers [String] The default containerd namespace used for containers managed + # + # @param plugins [String] The default containerd namespace used for plugins managed by + end + end + + # @see Docker::Models::SystemInfoResponse#containerd_commit + class ContainerdCommit < Docker::Internal::Type::BaseModel + # @!attribute id + # Actual commit ID of external tool. + # + # @return [String, nil] + optional :id, String, api_name: :ID + + # @!method initialize(id: nil) + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + # + # @param id [String] Actual commit ID of external tool. + end + + class DefaultAddressPool < Docker::Internal::Type::BaseModel + # @!attribute base + # The network address in CIDR format + # + # @return [String, nil] + optional :base, String, api_name: :Base + + # @!attribute size + # The network pool size + # + # @return [Integer, nil] + optional :size, Integer, api_name: :Size + + # @!method initialize(base: nil, size: nil) + # @param base [String] The network address in CIDR format + # + # @param size [Integer] The network pool size + end + + class DiscoveredDevice < Docker::Internal::Type::BaseModel + # @!attribute id + # The unique identifier for the device within its source driver. For CDI devices, + # this would be an FQDN like "vendor.com/gpu=0". + # + # @return [String, nil] + optional :id, String, api_name: :ID + + # @!attribute source + # The origin device driver. + # + # @return [String, nil] + optional :source, String, api_name: :Source + + # @!method initialize(id: nil, source: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::DiscoveredDevice} for more details. + # + # DeviceInfo represents a device that can be used by a container. + # + # @param id [String] The unique identifier for the device within its source driver. + # + # @param source [String] The origin device driver. + end + + # @see Docker::Models::SystemInfoResponse#firewall_backend + class FirewallBackend < Docker::Internal::Type::BaseModel + # @!attribute driver + # The name of the firewall backend driver. + # + # @return [String, nil] + optional :driver, String, api_name: :Driver + + # @!attribute info + # Information about the firewall backend, provided as "label" / "value" pairs. + # + #


+ # + # > **Note**: The information returned in this field, including the formatting of + # > values and labels, should not be considered stable, and may change without + # > notice. + # + # @return [Array>, nil] + optional :info, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::ArrayOf[String]], + api_name: :Info + + # @!method initialize(driver: nil, info: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::FirewallBackend} for more details. + # + # Information about the daemon's firewalling configuration. + # + # This field is currently only used on Linux, and omitted on other platforms. + # + # @param driver [String] The name of the firewall backend driver. + # + # @param info [Array>] Information about the firewall backend, provided as + end + + class GenericResource < Docker::Internal::Type::BaseModel + # @!attribute discrete_resource_spec + # + # @return [Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec, nil] + optional :discrete_resource_spec, + -> { Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec }, + api_name: :DiscreteResourceSpec + + # @!attribute named_resource_spec + # + # @return [Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec, nil] + optional :named_resource_spec, + -> { Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec }, + api_name: :NamedResourceSpec + + # @!method initialize(discrete_resource_spec: nil, named_resource_spec: nil) + # @param discrete_resource_spec [Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec] + # @param named_resource_spec [Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec] + + # @see Docker::Models::SystemInfoResponse::GenericResource#discrete_resource_spec + class DiscreteResourceSpec < Docker::Internal::Type::BaseModel + # @!attribute kind + # + # @return [String, nil] + optional :kind, String, api_name: :Kind + + # @!attribute value + # + # @return [Integer, nil] + optional :value, Integer, api_name: :Value + + # @!method initialize(kind: nil, value: nil) + # @param kind [String] + # @param value [Integer] + end + + # @see Docker::Models::SystemInfoResponse::GenericResource#named_resource_spec + class NamedResourceSpec < Docker::Internal::Type::BaseModel + # @!attribute kind + # + # @return [String, nil] + optional :kind, String, api_name: :Kind + + # @!attribute value + # + # @return [String, nil] + optional :value, String, api_name: :Value + + # @!method initialize(kind: nil, value: nil) + # @param kind [String] + # @param value [String] + end + end + + # @see Docker::Models::SystemInfoResponse#init_commit + class InitCommit < Docker::Internal::Type::BaseModel + # @!attribute id + # Actual commit ID of external tool. + # + # @return [String, nil] + optional :id, String, api_name: :ID + + # @!method initialize(id: nil) + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + # + # @param id [String] Actual commit ID of external tool. + end + + # Represents the isolation technology to use as a default for containers. The + # supported values are platform-specific. + # + # If no isolation value is specified on daemon start, on Windows client, the + # default is `hyperv`, and on Windows server, the default is `process`. + # + # This option is currently not used on other platforms. + # + # @see Docker::Models::SystemInfoResponse#isolation + module Isolation + extend Docker::Internal::Type::Enum + + DEFAULT = :default + HYPERV = :hyperv + PROCESS = :process + EMPTY = :"" + + # @!method self.values + # @return [Array] + end + + # @see Docker::Models::SystemInfoResponse#nri + class Nri < Docker::Internal::Type::BaseModel + # @!attribute info + # Information about NRI, provided as "label" / "value" pairs. + # + #


+ # + # > **Note**: The information returned in this field, including the formatting of + # > values and labels, should not be considered stable, and may change without + # > notice. + # + # @return [Array>, nil] + optional :info, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::ArrayOf[String]], + api_name: :Info + + # @!method initialize(info: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Nri} for more details. + # + # Information about the Node Resource Interface (NRI). + # + # This field is only present if NRI is enabled. + # + # @param info [Array>] Information about NRI, provided as "label" / "value" pairs. + end + + # @see Docker::Models::SystemInfoResponse#plugins + class Plugins < Docker::Internal::Type::BaseModel + # @!attribute authorization + # Names of available authorization plugins. + # + # @return [Array, nil] + optional :authorization, Docker::Internal::Type::ArrayOf[String], api_name: :Authorization + + # @!attribute log + # Names of available logging-drivers, and logging-driver plugins. + # + # @return [Array, nil] + optional :log, Docker::Internal::Type::ArrayOf[String], api_name: :Log + + # @!attribute network + # Names of available network-drivers, and network-driver plugins. + # + # @return [Array, nil] + optional :network, Docker::Internal::Type::ArrayOf[String], api_name: :Network + + # @!attribute volume + # Names of available volume-drivers, and network-driver plugins. + # + # @return [Array, nil] + optional :volume, Docker::Internal::Type::ArrayOf[String], api_name: :Volume + + # @!method initialize(authorization: nil, log: nil, network: nil, volume: nil) + # Available plugins per type. + # + #


+ # + # > **Note**: Only unmanaged (V1) plugins are included in this list. V1 plugins + # > are "lazily" loaded, and are not returned in this list if there is no resource + # > using the plugin. + # + # @param authorization [Array] Names of available authorization plugins. + # + # @param log [Array] Names of available logging-drivers, and logging-driver plugins. + # + # @param network [Array] Names of available network-drivers, and network-driver plugins. + # + # @param volume [Array] Names of available volume-drivers, and network-driver plugins. + end + + # @see Docker::Models::SystemInfoResponse#registry_config + class RegistryConfig < Docker::Internal::Type::BaseModel + # @!attribute index_configs + # + # @return [Hash{Symbol=>Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig, nil}, nil] + optional :index_configs, + -> { Docker::Internal::Type::HashOf[Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig, nil?: true] }, + api_name: :IndexConfigs + + # @!attribute insecure_registry_cid_rs + # List of IP ranges of insecure registries, using the CIDR syntax + # ([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries accept + # un-encrypted (HTTP) and/or untrusted (HTTPS with certificates from unknown CAs) + # communication. + # + # By default, local registries (`::1/128` and `127.0.0.0/8`) are configured as + # insecure. All other registries are secure. Communicating with an insecure + # registry is not possible if the daemon assumes that registry is secure. + # + # This configuration override this behavior, insecure communication with + # registries whose resolved IP address is within the subnet described by the CIDR + # syntax. + # + # Registries can also be marked insecure by hostname. Those registries are listed + # under `IndexConfigs` and have their `Secure` field set to `false`. + # + # > **Warning**: Using this option can be useful when running a local registry, + # > but introduces security vulnerabilities. This option should therefore ONLY be + # > used for testing purposes. For increased security, users should add their CA + # > to their system's list of trusted CAs instead of enabling this option. + # + # @return [Array, nil] + optional :insecure_registry_cid_rs, + Docker::Internal::Type::ArrayOf[String], + api_name: :InsecureRegistryCIDRs + + # @!attribute mirrors + # List of registry URLs that act as a mirror for the official (`docker.io`) + # registry. + # + # @return [Array, nil] + optional :mirrors, Docker::Internal::Type::ArrayOf[String], api_name: :Mirrors + + # @!method initialize(index_configs: nil, insecure_registry_cid_rs: nil, mirrors: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::RegistryConfig} for more details. + # + # RegistryServiceConfig stores daemon registry services configuration. + # + # @param index_configs [Hash{Symbol=>Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig, nil}] + # + # @param insecure_registry_cid_rs [Array] List of IP ranges of insecure registries, using the CIDR syntax + # + # @param mirrors [Array] List of registry URLs that act as a mirror for the official + + class IndexConfig < Docker::Internal::Type::BaseModel + # @!attribute mirrors + # List of mirrors, expressed as URIs. + # + # @return [Array, nil] + optional :mirrors, Docker::Internal::Type::ArrayOf[String], api_name: :Mirrors + + # @!attribute name + # Name of the registry, such as "docker.io". + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute official + # Indicates whether this is an official registry (i.e., Docker Hub / docker.io) + # + # @return [Boolean, nil] + optional :official, Docker::Internal::Type::Boolean, api_name: :Official + + # @!attribute secure + # Indicates if the registry is part of the list of insecure registries. + # + # If `false`, the registry is insecure. Insecure registries accept un-encrypted + # (HTTP) and/or untrusted (HTTPS with certificates from unknown CAs) + # communication. + # + # > **Warning**: Insecure registries can be useful when running a local registry. + # > However, because its use creates security vulnerabilities it should ONLY be + # > enabled for testing purposes. For increased security, users should add their + # > CA to their system's list of trusted CAs instead of enabling this option. + # + # @return [Boolean, nil] + optional :secure, Docker::Internal::Type::Boolean, api_name: :Secure + + # @!method initialize(mirrors: nil, name: nil, official: nil, secure: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig} for more + # details. + # + # IndexInfo contains information about a registry. + # + # @param mirrors [Array] List of mirrors, expressed as URIs. + # + # @param name [String] Name of the registry, such as "docker.io". + # + # @param official [Boolean] Indicates whether this is an official registry (i.e., Docker Hub / docker.io) + # + # @param secure [Boolean] Indicates if the registry is part of the list of insecure + end + end + + # @see Docker::Models::SystemInfoResponse#runc_commit + class RuncCommit < Docker::Internal::Type::BaseModel + # @!attribute id + # Actual commit ID of external tool. + # + # @return [String, nil] + optional :id, String, api_name: :ID + + # @!method initialize(id: nil) + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + # + # @param id [String] Actual commit ID of external tool. + end + + class Runtime < Docker::Internal::Type::BaseModel + # @!attribute path + # Name and, optional, path, of the OCI executable binary. + # + # If the path is omitted, the daemon searches the host's `$PATH` for the binary + # and uses the first result. + # + # @return [String, nil] + optional :path, String + + # @!attribute runtime_args + # List of command-line arguments to pass to the runtime when invoked. + # + # @return [Array, nil] + optional :runtime_args, Docker::Internal::Type::ArrayOf[String], api_name: :runtimeArgs, nil?: true + + # @!attribute status + # Information specific to the runtime. + # + # While this API specification does not define data provided by runtimes, the + # following well-known properties may be provided by runtimes: + # + # `org.opencontainers.runtime-spec.features`: features structure as defined in the + # [OCI Runtime Specification](https://github.com/opencontainers/runtime-spec/blob/main/features.md), + # in a JSON string representation. + # + #


+ # + # > **Note**: The information returned in this field, including the formatting of + # > values and labels, should not be considered stable, and may change without + # > notice. + # + # @return [Hash{Symbol=>String}, nil] + optional :status, Docker::Internal::Type::HashOf[String], nil?: true + + # @!method initialize(path: nil, runtime_args: nil, status: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Runtime} for more details. + # + # Runtime describes an + # [OCI compliant](https://github.com/opencontainers/runtime-spec) runtime. + # + # The runtime is invoked by the daemon via the `containerd` daemon. OCI runtimes + # act as an interface to the Linux kernel namespaces, cgroups, and SELinux. + # + # @param path [String] Name and, optional, path, of the OCI executable binary. + # + # @param runtime_args [Array, nil] List of command-line arguments to pass to the runtime when invoked. + # + # @param status [Hash{Symbol=>String}, nil] Information specific to the runtime. + end + + # @see Docker::Models::SystemInfoResponse#swarm + class Swarm < Docker::Internal::Type::BaseModel + # @!attribute cluster + # ClusterInfo represents information about the swarm as is returned by the "/info" + # endpoint. Join-tokens are not included. + # + # @return [Docker::Models::SystemInfoResponse::Swarm::Cluster, nil] + optional :cluster, + -> { Docker::Models::SystemInfoResponse::Swarm::Cluster }, + api_name: :Cluster, + nil?: true + + # @!attribute control_available + # + # @return [Boolean, nil] + optional :control_available, Docker::Internal::Type::Boolean, api_name: :ControlAvailable + + # @!attribute error + # + # @return [String, nil] + optional :error, String, api_name: :Error + + # @!attribute local_node_state + # Current local status of this node. + # + # @return [Symbol, Docker::Models::SystemInfoResponse::Swarm::LocalNodeState, nil] + optional :local_node_state, + enum: -> { Docker::Models::SystemInfoResponse::Swarm::LocalNodeState }, + api_name: :LocalNodeState + + # @!attribute managers + # Total number of managers in the swarm. + # + # @return [Integer, nil] + optional :managers, Integer, api_name: :Managers, nil?: true + + # @!attribute node_addr + # IP address at which this node can be reached by other nodes in the swarm. + # + # @return [String, nil] + optional :node_addr, String, api_name: :NodeAddr + + # @!attribute node_id + # Unique identifier of for this node in the swarm. + # + # @return [String, nil] + optional :node_id, String, api_name: :NodeID + + # @!attribute nodes + # Total number of nodes in the swarm. + # + # @return [Integer, nil] + optional :nodes, Integer, api_name: :Nodes, nil?: true + + # @!attribute remote_managers + # List of ID's and addresses of other managers in the swarm. + # + # @return [Array, nil] + optional :remote_managers, + -> { Docker::Internal::Type::ArrayOf[Docker::Models::SystemInfoResponse::Swarm::RemoteManager] }, + api_name: :RemoteManagers, + nil?: true + + # @!method initialize(cluster: nil, control_available: nil, error: nil, local_node_state: nil, managers: nil, node_addr: nil, node_id: nil, nodes: nil, remote_managers: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Swarm} for more details. + # + # Represents generic information about swarm. + # + # @param cluster [Docker::Models::SystemInfoResponse::Swarm::Cluster, nil] ClusterInfo represents information about the swarm as is returned by the + # + # @param control_available [Boolean] + # + # @param error [String] + # + # @param local_node_state [Symbol, Docker::Models::SystemInfoResponse::Swarm::LocalNodeState] Current local status of this node. + # + # @param managers [Integer, nil] Total number of managers in the swarm. + # + # @param node_addr [String] IP address at which this node can be reached by other nodes in the + # + # @param node_id [String] Unique identifier of for this node in the swarm. + # + # @param nodes [Integer, nil] Total number of nodes in the swarm. + # + # @param remote_managers [Array, nil] List of ID's and addresses of other managers in the swarm. + + # @see Docker::Models::SystemInfoResponse::Swarm#cluster + class Cluster < Docker::Internal::Type::BaseModel + # @!attribute created_at + # Date and time at which the swarm was initialised in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + # + # @return [String, nil] + optional :created_at, String, api_name: :CreatedAt + + # @!attribute data_path_port + # DataPathPort specifies the data path port number for data traffic. Acceptable + # port range is 1024 to 49151. If no port is set or is set to 0, the default port + # (4789) is used. + # + # @return [Integer, nil] + optional :data_path_port, Integer, api_name: :DataPathPort + + # @!attribute default_addr_pool + # Default Address Pool specifies default subnet pools for global scope networks. + # + # @return [Array, nil] + optional :default_addr_pool, Docker::Internal::Type::ArrayOf[String], api_name: :DefaultAddrPool + + # @!attribute id + # The ID of the swarm. + # + # @return [String, nil] + optional :id, String, api_name: :ID + + # @!attribute root_rotation_in_progress + # Whether there is currently a root CA rotation in progress for the swarm + # + # @return [Boolean, nil] + optional :root_rotation_in_progress, + Docker::Internal::Type::Boolean, + api_name: :RootRotationInProgress + + # @!attribute spec + # User modifiable swarm configuration. + # + # @return [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec, nil] + optional :spec, -> { Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec }, api_name: :Spec + + # @!attribute subnet_size + # SubnetSize specifies the subnet size of the networks created from the default + # subnet pool. + # + # @return [Integer, nil] + optional :subnet_size, Integer, api_name: :SubnetSize + + # @!attribute tls_info + # Information about the issuer of leaf TLS certificates and the trusted root CA + # certificate. + # + # @return [Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo, nil] + optional :tls_info, -> { Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo }, api_name: :TLSInfo + + # @!attribute updated_at + # Date and time at which the swarm was last updated in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + # + # @return [String, nil] + optional :updated_at, String, api_name: :UpdatedAt + + # @!attribute version + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + # + # @return [Docker::Models::SystemInfoResponse::Swarm::Cluster::Version, nil] + optional :version, -> { Docker::Models::SystemInfoResponse::Swarm::Cluster::Version }, api_name: :Version + + # @!method initialize(created_at: nil, data_path_port: nil, default_addr_pool: nil, id: nil, root_rotation_in_progress: nil, spec: nil, subnet_size: nil, tls_info: nil, updated_at: nil, version: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Swarm::Cluster} for more details. + # + # ClusterInfo represents information about the swarm as is returned by the "/info" + # endpoint. Join-tokens are not included. + # + # @param created_at [String] Date and time at which the swarm was initialised in + # + # @param data_path_port [Integer] DataPathPort specifies the data path port number for data traffic. + # + # @param default_addr_pool [Array] Default Address Pool specifies default subnet pools for global scope + # + # @param id [String] The ID of the swarm. + # + # @param root_rotation_in_progress [Boolean] Whether there is currently a root CA rotation in progress for the swarm + # + # @param spec [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec] User modifiable swarm configuration. + # + # @param subnet_size [Integer] SubnetSize specifies the subnet size of the networks created from the + # + # @param tls_info [Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo] Information about the issuer of leaf TLS certificates and the trusted root + # + # @param updated_at [String] Date and time at which the swarm was last updated in + # + # @param version [Docker::Models::SystemInfoResponse::Swarm::Cluster::Version] The version number of the object such as node, service, etc. This is needed + + # @see Docker::Models::SystemInfoResponse::Swarm::Cluster#spec + class Spec < Docker::Internal::Type::BaseModel + # @!attribute ca_config + # CA configuration. + # + # @return [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig, nil] + optional :ca_config, + -> { Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig }, + api_name: :CAConfig, + nil?: true + + # @!attribute dispatcher + # Dispatcher configuration. + # + # @return [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher, nil] + optional :dispatcher, + -> { Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher }, + api_name: :Dispatcher, + nil?: true + + # @!attribute encryption_config + # Parameters related to encryption-at-rest. + # + # @return [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig, nil] + optional :encryption_config, + -> { Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig }, + api_name: :EncryptionConfig + + # @!attribute labels + # User-defined key/value metadata. + # + # @return [Hash{Symbol=>String}, nil] + optional :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute name + # Name of the swarm. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute orchestration + # Orchestration configuration. + # + # @return [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration, nil] + optional :orchestration, + -> { Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration }, + api_name: :Orchestration, + nil?: true + + # @!attribute raft + # Raft configuration. + # + # @return [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft, nil] + optional :raft, -> { Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft }, api_name: :Raft + + # @!attribute task_defaults + # Defaults for creating tasks in this cluster. + # + # @return [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults, nil] + optional :task_defaults, + -> { Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults }, + api_name: :TaskDefaults + + # @!method initialize(ca_config: nil, dispatcher: nil, encryption_config: nil, labels: nil, name: nil, orchestration: nil, raft: nil, task_defaults: nil) + # User modifiable swarm configuration. + # + # @param ca_config [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig, nil] CA configuration. + # + # @param dispatcher [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher, nil] Dispatcher configuration. + # + # @param encryption_config [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig] Parameters related to encryption-at-rest. + # + # @param labels [Hash{Symbol=>String}] User-defined key/value metadata. + # + # @param name [String] Name of the swarm. + # + # @param orchestration [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration, nil] Orchestration configuration. + # + # @param raft [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft] Raft configuration. + # + # @param task_defaults [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults] Defaults for creating tasks in this cluster. + + # @see Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec#ca_config + class CaConfig < Docker::Internal::Type::BaseModel + # @!attribute external_c_as + # Configuration for forwarding signing requests to an external certificate + # authority. + # + # @return [Array, nil] + optional :external_c_as, + -> { Docker::Internal::Type::ArrayOf[Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA] }, + api_name: :ExternalCAs + + # @!attribute force_rotate + # An integer whose purpose is to force swarm to generate a new signing CA + # certificate and key, if none have been specified in `SigningCACert` and + # `SigningCAKey` + # + # @return [Integer, nil] + optional :force_rotate, Integer, api_name: :ForceRotate + + # @!attribute node_cert_expiry + # The duration node certificates are issued for. + # + # @return [Integer, nil] + optional :node_cert_expiry, Integer, api_name: :NodeCertExpiry + + # @!attribute signing_ca_cert + # The desired signing CA certificate for all swarm node TLS leaf certificates, in + # PEM format. + # + # @return [String, nil] + optional :signing_ca_cert, String, api_name: :SigningCACert + + # @!attribute signing_ca_key + # The desired signing CA key for all swarm node TLS leaf certificates, in PEM + # format. + # + # @return [String, nil] + optional :signing_ca_key, String, api_name: :SigningCAKey + + # @!method initialize(external_c_as: nil, force_rotate: nil, node_cert_expiry: nil, signing_ca_cert: nil, signing_ca_key: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig} for more + # details. + # + # CA configuration. + # + # @param external_c_as [Array] Configuration for forwarding signing requests to an external + # + # @param force_rotate [Integer] An integer whose purpose is to force swarm to generate a new + # + # @param node_cert_expiry [Integer] The duration node certificates are issued for. + # + # @param signing_ca_cert [String] The desired signing CA certificate for all swarm node TLS leaf + # + # @param signing_ca_key [String] The desired signing CA key for all swarm node TLS leaf certificates, + + class ExternalCA < Docker::Internal::Type::BaseModel + # @!attribute ca_cert + # The root CA certificate (in PEM format) this external CA uses to issue TLS + # certificates (assumed to be to the current swarm root CA certificate if not + # provided). + # + # @return [String, nil] + optional :ca_cert, String, api_name: :CACert + + # @!attribute options + # An object with key/value pairs that are interpreted as protocol-specific options + # for the external CA driver. + # + # @return [Hash{Symbol=>String}, nil] + optional :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!attribute protocol + # Protocol for communication with the external CA (currently only `cfssl` is + # supported). + # + # @return [Symbol, Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::Protocol, nil] + optional :protocol, + enum: -> { Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::Protocol }, + api_name: :Protocol + + # @!attribute url + # URL where certificate signing requests should be sent. + # + # @return [String, nil] + optional :url, String, api_name: :URL + + # @!method initialize(ca_cert: nil, options: nil, protocol: nil, url: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA} + # for more details. + # + # @param ca_cert [String] The root CA certificate (in PEM format) this external CA uses + # + # @param options [Hash{Symbol=>String}] An object with key/value pairs that are interpreted as + # + # @param protocol [Symbol, Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::Protocol] Protocol for communication with the external CA (currently + # + # @param url [String] URL where certificate signing requests should be sent. + + # Protocol for communication with the external CA (currently only `cfssl` is + # supported). + # + # @see Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA#protocol + module Protocol + extend Docker::Internal::Type::Enum + + CFSSL = :cfssl + + # @!method self.values + # @return [Array] + end + end + end + + # @see Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec#dispatcher + class Dispatcher < Docker::Internal::Type::BaseModel + # @!attribute heartbeat_period + # The delay for an agent to send a heartbeat to the dispatcher. + # + # @return [Integer, nil] + optional :heartbeat_period, Integer, api_name: :HeartbeatPeriod + + # @!method initialize(heartbeat_period: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher} for more + # details. + # + # Dispatcher configuration. + # + # @param heartbeat_period [Integer] The delay for an agent to send a heartbeat to the dispatcher. + end + + # @see Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec#encryption_config + class EncryptionConfig < Docker::Internal::Type::BaseModel + # @!attribute auto_lock_managers + # If set, generate a key and use it to lock data stored on the managers. + # + # @return [Boolean, nil] + optional :auto_lock_managers, Docker::Internal::Type::Boolean, api_name: :AutoLockManagers + + # @!method initialize(auto_lock_managers: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig} for + # more details. + # + # Parameters related to encryption-at-rest. + # + # @param auto_lock_managers [Boolean] If set, generate a key and use it to lock data stored on the + end + + # @see Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec#orchestration + class Orchestration < Docker::Internal::Type::BaseModel + # @!attribute task_history_retention_limit + # The number of historic tasks to keep per instance or node. If negative, never + # remove completed or failed tasks. + # + # @return [Integer, nil] + optional :task_history_retention_limit, Integer, api_name: :TaskHistoryRetentionLimit + + # @!method initialize(task_history_retention_limit: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration} for + # more details. + # + # Orchestration configuration. + # + # @param task_history_retention_limit [Integer] The number of historic tasks to keep per instance or node. If + end + + # @see Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec#raft + class Raft < Docker::Internal::Type::BaseModel + # @!attribute election_tick + # The number of ticks that a follower will wait for a message from the leader + # before becoming a candidate and starting an election. `ElectionTick` must be + # greater than `HeartbeatTick`. + # + # A tick currently defaults to one second, so these translate directly to seconds + # currently, but this is NOT guaranteed. + # + # @return [Integer, nil] + optional :election_tick, Integer, api_name: :ElectionTick + + # @!attribute heartbeat_tick + # The number of ticks between heartbeats. Every HeartbeatTick ticks, the leader + # will send a heartbeat to the followers. + # + # A tick currently defaults to one second, so these translate directly to seconds + # currently, but this is NOT guaranteed. + # + # @return [Integer, nil] + optional :heartbeat_tick, Integer, api_name: :HeartbeatTick + + # @!attribute keep_old_snapshots + # The number of snapshots to keep beyond the current snapshot. + # + # @return [Integer, nil] + optional :keep_old_snapshots, Integer, api_name: :KeepOldSnapshots + + # @!attribute log_entries_for_slow_followers + # The number of log entries to keep around to sync up slow followers after a + # snapshot is created. + # + # @return [Integer, nil] + optional :log_entries_for_slow_followers, Integer, api_name: :LogEntriesForSlowFollowers + + # @!attribute snapshot_interval + # The number of log entries between snapshots. + # + # @return [Integer, nil] + optional :snapshot_interval, Integer, api_name: :SnapshotInterval + + # @!method initialize(election_tick: nil, heartbeat_tick: nil, keep_old_snapshots: nil, log_entries_for_slow_followers: nil, snapshot_interval: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft} for more + # details. + # + # Raft configuration. + # + # @param election_tick [Integer] The number of ticks that a follower will wait for a message from + # + # @param heartbeat_tick [Integer] The number of ticks between heartbeats. Every HeartbeatTick ticks, + # + # @param keep_old_snapshots [Integer] The number of snapshots to keep beyond the current snapshot. + # + # @param log_entries_for_slow_followers [Integer] The number of log entries to keep around to sync up slow followers + # + # @param snapshot_interval [Integer] The number of log entries between snapshots. + end + + # @see Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec#task_defaults + class TaskDefaults < Docker::Internal::Type::BaseModel + # @!attribute log_driver + # The log driver to use for tasks created in the orchestrator if unspecified by a + # service. + # + # Updating this value only affects new tasks. Existing tasks continue to use their + # previously configured log driver until recreated. + # + # @return [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver, nil] + optional :log_driver, + -> { Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver }, + api_name: :LogDriver + + # @!method initialize(log_driver: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults} for + # more details. + # + # Defaults for creating tasks in this cluster. + # + # @param log_driver [Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver] The log driver to use for tasks created in the orchestrator if + + # @see Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults#log_driver + class LogDriver < Docker::Internal::Type::BaseModel + # @!attribute name + # The log driver to use as a default for new tasks. + # + # @return [String, nil] + optional :name, String, api_name: :Name + + # @!attribute options + # Driver-specific options for the selected log driver, specified as key/value + # pairs. + # + # @return [Hash{Symbol=>String}, nil] + optional :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!method initialize(name: nil, options: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver} + # for more details. + # + # The log driver to use for tasks created in the orchestrator if unspecified by a + # service. + # + # Updating this value only affects new tasks. Existing tasks continue to use their + # previously configured log driver until recreated. + # + # @param name [String] The log driver to use as a default for new tasks. + # + # @param options [Hash{Symbol=>String}] Driver-specific options for the selected log driver, specified + end + end + end + + # @see Docker::Models::SystemInfoResponse::Swarm::Cluster#tls_info + class TlsInfo < Docker::Internal::Type::BaseModel + # @!attribute cert_issuer_public_key + # The base64-url-safe-encoded raw public key bytes of the issuer. + # + # @return [String, nil] + optional :cert_issuer_public_key, String, api_name: :CertIssuerPublicKey + + # @!attribute cert_issuer_subject + # The base64-url-safe-encoded raw subject bytes of the issuer. + # + # @return [String, nil] + optional :cert_issuer_subject, String, api_name: :CertIssuerSubject + + # @!attribute trust_root + # The root CA certificate(s) that are used to validate leaf TLS certificates. + # + # @return [String, nil] + optional :trust_root, String, api_name: :TrustRoot + + # @!method initialize(cert_issuer_public_key: nil, cert_issuer_subject: nil, trust_root: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo} for more details. + # + # Information about the issuer of leaf TLS certificates and the trusted root CA + # certificate. + # + # @param cert_issuer_public_key [String] The base64-url-safe-encoded raw public key bytes of the issuer. + # + # @param cert_issuer_subject [String] The base64-url-safe-encoded raw subject bytes of the issuer. + # + # @param trust_root [String] The root CA certificate(s) that are used to validate leaf TLS + end + + # @see Docker::Models::SystemInfoResponse::Swarm::Cluster#version + class Version < Docker::Internal::Type::BaseModel + # @!attribute index + # + # @return [Integer, nil] + optional :index, Integer, api_name: :Index + + # @!method initialize(index: nil) + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + # + # @param index [Integer] + end + end + + # Current local status of this node. + # + # @see Docker::Models::SystemInfoResponse::Swarm#local_node_state + module LocalNodeState + extend Docker::Internal::Type::Enum + + EMPTY = :"" + INACTIVE = :inactive + PENDING = :pending + ACTIVE = :active + ERROR = :error + LOCKED = :locked + + # @!method self.values + # @return [Array] + end + + class RemoteManager < Docker::Internal::Type::BaseModel + # @!attribute addr + # IP address and ports at which this node can be reached. + # + # @return [String, nil] + optional :addr, String, api_name: :Addr + + # @!attribute node_id + # Unique identifier of for this node in the swarm. + # + # @return [String, nil] + optional :node_id, String, api_name: :NodeID + + # @!method initialize(addr: nil, node_id: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemInfoResponse::Swarm::RemoteManager} for more details. + # + # Represents a peer-node in the swarm + # + # @param addr [String] IP address and ports at which this node can be reached. + # + # @param node_id [String] Unique identifier of for this node in the swarm. + end + end + end + end +end diff --git a/lib/docker/models/system_ping_params.rb b/lib/docker/models/system_ping_params.rb new file mode 100644 index 0000000..9ddf84a --- /dev/null +++ b/lib/docker/models/system_ping_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::System#ping + class SystemPingParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/system_ping_response.rb b/lib/docker/models/system_ping_response.rb new file mode 100644 index 0000000..bba84eb --- /dev/null +++ b/lib/docker/models/system_ping_response.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module Docker + module Models + SystemPingResponse = String + end +end diff --git a/lib/docker/models/system_version_params.rb b/lib/docker/models/system_version_params.rb new file mode 100644 index 0000000..3d5e4d6 --- /dev/null +++ b/lib/docker/models/system_version_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::System#version + class SystemVersionParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/system_version_response.rb b/lib/docker/models/system_version_response.rb new file mode 100644 index 0000000..1537384 --- /dev/null +++ b/lib/docker/models/system_version_response.rb @@ -0,0 +1,164 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::System#version + class SystemVersionResponse < Docker::Internal::Type::BaseModel + # @!attribute api_version + # The default (and highest) API version that is supported by the daemon + # + # @return [String, nil] + optional :api_version, String, api_name: :ApiVersion + + # @!attribute arch + # Architecture of the daemon, as returned by the Go runtime (`GOARCH`). + # + # A full list of possible values can be found in the + # [Go documentation](https://go.dev/doc/install/source#environment). + # + # @return [String, nil] + optional :arch, String, api_name: :Arch + + # @!attribute build_time + # The date and time that the daemon was compiled. + # + # @return [String, nil] + optional :build_time, String, api_name: :BuildTime + + # @!attribute components + # Information about system components + # + # @return [Array, nil] + optional :components, + -> { Docker::Internal::Type::ArrayOf[Docker::Models::SystemVersionResponse::Component] }, + api_name: :Components + + # @!attribute experimental + # Indicates if the daemon is started with experimental features enabled. + # + # This field is omitted when empty / false. + # + # @return [Boolean, nil] + optional :experimental, Docker::Internal::Type::Boolean, api_name: :Experimental + + # @!attribute git_commit + # The Git commit of the source code that was used to build the daemon + # + # @return [String, nil] + optional :git_commit, String, api_name: :GitCommit + + # @!attribute go_version + # The version Go used to compile the daemon, and the version of the Go runtime in + # use. + # + # @return [String, nil] + optional :go_version, String, api_name: :GoVersion + + # @!attribute kernel_version + # The kernel version (`uname -r`) that the daemon is running on. + # + # This field is omitted when empty. + # + # @return [String, nil] + optional :kernel_version, String, api_name: :KernelVersion + + # @!attribute min_api_version + # The minimum API version that is supported by the daemon + # + # @return [String, nil] + optional :min_api_version, String, api_name: :MinAPIVersion + + # @!attribute os + # The operating system that the daemon is running on ("linux" or "windows") + # + # @return [String, nil] + optional :os, String, api_name: :Os + + # @!attribute platform + # + # @return [Docker::Models::SystemVersionResponse::Platform, nil] + optional :platform, -> { Docker::Models::SystemVersionResponse::Platform }, api_name: :Platform + + # @!attribute version + # The version of the daemon + # + # @return [String, nil] + optional :version, String, api_name: :Version + + # @!method initialize(api_version: nil, arch: nil, build_time: nil, components: nil, experimental: nil, git_commit: nil, go_version: nil, kernel_version: nil, min_api_version: nil, os: nil, platform: nil, version: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemVersionResponse} for more details. + # + # Response of Engine API: GET "/version" + # + # @param api_version [String] The default (and highest) API version that is supported by the daemon + # + # @param arch [String] Architecture of the daemon, as returned by the Go runtime (`GOARCH`). + # + # @param build_time [String] The date and time that the daemon was compiled. + # + # @param components [Array] Information about system components + # + # @param experimental [Boolean] Indicates if the daemon is started with experimental features enabled. + # + # @param git_commit [String] The Git commit of the source code that was used to build the daemon + # + # @param go_version [String] The version Go used to compile the daemon, and the version of the Go + # + # @param kernel_version [String] The kernel version (`uname -r`) that the daemon is running on. + # + # @param min_api_version [String] The minimum API version that is supported by the daemon + # + # @param os [String] The operating system that the daemon is running on ("linux" or "windows") + # + # @param platform [Docker::Models::SystemVersionResponse::Platform] + # + # @param version [String] The version of the daemon + + class Component < Docker::Internal::Type::BaseModel + # @!attribute name + # Name of the component + # + # @return [String] + required :name, String, api_name: :Name + + # @!attribute version + # Version of the component + # + # @return [String] + required :version, String, api_name: :Version + + # @!attribute details + # Key/value pairs of strings with additional information about the component. + # These values are intended for informational purposes only, and their content is + # not defined, and not part of the API specification. + # + # These messages can be printed by the client as information to the user. + # + # @return [Object, nil] + optional :details, Docker::Internal::Type::Unknown, api_name: :Details, nil?: true + + # @!method initialize(name:, version:, details: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::SystemVersionResponse::Component} for more details. + # + # @param name [String] Name of the component + # + # @param version [String] Version of the component + # + # @param details [Object, nil] Key/value pairs of strings with additional information about the + end + + # @see Docker::Models::SystemVersionResponse#platform + class Platform < Docker::Internal::Type::BaseModel + # @!attribute name + # + # @return [String] + required :name, String, api_name: :Name + + # @!method initialize(name:) + # @param name [String] + end + end + end +end diff --git a/lib/docker/models/volume.rb b/lib/docker/models/volume.rb new file mode 100644 index 0000000..5f89adb --- /dev/null +++ b/lib/docker/models/volume.rb @@ -0,0 +1,639 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Volumes#create + class Volume < Docker::Internal::Type::BaseModel + # @!attribute driver + # Name of the volume driver used by the volume. + # + # @return [String] + required :driver, String, api_name: :Driver + + # @!attribute labels + # User-defined key/value metadata. + # + # @return [Hash{Symbol=>String}] + required :labels, Docker::Internal::Type::HashOf[String], api_name: :Labels + + # @!attribute mountpoint + # Mount path of the volume on the host. + # + # @return [String] + required :mountpoint, String, api_name: :Mountpoint + + # @!attribute name + # Name of the volume. + # + # @return [String] + required :name, String, api_name: :Name + + # @!attribute options + # The driver specific options used when creating the volume. + # + # @return [Hash{Symbol=>String}] + required :options, Docker::Internal::Type::HashOf[String], api_name: :Options + + # @!attribute scope + # The level at which the volume exists. Either `global` for cluster-wide, or + # `local` for machine level. + # + # @return [Symbol, Docker::Models::Volume::Scope] + required :scope, enum: -> { Docker::Volume::Scope }, api_name: :Scope + + # @!attribute cluster_volume + # Options and information specific to, and only present on, Swarm CSI cluster + # volumes. + # + # @return [Docker::Models::Volume::ClusterVolume, nil] + optional :cluster_volume, -> { Docker::Volume::ClusterVolume }, api_name: :ClusterVolume + + # @!attribute created_at + # Date/Time the volume was created. + # + # @return [String, nil] + optional :created_at, String, api_name: :CreatedAt + + # @!attribute status + # Low-level details about the volume, provided by the volume driver. Details are + # returned as a map with key/value pairs: `{"key":"value","key2":"value2"}`. + # + # The `Status` field is optional, and is omitted if the volume driver does not + # support this feature. + # + # @return [Hash{Symbol=>Object}, nil] + optional :status, Docker::Internal::Type::HashOf[Docker::Internal::Type::Unknown], api_name: :Status + + # @!attribute usage_data + # Usage details about the volume. This information is used by the `GET /system/df` + # endpoint, and omitted in other endpoints. + # + # @return [Docker::Models::Volume::UsageData, nil] + optional :usage_data, -> { Docker::Volume::UsageData }, api_name: :UsageData, nil?: true + + # @!method initialize(driver:, labels:, mountpoint:, name:, options:, scope:, cluster_volume: nil, created_at: nil, status: nil, usage_data: nil) + # Some parameter documentations has been truncated, see {Docker::Models::Volume} + # for more details. + # + # @param driver [String] Name of the volume driver used by the volume. + # + # @param labels [Hash{Symbol=>String}] User-defined key/value metadata. + # + # @param mountpoint [String] Mount path of the volume on the host. + # + # @param name [String] Name of the volume. + # + # @param options [Hash{Symbol=>String}] The driver specific options used when creating the volume. + # + # @param scope [Symbol, Docker::Models::Volume::Scope] The level at which the volume exists. Either `global` for cluster-wide, + # + # @param cluster_volume [Docker::Models::Volume::ClusterVolume] Options and information specific to, and only present on, Swarm CSI + # + # @param created_at [String] Date/Time the volume was created. + # + # @param status [Hash{Symbol=>Object}] Low-level details about the volume, provided by the volume driver. + # + # @param usage_data [Docker::Models::Volume::UsageData, nil] Usage details about the volume. This information is used by the + + # The level at which the volume exists. Either `global` for cluster-wide, or + # `local` for machine level. + # + # @see Docker::Models::Volume#scope + module Scope + extend Docker::Internal::Type::Enum + + LOCAL = :local + GLOBAL = :global + + # @!method self.values + # @return [Array] + end + + # @see Docker::Models::Volume#cluster_volume + class ClusterVolume < Docker::Internal::Type::BaseModel + # @!attribute created_at + # + # @return [String, nil] + optional :created_at, String, api_name: :CreatedAt + + # @!attribute id + # The Swarm ID of this volume. Because cluster volumes are Swarm objects, they + # have an ID, unlike non-cluster volumes. This ID can be used to refer to the + # Volume instead of the name. + # + # @return [String, nil] + optional :id, String, api_name: :ID + + # @!attribute info + # Information about the global status of the volume. + # + # @return [Docker::Models::Volume::ClusterVolume::Info, nil] + optional :info, -> { Docker::Volume::ClusterVolume::Info }, api_name: :Info + + # @!attribute publish_status + # The status of the volume as it pertains to its publishing and use on specific + # nodes + # + # @return [Array, nil] + optional :publish_status, + -> { Docker::Internal::Type::ArrayOf[Docker::Volume::ClusterVolume::PublishStatus] }, + api_name: :PublishStatus + + # @!attribute spec + # Cluster-specific options used to create the volume. + # + # @return [Docker::Models::Volume::ClusterVolume::Spec, nil] + optional :spec, -> { Docker::Volume::ClusterVolume::Spec }, api_name: :Spec + + # @!attribute updated_at + # + # @return [String, nil] + optional :updated_at, String, api_name: :UpdatedAt + + # @!attribute version + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + # + # @return [Docker::Models::Volume::ClusterVolume::Version, nil] + optional :version, -> { Docker::Volume::ClusterVolume::Version }, api_name: :Version + + # @!method initialize(created_at: nil, id: nil, info: nil, publish_status: nil, spec: nil, updated_at: nil, version: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Volume::ClusterVolume} for more details. + # + # Options and information specific to, and only present on, Swarm CSI cluster + # volumes. + # + # @param created_at [String] + # + # @param id [String] The Swarm ID of this volume. Because cluster volumes are Swarm + # + # @param info [Docker::Models::Volume::ClusterVolume::Info] Information about the global status of the volume. + # + # @param publish_status [Array] The status of the volume as it pertains to its publishing and use on + # + # @param spec [Docker::Models::Volume::ClusterVolume::Spec] Cluster-specific options used to create the volume. + # + # @param updated_at [String] + # + # @param version [Docker::Models::Volume::ClusterVolume::Version] The version number of the object such as node, service, etc. This is needed + + # @see Docker::Models::Volume::ClusterVolume#info + class Info < Docker::Internal::Type::BaseModel + # @!attribute accessible_topology + # The topology this volume is actually accessible from. + # + # @return [ArrayString}>, nil] + optional :accessible_topology, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::HashOf[String]], + api_name: :AccessibleTopology + + # @!attribute capacity_bytes + # The capacity of the volume in bytes. A value of 0 indicates that the capacity is + # unknown. + # + # @return [Integer, nil] + optional :capacity_bytes, Integer, api_name: :CapacityBytes + + # @!attribute volume_context + # A map of strings to strings returned from the storage plugin when the volume is + # created. + # + # @return [Hash{Symbol=>String}, nil] + optional :volume_context, Docker::Internal::Type::HashOf[String], api_name: :VolumeContext + + # @!attribute volume_id + # The ID of the volume as returned by the CSI storage plugin. This is distinct + # from the volume's ID as provided by Docker. This ID is never used by the user + # when communicating with Docker to refer to this volume. If the ID is blank, then + # the Volume has not been successfully created in the plugin yet. + # + # @return [String, nil] + optional :volume_id, String, api_name: :VolumeID + + # @!method initialize(accessible_topology: nil, capacity_bytes: nil, volume_context: nil, volume_id: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Volume::ClusterVolume::Info} for more details. + # + # Information about the global status of the volume. + # + # @param accessible_topology [ArrayString}>] The topology this volume is actually accessible from. + # + # @param capacity_bytes [Integer] The capacity of the volume in bytes. A value of 0 indicates that + # + # @param volume_context [Hash{Symbol=>String}] A map of strings to strings returned from the storage plugin when + # + # @param volume_id [String] The ID of the volume as returned by the CSI storage plugin. This + end + + class PublishStatus < Docker::Internal::Type::BaseModel + # @!attribute node_id + # The ID of the Swarm node the volume is published on. + # + # @return [String, nil] + optional :node_id, String, api_name: :NodeID + + # @!attribute publish_context + # A map of strings to strings returned by the CSI controller plugin when a volume + # is published. + # + # @return [Hash{Symbol=>String}, nil] + optional :publish_context, Docker::Internal::Type::HashOf[String], api_name: :PublishContext + + # @!attribute state + # The published state of the volume. + # + # - `pending-publish` The volume should be published to this node, but the call to + # the controller plugin to do so has not yet been successfully completed. + # - `published` The volume is published successfully to the node. + # - `pending-node-unpublish` The volume should be unpublished from the node, and + # the manager is awaiting confirmation from the worker that it has done so. + # - `pending-controller-unpublish` The volume is successfully unpublished from the + # node, but has not yet been successfully unpublished on the controller. + # + # @return [Symbol, Docker::Models::Volume::ClusterVolume::PublishStatus::State, nil] + optional :state, enum: -> { Docker::Volume::ClusterVolume::PublishStatus::State }, api_name: :State + + # @!method initialize(node_id: nil, publish_context: nil, state: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Volume::ClusterVolume::PublishStatus} for more details. + # + # @param node_id [String] The ID of the Swarm node the volume is published on. + # + # @param publish_context [Hash{Symbol=>String}] A map of strings to strings returned by the CSI controller + # + # @param state [Symbol, Docker::Models::Volume::ClusterVolume::PublishStatus::State] The published state of the volume. + + # The published state of the volume. + # + # - `pending-publish` The volume should be published to this node, but the call to + # the controller plugin to do so has not yet been successfully completed. + # - `published` The volume is published successfully to the node. + # - `pending-node-unpublish` The volume should be unpublished from the node, and + # the manager is awaiting confirmation from the worker that it has done so. + # - `pending-controller-unpublish` The volume is successfully unpublished from the + # node, but has not yet been successfully unpublished on the controller. + # + # @see Docker::Models::Volume::ClusterVolume::PublishStatus#state + module State + extend Docker::Internal::Type::Enum + + PENDING_PUBLISH = :"pending-publish" + PUBLISHED = :published + PENDING_NODE_UNPUBLISH = :"pending-node-unpublish" + PENDING_CONTROLLER_UNPUBLISH = :"pending-controller-unpublish" + + # @!method self.values + # @return [Array] + end + end + + # @see Docker::Models::Volume::ClusterVolume#spec + class Spec < Docker::Internal::Type::BaseModel + # @!attribute access_mode + # Defines how the volume is used by tasks. + # + # @return [Docker::Models::Volume::ClusterVolume::Spec::AccessMode, nil] + optional :access_mode, -> { Docker::Volume::ClusterVolume::Spec::AccessMode }, api_name: :AccessMode + + # @!attribute group + # Group defines the volume group of this volume. Volumes belonging to the same + # group can be referred to by group name when creating Services. Referring to a + # volume by group instructs Swarm to treat volumes in that group interchangeably + # for the purpose of scheduling. Volumes with an empty string for a group + # technically all belong to the same, emptystring group. + # + # @return [String, nil] + optional :group, String, api_name: :Group + + # @!method initialize(access_mode: nil, group: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Volume::ClusterVolume::Spec} for more details. + # + # Cluster-specific options used to create the volume. + # + # @param access_mode [Docker::Models::Volume::ClusterVolume::Spec::AccessMode] Defines how the volume is used by tasks. + # + # @param group [String] Group defines the volume group of this volume. Volumes belonging to + + # @see Docker::Models::Volume::ClusterVolume::Spec#access_mode + class AccessMode < Docker::Internal::Type::BaseModel + # @!attribute accessibility_requirements + # Requirements for the accessible topology of the volume. These fields are + # optional. For an in-depth description of what these fields mean, see the CSI + # specification. + # + # @return [Docker::Models::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements, nil] + optional :accessibility_requirements, + -> { Docker::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements }, + api_name: :AccessibilityRequirements + + # @!attribute availability + # The availability of the volume for use in tasks. + # + # - `active` The volume is fully available for scheduling on the cluster + # - `pause` No new workloads should use the volume, but existing workloads are not + # stopped. + # - `drain` All workloads using this volume should be stopped and rescheduled, and + # no new ones should be started. + # + # @return [Symbol, Docker::Models::Volume::ClusterVolume::Spec::AccessMode::Availability, nil] + optional :availability, + enum: -> { Docker::Volume::ClusterVolume::Spec::AccessMode::Availability }, + api_name: :Availability + + # @!attribute capacity_range + # The desired capacity that the volume should be created with. If empty, the + # plugin will decide the capacity. + # + # @return [Docker::Models::Volume::ClusterVolume::Spec::AccessMode::CapacityRange, nil] + optional :capacity_range, + -> { Docker::Volume::ClusterVolume::Spec::AccessMode::CapacityRange }, + api_name: :CapacityRange + + # @!attribute mount_volume + # Options for using this volume as a Mount-type volume. + # + # Either MountVolume or BlockVolume, but not both, must be + # present. + # + # properties: FsType: type: "string" description: | Specifies the filesystem type + # for the mount volume. Optional. MountFlags: type: "array" description: | Flags + # to pass when mounting the volume. Optional. items: type: "string" BlockVolume: + # type: "object" description: | Options for using this volume as a Block-type + # volume. Intentionally empty. + # + # @return [Object, nil] + optional :mount_volume, Docker::Internal::Type::Unknown, api_name: :MountVolume + + # @!attribute scope + # The set of nodes this volume can be used on at one time. + # + # - `single` The volume may only be scheduled to one node at a time. + # - `multi` the volume may be scheduled to any supported number of nodes at a + # time. + # + # @return [Symbol, Docker::Models::Volume::ClusterVolume::Spec::AccessMode::Scope, nil] + optional :scope, + enum: -> { + Docker::Volume::ClusterVolume::Spec::AccessMode::Scope + }, + api_name: :Scope + + # @!attribute secrets + # Swarm Secrets that are passed to the CSI storage plugin when operating on this + # volume. + # + # @return [Array, nil] + optional :secrets, + -> { + Docker::Internal::Type::ArrayOf[Docker::Volume::ClusterVolume::Spec::AccessMode::Secret] + }, + api_name: :Secrets + + # @!attribute sharing + # The number and way that different tasks can use this volume at one time. + # + # - `none` The volume may only be used by one task at a time. + # - `readonly` The volume may be used by any number of tasks, but they all must + # mount the volume as readonly + # - `onewriter` The volume may be used by any number of tasks, but only one may + # mount it as read/write. + # - `all` The volume may have any number of readers and writers. + # + # @return [Symbol, Docker::Models::Volume::ClusterVolume::Spec::AccessMode::Sharing, nil] + optional :sharing, + enum: -> { Docker::Volume::ClusterVolume::Spec::AccessMode::Sharing }, + api_name: :Sharing + + # @!method initialize(accessibility_requirements: nil, availability: nil, capacity_range: nil, mount_volume: nil, scope: nil, secrets: nil, sharing: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Volume::ClusterVolume::Spec::AccessMode} for more details. + # + # Defines how the volume is used by tasks. + # + # @param accessibility_requirements [Docker::Models::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements] Requirements for the accessible topology of the volume. These + # + # @param availability [Symbol, Docker::Models::Volume::ClusterVolume::Spec::AccessMode::Availability] The availability of the volume for use in tasks. + # + # @param capacity_range [Docker::Models::Volume::ClusterVolume::Spec::AccessMode::CapacityRange] The desired capacity that the volume should be created with. If + # + # @param mount_volume [Object] Options for using this volume as a Mount-type volume. + # + # @param scope [Symbol, Docker::Models::Volume::ClusterVolume::Spec::AccessMode::Scope] The set of nodes this volume can be used on at one time. + # + # @param secrets [Array] Swarm Secrets that are passed to the CSI storage plugin when + # + # @param sharing [Symbol, Docker::Models::Volume::ClusterVolume::Spec::AccessMode::Sharing] The number and way that different tasks can use this volume + + # @see Docker::Models::Volume::ClusterVolume::Spec::AccessMode#accessibility_requirements + class AccessibilityRequirements < Docker::Internal::Type::BaseModel + # @!attribute preferred + # A list of topologies that the volume should attempt to be provisioned in. + # + # @return [ArrayString}>, nil] + optional :preferred, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::HashOf[String]], + api_name: :Preferred + + # @!attribute requisite + # A list of required topologies, at least one of which the volume must be + # accessible from. + # + # @return [ArrayString}>, nil] + optional :requisite, + Docker::Internal::Type::ArrayOf[Docker::Internal::Type::HashOf[String]], + api_name: :Requisite + + # @!method initialize(preferred: nil, requisite: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements} + # for more details. + # + # Requirements for the accessible topology of the volume. These fields are + # optional. For an in-depth description of what these fields mean, see the CSI + # specification. + # + # @param preferred [ArrayString}>] A list of topologies that the volume should attempt to be + # + # @param requisite [ArrayString}>] A list of required topologies, at least one of which the + end + + # The availability of the volume for use in tasks. + # + # - `active` The volume is fully available for scheduling on the cluster + # - `pause` No new workloads should use the volume, but existing workloads are not + # stopped. + # - `drain` All workloads using this volume should be stopped and rescheduled, and + # no new ones should be started. + # + # @see Docker::Models::Volume::ClusterVolume::Spec::AccessMode#availability + module Availability + extend Docker::Internal::Type::Enum + + ACTIVE = :active + PAUSE = :pause + DRAIN = :drain + + # @!method self.values + # @return [Array] + end + + # @see Docker::Models::Volume::ClusterVolume::Spec::AccessMode#capacity_range + class CapacityRange < Docker::Internal::Type::BaseModel + # @!attribute limit_bytes + # The volume must not be bigger than this. The value of 0 indicates an unspecified + # maximum. + # + # @return [Integer, nil] + optional :limit_bytes, Integer, api_name: :LimitBytes + + # @!attribute required_bytes + # The volume must be at least this big. The value of 0 indicates an unspecified + # minimum + # + # @return [Integer, nil] + optional :required_bytes, Integer, api_name: :RequiredBytes + + # @!method initialize(limit_bytes: nil, required_bytes: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Volume::ClusterVolume::Spec::AccessMode::CapacityRange} for + # more details. + # + # The desired capacity that the volume should be created with. If empty, the + # plugin will decide the capacity. + # + # @param limit_bytes [Integer] The volume must not be bigger than this. The value of 0 + # + # @param required_bytes [Integer] The volume must be at least this big. The value of 0 + end + + # The set of nodes this volume can be used on at one time. + # + # - `single` The volume may only be scheduled to one node at a time. + # - `multi` the volume may be scheduled to any supported number of nodes at a + # time. + # + # @see Docker::Models::Volume::ClusterVolume::Spec::AccessMode#scope + module Scope + extend Docker::Internal::Type::Enum + + SINGLE = :single + MULTI = :multi + + # @!method self.values + # @return [Array] + end + + class Secret < Docker::Internal::Type::BaseModel + # @!attribute key + # Key is the name of the key of the key-value pair passed to the plugin. + # + # @return [String, nil] + optional :key, String, api_name: :Key + + # @!attribute secret + # Secret is the swarm Secret object from which to read data. This can be a Secret + # name or ID. The Secret data is retrieved by swarm and used as the value of the + # key-value pair passed to the plugin. + # + # @return [String, nil] + optional :secret, String, api_name: :Secret + + # @!method initialize(key: nil, secret: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::Volume::ClusterVolume::Spec::AccessMode::Secret} for more + # details. + # + # One cluster volume secret entry. Defines a key-value pair that is passed to the + # plugin. + # + # @param key [String] Key is the name of the key of the key-value pair passed to + # + # @param secret [String] Secret is the swarm Secret object from which to read data. + end + + # The number and way that different tasks can use this volume at one time. + # + # - `none` The volume may only be used by one task at a time. + # - `readonly` The volume may be used by any number of tasks, but they all must + # mount the volume as readonly + # - `onewriter` The volume may be used by any number of tasks, but only one may + # mount it as read/write. + # - `all` The volume may have any number of readers and writers. + # + # @see Docker::Models::Volume::ClusterVolume::Spec::AccessMode#sharing + module Sharing + extend Docker::Internal::Type::Enum + + NONE = :none + READONLY = :readonly + ONEWRITER = :onewriter + ALL = :all + + # @!method self.values + # @return [Array] + end + end + end + + # @see Docker::Models::Volume::ClusterVolume#version + class Version < Docker::Internal::Type::BaseModel + # @!attribute index + # + # @return [Integer, nil] + optional :index, Integer, api_name: :Index + + # @!method initialize(index: nil) + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + # + # @param index [Integer] + end + end + + # @see Docker::Models::Volume#usage_data + class UsageData < Docker::Internal::Type::BaseModel + # @!attribute ref_count + # The number of containers referencing this volume. This field is set to `-1` if + # the reference-count is not available. + # + # @return [Integer] + required :ref_count, Integer, api_name: :RefCount + + # @!attribute size + # Amount of disk space used by the volume (in bytes). This information is only + # available for volumes created with the `"local"` volume driver. For volumes + # created with other volume drivers, this field is set to `-1` ("not available") + # + # @return [Integer] + required :size, Integer, api_name: :Size + + # @!method initialize(ref_count:, size:) + # Some parameter documentations has been truncated, see + # {Docker::Models::Volume::UsageData} for more details. + # + # Usage details about the volume. This information is used by the `GET /system/df` + # endpoint, and omitted in other endpoints. + # + # @param ref_count [Integer] The number of containers referencing this volume. This field + # + # @param size [Integer] Amount of disk space used by the volume (in bytes). This information + end + end + end +end diff --git a/lib/docker/models/volume_create_params.rb b/lib/docker/models/volume_create_params.rb new file mode 100644 index 0000000..9b78ae0 --- /dev/null +++ b/lib/docker/models/volume_create_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Volumes#create + class VolumeCreateParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/volume_delete_params.rb b/lib/docker/models/volume_delete_params.rb new file mode 100644 index 0000000..cecad57 --- /dev/null +++ b/lib/docker/models/volume_delete_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Volumes#delete + class VolumeDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute force + # Force the removal of the volume + # + # @return [Boolean, nil] + optional :force, Docker::Internal::Type::Boolean + + # @!method initialize(force: nil, request_options: {}) + # @param force [Boolean] Force the removal of the volume + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/volume_inspect_params.rb b/lib/docker/models/volume_inspect_params.rb new file mode 100644 index 0000000..0f1c97d --- /dev/null +++ b/lib/docker/models/volume_inspect_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Volumes#inspect_ + class VolumeInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/volume_list_params.rb b/lib/docker/models/volume_list_params.rb new file mode 100644 index 0000000..40abe60 --- /dev/null +++ b/lib/docker/models/volume_list_params.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Volumes#list + class VolumeListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + # @!attribute filters + # JSON encoded value of the filters (a `map[string][]string`) to process on the + # volumes list. Available filters: + # + # - `dangling=` When set to `true` (or `1`), returns all volumes that are + # not in use by a container. When set to `false` (or `0`), only volumes that are + # in use by one or more containers are returned. + # - `driver=` Matches volumes based on their driver. + # - `label=` or `label=:` Matches volumes based on the presence + # of a `label` alone or a `label` and a value. + # - `name=` Matches all or part of a volume name. + # + # @return [String, nil] + optional :filters, String + + # @!method initialize(filters: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Docker::Models::VolumeListParams} for more details. + # + # @param filters [String] JSON encoded value of the filters (a `map[string][]string`) to + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/docker/models/volume_list_response.rb b/lib/docker/models/volume_list_response.rb new file mode 100644 index 0000000..de190f5 --- /dev/null +++ b/lib/docker/models/volume_list_response.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module Docker + module Models + # @see Docker::Resources::Volumes#list + class VolumeListResponse < Docker::Internal::Type::BaseModel + # @!attribute volumes + # List of volumes + # + # @return [Array, nil] + optional :volumes, -> { Docker::Internal::Type::ArrayOf[Docker::Volume] }, api_name: :Volumes + + # @!attribute warnings + # Warnings that occurred when fetching the list of volumes. + # + # @return [Array, nil] + optional :warnings, Docker::Internal::Type::ArrayOf[String], api_name: :Warnings + + # @!method initialize(volumes: nil, warnings: nil) + # Some parameter documentations has been truncated, see + # {Docker::Models::VolumeListResponse} for more details. + # + # Volume list response + # + # @param volumes [Array] List of volumes + # + # @param warnings [Array] Warnings that occurred when fetching the list of volumes. + end + end +end diff --git a/lib/docker/request_options.rb b/lib/docker/request_options.rb new file mode 100644 index 0000000..c399ea3 --- /dev/null +++ b/lib/docker/request_options.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module Docker + # Specify HTTP behaviour to use for a specific request. These options supplement + # or override those provided at the client level. + # + # When making a request, you can pass an actual {RequestOptions} instance, or + # simply pass a Hash with symbol keys matching the attributes on this class. + class RequestOptions < Docker::Internal::Type::BaseModel + # @api private + # + # @param opts [Docker::RequestOptions, Hash{Symbol=>Object}] + # + # @raise [ArgumentError] + def self.validate!(opts) + case opts + in Docker::RequestOptions | Hash + opts.to_h.each_key do |k| + unless fields.include?(k) + raise ArgumentError.new("Request `opts` keys must be one of #{fields.keys}, got #{k.inspect}") + end + end + else + raise ArgumentError.new("Request `opts` must be a Hash or RequestOptions, got #{opts.inspect}") + end + end + + # @!attribute idempotency_key + # Idempotency key to send with request and all associated retries. Will only be + # sent for write requests. + # + # @return [String, nil] + optional :idempotency_key, String + + # @!attribute extra_query + # Extra query params to send with the request. These are `.merge`’d into any + # `query` given at the client level. + # + # @return [Hash{String=>Array, String, nil}, nil] + optional :extra_query, Docker::Internal::Type::HashOf[Docker::Internal::Type::ArrayOf[String]] + + # @!attribute extra_headers + # Extra headers to send with the request. These are `.merged`’d into any + # `extra_headers` given at the client level. + # + # @return [Hash{String=>String, nil}, nil] + optional :extra_headers, Docker::Internal::Type::HashOf[String, nil?: true] + + # @!attribute extra_body + # Extra data to send with the request. These are deep merged into any data + # generated as part of the normal request. + # + # @return [Object, nil] + optional :extra_body, Docker::Internal::Type::HashOf[Docker::Internal::Type::Unknown] + + # @!attribute max_retries + # Maximum number of retries to attempt after a failed initial request. + # + # @return [Integer, nil] + optional :max_retries, Integer + + # @!attribute timeout + # Request timeout in seconds. + # + # @return [Float, nil] + optional :timeout, Float + + # @!method initialize(values = {}) + # Returns a new instance of RequestOptions. + # + # @param values [Hash{Symbol=>Object}] + + define_sorbet_constant!(:OrHash) do + T.type_alias { T.any(Docker::RequestOptions, Docker::Internal::AnyHash) } + end + end +end diff --git a/lib/docker/resources/auth.rb b/lib/docker/resources/auth.rb new file mode 100644 index 0000000..046f865 --- /dev/null +++ b/lib/docker/resources/auth.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module Docker + module Resources + class Auth + # Validate credentials for a registry and, if available, get an identity token for + # accessing the registry without password. + # + # @overload login(password: nil, serveraddress: nil, username: nil, request_options: {}) + # + # @param password [String] + # @param serveraddress [String] + # @param username [String] + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::AuthResponse] + # + # @see Docker::Models::AuthLoginParams + def login(params = {}) + parsed, options = Docker::AuthLoginParams.dump_request(params) + @client.request( + method: :post, + path: "auth", + body: parsed, + model: Docker::AuthResponse, + options: options + ) + end + + # @api private + # + # @param client [Docker::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/lib/docker/resources/containers.rb b/lib/docker/resources/containers.rb new file mode 100644 index 0000000..8c50f1f --- /dev/null +++ b/lib/docker/resources/containers.rb @@ -0,0 +1,258 @@ +# frozen_string_literal: true + +module Docker + module Resources + class Containers + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerCreateParams} for more details. + # + # Create a container + # + # @overload create(config:, name: nil, platform: nil, request_options: {}) + # + # @param config [Docker::Models::ContainerCreateParams::Config] Body param: Configuration for a container that is portable between hosts. + # + # @param name [String] Query param: Assign the specified name to the container. Must match + # + # @param platform [String] Query param: Platform in the format `os[/arch[/variant]]` used for image lookup. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::CreateResponse] + # + # @see Docker::Models::ContainerCreateParams + def create(params) + parsed, options = Docker::ContainerCreateParams.dump_request(params) + @client.request( + method: :post, + path: "containers/create", + query: parsed.except(:config), + body: parsed[:config], + model: Docker::CreateResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerListParams} for more details. + # + # Returns a list of containers. For details on the format, see the + # [inspect endpoint](#operation/ContainerInspect). + # + # Note that it uses a different, smaller representation of a container than + # inspecting a single container. For example, the list of linked containers is not + # propagated . + # + # @overload list(all: nil, filters: nil, limit: nil, size: nil, request_options: {}) + # + # @param all [Boolean] Return all containers. By default, only running containers are shown. + # + # @param filters [String] Filters to process on the container list, encoded as JSON (a + # + # @param limit [Integer] Return this number of most recently created containers, including + # + # @param size [Boolean] Return the size of container as fields `SizeRw` and `SizeRootFs`. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Docker::Models::ContainerListParams + def list(params = {}) + parsed, options = Docker::ContainerListParams.dump_request(params) + @client.request( + method: :get, + path: "containers/json", + query: parsed, + model: Docker::Internal::Type::ArrayOf[Docker::Summary], + options: options + ) + end + + # Remove a container + # + # @overload delete(id, force: nil, link: nil, v: nil, request_options: {}) + # + # @param id [String] ID or name of the container + # + # @param force [Boolean] If the container is running, kill it before removing it. + # + # @param link [Boolean] Remove the specified link associated with the container. + # + # @param v [Boolean] Remove anonymous volumes associated with the container. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Docker::Models::ContainerDeleteParams + def delete(id, params = {}) + parsed, options = Docker::ContainerDeleteParams.dump_request(params) + @client.request( + method: :delete, + path: ["containers/%1$s", id], + query: parsed, + model: NilClass, + options: options + ) + end + + # Return low-level information about a container. + # + # @overload inspect_(id, size: nil, request_options: {}) + # + # @param id [String] ID or name of the container + # + # @param size [Boolean] Return the size of container as fields `SizeRw` and `SizeRootFs` + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::Container] + # + # @see Docker::Models::ContainerInspectParams + def inspect_(id, params = {}) + parsed, options = Docker::ContainerInspectParams.dump_request(params) + @client.request( + method: :get, + path: ["containers/%1$s/json", id], + query: parsed, + model: Docker::Container, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerKillParams} for more details. + # + # Send a POSIX signal to a container, defaulting to killing to the container. + # + # @overload kill(id, signal: nil, request_options: {}) + # + # @param id [String] ID or name of the container + # + # @param signal [String] Signal to send to the container as an integer or string (e.g. `SIGINT`). + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Docker::Models::ContainerKillParams + def kill(id, params = {}) + parsed, options = Docker::ContainerKillParams.dump_request(params) + @client.request( + method: :post, + path: ["containers/%1$s/kill", id], + query: parsed, + model: NilClass, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerLogsParams} for more details. + # + # Get `stdout` and `stderr` logs from a container. + # + # Note: This endpoint works only for containers with the `json-file` or `journald` + # logging driver. + # + # @overload logs(id, follow: nil, since: nil, stderr: nil, stdout: nil, tail: nil, timestamps: nil, until_: nil, request_options: {}) + # + # @param id [String] ID or name of the container + # + # @param follow [Boolean] Keep connection after returning logs. + # + # @param since [Integer] Only return logs since this time, as a UNIX timestamp + # + # @param stderr [Boolean] Return logs from `stderr` + # + # @param stdout [Boolean] Return logs from `stdout` + # + # @param tail [String] Only return this number of log lines from the end of the logs. + # + # @param timestamps [Boolean] Add timestamps to every log line + # + # @param until_ [Integer] Only return logs before this time, as a UNIX timestamp + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [StringIO] + # + # @see Docker::Models::ContainerLogsParams + def logs(id, params = {}) + parsed, options = Docker::ContainerLogsParams.dump_request(params) + @client.request( + method: :get, + path: ["containers/%1$s/logs", id], + query: parsed.transform_keys(until_: "until"), + headers: {"accept" => "application/vnd.docker.multiplexed-stream"}, + model: StringIO, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerStartParams} for more details. + # + # Start a container + # + # @overload start(id, detach_keys: nil, request_options: {}) + # + # @param id [String] ID or name of the container + # + # @param detach_keys [String] Override the key sequence for detaching a container. Format is a + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Docker::Models::ContainerStartParams + def start(id, params = {}) + parsed, options = Docker::ContainerStartParams.dump_request(params) + @client.request( + method: :post, + path: ["containers/%1$s/start", id], + query: parsed.transform_keys(detach_keys: "detachKeys"), + model: NilClass, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Docker::Models::ContainerStopParams} for more details. + # + # Stop a container + # + # @overload stop(id, signal: nil, t: nil, request_options: {}) + # + # @param id [String] ID or name of the container + # + # @param signal [String] Signal to send to the container as an integer or string (e.g. `SIGINT`). + # + # @param t [Integer] Number of seconds to wait before killing the container + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Docker::Models::ContainerStopParams + def stop(id, params = {}) + parsed, options = Docker::ContainerStopParams.dump_request(params) + @client.request( + method: :post, + path: ["containers/%1$s/stop", id], + query: parsed, + model: NilClass, + options: options + ) + end + + # @api private + # + # @param client [Docker::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/lib/docker/resources/images.rb b/lib/docker/resources/images.rb new file mode 100644 index 0000000..702c010 --- /dev/null +++ b/lib/docker/resources/images.rb @@ -0,0 +1,156 @@ +# frozen_string_literal: true + +module Docker + module Resources + class Images + # Some parameter documentations has been truncated, see + # {Docker::Models::ImageListParams} for more details. + # + # Returns a list of images on the server. Note that it uses a different, smaller + # representation of an image than inspecting a single image. + # + # @overload list(all: nil, digests: nil, filters: nil, manifests: nil, shared_size: nil, request_options: {}) + # + # @param all [Boolean] Show all images. Only images from a final layer (no children) are shown by defau + # + # @param digests [Boolean] Show digest information as a `RepoDigests` field on each image. + # + # @param filters [String] A JSON encoded value of the filters (a `map[string][]string`) to + # + # @param manifests [Boolean] Include `Manifests` in the image summary. + # + # @param shared_size [Boolean] Compute and show shared size as a `SharedSize` field on each image. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Docker::Models::ImageListParams + def list(params = {}) + parsed, options = Docker::ImageListParams.dump_request(params) + @client.request( + method: :get, + path: "images/json", + query: parsed.transform_keys(shared_size: "shared-size"), + model: Docker::Internal::Type::ArrayOf[Docker::Summary], + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Docker::Models::ImageDeleteParams} for more details. + # + # Remove an image, along with any untagged parent images that were referenced by + # that image. + # + # Images can't be removed if they have descendant images, are being used by a + # running container or are being used by a build. + # + # @overload delete(name, force: nil, noprune: nil, platforms: nil, request_options: {}) + # + # @param name [String] Image name or ID + # + # @param force [Boolean] Remove the image even if it is being used by stopped containers or has other tag + # + # @param noprune [Boolean] Do not delete untagged parent images + # + # @param platforms [Array] Select platform-specific content to delete. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Docker::Models::ImageDeleteParams + def delete(name, params = {}) + parsed, options = Docker::ImageDeleteParams.dump_request(params) + @client.request( + method: :delete, + path: ["images/%1$s", name], + query: parsed, + model: Docker::Internal::Type::ArrayOf[Docker::Models::ImageDeleteResponseItem], + options: options + ) + end + + # Return low-level information about an image. + # + # @overload inspect_(name, manifests: nil, request_options: {}) + # + # @param name [String] Image name or id + # + # @param manifests [Boolean] Include Manifests in the image summary. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::Image] + # + # @see Docker::Models::ImageInspectParams + def inspect_(name, params = {}) + parsed, options = Docker::ImageInspectParams.dump_request(params) + @client.request( + method: :get, + path: ["images/%1$s/json", name], + query: parsed, + model: Docker::Image, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Docker::Models::ImagePullParams} for more details. + # + # Pull or import an image. + # + # @overload pull(changes: nil, from_image: nil, from_src: nil, message: nil, platform: nil, repo: nil, tag: nil, body: nil, x_registry_auth: nil, request_options: {}) + # + # @param changes [Array] Query param: Apply `Dockerfile` instructions to the image that is created, + # + # @param from_image [String] Query param: Name of the image to pull. If the name includes a tag or digest, sp + # + # @param from_src [String] Query param: Source to import. The value may be a URL from which the image can b + # + # @param message [String] Query param: Set commit message for imported image. + # + # @param platform [String] Query param: Platform in the format os[/arch[/variant]]. + # + # @param repo [String] Query param: Repository name given to an image when it is imported. The repo may + # + # @param tag [String] Query param: Tag or digest. If empty when pulling an image, this causes all tags + # + # @param body [String] Body param + # + # @param x_registry_auth [String] Header param: A base64url-encoded auth configuration. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Docker::Models::ImagePullParams + def pull(params = {}) + parsed, options = Docker::ImagePullParams.dump_request(params) + query_params = [:changes, :from_image, :from_src, :message, :platform, :repo, :tag] + @client.request( + method: :post, + path: "images/create", + query: parsed.slice(*query_params).transform_keys(from_image: "fromImage", from_src: "fromSrc"), + headers: { + "content-type" => "application/octet-stream", + **parsed.except(:body, *query_params) + }.transform_keys( + x_registry_auth: "x-registry-auth" + ), + body: parsed[:body], + model: NilClass, + options: options + ) + end + + # @api private + # + # @param client [Docker::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/lib/docker/resources/networks.rb b/lib/docker/resources/networks.rb new file mode 100644 index 0000000..c84fe5a --- /dev/null +++ b/lib/docker/resources/networks.rb @@ -0,0 +1,139 @@ +# frozen_string_literal: true + +module Docker + module Resources + class Networks + # Some parameter documentations has been truncated, see + # {Docker::Models::NetworkCreateParams} for more details. + # + # Create a network + # + # @overload create(name:, attachable: nil, config_from: nil, config_only: nil, driver: nil, enable_i_pv4: nil, enable_i_pv6: nil, ingress: nil, internal: nil, ipam: nil, labels: nil, options: nil, scope: nil, request_options: {}) + # + # @param name [String] The network's name. + # + # @param attachable [Boolean] Globally scoped network is manually attachable by regular + # + # @param config_from [Docker::Models::NetworkCreateParams::ConfigFrom] The config-only network source to provide the configuration for + # + # @param config_only [Boolean] Creates a config-only network. Config-only networks are placeholder + # + # @param driver [String] Name of the network driver plugin to use. + # + # @param enable_i_pv4 [Boolean] Enable IPv4 on the network. + # + # @param enable_i_pv6 [Boolean] Enable IPv6 on the network. + # + # @param ingress [Boolean] Ingress network is the network which provides the routing-mesh + # + # @param internal [Boolean] Restrict external access to the network. + # + # @param ipam [Docker::Models::NetworkCreateParams::Ipam] + # + # @param labels [Hash{Symbol=>String}] User-defined key/value metadata. + # + # @param options [Hash{Symbol=>String}] Network specific options to be used by the drivers. + # + # @param scope [String] The level at which the network exists (e.g. `swarm` for cluster-wide + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::NetworkCreateResponse] + # + # @see Docker::Models::NetworkCreateParams + def create(params) + parsed, options = Docker::NetworkCreateParams.dump_request(params) + @client.request( + method: :post, + path: "networks/create", + body: parsed, + model: Docker::Models::NetworkCreateResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Docker::Models::NetworkListParams} for more details. + # + # Returns a list of networks. For details on the format, see the + # [network inspect endpoint](#operation/NetworkInspect). + # + # Note that it uses a different, smaller representation of a network than + # inspecting a single network. For example, the list of containers attached to the + # network is not propagated in API versions 1.28 and up. + # + # @overload list(filters: nil, request_options: {}) + # + # @param filters [String] JSON encoded value of the filters (a `map[string][]string`) to process + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Docker::Models::NetworkListParams + def list(params = {}) + parsed, options = Docker::NetworkListParams.dump_request(params) + @client.request( + method: :get, + path: "networks", + query: parsed, + model: Docker::Internal::Type::ArrayOf[Docker::Summary], + options: options + ) + end + + # Remove a network + # + # @overload delete(id, request_options: {}) + # + # @param id [String] Network ID or name + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Docker::Models::NetworkDeleteParams + def delete(id, params = {}) + @client.request( + method: :delete, + path: ["networks/%1$s", id], + model: NilClass, + options: params[:request_options] + ) + end + + # Inspect a network + # + # @overload inspect_(id, scope: nil, verbose: nil, request_options: {}) + # + # @param id [String] Network ID or name + # + # @param scope [String] Filter the network by scope (swarm, global, or local) + # + # @param verbose [Boolean] Detailed inspect output for troubleshooting + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::NetworkInspectResponse] + # + # @see Docker::Models::NetworkInspectParams + def inspect_(id, params = {}) + parsed, options = Docker::NetworkInspectParams.dump_request(params) + @client.request( + method: :get, + path: ["networks/%1$s", id], + query: parsed, + model: Docker::Models::NetworkInspectResponse, + options: options + ) + end + + # @api private + # + # @param client [Docker::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/lib/docker/resources/services.rb b/lib/docker/resources/services.rb new file mode 100644 index 0000000..5645198 --- /dev/null +++ b/lib/docker/resources/services.rb @@ -0,0 +1,113 @@ +# frozen_string_literal: true + +module Docker + module Resources + class Services + # Some parameter documentations has been truncated, see + # {Docker::Models::ServiceCreateParams} for more details. + # + # Create a service + # + # @overload create(spec:, x_registry_auth: nil, request_options: {}) + # + # @param spec [Docker::Models::ServiceCreateParams::Spec] Body param: User modifiable configuration for a service. + # + # @param x_registry_auth [String] Header param: A base64url-encoded auth configuration for pulling from private + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::ServiceCreateResponse] + # + # @see Docker::Models::ServiceCreateParams + def create(params) + parsed, options = Docker::ServiceCreateParams.dump_request(params) + @client.request( + method: :post, + path: "services/create", + headers: parsed.except(:spec).transform_keys(x_registry_auth: "x-registry-auth"), + body: parsed[:spec], + model: Docker::Models::ServiceCreateResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Docker::Models::ServiceListParams} for more details. + # + # List services + # + # @overload list(filters: nil, status: nil, request_options: {}) + # + # @param filters [String] A JSON encoded value of the filters (a `map[string][]string`) to + # + # @param status [Boolean] Include service status, with count of running and desired tasks. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Docker::Models::ServiceListParams + def list(params = {}) + parsed, options = Docker::ServiceListParams.dump_request(params) + @client.request( + method: :get, + path: "services", + query: parsed, + model: Docker::Internal::Type::ArrayOf[Docker::Service], + options: options + ) + end + + # Delete a service + # + # @overload delete(id, request_options: {}) + # + # @param id [String] ID or name of service. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Docker::Models::ServiceDeleteParams + def delete(id, params = {}) + @client.request( + method: :delete, + path: ["services/%1$s", id], + model: NilClass, + options: params[:request_options] + ) + end + + # Inspect a service + # + # @overload inspect_(id, insert_defaults: nil, request_options: {}) + # + # @param id [String] ID or name of service. + # + # @param insert_defaults [Boolean] Fill empty fields with default values. + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::Service] + # + # @see Docker::Models::ServiceInspectParams + def inspect_(id, params = {}) + parsed, options = Docker::ServiceInspectParams.dump_request(params) + @client.request( + method: :get, + path: ["services/%1$s", id], + query: parsed.transform_keys(insert_defaults: "insertDefaults"), + model: Docker::Service, + options: options + ) + end + + # @api private + # + # @param client [Docker::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/lib/docker/resources/system.rb b/lib/docker/resources/system.rb new file mode 100644 index 0000000..83484c3 --- /dev/null +++ b/lib/docker/resources/system.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +module Docker + module Resources + class System + # Get system information + # + # @overload info(request_options: {}) + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::SystemInfoResponse] + # + # @see Docker::Models::SystemInfoParams + def info(params = {}) + @client.request( + method: :get, + path: "info", + model: Docker::Models::SystemInfoResponse, + options: params[:request_options] + ) + end + + # This is a dummy endpoint you can use to test if the server is accessible. + # + # @overload ping(request_options: {}) + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [String] + # + # @see Docker::Models::SystemPingParams + def ping(params = {}) + @client.request( + method: :get, + path: "_ping", + headers: {"accept" => "text/plain"}, + model: String, + options: params[:request_options] + ) + end + + # Returns the version of Docker that is running and various information about the + # system that Docker is running on. + # + # @overload version(request_options: {}) + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::SystemVersionResponse] + # + # @see Docker::Models::SystemVersionParams + def version(params = {}) + @client.request( + method: :get, + path: "version", + model: Docker::Models::SystemVersionResponse, + options: params[:request_options] + ) + end + + # @api private + # + # @param client [Docker::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/lib/docker/resources/volumes.rb b/lib/docker/resources/volumes.rb new file mode 100644 index 0000000..c68027d --- /dev/null +++ b/lib/docker/resources/volumes.rb @@ -0,0 +1,105 @@ +# frozen_string_literal: true + +module Docker + module Resources + class Volumes + # Create a volume + # + # @overload create(create_request:, request_options: {}) + # + # @param create_request [Docker::Models::CreateRequest] Volume configuration + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::Volume] + # + # @see Docker::Models::VolumeCreateParams + def create(params) + parsed, options = Docker::VolumeCreateParams.dump_request(params) + @client.request( + method: :post, + path: "volumes/create", + body: parsed[:create_request], + model: Docker::Volume, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Docker::Models::VolumeListParams} for more details. + # + # List volumes + # + # @overload list(filters: nil, request_options: {}) + # + # @param filters [String] JSON encoded value of the filters (a `map[string][]string`) to + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::VolumeListResponse] + # + # @see Docker::Models::VolumeListParams + def list(params = {}) + parsed, options = Docker::VolumeListParams.dump_request(params) + @client.request( + method: :get, + path: "volumes", + query: parsed, + model: Docker::Models::VolumeListResponse, + options: options + ) + end + + # Instruct the driver to remove the volume. + # + # @overload delete(name, force: nil, request_options: {}) + # + # @param name [String] Volume name or ID + # + # @param force [Boolean] Force the removal of the volume + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Docker::Models::VolumeDeleteParams + def delete(name, params = {}) + parsed, options = Docker::VolumeDeleteParams.dump_request(params) + @client.request( + method: :delete, + path: ["volumes/%1$s", name], + query: parsed, + model: NilClass, + options: options + ) + end + + # Inspect a volume + # + # @overload inspect_(name, request_options: {}) + # + # @param name [String] Volume name or ID + # + # @param request_options [Docker::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Docker::Models::Volume] + # + # @see Docker::Models::VolumeInspectParams + def inspect_(name, params = {}) + @client.request( + method: :get, + path: ["volumes/%1$s", name], + model: Docker::Volume, + options: params[:request_options] + ) + end + + # @api private + # + # @param client [Docker::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/lib/docker/version.rb b/lib/docker/version.rb new file mode 100644 index 0000000..57da001 --- /dev/null +++ b/lib/docker/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module Docker + VERSION = "0.0.1" +end diff --git a/manifest.yaml b/manifest.yaml new file mode 100644 index 0000000..a1fd74a --- /dev/null +++ b/manifest.yaml @@ -0,0 +1,17 @@ +dependencies: + - English + - base64 + - cgi + - date + - erb + - etc + - json + - net/http + - openssl + - pathname + - rbconfig + - securerandom + - set + - stringio + - time + - uri diff --git a/rbi/docker/client.rbi b/rbi/docker/client.rbi new file mode 100644 index 0000000..ae837f8 --- /dev/null +++ b/rbi/docker/client.rbi @@ -0,0 +1,56 @@ +# typed: strong + +module Docker + class Client < Docker::Internal::Transport::BaseClient + DEFAULT_MAX_RETRIES = 2 + + DEFAULT_TIMEOUT_IN_SECONDS = T.let(60.0, Float) + + DEFAULT_INITIAL_RETRY_DELAY = T.let(0.5, Float) + + DEFAULT_MAX_RETRY_DELAY = T.let(8.0, Float) + + sig { returns(Docker::Resources::Auth) } + attr_reader :auth + + sig { returns(Docker::Resources::System) } + attr_reader :system_ + + sig { returns(Docker::Resources::Containers) } + attr_reader :containers + + sig { returns(Docker::Resources::Images) } + attr_reader :images + + sig { returns(Docker::Resources::Networks) } + attr_reader :networks + + sig { returns(Docker::Resources::Volumes) } + attr_reader :volumes + + sig { returns(Docker::Resources::Services) } + attr_reader :services + + # Creates and returns a new client for interacting with the API. + sig do + params( + base_url: T.nilable(String), + max_retries: Integer, + timeout: Float, + initial_retry_delay: Float, + max_retry_delay: Float + ).returns(T.attached_class) + end + def self.new( + # Override the default base URL for the API, e.g., + # `"https://api.example.com/v2/"`. Defaults to `ENV["DOCKER_BASE_URL"]` + base_url: ENV["DOCKER_BASE_URL"], + # Max number of retries to attempt after a failed retryable request. + max_retries: Docker::Client::DEFAULT_MAX_RETRIES, + timeout: Docker::Client::DEFAULT_TIMEOUT_IN_SECONDS, + initial_retry_delay: Docker::Client::DEFAULT_INITIAL_RETRY_DELAY, + max_retry_delay: Docker::Client::DEFAULT_MAX_RETRY_DELAY + ) + end + end +end diff --git a/rbi/docker/errors.rbi b/rbi/docker/errors.rbi new file mode 100644 index 0000000..9e4bcab --- /dev/null +++ b/rbi/docker/errors.rbi @@ -0,0 +1,205 @@ +# typed: strong + +module Docker + module Errors + class Error < StandardError + sig { returns(T.nilable(StandardError)) } + attr_accessor :cause + end + + class ConversionError < Docker::Errors::Error + sig { returns(T.nilable(StandardError)) } + def cause + end + + # @api private + sig do + params( + on: T::Class[StandardError], + method: Symbol, + target: T.anything, + value: T.anything, + cause: T.nilable(StandardError) + ).returns(T.attached_class) + end + def self.new(on:, method:, target:, value:, cause: nil) + end + end + + class APIError < Docker::Errors::Error + sig { returns(URI::Generic) } + attr_accessor :url + + sig { returns(T.nilable(Integer)) } + attr_accessor :status + + sig { returns(T.nilable(T::Hash[String, String])) } + attr_accessor :headers + + sig { returns(T.nilable(T.anything)) } + attr_accessor :body + + # @api private + sig do + params( + url: URI::Generic, + status: T.nilable(Integer), + headers: T.nilable(T::Hash[String, String]), + body: T.nilable(Object), + request: NilClass, + response: NilClass, + message: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + url:, + status: nil, + headers: nil, + body: nil, + request: nil, + response: nil, + message: nil + ) + end + end + + class APIConnectionError < Docker::Errors::APIError + sig { returns(NilClass) } + attr_accessor :status + + sig { returns(NilClass) } + attr_accessor :body + + # @api private + sig do + params( + url: URI::Generic, + status: NilClass, + headers: T.nilable(T::Hash[String, String]), + body: NilClass, + request: NilClass, + response: NilClass, + message: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + url:, + status: nil, + headers: nil, + body: nil, + request: nil, + response: nil, + message: "Connection error." + ) + end + end + + class APITimeoutError < Docker::Errors::APIConnectionError + # @api private + sig do + params( + url: URI::Generic, + status: NilClass, + headers: T.nilable(T::Hash[String, String]), + body: NilClass, + request: NilClass, + response: NilClass, + message: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + url:, + status: nil, + headers: nil, + body: nil, + request: nil, + response: nil, + message: "Request timed out." + ) + end + end + + class APIStatusError < Docker::Errors::APIError + # @api private + sig do + params( + url: URI::Generic, + status: Integer, + headers: T.nilable(T::Hash[String, String]), + body: T.nilable(Object), + request: NilClass, + response: NilClass, + message: T.nilable(String) + ).returns(T.attached_class) + end + def self.for( + url:, + status:, + headers:, + body:, + request:, + response:, + message: nil + ) + end + + sig { returns(Integer) } + attr_accessor :status + + # @api private + sig do + params( + url: URI::Generic, + status: Integer, + headers: T.nilable(T::Hash[String, String]), + body: T.nilable(Object), + request: NilClass, + response: NilClass, + message: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + url:, + status:, + headers:, + body:, + request:, + response:, + message: nil + ) + end + end + + class BadRequestError < Docker::Errors::APIStatusError + HTTP_STATUS = 400 + end + + class AuthenticationError < Docker::Errors::APIStatusError + HTTP_STATUS = 401 + end + + class PermissionDeniedError < Docker::Errors::APIStatusError + HTTP_STATUS = 403 + end + + class NotFoundError < Docker::Errors::APIStatusError + HTTP_STATUS = 404 + end + + class ConflictError < Docker::Errors::APIStatusError + HTTP_STATUS = 409 + end + + class UnprocessableEntityError < Docker::Errors::APIStatusError + HTTP_STATUS = 422 + end + + class RateLimitError < Docker::Errors::APIStatusError + HTTP_STATUS = 429 + end + + class InternalServerError < Docker::Errors::APIStatusError + HTTP_STATUS = T.let((500..), T::Range[Integer]) + end + end +end diff --git a/rbi/docker/file_part.rbi b/rbi/docker/file_part.rbi new file mode 100644 index 0000000..79d9d7f --- /dev/null +++ b/rbi/docker/file_part.rbi @@ -0,0 +1,37 @@ +# typed: strong + +module Docker + class FilePart + sig { returns(T.any(Pathname, StringIO, IO, String)) } + attr_reader :content + + sig { returns(T.nilable(String)) } + attr_reader :content_type + + sig { returns(T.nilable(String)) } + attr_reader :filename + + # @api private + sig { returns(String) } + private def read + end + + sig { params(a: T.anything).returns(String) } + def to_json(*a) + end + + sig { params(a: T.anything).returns(String) } + def to_yaml(*a) + end + + sig do + params( + content: T.any(Pathname, StringIO, IO, String), + filename: T.nilable(T.any(Pathname, String)), + content_type: T.nilable(String) + ).returns(T.attached_class) + end + def self.new(content, filename: nil, content_type: nil) + end + end +end diff --git a/rbi/docker/internal.rbi b/rbi/docker/internal.rbi new file mode 100644 index 0000000..6fbc109 --- /dev/null +++ b/rbi/docker/internal.rbi @@ -0,0 +1,16 @@ +# typed: strong + +module Docker + module Internal + extend Docker::Internal::Util::SorbetRuntimeSupport + + # Due to the current WIP status of Shapes support in Sorbet, types referencing + # this alias might be refined in the future. + AnyHash = T.type_alias { T::Hash[Symbol, T.anything] } + + FileInput = + T.type_alias { T.any(Pathname, StringIO, IO, String, Docker::FilePart) } + + OMIT = T.let(Object.new.freeze, T.anything) + end +end diff --git a/rbi/docker/internal/transport/base_client.rbi b/rbi/docker/internal/transport/base_client.rbi new file mode 100644 index 0000000..b427de0 --- /dev/null +++ b/rbi/docker/internal/transport/base_client.rbi @@ -0,0 +1,292 @@ +# typed: strong + +module Docker + module Internal + module Transport + # @api private + class BaseClient + extend Docker::Internal::Util::SorbetRuntimeSupport + + abstract! + + RequestComponents = + T.type_alias do + { + method: Symbol, + path: T.any(String, T::Array[String]), + query: + T.nilable( + T::Hash[String, T.nilable(T.any(T::Array[String], String))] + ), + headers: + T.nilable( + T::Hash[ + String, + T.nilable( + T.any( + String, + Integer, + T::Array[T.nilable(T.any(String, Integer))] + ) + ) + ] + ), + body: T.nilable(T.anything), + unwrap: + T.nilable( + T.any( + Symbol, + Integer, + T::Array[T.any(Symbol, Integer)], + T.proc.params(arg0: T.anything).returns(T.anything) + ) + ), + page: + T.nilable( + T::Class[ + Docker::Internal::Type::BasePage[ + Docker::Internal::Type::BaseModel + ] + ] + ), + stream: T.nilable(T::Class[T.anything]), + model: T.nilable(Docker::Internal::Type::Converter::Input), + options: T.nilable(Docker::RequestOptions::OrHash) + } + end + + RequestInput = + T.type_alias do + { + method: Symbol, + url: URI::Generic, + headers: T::Hash[String, String], + body: T.anything, + max_retries: Integer, + timeout: Float + } + end + + # from whatwg fetch spec + MAX_REDIRECTS = 20 + + PLATFORM_HEADERS = T::Hash[String, String] + + class << self + # @api private + sig do + params( + req: Docker::Internal::Transport::BaseClient::RequestComponents + ).void + end + def validate!(req) + end + + # @api private + sig do + params(status: Integer, headers: T::Hash[String, String]).returns( + T::Boolean + ) + end + def should_retry?(status, headers:) + end + + # @api private + sig do + params( + request: Docker::Internal::Transport::BaseClient::RequestInput, + status: Integer, + response_headers: T::Hash[String, String] + ).returns(Docker::Internal::Transport::BaseClient::RequestInput) + end + def follow_redirect(request, status:, response_headers:) + end + + # @api private + sig do + params( + status: T.any(Integer, Docker::Errors::APIConnectionError), + stream: T.nilable(T::Enumerable[String]) + ).void + end + def reap_connection!(status, stream:) + end + end + + sig { returns(URI::Generic) } + attr_reader :base_url + + sig { returns(Float) } + attr_reader :timeout + + sig { returns(Integer) } + attr_reader :max_retries + + sig { returns(Float) } + attr_reader :initial_retry_delay + + sig { returns(Float) } + attr_reader :max_retry_delay + + sig { returns(T::Hash[String, String]) } + attr_reader :headers + + sig { returns(T.nilable(String)) } + attr_reader :idempotency_header + + # @api private + sig { returns(Docker::Internal::Transport::PooledNetRequester) } + attr_reader :requester + + # @api private + sig do + params( + base_url: String, + timeout: Float, + max_retries: Integer, + initial_retry_delay: Float, + max_retry_delay: Float, + headers: + T::Hash[ + String, + T.nilable( + T.any( + String, + Integer, + T::Array[T.nilable(T.any(String, Integer))] + ) + ) + ], + idempotency_header: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + base_url:, + timeout: 0.0, + max_retries: 0, + initial_retry_delay: 0.0, + max_retry_delay: 0.0, + headers: {}, + idempotency_header: nil + ) + end + + # @api private + sig { returns(String) } + private def user_agent + end + + # @api private + sig { returns(String) } + private def generate_idempotency_key + end + + # @api private + sig do + overridable + .params( + req: Docker::Internal::Transport::BaseClient::RequestComponents, + opts: Docker::Internal::AnyHash + ) + .returns(Docker::Internal::Transport::BaseClient::RequestInput) + end + private def build_request(req, opts) + end + + # @api private + sig do + params( + headers: T::Hash[String, String], + retry_count: Integer + ).returns(Float) + end + private def retry_delay(headers, retry_count:) + end + + # @api private + sig do + params( + request: Docker::Internal::Transport::BaseClient::RequestInput, + redirect_count: Integer, + retry_count: Integer, + send_retry_header: T::Boolean + ).returns([Integer, Net::HTTPResponse, T::Enumerable[String]]) + end + def send_request( + request, + redirect_count:, + retry_count:, + send_retry_header: + ) + end + + # Execute the request specified by `req`. This is the method that all resource + # methods call into. + # + # @overload request(method, path, query: {}, headers: {}, body: nil, unwrap: nil, page: nil, stream: nil, model: Docker::Internal::Type::Unknown, options: {}) + sig do + params( + method: Symbol, + path: T.any(String, T::Array[String]), + query: + T.nilable( + T::Hash[String, T.nilable(T.any(T::Array[String], String))] + ), + headers: + T.nilable( + T::Hash[ + String, + T.nilable( + T.any( + String, + Integer, + T::Array[T.nilable(T.any(String, Integer))] + ) + ) + ] + ), + body: T.nilable(T.anything), + unwrap: + T.nilable( + T.any( + Symbol, + Integer, + T::Array[T.any(Symbol, Integer)], + T.proc.params(arg0: T.anything).returns(T.anything) + ) + ), + page: + T.nilable( + T::Class[ + Docker::Internal::Type::BasePage[ + Docker::Internal::Type::BaseModel + ] + ] + ), + stream: T.nilable(T::Class[T.anything]), + model: T.nilable(Docker::Internal::Type::Converter::Input), + options: T.nilable(Docker::RequestOptions::OrHash) + ).returns(T.anything) + end + def request( + method, + path, + query: {}, + headers: {}, + body: nil, + unwrap: nil, + page: nil, + stream: nil, + model: Docker::Internal::Type::Unknown, + options: {} + ) + end + + # @api private + sig { returns(String) } + def inspect + end + end + end + end +end diff --git a/rbi/docker/internal/transport/pooled_net_requester.rbi b/rbi/docker/internal/transport/pooled_net_requester.rbi new file mode 100644 index 0000000..7aff6f7 --- /dev/null +++ b/rbi/docker/internal/transport/pooled_net_requester.rbi @@ -0,0 +1,82 @@ +# typed: strong + +module Docker + module Internal + module Transport + # @api private + class PooledNetRequester + extend Docker::Internal::Util::SorbetRuntimeSupport + + Request = + T.type_alias do + { + method: Symbol, + url: URI::Generic, + headers: T::Hash[String, String], + body: T.anything, + deadline: Float + } + end + + # from the golang stdlib + # https://github.com/golang/go/blob/c8eced8580028328fde7c03cbfcb720ce15b2358/src/net/http/transport.go#L49 + KEEP_ALIVE_TIMEOUT = 30 + + DEFAULT_MAX_CONNECTIONS = T.let(T.unsafe(nil), Integer) + + class << self + # @api private + sig do + params(cert_store: OpenSSL::X509::Store, url: URI::Generic).returns( + Net::HTTP + ) + end + def connect(cert_store:, url:) + end + + # @api private + sig { params(conn: Net::HTTP, deadline: Float).void } + def calibrate_socket_timeout(conn, deadline) + end + + # @api private + sig do + params( + request: Docker::Internal::Transport::PooledNetRequester::Request, + blk: T.proc.params(arg0: String).void + ).returns([Net::HTTPGenericRequest, T.proc.void]) + end + def build_request(request, &blk) + end + end + + # @api private + sig do + params( + url: URI::Generic, + deadline: Float, + blk: T.proc.params(arg0: Net::HTTP).void + ).void + end + private def with_pool(url, deadline:, &blk) + end + + # @api private + sig do + params( + request: Docker::Internal::Transport::PooledNetRequester::Request + ).returns([Integer, Net::HTTPResponse, T::Enumerable[String]]) + end + def execute(request) + end + + # @api private + sig { params(size: Integer).returns(T.attached_class) } + def self.new( + size: Docker::Internal::Transport::PooledNetRequester::DEFAULT_MAX_CONNECTIONS + ) + end + end + end + end +end diff --git a/rbi/docker/internal/type/array_of.rbi b/rbi/docker/internal/type/array_of.rbi new file mode 100644 index 0000000..c94adfb --- /dev/null +++ b/rbi/docker/internal/type/array_of.rbi @@ -0,0 +1,104 @@ +# typed: strong + +module Docker + module Internal + module Type + # @api private + # + # Array of items of a given type. + class ArrayOf + include Docker::Internal::Type::Converter + include Docker::Internal::Util::SorbetRuntimeSupport + + abstract! + + Elem = type_member(:out) + + sig do + params( + type_info: + T.any( + Docker::Internal::AnyHash, + T.proc.returns(Docker::Internal::Type::Converter::Input), + Docker::Internal::Type::Converter::Input + ), + spec: Docker::Internal::AnyHash + ).returns(T.attached_class) + end + def self.[](type_info, spec = {}) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ==(other) + end + + sig { returns(Integer) } + def hash + end + + # @api private + sig do + override + .params( + value: T.any(T::Array[T.anything], T.anything), + state: Docker::Internal::Type::Converter::CoerceState + ) + .returns(T.any(T::Array[T.anything], T.anything)) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.any(T::Array[T.anything], T.anything), + state: Docker::Internal::Type::Converter::DumpState + ) + .returns(T.any(T::Array[T.anything], T.anything)) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + + # @api private + sig { returns(Elem) } + protected def item_type + end + + # @api private + sig { returns(T::Boolean) } + protected def nilable? + end + + # @api private + sig do + params( + type_info: + T.any( + Docker::Internal::AnyHash, + T.proc.returns(Docker::Internal::Type::Converter::Input), + Docker::Internal::Type::Converter::Input + ), + spec: Docker::Internal::AnyHash + ).void + end + def initialize(type_info, spec = {}) + end + + # @api private + sig { params(depth: Integer).returns(String) } + def inspect(depth: 0) + end + end + end + end +end diff --git a/rbi/docker/internal/type/base_model.rbi b/rbi/docker/internal/type/base_model.rbi new file mode 100644 index 0000000..5ffd4a6 --- /dev/null +++ b/rbi/docker/internal/type/base_model.rbi @@ -0,0 +1,299 @@ +# typed: strong + +module Docker + module Internal + module Type + class BaseModel + extend Docker::Internal::Type::Converter + extend Docker::Internal::Util::SorbetRuntimeSupport + + abstract! + + KnownField = + T.type_alias do + { + mode: T.nilable(Symbol), + required: T::Boolean, + nilable: T::Boolean + } + end + + OrHash = + T.type_alias do + T.any(Docker::Internal::Type::BaseModel, Docker::Internal::AnyHash) + end + + class << self + # @api private + # + # Assumes superclass fields are totally defined before fields are accessed / + # defined on subclasses. + sig { params(child: Docker::Internal::Type::BaseModel).void } + def inherited(child) + end + + # @api private + sig do + returns( + T::Hash[ + Symbol, + T.all( + Docker::Internal::Type::BaseModel::KnownField, + { + type_fn: + T.proc.returns(Docker::Internal::Type::Converter::Input) + } + ) + ] + ) + end + def known_fields + end + + # @api private + sig do + returns( + T::Hash[ + Symbol, + T.all( + Docker::Internal::Type::BaseModel::KnownField, + { type: Docker::Internal::Type::Converter::Input } + ) + ] + ) + end + def fields + end + + # @api private + sig do + params( + name_sym: Symbol, + required: T::Boolean, + type_info: + T.any( + { + const: + T.nilable( + T.any(NilClass, T::Boolean, Integer, Float, Symbol) + ), + enum: + T.nilable( + T.proc.returns(Docker::Internal::Type::Converter::Input) + ), + union: + T.nilable( + T.proc.returns(Docker::Internal::Type::Converter::Input) + ), + api_name: Symbol, + nil?: T::Boolean + }, + T.proc.returns(Docker::Internal::Type::Converter::Input), + Docker::Internal::Type::Converter::Input + ), + spec: Docker::Internal::AnyHash + ).void + end + private def add_field(name_sym, required:, type_info:, spec:) + end + + # @api private + sig do + params( + name_sym: Symbol, + type_info: + T.any( + Docker::Internal::AnyHash, + T.proc.returns(Docker::Internal::Type::Converter::Input), + Docker::Internal::Type::Converter::Input + ), + spec: Docker::Internal::AnyHash + ).void + end + def required(name_sym, type_info, spec = {}) + end + + # @api private + sig do + params( + name_sym: Symbol, + type_info: + T.any( + Docker::Internal::AnyHash, + T.proc.returns(Docker::Internal::Type::Converter::Input), + Docker::Internal::Type::Converter::Input + ), + spec: Docker::Internal::AnyHash + ).void + end + def optional(name_sym, type_info, spec = {}) + end + + # @api private + # + # `request_only` attributes not excluded from `.#coerce` when receiving responses + # even if well behaved servers should not send them + sig { params(blk: T.proc.void).void } + private def request_only(&blk) + end + + # @api private + # + # `response_only` attributes are omitted from `.#dump` when making requests + sig { params(blk: T.proc.void).void } + private def response_only(&blk) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ==(other) + end + + sig { returns(Integer) } + def hash + end + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ==(other) + end + + sig { returns(Integer) } + def hash + end + + class << self + # @api private + sig do + override + .params( + value: + T.any( + Docker::Internal::Type::BaseModel, + T::Hash[T.anything, T.anything], + T.anything + ), + state: Docker::Internal::Type::Converter::CoerceState + ) + .returns(T.any(T.attached_class, T.anything)) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.any(T.attached_class, T.anything), + state: Docker::Internal::Type::Converter::DumpState + ) + .returns(T.any(T::Hash[T.anything, T.anything], T.anything)) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + end + + class << self + # @api private + sig do + params( + model: Docker::Internal::Type::BaseModel, + convert: T::Boolean + ).returns(Docker::Internal::AnyHash) + end + def recursively_to_h(model, convert:) + end + end + + # Returns the raw value associated with the given key, if found. Otherwise, nil is + # returned. + # + # It is valid to lookup keys that are not in the API spec, for example to access + # undocumented features. This method does not parse response data into + # higher-level types. Lookup by anything other than a Symbol is an ArgumentError. + sig { params(key: Symbol).returns(T.nilable(T.anything)) } + def [](key) + end + + # Returns a Hash of the data underlying this object. O(1) + # + # Keys are Symbols and values are the raw values from the response. The return + # value indicates which values were ever set on the object. i.e. there will be a + # key in this hash if they ever were, even if the set value was nil. + # + # This method is not recursive. The returned value is shared by the object, so it + # should not be mutated. + sig { overridable.returns(Docker::Internal::AnyHash) } + def to_h + end + + # Returns a Hash of the data underlying this object. O(1) + # + # Keys are Symbols and values are the raw values from the response. The return + # value indicates which values were ever set on the object. i.e. there will be a + # key in this hash if they ever were, even if the set value was nil. + # + # This method is not recursive. The returned value is shared by the object, so it + # should not be mutated. + sig { overridable.returns(Docker::Internal::AnyHash) } + def to_hash + end + + # In addition to the behaviour of `#to_h`, this method will recursively call + # `#to_h` on nested models. + sig { overridable.returns(Docker::Internal::AnyHash) } + def deep_to_h + end + + sig do + params(keys: T.nilable(T::Array[Symbol])).returns( + Docker::Internal::AnyHash + ) + end + def deconstruct_keys(keys) + end + + sig { params(a: T.anything).returns(String) } + def to_json(*a) + end + + sig { params(a: T.anything).returns(String) } + def to_yaml(*a) + end + + # Create a new instance of a model. + sig do + params( + data: + T.any( + T::Hash[Symbol, T.anything], + Docker::Internal::Type::BaseModel + ) + ).returns(T.attached_class) + end + def self.new(data = {}) + end + + class << self + # @api private + sig { params(depth: Integer).returns(String) } + def inspect(depth: 0) + end + end + + sig { returns(String) } + def to_s + end + + # @api private + sig { returns(String) } + def inspect + end + end + end + end +end diff --git a/rbi/docker/internal/type/base_page.rbi b/rbi/docker/internal/type/base_page.rbi new file mode 100644 index 0000000..e61eab0 --- /dev/null +++ b/rbi/docker/internal/type/base_page.rbi @@ -0,0 +1,42 @@ +# typed: strong + +module Docker + module Internal + module Type + # @api private + # + # This module provides a base implementation for paginated responses in the SDK. + module BasePage + Elem = type_member(:out) + + sig { overridable.returns(T::Boolean) } + def next_page? + end + + sig { overridable.returns(T.self_type) } + def next_page + end + + sig { overridable.params(blk: T.proc.params(arg0: Elem).void).void } + def auto_paging_each(&blk) + end + + sig { returns(T::Enumerable[Elem]) } + def to_enum + end + + # @api private + sig do + params( + client: Docker::Internal::Transport::BaseClient, + req: Docker::Internal::Transport::BaseClient::RequestComponents, + headers: T::Hash[String, String], + page_data: T.anything + ).void + end + def initialize(client:, req:, headers:, page_data:) + end + end + end + end +end diff --git a/rbi/docker/internal/type/boolean.rbi b/rbi/docker/internal/type/boolean.rbi new file mode 100644 index 0000000..5251971 --- /dev/null +++ b/rbi/docker/internal/type/boolean.rbi @@ -0,0 +1,58 @@ +# typed: strong + +module Docker + module Internal + module Type + # @api private + # + # Ruby has no Boolean class; this is something for models to refer to. + class Boolean + extend Docker::Internal::Type::Converter + extend Docker::Internal::Util::SorbetRuntimeSupport + + abstract! + + sig { params(other: T.anything).returns(T::Boolean) } + def self.===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def self.==(other) + end + + class << self + # @api private + # + # Coerce value to Boolean if possible, otherwise return the original value. + sig do + override + .params( + value: T.any(T::Boolean, T.anything), + state: Docker::Internal::Type::Converter::CoerceState + ) + .returns(T.any(T::Boolean, T.anything)) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.any(T::Boolean, T.anything), + state: Docker::Internal::Type::Converter::DumpState + ) + .returns(T.any(T::Boolean, T.anything)) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + end + end + end + end +end diff --git a/rbi/docker/internal/type/converter.rbi b/rbi/docker/internal/type/converter.rbi new file mode 100644 index 0000000..11dd598 --- /dev/null +++ b/rbi/docker/internal/type/converter.rbi @@ -0,0 +1,204 @@ +# typed: strong + +module Docker + module Internal + module Type + # @api private + module Converter + extend Docker::Internal::Util::SorbetRuntimeSupport + + Input = + T.type_alias do + T.any(Docker::Internal::Type::Converter, T::Class[T.anything]) + end + + CoerceState = + T.type_alias do + { + translate_names: T::Boolean, + strictness: T::Boolean, + exactness: { + yes: Integer, + no: Integer, + maybe: Integer + }, + error: T::Class[StandardError], + branched: Integer + } + end + + DumpState = T.type_alias { { can_retry: T::Boolean } } + + # @api private + sig do + overridable + .params( + value: T.anything, + state: Docker::Internal::Type::Converter::CoerceState + ) + .returns(T.anything) + end + def coerce(value, state:) + end + + # @api private + sig do + overridable + .params( + value: T.anything, + state: Docker::Internal::Type::Converter::DumpState + ) + .returns(T.anything) + end + def dump(value, state:) + end + + # @api private + sig { params(depth: Integer).returns(String) } + def inspect(depth: 0) + end + + class << self + # @api private + sig do + params( + spec: + T.any( + { + const: + T.nilable( + T.any(NilClass, T::Boolean, Integer, Float, Symbol) + ), + enum: + T.nilable( + T.proc.returns(Docker::Internal::Type::Converter::Input) + ), + union: + T.nilable( + T.proc.returns(Docker::Internal::Type::Converter::Input) + ) + }, + T.proc.returns(Docker::Internal::Type::Converter::Input), + Docker::Internal::Type::Converter::Input + ) + ).returns(T.proc.returns(T.anything)) + end + def self.type_info(spec) + end + + # @api private + sig do + params( + type_info: + T.any( + { + const: + T.nilable( + T.any(NilClass, T::Boolean, Integer, Float, Symbol) + ), + enum: + T.nilable( + T.proc.returns(Docker::Internal::Type::Converter::Input) + ), + union: + T.nilable( + T.proc.returns(Docker::Internal::Type::Converter::Input) + ) + }, + T.proc.returns(Docker::Internal::Type::Converter::Input), + Docker::Internal::Type::Converter::Input + ), + spec: + T.any( + { + const: + T.nilable( + T.any(NilClass, T::Boolean, Integer, Float, Symbol) + ), + enum: + T.nilable( + T.proc.returns(Docker::Internal::Type::Converter::Input) + ), + union: + T.nilable( + T.proc.returns(Docker::Internal::Type::Converter::Input) + ) + }, + T.proc.returns(Docker::Internal::Type::Converter::Input), + Docker::Internal::Type::Converter::Input + ) + ).returns(Docker::Internal::AnyHash) + end + def self.meta_info(type_info, spec) + end + + # @api private + sig do + params(translate_names: T::Boolean).returns( + Docker::Internal::Type::Converter::CoerceState + ) + end + def self.new_coerce_state(translate_names: true) + end + + # @api private + # + # Based on `target`, transform `value` into `target`, to the extent possible: + # + # 1. if the given `value` conforms to `target` already, return the given `value` + # 2. if it's possible and safe to convert the given `value` to `target`, then the + # converted value + # 3. otherwise, the given `value` unaltered + # + # The coercion process is subject to improvement between minor release versions. + # See https://docs.pydantic.dev/latest/concepts/unions/#smart-mode + sig do + params( + target: Docker::Internal::Type::Converter::Input, + value: T.anything, + state: Docker::Internal::Type::Converter::CoerceState + ).returns(T.anything) + end + def self.coerce( + target, + value, + # The `strictness` is one of `true`, `false`. This informs the coercion strategy + # when we have to decide between multiple possible conversion targets: + # + # - `true`: the conversion must be exact, with minimum coercion. + # - `false`: the conversion can be approximate, with some coercion. + # + # The `exactness` is `Hash` with keys being one of `yes`, `no`, or `maybe`. For + # any given conversion attempt, the exactness will be updated based on how closely + # the value recursively matches the target type: + # + # - `yes`: the value can be converted to the target type with minimum coercion. + # - `maybe`: the value can be converted to the target type with some reasonable + # coercion. + # - `no`: the value cannot be converted to the target type. + # + # See implementation below for more details. + state: Docker::Internal::Type::Converter.new_coerce_state + ) + end + + # @api private + sig do + params( + target: Docker::Internal::Type::Converter::Input, + value: T.anything, + state: Docker::Internal::Type::Converter::DumpState + ).returns(T.anything) + end + def self.dump(target, value, state: { can_retry: true }) + end + + # @api private + sig { params(target: T.anything, depth: Integer).returns(String) } + def self.inspect(target, depth:) + end + end + end + end + end +end diff --git a/rbi/docker/internal/type/enum.rbi b/rbi/docker/internal/type/enum.rbi new file mode 100644 index 0000000..b538166 --- /dev/null +++ b/rbi/docker/internal/type/enum.rbi @@ -0,0 +1,82 @@ +# typed: strong + +module Docker + module Internal + module Type + # @api private + # + # A value from among a specified list of options. OpenAPI enum values map to Ruby + # values in the SDK as follows: + # + # 1. boolean => true | false + # 2. integer => Integer + # 3. float => Float + # 4. string => Symbol + # + # We can therefore convert string values to Symbols, but can't convert other + # values safely. + module Enum + include Docker::Internal::Type::Converter + include Docker::Internal::Util::SorbetRuntimeSupport + + # All of the valid Symbol values for this enum. + sig do + overridable.returns( + T::Array[T.any(NilClass, T::Boolean, Integer, Float, Symbol)] + ) + end + def values + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ==(other) + end + + sig { returns(Integer) } + def hash + end + + # @api private + # + # Unlike with primitives, `Enum` additionally validates that the value is a member + # of the enum. + sig do + override + .params( + value: T.any(String, Symbol, T.anything), + state: Docker::Internal::Type::Converter::CoerceState + ) + .returns(T.any(Symbol, T.anything)) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.any(Symbol, T.anything), + state: Docker::Internal::Type::Converter::DumpState + ) + .returns(T.any(Symbol, T.anything)) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + + # @api private + sig { params(depth: Integer).returns(String) } + def inspect(depth: 0) + end + end + end + end +end diff --git a/rbi/docker/internal/type/file_input.rbi b/rbi/docker/internal/type/file_input.rbi new file mode 100644 index 0000000..6955a26 --- /dev/null +++ b/rbi/docker/internal/type/file_input.rbi @@ -0,0 +1,59 @@ +# typed: strong + +module Docker + module Internal + module Type + # @api private + # + # Either `Pathname` or `StringIO`, or `IO`, or + # `Docker::Internal::Type::FileInput`. + # + # Note: when `IO` is used, all retries are disabled, since many IO` streams are + # not rewindable. + class FileInput + extend Docker::Internal::Type::Converter + + abstract! + + sig { params(other: T.anything).returns(T::Boolean) } + def self.===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def self.==(other) + end + + class << self + # @api private + sig do + override + .params( + value: T.any(StringIO, String, T.anything), + state: Docker::Internal::Type::Converter::CoerceState + ) + .returns(T.any(StringIO, T.anything)) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.any(Pathname, StringIO, IO, String, T.anything), + state: Docker::Internal::Type::Converter::DumpState + ) + .returns(T.any(Pathname, StringIO, IO, String, T.anything)) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + end + end + end + end +end diff --git a/rbi/docker/internal/type/hash_of.rbi b/rbi/docker/internal/type/hash_of.rbi new file mode 100644 index 0000000..1e71b35 --- /dev/null +++ b/rbi/docker/internal/type/hash_of.rbi @@ -0,0 +1,104 @@ +# typed: strong + +module Docker + module Internal + module Type + # @api private + # + # Hash of items of a given type. + class HashOf + include Docker::Internal::Type::Converter + include Docker::Internal::Util::SorbetRuntimeSupport + + abstract! + + Elem = type_member(:out) + + sig do + params( + type_info: + T.any( + Docker::Internal::AnyHash, + T.proc.returns(Docker::Internal::Type::Converter::Input), + Docker::Internal::Type::Converter::Input + ), + spec: Docker::Internal::AnyHash + ).returns(T.attached_class) + end + def self.[](type_info, spec = {}) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ==(other) + end + + sig { returns(Integer) } + def hash + end + + # @api private + sig do + override + .params( + value: T.any(T::Hash[T.anything, T.anything], T.anything), + state: Docker::Internal::Type::Converter::CoerceState + ) + .returns(T.any(Docker::Internal::AnyHash, T.anything)) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.any(T::Hash[T.anything, T.anything], T.anything), + state: Docker::Internal::Type::Converter::DumpState + ) + .returns(T.any(Docker::Internal::AnyHash, T.anything)) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + + # @api private + sig { returns(Elem) } + protected def item_type + end + + # @api private + sig { returns(T::Boolean) } + protected def nilable? + end + + # @api private + sig do + params( + type_info: + T.any( + Docker::Internal::AnyHash, + T.proc.returns(Docker::Internal::Type::Converter::Input), + Docker::Internal::Type::Converter::Input + ), + spec: Docker::Internal::AnyHash + ).void + end + def initialize(type_info, spec = {}) + end + + # @api private + sig { params(depth: Integer).returns(String) } + def inspect(depth: 0) + end + end + end + end +end diff --git a/rbi/docker/internal/type/request_parameters.rbi b/rbi/docker/internal/type/request_parameters.rbi new file mode 100644 index 0000000..3e3dd63 --- /dev/null +++ b/rbi/docker/internal/type/request_parameters.rbi @@ -0,0 +1,29 @@ +# typed: strong + +module Docker + module Internal + module Type + # @api private + module RequestParameters + # Options to specify HTTP behaviour for this request. + sig { returns(Docker::RequestOptions) } + attr_reader :request_options + + sig { params(request_options: Docker::RequestOptions::OrHash).void } + attr_writer :request_options + + # @api private + module Converter + # @api private + sig do + params(params: T.anything).returns( + [T.anything, Docker::Internal::AnyHash] + ) + end + def dump_request(params) + end + end + end + end + end +end diff --git a/rbi/docker/internal/type/union.rbi b/rbi/docker/internal/type/union.rbi new file mode 100644 index 0000000..3cab486 --- /dev/null +++ b/rbi/docker/internal/type/union.rbi @@ -0,0 +1,126 @@ +# typed: strong + +module Docker + module Internal + module Type + # @api private + module Union + include Docker::Internal::Type::Converter + include Docker::Internal::Util::SorbetRuntimeSupport + + # @api private + # + # All of the specified variant info for this union. + sig do + returns( + T::Array[ + [ + T.nilable(Symbol), + T.proc.returns(Docker::Internal::Type::Converter::Input), + Docker::Internal::AnyHash + ] + ] + ) + end + private def known_variants + end + + # @api private + sig do + returns( + T::Array[[T.nilable(Symbol), T.anything, Docker::Internal::AnyHash]] + ) + end + protected def derefed_variants + end + + # All of the specified variants for this union. + sig { overridable.returns(T::Array[T.anything]) } + def variants + end + + # @api private + sig { params(property: Symbol).void } + private def discriminator(property) + end + + # @api private + sig do + params( + key: + T.any( + Symbol, + Docker::Internal::AnyHash, + T.proc.returns(T.anything), + T.anything + ), + spec: + T.any( + Docker::Internal::AnyHash, + T.proc.returns(T.anything), + T.anything + ) + ).void + end + private def variant(key, spec = nil) + end + + # @api private + sig { params(value: T.anything).returns(T.nilable(T.anything)) } + private def resolve_variant(value) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ==(other) + end + + sig { returns(Integer) } + def hash + end + + # @api private + # + # Tries to efficiently coerce the given value to one of the known variants. + # + # If the value cannot match any of the known variants, the coercion is considered + # non-viable and returns the original value. + sig do + override + .params( + value: T.anything, + state: Docker::Internal::Type::Converter::CoerceState + ) + .returns(T.anything) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.anything, + state: Docker::Internal::Type::Converter::DumpState + ) + .returns(T.anything) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + + # @api private + sig { params(depth: Integer).returns(String) } + def inspect(depth: 0) + end + end + end + end +end diff --git a/rbi/docker/internal/type/unknown.rbi b/rbi/docker/internal/type/unknown.rbi new file mode 100644 index 0000000..fb2bb45 --- /dev/null +++ b/rbi/docker/internal/type/unknown.rbi @@ -0,0 +1,58 @@ +# typed: strong + +module Docker + module Internal + module Type + # @api private + # + # When we don't know what to expect for the value. + class Unknown + extend Docker::Internal::Type::Converter + extend Docker::Internal::Util::SorbetRuntimeSupport + + abstract! + + sig { params(other: T.anything).returns(T::Boolean) } + def self.===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def self.==(other) + end + + class << self + # @api private + # + # No coercion needed for Unknown type. + sig do + override + .params( + value: T.anything, + state: Docker::Internal::Type::Converter::CoerceState + ) + .returns(T.anything) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.anything, + state: Docker::Internal::Type::Converter::DumpState + ) + .returns(T.anything) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + end + end + end + end +end diff --git a/rbi/docker/internal/util.rbi b/rbi/docker/internal/util.rbi new file mode 100644 index 0000000..e989adc --- /dev/null +++ b/rbi/docker/internal/util.rbi @@ -0,0 +1,484 @@ +# typed: strong + +module Docker + module Internal + # @api private + module Util + extend Docker::Internal::Util::SorbetRuntimeSupport + + # @api private + sig { returns(Float) } + def self.monotonic_secs + end + + # @api private + sig do + params(ns: T.any(Module, T::Class[T.anything])).returns( + T::Enumerable[T.any(Module, T::Class[T.anything])] + ) + end + def self.walk_namespaces(ns) + end + + class << self + # @api private + sig { returns(String) } + def arch + end + + # @api private + sig { returns(String) } + def os + end + end + + class << self + # @api private + sig { params(input: T.anything).returns(T::Boolean) } + def primitive?(input) + end + + # @api private + sig do + params(input: T.any(String, T::Boolean)).returns( + T.any(T::Boolean, T.anything) + ) + end + def coerce_boolean(input) + end + + # @api private + sig do + params(input: T.any(String, T::Boolean)).returns( + T.nilable(T::Boolean) + ) + end + def coerce_boolean!(input) + end + + # @api private + sig do + params(input: T.any(String, Integer)).returns( + T.any(Integer, T.anything) + ) + end + def coerce_integer(input) + end + + # @api private + sig do + params(input: T.any(String, Integer, Float)).returns( + T.any(Float, T.anything) + ) + end + def coerce_float(input) + end + + # @api private + sig do + params(input: T.anything).returns( + T.any(T::Hash[T.anything, T.anything], T.anything) + ) + end + def coerce_hash(input) + end + + # @api private + sig do + params(input: T.anything).returns( + T.nilable(T::Hash[T.anything, T.anything]) + ) + end + def coerce_hash!(input) + end + end + + class << self + # @api private + sig do + params(lhs: T.anything, rhs: T.anything, concat: T::Boolean).returns( + T.anything + ) + end + private def deep_merge_lr(lhs, rhs, concat: false) + end + + # @api private + # + # Recursively merge one hash with another. If the values at a given key are not + # both hashes, just take the new value. + sig do + params( + values: T::Array[T.anything], + sentinel: T.nilable(T.anything), + concat: T::Boolean + ).returns(T.anything) + end + def deep_merge( + *values, + # the value to return if no values are provided. + sentinel: nil, + # whether to merge sequences by concatenation. + concat: false + ) + end + + # @api private + sig do + params( + data: + T.any( + Docker::Internal::AnyHash, + T::Array[T.anything], + T.anything + ), + pick: + T.nilable( + T.any( + Symbol, + Integer, + T::Array[T.any(Symbol, Integer)], + T.proc.params(arg0: T.anything).returns(T.anything) + ) + ), + blk: T.nilable(T.proc.returns(T.anything)) + ).returns(T.nilable(T.anything)) + end + def dig(data, pick, &blk) + end + end + + class << self + # @api private + sig { params(uri: URI::Generic).returns(String) } + def uri_origin(uri) + end + + # @api private + sig { params(path: T.any(String, T::Array[String])).returns(String) } + def interpolate_path(path) + end + end + + class << self + # @api private + sig do + params(query: T.nilable(String)).returns( + T::Hash[String, T::Array[String]] + ) + end + def decode_query(query) + end + + # @api private + sig do + params( + query: + T.nilable( + T::Hash[String, T.nilable(T.any(T::Array[String], String))] + ) + ).returns(T.nilable(String)) + end + def encode_query(query) + end + end + + ParsedUri = + T.type_alias do + { + scheme: T.nilable(String), + host: T.nilable(String), + port: T.nilable(Integer), + path: T.nilable(String), + query: T::Hash[String, T::Array[String]] + } + end + + class << self + # @api private + sig do + params(url: T.any(URI::Generic, String)).returns( + Docker::Internal::Util::ParsedUri + ) + end + def parse_uri(url) + end + + # @api private + sig do + params(parsed: Docker::Internal::Util::ParsedUri).returns( + URI::Generic + ) + end + def unparse_uri(parsed) + end + + # @api private + sig do + params( + lhs: Docker::Internal::Util::ParsedUri, + rhs: Docker::Internal::Util::ParsedUri + ).returns(URI::Generic) + end + def join_parsed_uri(lhs, rhs) + end + end + + class << self + # @api private + sig do + params( + headers: + T::Hash[ + String, + T.nilable( + T.any( + String, + Integer, + T::Array[T.nilable(T.any(String, Integer))] + ) + ) + ] + ).returns(T::Hash[String, String]) + end + def normalized_headers(*headers) + end + end + + # @api private + # + # An adapter that satisfies the IO interface required by `::IO.copy_stream` + class ReadIOAdapter + # @api private + sig { returns(T.nilable(T::Boolean)) } + def close? + end + + # @api private + sig { void } + def close + end + + # @api private + sig { params(max_len: T.nilable(Integer)).returns(String) } + private def read_enum(max_len) + end + + # @api private + sig do + params( + max_len: T.nilable(Integer), + out_string: T.nilable(String) + ).returns(T.nilable(String)) + end + def read(max_len = nil, out_string = nil) + end + + # @api private + sig do + params( + src: T.any(String, Pathname, StringIO, T::Enumerable[String]), + blk: T.proc.params(arg0: String).void + ).returns(T.attached_class) + end + def self.new(src, &blk) + end + end + + class << self + sig do + params(blk: T.proc.params(y: Enumerator::Yielder).void).returns( + T::Enumerable[String] + ) + end + def writable_enum(&blk) + end + end + + JSON_CONTENT = + T.let(%r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}, Regexp) + JSONL_CONTENT = + T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp) + + class << self + # @api private + sig do + params( + y: Enumerator::Yielder, + val: T.anything, + closing: T::Array[T.proc.void], + content_type: T.nilable(String) + ).void + end + private def write_multipart_content( + y, + val:, + closing:, + content_type: nil + ) + end + + # @api private + sig do + params( + y: Enumerator::Yielder, + boundary: String, + key: T.any(Symbol, String), + val: T.anything, + closing: T::Array[T.proc.void] + ).void + end + private def write_multipart_chunk(y, boundary:, key:, val:, closing:) + end + + # @api private + # + # https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#special-considerations-for-multipart-content + sig do + params(body: T.anything).returns([String, T::Enumerable[String]]) + end + private def encode_multipart_streaming(body) + end + + # @api private + sig do + params(headers: T::Hash[String, String], body: T.anything).returns( + T.anything + ) + end + def encode_content(headers, body) + end + + # @api private + # + # https://www.iana.org/assignments/character-sets/character-sets.xhtml + sig { params(content_type: String, text: String).void } + def force_charset!(content_type, text:) + end + + # @api private + # + # Assumes each chunk in stream has `Encoding::BINARY`. + sig do + params( + headers: T::Hash[String, String], + stream: T::Enumerable[String], + suppress_error: T::Boolean + ).returns(T.anything) + end + def decode_content(headers, stream:, suppress_error: false) + end + end + + class << self + # @api private + # + # https://doc.rust-lang.org/std/iter/trait.FusedIterator.html + sig do + params( + enum: T::Enumerable[T.anything], + external: T::Boolean, + close: T.proc.void + ).returns(T::Enumerable[T.anything]) + end + def fused_enum(enum, external: false, &close) + end + + # @api private + sig { params(enum: T.nilable(T::Enumerable[T.anything])).void } + def close_fused!(enum) + end + + # @api private + sig do + params( + enum: T.nilable(T::Enumerable[T.anything]), + blk: T.proc.params(arg0: Enumerator::Yielder).void + ).returns(T::Enumerable[T.anything]) + end + def chain_fused(enum, &blk) + end + end + + ServerSentEvent = + T.type_alias do + { + event: T.nilable(String), + data: T.nilable(String), + id: T.nilable(String), + retry: T.nilable(Integer) + } + end + + class << self + # @api private + # + # Assumes Strings have been forced into having `Encoding::BINARY`. + # + # This decoder is responsible for reassembling lines split across multiple + # fragments. + sig do + params(enum: T::Enumerable[String]).returns(T::Enumerable[String]) + end + def decode_lines(enum) + end + + # @api private + # + # https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream + # + # Assumes that `lines` has been decoded with `#decode_lines`. + sig do + params(lines: T::Enumerable[String]).returns( + T::Enumerable[Docker::Internal::Util::ServerSentEvent] + ) + end + def decode_sse(lines) + end + end + + # @api private + module SorbetRuntimeSupport + class MissingSorbetRuntimeError < ::RuntimeError + end + + # @api private + sig { returns(T::Hash[Symbol, T.anything]) } + private def sorbet_runtime_constants + end + + # @api private + sig { params(name: Symbol).void } + def const_missing(name) + end + + # @api private + sig { params(name: Symbol).returns(T::Boolean) } + def sorbet_constant_defined?(name) + end + + # @api private + sig { params(name: Symbol, blk: T.proc.returns(T.anything)).void } + def define_sorbet_constant!(name, &blk) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + + class << self + # @api private + sig do + params( + type: + T.any(Docker::Internal::Util::SorbetRuntimeSupport, T.anything) + ).returns(T.anything) + end + def to_sorbet_type(type) + end + end + end + end + end +end diff --git a/rbi/docker/models.rbi b/rbi/docker/models.rbi new file mode 100644 index 0000000..47beb51 --- /dev/null +++ b/rbi/docker/models.rbi @@ -0,0 +1,83 @@ +# typed: strong + +module Docker + AuthLoginParams = Docker::Models::AuthLoginParams + + AuthResponse = Docker::Models::AuthResponse + + Config = Docker::Models::Config + + Container = Docker::Models::Container + + ContainerCreateParams = Docker::Models::ContainerCreateParams + + ContainerDeleteParams = Docker::Models::ContainerDeleteParams + + ContainerInspectParams = Docker::Models::ContainerInspectParams + + ContainerKillParams = Docker::Models::ContainerKillParams + + ContainerListParams = Docker::Models::ContainerListParams + + ContainerLogsParams = Docker::Models::ContainerLogsParams + + ContainerStartParams = Docker::Models::ContainerStartParams + + ContainerStopParams = Docker::Models::ContainerStopParams + + CreateRequest = Docker::Models::CreateRequest + + CreateResponse = Docker::Models::CreateResponse + + Error = Docker::Models::Error + + Image = Docker::Models::Image + + ImageDeleteParams = Docker::Models::ImageDeleteParams + + ImageInspectParams = Docker::Models::ImageInspectParams + + ImageListParams = Docker::Models::ImageListParams + + ImagePullParams = Docker::Models::ImagePullParams + + Network = Docker::Models::Network + + NetworkCreateParams = Docker::Models::NetworkCreateParams + + NetworkDeleteParams = Docker::Models::NetworkDeleteParams + + NetworkInspectParams = Docker::Models::NetworkInspectParams + + NetworkListParams = Docker::Models::NetworkListParams + + Service = Docker::Models::Service + + ServiceCreateParams = Docker::Models::ServiceCreateParams + + ServiceDeleteParams = Docker::Models::ServiceDeleteParams + + ServiceInspectParams = Docker::Models::ServiceInspectParams + + ServiceListParams = Docker::Models::ServiceListParams + + Spec = Docker::Models::Spec + + Summary = Docker::Models::Summary + + SystemInfoParams = Docker::Models::SystemInfoParams + + SystemPingParams = Docker::Models::SystemPingParams + + SystemVersionParams = Docker::Models::SystemVersionParams + + Volume = Docker::Models::Volume + + VolumeCreateParams = Docker::Models::VolumeCreateParams + + VolumeDeleteParams = Docker::Models::VolumeDeleteParams + + VolumeInspectParams = Docker::Models::VolumeInspectParams + + VolumeListParams = Docker::Models::VolumeListParams +end diff --git a/rbi/docker/models/auth_login_params.rbi b/rbi/docker/models/auth_login_params.rbi new file mode 100644 index 0000000..b8f19eb --- /dev/null +++ b/rbi/docker/models/auth_login_params.rbi @@ -0,0 +1,62 @@ +# typed: strong + +module Docker + module Models + class AuthLoginParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::AuthLoginParams, Docker::Internal::AnyHash) + end + + sig { returns(T.nilable(String)) } + attr_reader :password + + sig { params(password: String).void } + attr_writer :password + + sig { returns(T.nilable(String)) } + attr_reader :serveraddress + + sig { params(serveraddress: String).void } + attr_writer :serveraddress + + sig { returns(T.nilable(String)) } + attr_reader :username + + sig { params(username: String).void } + attr_writer :username + + sig do + params( + password: String, + serveraddress: String, + username: String, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + password: nil, + serveraddress: nil, + username: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + password: String, + serveraddress: String, + username: String, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/auth_response.rbi b/rbi/docker/models/auth_response.rbi new file mode 100644 index 0000000..bdd749a --- /dev/null +++ b/rbi/docker/models/auth_response.rbi @@ -0,0 +1,37 @@ +# typed: strong + +module Docker + module Models + class AuthResponse < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(Docker::AuthResponse, Docker::Internal::AnyHash) } + + # The status of the authentication + sig { returns(String) } + attr_accessor :status + + # An opaque token used to authenticate a user after a successful login + sig { returns(T.nilable(String)) } + attr_reader :identity_token + + sig { params(identity_token: String).void } + attr_writer :identity_token + + # An identity token was generated successfully. + sig do + params(status: String, identity_token: String).returns(T.attached_class) + end + def self.new( + # The status of the authentication + status:, + # An opaque token used to authenticate a user after a successful login + identity_token: nil + ) + end + + sig { override.returns({ status: String, identity_token: String }) } + def to_hash + end + end + end +end diff --git a/rbi/docker/models/config.rbi b/rbi/docker/models/config.rbi new file mode 100644 index 0000000..33901bf --- /dev/null +++ b/rbi/docker/models/config.rbi @@ -0,0 +1,434 @@ +# typed: strong + +module Docker + module Models + class Config < Docker::Internal::Type::BaseModel + OrHash = T.type_alias { T.any(Docker::Config, Docker::Internal::AnyHash) } + + # Command is already escaped (Windows only) + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :args_escaped + + # Whether to attach to `stderr`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :attach_stderr + + sig { params(attach_stderr: T::Boolean).void } + attr_writer :attach_stderr + + # Whether to attach to `stdin`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :attach_stdin + + sig { params(attach_stdin: T::Boolean).void } + attr_writer :attach_stdin + + # Whether to attach to `stdout`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :attach_stdout + + sig { params(attach_stdout: T::Boolean).void } + attr_writer :attach_stdout + + # Command to run specified as a string or an array of strings. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :cmd + + sig { params(cmd: T::Array[String]).void } + attr_writer :cmd + + # The domain name to use for the container. + sig { returns(T.nilable(String)) } + attr_reader :domainname + + sig { params(domainname: String).void } + attr_writer :domainname + + # The entry point for the container as a string or an array of strings. + # + # If the array consists of exactly one empty string (`[""]`) then the entry point + # is reset to system default (i.e., the entry point used by docker when there is + # no `ENTRYPOINT` instruction in the `Dockerfile`). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :entrypoint + + sig { params(entrypoint: T::Array[String]).void } + attr_writer :entrypoint + + # A list of environment variables to set inside the container in the form + # `["VAR=value", ...]`. A variable without `=` is removed from the environment, + # rather than to have an empty value. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :env + + sig { params(env: T::Array[String]).void } + attr_writer :env + + # An object mapping ports to an empty object in the form: + # + # `{"/": {}}` + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :exposed_ports + + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + sig { returns(T.nilable(Docker::Config::Healthcheck)) } + attr_reader :healthcheck + + sig { params(healthcheck: Docker::Config::Healthcheck::OrHash).void } + attr_writer :healthcheck + + # The hostname to use for the container, as a valid RFC 1123 hostname. + sig { returns(T.nilable(String)) } + attr_reader :hostname + + sig { params(hostname: String).void } + attr_writer :hostname + + # The name (or reference) of the image to use when creating the container, or + # which was used when the container was created. + sig { returns(T.nilable(String)) } + attr_reader :image + + sig { params(image: String).void } + attr_writer :image + + # User-defined key/value metadata. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :labels + + sig { params(labels: T::Hash[Symbol, String]).void } + attr_writer :labels + + # Disable networking for the container. + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :network_disabled + + # `ONBUILD` metadata that were defined in the image's `Dockerfile`. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :on_build + + # Open `stdin` + sig { returns(T.nilable(T::Boolean)) } + attr_reader :open_stdin + + sig { params(open_stdin: T::Boolean).void } + attr_writer :open_stdin + + # Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :shell + + # Close `stdin` after one attached client disconnects + sig { returns(T.nilable(T::Boolean)) } + attr_reader :stdin_once + + sig { params(stdin_once: T::Boolean).void } + attr_writer :stdin_once + + # Signal to stop a container as a string or unsigned integer. + sig { returns(T.nilable(String)) } + attr_accessor :stop_signal + + # Timeout to stop a container in seconds. + sig { returns(T.nilable(Integer)) } + attr_accessor :stop_timeout + + # Attach standard streams to a TTY, including `stdin` if it is not closed. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :tty + + sig { params(tty: T::Boolean).void } + attr_writer :tty + + # Commands run as this user inside the container. If omitted, commands run as the + # user specified in the image the container was started from. + # + # Can be either user-name or UID, and optional group-name or GID, separated by a + # colon (`[<:group-name|GID>]`). + sig { returns(T.nilable(String)) } + attr_reader :user + + sig { params(user: String).void } + attr_writer :user + + # An object mapping mount point paths inside the container to empty objects. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :volumes + + sig { params(volumes: T::Hash[Symbol, T.anything]).void } + attr_writer :volumes + + # The working directory for commands to run in. + sig { returns(T.nilable(String)) } + attr_reader :working_dir + + sig { params(working_dir: String).void } + attr_writer :working_dir + + # Configuration for a container that is portable between hosts. + sig do + params( + args_escaped: T.nilable(T::Boolean), + attach_stderr: T::Boolean, + attach_stdin: T::Boolean, + attach_stdout: T::Boolean, + cmd: T::Array[String], + domainname: String, + entrypoint: T::Array[String], + env: T::Array[String], + exposed_ports: T.nilable(T::Hash[Symbol, T.anything]), + healthcheck: Docker::Config::Healthcheck::OrHash, + hostname: String, + image: String, + labels: T::Hash[Symbol, String], + network_disabled: T.nilable(T::Boolean), + on_build: T.nilable(T::Array[String]), + open_stdin: T::Boolean, + shell: T.nilable(T::Array[String]), + stdin_once: T::Boolean, + stop_signal: T.nilable(String), + stop_timeout: T.nilable(Integer), + tty: T::Boolean, + user: String, + volumes: T::Hash[Symbol, T.anything], + working_dir: String + ).returns(T.attached_class) + end + def self.new( + # Command is already escaped (Windows only) + args_escaped: nil, + # Whether to attach to `stderr`. + attach_stderr: nil, + # Whether to attach to `stdin`. + attach_stdin: nil, + # Whether to attach to `stdout`. + attach_stdout: nil, + # Command to run specified as a string or an array of strings. + cmd: nil, + # The domain name to use for the container. + domainname: nil, + # The entry point for the container as a string or an array of strings. + # + # If the array consists of exactly one empty string (`[""]`) then the entry point + # is reset to system default (i.e., the entry point used by docker when there is + # no `ENTRYPOINT` instruction in the `Dockerfile`). + entrypoint: nil, + # A list of environment variables to set inside the container in the form + # `["VAR=value", ...]`. A variable without `=` is removed from the environment, + # rather than to have an empty value. + env: nil, + # An object mapping ports to an empty object in the form: + # + # `{"/": {}}` + exposed_ports: nil, + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + healthcheck: nil, + # The hostname to use for the container, as a valid RFC 1123 hostname. + hostname: nil, + # The name (or reference) of the image to use when creating the container, or + # which was used when the container was created. + image: nil, + # User-defined key/value metadata. + labels: nil, + # Disable networking for the container. + network_disabled: nil, + # `ONBUILD` metadata that were defined in the image's `Dockerfile`. + on_build: nil, + # Open `stdin` + open_stdin: nil, + # Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + shell: nil, + # Close `stdin` after one attached client disconnects + stdin_once: nil, + # Signal to stop a container as a string or unsigned integer. + stop_signal: nil, + # Timeout to stop a container in seconds. + stop_timeout: nil, + # Attach standard streams to a TTY, including `stdin` if it is not closed. + tty: nil, + # Commands run as this user inside the container. If omitted, commands run as the + # user specified in the image the container was started from. + # + # Can be either user-name or UID, and optional group-name or GID, separated by a + # colon (`[<:group-name|GID>]`). + user: nil, + # An object mapping mount point paths inside the container to empty objects. + volumes: nil, + # The working directory for commands to run in. + working_dir: nil + ) + end + + sig do + override.returns( + { + args_escaped: T.nilable(T::Boolean), + attach_stderr: T::Boolean, + attach_stdin: T::Boolean, + attach_stdout: T::Boolean, + cmd: T::Array[String], + domainname: String, + entrypoint: T::Array[String], + env: T::Array[String], + exposed_ports: T.nilable(T::Hash[Symbol, T.anything]), + healthcheck: Docker::Config::Healthcheck, + hostname: String, + image: String, + labels: T::Hash[Symbol, String], + network_disabled: T.nilable(T::Boolean), + on_build: T.nilable(T::Array[String]), + open_stdin: T::Boolean, + shell: T.nilable(T::Array[String]), + stdin_once: T::Boolean, + stop_signal: T.nilable(String), + stop_timeout: T.nilable(Integer), + tty: T::Boolean, + user: String, + volumes: T::Hash[Symbol, T.anything], + working_dir: String + } + ) + end + def to_hash + end + + class Healthcheck < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Config::Healthcheck, Docker::Internal::AnyHash) + end + + # The time to wait between checks in nanoseconds. It should be 0 or at least + # 1000000 (1 ms). 0 means inherit. + sig { returns(T.nilable(Integer)) } + attr_reader :interval + + sig { params(interval: Integer).void } + attr_writer :interval + + # The number of consecutive failures needed to consider a container as unhealthy. + # 0 means inherit. + sig { returns(T.nilable(Integer)) } + attr_reader :retries + + sig { params(retries: Integer).void } + attr_writer :retries + + # The time to wait between checks in nanoseconds during the start period. It + # should be 0 or at least 1000000 (1 ms). 0 means inherit. + sig { returns(T.nilable(Integer)) } + attr_reader :start_interval + + sig { params(start_interval: Integer).void } + attr_writer :start_interval + + # Start period for the container to initialize before starting health-retries + # countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means + # inherit. + sig { returns(T.nilable(Integer)) } + attr_reader :start_period + + sig { params(start_period: Integer).void } + attr_writer :start_period + + # The test to perform. Possible values are: + # + # - `[]` inherit healthcheck from image or parent image + # - `["NONE"]` disable healthcheck + # - `["CMD", args...]` exec arguments directly + # - `["CMD-SHELL", command]` run command with system's default shell + # + # A non-zero exit code indicates a failed healthcheck: + # + # - `0` healthy + # - `1` unhealthy + # - `2` reserved (treated as unhealthy) + # - other values: error running probe + sig { returns(T.nilable(T::Array[String])) } + attr_reader :test_ + + sig { params(test_: T::Array[String]).void } + attr_writer :test_ + + # The time to wait before considering the check to have hung. It should be 0 or at + # least 1000000 (1 ms). 0 means inherit. + # + # If the health check command does not complete within this timeout, the check is + # considered failed and the health check process is forcibly terminated without a + # graceful shutdown. + sig { returns(T.nilable(Integer)) } + attr_reader :timeout + + sig { params(timeout: Integer).void } + attr_writer :timeout + + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + sig do + params( + interval: Integer, + retries: Integer, + start_interval: Integer, + start_period: Integer, + test_: T::Array[String], + timeout: Integer + ).returns(T.attached_class) + end + def self.new( + # The time to wait between checks in nanoseconds. It should be 0 or at least + # 1000000 (1 ms). 0 means inherit. + interval: nil, + # The number of consecutive failures needed to consider a container as unhealthy. + # 0 means inherit. + retries: nil, + # The time to wait between checks in nanoseconds during the start period. It + # should be 0 or at least 1000000 (1 ms). 0 means inherit. + start_interval: nil, + # Start period for the container to initialize before starting health-retries + # countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means + # inherit. + start_period: nil, + # The test to perform. Possible values are: + # + # - `[]` inherit healthcheck from image or parent image + # - `["NONE"]` disable healthcheck + # - `["CMD", args...]` exec arguments directly + # - `["CMD-SHELL", command]` run command with system's default shell + # + # A non-zero exit code indicates a failed healthcheck: + # + # - `0` healthy + # - `1` unhealthy + # - `2` reserved (treated as unhealthy) + # - other values: error running probe + test_: nil, + # The time to wait before considering the check to have hung. It should be 0 or at + # least 1000000 (1 ms). 0 means inherit. + # + # If the health check command does not complete within this timeout, the check is + # considered failed and the health check process is forcibly terminated without a + # graceful shutdown. + timeout: nil + ) + end + + sig do + override.returns( + { + interval: Integer, + retries: Integer, + start_interval: Integer, + start_period: Integer, + test_: T::Array[String], + timeout: Integer + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/docker/models/container.rbi b/rbi/docker/models/container.rbi new file mode 100644 index 0000000..4f908b8 --- /dev/null +++ b/rbi/docker/models/container.rbi @@ -0,0 +1,4422 @@ +# typed: strong + +module Docker + module Models + class Container < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(Docker::Container, Docker::Internal::AnyHash) } + + # The AppArmor profile set for the container. + sig { returns(T.nilable(String)) } + attr_reader :app_armor_profile + + sig { params(app_armor_profile: String).void } + attr_writer :app_armor_profile + + # The arguments to the command being run + sig { returns(T.nilable(T::Array[String])) } + attr_reader :args + + sig { params(args: T::Array[String]).void } + attr_writer :args + + # Configuration for a container that is portable between hosts. + sig { returns(T.nilable(Docker::Config)) } + attr_reader :config + + sig { params(config: Docker::Config::OrHash).void } + attr_writer :config + + # Date and time at which the container was created, formatted in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + sig { returns(T.nilable(String)) } + attr_accessor :created + + # The storage-driver used for the container's filesystem (graph-driver or + # snapshotter). + sig { returns(T.nilable(String)) } + attr_reader :driver + + sig { params(driver: String).void } + attr_writer :driver + + # IDs of exec instances that are running in the container. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :exec_ids + + # Information about the storage driver used to store the container's and image's + # filesystem. + sig { returns(T.nilable(Docker::Container::GraphDriver)) } + attr_reader :graph_driver + + sig { params(graph_driver: Docker::Container::GraphDriver::OrHash).void } + attr_writer :graph_driver + + # Container configuration that depends on the host we are running on + sig { returns(T.nilable(Docker::Container::HostConfig)) } + attr_reader :host_config + + sig { params(host_config: Docker::Container::HostConfig::OrHash).void } + attr_writer :host_config + + # Location of the `/etc/hostname` generated for the container on the host. + # + # This file is managed through the docker daemon, and should not be accessed or + # modified by other tools. + sig { returns(T.nilable(String)) } + attr_reader :hostname_path + + sig { params(hostname_path: String).void } + attr_writer :hostname_path + + # Location of the `/etc/hosts` generated for the container on the host. + # + # This file is managed through the docker daemon, and should not be accessed or + # modified by other tools. + sig { returns(T.nilable(String)) } + attr_reader :hosts_path + + sig { params(hosts_path: String).void } + attr_writer :hosts_path + + # The ID of this container as a 128-bit (64-character) hexadecimal string (32 + # bytes). + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # The ID (digest) of the image that this container was created from. + sig { returns(T.nilable(String)) } + attr_reader :image + + sig { params(image: String).void } + attr_writer :image + + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + sig { returns(T.nilable(Docker::Container::ImageManifestDescriptor)) } + attr_reader :image_manifest_descriptor + + sig do + params( + image_manifest_descriptor: + Docker::Container::ImageManifestDescriptor::OrHash + ).void + end + attr_writer :image_manifest_descriptor + + # Location of the file used to buffer the container's logs. Depending on the + # logging-driver used for the container, this field may be omitted. + # + # This file is managed through the docker daemon, and should not be accessed or + # modified by other tools. + sig { returns(T.nilable(String)) } + attr_accessor :log_path + + # SELinux mount label set for the container. + sig { returns(T.nilable(String)) } + attr_reader :mount_label + + sig { params(mount_label: String).void } + attr_writer :mount_label + + # List of mounts used by the container. + sig { returns(T.nilable(T::Array[Docker::Container::Mount])) } + attr_reader :mounts + + sig { params(mounts: T::Array[Docker::Container::Mount::OrHash]).void } + attr_writer :mounts + + # The name associated with this container. + # + # For historic reasons, the name may be prefixed with a forward-slash (`/`). + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # NetworkSettings exposes the network settings in the API + sig { returns(T.nilable(Docker::Container::NetworkSettings)) } + attr_reader :network_settings + + sig do + params( + network_settings: Docker::Container::NetworkSettings::OrHash + ).void + end + attr_writer :network_settings + + # The path to the command being run + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + # The platform (operating system) for which the container was created. + # + # This field was introduced for the experimental "LCOW" (Linux Containers On + # Windows) features, which has been removed. In most cases, this field is equal to + # the host's operating system (`linux` or `windows`). + sig { returns(T.nilable(String)) } + attr_reader :platform + + sig { params(platform: String).void } + attr_writer :platform + + # SELinux process label set for the container. + sig { returns(T.nilable(String)) } + attr_reader :process_label + + sig { params(process_label: String).void } + attr_writer :process_label + + # Location of the `/etc/resolv.conf` generated for the container on the host. + # + # This file is managed through the docker daemon, and should not be accessed or + # modified by other tools. + sig { returns(T.nilable(String)) } + attr_reader :resolv_conf_path + + sig { params(resolv_conf_path: String).void } + attr_writer :resolv_conf_path + + # Number of times the container was restarted since it was created, or since + # daemon was started. + sig { returns(T.nilable(Integer)) } + attr_reader :restart_count + + sig { params(restart_count: Integer).void } + attr_writer :restart_count + + # The total size of all files in the read-only layers from the image that the + # container uses. These layers can be shared between containers. + # + # This field is omitted by default, and only set when size is requested in the API + # request. + sig { returns(T.nilable(Integer)) } + attr_accessor :size_root_fs + + # The size of files that have been created or changed by this container. + # + # This field is omitted by default, and only set when size is requested in the API + # request. + sig { returns(T.nilable(Integer)) } + attr_accessor :size_rw + + # ContainerState stores container's running state. It's part of ContainerJSONBase + # and will be returned by the "inspect" command. + sig { returns(T.nilable(Docker::Container::State)) } + attr_reader :state + + sig { params(state: T.nilable(Docker::Container::State::OrHash)).void } + attr_writer :state + + # Information about the storage used by the container. + sig { returns(T.nilable(Docker::Container::Storage)) } + attr_reader :storage + + sig { params(storage: Docker::Container::Storage::OrHash).void } + attr_writer :storage + + sig do + params( + app_armor_profile: String, + args: T::Array[String], + config: Docker::Config::OrHash, + created: T.nilable(String), + driver: String, + exec_ids: T.nilable(T::Array[String]), + graph_driver: Docker::Container::GraphDriver::OrHash, + host_config: Docker::Container::HostConfig::OrHash, + hostname_path: String, + hosts_path: String, + id: String, + image: String, + image_manifest_descriptor: + Docker::Container::ImageManifestDescriptor::OrHash, + log_path: T.nilable(String), + mount_label: String, + mounts: T::Array[Docker::Container::Mount::OrHash], + name: String, + network_settings: Docker::Container::NetworkSettings::OrHash, + path: String, + platform: String, + process_label: String, + resolv_conf_path: String, + restart_count: Integer, + size_root_fs: T.nilable(Integer), + size_rw: T.nilable(Integer), + state: T.nilable(Docker::Container::State::OrHash), + storage: Docker::Container::Storage::OrHash + ).returns(T.attached_class) + end + def self.new( + # The AppArmor profile set for the container. + app_armor_profile: nil, + # The arguments to the command being run + args: nil, + # Configuration for a container that is portable between hosts. + config: nil, + # Date and time at which the container was created, formatted in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + created: nil, + # The storage-driver used for the container's filesystem (graph-driver or + # snapshotter). + driver: nil, + # IDs of exec instances that are running in the container. + exec_ids: nil, + # Information about the storage driver used to store the container's and image's + # filesystem. + graph_driver: nil, + # Container configuration that depends on the host we are running on + host_config: nil, + # Location of the `/etc/hostname` generated for the container on the host. + # + # This file is managed through the docker daemon, and should not be accessed or + # modified by other tools. + hostname_path: nil, + # Location of the `/etc/hosts` generated for the container on the host. + # + # This file is managed through the docker daemon, and should not be accessed or + # modified by other tools. + hosts_path: nil, + # The ID of this container as a 128-bit (64-character) hexadecimal string (32 + # bytes). + id: nil, + # The ID (digest) of the image that this container was created from. + image: nil, + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + image_manifest_descriptor: nil, + # Location of the file used to buffer the container's logs. Depending on the + # logging-driver used for the container, this field may be omitted. + # + # This file is managed through the docker daemon, and should not be accessed or + # modified by other tools. + log_path: nil, + # SELinux mount label set for the container. + mount_label: nil, + # List of mounts used by the container. + mounts: nil, + # The name associated with this container. + # + # For historic reasons, the name may be prefixed with a forward-slash (`/`). + name: nil, + # NetworkSettings exposes the network settings in the API + network_settings: nil, + # The path to the command being run + path: nil, + # The platform (operating system) for which the container was created. + # + # This field was introduced for the experimental "LCOW" (Linux Containers On + # Windows) features, which has been removed. In most cases, this field is equal to + # the host's operating system (`linux` or `windows`). + platform: nil, + # SELinux process label set for the container. + process_label: nil, + # Location of the `/etc/resolv.conf` generated for the container on the host. + # + # This file is managed through the docker daemon, and should not be accessed or + # modified by other tools. + resolv_conf_path: nil, + # Number of times the container was restarted since it was created, or since + # daemon was started. + restart_count: nil, + # The total size of all files in the read-only layers from the image that the + # container uses. These layers can be shared between containers. + # + # This field is omitted by default, and only set when size is requested in the API + # request. + size_root_fs: nil, + # The size of files that have been created or changed by this container. + # + # This field is omitted by default, and only set when size is requested in the API + # request. + size_rw: nil, + # ContainerState stores container's running state. It's part of ContainerJSONBase + # and will be returned by the "inspect" command. + state: nil, + # Information about the storage used by the container. + storage: nil + ) + end + + sig do + override.returns( + { + app_armor_profile: String, + args: T::Array[String], + config: Docker::Config, + created: T.nilable(String), + driver: String, + exec_ids: T.nilable(T::Array[String]), + graph_driver: Docker::Container::GraphDriver, + host_config: Docker::Container::HostConfig, + hostname_path: String, + hosts_path: String, + id: String, + image: String, + image_manifest_descriptor: + Docker::Container::ImageManifestDescriptor, + log_path: T.nilable(String), + mount_label: String, + mounts: T::Array[Docker::Container::Mount], + name: String, + network_settings: Docker::Container::NetworkSettings, + path: String, + platform: String, + process_label: String, + resolv_conf_path: String, + restart_count: Integer, + size_root_fs: T.nilable(Integer), + size_rw: T.nilable(Integer), + state: T.nilable(Docker::Container::State), + storage: Docker::Container::Storage + } + ) + end + def to_hash + end + + class GraphDriver < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Container::GraphDriver, Docker::Internal::AnyHash) + end + + # Low-level storage metadata, provided as key/value pairs. + # + # This information is driver-specific, and depends on the storage-driver in use, + # and should be used for informational purposes only. + sig { returns(T::Hash[Symbol, String]) } + attr_accessor :data + + # Name of the storage driver. + sig { returns(String) } + attr_accessor :name + + # Information about the storage driver used to store the container's and image's + # filesystem. + sig do + params(data: T::Hash[Symbol, String], name: String).returns( + T.attached_class + ) + end + def self.new( + # Low-level storage metadata, provided as key/value pairs. + # + # This information is driver-specific, and depends on the storage-driver in use, + # and should be used for informational purposes only. + data:, + # Name of the storage driver. + name: + ) + end + + sig do + override.returns({ data: T::Hash[Symbol, String], name: String }) + end + def to_hash + end + end + + class HostConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Container::HostConfig, Docker::Internal::AnyHash) + end + + # Arbitrary non-identifying metadata attached to container and provided to the + # runtime when the container is started. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :annotations + + sig { params(annotations: T::Hash[Symbol, String]).void } + attr_writer :annotations + + # Automatically remove the container when the container's process exits. This has + # no effect if `RestartPolicy` is set. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :auto_remove + + sig { params(auto_remove: T::Boolean).void } + attr_writer :auto_remove + + # A list of volume bindings for this container. Each volume binding is a string in + # one of these forms: + # + # - `host-src:container-dest[:options]` to bind-mount a host path into the + # container. Both `host-src`, and `container-dest` must be an _absolute_ path. + # - `volume-name:container-dest[:options]` to bind-mount a volume managed by a + # volume driver into the container. `container-dest` must be an _absolute_ path. + # + # `options` is an optional, comma-delimited list of: + # + # - `nocopy` disables automatic copying of data from the container path to the + # volume. The `nocopy` flag only applies to named volumes. + # - `[ro|rw]` mounts a volume read-only or read-write, respectively. If omitted or + # set to `rw`, volumes are mounted read-write. + # - `[z|Z]` applies SELinux labels to allow or deny multiple containers to read + # and write to the same volume. + # - `z`: a _shared_ content label is applied to the content. This label + # indicates that multiple containers can share the volume content, for both + # reading and writing. + # - `Z`: a _private unshared_ label is applied to the content. This label + # indicates that only the current container can use a private volume. Labeling + # systems such as SELinux require proper labels to be placed on volume content + # that is mounted into a container. Without a label, the security system can + # prevent a container's processes from using the content. By default, the + # labels set by the host operating system are not modified. + # - `[[r]shared|[r]slave|[r]private]` specifies mount + # [propagation behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt). + # This only applies to bind-mounted volumes, not internal volumes or named + # volumes. Mount propagation requires the source mount point (the location where + # the source directory is mounted in the host operating system) to have the + # correct propagation properties. For shared volumes, the source mount point + # must be set to `shared`. For slave volumes, the mount must be set to either + # `shared` or `slave`. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :binds + + sig { params(binds: T::Array[String]).void } + attr_writer :binds + + # Limit read rate (bytes per second) from a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + sig do + returns( + T.nilable( + T::Array[Docker::Container::HostConfig::BlkioDeviceReadBp] + ) + ) + end + attr_reader :blkio_device_read_bps + + sig do + params( + blkio_device_read_bps: + T::Array[Docker::Container::HostConfig::BlkioDeviceReadBp::OrHash] + ).void + end + attr_writer :blkio_device_read_bps + + # Limit read rate (IO per second) from a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + sig do + returns( + T.nilable( + T::Array[Docker::Container::HostConfig::BlkioDeviceReadIOp] + ) + ) + end + attr_reader :blkio_device_read_i_ops + + sig do + params( + blkio_device_read_i_ops: + T::Array[ + Docker::Container::HostConfig::BlkioDeviceReadIOp::OrHash + ] + ).void + end + attr_writer :blkio_device_read_i_ops + + # Limit write rate (bytes per second) to a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + sig do + returns( + T.nilable( + T::Array[Docker::Container::HostConfig::BlkioDeviceWriteBp] + ) + ) + end + attr_reader :blkio_device_write_bps + + sig do + params( + blkio_device_write_bps: + T::Array[ + Docker::Container::HostConfig::BlkioDeviceWriteBp::OrHash + ] + ).void + end + attr_writer :blkio_device_write_bps + + # Limit write rate (IO per second) to a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + sig do + returns( + T.nilable( + T::Array[Docker::Container::HostConfig::BlkioDeviceWriteIOp] + ) + ) + end + attr_reader :blkio_device_write_i_ops + + sig do + params( + blkio_device_write_i_ops: + T::Array[ + Docker::Container::HostConfig::BlkioDeviceWriteIOp::OrHash + ] + ).void + end + attr_writer :blkio_device_write_i_ops + + # Block IO weight (relative weight). + sig { returns(T.nilable(Integer)) } + attr_reader :blkio_weight + + sig { params(blkio_weight: Integer).void } + attr_writer :blkio_weight + + # Block IO weight (relative device weight) in the form: + # + # ``` + # [{"Path": "device_path", "Weight": weight}] + # ``` + sig do + returns( + T.nilable( + T::Array[Docker::Container::HostConfig::BlkioWeightDevice] + ) + ) + end + attr_reader :blkio_weight_device + + sig do + params( + blkio_weight_device: + T::Array[Docker::Container::HostConfig::BlkioWeightDevice::OrHash] + ).void + end + attr_writer :blkio_weight_device + + # A list of kernel capabilities to add to the container. Conflicts with option + # 'Capabilities'. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :cap_add + + sig { params(cap_add: T::Array[String]).void } + attr_writer :cap_add + + # A list of kernel capabilities to drop from the container. Conflicts with option + # 'Capabilities'. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :cap_drop + + sig { params(cap_drop: T::Array[String]).void } + attr_writer :cap_drop + + # Cgroup to use for the container. + sig { returns(T.nilable(String)) } + attr_reader :cgroup + + sig { params(cgroup: String).void } + attr_writer :cgroup + + # cgroup namespace mode for the container. Possible values are: + # + # - `"private"`: the container runs in its own private cgroup namespace + # - `"host"`: use the host system's cgroup namespace + # + # If not specified, the daemon default is used, which can either be `"private"` or + # `"host"`, depending on daemon version, kernel support and configuration. + sig do + returns( + T.nilable(Docker::Container::HostConfig::CgroupnsMode::TaggedSymbol) + ) + end + attr_reader :cgroupns_mode + + sig do + params( + cgroupns_mode: Docker::Container::HostConfig::CgroupnsMode::OrSymbol + ).void + end + attr_writer :cgroupns_mode + + # Path to `cgroups` under which the container's `cgroup` is created. If the path + # is not absolute, the path is considered to be relative to the `cgroups` path of + # the init process. Cgroups are created if they do not already exist. + sig { returns(T.nilable(String)) } + attr_reader :cgroup_parent + + sig { params(cgroup_parent: String).void } + attr_writer :cgroup_parent + + # Initial console size, as an `[height, width]` array. + sig { returns(T.nilable(T::Array[Integer])) } + attr_accessor :console_size + + # Path to a file where the container ID is written + sig { returns(T.nilable(String)) } + attr_reader :container_id_file + + sig { params(container_id_file: String).void } + attr_writer :container_id_file + + # The number of usable CPUs (Windows only). + # + # On Windows Server containers, the processor resource controls are mutually + # exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and + # `CPUPercent` last. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_count + + sig { params(cpu_count: Integer).void } + attr_writer :cpu_count + + # The usable percentage of the available CPUs (Windows only). + # + # On Windows Server containers, the processor resource controls are mutually + # exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and + # `CPUPercent` last. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_percent + + sig { params(cpu_percent: Integer).void } + attr_writer :cpu_percent + + # The length of a CPU period in microseconds. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_period + + sig { params(cpu_period: Integer).void } + attr_writer :cpu_period + + # Microseconds of CPU time that the container can get in a CPU period. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_quota + + sig { params(cpu_quota: Integer).void } + attr_writer :cpu_quota + + # The length of a CPU real-time period in microseconds. Set to 0 to allocate no + # time allocated to real-time tasks. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_realtime_period + + sig { params(cpu_realtime_period: Integer).void } + attr_writer :cpu_realtime_period + + # The length of a CPU real-time runtime in microseconds. Set to 0 to allocate no + # time allocated to real-time tasks. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_realtime_runtime + + sig { params(cpu_realtime_runtime: Integer).void } + attr_writer :cpu_realtime_runtime + + # CPUs in which to allow execution (e.g., `0-3`, `0,1`). + sig { returns(T.nilable(String)) } + attr_reader :cpuset_cpus + + sig { params(cpuset_cpus: String).void } + attr_writer :cpuset_cpus + + # Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on + # NUMA systems. + sig { returns(T.nilable(String)) } + attr_reader :cpuset_mems + + sig { params(cpuset_mems: String).void } + attr_writer :cpuset_mems + + # An integer value representing this container's relative CPU weight versus other + # containers. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_shares + + sig { params(cpu_shares: Integer).void } + attr_writer :cpu_shares + + # a list of cgroup rules to apply to the container + sig { returns(T.nilable(T::Array[String])) } + attr_reader :device_cgroup_rules + + sig { params(device_cgroup_rules: T::Array[String]).void } + attr_writer :device_cgroup_rules + + # A list of requests for devices to be sent to device drivers. + sig do + returns( + T.nilable(T::Array[Docker::Container::HostConfig::DeviceRequest]) + ) + end + attr_reader :device_requests + + sig do + params( + device_requests: + T::Array[Docker::Container::HostConfig::DeviceRequest::OrHash] + ).void + end + attr_writer :device_requests + + # A list of devices to add to the container. + sig do + returns(T.nilable(T::Array[Docker::Container::HostConfig::Device])) + end + attr_reader :devices + + sig do + params( + devices: T::Array[Docker::Container::HostConfig::Device::OrHash] + ).void + end + attr_writer :devices + + # A list of DNS servers for the container to use. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :dns + + sig { params(dns: T::Array[String]).void } + attr_writer :dns + + # A list of DNS options. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :dns_options + + sig { params(dns_options: T::Array[String]).void } + attr_writer :dns_options + + # A list of DNS search domains. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :dns_search + + sig { params(dns_search: T::Array[String]).void } + attr_writer :dns_search + + # A list of hostnames/IP mappings to add to the container's `/etc/hosts` file. + # Specified in the form `["hostname:IP"]`. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :extra_hosts + + sig { params(extra_hosts: T::Array[String]).void } + attr_writer :extra_hosts + + # A list of additional groups that the container process will run as. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :group_add + + sig { params(group_add: T::Array[String]).void } + attr_writer :group_add + + # Run an init inside the container that forwards signals and reaps processes. This + # field is omitted if empty, and the default (as configured on the daemon) is + # used. + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :init + + # Maximum IO in bytes per second for the container system drive (Windows only). + sig { returns(T.nilable(Integer)) } + attr_reader :io_maximum_bandwidth + + sig { params(io_maximum_bandwidth: Integer).void } + attr_writer :io_maximum_bandwidth + + # Maximum IOps for the container system drive (Windows only) + sig { returns(T.nilable(Integer)) } + attr_reader :io_maximum_i_ops + + sig { params(io_maximum_i_ops: Integer).void } + attr_writer :io_maximum_i_ops + + # IPC sharing mode for the container. Possible values are: + # + # - `"none"`: own private IPC namespace, with /dev/shm not mounted + # - `"private"`: own private IPC namespace + # - `"shareable"`: own private IPC namespace, with a possibility to share it with + # other containers + # - `"container:"`: join another (shareable) container's IPC namespace + # - `"host"`: use the host system's IPC namespace + # + # If not specified, daemon default is used, which can either be `"private"` or + # `"shareable"`, depending on daemon version and configuration. + sig { returns(T.nilable(String)) } + attr_reader :ipc_mode + + sig { params(ipc_mode: String).void } + attr_writer :ipc_mode + + # Isolation technology of the container. (Windows only) + sig do + returns( + T.nilable(Docker::Container::HostConfig::Isolation::TaggedSymbol) + ) + end + attr_reader :isolation + + sig do + params( + isolation: Docker::Container::HostConfig::Isolation::OrSymbol + ).void + end + attr_writer :isolation + + # A list of links for the container in the form `container_name:alias`. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :links + + sig { params(links: T::Array[String]).void } + attr_writer :links + + # The logging configuration for this container + sig { returns(T.nilable(Docker::Container::HostConfig::LogConfig)) } + attr_reader :log_config + + sig do + params( + log_config: Docker::Container::HostConfig::LogConfig::OrHash + ).void + end + attr_writer :log_config + + # The list of paths to be masked inside the container (this overrides the default + # set of paths). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :masked_paths + + sig { params(masked_paths: T::Array[String]).void } + attr_writer :masked_paths + + # Memory limit in bytes. + sig { returns(T.nilable(Integer)) } + attr_reader :memory + + sig { params(memory: Integer).void } + attr_writer :memory + + # Memory soft limit in bytes. + sig { returns(T.nilable(Integer)) } + attr_reader :memory_reservation + + sig { params(memory_reservation: Integer).void } + attr_writer :memory_reservation + + # Total memory limit (memory + swap). Set as `-1` to enable unlimited swap. + sig { returns(T.nilable(Integer)) } + attr_reader :memory_swap + + sig { params(memory_swap: Integer).void } + attr_writer :memory_swap + + # Tune a container's memory swappiness behavior. Accepts an integer between 0 + # and 100. + sig { returns(T.nilable(Integer)) } + attr_reader :memory_swappiness + + sig { params(memory_swappiness: Integer).void } + attr_writer :memory_swappiness + + # Specification for mounts to be added to the container. + sig do + returns(T.nilable(T::Array[Docker::Container::HostConfig::Mount])) + end + attr_reader :mounts + + sig do + params( + mounts: T::Array[Docker::Container::HostConfig::Mount::OrHash] + ).void + end + attr_writer :mounts + + # CPU quota in units of 10-9 CPUs. + sig { returns(T.nilable(Integer)) } + attr_reader :nano_cpus + + sig { params(nano_cpus: Integer).void } + attr_writer :nano_cpus + + # Network mode to use for this container. Supported standard values are: `bridge`, + # `host`, `none`, and `container:`. Any other value is taken as a custom + # network's name to which this container should connect to. + sig { returns(T.nilable(String)) } + attr_reader :network_mode + + sig { params(network_mode: String).void } + attr_writer :network_mode + + # Disable OOM Killer for the container. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :oom_kill_disable + + sig { params(oom_kill_disable: T::Boolean).void } + attr_writer :oom_kill_disable + + # An integer value containing the score given to the container in order to tune + # OOM killer preferences. + sig { returns(T.nilable(Integer)) } + attr_reader :oom_score_adj + + sig { params(oom_score_adj: Integer).void } + attr_writer :oom_score_adj + + # Set the PID (Process) Namespace mode for the container. It can be either: + # + # - `"container:"`: joins another container's PID namespace + # - `"host"`: use the host's PID namespace inside the container + sig { returns(T.nilable(String)) } + attr_reader :pid_mode + + sig { params(pid_mode: String).void } + attr_writer :pid_mode + + # Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` to not + # change. + sig { returns(T.nilable(Integer)) } + attr_accessor :pids_limit + + # PortMap describes the mapping of container ports to host ports, using the + # container's port-number and protocol as key in the format `/`, + # for example, `80/udp`. + # + # If a container's port is mapped for multiple protocols, separate entries are + # added to the mapping table. + sig do + returns( + T.nilable( + T::Hash[ + Symbol, + T::Array[Docker::Container::HostConfig::PortBinding] + ] + ) + ) + end + attr_reader :port_bindings + + sig do + params( + port_bindings: + T::Hash[ + Symbol, + T::Array[Docker::Container::HostConfig::PortBinding::OrHash] + ] + ).void + end + attr_writer :port_bindings + + # Gives the container full access to the host. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :privileged + + sig { params(privileged: T::Boolean).void } + attr_writer :privileged + + # Allocates an ephemeral host port for all of a container's exposed ports. + # + # Ports are de-allocated when the container stops and allocated when the container + # starts. The allocated port might be changed when restarting the container. + # + # The port is selected from the ephemeral port range that depends on the kernel. + # For example, on Linux the range is defined by + # `/proc/sys/net/ipv4/ip_local_port_range`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :publish_all_ports + + sig { params(publish_all_ports: T::Boolean).void } + attr_writer :publish_all_ports + + # The list of paths to be set as read-only inside the container (this overrides + # the default set of paths). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :readonly_paths + + sig { params(readonly_paths: T::Array[String]).void } + attr_writer :readonly_paths + + # Mount the container's root filesystem as read only. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :readonly_rootfs + + sig { params(readonly_rootfs: T::Boolean).void } + attr_writer :readonly_rootfs + + # The behavior to apply when the container exits. The default is not to restart. + # + # An ever increasing delay (double the previous delay, starting at 100ms) is added + # before each restart to prevent flooding the server. + sig { returns(T.nilable(Docker::Container::HostConfig::RestartPolicy)) } + attr_reader :restart_policy + + sig do + params( + restart_policy: Docker::Container::HostConfig::RestartPolicy::OrHash + ).void + end + attr_writer :restart_policy + + # Runtime to use with this container. + sig { returns(T.nilable(String)) } + attr_accessor :runtime + + # A list of string values to customize labels for MLS systems, such as SELinux. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :security_opt + + sig { params(security_opt: T::Array[String]).void } + attr_writer :security_opt + + # Size of `/dev/shm` in bytes. If omitted, the system uses 64MB. + sig { returns(T.nilable(Integer)) } + attr_reader :shm_size + + sig { params(shm_size: Integer).void } + attr_writer :shm_size + + # Storage driver options for this container, in the form `{"size": "120G"}`. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :storage_opt + + sig { params(storage_opt: T::Hash[Symbol, String]).void } + attr_writer :storage_opt + + # A list of kernel parameters (sysctls) to set in the container. + # + # This field is omitted if not set. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :sysctls + + # A map of container directories which should be replaced by tmpfs mounts, and + # their corresponding mount options. For example: + # + # ``` + # { "/run": "rw,noexec,nosuid,size=65536k" } + # ``` + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :tmpfs + + sig { params(tmpfs: T::Hash[Symbol, String]).void } + attr_writer :tmpfs + + # A list of resource limits to set in the container. For example: + # + # ``` + # {"Name": "nofile", "Soft": 1024, "Hard": 2048} + # ``` + sig do + returns(T.nilable(T::Array[Docker::Container::HostConfig::Ulimit])) + end + attr_reader :ulimits + + sig do + params( + ulimits: T::Array[Docker::Container::HostConfig::Ulimit::OrHash] + ).void + end + attr_writer :ulimits + + # Sets the usernamespace mode for the container when usernamespace remapping + # option is enabled. + sig { returns(T.nilable(String)) } + attr_reader :userns_mode + + sig { params(userns_mode: String).void } + attr_writer :userns_mode + + # UTS namespace to use for the container. + sig { returns(T.nilable(String)) } + attr_reader :uts_mode + + sig { params(uts_mode: String).void } + attr_writer :uts_mode + + # Driver that this container uses to mount volumes. + sig { returns(T.nilable(String)) } + attr_reader :volume_driver + + sig { params(volume_driver: String).void } + attr_writer :volume_driver + + # A list of volumes to inherit from another container, specified in the form + # `[:]`. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :volumes_from + + sig { params(volumes_from: T::Array[String]).void } + attr_writer :volumes_from + + # Container configuration that depends on the host we are running on + sig do + params( + annotations: T::Hash[Symbol, String], + auto_remove: T::Boolean, + binds: T::Array[String], + blkio_device_read_bps: + T::Array[ + Docker::Container::HostConfig::BlkioDeviceReadBp::OrHash + ], + blkio_device_read_i_ops: + T::Array[ + Docker::Container::HostConfig::BlkioDeviceReadIOp::OrHash + ], + blkio_device_write_bps: + T::Array[ + Docker::Container::HostConfig::BlkioDeviceWriteBp::OrHash + ], + blkio_device_write_i_ops: + T::Array[ + Docker::Container::HostConfig::BlkioDeviceWriteIOp::OrHash + ], + blkio_weight: Integer, + blkio_weight_device: + T::Array[ + Docker::Container::HostConfig::BlkioWeightDevice::OrHash + ], + cap_add: T::Array[String], + cap_drop: T::Array[String], + cgroup: String, + cgroupns_mode: + Docker::Container::HostConfig::CgroupnsMode::OrSymbol, + cgroup_parent: String, + console_size: T.nilable(T::Array[Integer]), + container_id_file: String, + cpu_count: Integer, + cpu_percent: Integer, + cpu_period: Integer, + cpu_quota: Integer, + cpu_realtime_period: Integer, + cpu_realtime_runtime: Integer, + cpuset_cpus: String, + cpuset_mems: String, + cpu_shares: Integer, + device_cgroup_rules: T::Array[String], + device_requests: + T::Array[Docker::Container::HostConfig::DeviceRequest::OrHash], + devices: T::Array[Docker::Container::HostConfig::Device::OrHash], + dns: T::Array[String], + dns_options: T::Array[String], + dns_search: T::Array[String], + extra_hosts: T::Array[String], + group_add: T::Array[String], + init: T.nilable(T::Boolean), + io_maximum_bandwidth: Integer, + io_maximum_i_ops: Integer, + ipc_mode: String, + isolation: Docker::Container::HostConfig::Isolation::OrSymbol, + links: T::Array[String], + log_config: Docker::Container::HostConfig::LogConfig::OrHash, + masked_paths: T::Array[String], + memory: Integer, + memory_reservation: Integer, + memory_swap: Integer, + memory_swappiness: Integer, + mounts: T::Array[Docker::Container::HostConfig::Mount::OrHash], + nano_cpus: Integer, + network_mode: String, + oom_kill_disable: T::Boolean, + oom_score_adj: Integer, + pid_mode: String, + pids_limit: T.nilable(Integer), + port_bindings: + T::Hash[ + Symbol, + T::Array[Docker::Container::HostConfig::PortBinding::OrHash] + ], + privileged: T::Boolean, + publish_all_ports: T::Boolean, + readonly_paths: T::Array[String], + readonly_rootfs: T::Boolean, + restart_policy: + Docker::Container::HostConfig::RestartPolicy::OrHash, + runtime: T.nilable(String), + security_opt: T::Array[String], + shm_size: Integer, + storage_opt: T::Hash[Symbol, String], + sysctls: T.nilable(T::Hash[Symbol, String]), + tmpfs: T::Hash[Symbol, String], + ulimits: T::Array[Docker::Container::HostConfig::Ulimit::OrHash], + userns_mode: String, + uts_mode: String, + volume_driver: String, + volumes_from: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # Arbitrary non-identifying metadata attached to container and provided to the + # runtime when the container is started. + annotations: nil, + # Automatically remove the container when the container's process exits. This has + # no effect if `RestartPolicy` is set. + auto_remove: nil, + # A list of volume bindings for this container. Each volume binding is a string in + # one of these forms: + # + # - `host-src:container-dest[:options]` to bind-mount a host path into the + # container. Both `host-src`, and `container-dest` must be an _absolute_ path. + # - `volume-name:container-dest[:options]` to bind-mount a volume managed by a + # volume driver into the container. `container-dest` must be an _absolute_ path. + # + # `options` is an optional, comma-delimited list of: + # + # - `nocopy` disables automatic copying of data from the container path to the + # volume. The `nocopy` flag only applies to named volumes. + # - `[ro|rw]` mounts a volume read-only or read-write, respectively. If omitted or + # set to `rw`, volumes are mounted read-write. + # - `[z|Z]` applies SELinux labels to allow or deny multiple containers to read + # and write to the same volume. + # - `z`: a _shared_ content label is applied to the content. This label + # indicates that multiple containers can share the volume content, for both + # reading and writing. + # - `Z`: a _private unshared_ label is applied to the content. This label + # indicates that only the current container can use a private volume. Labeling + # systems such as SELinux require proper labels to be placed on volume content + # that is mounted into a container. Without a label, the security system can + # prevent a container's processes from using the content. By default, the + # labels set by the host operating system are not modified. + # - `[[r]shared|[r]slave|[r]private]` specifies mount + # [propagation behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt). + # This only applies to bind-mounted volumes, not internal volumes or named + # volumes. Mount propagation requires the source mount point (the location where + # the source directory is mounted in the host operating system) to have the + # correct propagation properties. For shared volumes, the source mount point + # must be set to `shared`. For slave volumes, the mount must be set to either + # `shared` or `slave`. + binds: nil, + # Limit read rate (bytes per second) from a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + blkio_device_read_bps: nil, + # Limit read rate (IO per second) from a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + blkio_device_read_i_ops: nil, + # Limit write rate (bytes per second) to a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + blkio_device_write_bps: nil, + # Limit write rate (IO per second) to a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + blkio_device_write_i_ops: nil, + # Block IO weight (relative weight). + blkio_weight: nil, + # Block IO weight (relative device weight) in the form: + # + # ``` + # [{"Path": "device_path", "Weight": weight}] + # ``` + blkio_weight_device: nil, + # A list of kernel capabilities to add to the container. Conflicts with option + # 'Capabilities'. + cap_add: nil, + # A list of kernel capabilities to drop from the container. Conflicts with option + # 'Capabilities'. + cap_drop: nil, + # Cgroup to use for the container. + cgroup: nil, + # cgroup namespace mode for the container. Possible values are: + # + # - `"private"`: the container runs in its own private cgroup namespace + # - `"host"`: use the host system's cgroup namespace + # + # If not specified, the daemon default is used, which can either be `"private"` or + # `"host"`, depending on daemon version, kernel support and configuration. + cgroupns_mode: nil, + # Path to `cgroups` under which the container's `cgroup` is created. If the path + # is not absolute, the path is considered to be relative to the `cgroups` path of + # the init process. Cgroups are created if they do not already exist. + cgroup_parent: nil, + # Initial console size, as an `[height, width]` array. + console_size: nil, + # Path to a file where the container ID is written + container_id_file: nil, + # The number of usable CPUs (Windows only). + # + # On Windows Server containers, the processor resource controls are mutually + # exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and + # `CPUPercent` last. + cpu_count: nil, + # The usable percentage of the available CPUs (Windows only). + # + # On Windows Server containers, the processor resource controls are mutually + # exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and + # `CPUPercent` last. + cpu_percent: nil, + # The length of a CPU period in microseconds. + cpu_period: nil, + # Microseconds of CPU time that the container can get in a CPU period. + cpu_quota: nil, + # The length of a CPU real-time period in microseconds. Set to 0 to allocate no + # time allocated to real-time tasks. + cpu_realtime_period: nil, + # The length of a CPU real-time runtime in microseconds. Set to 0 to allocate no + # time allocated to real-time tasks. + cpu_realtime_runtime: nil, + # CPUs in which to allow execution (e.g., `0-3`, `0,1`). + cpuset_cpus: nil, + # Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on + # NUMA systems. + cpuset_mems: nil, + # An integer value representing this container's relative CPU weight versus other + # containers. + cpu_shares: nil, + # a list of cgroup rules to apply to the container + device_cgroup_rules: nil, + # A list of requests for devices to be sent to device drivers. + device_requests: nil, + # A list of devices to add to the container. + devices: nil, + # A list of DNS servers for the container to use. + dns: nil, + # A list of DNS options. + dns_options: nil, + # A list of DNS search domains. + dns_search: nil, + # A list of hostnames/IP mappings to add to the container's `/etc/hosts` file. + # Specified in the form `["hostname:IP"]`. + extra_hosts: nil, + # A list of additional groups that the container process will run as. + group_add: nil, + # Run an init inside the container that forwards signals and reaps processes. This + # field is omitted if empty, and the default (as configured on the daemon) is + # used. + init: nil, + # Maximum IO in bytes per second for the container system drive (Windows only). + io_maximum_bandwidth: nil, + # Maximum IOps for the container system drive (Windows only) + io_maximum_i_ops: nil, + # IPC sharing mode for the container. Possible values are: + # + # - `"none"`: own private IPC namespace, with /dev/shm not mounted + # - `"private"`: own private IPC namespace + # - `"shareable"`: own private IPC namespace, with a possibility to share it with + # other containers + # - `"container:"`: join another (shareable) container's IPC namespace + # - `"host"`: use the host system's IPC namespace + # + # If not specified, daemon default is used, which can either be `"private"` or + # `"shareable"`, depending on daemon version and configuration. + ipc_mode: nil, + # Isolation technology of the container. (Windows only) + isolation: nil, + # A list of links for the container in the form `container_name:alias`. + links: nil, + # The logging configuration for this container + log_config: nil, + # The list of paths to be masked inside the container (this overrides the default + # set of paths). + masked_paths: nil, + # Memory limit in bytes. + memory: nil, + # Memory soft limit in bytes. + memory_reservation: nil, + # Total memory limit (memory + swap). Set as `-1` to enable unlimited swap. + memory_swap: nil, + # Tune a container's memory swappiness behavior. Accepts an integer between 0 + # and 100. + memory_swappiness: nil, + # Specification for mounts to be added to the container. + mounts: nil, + # CPU quota in units of 10-9 CPUs. + nano_cpus: nil, + # Network mode to use for this container. Supported standard values are: `bridge`, + # `host`, `none`, and `container:`. Any other value is taken as a custom + # network's name to which this container should connect to. + network_mode: nil, + # Disable OOM Killer for the container. + oom_kill_disable: nil, + # An integer value containing the score given to the container in order to tune + # OOM killer preferences. + oom_score_adj: nil, + # Set the PID (Process) Namespace mode for the container. It can be either: + # + # - `"container:"`: joins another container's PID namespace + # - `"host"`: use the host's PID namespace inside the container + pid_mode: nil, + # Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` to not + # change. + pids_limit: nil, + # PortMap describes the mapping of container ports to host ports, using the + # container's port-number and protocol as key in the format `/`, + # for example, `80/udp`. + # + # If a container's port is mapped for multiple protocols, separate entries are + # added to the mapping table. + port_bindings: nil, + # Gives the container full access to the host. + privileged: nil, + # Allocates an ephemeral host port for all of a container's exposed ports. + # + # Ports are de-allocated when the container stops and allocated when the container + # starts. The allocated port might be changed when restarting the container. + # + # The port is selected from the ephemeral port range that depends on the kernel. + # For example, on Linux the range is defined by + # `/proc/sys/net/ipv4/ip_local_port_range`. + publish_all_ports: nil, + # The list of paths to be set as read-only inside the container (this overrides + # the default set of paths). + readonly_paths: nil, + # Mount the container's root filesystem as read only. + readonly_rootfs: nil, + # The behavior to apply when the container exits. The default is not to restart. + # + # An ever increasing delay (double the previous delay, starting at 100ms) is added + # before each restart to prevent flooding the server. + restart_policy: nil, + # Runtime to use with this container. + runtime: nil, + # A list of string values to customize labels for MLS systems, such as SELinux. + security_opt: nil, + # Size of `/dev/shm` in bytes. If omitted, the system uses 64MB. + shm_size: nil, + # Storage driver options for this container, in the form `{"size": "120G"}`. + storage_opt: nil, + # A list of kernel parameters (sysctls) to set in the container. + # + # This field is omitted if not set. + sysctls: nil, + # A map of container directories which should be replaced by tmpfs mounts, and + # their corresponding mount options. For example: + # + # ``` + # { "/run": "rw,noexec,nosuid,size=65536k" } + # ``` + tmpfs: nil, + # A list of resource limits to set in the container. For example: + # + # ``` + # {"Name": "nofile", "Soft": 1024, "Hard": 2048} + # ``` + ulimits: nil, + # Sets the usernamespace mode for the container when usernamespace remapping + # option is enabled. + userns_mode: nil, + # UTS namespace to use for the container. + uts_mode: nil, + # Driver that this container uses to mount volumes. + volume_driver: nil, + # A list of volumes to inherit from another container, specified in the form + # `[:]`. + volumes_from: nil + ) + end + + sig do + override.returns( + { + annotations: T::Hash[Symbol, String], + auto_remove: T::Boolean, + binds: T::Array[String], + blkio_device_read_bps: + T::Array[Docker::Container::HostConfig::BlkioDeviceReadBp], + blkio_device_read_i_ops: + T::Array[Docker::Container::HostConfig::BlkioDeviceReadIOp], + blkio_device_write_bps: + T::Array[Docker::Container::HostConfig::BlkioDeviceWriteBp], + blkio_device_write_i_ops: + T::Array[Docker::Container::HostConfig::BlkioDeviceWriteIOp], + blkio_weight: Integer, + blkio_weight_device: + T::Array[Docker::Container::HostConfig::BlkioWeightDevice], + cap_add: T::Array[String], + cap_drop: T::Array[String], + cgroup: String, + cgroupns_mode: + Docker::Container::HostConfig::CgroupnsMode::TaggedSymbol, + cgroup_parent: String, + console_size: T.nilable(T::Array[Integer]), + container_id_file: String, + cpu_count: Integer, + cpu_percent: Integer, + cpu_period: Integer, + cpu_quota: Integer, + cpu_realtime_period: Integer, + cpu_realtime_runtime: Integer, + cpuset_cpus: String, + cpuset_mems: String, + cpu_shares: Integer, + device_cgroup_rules: T::Array[String], + device_requests: + T::Array[Docker::Container::HostConfig::DeviceRequest], + devices: T::Array[Docker::Container::HostConfig::Device], + dns: T::Array[String], + dns_options: T::Array[String], + dns_search: T::Array[String], + extra_hosts: T::Array[String], + group_add: T::Array[String], + init: T.nilable(T::Boolean), + io_maximum_bandwidth: Integer, + io_maximum_i_ops: Integer, + ipc_mode: String, + isolation: Docker::Container::HostConfig::Isolation::TaggedSymbol, + links: T::Array[String], + log_config: Docker::Container::HostConfig::LogConfig, + masked_paths: T::Array[String], + memory: Integer, + memory_reservation: Integer, + memory_swap: Integer, + memory_swappiness: Integer, + mounts: T::Array[Docker::Container::HostConfig::Mount], + nano_cpus: Integer, + network_mode: String, + oom_kill_disable: T::Boolean, + oom_score_adj: Integer, + pid_mode: String, + pids_limit: T.nilable(Integer), + port_bindings: + T::Hash[ + Symbol, + T::Array[Docker::Container::HostConfig::PortBinding] + ], + privileged: T::Boolean, + publish_all_ports: T::Boolean, + readonly_paths: T::Array[String], + readonly_rootfs: T::Boolean, + restart_policy: Docker::Container::HostConfig::RestartPolicy, + runtime: T.nilable(String), + security_opt: T::Array[String], + shm_size: Integer, + storage_opt: T::Hash[Symbol, String], + sysctls: T.nilable(T::Hash[Symbol, String]), + tmpfs: T::Hash[Symbol, String], + ulimits: T::Array[Docker::Container::HostConfig::Ulimit], + userns_mode: String, + uts_mode: String, + volume_driver: String, + volumes_from: T::Array[String] + } + ) + end + def to_hash + end + + class BlkioDeviceReadBp < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::BlkioDeviceReadBp, + Docker::Internal::AnyHash + ) + end + + # Device path + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + # Rate + sig { returns(T.nilable(Integer)) } + attr_reader :rate + + sig { params(rate: Integer).void } + attr_writer :rate + + sig { params(path: String, rate: Integer).returns(T.attached_class) } + def self.new( + # Device path + path: nil, + # Rate + rate: nil + ) + end + + sig { override.returns({ path: String, rate: Integer }) } + def to_hash + end + end + + class BlkioDeviceReadIOp < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::BlkioDeviceReadIOp, + Docker::Internal::AnyHash + ) + end + + # Device path + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + # Rate + sig { returns(T.nilable(Integer)) } + attr_reader :rate + + sig { params(rate: Integer).void } + attr_writer :rate + + sig { params(path: String, rate: Integer).returns(T.attached_class) } + def self.new( + # Device path + path: nil, + # Rate + rate: nil + ) + end + + sig { override.returns({ path: String, rate: Integer }) } + def to_hash + end + end + + class BlkioDeviceWriteBp < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::BlkioDeviceWriteBp, + Docker::Internal::AnyHash + ) + end + + # Device path + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + # Rate + sig { returns(T.nilable(Integer)) } + attr_reader :rate + + sig { params(rate: Integer).void } + attr_writer :rate + + sig { params(path: String, rate: Integer).returns(T.attached_class) } + def self.new( + # Device path + path: nil, + # Rate + rate: nil + ) + end + + sig { override.returns({ path: String, rate: Integer }) } + def to_hash + end + end + + class BlkioDeviceWriteIOp < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::BlkioDeviceWriteIOp, + Docker::Internal::AnyHash + ) + end + + # Device path + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + # Rate + sig { returns(T.nilable(Integer)) } + attr_reader :rate + + sig { params(rate: Integer).void } + attr_writer :rate + + sig { params(path: String, rate: Integer).returns(T.attached_class) } + def self.new( + # Device path + path: nil, + # Rate + rate: nil + ) + end + + sig { override.returns({ path: String, rate: Integer }) } + def to_hash + end + end + + class BlkioWeightDevice < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::BlkioWeightDevice, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + sig { returns(T.nilable(Integer)) } + attr_reader :weight + + sig { params(weight: Integer).void } + attr_writer :weight + + sig do + params(path: String, weight: Integer).returns(T.attached_class) + end + def self.new(path: nil, weight: nil) + end + + sig { override.returns({ path: String, weight: Integer }) } + def to_hash + end + end + + # cgroup namespace mode for the container. Possible values are: + # + # - `"private"`: the container runs in its own private cgroup namespace + # - `"host"`: use the host system's cgroup namespace + # + # If not specified, the daemon default is used, which can either be `"private"` or + # `"host"`, depending on daemon version, kernel support and configuration. + module CgroupnsMode + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Container::HostConfig::CgroupnsMode) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRIVATE = + T.let( + :private, + Docker::Container::HostConfig::CgroupnsMode::TaggedSymbol + ) + HOST = + T.let( + :host, + Docker::Container::HostConfig::CgroupnsMode::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Container::HostConfig::CgroupnsMode::TaggedSymbol + ] + ) + end + def self.values + end + end + + class DeviceRequest < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::DeviceRequest, + Docker::Internal::AnyHash + ) + end + + # A list of capabilities; an OR list of AND lists of capabilities. + # + # Note that if a driver is specified the capabilities have no effect on selecting + # a driver as the driver name is used directly. + # + # Note that if no driver is specified the capabilities are used to select a driver + # with the required capabilities. + sig { returns(T.nilable(T::Array[T::Array[String]])) } + attr_reader :capabilities + + sig { params(capabilities: T::Array[T::Array[String]]).void } + attr_writer :capabilities + + sig { returns(T.nilable(Integer)) } + attr_reader :count + + sig { params(count: Integer).void } + attr_writer :count + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :device_ids + + sig { params(device_ids: T::Array[String]).void } + attr_writer :device_ids + + # The name of the device driver to use for this request. + # + # Note that if this is specified the capabilities are ignored when selecting a + # device driver. + sig { returns(T.nilable(String)) } + attr_reader :driver + + sig { params(driver: String).void } + attr_writer :driver + + # Driver-specific options, specified as a key/value pairs. These options are + # passed directly to the driver. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :options + + sig { params(options: T::Hash[Symbol, String]).void } + attr_writer :options + + # A request for devices to be sent to device drivers + sig do + params( + capabilities: T::Array[T::Array[String]], + count: Integer, + device_ids: T::Array[String], + driver: String, + options: T::Hash[Symbol, String] + ).returns(T.attached_class) + end + def self.new( + # A list of capabilities; an OR list of AND lists of capabilities. + # + # Note that if a driver is specified the capabilities have no effect on selecting + # a driver as the driver name is used directly. + # + # Note that if no driver is specified the capabilities are used to select a driver + # with the required capabilities. + capabilities: nil, + count: nil, + device_ids: nil, + # The name of the device driver to use for this request. + # + # Note that if this is specified the capabilities are ignored when selecting a + # device driver. + driver: nil, + # Driver-specific options, specified as a key/value pairs. These options are + # passed directly to the driver. + options: nil + ) + end + + sig do + override.returns( + { + capabilities: T::Array[T::Array[String]], + count: Integer, + device_ids: T::Array[String], + driver: String, + options: T::Hash[Symbol, String] + } + ) + end + def to_hash + end + end + + class Device < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::Device, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :cgroup_permissions + + sig { params(cgroup_permissions: String).void } + attr_writer :cgroup_permissions + + sig { returns(T.nilable(String)) } + attr_reader :path_in_container + + sig { params(path_in_container: String).void } + attr_writer :path_in_container + + sig { returns(T.nilable(String)) } + attr_reader :path_on_host + + sig { params(path_on_host: String).void } + attr_writer :path_on_host + + # A device mapping between the host and container + sig do + params( + cgroup_permissions: String, + path_in_container: String, + path_on_host: String + ).returns(T.attached_class) + end + def self.new( + cgroup_permissions: nil, + path_in_container: nil, + path_on_host: nil + ) + end + + sig do + override.returns( + { + cgroup_permissions: String, + path_in_container: String, + path_on_host: String + } + ) + end + def to_hash + end + end + + # Isolation technology of the container. (Windows only) + module Isolation + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Container::HostConfig::Isolation) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DEFAULT = + T.let( + :default, + Docker::Container::HostConfig::Isolation::TaggedSymbol + ) + PROCESS = + T.let( + :process, + Docker::Container::HostConfig::Isolation::TaggedSymbol + ) + HYPERV = + T.let( + :hyperv, + Docker::Container::HostConfig::Isolation::TaggedSymbol + ) + EMPTY = + T.let(:"", Docker::Container::HostConfig::Isolation::TaggedSymbol) + + sig do + override.returns( + T::Array[Docker::Container::HostConfig::Isolation::TaggedSymbol] + ) + end + def self.values + end + end + + class LogConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::LogConfig, + Docker::Internal::AnyHash + ) + end + + # Driver-specific configuration options for the logging driver. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :config + + sig { params(config: T::Hash[Symbol, String]).void } + attr_writer :config + + # Name of the logging driver used for the container or "none" if logging is + # disabled. + sig do + returns( + T.nilable( + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + ) + ) + end + attr_reader :type + + sig do + params( + type: Docker::Container::HostConfig::LogConfig::Type::OrSymbol + ).void + end + attr_writer :type + + # The logging configuration for this container + sig do + params( + config: T::Hash[Symbol, String], + type: Docker::Container::HostConfig::LogConfig::Type::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Driver-specific configuration options for the logging driver. + config: nil, + # Name of the logging driver used for the container or "none" if logging is + # disabled. + type: nil + ) + end + + sig do + override.returns( + { + config: T::Hash[Symbol, String], + type: + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + } + ) + end + def to_hash + end + + # Name of the logging driver used for the container or "none" if logging is + # disabled. + module Type + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Container::HostConfig::LogConfig::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LOCAL = + T.let( + :local, + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + ) + JSON_FILE = + T.let( + :"json-file", + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + ) + SYSLOG = + T.let( + :syslog, + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + ) + JOURNALD = + T.let( + :journald, + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + ) + GELF = + T.let( + :gelf, + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + ) + FLUENTD = + T.let( + :fluentd, + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + ) + AWSLOGS = + T.let( + :awslogs, + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + ) + SPLUNK = + T.let( + :splunk, + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + ) + ETWLOGS = + T.let( + :etwlogs, + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + ) + NONE = + T.let( + :none, + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Container::HostConfig::LogConfig::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Mount < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::Mount, + Docker::Internal::AnyHash + ) + end + + # Optional configuration for the `bind` type. + sig do + returns( + T.nilable(Docker::Container::HostConfig::Mount::BindOptions) + ) + end + attr_reader :bind_options + + sig do + params( + bind_options: + Docker::Container::HostConfig::Mount::BindOptions::OrHash + ).void + end + attr_writer :bind_options + + # The consistency requirement for the mount: `default`, `consistent`, `cached`, or + # `delegated`. + sig { returns(T.nilable(String)) } + attr_reader :consistency + + sig { params(consistency: String).void } + attr_writer :consistency + + # Optional configuration for the `image` type. + sig do + returns( + T.nilable(Docker::Container::HostConfig::Mount::ImageOptions) + ) + end + attr_reader :image_options + + sig do + params( + image_options: + Docker::Container::HostConfig::Mount::ImageOptions::OrHash + ).void + end + attr_writer :image_options + + # Whether the mount should be read-only. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :read_only + + sig { params(read_only: T::Boolean).void } + attr_writer :read_only + + # Mount source (e.g. a volume name, a host path). The source cannot be specified + # when using `Type=tmpfs`. For `Type=bind`, the source path must either exist, or + # the `CreateMountpoint` must be set to `true` to create the source path on the + # host if missing. + # + # For `Type=npipe`, the pipe must exist prior to creating the container. + sig { returns(T.nilable(String)) } + attr_reader :source + + sig { params(source: String).void } + attr_writer :source + + # Container path. + sig { returns(T.nilable(String)) } + attr_reader :target + + sig { params(target: String).void } + attr_writer :target + + # Optional configuration for the `tmpfs` type. + sig do + returns( + T.nilable(Docker::Container::HostConfig::Mount::TmpfsOptions) + ) + end + attr_reader :tmpfs_options + + sig do + params( + tmpfs_options: + Docker::Container::HostConfig::Mount::TmpfsOptions::OrHash + ).void + end + attr_writer :tmpfs_options + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + sig do + returns( + T.nilable( + Docker::Container::HostConfig::Mount::Type::TaggedSymbol + ) + ) + end + attr_reader :type + + sig do + params( + type: Docker::Container::HostConfig::Mount::Type::OrSymbol + ).void + end + attr_writer :type + + # Optional configuration for the `volume` type. + sig do + returns( + T.nilable(Docker::Container::HostConfig::Mount::VolumeOptions) + ) + end + attr_reader :volume_options + + sig do + params( + volume_options: + Docker::Container::HostConfig::Mount::VolumeOptions::OrHash + ).void + end + attr_writer :volume_options + + sig do + params( + bind_options: + Docker::Container::HostConfig::Mount::BindOptions::OrHash, + consistency: String, + image_options: + Docker::Container::HostConfig::Mount::ImageOptions::OrHash, + read_only: T::Boolean, + source: String, + target: String, + tmpfs_options: + Docker::Container::HostConfig::Mount::TmpfsOptions::OrHash, + type: Docker::Container::HostConfig::Mount::Type::OrSymbol, + volume_options: + Docker::Container::HostConfig::Mount::VolumeOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Optional configuration for the `bind` type. + bind_options: nil, + # The consistency requirement for the mount: `default`, `consistent`, `cached`, or + # `delegated`. + consistency: nil, + # Optional configuration for the `image` type. + image_options: nil, + # Whether the mount should be read-only. + read_only: nil, + # Mount source (e.g. a volume name, a host path). The source cannot be specified + # when using `Type=tmpfs`. For `Type=bind`, the source path must either exist, or + # the `CreateMountpoint` must be set to `true` to create the source path on the + # host if missing. + # + # For `Type=npipe`, the pipe must exist prior to creating the container. + source: nil, + # Container path. + target: nil, + # Optional configuration for the `tmpfs` type. + tmpfs_options: nil, + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + type: nil, + # Optional configuration for the `volume` type. + volume_options: nil + ) + end + + sig do + override.returns( + { + bind_options: Docker::Container::HostConfig::Mount::BindOptions, + consistency: String, + image_options: + Docker::Container::HostConfig::Mount::ImageOptions, + read_only: T::Boolean, + source: String, + target: String, + tmpfs_options: + Docker::Container::HostConfig::Mount::TmpfsOptions, + type: Docker::Container::HostConfig::Mount::Type::TaggedSymbol, + volume_options: + Docker::Container::HostConfig::Mount::VolumeOptions + } + ) + end + def to_hash + end + + class BindOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::Mount::BindOptions, + Docker::Internal::AnyHash + ) + end + + # Create mount point on host if missing + sig { returns(T.nilable(T::Boolean)) } + attr_reader :create_mountpoint + + sig { params(create_mountpoint: T::Boolean).void } + attr_writer :create_mountpoint + + # Disable recursive bind mount. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :non_recursive + + sig { params(non_recursive: T::Boolean).void } + attr_writer :non_recursive + + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + sig do + returns( + T.nilable( + Docker::Container::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + ) + end + attr_reader :propagation + + sig do + params( + propagation: + Docker::Container::HostConfig::Mount::BindOptions::Propagation::OrSymbol + ).void + end + attr_writer :propagation + + # Raise an error if the mount cannot be made recursively read-only. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :read_only_force_recursive + + sig { params(read_only_force_recursive: T::Boolean).void } + attr_writer :read_only_force_recursive + + # Make the mount non-recursively read-only, but still leave the mount recursive + # (unless NonRecursive is set to `true` in conjunction). + # + # Added in v1.44, before that version all read-only mounts were non-recursive by + # default. To match the previous behaviour this will default to `true` for clients + # on versions prior to v1.44. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :read_only_non_recursive + + sig { params(read_only_non_recursive: T::Boolean).void } + attr_writer :read_only_non_recursive + + # Optional configuration for the `bind` type. + sig do + params( + create_mountpoint: T::Boolean, + non_recursive: T::Boolean, + propagation: + Docker::Container::HostConfig::Mount::BindOptions::Propagation::OrSymbol, + read_only_force_recursive: T::Boolean, + read_only_non_recursive: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Create mount point on host if missing + create_mountpoint: nil, + # Disable recursive bind mount. + non_recursive: nil, + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + propagation: nil, + # Raise an error if the mount cannot be made recursively read-only. + read_only_force_recursive: nil, + # Make the mount non-recursively read-only, but still leave the mount recursive + # (unless NonRecursive is set to `true` in conjunction). + # + # Added in v1.44, before that version all read-only mounts were non-recursive by + # default. To match the previous behaviour this will default to `true` for clients + # on versions prior to v1.44. + read_only_non_recursive: nil + ) + end + + sig do + override.returns( + { + create_mountpoint: T::Boolean, + non_recursive: T::Boolean, + propagation: + Docker::Container::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol, + read_only_force_recursive: T::Boolean, + read_only_non_recursive: T::Boolean + } + ) + end + def to_hash + end + + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + module Propagation + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Container::HostConfig::Mount::BindOptions::Propagation + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRIVATE = + T.let( + :private, + Docker::Container::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + RPRIVATE = + T.let( + :rprivate, + Docker::Container::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + SHARED = + T.let( + :shared, + Docker::Container::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + RSHARED = + T.let( + :rshared, + Docker::Container::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + SLAVE = + T.let( + :slave, + Docker::Container::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + RSLAVE = + T.let( + :rslave, + Docker::Container::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Container::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class ImageOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::Mount::ImageOptions, + Docker::Internal::AnyHash + ) + end + + # Source path inside the image. Must be relative without any back traversals. + sig { returns(T.nilable(String)) } + attr_reader :subpath + + sig { params(subpath: String).void } + attr_writer :subpath + + # Optional configuration for the `image` type. + sig { params(subpath: String).returns(T.attached_class) } + def self.new( + # Source path inside the image. Must be relative without any back traversals. + subpath: nil + ) + end + + sig { override.returns({ subpath: String }) } + def to_hash + end + end + + class TmpfsOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::Mount::TmpfsOptions, + Docker::Internal::AnyHash + ) + end + + # The permission mode for the tmpfs mount in an integer. The value must not be in + # octal format (e.g. 755) but rather the decimal representation of the octal value + # (e.g. 493). + sig { returns(T.nilable(Integer)) } + attr_reader :mode + + sig { params(mode: Integer).void } + attr_writer :mode + + # The options to be passed to the tmpfs mount. An array of arrays. Flag options + # should be provided as 1-length arrays. Other types should be provided as as + # 2-length arrays, where the first item is the key and the second the value. + sig { returns(T.nilable(T::Array[T::Array[String]])) } + attr_reader :options + + sig { params(options: T::Array[T::Array[String]]).void } + attr_writer :options + + # The size for the tmpfs mount in bytes. + sig { returns(T.nilable(Integer)) } + attr_reader :size_bytes + + sig { params(size_bytes: Integer).void } + attr_writer :size_bytes + + # Optional configuration for the `tmpfs` type. + sig do + params( + mode: Integer, + options: T::Array[T::Array[String]], + size_bytes: Integer + ).returns(T.attached_class) + end + def self.new( + # The permission mode for the tmpfs mount in an integer. The value must not be in + # octal format (e.g. 755) but rather the decimal representation of the octal value + # (e.g. 493). + mode: nil, + # The options to be passed to the tmpfs mount. An array of arrays. Flag options + # should be provided as 1-length arrays. Other types should be provided as as + # 2-length arrays, where the first item is the key and the second the value. + options: nil, + # The size for the tmpfs mount in bytes. + size_bytes: nil + ) + end + + sig do + override.returns( + { + mode: Integer, + options: T::Array[T::Array[String]], + size_bytes: Integer + } + ) + end + def to_hash + end + end + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + module Type + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Container::HostConfig::Mount::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + BIND = + T.let( + :bind, + Docker::Container::HostConfig::Mount::Type::TaggedSymbol + ) + CLUSTER = + T.let( + :cluster, + Docker::Container::HostConfig::Mount::Type::TaggedSymbol + ) + IMAGE = + T.let( + :image, + Docker::Container::HostConfig::Mount::Type::TaggedSymbol + ) + NPIPE = + T.let( + :npipe, + Docker::Container::HostConfig::Mount::Type::TaggedSymbol + ) + TMPFS = + T.let( + :tmpfs, + Docker::Container::HostConfig::Mount::Type::TaggedSymbol + ) + VOLUME = + T.let( + :volume, + Docker::Container::HostConfig::Mount::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Container::HostConfig::Mount::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + class VolumeOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::Mount::VolumeOptions, + Docker::Internal::AnyHash + ) + end + + # Map of driver specific options + sig do + returns( + T.nilable( + Docker::Container::HostConfig::Mount::VolumeOptions::DriverConfig + ) + ) + end + attr_reader :driver_config + + sig do + params( + driver_config: + Docker::Container::HostConfig::Mount::VolumeOptions::DriverConfig::OrHash + ).void + end + attr_writer :driver_config + + # User-defined key/value metadata. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :labels + + sig { params(labels: T::Hash[Symbol, String]).void } + attr_writer :labels + + # Populate volume with data from the target. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :no_copy + + sig { params(no_copy: T::Boolean).void } + attr_writer :no_copy + + # Source path inside the volume. Must be relative without any back traversals. + sig { returns(T.nilable(String)) } + attr_reader :subpath + + sig { params(subpath: String).void } + attr_writer :subpath + + # Optional configuration for the `volume` type. + sig do + params( + driver_config: + Docker::Container::HostConfig::Mount::VolumeOptions::DriverConfig::OrHash, + labels: T::Hash[Symbol, String], + no_copy: T::Boolean, + subpath: String + ).returns(T.attached_class) + end + def self.new( + # Map of driver specific options + driver_config: nil, + # User-defined key/value metadata. + labels: nil, + # Populate volume with data from the target. + no_copy: nil, + # Source path inside the volume. Must be relative without any back traversals. + subpath: nil + ) + end + + sig do + override.returns( + { + driver_config: + Docker::Container::HostConfig::Mount::VolumeOptions::DriverConfig, + labels: T::Hash[Symbol, String], + no_copy: T::Boolean, + subpath: String + } + ) + end + def to_hash + end + + class DriverConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::Mount::VolumeOptions::DriverConfig, + Docker::Internal::AnyHash + ) + end + + # Name of the driver to use to create the volume. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # key/value map of driver specific options. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :options + + sig { params(options: T::Hash[Symbol, String]).void } + attr_writer :options + + # Map of driver specific options + sig do + params(name: String, options: T::Hash[Symbol, String]).returns( + T.attached_class + ) + end + def self.new( + # Name of the driver to use to create the volume. + name: nil, + # key/value map of driver specific options. + options: nil + ) + end + + sig do + override.returns( + { name: String, options: T::Hash[Symbol, String] } + ) + end + def to_hash + end + end + end + end + + class PortBinding < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::PortBinding, + Docker::Internal::AnyHash + ) + end + + # Host IP address that the container's port is mapped to. + sig { returns(T.nilable(String)) } + attr_reader :host_ip + + sig { params(host_ip: String).void } + attr_writer :host_ip + + # Host port number that the container's port is mapped to. + sig { returns(T.nilable(String)) } + attr_reader :host_port + + sig { params(host_port: String).void } + attr_writer :host_port + + # PortBinding represents a binding between a host IP address and a host port. + sig do + params(host_ip: String, host_port: String).returns(T.attached_class) + end + def self.new( + # Host IP address that the container's port is mapped to. + host_ip: nil, + # Host port number that the container's port is mapped to. + host_port: nil + ) + end + + sig { override.returns({ host_ip: String, host_port: String }) } + def to_hash + end + end + + class RestartPolicy < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::RestartPolicy, + Docker::Internal::AnyHash + ) + end + + # If `on-failure` is used, the number of times to retry before giving up. + sig { returns(T.nilable(Integer)) } + attr_reader :maximum_retry_count + + sig { params(maximum_retry_count: Integer).void } + attr_writer :maximum_retry_count + + # - Empty string means not to restart + # - `no` Do not automatically restart + # - `always` Always restart + # - `unless-stopped` Restart always except when the user has manually stopped the + # container + # - `on-failure` Restart only when the container exit code is non-zero + sig do + returns( + T.nilable( + Docker::Container::HostConfig::RestartPolicy::Name::TaggedSymbol + ) + ) + end + attr_reader :name + + sig do + params( + name: Docker::Container::HostConfig::RestartPolicy::Name::OrSymbol + ).void + end + attr_writer :name + + # The behavior to apply when the container exits. The default is not to restart. + # + # An ever increasing delay (double the previous delay, starting at 100ms) is added + # before each restart to prevent flooding the server. + sig do + params( + maximum_retry_count: Integer, + name: Docker::Container::HostConfig::RestartPolicy::Name::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # If `on-failure` is used, the number of times to retry before giving up. + maximum_retry_count: nil, + # - Empty string means not to restart + # - `no` Do not automatically restart + # - `always` Always restart + # - `unless-stopped` Restart always except when the user has manually stopped the + # container + # - `on-failure` Restart only when the container exit code is non-zero + name: nil + ) + end + + sig do + override.returns( + { + maximum_retry_count: Integer, + name: + Docker::Container::HostConfig::RestartPolicy::Name::TaggedSymbol + } + ) + end + def to_hash + end + + # - Empty string means not to restart + # - `no` Do not automatically restart + # - `always` Always restart + # - `unless-stopped` Restart always except when the user has manually stopped the + # container + # - `on-failure` Restart only when the container exit code is non-zero + module Name + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Container::HostConfig::RestartPolicy::Name + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + EMPTY = + T.let( + :"", + Docker::Container::HostConfig::RestartPolicy::Name::TaggedSymbol + ) + NO = + T.let( + :no, + Docker::Container::HostConfig::RestartPolicy::Name::TaggedSymbol + ) + ALWAYS = + T.let( + :always, + Docker::Container::HostConfig::RestartPolicy::Name::TaggedSymbol + ) + UNLESS_STOPPED = + T.let( + :"unless-stopped", + Docker::Container::HostConfig::RestartPolicy::Name::TaggedSymbol + ) + ON_FAILURE = + T.let( + :"on-failure", + Docker::Container::HostConfig::RestartPolicy::Name::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Container::HostConfig::RestartPolicy::Name::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Ulimit < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::HostConfig::Ulimit, + Docker::Internal::AnyHash + ) + end + + # Hard limit + sig { returns(T.nilable(Integer)) } + attr_reader :hard + + sig { params(hard: Integer).void } + attr_writer :hard + + # Name of ulimit + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Soft limit + sig { returns(T.nilable(Integer)) } + attr_reader :soft + + sig { params(soft: Integer).void } + attr_writer :soft + + sig do + params(hard: Integer, name: String, soft: Integer).returns( + T.attached_class + ) + end + def self.new( + # Hard limit + hard: nil, + # Name of ulimit + name: nil, + # Soft limit + soft: nil + ) + end + + sig do + override.returns({ hard: Integer, name: String, soft: Integer }) + end + def to_hash + end + end + end + + class ImageManifestDescriptor < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::ImageManifestDescriptor, + Docker::Internal::AnyHash + ) + end + + # Arbitrary metadata relating to the targeted content. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :annotations + + # ArtifactType is the IANA media type of this artifact. + sig { returns(T.nilable(String)) } + attr_accessor :artifact_type + + # Data is an embedding of the targeted content. This is encoded as a base64 string + # when marshalled to JSON (automatically, by encoding/json). If present, Data can + # be used directly to avoid fetching the targeted content. + sig { returns(T.nilable(String)) } + attr_accessor :data + + # The digest of the targeted content. + sig { returns(T.nilable(String)) } + attr_reader :digest + + sig { params(digest: String).void } + attr_writer :digest + + # The media type of the object this schema refers to. + sig { returns(T.nilable(String)) } + attr_reader :media_type + + sig { params(media_type: String).void } + attr_writer :media_type + + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + sig do + returns( + T.nilable(Docker::Container::ImageManifestDescriptor::Platform) + ) + end + attr_reader :platform + + sig do + params( + platform: + T.nilable( + Docker::Container::ImageManifestDescriptor::Platform::OrHash + ) + ).void + end + attr_writer :platform + + # The size in bytes of the blob. + sig { returns(T.nilable(Integer)) } + attr_reader :size + + sig { params(size: Integer).void } + attr_writer :size + + # List of URLs from which this object MAY be downloaded. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :urls + + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + sig do + params( + annotations: T.nilable(T::Hash[Symbol, String]), + artifact_type: T.nilable(String), + data: T.nilable(String), + digest: String, + media_type: String, + platform: + T.nilable( + Docker::Container::ImageManifestDescriptor::Platform::OrHash + ), + size: Integer, + urls: T.nilable(T::Array[String]) + ).returns(T.attached_class) + end + def self.new( + # Arbitrary metadata relating to the targeted content. + annotations: nil, + # ArtifactType is the IANA media type of this artifact. + artifact_type: nil, + # Data is an embedding of the targeted content. This is encoded as a base64 string + # when marshalled to JSON (automatically, by encoding/json). If present, Data can + # be used directly to avoid fetching the targeted content. + data: nil, + # The digest of the targeted content. + digest: nil, + # The media type of the object this schema refers to. + media_type: nil, + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + platform: nil, + # The size in bytes of the blob. + size: nil, + # List of URLs from which this object MAY be downloaded. + urls: nil + ) + end + + sig do + override.returns( + { + annotations: T.nilable(T::Hash[Symbol, String]), + artifact_type: T.nilable(String), + data: T.nilable(String), + digest: String, + media_type: String, + platform: + T.nilable(Docker::Container::ImageManifestDescriptor::Platform), + size: Integer, + urls: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + class Platform < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::ImageManifestDescriptor::Platform, + Docker::Internal::AnyHash + ) + end + + # The CPU architecture, for example `amd64` or `ppc64`. + sig { returns(T.nilable(String)) } + attr_reader :architecture + + sig { params(architecture: String).void } + attr_writer :architecture + + # The operating system, for example `linux` or `windows`. + sig { returns(T.nilable(String)) } + attr_reader :os + + sig { params(os: String).void } + attr_writer :os + + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :os_features + + sig { params(os_features: T::Array[String]).void } + attr_writer :os_features + + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + sig { returns(T.nilable(String)) } + attr_reader :os_version + + sig { params(os_version: String).void } + attr_writer :os_version + + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + sig { returns(T.nilable(String)) } + attr_reader :variant + + sig { params(variant: String).void } + attr_writer :variant + + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + sig do + params( + architecture: String, + os: String, + os_features: T::Array[String], + os_version: String, + variant: String + ).returns(T.attached_class) + end + def self.new( + # The CPU architecture, for example `amd64` or `ppc64`. + architecture: nil, + # The operating system, for example `linux` or `windows`. + os: nil, + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + os_features: nil, + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + os_version: nil, + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + variant: nil + ) + end + + sig do + override.returns( + { + architecture: String, + os: String, + os_features: T::Array[String], + os_version: String, + variant: String + } + ) + end + def to_hash + end + end + end + + class Mount < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Container::Mount, Docker::Internal::AnyHash) + end + + # Destination is the path relative to the container root (`/`) where the `Source` + # is mounted inside the container. + sig { returns(T.nilable(String)) } + attr_reader :destination + + sig { params(destination: String).void } + attr_writer :destination + + # Driver is the volume driver used to create the volume (if it is a volume). + sig { returns(T.nilable(String)) } + attr_reader :driver + + sig { params(driver: String).void } + attr_writer :driver + + # Mode is a comma separated list of options supplied by the user when creating the + # bind/volume mount. + # + # The default is platform-specific (`"z"` on Linux, empty on Windows). + sig { returns(T.nilable(String)) } + attr_reader :mode + + sig { params(mode: String).void } + attr_writer :mode + + # Name is the name reference to the underlying data defined by `Source` e.g., the + # volume name. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Propagation describes how mounts are propagated from the host into the mount + # point, and vice-versa. Refer to the + # [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + # for details. This field is not used on Windows. + sig { returns(T.nilable(String)) } + attr_reader :propagation + + sig { params(propagation: String).void } + attr_writer :propagation + + # Whether the mount is mounted writable (read-write). + sig { returns(T.nilable(T::Boolean)) } + attr_reader :rw + + sig { params(rw: T::Boolean).void } + attr_writer :rw + + # Source location of the mount. + # + # For volumes, this contains the storage location of the volume (within + # `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains the + # source (host) part of the bind-mount. For `tmpfs` mount points, this field is + # empty. + sig { returns(T.nilable(String)) } + attr_reader :source + + sig { params(source: String).void } + attr_writer :source + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + sig { returns(T.nilable(Docker::Container::Mount::Type::TaggedSymbol)) } + attr_reader :type + + sig { params(type: Docker::Container::Mount::Type::OrSymbol).void } + attr_writer :type + + # MountPoint represents a mount point configuration inside the container. This is + # used for reporting the mountpoints in use by a container. + sig do + params( + destination: String, + driver: String, + mode: String, + name: String, + propagation: String, + rw: T::Boolean, + source: String, + type: Docker::Container::Mount::Type::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Destination is the path relative to the container root (`/`) where the `Source` + # is mounted inside the container. + destination: nil, + # Driver is the volume driver used to create the volume (if it is a volume). + driver: nil, + # Mode is a comma separated list of options supplied by the user when creating the + # bind/volume mount. + # + # The default is platform-specific (`"z"` on Linux, empty on Windows). + mode: nil, + # Name is the name reference to the underlying data defined by `Source` e.g., the + # volume name. + name: nil, + # Propagation describes how mounts are propagated from the host into the mount + # point, and vice-versa. Refer to the + # [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + # for details. This field is not used on Windows. + propagation: nil, + # Whether the mount is mounted writable (read-write). + rw: nil, + # Source location of the mount. + # + # For volumes, this contains the storage location of the volume (within + # `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains the + # source (host) part of the bind-mount. For `tmpfs` mount points, this field is + # empty. + source: nil, + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + type: nil + ) + end + + sig do + override.returns( + { + destination: String, + driver: String, + mode: String, + name: String, + propagation: String, + rw: T::Boolean, + source: String, + type: Docker::Container::Mount::Type::TaggedSymbol + } + ) + end + def to_hash + end + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + module Type + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Docker::Container::Mount::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + BIND = T.let(:bind, Docker::Container::Mount::Type::TaggedSymbol) + CLUSTER = + T.let(:cluster, Docker::Container::Mount::Type::TaggedSymbol) + IMAGE = T.let(:image, Docker::Container::Mount::Type::TaggedSymbol) + NPIPE = T.let(:npipe, Docker::Container::Mount::Type::TaggedSymbol) + TMPFS = T.let(:tmpfs, Docker::Container::Mount::Type::TaggedSymbol) + VOLUME = T.let(:volume, Docker::Container::Mount::Type::TaggedSymbol) + + sig do + override.returns( + T::Array[Docker::Container::Mount::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + + class NetworkSettings < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Container::NetworkSettings, Docker::Internal::AnyHash) + end + + # Information about all networks that the container is connected to. + sig do + returns( + T.nilable( + T::Hash[Symbol, Docker::Container::NetworkSettings::Network] + ) + ) + end + attr_reader :networks + + sig do + params( + networks: + T::Hash[ + Symbol, + Docker::Container::NetworkSettings::Network::OrHash + ] + ).void + end + attr_writer :networks + + # PortMap describes the mapping of container ports to host ports, using the + # container's port-number and protocol as key in the format `/`, + # for example, `80/udp`. + # + # If a container's port is mapped for multiple protocols, separate entries are + # added to the mapping table. + sig do + returns( + T.nilable( + T::Hash[ + Symbol, + T::Array[Docker::Container::NetworkSettings::Port] + ] + ) + ) + end + attr_reader :ports + + sig do + params( + ports: + T::Hash[ + Symbol, + T::Array[Docker::Container::NetworkSettings::Port::OrHash] + ] + ).void + end + attr_writer :ports + + # SandboxID uniquely represents a container's network stack. + sig { returns(T.nilable(String)) } + attr_reader :sandbox_id + + sig { params(sandbox_id: String).void } + attr_writer :sandbox_id + + # SandboxKey is the full path of the netns handle + sig { returns(T.nilable(String)) } + attr_reader :sandbox_key + + sig { params(sandbox_key: String).void } + attr_writer :sandbox_key + + # NetworkSettings exposes the network settings in the API + sig do + params( + networks: + T::Hash[ + Symbol, + Docker::Container::NetworkSettings::Network::OrHash + ], + ports: + T::Hash[ + Symbol, + T::Array[Docker::Container::NetworkSettings::Port::OrHash] + ], + sandbox_id: String, + sandbox_key: String + ).returns(T.attached_class) + end + def self.new( + # Information about all networks that the container is connected to. + networks: nil, + # PortMap describes the mapping of container ports to host ports, using the + # container's port-number and protocol as key in the format `/`, + # for example, `80/udp`. + # + # If a container's port is mapped for multiple protocols, separate entries are + # added to the mapping table. + ports: nil, + # SandboxID uniquely represents a container's network stack. + sandbox_id: nil, + # SandboxKey is the full path of the netns handle + sandbox_key: nil + ) + end + + sig do + override.returns( + { + networks: + T::Hash[Symbol, Docker::Container::NetworkSettings::Network], + ports: + T::Hash[ + Symbol, + T::Array[Docker::Container::NetworkSettings::Port] + ], + sandbox_id: String, + sandbox_key: String + } + ) + end + def to_hash + end + + class Network < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::NetworkSettings::Network, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :aliases + + sig { params(aliases: T::Array[String]).void } + attr_writer :aliases + + # List of all DNS names an endpoint has on a specific network. This list is based + # on the container name, network aliases, container short ID, and hostname. + # + # These DNS names are non-fully qualified but can contain several dots. You can + # get fully qualified DNS names by appending `.`. For instance, if + # container name is `my.ctr` and the network is named `testnet`, `DNSNames` will + # contain `my.ctr` and the FQDN will be `my.ctr.testnet`. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :dns_names + + sig { params(dns_names: T::Array[String]).void } + attr_writer :dns_names + + # DriverOpts is a mapping of driver options and values. These options are passed + # directly to the driver and are driver specific. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :driver_opts + + # Unique ID for the service endpoint in a Sandbox. + sig { returns(T.nilable(String)) } + attr_reader :endpoint_id + + sig { params(endpoint_id: String).void } + attr_writer :endpoint_id + + # Gateway address for this network. + sig { returns(T.nilable(String)) } + attr_reader :gateway + + sig { params(gateway: String).void } + attr_writer :gateway + + # Global IPv6 address. + sig { returns(T.nilable(String)) } + attr_reader :global_i_pv6_address + + sig { params(global_i_pv6_address: String).void } + attr_writer :global_i_pv6_address + + # Mask length of the global IPv6 address. + sig { returns(T.nilable(Integer)) } + attr_reader :global_i_pv6_prefix_len + + sig { params(global_i_pv6_prefix_len: Integer).void } + attr_writer :global_i_pv6_prefix_len + + # This property determines which endpoint will provide the default gateway for a + # container. The endpoint with the highest priority will be used. If multiple + # endpoints have the same priority, endpoints are lexicographically sorted based + # on their network name, and the one that sorts first is picked. + sig { returns(T.nilable(Integer)) } + attr_reader :gw_priority + + sig { params(gw_priority: Integer).void } + attr_writer :gw_priority + + # IPv4 address. + sig { returns(T.nilable(String)) } + attr_reader :ip_address + + sig { params(ip_address: String).void } + attr_writer :ip_address + + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + sig do + returns( + T.nilable(Docker::Container::NetworkSettings::Network::IpamConfig) + ) + end + attr_reader :ipam_config + + sig do + params( + ipam_config: + T.nilable( + Docker::Container::NetworkSettings::Network::IpamConfig::OrHash + ) + ).void + end + attr_writer :ipam_config + + # Mask length of the IPv4 address. + sig { returns(T.nilable(Integer)) } + attr_reader :ip_prefix_len + + sig { params(ip_prefix_len: Integer).void } + attr_writer :ip_prefix_len + + # IPv6 gateway address. + sig { returns(T.nilable(String)) } + attr_reader :i_pv6_gateway + + sig { params(i_pv6_gateway: String).void } + attr_writer :i_pv6_gateway + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :links + + sig { params(links: T::Array[String]).void } + attr_writer :links + + # MAC address for the endpoint on this network. The network driver might ignore + # this parameter. + sig { returns(T.nilable(String)) } + attr_reader :mac_address + + sig { params(mac_address: String).void } + attr_writer :mac_address + + # Unique ID of the network. + sig { returns(T.nilable(String)) } + attr_reader :network_id + + sig { params(network_id: String).void } + attr_writer :network_id + + # Configuration for a network endpoint. + sig do + params( + aliases: T::Array[String], + dns_names: T::Array[String], + driver_opts: T.nilable(T::Hash[Symbol, String]), + endpoint_id: String, + gateway: String, + global_i_pv6_address: String, + global_i_pv6_prefix_len: Integer, + gw_priority: Integer, + ip_address: String, + ipam_config: + T.nilable( + Docker::Container::NetworkSettings::Network::IpamConfig::OrHash + ), + ip_prefix_len: Integer, + i_pv6_gateway: String, + links: T::Array[String], + mac_address: String, + network_id: String + ).returns(T.attached_class) + end + def self.new( + aliases: nil, + # List of all DNS names an endpoint has on a specific network. This list is based + # on the container name, network aliases, container short ID, and hostname. + # + # These DNS names are non-fully qualified but can contain several dots. You can + # get fully qualified DNS names by appending `.`. For instance, if + # container name is `my.ctr` and the network is named `testnet`, `DNSNames` will + # contain `my.ctr` and the FQDN will be `my.ctr.testnet`. + dns_names: nil, + # DriverOpts is a mapping of driver options and values. These options are passed + # directly to the driver and are driver specific. + driver_opts: nil, + # Unique ID for the service endpoint in a Sandbox. + endpoint_id: nil, + # Gateway address for this network. + gateway: nil, + # Global IPv6 address. + global_i_pv6_address: nil, + # Mask length of the global IPv6 address. + global_i_pv6_prefix_len: nil, + # This property determines which endpoint will provide the default gateway for a + # container. The endpoint with the highest priority will be used. If multiple + # endpoints have the same priority, endpoints are lexicographically sorted based + # on their network name, and the one that sorts first is picked. + gw_priority: nil, + # IPv4 address. + ip_address: nil, + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + ipam_config: nil, + # Mask length of the IPv4 address. + ip_prefix_len: nil, + # IPv6 gateway address. + i_pv6_gateway: nil, + links: nil, + # MAC address for the endpoint on this network. The network driver might ignore + # this parameter. + mac_address: nil, + # Unique ID of the network. + network_id: nil + ) + end + + sig do + override.returns( + { + aliases: T::Array[String], + dns_names: T::Array[String], + driver_opts: T.nilable(T::Hash[Symbol, String]), + endpoint_id: String, + gateway: String, + global_i_pv6_address: String, + global_i_pv6_prefix_len: Integer, + gw_priority: Integer, + ip_address: String, + ipam_config: + T.nilable( + Docker::Container::NetworkSettings::Network::IpamConfig + ), + ip_prefix_len: Integer, + i_pv6_gateway: String, + links: T::Array[String], + mac_address: String, + network_id: String + } + ) + end + def to_hash + end + + class IpamConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::NetworkSettings::Network::IpamConfig, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :i_pv4_address + + sig { params(i_pv4_address: String).void } + attr_writer :i_pv4_address + + sig { returns(T.nilable(String)) } + attr_reader :i_pv6_address + + sig { params(i_pv6_address: String).void } + attr_writer :i_pv6_address + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :link_local_ips + + sig { params(link_local_ips: T::Array[String]).void } + attr_writer :link_local_ips + + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + sig do + params( + i_pv4_address: String, + i_pv6_address: String, + link_local_ips: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + i_pv4_address: nil, + i_pv6_address: nil, + link_local_ips: nil + ) + end + + sig do + override.returns( + { + i_pv4_address: String, + i_pv6_address: String, + link_local_ips: T::Array[String] + } + ) + end + def to_hash + end + end + end + + class Port < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::NetworkSettings::Port, + Docker::Internal::AnyHash + ) + end + + # Host IP address that the container's port is mapped to. + sig { returns(T.nilable(String)) } + attr_reader :host_ip + + sig { params(host_ip: String).void } + attr_writer :host_ip + + # Host port number that the container's port is mapped to. + sig { returns(T.nilable(String)) } + attr_reader :host_port + + sig { params(host_port: String).void } + attr_writer :host_port + + # PortBinding represents a binding between a host IP address and a host port. + sig do + params(host_ip: String, host_port: String).returns(T.attached_class) + end + def self.new( + # Host IP address that the container's port is mapped to. + host_ip: nil, + # Host port number that the container's port is mapped to. + host_port: nil + ) + end + + sig { override.returns({ host_ip: String, host_port: String }) } + def to_hash + end + end + end + + class State < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Container::State, Docker::Internal::AnyHash) + end + + sig { returns(T.nilable(T::Boolean)) } + attr_reader :dead + + sig { params(dead: T::Boolean).void } + attr_writer :dead + + sig { returns(T.nilable(String)) } + attr_reader :error + + sig { params(error: String).void } + attr_writer :error + + # The last exit code of this container + sig { returns(T.nilable(Integer)) } + attr_reader :exit_code + + sig { params(exit_code: Integer).void } + attr_writer :exit_code + + # The time when this container last exited. + sig { returns(T.nilable(String)) } + attr_reader :finished_at + + sig { params(finished_at: String).void } + attr_writer :finished_at + + # Health stores information about the container's healthcheck results. + sig { returns(T.nilable(Docker::Container::State::Health)) } + attr_reader :health + + sig do + params( + health: T.nilable(Docker::Container::State::Health::OrHash) + ).void + end + attr_writer :health + + # Whether a process within this container has been killed because it ran out of + # memory since the container was last started. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :oom_killed + + sig { params(oom_killed: T::Boolean).void } + attr_writer :oom_killed + + # Whether this container is paused. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :paused + + sig { params(paused: T::Boolean).void } + attr_writer :paused + + # The process ID of this container + sig { returns(T.nilable(Integer)) } + attr_reader :pid + + sig { params(pid: Integer).void } + attr_writer :pid + + # Whether this container is restarting. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :restarting + + sig { params(restarting: T::Boolean).void } + attr_writer :restarting + + # Whether this container is running. + # + # Note that a running container can be _paused_. The `Running` and `Paused` + # booleans are not mutually exclusive: + # + # When pausing a container (on Linux), the freezer cgroup is used to suspend all + # processes in the container. Freezing the process requires the process to be + # running. As a result, paused containers are both `Running` _and_ `Paused`. + # + # Use the `Status` field instead to determine if a container's state is "running". + sig { returns(T.nilable(T::Boolean)) } + attr_reader :running + + sig { params(running: T::Boolean).void } + attr_writer :running + + # The time when this container was last started. + sig { returns(T.nilable(String)) } + attr_reader :started_at + + sig { params(started_at: String).void } + attr_writer :started_at + + # String representation of the container state. Can be one of "created", + # "running", "paused", "restarting", "removing", "exited", or "dead". + sig do + returns(T.nilable(Docker::Container::State::Status::TaggedSymbol)) + end + attr_reader :status + + sig { params(status: Docker::Container::State::Status::OrSymbol).void } + attr_writer :status + + # ContainerState stores container's running state. It's part of ContainerJSONBase + # and will be returned by the "inspect" command. + sig do + params( + dead: T::Boolean, + error: String, + exit_code: Integer, + finished_at: String, + health: T.nilable(Docker::Container::State::Health::OrHash), + oom_killed: T::Boolean, + paused: T::Boolean, + pid: Integer, + restarting: T::Boolean, + running: T::Boolean, + started_at: String, + status: Docker::Container::State::Status::OrSymbol + ).returns(T.attached_class) + end + def self.new( + dead: nil, + error: nil, + # The last exit code of this container + exit_code: nil, + # The time when this container last exited. + finished_at: nil, + # Health stores information about the container's healthcheck results. + health: nil, + # Whether a process within this container has been killed because it ran out of + # memory since the container was last started. + oom_killed: nil, + # Whether this container is paused. + paused: nil, + # The process ID of this container + pid: nil, + # Whether this container is restarting. + restarting: nil, + # Whether this container is running. + # + # Note that a running container can be _paused_. The `Running` and `Paused` + # booleans are not mutually exclusive: + # + # When pausing a container (on Linux), the freezer cgroup is used to suspend all + # processes in the container. Freezing the process requires the process to be + # running. As a result, paused containers are both `Running` _and_ `Paused`. + # + # Use the `Status` field instead to determine if a container's state is "running". + running: nil, + # The time when this container was last started. + started_at: nil, + # String representation of the container state. Can be one of "created", + # "running", "paused", "restarting", "removing", "exited", or "dead". + status: nil + ) + end + + sig do + override.returns( + { + dead: T::Boolean, + error: String, + exit_code: Integer, + finished_at: String, + health: T.nilable(Docker::Container::State::Health), + oom_killed: T::Boolean, + paused: T::Boolean, + pid: Integer, + restarting: T::Boolean, + running: T::Boolean, + started_at: String, + status: Docker::Container::State::Status::TaggedSymbol + } + ) + end + def to_hash + end + + class Health < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Container::State::Health, Docker::Internal::AnyHash) + end + + # FailingStreak is the number of consecutive failures + sig { returns(T.nilable(Integer)) } + attr_reader :failing_streak + + sig { params(failing_streak: Integer).void } + attr_writer :failing_streak + + # Log contains the last few results (oldest first) + sig do + returns( + T.nilable( + T::Array[T.nilable(Docker::Container::State::Health::Log)] + ) + ) + end + attr_reader :log + + sig do + params( + log: + T::Array[ + T.nilable(Docker::Container::State::Health::Log::OrHash) + ] + ).void + end + attr_writer :log + + # Status is one of `none`, `starting`, `healthy` or `unhealthy` + # + # - "none" Indicates there is no healthcheck + # - "starting" Starting indicates that the container is not yet ready + # - "healthy" Healthy indicates that the container is running correctly + # - "unhealthy" Unhealthy indicates that the container has a problem + sig do + returns( + T.nilable(Docker::Container::State::Health::Status::TaggedSymbol) + ) + end + attr_reader :status + + sig do + params( + status: Docker::Container::State::Health::Status::OrSymbol + ).void + end + attr_writer :status + + # Health stores information about the container's healthcheck results. + sig do + params( + failing_streak: Integer, + log: + T::Array[ + T.nilable(Docker::Container::State::Health::Log::OrHash) + ], + status: Docker::Container::State::Health::Status::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # FailingStreak is the number of consecutive failures + failing_streak: nil, + # Log contains the last few results (oldest first) + log: nil, + # Status is one of `none`, `starting`, `healthy` or `unhealthy` + # + # - "none" Indicates there is no healthcheck + # - "starting" Starting indicates that the container is not yet ready + # - "healthy" Healthy indicates that the container is running correctly + # - "unhealthy" Unhealthy indicates that the container has a problem + status: nil + ) + end + + sig do + override.returns( + { + failing_streak: Integer, + log: T::Array[T.nilable(Docker::Container::State::Health::Log)], + status: Docker::Container::State::Health::Status::TaggedSymbol + } + ) + end + def to_hash + end + + class Log < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::State::Health::Log, + Docker::Internal::AnyHash + ) + end + + # Date and time at which this check ended in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + sig { returns(T.nilable(String)) } + attr_reader :end_ + + sig { params(end_: String).void } + attr_writer :end_ + + # ExitCode meanings: + # + # - `0` healthy + # - `1` unhealthy + # - `2` reserved (considered unhealthy) + # - other values: error running probe + sig { returns(T.nilable(Integer)) } + attr_reader :exit_code + + sig { params(exit_code: Integer).void } + attr_writer :exit_code + + # Output from last check + sig { returns(T.nilable(String)) } + attr_reader :output + + sig { params(output: String).void } + attr_writer :output + + # Date and time at which this check started in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + sig { returns(T.nilable(Time)) } + attr_reader :start + + sig { params(start: Time).void } + attr_writer :start + + # HealthcheckResult stores information about a single run of a healthcheck probe + sig do + params( + end_: String, + exit_code: Integer, + output: String, + start: Time + ).returns(T.attached_class) + end + def self.new( + # Date and time at which this check ended in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + end_: nil, + # ExitCode meanings: + # + # - `0` healthy + # - `1` unhealthy + # - `2` reserved (considered unhealthy) + # - other values: error running probe + exit_code: nil, + # Output from last check + output: nil, + # Date and time at which this check started in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + start: nil + ) + end + + sig do + override.returns( + { + end_: String, + exit_code: Integer, + output: String, + start: Time + } + ) + end + def to_hash + end + end + + # Status is one of `none`, `starting`, `healthy` or `unhealthy` + # + # - "none" Indicates there is no healthcheck + # - "starting" Starting indicates that the container is not yet ready + # - "healthy" Healthy indicates that the container is running correctly + # - "unhealthy" Unhealthy indicates that the container has a problem + module Status + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Container::State::Health::Status) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + NONE = + T.let( + :none, + Docker::Container::State::Health::Status::TaggedSymbol + ) + STARTING = + T.let( + :starting, + Docker::Container::State::Health::Status::TaggedSymbol + ) + HEALTHY = + T.let( + :healthy, + Docker::Container::State::Health::Status::TaggedSymbol + ) + UNHEALTHY = + T.let( + :unhealthy, + Docker::Container::State::Health::Status::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Docker::Container::State::Health::Status::TaggedSymbol] + ) + end + def self.values + end + end + end + + # String representation of the container state. Can be one of "created", + # "running", "paused", "restarting", "removing", "exited", or "dead". + module Status + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Docker::Container::State::Status) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CREATED = + T.let(:created, Docker::Container::State::Status::TaggedSymbol) + RUNNING = + T.let(:running, Docker::Container::State::Status::TaggedSymbol) + PAUSED = + T.let(:paused, Docker::Container::State::Status::TaggedSymbol) + RESTARTING = + T.let(:restarting, Docker::Container::State::Status::TaggedSymbol) + REMOVING = + T.let(:removing, Docker::Container::State::Status::TaggedSymbol) + EXITED = + T.let(:exited, Docker::Container::State::Status::TaggedSymbol) + DEAD = T.let(:dead, Docker::Container::State::Status::TaggedSymbol) + + sig do + override.returns( + T::Array[Docker::Container::State::Status::TaggedSymbol] + ) + end + def self.values + end + end + end + + class Storage < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Container::Storage, Docker::Internal::AnyHash) + end + + # Information about the storage used for the container's root filesystem. + sig { returns(T.nilable(Docker::Container::Storage::RootFs)) } + attr_reader :root_fs + + sig { params(root_fs: Docker::Container::Storage::RootFs::OrHash).void } + attr_writer :root_fs + + # Information about the storage used by the container. + sig do + params(root_fs: Docker::Container::Storage::RootFs::OrHash).returns( + T.attached_class + ) + end + def self.new( + # Information about the storage used for the container's root filesystem. + root_fs: nil + ) + end + + sig do + override.returns({ root_fs: Docker::Container::Storage::RootFs }) + end + def to_hash + end + + class RootFs < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::Storage::RootFs, + Docker::Internal::AnyHash + ) + end + + # Information about a snapshot backend of the container's root filesystem. + sig do + returns(T.nilable(Docker::Container::Storage::RootFs::Snapshot)) + end + attr_reader :snapshot + + sig do + params( + snapshot: Docker::Container::Storage::RootFs::Snapshot::OrHash + ).void + end + attr_writer :snapshot + + # Information about the storage used for the container's root filesystem. + sig do + params( + snapshot: Docker::Container::Storage::RootFs::Snapshot::OrHash + ).returns(T.attached_class) + end + def self.new( + # Information about a snapshot backend of the container's root filesystem. + snapshot: nil + ) + end + + sig do + override.returns( + { snapshot: Docker::Container::Storage::RootFs::Snapshot } + ) + end + def to_hash + end + + class Snapshot < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Container::Storage::RootFs::Snapshot, + Docker::Internal::AnyHash + ) + end + + # Name of the snapshotter. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Information about a snapshot backend of the container's root filesystem. + sig { params(name: String).returns(T.attached_class) } + def self.new( + # Name of the snapshotter. + name: nil + ) + end + + sig { override.returns({ name: String }) } + def to_hash + end + end + end + end + end + end +end diff --git a/rbi/docker/models/container_create_params.rbi b/rbi/docker/models/container_create_params.rbi new file mode 100644 index 0000000..c5e8223 --- /dev/null +++ b/rbi/docker/models/container_create_params.rbi @@ -0,0 +1,3287 @@ +# typed: strong + +module Docker + module Models + class ContainerCreateParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ContainerCreateParams, Docker::Internal::AnyHash) + end + + # Configuration for a container that is portable between hosts. + sig { returns(Docker::ContainerCreateParams::Config) } + attr_reader :config + + sig { params(config: Docker::ContainerCreateParams::Config::OrHash).void } + attr_writer :config + + # Assign the specified name to the container. Must match + # `/?[a-zA-Z0-9][a-zA-Z0-9_.-]+`. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Platform in the format `os[/arch[/variant]]` used for image lookup. + # + # When specified, the daemon checks if the requested image is present in the local + # image cache with the given OS and Architecture, and otherwise returns a `404` + # status. + # + # If the option is not set, the host's native OS and Architecture are used to look + # up the image in the image cache. However, if no platform is passed and the given + # image does exist in the local image cache, but its OS or architecture does not + # match, the container is created with the available image, and a warning is added + # to the `Warnings` field in the response, for example; + # + # WARNING: The requested image's platform (linux/arm64/v8) does not + # match the detected host platform (linux/amd64) and no + # specific platform was requested + sig { returns(T.nilable(String)) } + attr_reader :platform + + sig { params(platform: String).void } + attr_writer :platform + + sig do + params( + config: Docker::ContainerCreateParams::Config::OrHash, + name: String, + platform: String, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Configuration for a container that is portable between hosts. + config:, + # Assign the specified name to the container. Must match + # `/?[a-zA-Z0-9][a-zA-Z0-9_.-]+`. + name: nil, + # Platform in the format `os[/arch[/variant]]` used for image lookup. + # + # When specified, the daemon checks if the requested image is present in the local + # image cache with the given OS and Architecture, and otherwise returns a `404` + # status. + # + # If the option is not set, the host's native OS and Architecture are used to look + # up the image in the image cache. However, if no platform is passed and the given + # image does exist in the local image cache, but its OS or architecture does not + # match, the container is created with the available image, and a warning is added + # to the `Warnings` field in the response, for example; + # + # WARNING: The requested image's platform (linux/arm64/v8) does not + # match the detected host platform (linux/amd64) and no + # specific platform was requested + platform: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + config: Docker::ContainerCreateParams::Config, + name: String, + platform: String, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + + class Config < Docker::Models::Config + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config, + Docker::Internal::AnyHash + ) + end + + # Container configuration that depends on the host we are running on + sig do + returns(T.nilable(Docker::ContainerCreateParams::Config::HostConfig)) + end + attr_reader :host_config + + sig do + params( + host_config: + Docker::ContainerCreateParams::Config::HostConfig::OrHash + ).void + end + attr_writer :host_config + + # NetworkingConfig represents the container's networking configuration for each of + # its interfaces. It is used for the networking configs specified in the + # `docker create` and `docker network connect` commands. + sig do + returns( + T.nilable(Docker::ContainerCreateParams::Config::NetworkingConfig) + ) + end + attr_reader :networking_config + + sig do + params( + networking_config: + Docker::ContainerCreateParams::Config::NetworkingConfig::OrHash + ).void + end + attr_writer :networking_config + + # Configuration for a container that is portable between hosts. + sig do + params( + host_config: + Docker::ContainerCreateParams::Config::HostConfig::OrHash, + networking_config: + Docker::ContainerCreateParams::Config::NetworkingConfig::OrHash + ).returns(T.attached_class) + end + def self.new( + # Container configuration that depends on the host we are running on + host_config: nil, + # NetworkingConfig represents the container's networking configuration for each of + # its interfaces. It is used for the networking configs specified in the + # `docker create` and `docker network connect` commands. + networking_config: nil + ) + end + + sig do + override.returns( + { + host_config: Docker::ContainerCreateParams::Config::HostConfig, + networking_config: + Docker::ContainerCreateParams::Config::NetworkingConfig + } + ) + end + def to_hash + end + + class HostConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig, + Docker::Internal::AnyHash + ) + end + + # Arbitrary non-identifying metadata attached to container and provided to the + # runtime when the container is started. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :annotations + + sig { params(annotations: T::Hash[Symbol, String]).void } + attr_writer :annotations + + # Automatically remove the container when the container's process exits. This has + # no effect if `RestartPolicy` is set. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :auto_remove + + sig { params(auto_remove: T::Boolean).void } + attr_writer :auto_remove + + # A list of volume bindings for this container. Each volume binding is a string in + # one of these forms: + # + # - `host-src:container-dest[:options]` to bind-mount a host path into the + # container. Both `host-src`, and `container-dest` must be an _absolute_ path. + # - `volume-name:container-dest[:options]` to bind-mount a volume managed by a + # volume driver into the container. `container-dest` must be an _absolute_ path. + # + # `options` is an optional, comma-delimited list of: + # + # - `nocopy` disables automatic copying of data from the container path to the + # volume. The `nocopy` flag only applies to named volumes. + # - `[ro|rw]` mounts a volume read-only or read-write, respectively. If omitted or + # set to `rw`, volumes are mounted read-write. + # - `[z|Z]` applies SELinux labels to allow or deny multiple containers to read + # and write to the same volume. + # - `z`: a _shared_ content label is applied to the content. This label + # indicates that multiple containers can share the volume content, for both + # reading and writing. + # - `Z`: a _private unshared_ label is applied to the content. This label + # indicates that only the current container can use a private volume. Labeling + # systems such as SELinux require proper labels to be placed on volume content + # that is mounted into a container. Without a label, the security system can + # prevent a container's processes from using the content. By default, the + # labels set by the host operating system are not modified. + # - `[[r]shared|[r]slave|[r]private]` specifies mount + # [propagation behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt). + # This only applies to bind-mounted volumes, not internal volumes or named + # volumes. Mount propagation requires the source mount point (the location where + # the source directory is mounted in the host operating system) to have the + # correct propagation properties. For shared volumes, the source mount point + # must be set to `shared`. For slave volumes, the mount must be set to either + # `shared` or `slave`. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :binds + + sig { params(binds: T::Array[String]).void } + attr_writer :binds + + # Limit read rate (bytes per second) from a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + sig do + returns( + T.nilable( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadBp + ] + ) + ) + end + attr_reader :blkio_device_read_bps + + sig do + params( + blkio_device_read_bps: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadBp::OrHash + ] + ).void + end + attr_writer :blkio_device_read_bps + + # Limit read rate (IO per second) from a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + sig do + returns( + T.nilable( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadIOp + ] + ) + ) + end + attr_reader :blkio_device_read_i_ops + + sig do + params( + blkio_device_read_i_ops: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadIOp::OrHash + ] + ).void + end + attr_writer :blkio_device_read_i_ops + + # Limit write rate (bytes per second) to a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + sig do + returns( + T.nilable( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteBp + ] + ) + ) + end + attr_reader :blkio_device_write_bps + + sig do + params( + blkio_device_write_bps: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteBp::OrHash + ] + ).void + end + attr_writer :blkio_device_write_bps + + # Limit write rate (IO per second) to a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + sig do + returns( + T.nilable( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteIOp + ] + ) + ) + end + attr_reader :blkio_device_write_i_ops + + sig do + params( + blkio_device_write_i_ops: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteIOp::OrHash + ] + ).void + end + attr_writer :blkio_device_write_i_ops + + # Block IO weight (relative weight). + sig { returns(T.nilable(Integer)) } + attr_reader :blkio_weight + + sig { params(blkio_weight: Integer).void } + attr_writer :blkio_weight + + # Block IO weight (relative device weight) in the form: + # + # ``` + # [{"Path": "device_path", "Weight": weight}] + # ``` + sig do + returns( + T.nilable( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioWeightDevice + ] + ) + ) + end + attr_reader :blkio_weight_device + + sig do + params( + blkio_weight_device: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioWeightDevice::OrHash + ] + ).void + end + attr_writer :blkio_weight_device + + # A list of kernel capabilities to add to the container. Conflicts with option + # 'Capabilities'. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :cap_add + + sig { params(cap_add: T::Array[String]).void } + attr_writer :cap_add + + # A list of kernel capabilities to drop from the container. Conflicts with option + # 'Capabilities'. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :cap_drop + + sig { params(cap_drop: T::Array[String]).void } + attr_writer :cap_drop + + # Cgroup to use for the container. + sig { returns(T.nilable(String)) } + attr_reader :cgroup + + sig { params(cgroup: String).void } + attr_writer :cgroup + + # cgroup namespace mode for the container. Possible values are: + # + # - `"private"`: the container runs in its own private cgroup namespace + # - `"host"`: use the host system's cgroup namespace + # + # If not specified, the daemon default is used, which can either be `"private"` or + # `"host"`, depending on daemon version, kernel support and configuration. + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::CgroupnsMode::OrSymbol + ) + ) + end + attr_reader :cgroupns_mode + + sig do + params( + cgroupns_mode: + Docker::ContainerCreateParams::Config::HostConfig::CgroupnsMode::OrSymbol + ).void + end + attr_writer :cgroupns_mode + + # Path to `cgroups` under which the container's `cgroup` is created. If the path + # is not absolute, the path is considered to be relative to the `cgroups` path of + # the init process. Cgroups are created if they do not already exist. + sig { returns(T.nilable(String)) } + attr_reader :cgroup_parent + + sig { params(cgroup_parent: String).void } + attr_writer :cgroup_parent + + # Initial console size, as an `[height, width]` array. + sig { returns(T.nilable(T::Array[Integer])) } + attr_accessor :console_size + + # Path to a file where the container ID is written + sig { returns(T.nilable(String)) } + attr_reader :container_id_file + + sig { params(container_id_file: String).void } + attr_writer :container_id_file + + # The number of usable CPUs (Windows only). + # + # On Windows Server containers, the processor resource controls are mutually + # exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and + # `CPUPercent` last. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_count + + sig { params(cpu_count: Integer).void } + attr_writer :cpu_count + + # The usable percentage of the available CPUs (Windows only). + # + # On Windows Server containers, the processor resource controls are mutually + # exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and + # `CPUPercent` last. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_percent + + sig { params(cpu_percent: Integer).void } + attr_writer :cpu_percent + + # The length of a CPU period in microseconds. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_period + + sig { params(cpu_period: Integer).void } + attr_writer :cpu_period + + # Microseconds of CPU time that the container can get in a CPU period. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_quota + + sig { params(cpu_quota: Integer).void } + attr_writer :cpu_quota + + # The length of a CPU real-time period in microseconds. Set to 0 to allocate no + # time allocated to real-time tasks. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_realtime_period + + sig { params(cpu_realtime_period: Integer).void } + attr_writer :cpu_realtime_period + + # The length of a CPU real-time runtime in microseconds. Set to 0 to allocate no + # time allocated to real-time tasks. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_realtime_runtime + + sig { params(cpu_realtime_runtime: Integer).void } + attr_writer :cpu_realtime_runtime + + # CPUs in which to allow execution (e.g., `0-3`, `0,1`). + sig { returns(T.nilable(String)) } + attr_reader :cpuset_cpus + + sig { params(cpuset_cpus: String).void } + attr_writer :cpuset_cpus + + # Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on + # NUMA systems. + sig { returns(T.nilable(String)) } + attr_reader :cpuset_mems + + sig { params(cpuset_mems: String).void } + attr_writer :cpuset_mems + + # An integer value representing this container's relative CPU weight versus other + # containers. + sig { returns(T.nilable(Integer)) } + attr_reader :cpu_shares + + sig { params(cpu_shares: Integer).void } + attr_writer :cpu_shares + + # a list of cgroup rules to apply to the container + sig { returns(T.nilable(T::Array[String])) } + attr_reader :device_cgroup_rules + + sig { params(device_cgroup_rules: T::Array[String]).void } + attr_writer :device_cgroup_rules + + # A list of requests for devices to be sent to device drivers. + sig do + returns( + T.nilable( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::DeviceRequest + ] + ) + ) + end + attr_reader :device_requests + + sig do + params( + device_requests: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::DeviceRequest::OrHash + ] + ).void + end + attr_writer :device_requests + + # A list of devices to add to the container. + sig do + returns( + T.nilable( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Device + ] + ) + ) + end + attr_reader :devices + + sig do + params( + devices: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Device::OrHash + ] + ).void + end + attr_writer :devices + + # A list of DNS servers for the container to use. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :dns + + sig { params(dns: T::Array[String]).void } + attr_writer :dns + + # A list of DNS options. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :dns_options + + sig { params(dns_options: T::Array[String]).void } + attr_writer :dns_options + + # A list of DNS search domains. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :dns_search + + sig { params(dns_search: T::Array[String]).void } + attr_writer :dns_search + + # A list of hostnames/IP mappings to add to the container's `/etc/hosts` file. + # Specified in the form `["hostname:IP"]`. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :extra_hosts + + sig { params(extra_hosts: T::Array[String]).void } + attr_writer :extra_hosts + + # A list of additional groups that the container process will run as. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :group_add + + sig { params(group_add: T::Array[String]).void } + attr_writer :group_add + + # Run an init inside the container that forwards signals and reaps processes. This + # field is omitted if empty, and the default (as configured on the daemon) is + # used. + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :init + + # Maximum IO in bytes per second for the container system drive (Windows only). + sig { returns(T.nilable(Integer)) } + attr_reader :io_maximum_bandwidth + + sig { params(io_maximum_bandwidth: Integer).void } + attr_writer :io_maximum_bandwidth + + # Maximum IOps for the container system drive (Windows only) + sig { returns(T.nilable(Integer)) } + attr_reader :io_maximum_i_ops + + sig { params(io_maximum_i_ops: Integer).void } + attr_writer :io_maximum_i_ops + + # IPC sharing mode for the container. Possible values are: + # + # - `"none"`: own private IPC namespace, with /dev/shm not mounted + # - `"private"`: own private IPC namespace + # - `"shareable"`: own private IPC namespace, with a possibility to share it with + # other containers + # - `"container:"`: join another (shareable) container's IPC namespace + # - `"host"`: use the host system's IPC namespace + # + # If not specified, daemon default is used, which can either be `"private"` or + # `"shareable"`, depending on daemon version and configuration. + sig { returns(T.nilable(String)) } + attr_reader :ipc_mode + + sig { params(ipc_mode: String).void } + attr_writer :ipc_mode + + # Isolation technology of the container. (Windows only) + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::Isolation::OrSymbol + ) + ) + end + attr_reader :isolation + + sig do + params( + isolation: + Docker::ContainerCreateParams::Config::HostConfig::Isolation::OrSymbol + ).void + end + attr_writer :isolation + + # A list of links for the container in the form `container_name:alias`. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :links + + sig { params(links: T::Array[String]).void } + attr_writer :links + + # The logging configuration for this container + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::LogConfig + ) + ) + end + attr_reader :log_config + + sig do + params( + log_config: + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::OrHash + ).void + end + attr_writer :log_config + + # The list of paths to be masked inside the container (this overrides the default + # set of paths). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :masked_paths + + sig { params(masked_paths: T::Array[String]).void } + attr_writer :masked_paths + + # Memory limit in bytes. + sig { returns(T.nilable(Integer)) } + attr_reader :memory + + sig { params(memory: Integer).void } + attr_writer :memory + + # Memory soft limit in bytes. + sig { returns(T.nilable(Integer)) } + attr_reader :memory_reservation + + sig { params(memory_reservation: Integer).void } + attr_writer :memory_reservation + + # Total memory limit (memory + swap). Set as `-1` to enable unlimited swap. + sig { returns(T.nilable(Integer)) } + attr_reader :memory_swap + + sig { params(memory_swap: Integer).void } + attr_writer :memory_swap + + # Tune a container's memory swappiness behavior. Accepts an integer between 0 + # and 100. + sig { returns(T.nilable(Integer)) } + attr_reader :memory_swappiness + + sig { params(memory_swappiness: Integer).void } + attr_writer :memory_swappiness + + # Specification for mounts to be added to the container. + sig do + returns( + T.nilable( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Mount + ] + ) + ) + end + attr_reader :mounts + + sig do + params( + mounts: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Mount::OrHash + ] + ).void + end + attr_writer :mounts + + # CPU quota in units of 10-9 CPUs. + sig { returns(T.nilable(Integer)) } + attr_reader :nano_cpus + + sig { params(nano_cpus: Integer).void } + attr_writer :nano_cpus + + # Network mode to use for this container. Supported standard values are: `bridge`, + # `host`, `none`, and `container:`. Any other value is taken as a custom + # network's name to which this container should connect to. + sig { returns(T.nilable(String)) } + attr_reader :network_mode + + sig { params(network_mode: String).void } + attr_writer :network_mode + + # Disable OOM Killer for the container. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :oom_kill_disable + + sig { params(oom_kill_disable: T::Boolean).void } + attr_writer :oom_kill_disable + + # An integer value containing the score given to the container in order to tune + # OOM killer preferences. + sig { returns(T.nilable(Integer)) } + attr_reader :oom_score_adj + + sig { params(oom_score_adj: Integer).void } + attr_writer :oom_score_adj + + # Set the PID (Process) Namespace mode for the container. It can be either: + # + # - `"container:"`: joins another container's PID namespace + # - `"host"`: use the host's PID namespace inside the container + sig { returns(T.nilable(String)) } + attr_reader :pid_mode + + sig { params(pid_mode: String).void } + attr_writer :pid_mode + + # Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` to not + # change. + sig { returns(T.nilable(Integer)) } + attr_accessor :pids_limit + + # PortMap describes the mapping of container ports to host ports, using the + # container's port-number and protocol as key in the format `/`, + # for example, `80/udp`. + # + # If a container's port is mapped for multiple protocols, separate entries are + # added to the mapping table. + sig do + returns( + T.nilable( + T::Hash[ + Symbol, + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::PortBinding + ] + ] + ) + ) + end + attr_reader :port_bindings + + sig do + params( + port_bindings: + T::Hash[ + Symbol, + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::PortBinding::OrHash + ] + ] + ).void + end + attr_writer :port_bindings + + # Gives the container full access to the host. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :privileged + + sig { params(privileged: T::Boolean).void } + attr_writer :privileged + + # Allocates an ephemeral host port for all of a container's exposed ports. + # + # Ports are de-allocated when the container stops and allocated when the container + # starts. The allocated port might be changed when restarting the container. + # + # The port is selected from the ephemeral port range that depends on the kernel. + # For example, on Linux the range is defined by + # `/proc/sys/net/ipv4/ip_local_port_range`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :publish_all_ports + + sig { params(publish_all_ports: T::Boolean).void } + attr_writer :publish_all_ports + + # The list of paths to be set as read-only inside the container (this overrides + # the default set of paths). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :readonly_paths + + sig { params(readonly_paths: T::Array[String]).void } + attr_writer :readonly_paths + + # Mount the container's root filesystem as read only. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :readonly_rootfs + + sig { params(readonly_rootfs: T::Boolean).void } + attr_writer :readonly_rootfs + + # The behavior to apply when the container exits. The default is not to restart. + # + # An ever increasing delay (double the previous delay, starting at 100ms) is added + # before each restart to prevent flooding the server. + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy + ) + ) + end + attr_reader :restart_policy + + sig do + params( + restart_policy: + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::OrHash + ).void + end + attr_writer :restart_policy + + # Runtime to use with this container. + sig { returns(T.nilable(String)) } + attr_accessor :runtime + + # A list of string values to customize labels for MLS systems, such as SELinux. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :security_opt + + sig { params(security_opt: T::Array[String]).void } + attr_writer :security_opt + + # Size of `/dev/shm` in bytes. If omitted, the system uses 64MB. + sig { returns(T.nilable(Integer)) } + attr_reader :shm_size + + sig { params(shm_size: Integer).void } + attr_writer :shm_size + + # Storage driver options for this container, in the form `{"size": "120G"}`. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :storage_opt + + sig { params(storage_opt: T::Hash[Symbol, String]).void } + attr_writer :storage_opt + + # A list of kernel parameters (sysctls) to set in the container. + # + # This field is omitted if not set. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :sysctls + + # A map of container directories which should be replaced by tmpfs mounts, and + # their corresponding mount options. For example: + # + # ``` + # { "/run": "rw,noexec,nosuid,size=65536k" } + # ``` + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :tmpfs + + sig { params(tmpfs: T::Hash[Symbol, String]).void } + attr_writer :tmpfs + + # A list of resource limits to set in the container. For example: + # + # ``` + # {"Name": "nofile", "Soft": 1024, "Hard": 2048} + # ``` + sig do + returns( + T.nilable( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Ulimit + ] + ) + ) + end + attr_reader :ulimits + + sig do + params( + ulimits: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Ulimit::OrHash + ] + ).void + end + attr_writer :ulimits + + # Sets the usernamespace mode for the container when usernamespace remapping + # option is enabled. + sig { returns(T.nilable(String)) } + attr_reader :userns_mode + + sig { params(userns_mode: String).void } + attr_writer :userns_mode + + # UTS namespace to use for the container. + sig { returns(T.nilable(String)) } + attr_reader :uts_mode + + sig { params(uts_mode: String).void } + attr_writer :uts_mode + + # Driver that this container uses to mount volumes. + sig { returns(T.nilable(String)) } + attr_reader :volume_driver + + sig { params(volume_driver: String).void } + attr_writer :volume_driver + + # A list of volumes to inherit from another container, specified in the form + # `[:]`. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :volumes_from + + sig { params(volumes_from: T::Array[String]).void } + attr_writer :volumes_from + + # Container configuration that depends on the host we are running on + sig do + params( + annotations: T::Hash[Symbol, String], + auto_remove: T::Boolean, + binds: T::Array[String], + blkio_device_read_bps: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadBp::OrHash + ], + blkio_device_read_i_ops: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadIOp::OrHash + ], + blkio_device_write_bps: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteBp::OrHash + ], + blkio_device_write_i_ops: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteIOp::OrHash + ], + blkio_weight: Integer, + blkio_weight_device: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioWeightDevice::OrHash + ], + cap_add: T::Array[String], + cap_drop: T::Array[String], + cgroup: String, + cgroupns_mode: + Docker::ContainerCreateParams::Config::HostConfig::CgroupnsMode::OrSymbol, + cgroup_parent: String, + console_size: T.nilable(T::Array[Integer]), + container_id_file: String, + cpu_count: Integer, + cpu_percent: Integer, + cpu_period: Integer, + cpu_quota: Integer, + cpu_realtime_period: Integer, + cpu_realtime_runtime: Integer, + cpuset_cpus: String, + cpuset_mems: String, + cpu_shares: Integer, + device_cgroup_rules: T::Array[String], + device_requests: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::DeviceRequest::OrHash + ], + devices: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Device::OrHash + ], + dns: T::Array[String], + dns_options: T::Array[String], + dns_search: T::Array[String], + extra_hosts: T::Array[String], + group_add: T::Array[String], + init: T.nilable(T::Boolean), + io_maximum_bandwidth: Integer, + io_maximum_i_ops: Integer, + ipc_mode: String, + isolation: + Docker::ContainerCreateParams::Config::HostConfig::Isolation::OrSymbol, + links: T::Array[String], + log_config: + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::OrHash, + masked_paths: T::Array[String], + memory: Integer, + memory_reservation: Integer, + memory_swap: Integer, + memory_swappiness: Integer, + mounts: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Mount::OrHash + ], + nano_cpus: Integer, + network_mode: String, + oom_kill_disable: T::Boolean, + oom_score_adj: Integer, + pid_mode: String, + pids_limit: T.nilable(Integer), + port_bindings: + T::Hash[ + Symbol, + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::PortBinding::OrHash + ] + ], + privileged: T::Boolean, + publish_all_ports: T::Boolean, + readonly_paths: T::Array[String], + readonly_rootfs: T::Boolean, + restart_policy: + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::OrHash, + runtime: T.nilable(String), + security_opt: T::Array[String], + shm_size: Integer, + storage_opt: T::Hash[Symbol, String], + sysctls: T.nilable(T::Hash[Symbol, String]), + tmpfs: T::Hash[Symbol, String], + ulimits: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Ulimit::OrHash + ], + userns_mode: String, + uts_mode: String, + volume_driver: String, + volumes_from: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # Arbitrary non-identifying metadata attached to container and provided to the + # runtime when the container is started. + annotations: nil, + # Automatically remove the container when the container's process exits. This has + # no effect if `RestartPolicy` is set. + auto_remove: nil, + # A list of volume bindings for this container. Each volume binding is a string in + # one of these forms: + # + # - `host-src:container-dest[:options]` to bind-mount a host path into the + # container. Both `host-src`, and `container-dest` must be an _absolute_ path. + # - `volume-name:container-dest[:options]` to bind-mount a volume managed by a + # volume driver into the container. `container-dest` must be an _absolute_ path. + # + # `options` is an optional, comma-delimited list of: + # + # - `nocopy` disables automatic copying of data from the container path to the + # volume. The `nocopy` flag only applies to named volumes. + # - `[ro|rw]` mounts a volume read-only or read-write, respectively. If omitted or + # set to `rw`, volumes are mounted read-write. + # - `[z|Z]` applies SELinux labels to allow or deny multiple containers to read + # and write to the same volume. + # - `z`: a _shared_ content label is applied to the content. This label + # indicates that multiple containers can share the volume content, for both + # reading and writing. + # - `Z`: a _private unshared_ label is applied to the content. This label + # indicates that only the current container can use a private volume. Labeling + # systems such as SELinux require proper labels to be placed on volume content + # that is mounted into a container. Without a label, the security system can + # prevent a container's processes from using the content. By default, the + # labels set by the host operating system are not modified. + # - `[[r]shared|[r]slave|[r]private]` specifies mount + # [propagation behavior](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt). + # This only applies to bind-mounted volumes, not internal volumes or named + # volumes. Mount propagation requires the source mount point (the location where + # the source directory is mounted in the host operating system) to have the + # correct propagation properties. For shared volumes, the source mount point + # must be set to `shared`. For slave volumes, the mount must be set to either + # `shared` or `slave`. + binds: nil, + # Limit read rate (bytes per second) from a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + blkio_device_read_bps: nil, + # Limit read rate (IO per second) from a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + blkio_device_read_i_ops: nil, + # Limit write rate (bytes per second) to a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + blkio_device_write_bps: nil, + # Limit write rate (IO per second) to a device, in the form: + # + # ``` + # [{"Path": "device_path", "Rate": rate}] + # ``` + blkio_device_write_i_ops: nil, + # Block IO weight (relative weight). + blkio_weight: nil, + # Block IO weight (relative device weight) in the form: + # + # ``` + # [{"Path": "device_path", "Weight": weight}] + # ``` + blkio_weight_device: nil, + # A list of kernel capabilities to add to the container. Conflicts with option + # 'Capabilities'. + cap_add: nil, + # A list of kernel capabilities to drop from the container. Conflicts with option + # 'Capabilities'. + cap_drop: nil, + # Cgroup to use for the container. + cgroup: nil, + # cgroup namespace mode for the container. Possible values are: + # + # - `"private"`: the container runs in its own private cgroup namespace + # - `"host"`: use the host system's cgroup namespace + # + # If not specified, the daemon default is used, which can either be `"private"` or + # `"host"`, depending on daemon version, kernel support and configuration. + cgroupns_mode: nil, + # Path to `cgroups` under which the container's `cgroup` is created. If the path + # is not absolute, the path is considered to be relative to the `cgroups` path of + # the init process. Cgroups are created if they do not already exist. + cgroup_parent: nil, + # Initial console size, as an `[height, width]` array. + console_size: nil, + # Path to a file where the container ID is written + container_id_file: nil, + # The number of usable CPUs (Windows only). + # + # On Windows Server containers, the processor resource controls are mutually + # exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and + # `CPUPercent` last. + cpu_count: nil, + # The usable percentage of the available CPUs (Windows only). + # + # On Windows Server containers, the processor resource controls are mutually + # exclusive. The order of precedence is `CPUCount` first, then `CPUShares`, and + # `CPUPercent` last. + cpu_percent: nil, + # The length of a CPU period in microseconds. + cpu_period: nil, + # Microseconds of CPU time that the container can get in a CPU period. + cpu_quota: nil, + # The length of a CPU real-time period in microseconds. Set to 0 to allocate no + # time allocated to real-time tasks. + cpu_realtime_period: nil, + # The length of a CPU real-time runtime in microseconds. Set to 0 to allocate no + # time allocated to real-time tasks. + cpu_realtime_runtime: nil, + # CPUs in which to allow execution (e.g., `0-3`, `0,1`). + cpuset_cpus: nil, + # Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on + # NUMA systems. + cpuset_mems: nil, + # An integer value representing this container's relative CPU weight versus other + # containers. + cpu_shares: nil, + # a list of cgroup rules to apply to the container + device_cgroup_rules: nil, + # A list of requests for devices to be sent to device drivers. + device_requests: nil, + # A list of devices to add to the container. + devices: nil, + # A list of DNS servers for the container to use. + dns: nil, + # A list of DNS options. + dns_options: nil, + # A list of DNS search domains. + dns_search: nil, + # A list of hostnames/IP mappings to add to the container's `/etc/hosts` file. + # Specified in the form `["hostname:IP"]`. + extra_hosts: nil, + # A list of additional groups that the container process will run as. + group_add: nil, + # Run an init inside the container that forwards signals and reaps processes. This + # field is omitted if empty, and the default (as configured on the daemon) is + # used. + init: nil, + # Maximum IO in bytes per second for the container system drive (Windows only). + io_maximum_bandwidth: nil, + # Maximum IOps for the container system drive (Windows only) + io_maximum_i_ops: nil, + # IPC sharing mode for the container. Possible values are: + # + # - `"none"`: own private IPC namespace, with /dev/shm not mounted + # - `"private"`: own private IPC namespace + # - `"shareable"`: own private IPC namespace, with a possibility to share it with + # other containers + # - `"container:"`: join another (shareable) container's IPC namespace + # - `"host"`: use the host system's IPC namespace + # + # If not specified, daemon default is used, which can either be `"private"` or + # `"shareable"`, depending on daemon version and configuration. + ipc_mode: nil, + # Isolation technology of the container. (Windows only) + isolation: nil, + # A list of links for the container in the form `container_name:alias`. + links: nil, + # The logging configuration for this container + log_config: nil, + # The list of paths to be masked inside the container (this overrides the default + # set of paths). + masked_paths: nil, + # Memory limit in bytes. + memory: nil, + # Memory soft limit in bytes. + memory_reservation: nil, + # Total memory limit (memory + swap). Set as `-1` to enable unlimited swap. + memory_swap: nil, + # Tune a container's memory swappiness behavior. Accepts an integer between 0 + # and 100. + memory_swappiness: nil, + # Specification for mounts to be added to the container. + mounts: nil, + # CPU quota in units of 10-9 CPUs. + nano_cpus: nil, + # Network mode to use for this container. Supported standard values are: `bridge`, + # `host`, `none`, and `container:`. Any other value is taken as a custom + # network's name to which this container should connect to. + network_mode: nil, + # Disable OOM Killer for the container. + oom_kill_disable: nil, + # An integer value containing the score given to the container in order to tune + # OOM killer preferences. + oom_score_adj: nil, + # Set the PID (Process) Namespace mode for the container. It can be either: + # + # - `"container:"`: joins another container's PID namespace + # - `"host"`: use the host's PID namespace inside the container + pid_mode: nil, + # Tune a container's PIDs limit. Set `0` or `-1` for unlimited, or `null` to not + # change. + pids_limit: nil, + # PortMap describes the mapping of container ports to host ports, using the + # container's port-number and protocol as key in the format `/`, + # for example, `80/udp`. + # + # If a container's port is mapped for multiple protocols, separate entries are + # added to the mapping table. + port_bindings: nil, + # Gives the container full access to the host. + privileged: nil, + # Allocates an ephemeral host port for all of a container's exposed ports. + # + # Ports are de-allocated when the container stops and allocated when the container + # starts. The allocated port might be changed when restarting the container. + # + # The port is selected from the ephemeral port range that depends on the kernel. + # For example, on Linux the range is defined by + # `/proc/sys/net/ipv4/ip_local_port_range`. + publish_all_ports: nil, + # The list of paths to be set as read-only inside the container (this overrides + # the default set of paths). + readonly_paths: nil, + # Mount the container's root filesystem as read only. + readonly_rootfs: nil, + # The behavior to apply when the container exits. The default is not to restart. + # + # An ever increasing delay (double the previous delay, starting at 100ms) is added + # before each restart to prevent flooding the server. + restart_policy: nil, + # Runtime to use with this container. + runtime: nil, + # A list of string values to customize labels for MLS systems, such as SELinux. + security_opt: nil, + # Size of `/dev/shm` in bytes. If omitted, the system uses 64MB. + shm_size: nil, + # Storage driver options for this container, in the form `{"size": "120G"}`. + storage_opt: nil, + # A list of kernel parameters (sysctls) to set in the container. + # + # This field is omitted if not set. + sysctls: nil, + # A map of container directories which should be replaced by tmpfs mounts, and + # their corresponding mount options. For example: + # + # ``` + # { "/run": "rw,noexec,nosuid,size=65536k" } + # ``` + tmpfs: nil, + # A list of resource limits to set in the container. For example: + # + # ``` + # {"Name": "nofile", "Soft": 1024, "Hard": 2048} + # ``` + ulimits: nil, + # Sets the usernamespace mode for the container when usernamespace remapping + # option is enabled. + userns_mode: nil, + # UTS namespace to use for the container. + uts_mode: nil, + # Driver that this container uses to mount volumes. + volume_driver: nil, + # A list of volumes to inherit from another container, specified in the form + # `[:]`. + volumes_from: nil + ) + end + + sig do + override.returns( + { + annotations: T::Hash[Symbol, String], + auto_remove: T::Boolean, + binds: T::Array[String], + blkio_device_read_bps: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadBp + ], + blkio_device_read_i_ops: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadIOp + ], + blkio_device_write_bps: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteBp + ], + blkio_device_write_i_ops: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteIOp + ], + blkio_weight: Integer, + blkio_weight_device: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::BlkioWeightDevice + ], + cap_add: T::Array[String], + cap_drop: T::Array[String], + cgroup: String, + cgroupns_mode: + Docker::ContainerCreateParams::Config::HostConfig::CgroupnsMode::OrSymbol, + cgroup_parent: String, + console_size: T.nilable(T::Array[Integer]), + container_id_file: String, + cpu_count: Integer, + cpu_percent: Integer, + cpu_period: Integer, + cpu_quota: Integer, + cpu_realtime_period: Integer, + cpu_realtime_runtime: Integer, + cpuset_cpus: String, + cpuset_mems: String, + cpu_shares: Integer, + device_cgroup_rules: T::Array[String], + device_requests: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::DeviceRequest + ], + devices: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Device + ], + dns: T::Array[String], + dns_options: T::Array[String], + dns_search: T::Array[String], + extra_hosts: T::Array[String], + group_add: T::Array[String], + init: T.nilable(T::Boolean), + io_maximum_bandwidth: Integer, + io_maximum_i_ops: Integer, + ipc_mode: String, + isolation: + Docker::ContainerCreateParams::Config::HostConfig::Isolation::OrSymbol, + links: T::Array[String], + log_config: + Docker::ContainerCreateParams::Config::HostConfig::LogConfig, + masked_paths: T::Array[String], + memory: Integer, + memory_reservation: Integer, + memory_swap: Integer, + memory_swappiness: Integer, + mounts: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Mount + ], + nano_cpus: Integer, + network_mode: String, + oom_kill_disable: T::Boolean, + oom_score_adj: Integer, + pid_mode: String, + pids_limit: T.nilable(Integer), + port_bindings: + T::Hash[ + Symbol, + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::PortBinding + ] + ], + privileged: T::Boolean, + publish_all_ports: T::Boolean, + readonly_paths: T::Array[String], + readonly_rootfs: T::Boolean, + restart_policy: + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy, + runtime: T.nilable(String), + security_opt: T::Array[String], + shm_size: Integer, + storage_opt: T::Hash[Symbol, String], + sysctls: T.nilable(T::Hash[Symbol, String]), + tmpfs: T::Hash[Symbol, String], + ulimits: + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Ulimit + ], + userns_mode: String, + uts_mode: String, + volume_driver: String, + volumes_from: T::Array[String] + } + ) + end + def to_hash + end + + class BlkioDeviceReadBp < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadBp, + Docker::Internal::AnyHash + ) + end + + # Device path + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + # Rate + sig { returns(T.nilable(Integer)) } + attr_reader :rate + + sig { params(rate: Integer).void } + attr_writer :rate + + sig do + params(path: String, rate: Integer).returns(T.attached_class) + end + def self.new( + # Device path + path: nil, + # Rate + rate: nil + ) + end + + sig { override.returns({ path: String, rate: Integer }) } + def to_hash + end + end + + class BlkioDeviceReadIOp < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadIOp, + Docker::Internal::AnyHash + ) + end + + # Device path + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + # Rate + sig { returns(T.nilable(Integer)) } + attr_reader :rate + + sig { params(rate: Integer).void } + attr_writer :rate + + sig do + params(path: String, rate: Integer).returns(T.attached_class) + end + def self.new( + # Device path + path: nil, + # Rate + rate: nil + ) + end + + sig { override.returns({ path: String, rate: Integer }) } + def to_hash + end + end + + class BlkioDeviceWriteBp < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteBp, + Docker::Internal::AnyHash + ) + end + + # Device path + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + # Rate + sig { returns(T.nilable(Integer)) } + attr_reader :rate + + sig { params(rate: Integer).void } + attr_writer :rate + + sig do + params(path: String, rate: Integer).returns(T.attached_class) + end + def self.new( + # Device path + path: nil, + # Rate + rate: nil + ) + end + + sig { override.returns({ path: String, rate: Integer }) } + def to_hash + end + end + + class BlkioDeviceWriteIOp < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteIOp, + Docker::Internal::AnyHash + ) + end + + # Device path + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + # Rate + sig { returns(T.nilable(Integer)) } + attr_reader :rate + + sig { params(rate: Integer).void } + attr_writer :rate + + sig do + params(path: String, rate: Integer).returns(T.attached_class) + end + def self.new( + # Device path + path: nil, + # Rate + rate: nil + ) + end + + sig { override.returns({ path: String, rate: Integer }) } + def to_hash + end + end + + class BlkioWeightDevice < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::BlkioWeightDevice, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + sig { returns(T.nilable(Integer)) } + attr_reader :weight + + sig { params(weight: Integer).void } + attr_writer :weight + + sig do + params(path: String, weight: Integer).returns(T.attached_class) + end + def self.new(path: nil, weight: nil) + end + + sig { override.returns({ path: String, weight: Integer }) } + def to_hash + end + end + + # cgroup namespace mode for the container. Possible values are: + # + # - `"private"`: the container runs in its own private cgroup namespace + # - `"host"`: use the host system's cgroup namespace + # + # If not specified, the daemon default is used, which can either be `"private"` or + # `"host"`, depending on daemon version, kernel support and configuration. + module CgroupnsMode + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::ContainerCreateParams::Config::HostConfig::CgroupnsMode + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRIVATE = + T.let( + :private, + Docker::ContainerCreateParams::Config::HostConfig::CgroupnsMode::TaggedSymbol + ) + HOST = + T.let( + :host, + Docker::ContainerCreateParams::Config::HostConfig::CgroupnsMode::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::CgroupnsMode::TaggedSymbol + ] + ) + end + def self.values + end + end + + class DeviceRequest < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::DeviceRequest, + Docker::Internal::AnyHash + ) + end + + # A list of capabilities; an OR list of AND lists of capabilities. + # + # Note that if a driver is specified the capabilities have no effect on selecting + # a driver as the driver name is used directly. + # + # Note that if no driver is specified the capabilities are used to select a driver + # with the required capabilities. + sig { returns(T.nilable(T::Array[T::Array[String]])) } + attr_reader :capabilities + + sig { params(capabilities: T::Array[T::Array[String]]).void } + attr_writer :capabilities + + sig { returns(T.nilable(Integer)) } + attr_reader :count + + sig { params(count: Integer).void } + attr_writer :count + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :device_ids + + sig { params(device_ids: T::Array[String]).void } + attr_writer :device_ids + + # The name of the device driver to use for this request. + # + # Note that if this is specified the capabilities are ignored when selecting a + # device driver. + sig { returns(T.nilable(String)) } + attr_reader :driver + + sig { params(driver: String).void } + attr_writer :driver + + # Driver-specific options, specified as a key/value pairs. These options are + # passed directly to the driver. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :options + + sig { params(options: T::Hash[Symbol, String]).void } + attr_writer :options + + # A request for devices to be sent to device drivers + sig do + params( + capabilities: T::Array[T::Array[String]], + count: Integer, + device_ids: T::Array[String], + driver: String, + options: T::Hash[Symbol, String] + ).returns(T.attached_class) + end + def self.new( + # A list of capabilities; an OR list of AND lists of capabilities. + # + # Note that if a driver is specified the capabilities have no effect on selecting + # a driver as the driver name is used directly. + # + # Note that if no driver is specified the capabilities are used to select a driver + # with the required capabilities. + capabilities: nil, + count: nil, + device_ids: nil, + # The name of the device driver to use for this request. + # + # Note that if this is specified the capabilities are ignored when selecting a + # device driver. + driver: nil, + # Driver-specific options, specified as a key/value pairs. These options are + # passed directly to the driver. + options: nil + ) + end + + sig do + override.returns( + { + capabilities: T::Array[T::Array[String]], + count: Integer, + device_ids: T::Array[String], + driver: String, + options: T::Hash[Symbol, String] + } + ) + end + def to_hash + end + end + + class Device < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::Device, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :cgroup_permissions + + sig { params(cgroup_permissions: String).void } + attr_writer :cgroup_permissions + + sig { returns(T.nilable(String)) } + attr_reader :path_in_container + + sig { params(path_in_container: String).void } + attr_writer :path_in_container + + sig { returns(T.nilable(String)) } + attr_reader :path_on_host + + sig { params(path_on_host: String).void } + attr_writer :path_on_host + + # A device mapping between the host and container + sig do + params( + cgroup_permissions: String, + path_in_container: String, + path_on_host: String + ).returns(T.attached_class) + end + def self.new( + cgroup_permissions: nil, + path_in_container: nil, + path_on_host: nil + ) + end + + sig do + override.returns( + { + cgroup_permissions: String, + path_in_container: String, + path_on_host: String + } + ) + end + def to_hash + end + end + + # Isolation technology of the container. (Windows only) + module Isolation + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::ContainerCreateParams::Config::HostConfig::Isolation + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DEFAULT = + T.let( + :default, + Docker::ContainerCreateParams::Config::HostConfig::Isolation::TaggedSymbol + ) + PROCESS = + T.let( + :process, + Docker::ContainerCreateParams::Config::HostConfig::Isolation::TaggedSymbol + ) + HYPERV = + T.let( + :hyperv, + Docker::ContainerCreateParams::Config::HostConfig::Isolation::TaggedSymbol + ) + EMPTY = + T.let( + :"", + Docker::ContainerCreateParams::Config::HostConfig::Isolation::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Isolation::TaggedSymbol + ] + ) + end + def self.values + end + end + + class LogConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::LogConfig, + Docker::Internal::AnyHash + ) + end + + # Driver-specific configuration options for the logging driver. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :config + + sig { params(config: T::Hash[Symbol, String]).void } + attr_writer :config + + # Name of the logging driver used for the container or "none" if logging is + # disabled. + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::OrSymbol + ) + ) + end + attr_reader :type + + sig do + params( + type: + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::OrSymbol + ).void + end + attr_writer :type + + # The logging configuration for this container + sig do + params( + config: T::Hash[Symbol, String], + type: + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Driver-specific configuration options for the logging driver. + config: nil, + # Name of the logging driver used for the container or "none" if logging is + # disabled. + type: nil + ) + end + + sig do + override.returns( + { + config: T::Hash[Symbol, String], + type: + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::OrSymbol + } + ) + end + def to_hash + end + + # Name of the logging driver used for the container or "none" if logging is + # disabled. + module Type + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LOCAL = + T.let( + :local, + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::TaggedSymbol + ) + JSON_FILE = + T.let( + :"json-file", + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::TaggedSymbol + ) + SYSLOG = + T.let( + :syslog, + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::TaggedSymbol + ) + JOURNALD = + T.let( + :journald, + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::TaggedSymbol + ) + GELF = + T.let( + :gelf, + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::TaggedSymbol + ) + FLUENTD = + T.let( + :fluentd, + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::TaggedSymbol + ) + AWSLOGS = + T.let( + :awslogs, + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::TaggedSymbol + ) + SPLUNK = + T.let( + :splunk, + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::TaggedSymbol + ) + ETWLOGS = + T.let( + :etwlogs, + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::TaggedSymbol + ) + NONE = + T.let( + :none, + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::LogConfig::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Mount < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::Mount, + Docker::Internal::AnyHash + ) + end + + # Optional configuration for the `bind` type. + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions + ) + ) + end + attr_reader :bind_options + + sig do + params( + bind_options: + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::OrHash + ).void + end + attr_writer :bind_options + + # The consistency requirement for the mount: `default`, `consistent`, `cached`, or + # `delegated`. + sig { returns(T.nilable(String)) } + attr_reader :consistency + + sig { params(consistency: String).void } + attr_writer :consistency + + # Optional configuration for the `image` type. + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions + ) + ) + end + attr_reader :image_options + + sig do + params( + image_options: + Docker::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions::OrHash + ).void + end + attr_writer :image_options + + # Whether the mount should be read-only. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :read_only + + sig { params(read_only: T::Boolean).void } + attr_writer :read_only + + # Mount source (e.g. a volume name, a host path). The source cannot be specified + # when using `Type=tmpfs`. For `Type=bind`, the source path must either exist, or + # the `CreateMountpoint` must be set to `true` to create the source path on the + # host if missing. + # + # For `Type=npipe`, the pipe must exist prior to creating the container. + sig { returns(T.nilable(String)) } + attr_reader :source + + sig { params(source: String).void } + attr_writer :source + + # Container path. + sig { returns(T.nilable(String)) } + attr_reader :target + + sig { params(target: String).void } + attr_writer :target + + # Optional configuration for the `tmpfs` type. + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions + ) + ) + end + attr_reader :tmpfs_options + + sig do + params( + tmpfs_options: + Docker::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions::OrHash + ).void + end + attr_writer :tmpfs_options + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::Mount::Type::OrSymbol + ) + ) + end + attr_reader :type + + sig do + params( + type: + Docker::ContainerCreateParams::Config::HostConfig::Mount::Type::OrSymbol + ).void + end + attr_writer :type + + # Optional configuration for the `volume` type. + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions + ) + ) + end + attr_reader :volume_options + + sig do + params( + volume_options: + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::OrHash + ).void + end + attr_writer :volume_options + + sig do + params( + bind_options: + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::OrHash, + consistency: String, + image_options: + Docker::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions::OrHash, + read_only: T::Boolean, + source: String, + target: String, + tmpfs_options: + Docker::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions::OrHash, + type: + Docker::ContainerCreateParams::Config::HostConfig::Mount::Type::OrSymbol, + volume_options: + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Optional configuration for the `bind` type. + bind_options: nil, + # The consistency requirement for the mount: `default`, `consistent`, `cached`, or + # `delegated`. + consistency: nil, + # Optional configuration for the `image` type. + image_options: nil, + # Whether the mount should be read-only. + read_only: nil, + # Mount source (e.g. a volume name, a host path). The source cannot be specified + # when using `Type=tmpfs`. For `Type=bind`, the source path must either exist, or + # the `CreateMountpoint` must be set to `true` to create the source path on the + # host if missing. + # + # For `Type=npipe`, the pipe must exist prior to creating the container. + source: nil, + # Container path. + target: nil, + # Optional configuration for the `tmpfs` type. + tmpfs_options: nil, + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + type: nil, + # Optional configuration for the `volume` type. + volume_options: nil + ) + end + + sig do + override.returns( + { + bind_options: + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions, + consistency: String, + image_options: + Docker::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions, + read_only: T::Boolean, + source: String, + target: String, + tmpfs_options: + Docker::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions, + type: + Docker::ContainerCreateParams::Config::HostConfig::Mount::Type::OrSymbol, + volume_options: + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions + } + ) + end + def to_hash + end + + class BindOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions, + Docker::Internal::AnyHash + ) + end + + # Create mount point on host if missing + sig { returns(T.nilable(T::Boolean)) } + attr_reader :create_mountpoint + + sig { params(create_mountpoint: T::Boolean).void } + attr_writer :create_mountpoint + + # Disable recursive bind mount. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :non_recursive + + sig { params(non_recursive: T::Boolean).void } + attr_writer :non_recursive + + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation::OrSymbol + ) + ) + end + attr_reader :propagation + + sig do + params( + propagation: + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation::OrSymbol + ).void + end + attr_writer :propagation + + # Raise an error if the mount cannot be made recursively read-only. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :read_only_force_recursive + + sig { params(read_only_force_recursive: T::Boolean).void } + attr_writer :read_only_force_recursive + + # Make the mount non-recursively read-only, but still leave the mount recursive + # (unless NonRecursive is set to `true` in conjunction). + # + # Added in v1.44, before that version all read-only mounts were non-recursive by + # default. To match the previous behaviour this will default to `true` for clients + # on versions prior to v1.44. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :read_only_non_recursive + + sig { params(read_only_non_recursive: T::Boolean).void } + attr_writer :read_only_non_recursive + + # Optional configuration for the `bind` type. + sig do + params( + create_mountpoint: T::Boolean, + non_recursive: T::Boolean, + propagation: + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation::OrSymbol, + read_only_force_recursive: T::Boolean, + read_only_non_recursive: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Create mount point on host if missing + create_mountpoint: nil, + # Disable recursive bind mount. + non_recursive: nil, + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + propagation: nil, + # Raise an error if the mount cannot be made recursively read-only. + read_only_force_recursive: nil, + # Make the mount non-recursively read-only, but still leave the mount recursive + # (unless NonRecursive is set to `true` in conjunction). + # + # Added in v1.44, before that version all read-only mounts were non-recursive by + # default. To match the previous behaviour this will default to `true` for clients + # on versions prior to v1.44. + read_only_non_recursive: nil + ) + end + + sig do + override.returns( + { + create_mountpoint: T::Boolean, + non_recursive: T::Boolean, + propagation: + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation::OrSymbol, + read_only_force_recursive: T::Boolean, + read_only_non_recursive: T::Boolean + } + ) + end + def to_hash + end + + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + module Propagation + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRIVATE = + T.let( + :private, + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + RPRIVATE = + T.let( + :rprivate, + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + SHARED = + T.let( + :shared, + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + RSHARED = + T.let( + :rshared, + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + SLAVE = + T.let( + :slave, + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + RSLAVE = + T.let( + :rslave, + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::Propagation::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class ImageOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions, + Docker::Internal::AnyHash + ) + end + + # Source path inside the image. Must be relative without any back traversals. + sig { returns(T.nilable(String)) } + attr_reader :subpath + + sig { params(subpath: String).void } + attr_writer :subpath + + # Optional configuration for the `image` type. + sig { params(subpath: String).returns(T.attached_class) } + def self.new( + # Source path inside the image. Must be relative without any back traversals. + subpath: nil + ) + end + + sig { override.returns({ subpath: String }) } + def to_hash + end + end + + class TmpfsOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions, + Docker::Internal::AnyHash + ) + end + + # The permission mode for the tmpfs mount in an integer. The value must not be in + # octal format (e.g. 755) but rather the decimal representation of the octal value + # (e.g. 493). + sig { returns(T.nilable(Integer)) } + attr_reader :mode + + sig { params(mode: Integer).void } + attr_writer :mode + + # The options to be passed to the tmpfs mount. An array of arrays. Flag options + # should be provided as 1-length arrays. Other types should be provided as as + # 2-length arrays, where the first item is the key and the second the value. + sig { returns(T.nilable(T::Array[T::Array[String]])) } + attr_reader :options + + sig { params(options: T::Array[T::Array[String]]).void } + attr_writer :options + + # The size for the tmpfs mount in bytes. + sig { returns(T.nilable(Integer)) } + attr_reader :size_bytes + + sig { params(size_bytes: Integer).void } + attr_writer :size_bytes + + # Optional configuration for the `tmpfs` type. + sig do + params( + mode: Integer, + options: T::Array[T::Array[String]], + size_bytes: Integer + ).returns(T.attached_class) + end + def self.new( + # The permission mode for the tmpfs mount in an integer. The value must not be in + # octal format (e.g. 755) but rather the decimal representation of the octal value + # (e.g. 493). + mode: nil, + # The options to be passed to the tmpfs mount. An array of arrays. Flag options + # should be provided as 1-length arrays. Other types should be provided as as + # 2-length arrays, where the first item is the key and the second the value. + options: nil, + # The size for the tmpfs mount in bytes. + size_bytes: nil + ) + end + + sig do + override.returns( + { + mode: Integer, + options: T::Array[T::Array[String]], + size_bytes: Integer + } + ) + end + def to_hash + end + end + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + module Type + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::ContainerCreateParams::Config::HostConfig::Mount::Type + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + BIND = + T.let( + :bind, + Docker::ContainerCreateParams::Config::HostConfig::Mount::Type::TaggedSymbol + ) + CLUSTER = + T.let( + :cluster, + Docker::ContainerCreateParams::Config::HostConfig::Mount::Type::TaggedSymbol + ) + IMAGE = + T.let( + :image, + Docker::ContainerCreateParams::Config::HostConfig::Mount::Type::TaggedSymbol + ) + NPIPE = + T.let( + :npipe, + Docker::ContainerCreateParams::Config::HostConfig::Mount::Type::TaggedSymbol + ) + TMPFS = + T.let( + :tmpfs, + Docker::ContainerCreateParams::Config::HostConfig::Mount::Type::TaggedSymbol + ) + VOLUME = + T.let( + :volume, + Docker::ContainerCreateParams::Config::HostConfig::Mount::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::Mount::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + class VolumeOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions, + Docker::Internal::AnyHash + ) + end + + # Map of driver specific options + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig + ) + ) + end + attr_reader :driver_config + + sig do + params( + driver_config: + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig::OrHash + ).void + end + attr_writer :driver_config + + # User-defined key/value metadata. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :labels + + sig { params(labels: T::Hash[Symbol, String]).void } + attr_writer :labels + + # Populate volume with data from the target. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :no_copy + + sig { params(no_copy: T::Boolean).void } + attr_writer :no_copy + + # Source path inside the volume. Must be relative without any back traversals. + sig { returns(T.nilable(String)) } + attr_reader :subpath + + sig { params(subpath: String).void } + attr_writer :subpath + + # Optional configuration for the `volume` type. + sig do + params( + driver_config: + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig::OrHash, + labels: T::Hash[Symbol, String], + no_copy: T::Boolean, + subpath: String + ).returns(T.attached_class) + end + def self.new( + # Map of driver specific options + driver_config: nil, + # User-defined key/value metadata. + labels: nil, + # Populate volume with data from the target. + no_copy: nil, + # Source path inside the volume. Must be relative without any back traversals. + subpath: nil + ) + end + + sig do + override.returns( + { + driver_config: + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig, + labels: T::Hash[Symbol, String], + no_copy: T::Boolean, + subpath: String + } + ) + end + def to_hash + end + + class DriverConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig, + Docker::Internal::AnyHash + ) + end + + # Name of the driver to use to create the volume. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # key/value map of driver specific options. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :options + + sig { params(options: T::Hash[Symbol, String]).void } + attr_writer :options + + # Map of driver specific options + sig do + params( + name: String, + options: T::Hash[Symbol, String] + ).returns(T.attached_class) + end + def self.new( + # Name of the driver to use to create the volume. + name: nil, + # key/value map of driver specific options. + options: nil + ) + end + + sig do + override.returns( + { name: String, options: T::Hash[Symbol, String] } + ) + end + def to_hash + end + end + end + end + + class PortBinding < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::PortBinding, + Docker::Internal::AnyHash + ) + end + + # Host IP address that the container's port is mapped to. + sig { returns(T.nilable(String)) } + attr_reader :host_ip + + sig { params(host_ip: String).void } + attr_writer :host_ip + + # Host port number that the container's port is mapped to. + sig { returns(T.nilable(String)) } + attr_reader :host_port + + sig { params(host_port: String).void } + attr_writer :host_port + + # PortBinding represents a binding between a host IP address and a host port. + sig do + params(host_ip: String, host_port: String).returns( + T.attached_class + ) + end + def self.new( + # Host IP address that the container's port is mapped to. + host_ip: nil, + # Host port number that the container's port is mapped to. + host_port: nil + ) + end + + sig { override.returns({ host_ip: String, host_port: String }) } + def to_hash + end + end + + class RestartPolicy < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy, + Docker::Internal::AnyHash + ) + end + + # If `on-failure` is used, the number of times to retry before giving up. + sig { returns(T.nilable(Integer)) } + attr_reader :maximum_retry_count + + sig { params(maximum_retry_count: Integer).void } + attr_writer :maximum_retry_count + + # - Empty string means not to restart + # - `no` Do not automatically restart + # - `always` Always restart + # - `unless-stopped` Restart always except when the user has manually stopped the + # container + # - `on-failure` Restart only when the container exit code is non-zero + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name::OrSymbol + ) + ) + end + attr_reader :name + + sig do + params( + name: + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name::OrSymbol + ).void + end + attr_writer :name + + # The behavior to apply when the container exits. The default is not to restart. + # + # An ever increasing delay (double the previous delay, starting at 100ms) is added + # before each restart to prevent flooding the server. + sig do + params( + maximum_retry_count: Integer, + name: + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # If `on-failure` is used, the number of times to retry before giving up. + maximum_retry_count: nil, + # - Empty string means not to restart + # - `no` Do not automatically restart + # - `always` Always restart + # - `unless-stopped` Restart always except when the user has manually stopped the + # container + # - `on-failure` Restart only when the container exit code is non-zero + name: nil + ) + end + + sig do + override.returns( + { + maximum_retry_count: Integer, + name: + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name::OrSymbol + } + ) + end + def to_hash + end + + # - Empty string means not to restart + # - `no` Do not automatically restart + # - `always` Always restart + # - `unless-stopped` Restart always except when the user has manually stopped the + # container + # - `on-failure` Restart only when the container exit code is non-zero + module Name + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + EMPTY = + T.let( + :"", + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name::TaggedSymbol + ) + NO = + T.let( + :no, + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name::TaggedSymbol + ) + ALWAYS = + T.let( + :always, + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name::TaggedSymbol + ) + UNLESS_STOPPED = + T.let( + :"unless-stopped", + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name::TaggedSymbol + ) + ON_FAILURE = + T.let( + :"on-failure", + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy::Name::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Ulimit < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::HostConfig::Ulimit, + Docker::Internal::AnyHash + ) + end + + # Hard limit + sig { returns(T.nilable(Integer)) } + attr_reader :hard + + sig { params(hard: Integer).void } + attr_writer :hard + + # Name of ulimit + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Soft limit + sig { returns(T.nilable(Integer)) } + attr_reader :soft + + sig { params(soft: Integer).void } + attr_writer :soft + + sig do + params(hard: Integer, name: String, soft: Integer).returns( + T.attached_class + ) + end + def self.new( + # Hard limit + hard: nil, + # Name of ulimit + name: nil, + # Soft limit + soft: nil + ) + end + + sig do + override.returns({ hard: Integer, name: String, soft: Integer }) + end + def to_hash + end + end + end + + class NetworkingConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::NetworkingConfig, + Docker::Internal::AnyHash + ) + end + + # A mapping of network name to endpoint configuration for that network. The + # endpoint configuration can be left empty to connect to that network with no + # particular endpoint configuration. + sig do + returns( + T.nilable( + T::Hash[ + Symbol, + Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig + ] + ) + ) + end + attr_reader :endpoints_config + + sig do + params( + endpoints_config: + T::Hash[ + Symbol, + Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::OrHash + ] + ).void + end + attr_writer :endpoints_config + + # NetworkingConfig represents the container's networking configuration for each of + # its interfaces. It is used for the networking configs specified in the + # `docker create` and `docker network connect` commands. + sig do + params( + endpoints_config: + T::Hash[ + Symbol, + Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::OrHash + ] + ).returns(T.attached_class) + end + def self.new( + # A mapping of network name to endpoint configuration for that network. The + # endpoint configuration can be left empty to connect to that network with no + # particular endpoint configuration. + endpoints_config: nil + ) + end + + sig do + override.returns( + { + endpoints_config: + T::Hash[ + Symbol, + Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig + ] + } + ) + end + def to_hash + end + + class EndpointsConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :aliases + + sig { params(aliases: T::Array[String]).void } + attr_writer :aliases + + # List of all DNS names an endpoint has on a specific network. This list is based + # on the container name, network aliases, container short ID, and hostname. + # + # These DNS names are non-fully qualified but can contain several dots. You can + # get fully qualified DNS names by appending `.`. For instance, if + # container name is `my.ctr` and the network is named `testnet`, `DNSNames` will + # contain `my.ctr` and the FQDN will be `my.ctr.testnet`. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :dns_names + + sig { params(dns_names: T::Array[String]).void } + attr_writer :dns_names + + # DriverOpts is a mapping of driver options and values. These options are passed + # directly to the driver and are driver specific. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :driver_opts + + # Unique ID for the service endpoint in a Sandbox. + sig { returns(T.nilable(String)) } + attr_reader :endpoint_id + + sig { params(endpoint_id: String).void } + attr_writer :endpoint_id + + # Gateway address for this network. + sig { returns(T.nilable(String)) } + attr_reader :gateway + + sig { params(gateway: String).void } + attr_writer :gateway + + # Global IPv6 address. + sig { returns(T.nilable(String)) } + attr_reader :global_i_pv6_address + + sig { params(global_i_pv6_address: String).void } + attr_writer :global_i_pv6_address + + # Mask length of the global IPv6 address. + sig { returns(T.nilable(Integer)) } + attr_reader :global_i_pv6_prefix_len + + sig { params(global_i_pv6_prefix_len: Integer).void } + attr_writer :global_i_pv6_prefix_len + + # This property determines which endpoint will provide the default gateway for a + # container. The endpoint with the highest priority will be used. If multiple + # endpoints have the same priority, endpoints are lexicographically sorted based + # on their network name, and the one that sorts first is picked. + sig { returns(T.nilable(Integer)) } + attr_reader :gw_priority + + sig { params(gw_priority: Integer).void } + attr_writer :gw_priority + + # IPv4 address. + sig { returns(T.nilable(String)) } + attr_reader :ip_address + + sig { params(ip_address: String).void } + attr_writer :ip_address + + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + sig do + returns( + T.nilable( + Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::IpamConfig + ) + ) + end + attr_reader :ipam_config + + sig do + params( + ipam_config: + T.nilable( + Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::IpamConfig::OrHash + ) + ).void + end + attr_writer :ipam_config + + # Mask length of the IPv4 address. + sig { returns(T.nilable(Integer)) } + attr_reader :ip_prefix_len + + sig { params(ip_prefix_len: Integer).void } + attr_writer :ip_prefix_len + + # IPv6 gateway address. + sig { returns(T.nilable(String)) } + attr_reader :i_pv6_gateway + + sig { params(i_pv6_gateway: String).void } + attr_writer :i_pv6_gateway + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :links + + sig { params(links: T::Array[String]).void } + attr_writer :links + + # MAC address for the endpoint on this network. The network driver might ignore + # this parameter. + sig { returns(T.nilable(String)) } + attr_reader :mac_address + + sig { params(mac_address: String).void } + attr_writer :mac_address + + # Unique ID of the network. + sig { returns(T.nilable(String)) } + attr_reader :network_id + + sig { params(network_id: String).void } + attr_writer :network_id + + # Configuration for a network endpoint. + sig do + params( + aliases: T::Array[String], + dns_names: T::Array[String], + driver_opts: T.nilable(T::Hash[Symbol, String]), + endpoint_id: String, + gateway: String, + global_i_pv6_address: String, + global_i_pv6_prefix_len: Integer, + gw_priority: Integer, + ip_address: String, + ipam_config: + T.nilable( + Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::IpamConfig::OrHash + ), + ip_prefix_len: Integer, + i_pv6_gateway: String, + links: T::Array[String], + mac_address: String, + network_id: String + ).returns(T.attached_class) + end + def self.new( + aliases: nil, + # List of all DNS names an endpoint has on a specific network. This list is based + # on the container name, network aliases, container short ID, and hostname. + # + # These DNS names are non-fully qualified but can contain several dots. You can + # get fully qualified DNS names by appending `.`. For instance, if + # container name is `my.ctr` and the network is named `testnet`, `DNSNames` will + # contain `my.ctr` and the FQDN will be `my.ctr.testnet`. + dns_names: nil, + # DriverOpts is a mapping of driver options and values. These options are passed + # directly to the driver and are driver specific. + driver_opts: nil, + # Unique ID for the service endpoint in a Sandbox. + endpoint_id: nil, + # Gateway address for this network. + gateway: nil, + # Global IPv6 address. + global_i_pv6_address: nil, + # Mask length of the global IPv6 address. + global_i_pv6_prefix_len: nil, + # This property determines which endpoint will provide the default gateway for a + # container. The endpoint with the highest priority will be used. If multiple + # endpoints have the same priority, endpoints are lexicographically sorted based + # on their network name, and the one that sorts first is picked. + gw_priority: nil, + # IPv4 address. + ip_address: nil, + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + ipam_config: nil, + # Mask length of the IPv4 address. + ip_prefix_len: nil, + # IPv6 gateway address. + i_pv6_gateway: nil, + links: nil, + # MAC address for the endpoint on this network. The network driver might ignore + # this parameter. + mac_address: nil, + # Unique ID of the network. + network_id: nil + ) + end + + sig do + override.returns( + { + aliases: T::Array[String], + dns_names: T::Array[String], + driver_opts: T.nilable(T::Hash[Symbol, String]), + endpoint_id: String, + gateway: String, + global_i_pv6_address: String, + global_i_pv6_prefix_len: Integer, + gw_priority: Integer, + ip_address: String, + ipam_config: + T.nilable( + Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::IpamConfig + ), + ip_prefix_len: Integer, + i_pv6_gateway: String, + links: T::Array[String], + mac_address: String, + network_id: String + } + ) + end + def to_hash + end + + class IpamConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::IpamConfig, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :i_pv4_address + + sig { params(i_pv4_address: String).void } + attr_writer :i_pv4_address + + sig { returns(T.nilable(String)) } + attr_reader :i_pv6_address + + sig { params(i_pv6_address: String).void } + attr_writer :i_pv6_address + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :link_local_ips + + sig { params(link_local_ips: T::Array[String]).void } + attr_writer :link_local_ips + + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + sig do + params( + i_pv4_address: String, + i_pv6_address: String, + link_local_ips: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + i_pv4_address: nil, + i_pv6_address: nil, + link_local_ips: nil + ) + end + + sig do + override.returns( + { + i_pv4_address: String, + i_pv6_address: String, + link_local_ips: T::Array[String] + } + ) + end + def to_hash + end + end + end + end + end + end + end +end diff --git a/rbi/docker/models/container_delete_params.rbi b/rbi/docker/models/container_delete_params.rbi new file mode 100644 index 0000000..2b7a948 --- /dev/null +++ b/rbi/docker/models/container_delete_params.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module Docker + module Models + class ContainerDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ContainerDeleteParams, Docker::Internal::AnyHash) + end + + # If the container is running, kill it before removing it. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :force + + sig { params(force: T::Boolean).void } + attr_writer :force + + # Remove the specified link associated with the container. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :link + + sig { params(link: T::Boolean).void } + attr_writer :link + + # Remove anonymous volumes associated with the container. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :v + + sig { params(v: T::Boolean).void } + attr_writer :v + + sig do + params( + force: T::Boolean, + link: T::Boolean, + v: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # If the container is running, kill it before removing it. + force: nil, + # Remove the specified link associated with the container. + link: nil, + # Remove anonymous volumes associated with the container. + v: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + force: T::Boolean, + link: T::Boolean, + v: T::Boolean, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/container_inspect_params.rbi b/rbi/docker/models/container_inspect_params.rbi new file mode 100644 index 0000000..fbab4d0 --- /dev/null +++ b/rbi/docker/models/container_inspect_params.rbi @@ -0,0 +1,43 @@ +# typed: strong + +module Docker + module Models + class ContainerInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ContainerInspectParams, Docker::Internal::AnyHash) + end + + # Return the size of container as fields `SizeRw` and `SizeRootFs` + sig { returns(T.nilable(T::Boolean)) } + attr_reader :size + + sig { params(size: T::Boolean).void } + attr_writer :size + + sig do + params( + size: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Return the size of container as fields `SizeRw` and `SizeRootFs` + size: nil, + request_options: {} + ) + end + + sig do + override.returns( + { size: T::Boolean, request_options: Docker::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/container_kill_params.rbi b/rbi/docker/models/container_kill_params.rbi new file mode 100644 index 0000000..eedbba5 --- /dev/null +++ b/rbi/docker/models/container_kill_params.rbi @@ -0,0 +1,43 @@ +# typed: strong + +module Docker + module Models + class ContainerKillParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ContainerKillParams, Docker::Internal::AnyHash) + end + + # Signal to send to the container as an integer or string (e.g. `SIGINT`). + sig { returns(T.nilable(String)) } + attr_reader :signal + + sig { params(signal: String).void } + attr_writer :signal + + sig do + params( + signal: String, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Signal to send to the container as an integer or string (e.g. `SIGINT`). + signal: nil, + request_options: {} + ) + end + + sig do + override.returns( + { signal: String, request_options: Docker::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/container_list_params.rbi b/rbi/docker/models/container_list_params.rbi new file mode 100644 index 0000000..225df5c --- /dev/null +++ b/rbi/docker/models/container_list_params.rbi @@ -0,0 +1,121 @@ +# typed: strong + +module Docker + module Models + class ContainerListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ContainerListParams, Docker::Internal::AnyHash) + end + + # Return all containers. By default, only running containers are shown. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :all + + sig { params(all: T::Boolean).void } + attr_writer :all + + # Filters to process on the container list, encoded as JSON (a + # `map[string][]string`). For example, `{"status": ["paused"]}` will only return + # paused containers. + # + # Available filters: + # + # - `ancestor`=(`[:]`, ``, or ``) + # - `before`=(`` or ``) + # - `expose`=(`[/]`|`/[]`) + # - `exited=` containers with exit code of `` + # - `health`=(`starting`|`healthy`|`unhealthy`|`none`) + # - `id=` a container's ID + # - `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only) + # - `is-task=`(`true`|`false`) + # - `label=key` or `label="key=value"` of a container label + # - `name=` a container's name + # - `network`=(`` or ``) + # - `publish`=(`[/]`|`/[]`) + # - `since`=(`` or ``) + # - `status=`(`created`|`restarting`|`running`|`removing`|`paused`|`exited`|`dead`) + # - `volume`=(`` or ``) + sig { returns(T.nilable(String)) } + attr_reader :filters + + sig { params(filters: String).void } + attr_writer :filters + + # Return this number of most recently created containers, including non-running + # ones. + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + # Return the size of container as fields `SizeRw` and `SizeRootFs`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :size + + sig { params(size: T::Boolean).void } + attr_writer :size + + sig do + params( + all: T::Boolean, + filters: String, + limit: Integer, + size: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Return all containers. By default, only running containers are shown. + all: nil, + # Filters to process on the container list, encoded as JSON (a + # `map[string][]string`). For example, `{"status": ["paused"]}` will only return + # paused containers. + # + # Available filters: + # + # - `ancestor`=(`[:]`, ``, or ``) + # - `before`=(`` or ``) + # - `expose`=(`[/]`|`/[]`) + # - `exited=` containers with exit code of `` + # - `health`=(`starting`|`healthy`|`unhealthy`|`none`) + # - `id=` a container's ID + # - `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only) + # - `is-task=`(`true`|`false`) + # - `label=key` or `label="key=value"` of a container label + # - `name=` a container's name + # - `network`=(`` or ``) + # - `publish`=(`[/]`|`/[]`) + # - `since`=(`` or ``) + # - `status=`(`created`|`restarting`|`running`|`removing`|`paused`|`exited`|`dead`) + # - `volume`=(`` or ``) + filters: nil, + # Return this number of most recently created containers, including non-running + # ones. + limit: nil, + # Return the size of container as fields `SizeRw` and `SizeRootFs`. + size: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + all: T::Boolean, + filters: String, + limit: Integer, + size: T::Boolean, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/container_list_response.rbi b/rbi/docker/models/container_list_response.rbi new file mode 100644 index 0000000..32c1f17 --- /dev/null +++ b/rbi/docker/models/container_list_response.rbi @@ -0,0 +1,11 @@ +# typed: strong + +module Docker + module Models + ContainerListResponse = + T.let( + Docker::Internal::Type::ArrayOf[Docker::Summary], + Docker::Internal::Type::Converter + ) + end +end diff --git a/rbi/docker/models/container_logs_params.rbi b/rbi/docker/models/container_logs_params.rbi new file mode 100644 index 0000000..7a277df --- /dev/null +++ b/rbi/docker/models/container_logs_params.rbi @@ -0,0 +1,114 @@ +# typed: strong + +module Docker + module Models + class ContainerLogsParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ContainerLogsParams, Docker::Internal::AnyHash) + end + + # Keep connection after returning logs. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :follow + + sig { params(follow: T::Boolean).void } + attr_writer :follow + + # Only return logs since this time, as a UNIX timestamp + sig { returns(T.nilable(Integer)) } + attr_reader :since + + sig { params(since: Integer).void } + attr_writer :since + + # Return logs from `stderr` + sig { returns(T.nilable(T::Boolean)) } + attr_reader :stderr + + sig { params(stderr: T::Boolean).void } + attr_writer :stderr + + # Return logs from `stdout` + sig { returns(T.nilable(T::Boolean)) } + attr_reader :stdout + + sig { params(stdout: T::Boolean).void } + attr_writer :stdout + + # Only return this number of log lines from the end of the logs. Specify as an + # integer or `all` to output all log lines. + sig { returns(T.nilable(String)) } + attr_reader :tail + + sig { params(tail: String).void } + attr_writer :tail + + # Add timestamps to every log line + sig { returns(T.nilable(T::Boolean)) } + attr_reader :timestamps + + sig { params(timestamps: T::Boolean).void } + attr_writer :timestamps + + # Only return logs before this time, as a UNIX timestamp + sig { returns(T.nilable(Integer)) } + attr_reader :until_ + + sig { params(until_: Integer).void } + attr_writer :until_ + + sig do + params( + follow: T::Boolean, + since: Integer, + stderr: T::Boolean, + stdout: T::Boolean, + tail: String, + timestamps: T::Boolean, + until_: Integer, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Keep connection after returning logs. + follow: nil, + # Only return logs since this time, as a UNIX timestamp + since: nil, + # Return logs from `stderr` + stderr: nil, + # Return logs from `stdout` + stdout: nil, + # Only return this number of log lines from the end of the logs. Specify as an + # integer or `all` to output all log lines. + tail: nil, + # Add timestamps to every log line + timestamps: nil, + # Only return logs before this time, as a UNIX timestamp + until_: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + follow: T::Boolean, + since: Integer, + stderr: T::Boolean, + stdout: T::Boolean, + tail: String, + timestamps: T::Boolean, + until_: Integer, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/container_start_params.rbi b/rbi/docker/models/container_start_params.rbi new file mode 100644 index 0000000..641426c --- /dev/null +++ b/rbi/docker/models/container_start_params.rbi @@ -0,0 +1,47 @@ +# typed: strong + +module Docker + module Models + class ContainerStartParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ContainerStartParams, Docker::Internal::AnyHash) + end + + # Override the key sequence for detaching a container. Format is a single + # character `[a-Z]` or `ctrl-` where `` is one of: `a-z`, `@`, `^`, + # `[`, `,` or `_`. + sig { returns(T.nilable(String)) } + attr_reader :detach_keys + + sig { params(detach_keys: String).void } + attr_writer :detach_keys + + sig do + params( + detach_keys: String, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Override the key sequence for detaching a container. Format is a single + # character `[a-Z]` or `ctrl-` where `` is one of: `a-z`, `@`, `^`, + # `[`, `,` or `_`. + detach_keys: nil, + request_options: {} + ) + end + + sig do + override.returns( + { detach_keys: String, request_options: Docker::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/container_stop_params.rbi b/rbi/docker/models/container_stop_params.rbi new file mode 100644 index 0000000..5b10f2e --- /dev/null +++ b/rbi/docker/models/container_stop_params.rbi @@ -0,0 +1,57 @@ +# typed: strong + +module Docker + module Models + class ContainerStopParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ContainerStopParams, Docker::Internal::AnyHash) + end + + # Signal to send to the container as an integer or string (e.g. `SIGINT`). + sig { returns(T.nilable(String)) } + attr_reader :signal + + sig { params(signal: String).void } + attr_writer :signal + + # Number of seconds to wait before killing the container + sig { returns(T.nilable(Integer)) } + attr_reader :t + + sig { params(t: Integer).void } + attr_writer :t + + sig do + params( + signal: String, + t: Integer, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Signal to send to the container as an integer or string (e.g. `SIGINT`). + signal: nil, + # Number of seconds to wait before killing the container + t: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + signal: String, + t: Integer, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/create_request.rbi b/rbi/docker/models/create_request.rbi new file mode 100644 index 0000000..12ce06d --- /dev/null +++ b/rbi/docker/models/create_request.rbi @@ -0,0 +1,695 @@ +# typed: strong + +module Docker + module Models + class CreateRequest < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(Docker::CreateRequest, Docker::Internal::AnyHash) } + + # Cluster-specific options used to create the volume. + sig { returns(T.nilable(Docker::CreateRequest::ClusterVolumeSpec)) } + attr_reader :cluster_volume_spec + + sig do + params( + cluster_volume_spec: Docker::CreateRequest::ClusterVolumeSpec::OrHash + ).void + end + attr_writer :cluster_volume_spec + + # Name of the volume driver to use. + sig { returns(T.nilable(String)) } + attr_reader :driver + + sig { params(driver: String).void } + attr_writer :driver + + # A mapping of driver options and values. These options are passed directly to the + # driver and are driver specific. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :driver_opts + + sig { params(driver_opts: T::Hash[Symbol, String]).void } + attr_writer :driver_opts + + # User-defined key/value metadata. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :labels + + sig { params(labels: T::Hash[Symbol, String]).void } + attr_writer :labels + + # The new volume's name. If not specified, Docker generates a name. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Volume configuration + sig do + params( + cluster_volume_spec: Docker::CreateRequest::ClusterVolumeSpec::OrHash, + driver: String, + driver_opts: T::Hash[Symbol, String], + labels: T::Hash[Symbol, String], + name: String + ).returns(T.attached_class) + end + def self.new( + # Cluster-specific options used to create the volume. + cluster_volume_spec: nil, + # Name of the volume driver to use. + driver: nil, + # A mapping of driver options and values. These options are passed directly to the + # driver and are driver specific. + driver_opts: nil, + # User-defined key/value metadata. + labels: nil, + # The new volume's name. If not specified, Docker generates a name. + name: nil + ) + end + + sig do + override.returns( + { + cluster_volume_spec: Docker::CreateRequest::ClusterVolumeSpec, + driver: String, + driver_opts: T::Hash[Symbol, String], + labels: T::Hash[Symbol, String], + name: String + } + ) + end + def to_hash + end + + class ClusterVolumeSpec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::CreateRequest::ClusterVolumeSpec, + Docker::Internal::AnyHash + ) + end + + # Defines how the volume is used by tasks. + sig do + returns( + T.nilable(Docker::CreateRequest::ClusterVolumeSpec::AccessMode) + ) + end + attr_reader :access_mode + + sig do + params( + access_mode: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::OrHash + ).void + end + attr_writer :access_mode + + # Group defines the volume group of this volume. Volumes belonging to the same + # group can be referred to by group name when creating Services. Referring to a + # volume by group instructs Swarm to treat volumes in that group interchangeably + # for the purpose of scheduling. Volumes with an empty string for a group + # technically all belong to the same, emptystring group. + sig { returns(T.nilable(String)) } + attr_reader :group + + sig { params(group: String).void } + attr_writer :group + + # Cluster-specific options used to create the volume. + sig do + params( + access_mode: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::OrHash, + group: String + ).returns(T.attached_class) + end + def self.new( + # Defines how the volume is used by tasks. + access_mode: nil, + # Group defines the volume group of this volume. Volumes belonging to the same + # group can be referred to by group name when creating Services. Referring to a + # volume by group instructs Swarm to treat volumes in that group interchangeably + # for the purpose of scheduling. Volumes with an empty string for a group + # technically all belong to the same, emptystring group. + group: nil + ) + end + + sig do + override.returns( + { + access_mode: Docker::CreateRequest::ClusterVolumeSpec::AccessMode, + group: String + } + ) + end + def to_hash + end + + class AccessMode < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::CreateRequest::ClusterVolumeSpec::AccessMode, + Docker::Internal::AnyHash + ) + end + + # Requirements for the accessible topology of the volume. These fields are + # optional. For an in-depth description of what these fields mean, see the CSI + # specification. + sig do + returns( + T.nilable( + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements + ) + ) + end + attr_reader :accessibility_requirements + + sig do + params( + accessibility_requirements: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements::OrHash + ).void + end + attr_writer :accessibility_requirements + + # The availability of the volume for use in tasks. + # + # - `active` The volume is fully available for scheduling on the cluster + # - `pause` No new workloads should use the volume, but existing workloads are not + # stopped. + # - `drain` All workloads using this volume should be stopped and rescheduled, and + # no new ones should be started. + sig do + returns( + T.nilable( + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Availability::OrSymbol + ) + ) + end + attr_reader :availability + + sig do + params( + availability: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Availability::OrSymbol + ).void + end + attr_writer :availability + + # The desired capacity that the volume should be created with. If empty, the + # plugin will decide the capacity. + sig do + returns( + T.nilable( + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange + ) + ) + end + attr_reader :capacity_range + + sig do + params( + capacity_range: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange::OrHash + ).void + end + attr_writer :capacity_range + + # Options for using this volume as a Mount-type volume. + # + # Either MountVolume or BlockVolume, but not both, must be + # present. + # + # properties: FsType: type: "string" description: | Specifies the filesystem type + # for the mount volume. Optional. MountFlags: type: "array" description: | Flags + # to pass when mounting the volume. Optional. items: type: "string" BlockVolume: + # type: "object" description: | Options for using this volume as a Block-type + # volume. Intentionally empty. + sig { returns(T.nilable(T.anything)) } + attr_reader :mount_volume + + sig { params(mount_volume: T.anything).void } + attr_writer :mount_volume + + # The set of nodes this volume can be used on at one time. + # + # - `single` The volume may only be scheduled to one node at a time. + # - `multi` the volume may be scheduled to any supported number of nodes at a + # time. + sig do + returns( + T.nilable( + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Scope::OrSymbol + ) + ) + end + attr_reader :scope + + sig do + params( + scope: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Scope::OrSymbol + ).void + end + attr_writer :scope + + # Swarm Secrets that are passed to the CSI storage plugin when operating on this + # volume. + sig do + returns( + T.nilable( + T::Array[ + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Secret + ] + ) + ) + end + attr_reader :secrets + + sig do + params( + secrets: + T::Array[ + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Secret::OrHash + ] + ).void + end + attr_writer :secrets + + # The number and way that different tasks can use this volume at one time. + # + # - `none` The volume may only be used by one task at a time. + # - `readonly` The volume may be used by any number of tasks, but they all must + # mount the volume as readonly + # - `onewriter` The volume may be used by any number of tasks, but only one may + # mount it as read/write. + # - `all` The volume may have any number of readers and writers. + sig do + returns( + T.nilable( + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing::OrSymbol + ) + ) + end + attr_reader :sharing + + sig do + params( + sharing: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing::OrSymbol + ).void + end + attr_writer :sharing + + # Defines how the volume is used by tasks. + sig do + params( + accessibility_requirements: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements::OrHash, + availability: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Availability::OrSymbol, + capacity_range: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange::OrHash, + mount_volume: T.anything, + scope: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Scope::OrSymbol, + secrets: + T::Array[ + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Secret::OrHash + ], + sharing: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Requirements for the accessible topology of the volume. These fields are + # optional. For an in-depth description of what these fields mean, see the CSI + # specification. + accessibility_requirements: nil, + # The availability of the volume for use in tasks. + # + # - `active` The volume is fully available for scheduling on the cluster + # - `pause` No new workloads should use the volume, but existing workloads are not + # stopped. + # - `drain` All workloads using this volume should be stopped and rescheduled, and + # no new ones should be started. + availability: nil, + # The desired capacity that the volume should be created with. If empty, the + # plugin will decide the capacity. + capacity_range: nil, + # Options for using this volume as a Mount-type volume. + # + # Either MountVolume or BlockVolume, but not both, must be + # present. + # + # properties: FsType: type: "string" description: | Specifies the filesystem type + # for the mount volume. Optional. MountFlags: type: "array" description: | Flags + # to pass when mounting the volume. Optional. items: type: "string" BlockVolume: + # type: "object" description: | Options for using this volume as a Block-type + # volume. Intentionally empty. + mount_volume: nil, + # The set of nodes this volume can be used on at one time. + # + # - `single` The volume may only be scheduled to one node at a time. + # - `multi` the volume may be scheduled to any supported number of nodes at a + # time. + scope: nil, + # Swarm Secrets that are passed to the CSI storage plugin when operating on this + # volume. + secrets: nil, + # The number and way that different tasks can use this volume at one time. + # + # - `none` The volume may only be used by one task at a time. + # - `readonly` The volume may be used by any number of tasks, but they all must + # mount the volume as readonly + # - `onewriter` The volume may be used by any number of tasks, but only one may + # mount it as read/write. + # - `all` The volume may have any number of readers and writers. + sharing: nil + ) + end + + sig do + override.returns( + { + accessibility_requirements: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements, + availability: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Availability::OrSymbol, + capacity_range: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange, + mount_volume: T.anything, + scope: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Scope::OrSymbol, + secrets: + T::Array[ + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Secret + ], + sharing: + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing::OrSymbol + } + ) + end + def to_hash + end + + class AccessibilityRequirements < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements, + Docker::Internal::AnyHash + ) + end + + # A list of topologies that the volume should attempt to be provisioned in. + sig { returns(T.nilable(T::Array[T::Hash[Symbol, String]])) } + attr_reader :preferred + + sig { params(preferred: T::Array[T::Hash[Symbol, String]]).void } + attr_writer :preferred + + # A list of required topologies, at least one of which the volume must be + # accessible from. + sig { returns(T.nilable(T::Array[T::Hash[Symbol, String]])) } + attr_reader :requisite + + sig { params(requisite: T::Array[T::Hash[Symbol, String]]).void } + attr_writer :requisite + + # Requirements for the accessible topology of the volume. These fields are + # optional. For an in-depth description of what these fields mean, see the CSI + # specification. + sig do + params( + preferred: T::Array[T::Hash[Symbol, String]], + requisite: T::Array[T::Hash[Symbol, String]] + ).returns(T.attached_class) + end + def self.new( + # A list of topologies that the volume should attempt to be provisioned in. + preferred: nil, + # A list of required topologies, at least one of which the volume must be + # accessible from. + requisite: nil + ) + end + + sig do + override.returns( + { + preferred: T::Array[T::Hash[Symbol, String]], + requisite: T::Array[T::Hash[Symbol, String]] + } + ) + end + def to_hash + end + end + + # The availability of the volume for use in tasks. + # + # - `active` The volume is fully available for scheduling on the cluster + # - `pause` No new workloads should use the volume, but existing workloads are not + # stopped. + # - `drain` All workloads using this volume should be stopped and rescheduled, and + # no new ones should be started. + module Availability + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Availability + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + ACTIVE = + T.let( + :active, + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Availability::TaggedSymbol + ) + PAUSE = + T.let( + :pause, + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Availability::TaggedSymbol + ) + DRAIN = + T.let( + :drain, + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Availability::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Availability::TaggedSymbol + ] + ) + end + def self.values + end + end + + class CapacityRange < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange, + Docker::Internal::AnyHash + ) + end + + # The volume must not be bigger than this. The value of 0 indicates an unspecified + # maximum. + sig { returns(T.nilable(Integer)) } + attr_reader :limit_bytes + + sig { params(limit_bytes: Integer).void } + attr_writer :limit_bytes + + # The volume must be at least this big. The value of 0 indicates an unspecified + # minimum + sig { returns(T.nilable(Integer)) } + attr_reader :required_bytes + + sig { params(required_bytes: Integer).void } + attr_writer :required_bytes + + # The desired capacity that the volume should be created with. If empty, the + # plugin will decide the capacity. + sig do + params(limit_bytes: Integer, required_bytes: Integer).returns( + T.attached_class + ) + end + def self.new( + # The volume must not be bigger than this. The value of 0 indicates an unspecified + # maximum. + limit_bytes: nil, + # The volume must be at least this big. The value of 0 indicates an unspecified + # minimum + required_bytes: nil + ) + end + + sig do + override.returns( + { limit_bytes: Integer, required_bytes: Integer } + ) + end + def to_hash + end + end + + # The set of nodes this volume can be used on at one time. + # + # - `single` The volume may only be scheduled to one node at a time. + # - `multi` the volume may be scheduled to any supported number of nodes at a + # time. + module Scope + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Scope + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SINGLE = + T.let( + :single, + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Scope::TaggedSymbol + ) + MULTI = + T.let( + :multi, + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Scope::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Scope::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Secret < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Secret, + Docker::Internal::AnyHash + ) + end + + # Key is the name of the key of the key-value pair passed to the plugin. + sig { returns(T.nilable(String)) } + attr_reader :key + + sig { params(key: String).void } + attr_writer :key + + # Secret is the swarm Secret object from which to read data. This can be a Secret + # name or ID. The Secret data is retrieved by swarm and used as the value of the + # key-value pair passed to the plugin. + sig { returns(T.nilable(String)) } + attr_reader :secret + + sig { params(secret: String).void } + attr_writer :secret + + # One cluster volume secret entry. Defines a key-value pair that is passed to the + # plugin. + sig do + params(key: String, secret: String).returns(T.attached_class) + end + def self.new( + # Key is the name of the key of the key-value pair passed to the plugin. + key: nil, + # Secret is the swarm Secret object from which to read data. This can be a Secret + # name or ID. The Secret data is retrieved by swarm and used as the value of the + # key-value pair passed to the plugin. + secret: nil + ) + end + + sig { override.returns({ key: String, secret: String }) } + def to_hash + end + end + + # The number and way that different tasks can use this volume at one time. + # + # - `none` The volume may only be used by one task at a time. + # - `readonly` The volume may be used by any number of tasks, but they all must + # mount the volume as readonly + # - `onewriter` The volume may be used by any number of tasks, but only one may + # mount it as read/write. + # - `all` The volume may have any number of readers and writers. + module Sharing + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + NONE = + T.let( + :none, + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing::TaggedSymbol + ) + READONLY = + T.let( + :readonly, + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing::TaggedSymbol + ) + ONEWRITER = + T.let( + :onewriter, + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing::TaggedSymbol + ) + ALL = + T.let( + :all, + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Sharing::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + end + end +end diff --git a/rbi/docker/models/create_response.rbi b/rbi/docker/models/create_response.rbi new file mode 100644 index 0000000..8102dfe --- /dev/null +++ b/rbi/docker/models/create_response.rbi @@ -0,0 +1,36 @@ +# typed: strong + +module Docker + module Models + class CreateResponse < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::CreateResponse, Docker::Internal::AnyHash) + end + + # The ID of the created container + sig { returns(String) } + attr_accessor :id + + # Warnings encountered when creating the container + sig { returns(T::Array[String]) } + attr_accessor :warnings + + # OK response to ContainerCreate operation + sig do + params(id: String, warnings: T::Array[String]).returns(T.attached_class) + end + def self.new( + # The ID of the created container + id:, + # Warnings encountered when creating the container + warnings: + ) + end + + sig { override.returns({ id: String, warnings: T::Array[String] }) } + def to_hash + end + end + end +end diff --git a/rbi/docker/models/error.rbi b/rbi/docker/models/error.rbi new file mode 100644 index 0000000..1fa64c0 --- /dev/null +++ b/rbi/docker/models/error.rbi @@ -0,0 +1,25 @@ +# typed: strong + +module Docker + module Models + class Error < Docker::Internal::Type::BaseModel + OrHash = T.type_alias { T.any(Docker::Error, Docker::Internal::AnyHash) } + + # The error message. + sig { returns(String) } + attr_accessor :message + + # Represents an error. + sig { params(message: String).returns(T.attached_class) } + def self.new( + # The error message. + message: + ) + end + + sig { override.returns({ message: String }) } + def to_hash + end + end + end +end diff --git a/rbi/docker/models/image.rbi b/rbi/docker/models/image.rbi new file mode 100644 index 0000000..255254b --- /dev/null +++ b/rbi/docker/models/image.rbi @@ -0,0 +1,2239 @@ +# typed: strong + +module Docker + module Models + class Image < Docker::Internal::Type::BaseModel + OrHash = T.type_alias { T.any(Docker::Image, Docker::Internal::AnyHash) } + + # Hardware CPU architecture that the image runs on. + sig { returns(T.nilable(String)) } + attr_reader :architecture + + sig { params(architecture: String).void } + attr_writer :architecture + + # Name of the author that was specified when committing the image, or as specified + # through MAINTAINER (deprecated) in the Dockerfile. + sig { returns(T.nilable(String)) } + attr_accessor :author + + # Optional message that was set when committing or importing the image. + sig { returns(T.nilable(String)) } + attr_accessor :comment + + # Configuration of the image. These fields are used as defaults when starting a + # container from the image. + sig { returns(T.nilable(Docker::Image::Config)) } + attr_reader :config + + sig { params(config: Docker::Image::Config::OrHash).void } + attr_writer :config + + # Date and time at which the image was created, formatted in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + # + # This information is only available if present in the image, and omitted + # otherwise. + sig { returns(T.nilable(String)) } + attr_accessor :created + + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + sig { returns(T.nilable(Docker::Image::Descriptor)) } + attr_reader :descriptor + + sig { params(descriptor: Docker::Image::Descriptor::OrHash).void } + attr_writer :descriptor + + # Information about the storage driver used to store the container's and image's + # filesystem. + sig { returns(T.nilable(Docker::Image::GraphDriver)) } + attr_reader :graph_driver + + sig { params(graph_driver: Docker::Image::GraphDriver::OrHash).void } + attr_writer :graph_driver + + # ID is the content-addressable ID of an image. + # + # This identifier is a content-addressable digest calculated from the image's + # configuration (which includes the digests of layers used by the image). + # + # Note that this digest differs from the `RepoDigests` below, which holds digests + # of image manifests that reference the image. + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Identity holds information about the identity and origin of the image. This is + # trusted information verified by the daemon and cannot be modified by tagging an + # image to a different name. + sig { returns(T.nilable(Docker::Image::Identity)) } + attr_reader :identity + + sig { params(identity: Docker::Image::Identity::OrHash).void } + attr_writer :identity + + # Manifests is a list of image manifests available in this image. It provides a + # more detailed view of the platform-specific image manifests or other + # image-attached data like build attestations. + # + # Only available if the daemon provides a multi-platform image store and the + # `manifests` option is set in the inspect request. + # + # WARNING: This is experimental and may change at any time without any backward + # compatibility. + sig { returns(T.nilable(T::Array[Docker::Image::Manifest])) } + attr_accessor :manifests + + # Additional metadata of the image in the local cache. This information is local + # to the daemon, and not part of the image itself. + sig { returns(T.nilable(Docker::Image::Metadata)) } + attr_reader :metadata + + sig { params(metadata: Docker::Image::Metadata::OrHash).void } + attr_writer :metadata + + # Operating System the image is built to run on. + sig { returns(T.nilable(String)) } + attr_reader :os + + sig { params(os: String).void } + attr_writer :os + + # Operating System version the image is built to run on (especially for Windows). + sig { returns(T.nilable(String)) } + attr_accessor :os_version + + # List of content-addressable digests of locally available image manifests that + # the image is referenced from. Multiple manifests can refer to the same image. + # + # These digests are usually only available if the image was either pulled from a + # registry, or if the image was pushed to a registry, which is when the manifest + # is generated and its digest calculated. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :repo_digests + + sig { params(repo_digests: T::Array[String]).void } + attr_writer :repo_digests + + # List of image names/tags in the local image cache that reference this image. + # + # Multiple image tags can refer to the same image, and this list may be empty if + # no tags reference the image, in which case the image is "untagged", in which + # case it can still be referenced by its ID. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :repo_tags + + sig { params(repo_tags: T::Array[String]).void } + attr_writer :repo_tags + + # Information about the image's RootFS, including the layer IDs. + sig { returns(T.nilable(Docker::Image::RootFs)) } + attr_reader :root_fs + + sig { params(root_fs: Docker::Image::RootFs::OrHash).void } + attr_writer :root_fs + + # Total size of the image including all layers it is composed of. + sig { returns(T.nilable(Integer)) } + attr_reader :size + + sig { params(size: Integer).void } + attr_writer :size + + # CPU architecture variant (presently ARM-only). + sig { returns(T.nilable(String)) } + attr_accessor :variant + + # Information about an image in the local image cache. + sig do + params( + architecture: String, + author: T.nilable(String), + comment: T.nilable(String), + config: Docker::Image::Config::OrHash, + created: T.nilable(String), + descriptor: Docker::Image::Descriptor::OrHash, + graph_driver: Docker::Image::GraphDriver::OrHash, + id: String, + identity: Docker::Image::Identity::OrHash, + manifests: T.nilable(T::Array[Docker::Image::Manifest::OrHash]), + metadata: Docker::Image::Metadata::OrHash, + os: String, + os_version: T.nilable(String), + repo_digests: T::Array[String], + repo_tags: T::Array[String], + root_fs: Docker::Image::RootFs::OrHash, + size: Integer, + variant: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + # Hardware CPU architecture that the image runs on. + architecture: nil, + # Name of the author that was specified when committing the image, or as specified + # through MAINTAINER (deprecated) in the Dockerfile. + author: nil, + # Optional message that was set when committing or importing the image. + comment: nil, + # Configuration of the image. These fields are used as defaults when starting a + # container from the image. + config: nil, + # Date and time at which the image was created, formatted in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + # + # This information is only available if present in the image, and omitted + # otherwise. + created: nil, + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + descriptor: nil, + # Information about the storage driver used to store the container's and image's + # filesystem. + graph_driver: nil, + # ID is the content-addressable ID of an image. + # + # This identifier is a content-addressable digest calculated from the image's + # configuration (which includes the digests of layers used by the image). + # + # Note that this digest differs from the `RepoDigests` below, which holds digests + # of image manifests that reference the image. + id: nil, + # Identity holds information about the identity and origin of the image. This is + # trusted information verified by the daemon and cannot be modified by tagging an + # image to a different name. + identity: nil, + # Manifests is a list of image manifests available in this image. It provides a + # more detailed view of the platform-specific image manifests or other + # image-attached data like build attestations. + # + # Only available if the daemon provides a multi-platform image store and the + # `manifests` option is set in the inspect request. + # + # WARNING: This is experimental and may change at any time without any backward + # compatibility. + manifests: nil, + # Additional metadata of the image in the local cache. This information is local + # to the daemon, and not part of the image itself. + metadata: nil, + # Operating System the image is built to run on. + os: nil, + # Operating System version the image is built to run on (especially for Windows). + os_version: nil, + # List of content-addressable digests of locally available image manifests that + # the image is referenced from. Multiple manifests can refer to the same image. + # + # These digests are usually only available if the image was either pulled from a + # registry, or if the image was pushed to a registry, which is when the manifest + # is generated and its digest calculated. + repo_digests: nil, + # List of image names/tags in the local image cache that reference this image. + # + # Multiple image tags can refer to the same image, and this list may be empty if + # no tags reference the image, in which case the image is "untagged", in which + # case it can still be referenced by its ID. + repo_tags: nil, + # Information about the image's RootFS, including the layer IDs. + root_fs: nil, + # Total size of the image including all layers it is composed of. + size: nil, + # CPU architecture variant (presently ARM-only). + variant: nil + ) + end + + sig do + override.returns( + { + architecture: String, + author: T.nilable(String), + comment: T.nilable(String), + config: Docker::Image::Config, + created: T.nilable(String), + descriptor: Docker::Image::Descriptor, + graph_driver: Docker::Image::GraphDriver, + id: String, + identity: Docker::Image::Identity, + manifests: T.nilable(T::Array[Docker::Image::Manifest]), + metadata: Docker::Image::Metadata, + os: String, + os_version: T.nilable(String), + repo_digests: T::Array[String], + repo_tags: T::Array[String], + root_fs: Docker::Image::RootFs, + size: Integer, + variant: T.nilable(String) + } + ) + end + def to_hash + end + + class Config < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Image::Config, Docker::Internal::AnyHash) + end + + # Command is already escaped (Windows only) + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :args_escaped + + # Command to run specified as a string or an array of strings. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :cmd + + sig { params(cmd: T::Array[String]).void } + attr_writer :cmd + + # The entry point for the container as a string or an array of strings. + # + # If the array consists of exactly one empty string (`[""]`) then the entry point + # is reset to system default (i.e., the entry point used by docker when there is + # no `ENTRYPOINT` instruction in the `Dockerfile`). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :entrypoint + + sig { params(entrypoint: T::Array[String]).void } + attr_writer :entrypoint + + # A list of environment variables to set inside the container in the form + # `["VAR=value", ...]`. A variable without `=` is removed from the environment, + # rather than to have an empty value. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :env + + sig { params(env: T::Array[String]).void } + attr_writer :env + + # An object mapping ports to an empty object in the form: + # + # `{"/": {}}` + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :exposed_ports + + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + sig { returns(T.nilable(Docker::Image::Config::Healthcheck)) } + attr_reader :healthcheck + + sig do + params(healthcheck: Docker::Image::Config::Healthcheck::OrHash).void + end + attr_writer :healthcheck + + # User-defined key/value metadata. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :labels + + sig { params(labels: T::Hash[Symbol, String]).void } + attr_writer :labels + + # `ONBUILD` metadata that were defined in the image's `Dockerfile`. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :on_build + + # Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :shell + + # Signal to stop a container as a string or unsigned integer. + sig { returns(T.nilable(String)) } + attr_accessor :stop_signal + + # The user that commands are run as inside the container. + sig { returns(T.nilable(String)) } + attr_reader :user + + sig { params(user: String).void } + attr_writer :user + + # An object mapping mount point paths inside the container to empty objects. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :volumes + + sig { params(volumes: T::Hash[Symbol, T.anything]).void } + attr_writer :volumes + + # The working directory for commands to run in. + sig { returns(T.nilable(String)) } + attr_reader :working_dir + + sig { params(working_dir: String).void } + attr_writer :working_dir + + # Configuration of the image. These fields are used as defaults when starting a + # container from the image. + sig do + params( + args_escaped: T.nilable(T::Boolean), + cmd: T::Array[String], + entrypoint: T::Array[String], + env: T::Array[String], + exposed_ports: T.nilable(T::Hash[Symbol, T.anything]), + healthcheck: Docker::Image::Config::Healthcheck::OrHash, + labels: T::Hash[Symbol, String], + on_build: T.nilable(T::Array[String]), + shell: T.nilable(T::Array[String]), + stop_signal: T.nilable(String), + user: String, + volumes: T::Hash[Symbol, T.anything], + working_dir: String + ).returns(T.attached_class) + end + def self.new( + # Command is already escaped (Windows only) + args_escaped: nil, + # Command to run specified as a string or an array of strings. + cmd: nil, + # The entry point for the container as a string or an array of strings. + # + # If the array consists of exactly one empty string (`[""]`) then the entry point + # is reset to system default (i.e., the entry point used by docker when there is + # no `ENTRYPOINT` instruction in the `Dockerfile`). + entrypoint: nil, + # A list of environment variables to set inside the container in the form + # `["VAR=value", ...]`. A variable without `=` is removed from the environment, + # rather than to have an empty value. + env: nil, + # An object mapping ports to an empty object in the form: + # + # `{"/": {}}` + exposed_ports: nil, + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + healthcheck: nil, + # User-defined key/value metadata. + labels: nil, + # `ONBUILD` metadata that were defined in the image's `Dockerfile`. + on_build: nil, + # Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. + shell: nil, + # Signal to stop a container as a string or unsigned integer. + stop_signal: nil, + # The user that commands are run as inside the container. + user: nil, + # An object mapping mount point paths inside the container to empty objects. + volumes: nil, + # The working directory for commands to run in. + working_dir: nil + ) + end + + sig do + override.returns( + { + args_escaped: T.nilable(T::Boolean), + cmd: T::Array[String], + entrypoint: T::Array[String], + env: T::Array[String], + exposed_ports: T.nilable(T::Hash[Symbol, T.anything]), + healthcheck: Docker::Image::Config::Healthcheck, + labels: T::Hash[Symbol, String], + on_build: T.nilable(T::Array[String]), + shell: T.nilable(T::Array[String]), + stop_signal: T.nilable(String), + user: String, + volumes: T::Hash[Symbol, T.anything], + working_dir: String + } + ) + end + def to_hash + end + + class Healthcheck < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Image::Config::Healthcheck, + Docker::Internal::AnyHash + ) + end + + # The time to wait between checks in nanoseconds. It should be 0 or at least + # 1000000 (1 ms). 0 means inherit. + sig { returns(T.nilable(Integer)) } + attr_reader :interval + + sig { params(interval: Integer).void } + attr_writer :interval + + # The number of consecutive failures needed to consider a container as unhealthy. + # 0 means inherit. + sig { returns(T.nilable(Integer)) } + attr_reader :retries + + sig { params(retries: Integer).void } + attr_writer :retries + + # The time to wait between checks in nanoseconds during the start period. It + # should be 0 or at least 1000000 (1 ms). 0 means inherit. + sig { returns(T.nilable(Integer)) } + attr_reader :start_interval + + sig { params(start_interval: Integer).void } + attr_writer :start_interval + + # Start period for the container to initialize before starting health-retries + # countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means + # inherit. + sig { returns(T.nilable(Integer)) } + attr_reader :start_period + + sig { params(start_period: Integer).void } + attr_writer :start_period + + # The test to perform. Possible values are: + # + # - `[]` inherit healthcheck from image or parent image + # - `["NONE"]` disable healthcheck + # - `["CMD", args...]` exec arguments directly + # - `["CMD-SHELL", command]` run command with system's default shell + # + # A non-zero exit code indicates a failed healthcheck: + # + # - `0` healthy + # - `1` unhealthy + # - `2` reserved (treated as unhealthy) + # - other values: error running probe + sig { returns(T.nilable(T::Array[String])) } + attr_reader :test_ + + sig { params(test_: T::Array[String]).void } + attr_writer :test_ + + # The time to wait before considering the check to have hung. It should be 0 or at + # least 1000000 (1 ms). 0 means inherit. + # + # If the health check command does not complete within this timeout, the check is + # considered failed and the health check process is forcibly terminated without a + # graceful shutdown. + sig { returns(T.nilable(Integer)) } + attr_reader :timeout + + sig { params(timeout: Integer).void } + attr_writer :timeout + + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + sig do + params( + interval: Integer, + retries: Integer, + start_interval: Integer, + start_period: Integer, + test_: T::Array[String], + timeout: Integer + ).returns(T.attached_class) + end + def self.new( + # The time to wait between checks in nanoseconds. It should be 0 or at least + # 1000000 (1 ms). 0 means inherit. + interval: nil, + # The number of consecutive failures needed to consider a container as unhealthy. + # 0 means inherit. + retries: nil, + # The time to wait between checks in nanoseconds during the start period. It + # should be 0 or at least 1000000 (1 ms). 0 means inherit. + start_interval: nil, + # Start period for the container to initialize before starting health-retries + # countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means + # inherit. + start_period: nil, + # The test to perform. Possible values are: + # + # - `[]` inherit healthcheck from image or parent image + # - `["NONE"]` disable healthcheck + # - `["CMD", args...]` exec arguments directly + # - `["CMD-SHELL", command]` run command with system's default shell + # + # A non-zero exit code indicates a failed healthcheck: + # + # - `0` healthy + # - `1` unhealthy + # - `2` reserved (treated as unhealthy) + # - other values: error running probe + test_: nil, + # The time to wait before considering the check to have hung. It should be 0 or at + # least 1000000 (1 ms). 0 means inherit. + # + # If the health check command does not complete within this timeout, the check is + # considered failed and the health check process is forcibly terminated without a + # graceful shutdown. + timeout: nil + ) + end + + sig do + override.returns( + { + interval: Integer, + retries: Integer, + start_interval: Integer, + start_period: Integer, + test_: T::Array[String], + timeout: Integer + } + ) + end + def to_hash + end + end + end + + class Descriptor < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Image::Descriptor, Docker::Internal::AnyHash) + end + + # Arbitrary metadata relating to the targeted content. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :annotations + + # ArtifactType is the IANA media type of this artifact. + sig { returns(T.nilable(String)) } + attr_accessor :artifact_type + + # Data is an embedding of the targeted content. This is encoded as a base64 string + # when marshalled to JSON (automatically, by encoding/json). If present, Data can + # be used directly to avoid fetching the targeted content. + sig { returns(T.nilable(String)) } + attr_accessor :data + + # The digest of the targeted content. + sig { returns(T.nilable(String)) } + attr_reader :digest + + sig { params(digest: String).void } + attr_writer :digest + + # The media type of the object this schema refers to. + sig { returns(T.nilable(String)) } + attr_reader :media_type + + sig { params(media_type: String).void } + attr_writer :media_type + + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + sig { returns(T.nilable(Docker::Image::Descriptor::Platform)) } + attr_reader :platform + + sig do + params( + platform: T.nilable(Docker::Image::Descriptor::Platform::OrHash) + ).void + end + attr_writer :platform + + # The size in bytes of the blob. + sig { returns(T.nilable(Integer)) } + attr_reader :size + + sig { params(size: Integer).void } + attr_writer :size + + # List of URLs from which this object MAY be downloaded. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :urls + + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + sig do + params( + annotations: T.nilable(T::Hash[Symbol, String]), + artifact_type: T.nilable(String), + data: T.nilable(String), + digest: String, + media_type: String, + platform: T.nilable(Docker::Image::Descriptor::Platform::OrHash), + size: Integer, + urls: T.nilable(T::Array[String]) + ).returns(T.attached_class) + end + def self.new( + # Arbitrary metadata relating to the targeted content. + annotations: nil, + # ArtifactType is the IANA media type of this artifact. + artifact_type: nil, + # Data is an embedding of the targeted content. This is encoded as a base64 string + # when marshalled to JSON (automatically, by encoding/json). If present, Data can + # be used directly to avoid fetching the targeted content. + data: nil, + # The digest of the targeted content. + digest: nil, + # The media type of the object this schema refers to. + media_type: nil, + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + platform: nil, + # The size in bytes of the blob. + size: nil, + # List of URLs from which this object MAY be downloaded. + urls: nil + ) + end + + sig do + override.returns( + { + annotations: T.nilable(T::Hash[Symbol, String]), + artifact_type: T.nilable(String), + data: T.nilable(String), + digest: String, + media_type: String, + platform: T.nilable(Docker::Image::Descriptor::Platform), + size: Integer, + urls: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + class Platform < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Image::Descriptor::Platform, + Docker::Internal::AnyHash + ) + end + + # The CPU architecture, for example `amd64` or `ppc64`. + sig { returns(T.nilable(String)) } + attr_reader :architecture + + sig { params(architecture: String).void } + attr_writer :architecture + + # The operating system, for example `linux` or `windows`. + sig { returns(T.nilable(String)) } + attr_reader :os + + sig { params(os: String).void } + attr_writer :os + + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :os_features + + sig { params(os_features: T::Array[String]).void } + attr_writer :os_features + + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + sig { returns(T.nilable(String)) } + attr_reader :os_version + + sig { params(os_version: String).void } + attr_writer :os_version + + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + sig { returns(T.nilable(String)) } + attr_reader :variant + + sig { params(variant: String).void } + attr_writer :variant + + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + sig do + params( + architecture: String, + os: String, + os_features: T::Array[String], + os_version: String, + variant: String + ).returns(T.attached_class) + end + def self.new( + # The CPU architecture, for example `amd64` or `ppc64`. + architecture: nil, + # The operating system, for example `linux` or `windows`. + os: nil, + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + os_features: nil, + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + os_version: nil, + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + variant: nil + ) + end + + sig do + override.returns( + { + architecture: String, + os: String, + os_features: T::Array[String], + os_version: String, + variant: String + } + ) + end + def to_hash + end + end + end + + class GraphDriver < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Image::GraphDriver, Docker::Internal::AnyHash) + end + + # Low-level storage metadata, provided as key/value pairs. + # + # This information is driver-specific, and depends on the storage-driver in use, + # and should be used for informational purposes only. + sig { returns(T::Hash[Symbol, String]) } + attr_accessor :data + + # Name of the storage driver. + sig { returns(String) } + attr_accessor :name + + # Information about the storage driver used to store the container's and image's + # filesystem. + sig do + params(data: T::Hash[Symbol, String], name: String).returns( + T.attached_class + ) + end + def self.new( + # Low-level storage metadata, provided as key/value pairs. + # + # This information is driver-specific, and depends on the storage-driver in use, + # and should be used for informational purposes only. + data:, + # Name of the storage driver. + name: + ) + end + + sig do + override.returns({ data: T::Hash[Symbol, String], name: String }) + end + def to_hash + end + end + + class Identity < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Image::Identity, Docker::Internal::AnyHash) + end + + # Build contains build reference information if image was created via build. + sig { returns(T.nilable(T::Array[Docker::Image::Identity::Build])) } + attr_reader :build + + sig do + params(build: T::Array[Docker::Image::Identity::Build::OrHash]).void + end + attr_writer :build + + # Pull contains remote location information if image was created via pull. If + # image was pulled via mirror, this contains the original repository location. + # After successful push this images also contains the pushed repository location. + sig { returns(T.nilable(T::Array[Docker::Image::Identity::Pull])) } + attr_reader :pull + + sig do + params(pull: T::Array[Docker::Image::Identity::Pull::OrHash]).void + end + attr_writer :pull + + # Signature contains the properties of verified signatures for the image. + sig { returns(T.nilable(T::Array[Docker::Image::Identity::Signature])) } + attr_reader :signature + + sig do + params( + signature: T::Array[Docker::Image::Identity::Signature::OrHash] + ).void + end + attr_writer :signature + + # Identity holds information about the identity and origin of the image. This is + # trusted information verified by the daemon and cannot be modified by tagging an + # image to a different name. + sig do + params( + build: T::Array[Docker::Image::Identity::Build::OrHash], + pull: T::Array[Docker::Image::Identity::Pull::OrHash], + signature: T::Array[Docker::Image::Identity::Signature::OrHash] + ).returns(T.attached_class) + end + def self.new( + # Build contains build reference information if image was created via build. + build: nil, + # Pull contains remote location information if image was created via pull. If + # image was pulled via mirror, this contains the original repository location. + # After successful push this images also contains the pushed repository location. + pull: nil, + # Signature contains the properties of verified signatures for the image. + signature: nil + ) + end + + sig do + override.returns( + { + build: T::Array[Docker::Image::Identity::Build], + pull: T::Array[Docker::Image::Identity::Pull], + signature: T::Array[Docker::Image::Identity::Signature] + } + ) + end + def to_hash + end + + class Build < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Image::Identity::Build, Docker::Internal::AnyHash) + end + + # CreatedAt is the time when the build ran. + sig { returns(T.nilable(Time)) } + attr_reader :created_at + + sig { params(created_at: Time).void } + attr_writer :created_at + + # Ref is the identifier for the build request. This reference can be used to look + # up the build details in BuildKit history API. + sig { returns(T.nilable(String)) } + attr_reader :ref + + sig { params(ref: String).void } + attr_writer :ref + + # BuildIdentity contains build reference information if image was created via + # build. + sig do + params(created_at: Time, ref: String).returns(T.attached_class) + end + def self.new( + # CreatedAt is the time when the build ran. + created_at: nil, + # Ref is the identifier for the build request. This reference can be used to look + # up the build details in BuildKit history API. + ref: nil + ) + end + + sig { override.returns({ created_at: Time, ref: String }) } + def to_hash + end + end + + class Pull < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Image::Identity::Pull, Docker::Internal::AnyHash) + end + + # Repository is the remote repository location the image was pulled from. + sig { returns(T.nilable(String)) } + attr_reader :repository + + sig { params(repository: String).void } + attr_writer :repository + + # PullIdentity contains remote location information if image was created via pull. + # If image was pulled via mirror, this contains the original repository location. + sig { params(repository: String).returns(T.attached_class) } + def self.new( + # Repository is the remote repository location the image was pulled from. + repository: nil + ) + end + + sig { override.returns({ repository: String }) } + def to_hash + end + end + + class Signature < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Image::Identity::Signature, + Docker::Internal::AnyHash + ) + end + + # DockerReference is the Docker image reference associated with the signature. + # This is an optional field only present in older hashedrecord signatures. + sig { returns(T.nilable(String)) } + attr_reader :docker_reference + + sig { params(docker_reference: String).void } + attr_writer :docker_reference + + # Error contains error information if signature verification failed. Other fields + # will be empty in this case. + sig { returns(T.nilable(String)) } + attr_reader :error + + sig { params(error: String).void } + attr_writer :error + + # KnownSignerIdentity is an identifier for a special signer identity that is known + # to the implementation. + sig do + returns( + T.nilable( + Docker::Image::Identity::Signature::KnownSigner::TaggedSymbol + ) + ) + end + attr_reader :known_signer + + sig do + params( + known_signer: + Docker::Image::Identity::Signature::KnownSigner::OrSymbol + ).void + end + attr_writer :known_signer + + # Name is a textual description summarizing the type of signature. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # SignatureType is the type of signature format. + sig do + returns( + T.nilable( + Docker::Image::Identity::Signature::SignatureType::TaggedSymbol + ) + ) + end + attr_reader :signature_type + + sig do + params( + signature_type: + Docker::Image::Identity::Signature::SignatureType::OrSymbol + ).void + end + attr_writer :signature_type + + # SignerIdentity contains information about the signer certificate used to sign + # the image. + sig { returns(T.nilable(Docker::Image::Identity::Signature::Signer)) } + attr_reader :signer + + sig do + params( + signer: Docker::Image::Identity::Signature::Signer::OrHash + ).void + end + attr_writer :signer + + # Timestamps contains a list of verified signed timestamps for the signature. + sig do + returns( + T.nilable(T::Array[Docker::Image::Identity::Signature::Timestamp]) + ) + end + attr_reader :timestamps + + sig do + params( + timestamps: + T::Array[Docker::Image::Identity::Signature::Timestamp::OrHash] + ).void + end + attr_writer :timestamps + + # Warnings contains any warnings that occurred during signature verification. For + # example, if there was no internet connectivity and cached trust roots were used. + # Warning does not indicate a failed verification but may point to configuration + # issues. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :warnings + + sig { params(warnings: T::Array[String]).void } + attr_writer :warnings + + # SignatureIdentity contains the properties of verified signatures for the image. + sig do + params( + docker_reference: String, + error: String, + known_signer: + Docker::Image::Identity::Signature::KnownSigner::OrSymbol, + name: String, + signature_type: + Docker::Image::Identity::Signature::SignatureType::OrSymbol, + signer: Docker::Image::Identity::Signature::Signer::OrHash, + timestamps: + T::Array[Docker::Image::Identity::Signature::Timestamp::OrHash], + warnings: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # DockerReference is the Docker image reference associated with the signature. + # This is an optional field only present in older hashedrecord signatures. + docker_reference: nil, + # Error contains error information if signature verification failed. Other fields + # will be empty in this case. + error: nil, + # KnownSignerIdentity is an identifier for a special signer identity that is known + # to the implementation. + known_signer: nil, + # Name is a textual description summarizing the type of signature. + name: nil, + # SignatureType is the type of signature format. + signature_type: nil, + # SignerIdentity contains information about the signer certificate used to sign + # the image. + signer: nil, + # Timestamps contains a list of verified signed timestamps for the signature. + timestamps: nil, + # Warnings contains any warnings that occurred during signature verification. For + # example, if there was no internet connectivity and cached trust roots were used. + # Warning does not indicate a failed verification but may point to configuration + # issues. + warnings: nil + ) + end + + sig do + override.returns( + { + docker_reference: String, + error: String, + known_signer: + Docker::Image::Identity::Signature::KnownSigner::TaggedSymbol, + name: String, + signature_type: + Docker::Image::Identity::Signature::SignatureType::TaggedSymbol, + signer: Docker::Image::Identity::Signature::Signer, + timestamps: + T::Array[Docker::Image::Identity::Signature::Timestamp], + warnings: T::Array[String] + } + ) + end + def to_hash + end + + # KnownSignerIdentity is an identifier for a special signer identity that is known + # to the implementation. + module KnownSigner + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Image::Identity::Signature::KnownSigner) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DHI = + T.let( + :DHI, + Docker::Image::Identity::Signature::KnownSigner::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Image::Identity::Signature::KnownSigner::TaggedSymbol + ] + ) + end + def self.values + end + end + + # SignatureType is the type of signature format. + module SignatureType + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Image::Identity::Signature::SignatureType) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + BUNDLE_V0_3 = + T.let( + :"bundle-v0.3", + Docker::Image::Identity::Signature::SignatureType::TaggedSymbol + ) + SIMPLESIGNING_V1 = + T.let( + :"simplesigning-v1", + Docker::Image::Identity::Signature::SignatureType::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Image::Identity::Signature::SignatureType::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Signer < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Image::Identity::Signature::Signer, + Docker::Internal::AnyHash + ) + end + + # Immutable reference to the specific version of the top-level/initiating build + # instructions. + sig { returns(T.nilable(String)) } + attr_reader :build_config_digest + + sig { params(build_config_digest: String).void } + attr_writer :build_config_digest + + # Build Config URL to the top-level/initiating build instructions. + sig { returns(T.nilable(String)) } + attr_reader :build_config_uri + + sig { params(build_config_uri: String).void } + attr_writer :build_config_uri + + # Immutable reference to the specific version of the build instructions that is + # responsible for signing. + sig { returns(T.nilable(String)) } + attr_reader :build_signer_digest + + sig { params(build_signer_digest: String).void } + attr_writer :build_signer_digest + + # Reference to specific build instructions that are responsible for signing. + sig { returns(T.nilable(String)) } + attr_reader :build_signer_uri + + sig { params(build_signer_uri: String).void } + attr_writer :build_signer_uri + + # Event or action that initiated the build. + sig { returns(T.nilable(String)) } + attr_reader :build_trigger + + sig { params(build_trigger: String).void } + attr_writer :build_trigger + + # CertificateIssuer is the certificate issuer. + sig { returns(T.nilable(String)) } + attr_reader :certificate_issuer + + sig { params(certificate_issuer: String).void } + attr_writer :certificate_issuer + + # The OIDC issuer. Should match `iss` claim of ID token or, in the case of a + # federated login like Dex it should match the issuer URL of the upstream issuer. + # The issuer is not set the extensions are invalid and will fail to render. + sig { returns(T.nilable(String)) } + attr_reader :issuer + + sig { params(issuer: String).void } + attr_writer :issuer + + # Run Invocation URL to uniquely identify the build execution. + sig { returns(T.nilable(String)) } + attr_reader :run_invocation_uri + + sig { params(run_invocation_uri: String).void } + attr_writer :run_invocation_uri + + # Specifies whether the build took place in platform-hosted cloud infrastructure + # or customer/self-hosted infrastructure. + sig { returns(T.nilable(String)) } + attr_reader :runner_environment + + sig { params(runner_environment: String).void } + attr_writer :runner_environment + + # Immutable reference to a specific version of the source code that the build was + # based upon. + sig { returns(T.nilable(String)) } + attr_reader :source_repository_digest + + sig { params(source_repository_digest: String).void } + attr_writer :source_repository_digest + + # Immutable identifier for the source repository the workflow was based upon. + sig { returns(T.nilable(String)) } + attr_reader :source_repository_identifier + + sig { params(source_repository_identifier: String).void } + attr_writer :source_repository_identifier + + # Immutable identifier for the owner of the source repository that the workflow + # was based upon. + sig { returns(T.nilable(String)) } + attr_reader :source_repository_owner_identifier + + sig { params(source_repository_owner_identifier: String).void } + attr_writer :source_repository_owner_identifier + + # Source repository owner URL of the owner of the source repository that the build + # was based on. + sig { returns(T.nilable(String)) } + attr_reader :source_repository_owner_uri + + sig { params(source_repository_owner_uri: String).void } + attr_writer :source_repository_owner_uri + + # Source Repository Ref that the build run was based upon. + sig { returns(T.nilable(String)) } + attr_reader :source_repository_ref + + sig { params(source_repository_ref: String).void } + attr_writer :source_repository_ref + + # Source repository URL that the build was based on. + sig { returns(T.nilable(String)) } + attr_reader :source_repository_uri + + sig { params(source_repository_uri: String).void } + attr_writer :source_repository_uri + + # Source repository visibility at the time of signing the certificate. + sig { returns(T.nilable(String)) } + attr_reader :source_repository_visibility_at_signing + + sig { params(source_repository_visibility_at_signing: String).void } + attr_writer :source_repository_visibility_at_signing + + # SubjectAlternativeName is the certificate subject alternative name. + sig { returns(T.nilable(String)) } + attr_reader :subject_alternative_name + + sig { params(subject_alternative_name: String).void } + attr_writer :subject_alternative_name + + # SignerIdentity contains information about the signer certificate used to sign + # the image. + sig do + params( + build_config_digest: String, + build_config_uri: String, + build_signer_digest: String, + build_signer_uri: String, + build_trigger: String, + certificate_issuer: String, + issuer: String, + run_invocation_uri: String, + runner_environment: String, + source_repository_digest: String, + source_repository_identifier: String, + source_repository_owner_identifier: String, + source_repository_owner_uri: String, + source_repository_ref: String, + source_repository_uri: String, + source_repository_visibility_at_signing: String, + subject_alternative_name: String + ).returns(T.attached_class) + end + def self.new( + # Immutable reference to the specific version of the top-level/initiating build + # instructions. + build_config_digest: nil, + # Build Config URL to the top-level/initiating build instructions. + build_config_uri: nil, + # Immutable reference to the specific version of the build instructions that is + # responsible for signing. + build_signer_digest: nil, + # Reference to specific build instructions that are responsible for signing. + build_signer_uri: nil, + # Event or action that initiated the build. + build_trigger: nil, + # CertificateIssuer is the certificate issuer. + certificate_issuer: nil, + # The OIDC issuer. Should match `iss` claim of ID token or, in the case of a + # federated login like Dex it should match the issuer URL of the upstream issuer. + # The issuer is not set the extensions are invalid and will fail to render. + issuer: nil, + # Run Invocation URL to uniquely identify the build execution. + run_invocation_uri: nil, + # Specifies whether the build took place in platform-hosted cloud infrastructure + # or customer/self-hosted infrastructure. + runner_environment: nil, + # Immutable reference to a specific version of the source code that the build was + # based upon. + source_repository_digest: nil, + # Immutable identifier for the source repository the workflow was based upon. + source_repository_identifier: nil, + # Immutable identifier for the owner of the source repository that the workflow + # was based upon. + source_repository_owner_identifier: nil, + # Source repository owner URL of the owner of the source repository that the build + # was based on. + source_repository_owner_uri: nil, + # Source Repository Ref that the build run was based upon. + source_repository_ref: nil, + # Source repository URL that the build was based on. + source_repository_uri: nil, + # Source repository visibility at the time of signing the certificate. + source_repository_visibility_at_signing: nil, + # SubjectAlternativeName is the certificate subject alternative name. + subject_alternative_name: nil + ) + end + + sig do + override.returns( + { + build_config_digest: String, + build_config_uri: String, + build_signer_digest: String, + build_signer_uri: String, + build_trigger: String, + certificate_issuer: String, + issuer: String, + run_invocation_uri: String, + runner_environment: String, + source_repository_digest: String, + source_repository_identifier: String, + source_repository_owner_identifier: String, + source_repository_owner_uri: String, + source_repository_ref: String, + source_repository_uri: String, + source_repository_visibility_at_signing: String, + subject_alternative_name: String + } + ) + end + def to_hash + end + end + + class Timestamp < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Image::Identity::Signature::Timestamp, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(Time)) } + attr_reader :timestamp + + sig { params(timestamp: Time).void } + attr_writer :timestamp + + # SignatureTimestampType is the type of timestamp used in the signature. + sig do + returns( + T.nilable( + Docker::Image::Identity::Signature::Timestamp::Type::TaggedSymbol + ) + ) + end + attr_reader :type + + sig do + params( + type: + Docker::Image::Identity::Signature::Timestamp::Type::OrSymbol + ).void + end + attr_writer :type + + sig { returns(T.nilable(String)) } + attr_reader :uri + + sig { params(uri: String).void } + attr_writer :uri + + # SignatureTimestamp contains information about a verified signed timestamp for an + # image signature. + sig do + params( + timestamp: Time, + type: + Docker::Image::Identity::Signature::Timestamp::Type::OrSymbol, + uri: String + ).returns(T.attached_class) + end + def self.new( + timestamp: nil, + # SignatureTimestampType is the type of timestamp used in the signature. + type: nil, + uri: nil + ) + end + + sig do + override.returns( + { + timestamp: Time, + type: + Docker::Image::Identity::Signature::Timestamp::Type::TaggedSymbol, + uri: String + } + ) + end + def to_hash + end + + # SignatureTimestampType is the type of timestamp used in the signature. + module Type + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Image::Identity::Signature::Timestamp::Type + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TLOG = + T.let( + :Tlog, + Docker::Image::Identity::Signature::Timestamp::Type::TaggedSymbol + ) + TIMESTAMP_AUTHORITY = + T.let( + :TimestampAuthority, + Docker::Image::Identity::Signature::Timestamp::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Image::Identity::Signature::Timestamp::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + end + + class Manifest < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Image::Manifest, Docker::Internal::AnyHash) + end + + # Indicates whether all the child content (image config, layers) is fully + # available locally. + sig { returns(T::Boolean) } + attr_accessor :available + + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + sig { returns(Docker::Image::Manifest::Descriptor) } + attr_reader :descriptor + + sig do + params(descriptor: Docker::Image::Manifest::Descriptor::OrHash).void + end + attr_writer :descriptor + + # ID is the content-addressable ID of an image and is the same as the digest of + # the image manifest. + sig { returns(String) } + attr_accessor :id + + # The kind of the manifest. + # + # | kind | description | + # | ----------- | ------------------------------------------------------------------------------------ | + # | image | Image manifest that can be used to start a container. | + # | attestation | Attestation manifest produced by the Buildkit builder for a specific image manifest. | + sig { returns(Docker::Image::Manifest::Kind::TaggedSymbol) } + attr_accessor :kind + + sig { returns(Docker::Image::Manifest::Size) } + attr_reader :size + + sig { params(size: Docker::Image::Manifest::Size::OrHash).void } + attr_writer :size + + # The image data for the attestation manifest. This field is only populated when + # Kind is "attestation". + sig { returns(T.nilable(Docker::Image::Manifest::AttestationData)) } + attr_reader :attestation_data + + sig do + params( + attestation_data: + T.nilable(Docker::Image::Manifest::AttestationData::OrHash) + ).void + end + attr_writer :attestation_data + + # The image data for the image manifest. This field is only populated when Kind is + # "image". + sig { returns(T.nilable(Docker::Image::Manifest::ImageData)) } + attr_reader :image_data + + sig do + params( + image_data: T.nilable(Docker::Image::Manifest::ImageData::OrHash) + ).void + end + attr_writer :image_data + + # ImageManifestSummary represents a summary of an image manifest. + sig do + params( + available: T::Boolean, + descriptor: Docker::Image::Manifest::Descriptor::OrHash, + id: String, + kind: Docker::Image::Manifest::Kind::OrSymbol, + size: Docker::Image::Manifest::Size::OrHash, + attestation_data: + T.nilable(Docker::Image::Manifest::AttestationData::OrHash), + image_data: T.nilable(Docker::Image::Manifest::ImageData::OrHash) + ).returns(T.attached_class) + end + def self.new( + # Indicates whether all the child content (image config, layers) is fully + # available locally. + available:, + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + descriptor:, + # ID is the content-addressable ID of an image and is the same as the digest of + # the image manifest. + id:, + # The kind of the manifest. + # + # | kind | description | + # | ----------- | ------------------------------------------------------------------------------------ | + # | image | Image manifest that can be used to start a container. | + # | attestation | Attestation manifest produced by the Buildkit builder for a specific image manifest. | + kind:, + size:, + # The image data for the attestation manifest. This field is only populated when + # Kind is "attestation". + attestation_data: nil, + # The image data for the image manifest. This field is only populated when Kind is + # "image". + image_data: nil + ) + end + + sig do + override.returns( + { + available: T::Boolean, + descriptor: Docker::Image::Manifest::Descriptor, + id: String, + kind: Docker::Image::Manifest::Kind::TaggedSymbol, + size: Docker::Image::Manifest::Size, + attestation_data: + T.nilable(Docker::Image::Manifest::AttestationData), + image_data: T.nilable(Docker::Image::Manifest::ImageData) + } + ) + end + def to_hash + end + + class Descriptor < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Image::Manifest::Descriptor, + Docker::Internal::AnyHash + ) + end + + # Arbitrary metadata relating to the targeted content. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :annotations + + # ArtifactType is the IANA media type of this artifact. + sig { returns(T.nilable(String)) } + attr_accessor :artifact_type + + # Data is an embedding of the targeted content. This is encoded as a base64 string + # when marshalled to JSON (automatically, by encoding/json). If present, Data can + # be used directly to avoid fetching the targeted content. + sig { returns(T.nilable(String)) } + attr_accessor :data + + # The digest of the targeted content. + sig { returns(T.nilable(String)) } + attr_reader :digest + + sig { params(digest: String).void } + attr_writer :digest + + # The media type of the object this schema refers to. + sig { returns(T.nilable(String)) } + attr_reader :media_type + + sig { params(media_type: String).void } + attr_writer :media_type + + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + sig do + returns(T.nilable(Docker::Image::Manifest::Descriptor::Platform)) + end + attr_reader :platform + + sig do + params( + platform: + T.nilable(Docker::Image::Manifest::Descriptor::Platform::OrHash) + ).void + end + attr_writer :platform + + # The size in bytes of the blob. + sig { returns(T.nilable(Integer)) } + attr_reader :size + + sig { params(size: Integer).void } + attr_writer :size + + # List of URLs from which this object MAY be downloaded. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :urls + + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + sig do + params( + annotations: T.nilable(T::Hash[Symbol, String]), + artifact_type: T.nilable(String), + data: T.nilable(String), + digest: String, + media_type: String, + platform: + T.nilable( + Docker::Image::Manifest::Descriptor::Platform::OrHash + ), + size: Integer, + urls: T.nilable(T::Array[String]) + ).returns(T.attached_class) + end + def self.new( + # Arbitrary metadata relating to the targeted content. + annotations: nil, + # ArtifactType is the IANA media type of this artifact. + artifact_type: nil, + # Data is an embedding of the targeted content. This is encoded as a base64 string + # when marshalled to JSON (automatically, by encoding/json). If present, Data can + # be used directly to avoid fetching the targeted content. + data: nil, + # The digest of the targeted content. + digest: nil, + # The media type of the object this schema refers to. + media_type: nil, + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + platform: nil, + # The size in bytes of the blob. + size: nil, + # List of URLs from which this object MAY be downloaded. + urls: nil + ) + end + + sig do + override.returns( + { + annotations: T.nilable(T::Hash[Symbol, String]), + artifact_type: T.nilable(String), + data: T.nilable(String), + digest: String, + media_type: String, + platform: + T.nilable(Docker::Image::Manifest::Descriptor::Platform), + size: Integer, + urls: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + class Platform < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Image::Manifest::Descriptor::Platform, + Docker::Internal::AnyHash + ) + end + + # The CPU architecture, for example `amd64` or `ppc64`. + sig { returns(T.nilable(String)) } + attr_reader :architecture + + sig { params(architecture: String).void } + attr_writer :architecture + + # The operating system, for example `linux` or `windows`. + sig { returns(T.nilable(String)) } + attr_reader :os + + sig { params(os: String).void } + attr_writer :os + + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :os_features + + sig { params(os_features: T::Array[String]).void } + attr_writer :os_features + + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + sig { returns(T.nilable(String)) } + attr_reader :os_version + + sig { params(os_version: String).void } + attr_writer :os_version + + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + sig { returns(T.nilable(String)) } + attr_reader :variant + + sig { params(variant: String).void } + attr_writer :variant + + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + sig do + params( + architecture: String, + os: String, + os_features: T::Array[String], + os_version: String, + variant: String + ).returns(T.attached_class) + end + def self.new( + # The CPU architecture, for example `amd64` or `ppc64`. + architecture: nil, + # The operating system, for example `linux` or `windows`. + os: nil, + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + os_features: nil, + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + os_version: nil, + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + variant: nil + ) + end + + sig do + override.returns( + { + architecture: String, + os: String, + os_features: T::Array[String], + os_version: String, + variant: String + } + ) + end + def to_hash + end + end + end + + # The kind of the manifest. + # + # | kind | description | + # | ----------- | ------------------------------------------------------------------------------------ | + # | image | Image manifest that can be used to start a container. | + # | attestation | Attestation manifest produced by the Buildkit builder for a specific image manifest. | + module Kind + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Docker::Image::Manifest::Kind) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + IMAGE = T.let(:image, Docker::Image::Manifest::Kind::TaggedSymbol) + ATTESTATION = + T.let(:attestation, Docker::Image::Manifest::Kind::TaggedSymbol) + UNKNOWN = T.let(:unknown, Docker::Image::Manifest::Kind::TaggedSymbol) + + sig do + override.returns( + T::Array[Docker::Image::Manifest::Kind::TaggedSymbol] + ) + end + def self.values + end + end + + class Size < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Image::Manifest::Size, Docker::Internal::AnyHash) + end + + # Content is the size (in bytes) of all the locally present content in the content + # store (e.g. image config, layers) referenced by this manifest and its children. + # This only includes blobs in the content store. + sig { returns(Integer) } + attr_accessor :content + + # Total is the total size (in bytes) of all the locally present data (both + # distributable and non-distributable) that's related to this manifest and its + # children. This equal to the sum of [Content] size AND all the sizes in the + # [Size] struct present in the Kind-specific data struct. For example, for an + # image kind (Kind == "image") this would include the size of the image content + # and unpacked image snapshots ([Size.Content] + [ImageData.Size.Unpacked]). + sig { returns(Integer) } + attr_accessor :total + + sig do + params(content: Integer, total: Integer).returns(T.attached_class) + end + def self.new( + # Content is the size (in bytes) of all the locally present content in the content + # store (e.g. image config, layers) referenced by this manifest and its children. + # This only includes blobs in the content store. + content:, + # Total is the total size (in bytes) of all the locally present data (both + # distributable and non-distributable) that's related to this manifest and its + # children. This equal to the sum of [Content] size AND all the sizes in the + # [Size] struct present in the Kind-specific data struct. For example, for an + # image kind (Kind == "image") this would include the size of the image content + # and unpacked image snapshots ([Size.Content] + [ImageData.Size.Unpacked]). + total: + ) + end + + sig { override.returns({ content: Integer, total: Integer }) } + def to_hash + end + end + + class AttestationData < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Image::Manifest::AttestationData, + Docker::Internal::AnyHash + ) + end + + # The digest of the image manifest that this attestation is for. + sig { returns(String) } + attr_accessor :for_ + + # The image data for the attestation manifest. This field is only populated when + # Kind is "attestation". + sig { params(for_: String).returns(T.attached_class) } + def self.new( + # The digest of the image manifest that this attestation is for. + for_: + ) + end + + sig { override.returns({ for_: String }) } + def to_hash + end + end + + class ImageData < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Image::Manifest::ImageData, + Docker::Internal::AnyHash + ) + end + + # The IDs of the containers that are using this image. + sig { returns(T::Array[String]) } + attr_accessor :containers + + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + sig do + returns(T.nilable(Docker::Image::Manifest::ImageData::Platform)) + end + attr_reader :platform + + sig do + params( + platform: + T.nilable(Docker::Image::Manifest::ImageData::Platform::OrHash) + ).void + end + attr_writer :platform + + sig { returns(Docker::Image::Manifest::ImageData::Size) } + attr_reader :size + + sig do + params(size: Docker::Image::Manifest::ImageData::Size::OrHash).void + end + attr_writer :size + + # The image data for the image manifest. This field is only populated when Kind is + # "image". + sig do + params( + containers: T::Array[String], + platform: + T.nilable(Docker::Image::Manifest::ImageData::Platform::OrHash), + size: Docker::Image::Manifest::ImageData::Size::OrHash + ).returns(T.attached_class) + end + def self.new( + # The IDs of the containers that are using this image. + containers:, + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + platform:, + size: + ) + end + + sig do + override.returns( + { + containers: T::Array[String], + platform: + T.nilable(Docker::Image::Manifest::ImageData::Platform), + size: Docker::Image::Manifest::ImageData::Size + } + ) + end + def to_hash + end + + class Platform < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Image::Manifest::ImageData::Platform, + Docker::Internal::AnyHash + ) + end + + # The CPU architecture, for example `amd64` or `ppc64`. + sig { returns(T.nilable(String)) } + attr_reader :architecture + + sig { params(architecture: String).void } + attr_writer :architecture + + # The operating system, for example `linux` or `windows`. + sig { returns(T.nilable(String)) } + attr_reader :os + + sig { params(os: String).void } + attr_writer :os + + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :os_features + + sig { params(os_features: T::Array[String]).void } + attr_writer :os_features + + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + sig { returns(T.nilable(String)) } + attr_reader :os_version + + sig { params(os_version: String).void } + attr_writer :os_version + + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + sig { returns(T.nilable(String)) } + attr_reader :variant + + sig { params(variant: String).void } + attr_writer :variant + + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + sig do + params( + architecture: String, + os: String, + os_features: T::Array[String], + os_version: String, + variant: String + ).returns(T.attached_class) + end + def self.new( + # The CPU architecture, for example `amd64` or `ppc64`. + architecture: nil, + # The operating system, for example `linux` or `windows`. + os: nil, + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + os_features: nil, + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + os_version: nil, + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + variant: nil + ) + end + + sig do + override.returns( + { + architecture: String, + os: String, + os_features: T::Array[String], + os_version: String, + variant: String + } + ) + end + def to_hash + end + end + + class Size < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Image::Manifest::ImageData::Size, + Docker::Internal::AnyHash + ) + end + + # Unpacked is the size (in bytes) of the locally unpacked (uncompressed) image + # content that's directly usable by the containers running this image. It's + # independent of the distributable content - e.g. the image might still have an + # unpacked data that's still used by some container even when the + # distributable/compressed content is already gone. + sig { returns(Integer) } + attr_accessor :unpacked + + sig { params(unpacked: Integer).returns(T.attached_class) } + def self.new( + # Unpacked is the size (in bytes) of the locally unpacked (uncompressed) image + # content that's directly usable by the containers running this image. It's + # independent of the distributable content - e.g. the image might still have an + # unpacked data that's still used by some container even when the + # distributable/compressed content is already gone. + unpacked: + ) + end + + sig { override.returns({ unpacked: Integer }) } + def to_hash + end + end + end + end + + class Metadata < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Image::Metadata, Docker::Internal::AnyHash) + end + + # Date and time at which the image was last tagged in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + # + # This information is only available if the image was tagged locally, and omitted + # otherwise. + sig { returns(T.nilable(String)) } + attr_accessor :last_tag_time + + # Additional metadata of the image in the local cache. This information is local + # to the daemon, and not part of the image itself. + sig do + params(last_tag_time: T.nilable(String)).returns(T.attached_class) + end + def self.new( + # Date and time at which the image was last tagged in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + # + # This information is only available if the image was tagged locally, and omitted + # otherwise. + last_tag_time: nil + ) + end + + sig { override.returns({ last_tag_time: T.nilable(String) }) } + def to_hash + end + end + + class RootFs < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Image::RootFs, Docker::Internal::AnyHash) + end + + sig { returns(String) } + attr_accessor :type + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :layers + + sig { params(layers: T::Array[String]).void } + attr_writer :layers + + # Information about the image's RootFS, including the layer IDs. + sig do + params(type: String, layers: T::Array[String]).returns( + T.attached_class + ) + end + def self.new(type:, layers: nil) + end + + sig { override.returns({ type: String, layers: T::Array[String] }) } + def to_hash + end + end + end + end +end diff --git a/rbi/docker/models/image_delete_params.rbi b/rbi/docker/models/image_delete_params.rbi new file mode 100644 index 0000000..3859141 --- /dev/null +++ b/rbi/docker/models/image_delete_params.rbi @@ -0,0 +1,72 @@ +# typed: strong + +module Docker + module Models + class ImageDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ImageDeleteParams, Docker::Internal::AnyHash) + end + + # Remove the image even if it is being used by stopped containers or has other + # tags + sig { returns(T.nilable(T::Boolean)) } + attr_reader :force + + sig { params(force: T::Boolean).void } + attr_writer :force + + # Do not delete untagged parent images + sig { returns(T.nilable(T::Boolean)) } + attr_reader :noprune + + sig { params(noprune: T::Boolean).void } + attr_writer :noprune + + # Select platform-specific content to delete. Multiple values are accepted. Each + # platform is a OCI platform encoded as a JSON string. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :platforms + + sig { params(platforms: T::Array[String]).void } + attr_writer :platforms + + sig do + params( + force: T::Boolean, + noprune: T::Boolean, + platforms: T::Array[String], + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Remove the image even if it is being used by stopped containers or has other + # tags + force: nil, + # Do not delete untagged parent images + noprune: nil, + # Select platform-specific content to delete. Multiple values are accepted. Each + # platform is a OCI platform encoded as a JSON string. + platforms: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + force: T::Boolean, + noprune: T::Boolean, + platforms: T::Array[String], + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/image_delete_response.rbi b/rbi/docker/models/image_delete_response.rbi new file mode 100644 index 0000000..9a72d68 --- /dev/null +++ b/rbi/docker/models/image_delete_response.rbi @@ -0,0 +1,52 @@ +# typed: strong + +module Docker + module Models + class ImageDeleteResponseItem < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::ImageDeleteResponseItem, + Docker::Internal::AnyHash + ) + end + + # The image ID of an image that was deleted + sig { returns(T.nilable(String)) } + attr_reader :deleted + + sig { params(deleted: String).void } + attr_writer :deleted + + # The image ID of an image that was untagged + sig { returns(T.nilable(String)) } + attr_reader :untagged + + sig { params(untagged: String).void } + attr_writer :untagged + + sig do + params(deleted: String, untagged: String).returns(T.attached_class) + end + def self.new( + # The image ID of an image that was deleted + deleted: nil, + # The image ID of an image that was untagged + untagged: nil + ) + end + + sig { override.returns({ deleted: String, untagged: String }) } + def to_hash + end + end + + ImageDeleteResponse = + T.let( + Docker::Internal::Type::ArrayOf[ + Docker::Models::ImageDeleteResponseItem + ], + Docker::Internal::Type::Converter + ) + end +end diff --git a/rbi/docker/models/image_inspect_params.rbi b/rbi/docker/models/image_inspect_params.rbi new file mode 100644 index 0000000..1891556 --- /dev/null +++ b/rbi/docker/models/image_inspect_params.rbi @@ -0,0 +1,43 @@ +# typed: strong + +module Docker + module Models + class ImageInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ImageInspectParams, Docker::Internal::AnyHash) + end + + # Include Manifests in the image summary. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :manifests + + sig { params(manifests: T::Boolean).void } + attr_writer :manifests + + sig do + params( + manifests: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Include Manifests in the image summary. + manifests: nil, + request_options: {} + ) + end + + sig do + override.returns( + { manifests: T::Boolean, request_options: Docker::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/image_list_params.rbi b/rbi/docker/models/image_list_params.rbi new file mode 100644 index 0000000..19e0797 --- /dev/null +++ b/rbi/docker/models/image_list_params.rbi @@ -0,0 +1,112 @@ +# typed: strong + +module Docker + module Models + class ImageListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ImageListParams, Docker::Internal::AnyHash) + end + + # Show all images. Only images from a final layer (no children) are shown by + # default. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :all + + sig { params(all: T::Boolean).void } + attr_writer :all + + # Show digest information as a `RepoDigests` field on each image. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :digests + + sig { params(digests: T::Boolean).void } + attr_writer :digests + + # A JSON encoded value of the filters (a `map[string][]string`) to process on the + # images list. + # + # Available filters: + # + # - `before`=(`[:]`, `` or ``) + # - `dangling=true` + # - `label=key` or `label="key=value"` of an image label + # - `reference`=(`[:]`) + # - `since`=(`[:]`, `` or ``) + # - `until=` + sig { returns(T.nilable(String)) } + attr_reader :filters + + sig { params(filters: String).void } + attr_writer :filters + + # Include `Manifests` in the image summary. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :manifests + + sig { params(manifests: T::Boolean).void } + attr_writer :manifests + + # Compute and show shared size as a `SharedSize` field on each image. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :shared_size + + sig { params(shared_size: T::Boolean).void } + attr_writer :shared_size + + sig do + params( + all: T::Boolean, + digests: T::Boolean, + filters: String, + manifests: T::Boolean, + shared_size: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Show all images. Only images from a final layer (no children) are shown by + # default. + all: nil, + # Show digest information as a `RepoDigests` field on each image. + digests: nil, + # A JSON encoded value of the filters (a `map[string][]string`) to process on the + # images list. + # + # Available filters: + # + # - `before`=(`[:]`, `` or ``) + # - `dangling=true` + # - `label=key` or `label="key=value"` of an image label + # - `reference`=(`[:]`) + # - `since`=(`[:]`, `` or ``) + # - `until=` + filters: nil, + # Include `Manifests` in the image summary. + manifests: nil, + # Compute and show shared size as a `SharedSize` field on each image. + shared_size: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + all: T::Boolean, + digests: T::Boolean, + filters: String, + manifests: T::Boolean, + shared_size: T::Boolean, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/image_list_response.rbi b/rbi/docker/models/image_list_response.rbi new file mode 100644 index 0000000..0cc7229 --- /dev/null +++ b/rbi/docker/models/image_list_response.rbi @@ -0,0 +1,11 @@ +# typed: strong + +module Docker + module Models + ImageListResponse = + T.let( + Docker::Internal::Type::ArrayOf[Docker::Summary], + Docker::Internal::Type::Converter + ) + end +end diff --git a/rbi/docker/models/image_pull_params.rbi b/rbi/docker/models/image_pull_params.rbi new file mode 100644 index 0000000..3cb98b9 --- /dev/null +++ b/rbi/docker/models/image_pull_params.rbi @@ -0,0 +1,186 @@ +# typed: strong + +module Docker + module Models + class ImagePullParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ImagePullParams, Docker::Internal::AnyHash) + end + + # Apply `Dockerfile` instructions to the image that is created, for example: + # `changes=ENV DEBUG=true`. Note that `ENV DEBUG=true` should be URI component + # encoded. + # + # Supported `Dockerfile` instructions: + # `CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR` + sig { returns(T.nilable(T::Array[String])) } + attr_reader :changes + + sig { params(changes: T::Array[String]).void } + attr_writer :changes + + # Name of the image to pull. If the name includes a tag or digest, specific + # behavior applies: + # + # - If only `fromImage` includes a tag, that tag is used. + # - If both `fromImage` and `tag` are provided, `tag` takes precedence. + # - If `fromImage` includes a digest, the image is pulled by digest, and `tag` is + # ignored. + # - If neither a tag nor digest is specified, all tags are pulled. + sig { returns(T.nilable(String)) } + attr_reader :from_image + + sig { params(from_image: String).void } + attr_writer :from_image + + # Source to import. The value may be a URL from which the image can be retrieved + # or `-` to read the image from the request body. This parameter may only be used + # when importing an image. + sig { returns(T.nilable(String)) } + attr_reader :from_src + + sig { params(from_src: String).void } + attr_writer :from_src + + # Set commit message for imported image. + sig { returns(T.nilable(String)) } + attr_reader :message + + sig { params(message: String).void } + attr_writer :message + + # Platform in the format os[/arch[/variant]]. + # + # When used in combination with the `fromImage` option, the daemon checks if the + # given image is present in the local image cache with the given OS and + # Architecture, and otherwise attempts to pull the image. If the option is not + # set, the host's native OS and Architecture are used. If the given image does not + # exist in the local image cache, the daemon attempts to pull the image with the + # host's native OS and Architecture. If the given image does exists in the local + # image cache, but its OS or architecture does not match, a warning is produced. + # + # When used with the `fromSrc` option to import an image from an archive, this + # option sets the platform information for the imported image. If the option is + # not set, the host's native OS and Architecture are used for the imported image. + sig { returns(T.nilable(String)) } + attr_reader :platform + + sig { params(platform: String).void } + attr_writer :platform + + # Repository name given to an image when it is imported. The repo may include a + # tag. This parameter may only be used when importing an image. + sig { returns(T.nilable(String)) } + attr_reader :repo + + sig { params(repo: String).void } + attr_writer :repo + + # Tag or digest. If empty when pulling an image, this causes all tags for the + # given image to be pulled. + sig { returns(T.nilable(String)) } + attr_reader :tag + + sig { params(tag: String).void } + attr_writer :tag + + sig { returns(T.nilable(String)) } + attr_reader :body + + sig { params(body: String).void } + attr_writer :body + + sig { returns(T.nilable(String)) } + attr_reader :x_registry_auth + + sig { params(x_registry_auth: String).void } + attr_writer :x_registry_auth + + sig do + params( + changes: T::Array[String], + from_image: String, + from_src: String, + message: String, + platform: String, + repo: String, + tag: String, + body: String, + x_registry_auth: String, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Apply `Dockerfile` instructions to the image that is created, for example: + # `changes=ENV DEBUG=true`. Note that `ENV DEBUG=true` should be URI component + # encoded. + # + # Supported `Dockerfile` instructions: + # `CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR` + changes: nil, + # Name of the image to pull. If the name includes a tag or digest, specific + # behavior applies: + # + # - If only `fromImage` includes a tag, that tag is used. + # - If both `fromImage` and `tag` are provided, `tag` takes precedence. + # - If `fromImage` includes a digest, the image is pulled by digest, and `tag` is + # ignored. + # - If neither a tag nor digest is specified, all tags are pulled. + from_image: nil, + # Source to import. The value may be a URL from which the image can be retrieved + # or `-` to read the image from the request body. This parameter may only be used + # when importing an image. + from_src: nil, + # Set commit message for imported image. + message: nil, + # Platform in the format os[/arch[/variant]]. + # + # When used in combination with the `fromImage` option, the daemon checks if the + # given image is present in the local image cache with the given OS and + # Architecture, and otherwise attempts to pull the image. If the option is not + # set, the host's native OS and Architecture are used. If the given image does not + # exist in the local image cache, the daemon attempts to pull the image with the + # host's native OS and Architecture. If the given image does exists in the local + # image cache, but its OS or architecture does not match, a warning is produced. + # + # When used with the `fromSrc` option to import an image from an archive, this + # option sets the platform information for the imported image. If the option is + # not set, the host's native OS and Architecture are used for the imported image. + platform: nil, + # Repository name given to an image when it is imported. The repo may include a + # tag. This parameter may only be used when importing an image. + repo: nil, + # Tag or digest. If empty when pulling an image, this causes all tags for the + # given image to be pulled. + tag: nil, + body: nil, + x_registry_auth: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + changes: T::Array[String], + from_image: String, + from_src: String, + message: String, + platform: String, + repo: String, + tag: String, + body: String, + x_registry_auth: String, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/network.rbi b/rbi/docker/models/network.rbi new file mode 100644 index 0000000..52520fe --- /dev/null +++ b/rbi/docker/models/network.rbi @@ -0,0 +1,405 @@ +# typed: strong + +module Docker + module Models + class Network < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(Docker::Network, Docker::Internal::AnyHash) } + + # Whether a global / swarm scope network is manually attachable by regular + # containers from workers in swarm mode. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :attachable + + sig { params(attachable: T::Boolean).void } + attr_writer :attachable + + # The config-only network source to provide the configuration for this network. + sig { returns(T.nilable(Docker::Network::ConfigFrom)) } + attr_reader :config_from + + sig { params(config_from: Docker::Network::ConfigFrom::OrHash).void } + attr_writer :config_from + + # Whether the network is a config-only network. Config-only networks are + # placeholder networks for network configurations to be used by other networks. + # Config-only networks cannot be used directly to run containers or services. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :config_only + + sig { params(config_only: T::Boolean).void } + attr_writer :config_only + + # Date and time at which the network was created in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + sig { returns(T.nilable(String)) } + attr_reader :created + + sig { params(created: String).void } + attr_writer :created + + # The name of the driver used to create the network (e.g. `bridge`, `overlay`). + sig { returns(T.nilable(String)) } + attr_reader :driver + + sig { params(driver: String).void } + attr_writer :driver + + # Whether the network was created with IPv4 enabled. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :enable_i_pv4 + + sig { params(enable_i_pv4: T::Boolean).void } + attr_writer :enable_i_pv4 + + # Whether the network was created with IPv6 enabled. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :enable_i_pv6 + + sig { params(enable_i_pv6: T::Boolean).void } + attr_writer :enable_i_pv6 + + # ID that uniquely identifies a network on a single machine. + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Whether the network is providing the routing-mesh for the swarm cluster. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :ingress + + sig { params(ingress: T::Boolean).void } + attr_writer :ingress + + # Whether the network is created to only allow internal networking connectivity. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :internal + + sig { params(internal: T::Boolean).void } + attr_writer :internal + + sig { returns(T.nilable(Docker::Network::Ipam)) } + attr_reader :ipam + + sig { params(ipam: Docker::Network::Ipam::OrHash).void } + attr_writer :ipam + + # Metadata specific to the network being created. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :labels + + sig { params(labels: T::Hash[Symbol, String]).void } + attr_writer :labels + + # Name of the network. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Network-specific options uses when creating the network. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :options + + sig { params(options: T::Hash[Symbol, String]).void } + attr_writer :options + + # List of peer nodes for an overlay network. This field is only present for + # overlay networks, and omitted for other network types. + sig { returns(T.nilable(T::Array[Docker::Network::Peer])) } + attr_reader :peers + + sig { params(peers: T::Array[Docker::Network::Peer::OrHash]).void } + attr_writer :peers + + # The level at which the network exists (e.g. `swarm` for cluster-wide or `local` + # for machine level) + sig { returns(T.nilable(String)) } + attr_reader :scope + + sig { params(scope: String).void } + attr_writer :scope + + sig do + params( + attachable: T::Boolean, + config_from: Docker::Network::ConfigFrom::OrHash, + config_only: T::Boolean, + created: String, + driver: String, + enable_i_pv4: T::Boolean, + enable_i_pv6: T::Boolean, + id: String, + ingress: T::Boolean, + internal: T::Boolean, + ipam: Docker::Network::Ipam::OrHash, + labels: T::Hash[Symbol, String], + name: String, + options: T::Hash[Symbol, String], + peers: T::Array[Docker::Network::Peer::OrHash], + scope: String + ).returns(T.attached_class) + end + def self.new( + # Whether a global / swarm scope network is manually attachable by regular + # containers from workers in swarm mode. + attachable: nil, + # The config-only network source to provide the configuration for this network. + config_from: nil, + # Whether the network is a config-only network. Config-only networks are + # placeholder networks for network configurations to be used by other networks. + # Config-only networks cannot be used directly to run containers or services. + config_only: nil, + # Date and time at which the network was created in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + created: nil, + # The name of the driver used to create the network (e.g. `bridge`, `overlay`). + driver: nil, + # Whether the network was created with IPv4 enabled. + enable_i_pv4: nil, + # Whether the network was created with IPv6 enabled. + enable_i_pv6: nil, + # ID that uniquely identifies a network on a single machine. + id: nil, + # Whether the network is providing the routing-mesh for the swarm cluster. + ingress: nil, + # Whether the network is created to only allow internal networking connectivity. + internal: nil, + ipam: nil, + # Metadata specific to the network being created. + labels: nil, + # Name of the network. + name: nil, + # Network-specific options uses when creating the network. + options: nil, + # List of peer nodes for an overlay network. This field is only present for + # overlay networks, and omitted for other network types. + peers: nil, + # The level at which the network exists (e.g. `swarm` for cluster-wide or `local` + # for machine level) + scope: nil + ) + end + + sig do + override.returns( + { + attachable: T::Boolean, + config_from: Docker::Network::ConfigFrom, + config_only: T::Boolean, + created: String, + driver: String, + enable_i_pv4: T::Boolean, + enable_i_pv6: T::Boolean, + id: String, + ingress: T::Boolean, + internal: T::Boolean, + ipam: Docker::Network::Ipam, + labels: T::Hash[Symbol, String], + name: String, + options: T::Hash[Symbol, String], + peers: T::Array[Docker::Network::Peer], + scope: String + } + ) + end + def to_hash + end + + class ConfigFrom < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Network::ConfigFrom, Docker::Internal::AnyHash) + end + + # The name of the config-only network that provides the network's configuration. + # The specified network must be an existing config-only network. Only network + # names are allowed, not network IDs. + sig { returns(T.nilable(String)) } + attr_reader :network + + sig { params(network: String).void } + attr_writer :network + + # The config-only network source to provide the configuration for this network. + sig { params(network: String).returns(T.attached_class) } + def self.new( + # The name of the config-only network that provides the network's configuration. + # The specified network must be an existing config-only network. Only network + # names are allowed, not network IDs. + network: nil + ) + end + + sig { override.returns({ network: String }) } + def to_hash + end + end + + class Ipam < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Network::Ipam, Docker::Internal::AnyHash) + end + + # List of IPAM configuration options, specified as a map: + # + # ``` + # {"Subnet": , "IPRange": , "Gateway": , "AuxAddress": } + # ``` + sig { returns(T.nilable(T::Array[Docker::Network::Ipam::Config])) } + attr_reader :config + + sig do + params(config: T::Array[Docker::Network::Ipam::Config::OrHash]).void + end + attr_writer :config + + # Name of the IPAM driver to use. + sig { returns(T.nilable(String)) } + attr_reader :driver + + sig { params(driver: String).void } + attr_writer :driver + + # Driver-specific options, specified as a map. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :options + + sig { params(options: T::Hash[Symbol, String]).void } + attr_writer :options + + sig do + params( + config: T::Array[Docker::Network::Ipam::Config::OrHash], + driver: String, + options: T::Hash[Symbol, String] + ).returns(T.attached_class) + end + def self.new( + # List of IPAM configuration options, specified as a map: + # + # ``` + # {"Subnet": , "IPRange": , "Gateway": , "AuxAddress": } + # ``` + config: nil, + # Name of the IPAM driver to use. + driver: nil, + # Driver-specific options, specified as a map. + options: nil + ) + end + + sig do + override.returns( + { + config: T::Array[Docker::Network::Ipam::Config], + driver: String, + options: T::Hash[Symbol, String] + } + ) + end + def to_hash + end + + class Config < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Network::Ipam::Config, Docker::Internal::AnyHash) + end + + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :auxiliary_addresses + + sig { params(auxiliary_addresses: T::Hash[Symbol, String]).void } + attr_writer :auxiliary_addresses + + sig { returns(T.nilable(String)) } + attr_reader :gateway + + sig { params(gateway: String).void } + attr_writer :gateway + + sig { returns(T.nilable(String)) } + attr_reader :ip_range + + sig { params(ip_range: String).void } + attr_writer :ip_range + + sig { returns(T.nilable(String)) } + attr_reader :subnet + + sig { params(subnet: String).void } + attr_writer :subnet + + sig do + params( + auxiliary_addresses: T::Hash[Symbol, String], + gateway: String, + ip_range: String, + subnet: String + ).returns(T.attached_class) + end + def self.new( + auxiliary_addresses: nil, + gateway: nil, + ip_range: nil, + subnet: nil + ) + end + + sig do + override.returns( + { + auxiliary_addresses: T::Hash[Symbol, String], + gateway: String, + ip_range: String, + subnet: String + } + ) + end + def to_hash + end + end + end + + class Peer < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Network::Peer, Docker::Internal::AnyHash) + end + + # IP-address of the peer-node in the Swarm cluster. + sig { returns(T.nilable(String)) } + attr_reader :ip + + sig { params(ip: String).void } + attr_writer :ip + + # ID of the peer-node in the Swarm cluster. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # represents one peer of an overlay network. + sig { params(ip: String, name: String).returns(T.attached_class) } + def self.new( + # IP-address of the peer-node in the Swarm cluster. + ip: nil, + # ID of the peer-node in the Swarm cluster. + name: nil + ) + end + + sig { override.returns({ ip: String, name: String }) } + def to_hash + end + end + end + end +end diff --git a/rbi/docker/models/network_create_params.rbi b/rbi/docker/models/network_create_params.rbi new file mode 100644 index 0000000..0b28e75 --- /dev/null +++ b/rbi/docker/models/network_create_params.rbi @@ -0,0 +1,354 @@ +# typed: strong + +module Docker + module Models + class NetworkCreateParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::NetworkCreateParams, Docker::Internal::AnyHash) + end + + # The network's name. + sig { returns(String) } + attr_accessor :name + + # Globally scoped network is manually attachable by regular containers from + # workers in swarm mode. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :attachable + + sig { params(attachable: T::Boolean).void } + attr_writer :attachable + + # The config-only network source to provide the configuration for this network. + sig { returns(T.nilable(Docker::NetworkCreateParams::ConfigFrom)) } + attr_reader :config_from + + sig do + params( + config_from: Docker::NetworkCreateParams::ConfigFrom::OrHash + ).void + end + attr_writer :config_from + + # Creates a config-only network. Config-only networks are placeholder networks for + # network configurations to be used by other networks. Config-only networks cannot + # be used directly to run containers or services. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :config_only + + sig { params(config_only: T::Boolean).void } + attr_writer :config_only + + # Name of the network driver plugin to use. + sig { returns(T.nilable(String)) } + attr_reader :driver + + sig { params(driver: String).void } + attr_writer :driver + + # Enable IPv4 on the network. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :enable_i_pv4 + + sig { params(enable_i_pv4: T::Boolean).void } + attr_writer :enable_i_pv4 + + # Enable IPv6 on the network. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :enable_i_pv6 + + sig { params(enable_i_pv6: T::Boolean).void } + attr_writer :enable_i_pv6 + + # Ingress network is the network which provides the routing-mesh in swarm mode. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :ingress + + sig { params(ingress: T::Boolean).void } + attr_writer :ingress + + # Restrict external access to the network. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :internal + + sig { params(internal: T::Boolean).void } + attr_writer :internal + + sig { returns(T.nilable(Docker::NetworkCreateParams::Ipam)) } + attr_reader :ipam + + sig { params(ipam: Docker::NetworkCreateParams::Ipam::OrHash).void } + attr_writer :ipam + + # User-defined key/value metadata. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :labels + + sig { params(labels: T::Hash[Symbol, String]).void } + attr_writer :labels + + # Network specific options to be used by the drivers. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :options + + sig { params(options: T::Hash[Symbol, String]).void } + attr_writer :options + + # The level at which the network exists (e.g. `swarm` for cluster-wide or `local` + # for machine level). + sig { returns(T.nilable(String)) } + attr_reader :scope + + sig { params(scope: String).void } + attr_writer :scope + + sig do + params( + name: String, + attachable: T::Boolean, + config_from: Docker::NetworkCreateParams::ConfigFrom::OrHash, + config_only: T::Boolean, + driver: String, + enable_i_pv4: T::Boolean, + enable_i_pv6: T::Boolean, + ingress: T::Boolean, + internal: T::Boolean, + ipam: Docker::NetworkCreateParams::Ipam::OrHash, + labels: T::Hash[Symbol, String], + options: T::Hash[Symbol, String], + scope: String, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # The network's name. + name:, + # Globally scoped network is manually attachable by regular containers from + # workers in swarm mode. + attachable: nil, + # The config-only network source to provide the configuration for this network. + config_from: nil, + # Creates a config-only network. Config-only networks are placeholder networks for + # network configurations to be used by other networks. Config-only networks cannot + # be used directly to run containers or services. + config_only: nil, + # Name of the network driver plugin to use. + driver: nil, + # Enable IPv4 on the network. + enable_i_pv4: nil, + # Enable IPv6 on the network. + enable_i_pv6: nil, + # Ingress network is the network which provides the routing-mesh in swarm mode. + ingress: nil, + # Restrict external access to the network. + internal: nil, + ipam: nil, + # User-defined key/value metadata. + labels: nil, + # Network specific options to be used by the drivers. + options: nil, + # The level at which the network exists (e.g. `swarm` for cluster-wide or `local` + # for machine level). + scope: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + name: String, + attachable: T::Boolean, + config_from: Docker::NetworkCreateParams::ConfigFrom, + config_only: T::Boolean, + driver: String, + enable_i_pv4: T::Boolean, + enable_i_pv6: T::Boolean, + ingress: T::Boolean, + internal: T::Boolean, + ipam: Docker::NetworkCreateParams::Ipam, + labels: T::Hash[Symbol, String], + options: T::Hash[Symbol, String], + scope: String, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + + class ConfigFrom < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::NetworkCreateParams::ConfigFrom, + Docker::Internal::AnyHash + ) + end + + # The name of the config-only network that provides the network's configuration. + # The specified network must be an existing config-only network. Only network + # names are allowed, not network IDs. + sig { returns(T.nilable(String)) } + attr_reader :network + + sig { params(network: String).void } + attr_writer :network + + # The config-only network source to provide the configuration for this network. + sig { params(network: String).returns(T.attached_class) } + def self.new( + # The name of the config-only network that provides the network's configuration. + # The specified network must be an existing config-only network. Only network + # names are allowed, not network IDs. + network: nil + ) + end + + sig { override.returns({ network: String }) } + def to_hash + end + end + + class Ipam < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::NetworkCreateParams::Ipam, Docker::Internal::AnyHash) + end + + # List of IPAM configuration options, specified as a map: + # + # ``` + # {"Subnet": , "IPRange": , "Gateway": , "AuxAddress": } + # ``` + sig do + returns( + T.nilable(T::Array[Docker::NetworkCreateParams::Ipam::Config]) + ) + end + attr_reader :config + + sig do + params( + config: T::Array[Docker::NetworkCreateParams::Ipam::Config::OrHash] + ).void + end + attr_writer :config + + # Name of the IPAM driver to use. + sig { returns(T.nilable(String)) } + attr_reader :driver + + sig { params(driver: String).void } + attr_writer :driver + + # Driver-specific options, specified as a map. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :options + + sig { params(options: T::Hash[Symbol, String]).void } + attr_writer :options + + sig do + params( + config: T::Array[Docker::NetworkCreateParams::Ipam::Config::OrHash], + driver: String, + options: T::Hash[Symbol, String] + ).returns(T.attached_class) + end + def self.new( + # List of IPAM configuration options, specified as a map: + # + # ``` + # {"Subnet": , "IPRange": , "Gateway": , "AuxAddress": } + # ``` + config: nil, + # Name of the IPAM driver to use. + driver: nil, + # Driver-specific options, specified as a map. + options: nil + ) + end + + sig do + override.returns( + { + config: T::Array[Docker::NetworkCreateParams::Ipam::Config], + driver: String, + options: T::Hash[Symbol, String] + } + ) + end + def to_hash + end + + class Config < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::NetworkCreateParams::Ipam::Config, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :auxiliary_addresses + + sig { params(auxiliary_addresses: T::Hash[Symbol, String]).void } + attr_writer :auxiliary_addresses + + sig { returns(T.nilable(String)) } + attr_reader :gateway + + sig { params(gateway: String).void } + attr_writer :gateway + + sig { returns(T.nilable(String)) } + attr_reader :ip_range + + sig { params(ip_range: String).void } + attr_writer :ip_range + + sig { returns(T.nilable(String)) } + attr_reader :subnet + + sig { params(subnet: String).void } + attr_writer :subnet + + sig do + params( + auxiliary_addresses: T::Hash[Symbol, String], + gateway: String, + ip_range: String, + subnet: String + ).returns(T.attached_class) + end + def self.new( + auxiliary_addresses: nil, + gateway: nil, + ip_range: nil, + subnet: nil + ) + end + + sig do + override.returns( + { + auxiliary_addresses: T::Hash[Symbol, String], + gateway: String, + ip_range: String, + subnet: String + } + ) + end + def to_hash + end + end + end + end + end +end diff --git a/rbi/docker/models/network_create_response.rbi b/rbi/docker/models/network_create_response.rbi new file mode 100644 index 0000000..89baa61 --- /dev/null +++ b/rbi/docker/models/network_create_response.rbi @@ -0,0 +1,37 @@ +# typed: strong + +module Docker + module Models + class NetworkCreateResponse < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::NetworkCreateResponse, + Docker::Internal::AnyHash + ) + end + + # The ID of the created network. + sig { returns(String) } + attr_accessor :id + + # Warnings encountered when creating the container + sig { returns(String) } + attr_accessor :warning + + # OK response to NetworkCreate operation + sig { params(id: String, warning: String).returns(T.attached_class) } + def self.new( + # The ID of the created network. + id:, + # Warnings encountered when creating the container + warning: + ) + end + + sig { override.returns({ id: String, warning: String }) } + def to_hash + end + end + end +end diff --git a/rbi/docker/models/network_delete_params.rbi b/rbi/docker/models/network_delete_params.rbi new file mode 100644 index 0000000..01ed43b --- /dev/null +++ b/rbi/docker/models/network_delete_params.rbi @@ -0,0 +1,27 @@ +# typed: strong + +module Docker + module Models + class NetworkDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::NetworkDeleteParams, Docker::Internal::AnyHash) + end + + sig do + params(request_options: Docker::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Docker::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/docker/models/network_inspect_params.rbi b/rbi/docker/models/network_inspect_params.rbi new file mode 100644 index 0000000..42cf3df --- /dev/null +++ b/rbi/docker/models/network_inspect_params.rbi @@ -0,0 +1,57 @@ +# typed: strong + +module Docker + module Models + class NetworkInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::NetworkInspectParams, Docker::Internal::AnyHash) + end + + # Filter the network by scope (swarm, global, or local) + sig { returns(T.nilable(String)) } + attr_reader :scope + + sig { params(scope: String).void } + attr_writer :scope + + # Detailed inspect output for troubleshooting + sig { returns(T.nilable(T::Boolean)) } + attr_reader :verbose + + sig { params(verbose: T::Boolean).void } + attr_writer :verbose + + sig do + params( + scope: String, + verbose: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Filter the network by scope (swarm, global, or local) + scope: nil, + # Detailed inspect output for troubleshooting + verbose: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + scope: String, + verbose: T::Boolean, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/network_inspect_response.rbi b/rbi/docker/models/network_inspect_response.rbi new file mode 100644 index 0000000..812ea34 --- /dev/null +++ b/rbi/docker/models/network_inspect_response.rbi @@ -0,0 +1,320 @@ +# typed: strong + +module Docker + module Models + class NetworkInspectResponse < Docker::Models::Network + OrHash = + T.type_alias do + T.any( + Docker::Models::NetworkInspectResponse, + Docker::Internal::AnyHash + ) + end + + # Contains endpoints attached to the network. + sig do + returns( + T.nilable( + T::Hash[Symbol, Docker::Models::NetworkInspectResponse::Container] + ) + ) + end + attr_reader :containers + + sig do + params( + containers: + T::Hash[ + Symbol, + Docker::Models::NetworkInspectResponse::Container::OrHash + ] + ).void + end + attr_writer :containers + + # List of services using the network. This field is only present for swarm scope + # networks, and omitted for local scope networks. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :services + + sig { params(services: T::Hash[Symbol, T.anything]).void } + attr_writer :services + + # provides runtime information about the network such as the number of allocated + # IPs. + sig { returns(T.nilable(Docker::Models::NetworkInspectResponse::Status)) } + attr_reader :status + + sig do + params( + status: Docker::Models::NetworkInspectResponse::Status::OrHash + ).void + end + attr_writer :status + + # The body of the "get network" http response message. + sig do + params( + containers: + T::Hash[ + Symbol, + Docker::Models::NetworkInspectResponse::Container::OrHash + ], + services: T::Hash[Symbol, T.anything], + status: Docker::Models::NetworkInspectResponse::Status::OrHash + ).returns(T.attached_class) + end + def self.new( + # Contains endpoints attached to the network. + containers: nil, + # List of services using the network. This field is only present for swarm scope + # networks, and omitted for local scope networks. + services: nil, + # provides runtime information about the network such as the number of allocated + # IPs. + status: nil + ) + end + + sig do + override.returns( + { + containers: + T::Hash[ + Symbol, + Docker::Models::NetworkInspectResponse::Container + ], + services: T::Hash[Symbol, T.anything], + status: Docker::Models::NetworkInspectResponse::Status + } + ) + end + def to_hash + end + + class Container < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::NetworkInspectResponse::Container, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :endpoint_id + + sig { params(endpoint_id: String).void } + attr_writer :endpoint_id + + sig { returns(T.nilable(String)) } + attr_reader :i_pv4_address + + sig { params(i_pv4_address: String).void } + attr_writer :i_pv4_address + + sig { returns(T.nilable(String)) } + attr_reader :i_pv6_address + + sig { params(i_pv6_address: String).void } + attr_writer :i_pv6_address + + sig { returns(T.nilable(String)) } + attr_reader :mac_address + + sig { params(mac_address: String).void } + attr_writer :mac_address + + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # contains network resources allocated and used for a container in a network. + sig do + params( + endpoint_id: String, + i_pv4_address: String, + i_pv6_address: String, + mac_address: String, + name: String + ).returns(T.attached_class) + end + def self.new( + endpoint_id: nil, + i_pv4_address: nil, + i_pv6_address: nil, + mac_address: nil, + name: nil + ) + end + + sig do + override.returns( + { + endpoint_id: String, + i_pv4_address: String, + i_pv6_address: String, + mac_address: String, + name: String + } + ) + end + def to_hash + end + end + + class Status < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::NetworkInspectResponse::Status, + Docker::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable(Docker::Models::NetworkInspectResponse::Status::Ipam) + ) + end + attr_reader :ipam + + sig do + params( + ipam: Docker::Models::NetworkInspectResponse::Status::Ipam::OrHash + ).void + end + attr_writer :ipam + + # provides runtime information about the network such as the number of allocated + # IPs. + sig do + params( + ipam: Docker::Models::NetworkInspectResponse::Status::Ipam::OrHash + ).returns(T.attached_class) + end + def self.new(ipam: nil) + end + + sig do + override.returns( + { ipam: Docker::Models::NetworkInspectResponse::Status::Ipam } + ) + end + def to_hash + end + + class Ipam < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::NetworkInspectResponse::Status::Ipam, + Docker::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + T::Hash[ + Symbol, + Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet + ] + ) + ) + end + attr_reader :subnets + + sig do + params( + subnets: + T::Hash[ + Symbol, + Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet::OrHash + ] + ).void + end + attr_writer :subnets + + sig do + params( + subnets: + T::Hash[ + Symbol, + Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet::OrHash + ] + ).returns(T.attached_class) + end + def self.new(subnets: nil) + end + + sig do + override.returns( + { + subnets: + T::Hash[ + Symbol, + Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet + ] + } + ) + end + def to_hash + end + + class Subnet < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet, + Docker::Internal::AnyHash + ) + end + + # Number of IP addresses within the network's IPRange for the subnet that are + # available for allocation, saturating at 264 - 1. + sig { returns(T.nilable(Integer)) } + attr_reader :dynamic_ips_available + + sig { params(dynamic_ips_available: Integer).void } + attr_writer :dynamic_ips_available + + # Number of IP addresses in the subnet that are in use or reserved and are + # therefore unavailable for allocation, saturating at 264 - 1. + sig { returns(T.nilable(Integer)) } + attr_reader :ips_in_use + + sig { params(ips_in_use: Integer).void } + attr_writer :ips_in_use + + sig do + params( + dynamic_ips_available: Integer, + ips_in_use: Integer + ).returns(T.attached_class) + end + def self.new( + # Number of IP addresses within the network's IPRange for the subnet that are + # available for allocation, saturating at 264 - 1. + dynamic_ips_available: nil, + # Number of IP addresses in the subnet that are in use or reserved and are + # therefore unavailable for allocation, saturating at 264 - 1. + ips_in_use: nil + ) + end + + sig do + override.returns( + { dynamic_ips_available: Integer, ips_in_use: Integer } + ) + end + def to_hash + end + end + end + end + end + end +end diff --git a/rbi/docker/models/network_list_params.rbi b/rbi/docker/models/network_list_params.rbi new file mode 100644 index 0000000..fc9b9c7 --- /dev/null +++ b/rbi/docker/models/network_list_params.rbi @@ -0,0 +1,73 @@ +# typed: strong + +module Docker + module Models + class NetworkListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::NetworkListParams, Docker::Internal::AnyHash) + end + + # JSON encoded value of the filters (a `map[string][]string`) to process on the + # networks list. + # + # Available filters: + # + # - `dangling=` When set to `true` (or `1`), returns all networks that + # are not in use by a container. When set to `false` (or `0`), only networks + # that are in use by one or more containers are returned. + # - `driver=` Matches a network's driver. + # - `id=` Matches all or part of a network ID. + # - `label=` or `label==` of a network label. + # - `name=` Matches all or part of a network name. + # - `scope=["swarm"|"global"|"local"]` Filters networks by scope (`swarm`, + # `global`, or `local`). + # - `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword + # returns all user-defined networks. + sig { returns(T.nilable(String)) } + attr_reader :filters + + sig { params(filters: String).void } + attr_writer :filters + + sig do + params( + filters: String, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # JSON encoded value of the filters (a `map[string][]string`) to process on the + # networks list. + # + # Available filters: + # + # - `dangling=` When set to `true` (or `1`), returns all networks that + # are not in use by a container. When set to `false` (or `0`), only networks + # that are in use by one or more containers are returned. + # - `driver=` Matches a network's driver. + # - `id=` Matches all or part of a network ID. + # - `label=` or `label==` of a network label. + # - `name=` Matches all or part of a network name. + # - `scope=["swarm"|"global"|"local"]` Filters networks by scope (`swarm`, + # `global`, or `local`). + # - `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword + # returns all user-defined networks. + filters: nil, + request_options: {} + ) + end + + sig do + override.returns( + { filters: String, request_options: Docker::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/network_list_response.rbi b/rbi/docker/models/network_list_response.rbi new file mode 100644 index 0000000..a3420bb --- /dev/null +++ b/rbi/docker/models/network_list_response.rbi @@ -0,0 +1,11 @@ +# typed: strong + +module Docker + module Models + NetworkListResponse = + T.let( + Docker::Internal::Type::ArrayOf[Docker::Summary], + Docker::Internal::Type::Converter + ) + end +end diff --git a/rbi/docker/models/service.rbi b/rbi/docker/models/service.rbi new file mode 100644 index 0000000..8dadde0 --- /dev/null +++ b/rbi/docker/models/service.rbi @@ -0,0 +1,999 @@ +# typed: strong + +module Docker + module Models + class Service < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(Docker::Service, Docker::Internal::AnyHash) } + + sig { returns(T.nilable(String)) } + attr_reader :created_at + + sig { params(created_at: String).void } + attr_writer :created_at + + sig { returns(T.nilable(Docker::Service::Endpoint)) } + attr_reader :endpoint + + sig { params(endpoint: Docker::Service::Endpoint::OrHash).void } + attr_writer :endpoint + + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # The status of the service when it is in one of ReplicatedJob or GlobalJob modes. + # Absent on Replicated and Global mode services. The JobIteration is an + # ObjectVersion, but unlike the Service's version, does not need to be sent with + # an update request. + sig { returns(T.nilable(Docker::Service::JobStatus)) } + attr_reader :job_status + + sig { params(job_status: Docker::Service::JobStatus::OrHash).void } + attr_writer :job_status + + # The status of the service's tasks. Provided only when requested as part of a + # ServiceList operation. + sig { returns(T.nilable(Docker::Service::ServiceStatus)) } + attr_reader :service_status + + sig do + params(service_status: Docker::Service::ServiceStatus::OrHash).void + end + attr_writer :service_status + + # User modifiable configuration for a service. + sig { returns(T.nilable(Docker::Spec)) } + attr_reader :spec + + sig { params(spec: Docker::Spec::OrHash).void } + attr_writer :spec + + sig { returns(T.nilable(String)) } + attr_reader :updated_at + + sig { params(updated_at: String).void } + attr_writer :updated_at + + # The status of a service update. + sig { returns(T.nilable(Docker::Service::UpdateStatus)) } + attr_reader :update_status + + sig { params(update_status: Docker::Service::UpdateStatus::OrHash).void } + attr_writer :update_status + + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + sig { returns(T.nilable(Docker::Service::Version)) } + attr_reader :version + + sig { params(version: Docker::Service::Version::OrHash).void } + attr_writer :version + + sig do + params( + created_at: String, + endpoint: Docker::Service::Endpoint::OrHash, + id: String, + job_status: Docker::Service::JobStatus::OrHash, + service_status: Docker::Service::ServiceStatus::OrHash, + spec: Docker::Spec::OrHash, + updated_at: String, + update_status: Docker::Service::UpdateStatus::OrHash, + version: Docker::Service::Version::OrHash + ).returns(T.attached_class) + end + def self.new( + created_at: nil, + endpoint: nil, + id: nil, + # The status of the service when it is in one of ReplicatedJob or GlobalJob modes. + # Absent on Replicated and Global mode services. The JobIteration is an + # ObjectVersion, but unlike the Service's version, does not need to be sent with + # an update request. + job_status: nil, + # The status of the service's tasks. Provided only when requested as part of a + # ServiceList operation. + service_status: nil, + # User modifiable configuration for a service. + spec: nil, + updated_at: nil, + # The status of a service update. + update_status: nil, + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + version: nil + ) + end + + sig do + override.returns( + { + created_at: String, + endpoint: Docker::Service::Endpoint, + id: String, + job_status: Docker::Service::JobStatus, + service_status: Docker::Service::ServiceStatus, + spec: Docker::Spec, + updated_at: String, + update_status: Docker::Service::UpdateStatus, + version: Docker::Service::Version + } + ) + end + def to_hash + end + + class Endpoint < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Service::Endpoint, Docker::Internal::AnyHash) + end + + sig { returns(T.nilable(T::Array[Docker::Service::Endpoint::Port])) } + attr_reader :ports + + sig do + params(ports: T::Array[Docker::Service::Endpoint::Port::OrHash]).void + end + attr_writer :ports + + # Properties that can be configured to access and load balance a service. + sig { returns(T.nilable(Docker::Service::Endpoint::Spec)) } + attr_reader :spec + + sig { params(spec: Docker::Service::Endpoint::Spec::OrHash).void } + attr_writer :spec + + sig do + returns(T.nilable(T::Array[Docker::Service::Endpoint::VirtualIP])) + end + attr_reader :virtual_ips + + sig do + params( + virtual_ips: T::Array[Docker::Service::Endpoint::VirtualIP::OrHash] + ).void + end + attr_writer :virtual_ips + + sig do + params( + ports: T::Array[Docker::Service::Endpoint::Port::OrHash], + spec: Docker::Service::Endpoint::Spec::OrHash, + virtual_ips: T::Array[Docker::Service::Endpoint::VirtualIP::OrHash] + ).returns(T.attached_class) + end + def self.new( + ports: nil, + # Properties that can be configured to access and load balance a service. + spec: nil, + virtual_ips: nil + ) + end + + sig do + override.returns( + { + ports: T::Array[Docker::Service::Endpoint::Port], + spec: Docker::Service::Endpoint::Spec, + virtual_ips: T::Array[Docker::Service::Endpoint::VirtualIP] + } + ) + end + def to_hash + end + + class Port < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Service::Endpoint::Port, Docker::Internal::AnyHash) + end + + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + sig do + returns( + T.nilable(Docker::Service::Endpoint::Port::Protocol::TaggedSymbol) + ) + end + attr_reader :protocol + + sig do + params( + protocol: Docker::Service::Endpoint::Port::Protocol::OrSymbol + ).void + end + attr_writer :protocol + + # The port on the swarm hosts. + sig { returns(T.nilable(Integer)) } + attr_reader :published_port + + sig { params(published_port: Integer).void } + attr_writer :published_port + + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + sig do + returns( + T.nilable( + Docker::Service::Endpoint::Port::PublishMode::TaggedSymbol + ) + ) + end + attr_reader :publish_mode + + sig do + params( + publish_mode: + Docker::Service::Endpoint::Port::PublishMode::OrSymbol + ).void + end + attr_writer :publish_mode + + # The port inside the container. + sig { returns(T.nilable(Integer)) } + attr_reader :target_port + + sig { params(target_port: Integer).void } + attr_writer :target_port + + sig do + params( + name: String, + protocol: Docker::Service::Endpoint::Port::Protocol::OrSymbol, + published_port: Integer, + publish_mode: + Docker::Service::Endpoint::Port::PublishMode::OrSymbol, + target_port: Integer + ).returns(T.attached_class) + end + def self.new( + name: nil, + protocol: nil, + # The port on the swarm hosts. + published_port: nil, + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + publish_mode: nil, + # The port inside the container. + target_port: nil + ) + end + + sig do + override.returns( + { + name: String, + protocol: + Docker::Service::Endpoint::Port::Protocol::TaggedSymbol, + published_port: Integer, + publish_mode: + Docker::Service::Endpoint::Port::PublishMode::TaggedSymbol, + target_port: Integer + } + ) + end + def to_hash + end + + module Protocol + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Service::Endpoint::Port::Protocol) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TCP = + T.let( + :tcp, + Docker::Service::Endpoint::Port::Protocol::TaggedSymbol + ) + UDP = + T.let( + :udp, + Docker::Service::Endpoint::Port::Protocol::TaggedSymbol + ) + SCTP = + T.let( + :sctp, + Docker::Service::Endpoint::Port::Protocol::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Service::Endpoint::Port::Protocol::TaggedSymbol + ] + ) + end + def self.values + end + end + + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + module PublishMode + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Service::Endpoint::Port::PublishMode) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INGRESS = + T.let( + :ingress, + Docker::Service::Endpoint::Port::PublishMode::TaggedSymbol + ) + HOST = + T.let( + :host, + Docker::Service::Endpoint::Port::PublishMode::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Service::Endpoint::Port::PublishMode::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Spec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Service::Endpoint::Spec, Docker::Internal::AnyHash) + end + + # The mode of resolution to use for internal load balancing between tasks. + sig do + returns( + T.nilable(Docker::Service::Endpoint::Spec::Mode::TaggedSymbol) + ) + end + attr_reader :mode + + sig do + params(mode: Docker::Service::Endpoint::Spec::Mode::OrSymbol).void + end + attr_writer :mode + + # List of exposed ports that this service is accessible on from the outside. Ports + # can only be provided if `vip` resolution mode is used. + sig do + returns(T.nilable(T::Array[Docker::Service::Endpoint::Spec::Port])) + end + attr_reader :ports + + sig do + params( + ports: T::Array[Docker::Service::Endpoint::Spec::Port::OrHash] + ).void + end + attr_writer :ports + + # Properties that can be configured to access and load balance a service. + sig do + params( + mode: Docker::Service::Endpoint::Spec::Mode::OrSymbol, + ports: T::Array[Docker::Service::Endpoint::Spec::Port::OrHash] + ).returns(T.attached_class) + end + def self.new( + # The mode of resolution to use for internal load balancing between tasks. + mode: nil, + # List of exposed ports that this service is accessible on from the outside. Ports + # can only be provided if `vip` resolution mode is used. + ports: nil + ) + end + + sig do + override.returns( + { + mode: Docker::Service::Endpoint::Spec::Mode::TaggedSymbol, + ports: T::Array[Docker::Service::Endpoint::Spec::Port] + } + ) + end + def to_hash + end + + # The mode of resolution to use for internal load balancing between tasks. + module Mode + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Service::Endpoint::Spec::Mode) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + VIP = + T.let(:vip, Docker::Service::Endpoint::Spec::Mode::TaggedSymbol) + DNSRR = + T.let(:dnsrr, Docker::Service::Endpoint::Spec::Mode::TaggedSymbol) + + sig do + override.returns( + T::Array[Docker::Service::Endpoint::Spec::Mode::TaggedSymbol] + ) + end + def self.values + end + end + + class Port < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Service::Endpoint::Spec::Port, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + sig do + returns( + T.nilable( + Docker::Service::Endpoint::Spec::Port::Protocol::TaggedSymbol + ) + ) + end + attr_reader :protocol + + sig do + params( + protocol: + Docker::Service::Endpoint::Spec::Port::Protocol::OrSymbol + ).void + end + attr_writer :protocol + + # The port on the swarm hosts. + sig { returns(T.nilable(Integer)) } + attr_reader :published_port + + sig { params(published_port: Integer).void } + attr_writer :published_port + + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + sig do + returns( + T.nilable( + Docker::Service::Endpoint::Spec::Port::PublishMode::TaggedSymbol + ) + ) + end + attr_reader :publish_mode + + sig do + params( + publish_mode: + Docker::Service::Endpoint::Spec::Port::PublishMode::OrSymbol + ).void + end + attr_writer :publish_mode + + # The port inside the container. + sig { returns(T.nilable(Integer)) } + attr_reader :target_port + + sig { params(target_port: Integer).void } + attr_writer :target_port + + sig do + params( + name: String, + protocol: + Docker::Service::Endpoint::Spec::Port::Protocol::OrSymbol, + published_port: Integer, + publish_mode: + Docker::Service::Endpoint::Spec::Port::PublishMode::OrSymbol, + target_port: Integer + ).returns(T.attached_class) + end + def self.new( + name: nil, + protocol: nil, + # The port on the swarm hosts. + published_port: nil, + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + publish_mode: nil, + # The port inside the container. + target_port: nil + ) + end + + sig do + override.returns( + { + name: String, + protocol: + Docker::Service::Endpoint::Spec::Port::Protocol::TaggedSymbol, + published_port: Integer, + publish_mode: + Docker::Service::Endpoint::Spec::Port::PublishMode::TaggedSymbol, + target_port: Integer + } + ) + end + def to_hash + end + + module Protocol + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Service::Endpoint::Spec::Port::Protocol) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TCP = + T.let( + :tcp, + Docker::Service::Endpoint::Spec::Port::Protocol::TaggedSymbol + ) + UDP = + T.let( + :udp, + Docker::Service::Endpoint::Spec::Port::Protocol::TaggedSymbol + ) + SCTP = + T.let( + :sctp, + Docker::Service::Endpoint::Spec::Port::Protocol::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Service::Endpoint::Spec::Port::Protocol::TaggedSymbol + ] + ) + end + def self.values + end + end + + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + module PublishMode + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Service::Endpoint::Spec::Port::PublishMode + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INGRESS = + T.let( + :ingress, + Docker::Service::Endpoint::Spec::Port::PublishMode::TaggedSymbol + ) + HOST = + T.let( + :host, + Docker::Service::Endpoint::Spec::Port::PublishMode::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Service::Endpoint::Spec::Port::PublishMode::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class VirtualIP < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Service::Endpoint::VirtualIP, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :addr + + sig { params(addr: String).void } + attr_writer :addr + + sig { returns(T.nilable(String)) } + attr_reader :network_id + + sig { params(network_id: String).void } + attr_writer :network_id + + sig do + params(addr: String, network_id: String).returns(T.attached_class) + end + def self.new(addr: nil, network_id: nil) + end + + sig { override.returns({ addr: String, network_id: String }) } + def to_hash + end + end + end + + class JobStatus < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Service::JobStatus, Docker::Internal::AnyHash) + end + + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + sig { returns(T.nilable(Docker::Service::JobStatus::JobIteration)) } + attr_reader :job_iteration + + sig do + params( + job_iteration: Docker::Service::JobStatus::JobIteration::OrHash + ).void + end + attr_writer :job_iteration + + # The last time, as observed by the server, that this job was started. + sig { returns(T.nilable(String)) } + attr_reader :last_execution + + sig { params(last_execution: String).void } + attr_writer :last_execution + + # The status of the service when it is in one of ReplicatedJob or GlobalJob modes. + # Absent on Replicated and Global mode services. The JobIteration is an + # ObjectVersion, but unlike the Service's version, does not need to be sent with + # an update request. + sig do + params( + job_iteration: Docker::Service::JobStatus::JobIteration::OrHash, + last_execution: String + ).returns(T.attached_class) + end + def self.new( + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + job_iteration: nil, + # The last time, as observed by the server, that this job was started. + last_execution: nil + ) + end + + sig do + override.returns( + { + job_iteration: Docker::Service::JobStatus::JobIteration, + last_execution: String + } + ) + end + def to_hash + end + + class JobIteration < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Service::JobStatus::JobIteration, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(Integer)) } + attr_reader :index + + sig { params(index: Integer).void } + attr_writer :index + + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + sig { params(index: Integer).returns(T.attached_class) } + def self.new(index: nil) + end + + sig { override.returns({ index: Integer }) } + def to_hash + end + end + end + + class ServiceStatus < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Service::ServiceStatus, Docker::Internal::AnyHash) + end + + # The number of tasks for a job that are in the Completed state. This field must + # be cross-referenced with the service type, as the value of 0 may mean the + # service is not in a job mode, or it may mean the job-mode service has no tasks + # yet Completed. + sig { returns(T.nilable(Integer)) } + attr_reader :completed_tasks + + sig { params(completed_tasks: Integer).void } + attr_writer :completed_tasks + + # The number of tasks for the service desired to be running. For replicated + # services, this is the replica count from the service spec. For global services, + # this is computed by taking count of all tasks for the service with a Desired + # State other than Shutdown. + sig { returns(T.nilable(Integer)) } + attr_reader :desired_tasks + + sig { params(desired_tasks: Integer).void } + attr_writer :desired_tasks + + # The number of tasks for the service currently in the Running state. + sig { returns(T.nilable(Integer)) } + attr_reader :running_tasks + + sig { params(running_tasks: Integer).void } + attr_writer :running_tasks + + # The status of the service's tasks. Provided only when requested as part of a + # ServiceList operation. + sig do + params( + completed_tasks: Integer, + desired_tasks: Integer, + running_tasks: Integer + ).returns(T.attached_class) + end + def self.new( + # The number of tasks for a job that are in the Completed state. This field must + # be cross-referenced with the service type, as the value of 0 may mean the + # service is not in a job mode, or it may mean the job-mode service has no tasks + # yet Completed. + completed_tasks: nil, + # The number of tasks for the service desired to be running. For replicated + # services, this is the replica count from the service spec. For global services, + # this is computed by taking count of all tasks for the service with a Desired + # State other than Shutdown. + desired_tasks: nil, + # The number of tasks for the service currently in the Running state. + running_tasks: nil + ) + end + + sig do + override.returns( + { + completed_tasks: Integer, + desired_tasks: Integer, + running_tasks: Integer + } + ) + end + def to_hash + end + end + + class UpdateStatus < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Service::UpdateStatus, Docker::Internal::AnyHash) + end + + sig { returns(T.nilable(String)) } + attr_reader :completed_at + + sig { params(completed_at: String).void } + attr_writer :completed_at + + sig { returns(T.nilable(String)) } + attr_reader :message + + sig { params(message: String).void } + attr_writer :message + + sig { returns(T.nilable(String)) } + attr_reader :started_at + + sig { params(started_at: String).void } + attr_writer :started_at + + sig do + returns(T.nilable(Docker::Service::UpdateStatus::State::TaggedSymbol)) + end + attr_reader :state + + sig do + params(state: Docker::Service::UpdateStatus::State::OrSymbol).void + end + attr_writer :state + + # The status of a service update. + sig do + params( + completed_at: String, + message: String, + started_at: String, + state: Docker::Service::UpdateStatus::State::OrSymbol + ).returns(T.attached_class) + end + def self.new( + completed_at: nil, + message: nil, + started_at: nil, + state: nil + ) + end + + sig do + override.returns( + { + completed_at: String, + message: String, + started_at: String, + state: Docker::Service::UpdateStatus::State::TaggedSymbol + } + ) + end + def to_hash + end + + module State + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Docker::Service::UpdateStatus::State) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + UPDATING = + T.let(:updating, Docker::Service::UpdateStatus::State::TaggedSymbol) + PAUSED = + T.let(:paused, Docker::Service::UpdateStatus::State::TaggedSymbol) + COMPLETED = + T.let( + :completed, + Docker::Service::UpdateStatus::State::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Docker::Service::UpdateStatus::State::TaggedSymbol] + ) + end + def self.values + end + end + end + + class Version < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Service::Version, Docker::Internal::AnyHash) + end + + sig { returns(T.nilable(Integer)) } + attr_reader :index + + sig { params(index: Integer).void } + attr_writer :index + + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + sig { params(index: Integer).returns(T.attached_class) } + def self.new(index: nil) + end + + sig { override.returns({ index: Integer }) } + def to_hash + end + end + end + end +end diff --git a/rbi/docker/models/service_create_params.rbi b/rbi/docker/models/service_create_params.rbi new file mode 100644 index 0000000..9172a62 --- /dev/null +++ b/rbi/docker/models/service_create_params.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module Docker + module Models + class ServiceCreateParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ServiceCreateParams, Docker::Internal::AnyHash) + end + + # User modifiable configuration for a service. + sig { returns(Docker::ServiceCreateParams::Spec) } + attr_reader :spec + + sig { params(spec: Docker::ServiceCreateParams::Spec::OrHash).void } + attr_writer :spec + + sig { returns(T.nilable(String)) } + attr_reader :x_registry_auth + + sig { params(x_registry_auth: String).void } + attr_writer :x_registry_auth + + sig do + params( + spec: Docker::ServiceCreateParams::Spec::OrHash, + x_registry_auth: String, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # User modifiable configuration for a service. + spec:, + x_registry_auth: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + spec: Docker::ServiceCreateParams::Spec, + x_registry_auth: String, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + + class Spec < Docker::Models::Spec + OrHash = + T.type_alias do + T.any(Docker::ServiceCreateParams::Spec, Docker::Internal::AnyHash) + end + + # User modifiable configuration for a service. + sig { returns(T.attached_class) } + def self.new + end + + sig { override.returns({}) } + def to_hash + end + end + end + end +end diff --git a/rbi/docker/models/service_create_response.rbi b/rbi/docker/models/service_create_response.rbi new file mode 100644 index 0000000..e419207 --- /dev/null +++ b/rbi/docker/models/service_create_response.rbi @@ -0,0 +1,50 @@ +# typed: strong + +module Docker + module Models + class ServiceCreateResponse < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::ServiceCreateResponse, + Docker::Internal::AnyHash + ) + end + + # The ID of the created service. + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Optional warning message. + # + # FIXME(thaJeztah): this should have "omitempty" in the generated type. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :warnings + + # contains the information returned to a client on the creation of a new service. + sig do + params(id: String, warnings: T.nilable(T::Array[String])).returns( + T.attached_class + ) + end + def self.new( + # The ID of the created service. + id: nil, + # Optional warning message. + # + # FIXME(thaJeztah): this should have "omitempty" in the generated type. + warnings: nil + ) + end + + sig do + override.returns({ id: String, warnings: T.nilable(T::Array[String]) }) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/service_delete_params.rbi b/rbi/docker/models/service_delete_params.rbi new file mode 100644 index 0000000..5d669ba --- /dev/null +++ b/rbi/docker/models/service_delete_params.rbi @@ -0,0 +1,27 @@ +# typed: strong + +module Docker + module Models + class ServiceDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ServiceDeleteParams, Docker::Internal::AnyHash) + end + + sig do + params(request_options: Docker::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Docker::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/docker/models/service_inspect_params.rbi b/rbi/docker/models/service_inspect_params.rbi new file mode 100644 index 0000000..3666066 --- /dev/null +++ b/rbi/docker/models/service_inspect_params.rbi @@ -0,0 +1,46 @@ +# typed: strong + +module Docker + module Models + class ServiceInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ServiceInspectParams, Docker::Internal::AnyHash) + end + + # Fill empty fields with default values. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :insert_defaults + + sig { params(insert_defaults: T::Boolean).void } + attr_writer :insert_defaults + + sig do + params( + insert_defaults: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Fill empty fields with default values. + insert_defaults: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + insert_defaults: T::Boolean, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/service_list_params.rbi b/rbi/docker/models/service_list_params.rbi new file mode 100644 index 0000000..c483b94 --- /dev/null +++ b/rbi/docker/models/service_list_params.rbi @@ -0,0 +1,73 @@ +# typed: strong + +module Docker + module Models + class ServiceListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::ServiceListParams, Docker::Internal::AnyHash) + end + + # A JSON encoded value of the filters (a `map[string][]string`) to process on the + # services list. + # + # Available filters: + # + # - `id=` + # - `label=` + # - `mode=["replicated"|"global"]` + # - `name=` + sig { returns(T.nilable(String)) } + attr_reader :filters + + sig { params(filters: String).void } + attr_writer :filters + + # Include service status, with count of running and desired tasks. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :status + + sig { params(status: T::Boolean).void } + attr_writer :status + + sig do + params( + filters: String, + status: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # A JSON encoded value of the filters (a `map[string][]string`) to process on the + # services list. + # + # Available filters: + # + # - `id=` + # - `label=` + # - `mode=["replicated"|"global"]` + # - `name=` + filters: nil, + # Include service status, with count of running and desired tasks. + status: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + filters: String, + status: T::Boolean, + request_options: Docker::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/service_list_response.rbi b/rbi/docker/models/service_list_response.rbi new file mode 100644 index 0000000..5cbc08f --- /dev/null +++ b/rbi/docker/models/service_list_response.rbi @@ -0,0 +1,11 @@ +# typed: strong + +module Docker + module Models + ServiceListResponse = + T.let( + Docker::Internal::Type::ArrayOf[Docker::Service], + Docker::Internal::Type::Converter + ) + end +end diff --git a/rbi/docker/models/spec.rbi b/rbi/docker/models/spec.rbi new file mode 100644 index 0000000..077d26c --- /dev/null +++ b/rbi/docker/models/spec.rbi @@ -0,0 +1,4456 @@ +# typed: strong + +module Docker + module Models + class Spec < Docker::Internal::Type::BaseModel + OrHash = T.type_alias { T.any(Docker::Spec, Docker::Internal::AnyHash) } + + # Properties that can be configured to access and load balance a service. + sig { returns(T.nilable(Docker::Spec::EndpointSpec)) } + attr_reader :endpoint_spec + + sig { params(endpoint_spec: Docker::Spec::EndpointSpec::OrHash).void } + attr_writer :endpoint_spec + + # User-defined key/value metadata. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :labels + + sig { params(labels: T::Hash[Symbol, String]).void } + attr_writer :labels + + # Scheduling mode for the service. + sig { returns(T.nilable(Docker::Spec::Mode)) } + attr_reader :mode + + sig { params(mode: Docker::Spec::Mode::OrHash).void } + attr_writer :mode + + # Name of the service. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Specifies which networks the service should attach to. + # + # Deprecated: This field is deprecated since v1.44. The Networks field in TaskSpec + # should be used instead. + sig { returns(T.nilable(T::Array[Docker::Spec::Network])) } + attr_reader :networks + + sig { params(networks: T::Array[Docker::Spec::Network::OrHash]).void } + attr_writer :networks + + # Specification for the rollback strategy of the service. + sig { returns(T.nilable(Docker::Spec::RollbackConfig)) } + attr_reader :rollback_config + + sig { params(rollback_config: Docker::Spec::RollbackConfig::OrHash).void } + attr_writer :rollback_config + + # User modifiable task configuration. + sig { returns(T.nilable(Docker::Spec::TaskTemplate)) } + attr_reader :task_template + + sig { params(task_template: Docker::Spec::TaskTemplate::OrHash).void } + attr_writer :task_template + + # Specification for the update strategy of the service. + sig { returns(T.nilable(Docker::Spec::UpdateConfig)) } + attr_reader :update_config + + sig { params(update_config: Docker::Spec::UpdateConfig::OrHash).void } + attr_writer :update_config + + # User modifiable configuration for a service. + sig do + params( + endpoint_spec: Docker::Spec::EndpointSpec::OrHash, + labels: T::Hash[Symbol, String], + mode: Docker::Spec::Mode::OrHash, + name: String, + networks: T::Array[Docker::Spec::Network::OrHash], + rollback_config: Docker::Spec::RollbackConfig::OrHash, + task_template: Docker::Spec::TaskTemplate::OrHash, + update_config: Docker::Spec::UpdateConfig::OrHash + ).returns(T.attached_class) + end + def self.new( + # Properties that can be configured to access and load balance a service. + endpoint_spec: nil, + # User-defined key/value metadata. + labels: nil, + # Scheduling mode for the service. + mode: nil, + # Name of the service. + name: nil, + # Specifies which networks the service should attach to. + # + # Deprecated: This field is deprecated since v1.44. The Networks field in TaskSpec + # should be used instead. + networks: nil, + # Specification for the rollback strategy of the service. + rollback_config: nil, + # User modifiable task configuration. + task_template: nil, + # Specification for the update strategy of the service. + update_config: nil + ) + end + + sig do + override.returns( + { + endpoint_spec: Docker::Spec::EndpointSpec, + labels: T::Hash[Symbol, String], + mode: Docker::Spec::Mode, + name: String, + networks: T::Array[Docker::Spec::Network], + rollback_config: Docker::Spec::RollbackConfig, + task_template: Docker::Spec::TaskTemplate, + update_config: Docker::Spec::UpdateConfig + } + ) + end + def to_hash + end + + class EndpointSpec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Spec::EndpointSpec, Docker::Internal::AnyHash) + end + + # The mode of resolution to use for internal load balancing between tasks. + sig { returns(T.nilable(Docker::Spec::EndpointSpec::Mode::OrSymbol)) } + attr_reader :mode + + sig { params(mode: Docker::Spec::EndpointSpec::Mode::OrSymbol).void } + attr_writer :mode + + # List of exposed ports that this service is accessible on from the outside. Ports + # can only be provided if `vip` resolution mode is used. + sig { returns(T.nilable(T::Array[Docker::Spec::EndpointSpec::Port])) } + attr_reader :ports + + sig do + params(ports: T::Array[Docker::Spec::EndpointSpec::Port::OrHash]).void + end + attr_writer :ports + + # Properties that can be configured to access and load balance a service. + sig do + params( + mode: Docker::Spec::EndpointSpec::Mode::OrSymbol, + ports: T::Array[Docker::Spec::EndpointSpec::Port::OrHash] + ).returns(T.attached_class) + end + def self.new( + # The mode of resolution to use for internal load balancing between tasks. + mode: nil, + # List of exposed ports that this service is accessible on from the outside. Ports + # can only be provided if `vip` resolution mode is used. + ports: nil + ) + end + + sig do + override.returns( + { + mode: Docker::Spec::EndpointSpec::Mode::OrSymbol, + ports: T::Array[Docker::Spec::EndpointSpec::Port] + } + ) + end + def to_hash + end + + # The mode of resolution to use for internal load balancing between tasks. + module Mode + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Docker::Spec::EndpointSpec::Mode) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + VIP = T.let(:vip, Docker::Spec::EndpointSpec::Mode::TaggedSymbol) + DNSRR = T.let(:dnsrr, Docker::Spec::EndpointSpec::Mode::TaggedSymbol) + + sig do + override.returns( + T::Array[Docker::Spec::EndpointSpec::Mode::TaggedSymbol] + ) + end + def self.values + end + end + + class Port < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Spec::EndpointSpec::Port, Docker::Internal::AnyHash) + end + + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + sig do + returns( + T.nilable(Docker::Spec::EndpointSpec::Port::Protocol::OrSymbol) + ) + end + attr_reader :protocol + + sig do + params( + protocol: Docker::Spec::EndpointSpec::Port::Protocol::OrSymbol + ).void + end + attr_writer :protocol + + # The port on the swarm hosts. + sig { returns(T.nilable(Integer)) } + attr_reader :published_port + + sig { params(published_port: Integer).void } + attr_writer :published_port + + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + sig do + returns( + T.nilable(Docker::Spec::EndpointSpec::Port::PublishMode::OrSymbol) + ) + end + attr_reader :publish_mode + + sig do + params( + publish_mode: + Docker::Spec::EndpointSpec::Port::PublishMode::OrSymbol + ).void + end + attr_writer :publish_mode + + # The port inside the container. + sig { returns(T.nilable(Integer)) } + attr_reader :target_port + + sig { params(target_port: Integer).void } + attr_writer :target_port + + sig do + params( + name: String, + protocol: Docker::Spec::EndpointSpec::Port::Protocol::OrSymbol, + published_port: Integer, + publish_mode: + Docker::Spec::EndpointSpec::Port::PublishMode::OrSymbol, + target_port: Integer + ).returns(T.attached_class) + end + def self.new( + name: nil, + protocol: nil, + # The port on the swarm hosts. + published_port: nil, + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + publish_mode: nil, + # The port inside the container. + target_port: nil + ) + end + + sig do + override.returns( + { + name: String, + protocol: Docker::Spec::EndpointSpec::Port::Protocol::OrSymbol, + published_port: Integer, + publish_mode: + Docker::Spec::EndpointSpec::Port::PublishMode::OrSymbol, + target_port: Integer + } + ) + end + def to_hash + end + + module Protocol + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Spec::EndpointSpec::Port::Protocol) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TCP = + T.let( + :tcp, + Docker::Spec::EndpointSpec::Port::Protocol::TaggedSymbol + ) + UDP = + T.let( + :udp, + Docker::Spec::EndpointSpec::Port::Protocol::TaggedSymbol + ) + SCTP = + T.let( + :sctp, + Docker::Spec::EndpointSpec::Port::Protocol::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Spec::EndpointSpec::Port::Protocol::TaggedSymbol + ] + ) + end + def self.values + end + end + + # The mode in which port is published. + # + #


+ # + # - "ingress" makes the target port accessible on every node, regardless of + # whether there is a task for the service running on that node or not. + # - "host" bypasses the routing mesh and publish the port directly on the swarm + # node where that service is running. + module PublishMode + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Spec::EndpointSpec::Port::PublishMode) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + INGRESS = + T.let( + :ingress, + Docker::Spec::EndpointSpec::Port::PublishMode::TaggedSymbol + ) + HOST = + T.let( + :host, + Docker::Spec::EndpointSpec::Port::PublishMode::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Spec::EndpointSpec::Port::PublishMode::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class Mode < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(Docker::Spec::Mode, Docker::Internal::AnyHash) } + + sig { returns(T.nilable(T.anything)) } + attr_reader :global + + sig { params(global: T.anything).void } + attr_writer :global + + # The mode used for services which run a task to the completed state on each valid + # node. + sig { returns(T.nilable(T.anything)) } + attr_reader :global_job + + sig { params(global_job: T.anything).void } + attr_writer :global_job + + sig { returns(T.nilable(Docker::Spec::Mode::Replicated)) } + attr_reader :replicated + + sig { params(replicated: Docker::Spec::Mode::Replicated::OrHash).void } + attr_writer :replicated + + # The mode used for services with a finite number of tasks that run to a completed + # state. + sig { returns(T.nilable(Docker::Spec::Mode::ReplicatedJob)) } + attr_reader :replicated_job + + sig do + params(replicated_job: Docker::Spec::Mode::ReplicatedJob::OrHash).void + end + attr_writer :replicated_job + + # Scheduling mode for the service. + sig do + params( + global: T.anything, + global_job: T.anything, + replicated: Docker::Spec::Mode::Replicated::OrHash, + replicated_job: Docker::Spec::Mode::ReplicatedJob::OrHash + ).returns(T.attached_class) + end + def self.new( + global: nil, + # The mode used for services which run a task to the completed state on each valid + # node. + global_job: nil, + replicated: nil, + # The mode used for services with a finite number of tasks that run to a completed + # state. + replicated_job: nil + ) + end + + sig do + override.returns( + { + global: T.anything, + global_job: T.anything, + replicated: Docker::Spec::Mode::Replicated, + replicated_job: Docker::Spec::Mode::ReplicatedJob + } + ) + end + def to_hash + end + + class Replicated < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Spec::Mode::Replicated, Docker::Internal::AnyHash) + end + + sig { returns(T.nilable(Integer)) } + attr_reader :replicas + + sig { params(replicas: Integer).void } + attr_writer :replicas + + sig { params(replicas: Integer).returns(T.attached_class) } + def self.new(replicas: nil) + end + + sig { override.returns({ replicas: Integer }) } + def to_hash + end + end + + class ReplicatedJob < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::Mode::ReplicatedJob, + Docker::Internal::AnyHash + ) + end + + # The maximum number of replicas to run simultaneously. + sig { returns(T.nilable(Integer)) } + attr_reader :max_concurrent + + sig { params(max_concurrent: Integer).void } + attr_writer :max_concurrent + + # The total number of replicas desired to reach the Completed state. If unset, + # will default to the value of `MaxConcurrent` + sig { returns(T.nilable(Integer)) } + attr_reader :total_completions + + sig { params(total_completions: Integer).void } + attr_writer :total_completions + + # The mode used for services with a finite number of tasks that run to a completed + # state. + sig do + params(max_concurrent: Integer, total_completions: Integer).returns( + T.attached_class + ) + end + def self.new( + # The maximum number of replicas to run simultaneously. + max_concurrent: nil, + # The total number of replicas desired to reach the Completed state. If unset, + # will default to the value of `MaxConcurrent` + total_completions: nil + ) + end + + sig do + override.returns( + { max_concurrent: Integer, total_completions: Integer } + ) + end + def to_hash + end + end + end + + class Network < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Spec::Network, Docker::Internal::AnyHash) + end + + # Discoverable alternate names for the service on this network. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :aliases + + sig { params(aliases: T::Array[String]).void } + attr_writer :aliases + + # Driver attachment options for the network target. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :driver_opts + + sig { params(driver_opts: T::Hash[Symbol, String]).void } + attr_writer :driver_opts + + # The target network for attachment. Must be a network name or ID. + sig { returns(T.nilable(String)) } + attr_reader :target + + sig { params(target: String).void } + attr_writer :target + + # Specifies how a service should be attached to a particular network. + sig do + params( + aliases: T::Array[String], + driver_opts: T::Hash[Symbol, String], + target: String + ).returns(T.attached_class) + end + def self.new( + # Discoverable alternate names for the service on this network. + aliases: nil, + # Driver attachment options for the network target. + driver_opts: nil, + # The target network for attachment. Must be a network name or ID. + target: nil + ) + end + + sig do + override.returns( + { + aliases: T::Array[String], + driver_opts: T::Hash[Symbol, String], + target: String + } + ) + end + def to_hash + end + end + + class RollbackConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Spec::RollbackConfig, Docker::Internal::AnyHash) + end + + # Amount of time between rollback iterations, in nanoseconds. + sig { returns(T.nilable(Integer)) } + attr_reader :delay + + sig { params(delay: Integer).void } + attr_writer :delay + + # Action to take if an rolled back task fails to run, or stops running during the + # rollback. + sig do + returns( + T.nilable(Docker::Spec::RollbackConfig::FailureAction::OrSymbol) + ) + end + attr_reader :failure_action + + sig do + params( + failure_action: + Docker::Spec::RollbackConfig::FailureAction::OrSymbol + ).void + end + attr_writer :failure_action + + # The fraction of tasks that may fail during a rollback before the failure action + # is invoked, specified as a floating point number between 0 and 1. + sig { returns(T.nilable(Float)) } + attr_reader :max_failure_ratio + + sig { params(max_failure_ratio: Float).void } + attr_writer :max_failure_ratio + + # Amount of time to monitor each rolled back task for failures, in nanoseconds. + sig { returns(T.nilable(Integer)) } + attr_reader :monitor + + sig { params(monitor: Integer).void } + attr_writer :monitor + + # The order of operations when rolling back a task. Either the old task is shut + # down before the new task is started, or the new task is started before the old + # task is shut down. + sig do + returns(T.nilable(Docker::Spec::RollbackConfig::Order::OrSymbol)) + end + attr_reader :order + + sig do + params(order: Docker::Spec::RollbackConfig::Order::OrSymbol).void + end + attr_writer :order + + # Maximum number of tasks to be rolled back in one iteration (0 means unlimited + # parallelism). + sig { returns(T.nilable(Integer)) } + attr_reader :parallelism + + sig { params(parallelism: Integer).void } + attr_writer :parallelism + + # Specification for the rollback strategy of the service. + sig do + params( + delay: Integer, + failure_action: + Docker::Spec::RollbackConfig::FailureAction::OrSymbol, + max_failure_ratio: Float, + monitor: Integer, + order: Docker::Spec::RollbackConfig::Order::OrSymbol, + parallelism: Integer + ).returns(T.attached_class) + end + def self.new( + # Amount of time between rollback iterations, in nanoseconds. + delay: nil, + # Action to take if an rolled back task fails to run, or stops running during the + # rollback. + failure_action: nil, + # The fraction of tasks that may fail during a rollback before the failure action + # is invoked, specified as a floating point number between 0 and 1. + max_failure_ratio: nil, + # Amount of time to monitor each rolled back task for failures, in nanoseconds. + monitor: nil, + # The order of operations when rolling back a task. Either the old task is shut + # down before the new task is started, or the new task is started before the old + # task is shut down. + order: nil, + # Maximum number of tasks to be rolled back in one iteration (0 means unlimited + # parallelism). + parallelism: nil + ) + end + + sig do + override.returns( + { + delay: Integer, + failure_action: + Docker::Spec::RollbackConfig::FailureAction::OrSymbol, + max_failure_ratio: Float, + monitor: Integer, + order: Docker::Spec::RollbackConfig::Order::OrSymbol, + parallelism: Integer + } + ) + end + def to_hash + end + + # Action to take if an rolled back task fails to run, or stops running during the + # rollback. + module FailureAction + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Spec::RollbackConfig::FailureAction) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CONTINUE = + T.let( + :continue, + Docker::Spec::RollbackConfig::FailureAction::TaggedSymbol + ) + PAUSE = + T.let( + :pause, + Docker::Spec::RollbackConfig::FailureAction::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Spec::RollbackConfig::FailureAction::TaggedSymbol + ] + ) + end + def self.values + end + end + + # The order of operations when rolling back a task. Either the old task is shut + # down before the new task is started, or the new task is started before the old + # task is shut down. + module Order + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Docker::Spec::RollbackConfig::Order) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + STOP_FIRST = + T.let( + :"stop-first", + Docker::Spec::RollbackConfig::Order::TaggedSymbol + ) + START_FIRST = + T.let( + :"start-first", + Docker::Spec::RollbackConfig::Order::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Docker::Spec::RollbackConfig::Order::TaggedSymbol] + ) + end + def self.values + end + end + end + + class TaskTemplate < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Spec::TaskTemplate, Docker::Internal::AnyHash) + end + + # Container spec for the service. + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + sig { returns(T.nilable(Docker::Spec::TaskTemplate::ContainerSpec)) } + attr_reader :container_spec + + sig do + params( + container_spec: Docker::Spec::TaskTemplate::ContainerSpec::OrHash + ).void + end + attr_writer :container_spec + + # A counter that triggers an update even if no relevant parameters have been + # changed. + sig { returns(T.nilable(Integer)) } + attr_reader :force_update + + sig { params(force_update: Integer).void } + attr_writer :force_update + + # Specifies the log driver to use for tasks created from this spec. If not + # present, the default one for the swarm will be used, finally falling back to the + # engine default if not specified. + sig { returns(T.nilable(Docker::Spec::TaskTemplate::LogDriver)) } + attr_reader :log_driver + + sig do + params(log_driver: Docker::Spec::TaskTemplate::LogDriver::OrHash).void + end + attr_writer :log_driver + + # Read-only spec type for non-swarm containers attached to swarm overlay networks. + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + sig do + returns(T.nilable(Docker::Spec::TaskTemplate::NetworkAttachmentSpec)) + end + attr_reader :network_attachment_spec + + sig do + params( + network_attachment_spec: + Docker::Spec::TaskTemplate::NetworkAttachmentSpec::OrHash + ).void + end + attr_writer :network_attachment_spec + + # Specifies which networks the service should attach to. + sig do + returns(T.nilable(T::Array[Docker::Spec::TaskTemplate::Network])) + end + attr_reader :networks + + sig do + params( + networks: T::Array[Docker::Spec::TaskTemplate::Network::OrHash] + ).void + end + attr_writer :networks + + sig { returns(T.nilable(Docker::Spec::TaskTemplate::Placement)) } + attr_reader :placement + + sig do + params(placement: Docker::Spec::TaskTemplate::Placement::OrHash).void + end + attr_writer :placement + + # Plugin spec for the service. _(Experimental release only.)_ + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + sig { returns(T.nilable(Docker::Spec::TaskTemplate::PluginSpec)) } + attr_reader :plugin_spec + + sig do + params( + plugin_spec: Docker::Spec::TaskTemplate::PluginSpec::OrHash + ).void + end + attr_writer :plugin_spec + + # Resource requirements which apply to each individual container created as part + # of the service. + sig { returns(T.nilable(Docker::Spec::TaskTemplate::Resources)) } + attr_reader :resources + + sig do + params(resources: Docker::Spec::TaskTemplate::Resources::OrHash).void + end + attr_writer :resources + + # Specification for the restart policy which applies to containers created as part + # of this service. + sig { returns(T.nilable(Docker::Spec::TaskTemplate::RestartPolicy)) } + attr_reader :restart_policy + + sig do + params( + restart_policy: Docker::Spec::TaskTemplate::RestartPolicy::OrHash + ).void + end + attr_writer :restart_policy + + # Runtime is the type of runtime specified for the task executor. + sig { returns(T.nilable(String)) } + attr_reader :runtime + + sig { params(runtime: String).void } + attr_writer :runtime + + # User modifiable task configuration. + sig do + params( + container_spec: Docker::Spec::TaskTemplate::ContainerSpec::OrHash, + force_update: Integer, + log_driver: Docker::Spec::TaskTemplate::LogDriver::OrHash, + network_attachment_spec: + Docker::Spec::TaskTemplate::NetworkAttachmentSpec::OrHash, + networks: T::Array[Docker::Spec::TaskTemplate::Network::OrHash], + placement: Docker::Spec::TaskTemplate::Placement::OrHash, + plugin_spec: Docker::Spec::TaskTemplate::PluginSpec::OrHash, + resources: Docker::Spec::TaskTemplate::Resources::OrHash, + restart_policy: Docker::Spec::TaskTemplate::RestartPolicy::OrHash, + runtime: String + ).returns(T.attached_class) + end + def self.new( + # Container spec for the service. + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + container_spec: nil, + # A counter that triggers an update even if no relevant parameters have been + # changed. + force_update: nil, + # Specifies the log driver to use for tasks created from this spec. If not + # present, the default one for the swarm will be used, finally falling back to the + # engine default if not specified. + log_driver: nil, + # Read-only spec type for non-swarm containers attached to swarm overlay networks. + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + network_attachment_spec: nil, + # Specifies which networks the service should attach to. + networks: nil, + placement: nil, + # Plugin spec for the service. _(Experimental release only.)_ + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + plugin_spec: nil, + # Resource requirements which apply to each individual container created as part + # of the service. + resources: nil, + # Specification for the restart policy which applies to containers created as part + # of this service. + restart_policy: nil, + # Runtime is the type of runtime specified for the task executor. + runtime: nil + ) + end + + sig do + override.returns( + { + container_spec: Docker::Spec::TaskTemplate::ContainerSpec, + force_update: Integer, + log_driver: Docker::Spec::TaskTemplate::LogDriver, + network_attachment_spec: + Docker::Spec::TaskTemplate::NetworkAttachmentSpec, + networks: T::Array[Docker::Spec::TaskTemplate::Network], + placement: Docker::Spec::TaskTemplate::Placement, + plugin_spec: Docker::Spec::TaskTemplate::PluginSpec, + resources: Docker::Spec::TaskTemplate::Resources, + restart_policy: Docker::Spec::TaskTemplate::RestartPolicy, + runtime: String + } + ) + end + def to_hash + end + + class ContainerSpec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec, + Docker::Internal::AnyHash + ) + end + + # Arguments to the command. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :args + + sig { params(args: T::Array[String]).void } + attr_writer :args + + # A list of kernel capabilities to add to the default set for the container. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :capability_add + + sig { params(capability_add: T::Array[String]).void } + attr_writer :capability_add + + # A list of kernel capabilities to drop from the default set for the container. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :capability_drop + + sig { params(capability_drop: T::Array[String]).void } + attr_writer :capability_drop + + # The command to be run in the image. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :command + + sig { params(command: T::Array[String]).void } + attr_writer :command + + # Configs contains references to zero or more configs that will be exposed to the + # service. + sig do + returns( + T.nilable( + T::Array[Docker::Spec::TaskTemplate::ContainerSpec::Config] + ) + ) + end + attr_reader :configs + + sig do + params( + configs: + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Config::OrHash + ] + ).void + end + attr_writer :configs + + # The working directory for commands to run in. + sig { returns(T.nilable(String)) } + attr_reader :dir + + sig { params(dir: String).void } + attr_writer :dir + + # Specification for DNS related configurations in resolver configuration file + # (`resolv.conf`). + sig do + returns( + T.nilable(Docker::Spec::TaskTemplate::ContainerSpec::DNSConfig) + ) + end + attr_reader :dns_config + + sig do + params( + dns_config: + Docker::Spec::TaskTemplate::ContainerSpec::DNSConfig::OrHash + ).void + end + attr_writer :dns_config + + # A list of environment variables in the form `VAR=value`. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :env + + sig { params(env: T::Array[String]).void } + attr_writer :env + + # A list of additional groups that the container process will run as. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :groups + + sig { params(groups: T::Array[String]).void } + attr_writer :groups + + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + sig do + returns( + T.nilable(Docker::Spec::TaskTemplate::ContainerSpec::HealthCheck) + ) + end + attr_reader :health_check + + sig do + params( + health_check: + Docker::Spec::TaskTemplate::ContainerSpec::HealthCheck::OrHash + ).void + end + attr_writer :health_check + + # The hostname to use for the container, as a valid + # [RFC 1123](https://tools.ietf.org/html/rfc1123) hostname. + sig { returns(T.nilable(String)) } + attr_reader :hostname + + sig { params(hostname: String).void } + attr_writer :hostname + + # A list of hostname/IP mappings to add to the container's `hosts` file. The + # format of extra hosts is specified in the + # [hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html) man page: + # + # IP_address canonical_hostname [aliases...] + sig { returns(T.nilable(T::Array[String])) } + attr_reader :hosts + + sig { params(hosts: T::Array[String]).void } + attr_writer :hosts + + # The image name to use for the container + sig { returns(T.nilable(String)) } + attr_reader :image + + sig { params(image: String).void } + attr_writer :image + + # Run an init inside the container that forwards signals and reaps processes. This + # field is omitted if empty, and the default (as configured on the daemon) is + # used. + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :init + + # Isolation technology of the containers running the service. (Windows only) + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Isolation::OrSymbol + ) + ) + end + attr_reader :isolation + + sig do + params( + isolation: + Docker::Spec::TaskTemplate::ContainerSpec::Isolation::OrSymbol + ).void + end + attr_writer :isolation + + # User-defined key/value data. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :labels + + sig { params(labels: T::Hash[Symbol, String]).void } + attr_writer :labels + + # Specification for mounts to be added to containers created as part of the + # service. + sig do + returns( + T.nilable( + T::Array[Docker::Spec::TaskTemplate::ContainerSpec::Mount] + ) + ) + end + attr_reader :mounts + + sig do + params( + mounts: + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Mount::OrHash + ] + ).void + end + attr_writer :mounts + + # An integer value containing the score given to the container in order to tune + # OOM killer preferences. + sig { returns(T.nilable(Integer)) } + attr_reader :oom_score_adj + + sig { params(oom_score_adj: Integer).void } + attr_writer :oom_score_adj + + # Open `stdin` + sig { returns(T.nilable(T::Boolean)) } + attr_reader :open_stdin + + sig { params(open_stdin: T::Boolean).void } + attr_writer :open_stdin + + # Security options for the container + sig do + returns( + T.nilable(Docker::Spec::TaskTemplate::ContainerSpec::Privileges) + ) + end + attr_reader :privileges + + sig do + params( + privileges: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::OrHash + ).void + end + attr_writer :privileges + + # Mount the container's root filesystem as read only. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :read_only + + sig { params(read_only: T::Boolean).void } + attr_writer :read_only + + # Secrets contains references to zero or more secrets that will be exposed to the + # service. + sig do + returns( + T.nilable( + T::Array[Docker::Spec::TaskTemplate::ContainerSpec::Secret] + ) + ) + end + attr_reader :secrets + + sig do + params( + secrets: + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Secret::OrHash + ] + ).void + end + attr_writer :secrets + + # Amount of time to wait for the container to terminate before forcefully killing + # it. + sig { returns(T.nilable(Integer)) } + attr_reader :stop_grace_period + + sig { params(stop_grace_period: Integer).void } + attr_writer :stop_grace_period + + # Signal to stop the container. + sig { returns(T.nilable(String)) } + attr_reader :stop_signal + + sig { params(stop_signal: String).void } + attr_writer :stop_signal + + # Set kernel namedspaced parameters (sysctls) in the container. The Sysctls option + # on services accepts the same sysctls as the are supported on containers. Note + # that while the same sysctls are supported, no guarantees or checks are made + # about their suitability for a clustered environment, and it's up to the user to + # determine whether a given sysctl will work properly in a Service. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :sysctls + + sig { params(sysctls: T::Hash[Symbol, String]).void } + attr_writer :sysctls + + # Whether a pseudo-TTY should be allocated. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :tty + + sig { params(tty: T::Boolean).void } + attr_writer :tty + + # A list of resource limits to set in the container. For example: + # `{"Name": "nofile", "Soft": 1024, "Hard": 2048}`" + sig do + returns( + T.nilable( + T::Array[Docker::Spec::TaskTemplate::ContainerSpec::Ulimit] + ) + ) + end + attr_reader :ulimits + + sig do + params( + ulimits: + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Ulimit::OrHash + ] + ).void + end + attr_writer :ulimits + + # The user inside the container. + sig { returns(T.nilable(String)) } + attr_reader :user + + sig { params(user: String).void } + attr_writer :user + + # Container spec for the service. + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + sig do + params( + args: T::Array[String], + capability_add: T::Array[String], + capability_drop: T::Array[String], + command: T::Array[String], + configs: + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Config::OrHash + ], + dir: String, + dns_config: + Docker::Spec::TaskTemplate::ContainerSpec::DNSConfig::OrHash, + env: T::Array[String], + groups: T::Array[String], + health_check: + Docker::Spec::TaskTemplate::ContainerSpec::HealthCheck::OrHash, + hostname: String, + hosts: T::Array[String], + image: String, + init: T.nilable(T::Boolean), + isolation: + Docker::Spec::TaskTemplate::ContainerSpec::Isolation::OrSymbol, + labels: T::Hash[Symbol, String], + mounts: + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Mount::OrHash + ], + oom_score_adj: Integer, + open_stdin: T::Boolean, + privileges: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::OrHash, + read_only: T::Boolean, + secrets: + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Secret::OrHash + ], + stop_grace_period: Integer, + stop_signal: String, + sysctls: T::Hash[Symbol, String], + tty: T::Boolean, + ulimits: + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Ulimit::OrHash + ], + user: String + ).returns(T.attached_class) + end + def self.new( + # Arguments to the command. + args: nil, + # A list of kernel capabilities to add to the default set for the container. + capability_add: nil, + # A list of kernel capabilities to drop from the default set for the container. + capability_drop: nil, + # The command to be run in the image. + command: nil, + # Configs contains references to zero or more configs that will be exposed to the + # service. + configs: nil, + # The working directory for commands to run in. + dir: nil, + # Specification for DNS related configurations in resolver configuration file + # (`resolv.conf`). + dns_config: nil, + # A list of environment variables in the form `VAR=value`. + env: nil, + # A list of additional groups that the container process will run as. + groups: nil, + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + health_check: nil, + # The hostname to use for the container, as a valid + # [RFC 1123](https://tools.ietf.org/html/rfc1123) hostname. + hostname: nil, + # A list of hostname/IP mappings to add to the container's `hosts` file. The + # format of extra hosts is specified in the + # [hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html) man page: + # + # IP_address canonical_hostname [aliases...] + hosts: nil, + # The image name to use for the container + image: nil, + # Run an init inside the container that forwards signals and reaps processes. This + # field is omitted if empty, and the default (as configured on the daemon) is + # used. + init: nil, + # Isolation technology of the containers running the service. (Windows only) + isolation: nil, + # User-defined key/value data. + labels: nil, + # Specification for mounts to be added to containers created as part of the + # service. + mounts: nil, + # An integer value containing the score given to the container in order to tune + # OOM killer preferences. + oom_score_adj: nil, + # Open `stdin` + open_stdin: nil, + # Security options for the container + privileges: nil, + # Mount the container's root filesystem as read only. + read_only: nil, + # Secrets contains references to zero or more secrets that will be exposed to the + # service. + secrets: nil, + # Amount of time to wait for the container to terminate before forcefully killing + # it. + stop_grace_period: nil, + # Signal to stop the container. + stop_signal: nil, + # Set kernel namedspaced parameters (sysctls) in the container. The Sysctls option + # on services accepts the same sysctls as the are supported on containers. Note + # that while the same sysctls are supported, no guarantees or checks are made + # about their suitability for a clustered environment, and it's up to the user to + # determine whether a given sysctl will work properly in a Service. + sysctls: nil, + # Whether a pseudo-TTY should be allocated. + tty: nil, + # A list of resource limits to set in the container. For example: + # `{"Name": "nofile", "Soft": 1024, "Hard": 2048}`" + ulimits: nil, + # The user inside the container. + user: nil + ) + end + + sig do + override.returns( + { + args: T::Array[String], + capability_add: T::Array[String], + capability_drop: T::Array[String], + command: T::Array[String], + configs: + T::Array[Docker::Spec::TaskTemplate::ContainerSpec::Config], + dir: String, + dns_config: + Docker::Spec::TaskTemplate::ContainerSpec::DNSConfig, + env: T::Array[String], + groups: T::Array[String], + health_check: + Docker::Spec::TaskTemplate::ContainerSpec::HealthCheck, + hostname: String, + hosts: T::Array[String], + image: String, + init: T.nilable(T::Boolean), + isolation: + Docker::Spec::TaskTemplate::ContainerSpec::Isolation::OrSymbol, + labels: T::Hash[Symbol, String], + mounts: + T::Array[Docker::Spec::TaskTemplate::ContainerSpec::Mount], + oom_score_adj: Integer, + open_stdin: T::Boolean, + privileges: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges, + read_only: T::Boolean, + secrets: + T::Array[Docker::Spec::TaskTemplate::ContainerSpec::Secret], + stop_grace_period: Integer, + stop_signal: String, + sysctls: T::Hash[Symbol, String], + tty: T::Boolean, + ulimits: + T::Array[Docker::Spec::TaskTemplate::ContainerSpec::Ulimit], + user: String + } + ) + end + def to_hash + end + + class Config < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Config, + Docker::Internal::AnyHash + ) + end + + # ConfigID represents the ID of the specific config that we're referencing. + sig { returns(T.nilable(String)) } + attr_reader :config_id + + sig { params(config_id: String).void } + attr_writer :config_id + + # ConfigName is the name of the config that this references, but this is just + # provided for lookup/display purposes. The config in the reference will be + # identified by its ID. + sig { returns(T.nilable(String)) } + attr_reader :config_name + + sig { params(config_name: String).void } + attr_writer :config_name + + # File represents a specific target that is backed by a file. + # + #


+ # + # > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Config::File + ) + ) + end + attr_reader :file + + sig do + params( + file: + Docker::Spec::TaskTemplate::ContainerSpec::Config::File::OrHash + ).void + end + attr_writer :file + + # Runtime represents a target that is not mounted into the container but is used + # by the task + # + #


+ # + # > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + sig { returns(T.nilable(T.anything)) } + attr_reader :runtime + + sig { params(runtime: T.anything).void } + attr_writer :runtime + + sig do + params( + config_id: String, + config_name: String, + file: + Docker::Spec::TaskTemplate::ContainerSpec::Config::File::OrHash, + runtime: T.anything + ).returns(T.attached_class) + end + def self.new( + # ConfigID represents the ID of the specific config that we're referencing. + config_id: nil, + # ConfigName is the name of the config that this references, but this is just + # provided for lookup/display purposes. The config in the reference will be + # identified by its ID. + config_name: nil, + # File represents a specific target that is backed by a file. + # + #


+ # + # > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + file: nil, + # Runtime represents a target that is not mounted into the container but is used + # by the task + # + #


+ # + # > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + runtime: nil + ) + end + + sig do + override.returns( + { + config_id: String, + config_name: String, + file: Docker::Spec::TaskTemplate::ContainerSpec::Config::File, + runtime: T.anything + } + ) + end + def to_hash + end + + class File < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Config::File, + Docker::Internal::AnyHash + ) + end + + # GID represents the file GID. + sig { returns(T.nilable(String)) } + attr_reader :gid + + sig { params(gid: String).void } + attr_writer :gid + + # Mode represents the FileMode of the file. + sig { returns(T.nilable(Integer)) } + attr_reader :mode + + sig { params(mode: Integer).void } + attr_writer :mode + + # Name represents the final filename in the filesystem. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # UID represents the file UID. + sig { returns(T.nilable(String)) } + attr_reader :uid + + sig { params(uid: String).void } + attr_writer :uid + + # File represents a specific target that is backed by a file. + # + #


+ # + # > **Note**: `Configs.File` and `Configs.Runtime` are mutually exclusive + sig do + params( + gid: String, + mode: Integer, + name: String, + uid: String + ).returns(T.attached_class) + end + def self.new( + # GID represents the file GID. + gid: nil, + # Mode represents the FileMode of the file. + mode: nil, + # Name represents the final filename in the filesystem. + name: nil, + # UID represents the file UID. + uid: nil + ) + end + + sig do + override.returns( + { gid: String, mode: Integer, name: String, uid: String } + ) + end + def to_hash + end + end + end + + class DNSConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::DNSConfig, + Docker::Internal::AnyHash + ) + end + + # The IP addresses of the name servers. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :nameservers + + sig { params(nameservers: T::Array[String]).void } + attr_writer :nameservers + + # A list of internal resolver variables to be modified (e.g., `debug`, `ndots:3`, + # etc.). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :options + + sig { params(options: T::Array[String]).void } + attr_writer :options + + # A search list for host-name lookup. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :search + + sig { params(search: T::Array[String]).void } + attr_writer :search + + # Specification for DNS related configurations in resolver configuration file + # (`resolv.conf`). + sig do + params( + nameservers: T::Array[String], + options: T::Array[String], + search: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # The IP addresses of the name servers. + nameservers: nil, + # A list of internal resolver variables to be modified (e.g., `debug`, `ndots:3`, + # etc.). + options: nil, + # A search list for host-name lookup. + search: nil + ) + end + + sig do + override.returns( + { + nameservers: T::Array[String], + options: T::Array[String], + search: T::Array[String] + } + ) + end + def to_hash + end + end + + class HealthCheck < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::HealthCheck, + Docker::Internal::AnyHash + ) + end + + # The time to wait between checks in nanoseconds. It should be 0 or at least + # 1000000 (1 ms). 0 means inherit. + sig { returns(T.nilable(Integer)) } + attr_reader :interval + + sig { params(interval: Integer).void } + attr_writer :interval + + # The number of consecutive failures needed to consider a container as unhealthy. + # 0 means inherit. + sig { returns(T.nilable(Integer)) } + attr_reader :retries + + sig { params(retries: Integer).void } + attr_writer :retries + + # The time to wait between checks in nanoseconds during the start period. It + # should be 0 or at least 1000000 (1 ms). 0 means inherit. + sig { returns(T.nilable(Integer)) } + attr_reader :start_interval + + sig { params(start_interval: Integer).void } + attr_writer :start_interval + + # Start period for the container to initialize before starting health-retries + # countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means + # inherit. + sig { returns(T.nilable(Integer)) } + attr_reader :start_period + + sig { params(start_period: Integer).void } + attr_writer :start_period + + # The test to perform. Possible values are: + # + # - `[]` inherit healthcheck from image or parent image + # - `["NONE"]` disable healthcheck + # - `["CMD", args...]` exec arguments directly + # - `["CMD-SHELL", command]` run command with system's default shell + # + # A non-zero exit code indicates a failed healthcheck: + # + # - `0` healthy + # - `1` unhealthy + # - `2` reserved (treated as unhealthy) + # - other values: error running probe + sig { returns(T.nilable(T::Array[String])) } + attr_reader :test_ + + sig { params(test_: T::Array[String]).void } + attr_writer :test_ + + # The time to wait before considering the check to have hung. It should be 0 or at + # least 1000000 (1 ms). 0 means inherit. + # + # If the health check command does not complete within this timeout, the check is + # considered failed and the health check process is forcibly terminated without a + # graceful shutdown. + sig { returns(T.nilable(Integer)) } + attr_reader :timeout + + sig { params(timeout: Integer).void } + attr_writer :timeout + + # A test to perform to check that the container is healthy. Healthcheck commands + # should be side-effect free. + sig do + params( + interval: Integer, + retries: Integer, + start_interval: Integer, + start_period: Integer, + test_: T::Array[String], + timeout: Integer + ).returns(T.attached_class) + end + def self.new( + # The time to wait between checks in nanoseconds. It should be 0 or at least + # 1000000 (1 ms). 0 means inherit. + interval: nil, + # The number of consecutive failures needed to consider a container as unhealthy. + # 0 means inherit. + retries: nil, + # The time to wait between checks in nanoseconds during the start period. It + # should be 0 or at least 1000000 (1 ms). 0 means inherit. + start_interval: nil, + # Start period for the container to initialize before starting health-retries + # countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means + # inherit. + start_period: nil, + # The test to perform. Possible values are: + # + # - `[]` inherit healthcheck from image or parent image + # - `["NONE"]` disable healthcheck + # - `["CMD", args...]` exec arguments directly + # - `["CMD-SHELL", command]` run command with system's default shell + # + # A non-zero exit code indicates a failed healthcheck: + # + # - `0` healthy + # - `1` unhealthy + # - `2` reserved (treated as unhealthy) + # - other values: error running probe + test_: nil, + # The time to wait before considering the check to have hung. It should be 0 or at + # least 1000000 (1 ms). 0 means inherit. + # + # If the health check command does not complete within this timeout, the check is + # considered failed and the health check process is forcibly terminated without a + # graceful shutdown. + timeout: nil + ) + end + + sig do + override.returns( + { + interval: Integer, + retries: Integer, + start_interval: Integer, + start_period: Integer, + test_: T::Array[String], + timeout: Integer + } + ) + end + def to_hash + end + end + + # Isolation technology of the containers running the service. (Windows only) + module Isolation + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Spec::TaskTemplate::ContainerSpec::Isolation + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DEFAULT = + T.let( + :default, + Docker::Spec::TaskTemplate::ContainerSpec::Isolation::TaggedSymbol + ) + PROCESS = + T.let( + :process, + Docker::Spec::TaskTemplate::ContainerSpec::Isolation::TaggedSymbol + ) + HYPERV = + T.let( + :hyperv, + Docker::Spec::TaskTemplate::ContainerSpec::Isolation::TaggedSymbol + ) + EMPTY = + T.let( + :"", + Docker::Spec::TaskTemplate::ContainerSpec::Isolation::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Isolation::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Mount < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Mount, + Docker::Internal::AnyHash + ) + end + + # Optional configuration for the `bind` type. + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions + ) + ) + end + attr_reader :bind_options + + sig do + params( + bind_options: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::OrHash + ).void + end + attr_writer :bind_options + + # The consistency requirement for the mount: `default`, `consistent`, `cached`, or + # `delegated`. + sig { returns(T.nilable(String)) } + attr_reader :consistency + + sig { params(consistency: String).void } + attr_writer :consistency + + # Optional configuration for the `image` type. + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions + ) + ) + end + attr_reader :image_options + + sig do + params( + image_options: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions::OrHash + ).void + end + attr_writer :image_options + + # Whether the mount should be read-only. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :read_only + + sig { params(read_only: T::Boolean).void } + attr_writer :read_only + + # Mount source (e.g. a volume name, a host path). The source cannot be specified + # when using `Type=tmpfs`. For `Type=bind`, the source path must either exist, or + # the `CreateMountpoint` must be set to `true` to create the source path on the + # host if missing. + # + # For `Type=npipe`, the pipe must exist prior to creating the container. + sig { returns(T.nilable(String)) } + attr_reader :source + + sig { params(source: String).void } + attr_writer :source + + # Container path. + sig { returns(T.nilable(String)) } + attr_reader :target + + sig { params(target: String).void } + attr_writer :target + + # Optional configuration for the `tmpfs` type. + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions + ) + ) + end + attr_reader :tmpfs_options + + sig do + params( + tmpfs_options: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions::OrHash + ).void + end + attr_writer :tmpfs_options + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type::OrSymbol + ) + ) + end + attr_reader :type + + sig do + params( + type: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type::OrSymbol + ).void + end + attr_writer :type + + # Optional configuration for the `volume` type. + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions + ) + ) + end + attr_reader :volume_options + + sig do + params( + volume_options: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::OrHash + ).void + end + attr_writer :volume_options + + sig do + params( + bind_options: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::OrHash, + consistency: String, + image_options: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions::OrHash, + read_only: T::Boolean, + source: String, + target: String, + tmpfs_options: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions::OrHash, + type: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type::OrSymbol, + volume_options: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Optional configuration for the `bind` type. + bind_options: nil, + # The consistency requirement for the mount: `default`, `consistent`, `cached`, or + # `delegated`. + consistency: nil, + # Optional configuration for the `image` type. + image_options: nil, + # Whether the mount should be read-only. + read_only: nil, + # Mount source (e.g. a volume name, a host path). The source cannot be specified + # when using `Type=tmpfs`. For `Type=bind`, the source path must either exist, or + # the `CreateMountpoint` must be set to `true` to create the source path on the + # host if missing. + # + # For `Type=npipe`, the pipe must exist prior to creating the container. + source: nil, + # Container path. + target: nil, + # Optional configuration for the `tmpfs` type. + tmpfs_options: nil, + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + type: nil, + # Optional configuration for the `volume` type. + volume_options: nil + ) + end + + sig do + override.returns( + { + bind_options: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions, + consistency: String, + image_options: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions, + read_only: T::Boolean, + source: String, + target: String, + tmpfs_options: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions, + type: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type::OrSymbol, + volume_options: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions + } + ) + end + def to_hash + end + + class BindOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions, + Docker::Internal::AnyHash + ) + end + + # Create mount point on host if missing + sig { returns(T.nilable(T::Boolean)) } + attr_reader :create_mountpoint + + sig { params(create_mountpoint: T::Boolean).void } + attr_writer :create_mountpoint + + # Disable recursive bind mount. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :non_recursive + + sig { params(non_recursive: T::Boolean).void } + attr_writer :non_recursive + + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation::OrSymbol + ) + ) + end + attr_reader :propagation + + sig do + params( + propagation: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation::OrSymbol + ).void + end + attr_writer :propagation + + # Raise an error if the mount cannot be made recursively read-only. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :read_only_force_recursive + + sig { params(read_only_force_recursive: T::Boolean).void } + attr_writer :read_only_force_recursive + + # Make the mount non-recursively read-only, but still leave the mount recursive + # (unless NonRecursive is set to `true` in conjunction). + # + # Added in v1.44, before that version all read-only mounts were non-recursive by + # default. To match the previous behaviour this will default to `true` for clients + # on versions prior to v1.44. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :read_only_non_recursive + + sig { params(read_only_non_recursive: T::Boolean).void } + attr_writer :read_only_non_recursive + + # Optional configuration for the `bind` type. + sig do + params( + create_mountpoint: T::Boolean, + non_recursive: T::Boolean, + propagation: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation::OrSymbol, + read_only_force_recursive: T::Boolean, + read_only_non_recursive: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Create mount point on host if missing + create_mountpoint: nil, + # Disable recursive bind mount. + non_recursive: nil, + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + propagation: nil, + # Raise an error if the mount cannot be made recursively read-only. + read_only_force_recursive: nil, + # Make the mount non-recursively read-only, but still leave the mount recursive + # (unless NonRecursive is set to `true` in conjunction). + # + # Added in v1.44, before that version all read-only mounts were non-recursive by + # default. To match the previous behaviour this will default to `true` for clients + # on versions prior to v1.44. + read_only_non_recursive: nil + ) + end + + sig do + override.returns( + { + create_mountpoint: T::Boolean, + non_recursive: T::Boolean, + propagation: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation::OrSymbol, + read_only_force_recursive: T::Boolean, + read_only_non_recursive: T::Boolean + } + ) + end + def to_hash + end + + # A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. + module Propagation + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PRIVATE = + T.let( + :private, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation::TaggedSymbol + ) + RPRIVATE = + T.let( + :rprivate, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation::TaggedSymbol + ) + SHARED = + T.let( + :shared, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation::TaggedSymbol + ) + RSHARED = + T.let( + :rshared, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation::TaggedSymbol + ) + SLAVE = + T.let( + :slave, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation::TaggedSymbol + ) + RSLAVE = + T.let( + :rslave, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::Propagation::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class ImageOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions, + Docker::Internal::AnyHash + ) + end + + # Source path inside the image. Must be relative without any back traversals. + sig { returns(T.nilable(String)) } + attr_reader :subpath + + sig { params(subpath: String).void } + attr_writer :subpath + + # Optional configuration for the `image` type. + sig { params(subpath: String).returns(T.attached_class) } + def self.new( + # Source path inside the image. Must be relative without any back traversals. + subpath: nil + ) + end + + sig { override.returns({ subpath: String }) } + def to_hash + end + end + + class TmpfsOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions, + Docker::Internal::AnyHash + ) + end + + # The permission mode for the tmpfs mount in an integer. The value must not be in + # octal format (e.g. 755) but rather the decimal representation of the octal value + # (e.g. 493). + sig { returns(T.nilable(Integer)) } + attr_reader :mode + + sig { params(mode: Integer).void } + attr_writer :mode + + # The options to be passed to the tmpfs mount. An array of arrays. Flag options + # should be provided as 1-length arrays. Other types should be provided as as + # 2-length arrays, where the first item is the key and the second the value. + sig { returns(T.nilable(T::Array[T::Array[String]])) } + attr_reader :options + + sig { params(options: T::Array[T::Array[String]]).void } + attr_writer :options + + # The size for the tmpfs mount in bytes. + sig { returns(T.nilable(Integer)) } + attr_reader :size_bytes + + sig { params(size_bytes: Integer).void } + attr_writer :size_bytes + + # Optional configuration for the `tmpfs` type. + sig do + params( + mode: Integer, + options: T::Array[T::Array[String]], + size_bytes: Integer + ).returns(T.attached_class) + end + def self.new( + # The permission mode for the tmpfs mount in an integer. The value must not be in + # octal format (e.g. 755) but rather the decimal representation of the octal value + # (e.g. 493). + mode: nil, + # The options to be passed to the tmpfs mount. An array of arrays. Flag options + # should be provided as 1-length arrays. Other types should be provided as as + # 2-length arrays, where the first item is the key and the second the value. + options: nil, + # The size for the tmpfs mount in bytes. + size_bytes: nil + ) + end + + sig do + override.returns( + { + mode: Integer, + options: T::Array[T::Array[String]], + size_bytes: Integer + } + ) + end + def to_hash + end + end + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + module Type + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + BIND = + T.let( + :bind, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type::TaggedSymbol + ) + CLUSTER = + T.let( + :cluster, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type::TaggedSymbol + ) + IMAGE = + T.let( + :image, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type::TaggedSymbol + ) + NPIPE = + T.let( + :npipe, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type::TaggedSymbol + ) + TMPFS = + T.let( + :tmpfs, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type::TaggedSymbol + ) + VOLUME = + T.let( + :volume, + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Mount::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + class VolumeOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions, + Docker::Internal::AnyHash + ) + end + + # Map of driver specific options + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig + ) + ) + end + attr_reader :driver_config + + sig do + params( + driver_config: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig::OrHash + ).void + end + attr_writer :driver_config + + # User-defined key/value metadata. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :labels + + sig { params(labels: T::Hash[Symbol, String]).void } + attr_writer :labels + + # Populate volume with data from the target. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :no_copy + + sig { params(no_copy: T::Boolean).void } + attr_writer :no_copy + + # Source path inside the volume. Must be relative without any back traversals. + sig { returns(T.nilable(String)) } + attr_reader :subpath + + sig { params(subpath: String).void } + attr_writer :subpath + + # Optional configuration for the `volume` type. + sig do + params( + driver_config: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig::OrHash, + labels: T::Hash[Symbol, String], + no_copy: T::Boolean, + subpath: String + ).returns(T.attached_class) + end + def self.new( + # Map of driver specific options + driver_config: nil, + # User-defined key/value metadata. + labels: nil, + # Populate volume with data from the target. + no_copy: nil, + # Source path inside the volume. Must be relative without any back traversals. + subpath: nil + ) + end + + sig do + override.returns( + { + driver_config: + Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig, + labels: T::Hash[Symbol, String], + no_copy: T::Boolean, + subpath: String + } + ) + end + def to_hash + end + + class DriverConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig, + Docker::Internal::AnyHash + ) + end + + # Name of the driver to use to create the volume. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # key/value map of driver specific options. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :options + + sig { params(options: T::Hash[Symbol, String]).void } + attr_writer :options + + # Map of driver specific options + sig do + params( + name: String, + options: T::Hash[Symbol, String] + ).returns(T.attached_class) + end + def self.new( + # Name of the driver to use to create the volume. + name: nil, + # key/value map of driver specific options. + options: nil + ) + end + + sig do + override.returns( + { name: String, options: T::Hash[Symbol, String] } + ) + end + def to_hash + end + end + end + end + + class Privileges < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges, + Docker::Internal::AnyHash + ) + end + + # Options for configuring AppArmor on the container + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor + ) + ) + end + attr_reader :app_armor + + sig do + params( + app_armor: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::OrHash + ).void + end + attr_writer :app_armor + + # CredentialSpec for managed service account (Windows only) + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec + ) + ) + end + attr_reader :credential_spec + + sig do + params( + credential_spec: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec::OrHash + ).void + end + attr_writer :credential_spec + + # Configuration of the no_new_privs bit in the container + sig { returns(T.nilable(T::Boolean)) } + attr_reader :no_new_privileges + + sig { params(no_new_privileges: T::Boolean).void } + attr_writer :no_new_privileges + + # Options for configuring seccomp on the container + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp + ) + ) + end + attr_reader :seccomp + + sig do + params( + seccomp: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::OrHash + ).void + end + attr_writer :seccomp + + # SELinux labels of the container + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext + ) + ) + end + attr_reader :se_linux_context + + sig do + params( + se_linux_context: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext::OrHash + ).void + end + attr_writer :se_linux_context + + # Security options for the container + sig do + params( + app_armor: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::OrHash, + credential_spec: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec::OrHash, + no_new_privileges: T::Boolean, + seccomp: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::OrHash, + se_linux_context: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext::OrHash + ).returns(T.attached_class) + end + def self.new( + # Options for configuring AppArmor on the container + app_armor: nil, + # CredentialSpec for managed service account (Windows only) + credential_spec: nil, + # Configuration of the no_new_privs bit in the container + no_new_privileges: nil, + # Options for configuring seccomp on the container + seccomp: nil, + # SELinux labels of the container + se_linux_context: nil + ) + end + + sig do + override.returns( + { + app_armor: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor, + credential_spec: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec, + no_new_privileges: T::Boolean, + seccomp: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp, + se_linux_context: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext + } + ) + end + def to_hash + end + + class AppArmor < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor, + Docker::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::Mode::OrSymbol + ) + ) + end + attr_reader :mode + + sig do + params( + mode: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::Mode::OrSymbol + ).void + end + attr_writer :mode + + # Options for configuring AppArmor on the container + sig do + params( + mode: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::Mode::OrSymbol + ).returns(T.attached_class) + end + def self.new(mode: nil) + end + + sig do + override.returns( + { + mode: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::Mode::OrSymbol + } + ) + end + def to_hash + end + + module Mode + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::Mode + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DEFAULT = + T.let( + :default, + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::Mode::TaggedSymbol + ) + DISABLED = + T.let( + :disabled, + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::Mode::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::Mode::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class CredentialSpec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec, + Docker::Internal::AnyHash + ) + end + + # Load credential spec from a Swarm Config with the given ID. The specified config + # must also be present in the Configs field with the Runtime property set. + # + #


+ # + # > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, and + # > `CredentialSpec.Config` are mutually exclusive. + sig { returns(T.nilable(String)) } + attr_reader :config + + sig { params(config: String).void } + attr_writer :config + + # Load credential spec from this file. The file is read by the daemon, and must be + # present in the `CredentialSpecs` subdirectory in the docker data directory, + # which defaults to `C:\ProgramData\Docker\` on Windows. + # + # For example, specifying `spec.json` loads + # `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + # + #


+ # + # > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, and + # > `CredentialSpec.Config` are mutually exclusive. + sig { returns(T.nilable(String)) } + attr_reader :file + + sig { params(file: String).void } + attr_writer :file + + # Load credential spec from this value in the Windows registry. The specified + # registry value must be located in: + # + # `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\CredentialSpecs` + # + #


+ # + # > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, and + # > `CredentialSpec.Config` are mutually exclusive. + sig { returns(T.nilable(String)) } + attr_reader :registry + + sig { params(registry: String).void } + attr_writer :registry + + # CredentialSpec for managed service account (Windows only) + sig do + params(config: String, file: String, registry: String).returns( + T.attached_class + ) + end + def self.new( + # Load credential spec from a Swarm Config with the given ID. The specified config + # must also be present in the Configs field with the Runtime property set. + # + #


+ # + # > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, and + # > `CredentialSpec.Config` are mutually exclusive. + config: nil, + # Load credential spec from this file. The file is read by the daemon, and must be + # present in the `CredentialSpecs` subdirectory in the docker data directory, + # which defaults to `C:\ProgramData\Docker\` on Windows. + # + # For example, specifying `spec.json` loads + # `C:\ProgramData\Docker\CredentialSpecs\spec.json`. + # + #


+ # + # > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, and + # > `CredentialSpec.Config` are mutually exclusive. + file: nil, + # Load credential spec from this value in the Windows registry. The specified + # registry value must be located in: + # + # `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\CredentialSpecs` + # + #


+ # + # > **Note**: `CredentialSpec.File`, `CredentialSpec.Registry`, and + # > `CredentialSpec.Config` are mutually exclusive. + registry: nil + ) + end + + sig do + override.returns( + { config: String, file: String, registry: String } + ) + end + def to_hash + end + end + + class Seccomp < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp, + Docker::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::Mode::OrSymbol + ) + ) + end + attr_reader :mode + + sig do + params( + mode: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::Mode::OrSymbol + ).void + end + attr_writer :mode + + # The custom seccomp profile as a json object + sig { returns(T.nilable(String)) } + attr_reader :profile + + sig { params(profile: String).void } + attr_writer :profile + + # Options for configuring seccomp on the container + sig do + params( + mode: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::Mode::OrSymbol, + profile: String + ).returns(T.attached_class) + end + def self.new( + mode: nil, + # The custom seccomp profile as a json object + profile: nil + ) + end + + sig do + override.returns( + { + mode: + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::Mode::OrSymbol, + profile: String + } + ) + end + def to_hash + end + + module Mode + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::Mode + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DEFAULT = + T.let( + :default, + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::Mode::TaggedSymbol + ) + UNCONFINED = + T.let( + :unconfined, + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::Mode::TaggedSymbol + ) + CUSTOM = + T.let( + :custom, + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::Mode::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::Mode::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class SeLinuxContext < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext, + Docker::Internal::AnyHash + ) + end + + # Disable SELinux + sig { returns(T.nilable(T::Boolean)) } + attr_reader :disable + + sig { params(disable: T::Boolean).void } + attr_writer :disable + + # SELinux level label + sig { returns(T.nilable(String)) } + attr_reader :level + + sig { params(level: String).void } + attr_writer :level + + # SELinux role label + sig { returns(T.nilable(String)) } + attr_reader :role + + sig { params(role: String).void } + attr_writer :role + + # SELinux type label + sig { returns(T.nilable(String)) } + attr_reader :type + + sig { params(type: String).void } + attr_writer :type + + # SELinux user label + sig { returns(T.nilable(String)) } + attr_reader :user + + sig { params(user: String).void } + attr_writer :user + + # SELinux labels of the container + sig do + params( + disable: T::Boolean, + level: String, + role: String, + type: String, + user: String + ).returns(T.attached_class) + end + def self.new( + # Disable SELinux + disable: nil, + # SELinux level label + level: nil, + # SELinux role label + role: nil, + # SELinux type label + type: nil, + # SELinux user label + user: nil + ) + end + + sig do + override.returns( + { + disable: T::Boolean, + level: String, + role: String, + type: String, + user: String + } + ) + end + def to_hash + end + end + end + + class Secret < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Secret, + Docker::Internal::AnyHash + ) + end + + # File represents a specific target that is backed by a file. + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::ContainerSpec::Secret::File + ) + ) + end + attr_reader :file + + sig do + params( + file: + Docker::Spec::TaskTemplate::ContainerSpec::Secret::File::OrHash + ).void + end + attr_writer :file + + # SecretID represents the ID of the specific secret that we're referencing. + sig { returns(T.nilable(String)) } + attr_reader :secret_id + + sig { params(secret_id: String).void } + attr_writer :secret_id + + # SecretName is the name of the secret that this references, but this is just + # provided for lookup/display purposes. The secret in the reference will be + # identified by its ID. + sig { returns(T.nilable(String)) } + attr_reader :secret_name + + sig { params(secret_name: String).void } + attr_writer :secret_name + + sig do + params( + file: + Docker::Spec::TaskTemplate::ContainerSpec::Secret::File::OrHash, + secret_id: String, + secret_name: String + ).returns(T.attached_class) + end + def self.new( + # File represents a specific target that is backed by a file. + file: nil, + # SecretID represents the ID of the specific secret that we're referencing. + secret_id: nil, + # SecretName is the name of the secret that this references, but this is just + # provided for lookup/display purposes. The secret in the reference will be + # identified by its ID. + secret_name: nil + ) + end + + sig do + override.returns( + { + file: Docker::Spec::TaskTemplate::ContainerSpec::Secret::File, + secret_id: String, + secret_name: String + } + ) + end + def to_hash + end + + class File < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Secret::File, + Docker::Internal::AnyHash + ) + end + + # GID represents the file GID. + sig { returns(T.nilable(String)) } + attr_reader :gid + + sig { params(gid: String).void } + attr_writer :gid + + # Mode represents the FileMode of the file. + sig { returns(T.nilable(Integer)) } + attr_reader :mode + + sig { params(mode: Integer).void } + attr_writer :mode + + # Name represents the final filename in the filesystem. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # UID represents the file UID. + sig { returns(T.nilable(String)) } + attr_reader :uid + + sig { params(uid: String).void } + attr_writer :uid + + # File represents a specific target that is backed by a file. + sig do + params( + gid: String, + mode: Integer, + name: String, + uid: String + ).returns(T.attached_class) + end + def self.new( + # GID represents the file GID. + gid: nil, + # Mode represents the FileMode of the file. + mode: nil, + # Name represents the final filename in the filesystem. + name: nil, + # UID represents the file UID. + uid: nil + ) + end + + sig do + override.returns( + { gid: String, mode: Integer, name: String, uid: String } + ) + end + def to_hash + end + end + end + + class Ulimit < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::ContainerSpec::Ulimit, + Docker::Internal::AnyHash + ) + end + + # Hard limit + sig { returns(T.nilable(Integer)) } + attr_reader :hard + + sig { params(hard: Integer).void } + attr_writer :hard + + # Name of ulimit + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Soft limit + sig { returns(T.nilable(Integer)) } + attr_reader :soft + + sig { params(soft: Integer).void } + attr_writer :soft + + sig do + params(hard: Integer, name: String, soft: Integer).returns( + T.attached_class + ) + end + def self.new( + # Hard limit + hard: nil, + # Name of ulimit + name: nil, + # Soft limit + soft: nil + ) + end + + sig do + override.returns({ hard: Integer, name: String, soft: Integer }) + end + def to_hash + end + end + end + + class LogDriver < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::LogDriver, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :options + + sig { params(options: T::Hash[Symbol, String]).void } + attr_writer :options + + # Specifies the log driver to use for tasks created from this spec. If not + # present, the default one for the swarm will be used, finally falling back to the + # engine default if not specified. + sig do + params(name: String, options: T::Hash[Symbol, String]).returns( + T.attached_class + ) + end + def self.new(name: nil, options: nil) + end + + sig do + override.returns({ name: String, options: T::Hash[Symbol, String] }) + end + def to_hash + end + end + + class NetworkAttachmentSpec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::NetworkAttachmentSpec, + Docker::Internal::AnyHash + ) + end + + # ID of the container represented by this task + sig { returns(T.nilable(String)) } + attr_reader :container_id + + sig { params(container_id: String).void } + attr_writer :container_id + + # Read-only spec type for non-swarm containers attached to swarm overlay networks. + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + sig { params(container_id: String).returns(T.attached_class) } + def self.new( + # ID of the container represented by this task + container_id: nil + ) + end + + sig { override.returns({ container_id: String }) } + def to_hash + end + end + + class Network < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::Network, + Docker::Internal::AnyHash + ) + end + + # Discoverable alternate names for the service on this network. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :aliases + + sig { params(aliases: T::Array[String]).void } + attr_writer :aliases + + # Driver attachment options for the network target. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :driver_opts + + sig { params(driver_opts: T::Hash[Symbol, String]).void } + attr_writer :driver_opts + + # The target network for attachment. Must be a network name or ID. + sig { returns(T.nilable(String)) } + attr_reader :target + + sig { params(target: String).void } + attr_writer :target + + # Specifies how a service should be attached to a particular network. + sig do + params( + aliases: T::Array[String], + driver_opts: T::Hash[Symbol, String], + target: String + ).returns(T.attached_class) + end + def self.new( + # Discoverable alternate names for the service on this network. + aliases: nil, + # Driver attachment options for the network target. + driver_opts: nil, + # The target network for attachment. Must be a network name or ID. + target: nil + ) + end + + sig do + override.returns( + { + aliases: T::Array[String], + driver_opts: T::Hash[Symbol, String], + target: String + } + ) + end + def to_hash + end + end + + class Placement < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::Placement, + Docker::Internal::AnyHash + ) + end + + # An array of constraint expressions to limit the set of nodes where a task can be + # scheduled. Constraint expressions can either use a _match_ (`==`) or _exclude_ + # (`!=`) rule. Multiple constraints find nodes that satisfy every expression (AND + # match). Constraints can match node or Docker Engine labels as follows: + # + # | node attribute | matches | example | + # | -------------------- | ------------------------------ | --------------------------------------------- | + # | `node.id` | Node ID | `node.id==2ivku8v2gvtg4` | + # | `node.hostname` | Node hostname | `node.hostname!=node-2` | + # | `node.role` | Node role (`manager`/`worker`) | `node.role==manager` | + # | `node.platform.os` | Node operating system | `node.platform.os==windows` | + # | `node.platform.arch` | Node architecture | `node.platform.arch==x86_64` | + # | `node.labels` | User-defined node labels | `node.labels.security==high` | + # | `engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-24.04` | + # + # `engine.labels` apply to Docker Engine labels like operating system, drivers, + # etc. Swarm administrators add `node.labels` for operational purposes by using + # the [`node update endpoint`](#operation/NodeUpdate). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :constraints + + sig { params(constraints: T::Array[String]).void } + attr_writer :constraints + + # Maximum number of replicas for per node (default value is 0, which is unlimited) + sig { returns(T.nilable(Integer)) } + attr_reader :max_replicas + + sig { params(max_replicas: Integer).void } + attr_writer :max_replicas + + # Platforms stores all the platforms that the service's image can run on. This + # field is used in the platform filter for scheduling. If empty, then the platform + # filter is off, meaning there are no scheduling restrictions. + sig do + returns( + T.nilable( + T::Array[Docker::Spec::TaskTemplate::Placement::Platform] + ) + ) + end + attr_reader :platforms + + sig do + params( + platforms: + T::Array[ + Docker::Spec::TaskTemplate::Placement::Platform::OrHash + ] + ).void + end + attr_writer :platforms + + # Preferences provide a way to make the scheduler aware of factors such as + # topology. They are provided in order from highest to lowest precedence. + sig do + returns( + T.nilable( + T::Array[Docker::Spec::TaskTemplate::Placement::Preference] + ) + ) + end + attr_reader :preferences + + sig do + params( + preferences: + T::Array[ + Docker::Spec::TaskTemplate::Placement::Preference::OrHash + ] + ).void + end + attr_writer :preferences + + sig do + params( + constraints: T::Array[String], + max_replicas: Integer, + platforms: + T::Array[ + Docker::Spec::TaskTemplate::Placement::Platform::OrHash + ], + preferences: + T::Array[ + Docker::Spec::TaskTemplate::Placement::Preference::OrHash + ] + ).returns(T.attached_class) + end + def self.new( + # An array of constraint expressions to limit the set of nodes where a task can be + # scheduled. Constraint expressions can either use a _match_ (`==`) or _exclude_ + # (`!=`) rule. Multiple constraints find nodes that satisfy every expression (AND + # match). Constraints can match node or Docker Engine labels as follows: + # + # | node attribute | matches | example | + # | -------------------- | ------------------------------ | --------------------------------------------- | + # | `node.id` | Node ID | `node.id==2ivku8v2gvtg4` | + # | `node.hostname` | Node hostname | `node.hostname!=node-2` | + # | `node.role` | Node role (`manager`/`worker`) | `node.role==manager` | + # | `node.platform.os` | Node operating system | `node.platform.os==windows` | + # | `node.platform.arch` | Node architecture | `node.platform.arch==x86_64` | + # | `node.labels` | User-defined node labels | `node.labels.security==high` | + # | `engine.labels` | Docker Engine's labels | `engine.labels.operatingsystem==ubuntu-24.04` | + # + # `engine.labels` apply to Docker Engine labels like operating system, drivers, + # etc. Swarm administrators add `node.labels` for operational purposes by using + # the [`node update endpoint`](#operation/NodeUpdate). + constraints: nil, + # Maximum number of replicas for per node (default value is 0, which is unlimited) + max_replicas: nil, + # Platforms stores all the platforms that the service's image can run on. This + # field is used in the platform filter for scheduling. If empty, then the platform + # filter is off, meaning there are no scheduling restrictions. + platforms: nil, + # Preferences provide a way to make the scheduler aware of factors such as + # topology. They are provided in order from highest to lowest precedence. + preferences: nil + ) + end + + sig do + override.returns( + { + constraints: T::Array[String], + max_replicas: Integer, + platforms: + T::Array[Docker::Spec::TaskTemplate::Placement::Platform], + preferences: + T::Array[Docker::Spec::TaskTemplate::Placement::Preference] + } + ) + end + def to_hash + end + + class Platform < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::Placement::Platform, + Docker::Internal::AnyHash + ) + end + + # Architecture represents the hardware architecture (for example, `x86_64`). + sig { returns(T.nilable(String)) } + attr_reader :architecture + + sig { params(architecture: String).void } + attr_writer :architecture + + # OS represents the Operating System (for example, `linux` or `windows`). + sig { returns(T.nilable(String)) } + attr_reader :os + + sig { params(os: String).void } + attr_writer :os + + # Platform represents the platform (Arch/OS). + sig do + params(architecture: String, os: String).returns(T.attached_class) + end + def self.new( + # Architecture represents the hardware architecture (for example, `x86_64`). + architecture: nil, + # OS represents the Operating System (for example, `linux` or `windows`). + os: nil + ) + end + + sig { override.returns({ architecture: String, os: String }) } + def to_hash + end + end + + class Preference < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::Placement::Preference, + Docker::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::Placement::Preference::Spread + ) + ) + end + attr_reader :spread + + sig do + params( + spread: + Docker::Spec::TaskTemplate::Placement::Preference::Spread::OrHash + ).void + end + attr_writer :spread + + sig do + params( + spread: + Docker::Spec::TaskTemplate::Placement::Preference::Spread::OrHash + ).returns(T.attached_class) + end + def self.new(spread: nil) + end + + sig do + override.returns( + { + spread: + Docker::Spec::TaskTemplate::Placement::Preference::Spread + } + ) + end + def to_hash + end + + class Spread < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::Placement::Preference::Spread, + Docker::Internal::AnyHash + ) + end + + # label descriptor, such as `engine.labels.az`. + sig { returns(T.nilable(String)) } + attr_reader :spread_descriptor + + sig { params(spread_descriptor: String).void } + attr_writer :spread_descriptor + + sig do + params(spread_descriptor: String).returns(T.attached_class) + end + def self.new( + # label descriptor, such as `engine.labels.az`. + spread_descriptor: nil + ) + end + + sig { override.returns({ spread_descriptor: String }) } + def to_hash + end + end + end + end + + class PluginSpec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::PluginSpec, + Docker::Internal::AnyHash + ) + end + + # Disable the plugin once scheduled. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :disabled + + sig { params(disabled: T::Boolean).void } + attr_writer :disabled + + # The name or 'alias' to use for the plugin. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + sig do + returns( + T.nilable( + T::Array[ + Docker::Spec::TaskTemplate::PluginSpec::PluginPrivilege + ] + ) + ) + end + attr_reader :plugin_privilege + + sig do + params( + plugin_privilege: + T::Array[ + Docker::Spec::TaskTemplate::PluginSpec::PluginPrivilege::OrHash + ] + ).void + end + attr_writer :plugin_privilege + + # The plugin image reference to use. + sig { returns(T.nilable(String)) } + attr_reader :remote + + sig { params(remote: String).void } + attr_writer :remote + + # Plugin spec for the service. _(Experimental release only.)_ + # + #


+ # + # > **Note**: ContainerSpec, NetworkAttachmentSpec, and PluginSpec are mutually + # > exclusive. PluginSpec is only used when the Runtime field is set to `plugin`. + # > NetworkAttachmentSpec is used when the Runtime field is set to `attachment`. + sig do + params( + disabled: T::Boolean, + name: String, + plugin_privilege: + T::Array[ + Docker::Spec::TaskTemplate::PluginSpec::PluginPrivilege::OrHash + ], + remote: String + ).returns(T.attached_class) + end + def self.new( + # Disable the plugin once scheduled. + disabled: nil, + # The name or 'alias' to use for the plugin. + name: nil, + plugin_privilege: nil, + # The plugin image reference to use. + remote: nil + ) + end + + sig do + override.returns( + { + disabled: T::Boolean, + name: String, + plugin_privilege: + T::Array[ + Docker::Spec::TaskTemplate::PluginSpec::PluginPrivilege + ], + remote: String + } + ) + end + def to_hash + end + + class PluginPrivilege < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::PluginSpec::PluginPrivilege, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :value + + sig { params(value: T::Array[String]).void } + attr_writer :value + + # Describes a permission the user has to accept upon installing the plugin. + sig do + params( + description: String, + name: String, + value: T::Array[String] + ).returns(T.attached_class) + end + def self.new(description: nil, name: nil, value: nil) + end + + sig do + override.returns( + { description: String, name: String, value: T::Array[String] } + ) + end + def to_hash + end + end + end + + class Resources < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::Resources, + Docker::Internal::AnyHash + ) + end + + # An object describing a limit on resources which can be requested by a task. + sig do + returns(T.nilable(Docker::Spec::TaskTemplate::Resources::Limits)) + end + attr_reader :limits + + sig do + params( + limits: Docker::Spec::TaskTemplate::Resources::Limits::OrHash + ).void + end + attr_writer :limits + + # Tune the service's containers' memory swappiness (0 to 100). If not specified, + # defaults to the containers' OS' default, generally 60, or whatever value was + # predefined in the image. Set to -1 to unset a previously set value. + sig { returns(T.nilable(Integer)) } + attr_accessor :memory_swappiness + + # An object describing the resources which can be advertised by a node and + # requested by a task. + sig do + returns( + T.nilable(Docker::Spec::TaskTemplate::Resources::Reservations) + ) + end + attr_reader :reservations + + sig do + params( + reservations: + Docker::Spec::TaskTemplate::Resources::Reservations::OrHash + ).void + end + attr_writer :reservations + + # Amount of swap in bytes - can only be used together with a memory limit. If not + # specified, the default behaviour is to grant a swap space twice as big as the + # memory limit. Set to -1 to enable unlimited swap. + sig { returns(T.nilable(Integer)) } + attr_accessor :swap_bytes + + # Resource requirements which apply to each individual container created as part + # of the service. + sig do + params( + limits: Docker::Spec::TaskTemplate::Resources::Limits::OrHash, + memory_swappiness: T.nilable(Integer), + reservations: + Docker::Spec::TaskTemplate::Resources::Reservations::OrHash, + swap_bytes: T.nilable(Integer) + ).returns(T.attached_class) + end + def self.new( + # An object describing a limit on resources which can be requested by a task. + limits: nil, + # Tune the service's containers' memory swappiness (0 to 100). If not specified, + # defaults to the containers' OS' default, generally 60, or whatever value was + # predefined in the image. Set to -1 to unset a previously set value. + memory_swappiness: nil, + # An object describing the resources which can be advertised by a node and + # requested by a task. + reservations: nil, + # Amount of swap in bytes - can only be used together with a memory limit. If not + # specified, the default behaviour is to grant a swap space twice as big as the + # memory limit. Set to -1 to enable unlimited swap. + swap_bytes: nil + ) + end + + sig do + override.returns( + { + limits: Docker::Spec::TaskTemplate::Resources::Limits, + memory_swappiness: T.nilable(Integer), + reservations: + Docker::Spec::TaskTemplate::Resources::Reservations, + swap_bytes: T.nilable(Integer) + } + ) + end + def to_hash + end + + class Limits < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::Resources::Limits, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(Integer)) } + attr_reader :memory_bytes + + sig { params(memory_bytes: Integer).void } + attr_writer :memory_bytes + + sig { returns(T.nilable(Integer)) } + attr_reader :nano_cpus + + sig { params(nano_cpus: Integer).void } + attr_writer :nano_cpus + + # Limits the maximum number of PIDs in the container. Set `0` for unlimited. + sig { returns(T.nilable(Integer)) } + attr_reader :pids + + sig { params(pids: Integer).void } + attr_writer :pids + + # An object describing a limit on resources which can be requested by a task. + sig do + params( + memory_bytes: Integer, + nano_cpus: Integer, + pids: Integer + ).returns(T.attached_class) + end + def self.new( + memory_bytes: nil, + nano_cpus: nil, + # Limits the maximum number of PIDs in the container. Set `0` for unlimited. + pids: nil + ) + end + + sig do + override.returns( + { memory_bytes: Integer, nano_cpus: Integer, pids: Integer } + ) + end + def to_hash + end + end + + class Reservations < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::Resources::Reservations, + Docker::Internal::AnyHash + ) + end + + # User-defined resources can be either Integer resources (e.g, `SSD=3`) or String + # resources (e.g, `GPU=UUID1`). + sig do + returns( + T.nilable( + T::Array[ + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource + ] + ) + ) + end + attr_reader :generic_resources + + sig do + params( + generic_resources: + T::Array[ + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::OrHash + ] + ).void + end + attr_writer :generic_resources + + sig { returns(T.nilable(Integer)) } + attr_reader :memory_bytes + + sig { params(memory_bytes: Integer).void } + attr_writer :memory_bytes + + sig { returns(T.nilable(Integer)) } + attr_reader :nano_cpus + + sig { params(nano_cpus: Integer).void } + attr_writer :nano_cpus + + # An object describing the resources which can be advertised by a node and + # requested by a task. + sig do + params( + generic_resources: + T::Array[ + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::OrHash + ], + memory_bytes: Integer, + nano_cpus: Integer + ).returns(T.attached_class) + end + def self.new( + # User-defined resources can be either Integer resources (e.g, `SSD=3`) or String + # resources (e.g, `GPU=UUID1`). + generic_resources: nil, + memory_bytes: nil, + nano_cpus: nil + ) + end + + sig do + override.returns( + { + generic_resources: + T::Array[ + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource + ], + memory_bytes: Integer, + nano_cpus: Integer + } + ) + end + def to_hash + end + + class GenericResource < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource, + Docker::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec + ) + ) + end + attr_reader :discrete_resource_spec + + sig do + params( + discrete_resource_spec: + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec::OrHash + ).void + end + attr_writer :discrete_resource_spec + + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec + ) + ) + end + attr_reader :named_resource_spec + + sig do + params( + named_resource_spec: + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec::OrHash + ).void + end + attr_writer :named_resource_spec + + sig do + params( + discrete_resource_spec: + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec::OrHash, + named_resource_spec: + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec::OrHash + ).returns(T.attached_class) + end + def self.new( + discrete_resource_spec: nil, + named_resource_spec: nil + ) + end + + sig do + override.returns( + { + discrete_resource_spec: + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec, + named_resource_spec: + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec + } + ) + end + def to_hash + end + + class DiscreteResourceSpec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :kind + + sig { params(kind: String).void } + attr_writer :kind + + sig { returns(T.nilable(Integer)) } + attr_reader :value + + sig { params(value: Integer).void } + attr_writer :value + + sig do + params(kind: String, value: Integer).returns(T.attached_class) + end + def self.new(kind: nil, value: nil) + end + + sig { override.returns({ kind: String, value: Integer }) } + def to_hash + end + end + + class NamedResourceSpec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :kind + + sig { params(kind: String).void } + attr_writer :kind + + sig { returns(T.nilable(String)) } + attr_reader :value + + sig { params(value: String).void } + attr_writer :value + + sig do + params(kind: String, value: String).returns(T.attached_class) + end + def self.new(kind: nil, value: nil) + end + + sig { override.returns({ kind: String, value: String }) } + def to_hash + end + end + end + end + end + + class RestartPolicy < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Spec::TaskTemplate::RestartPolicy, + Docker::Internal::AnyHash + ) + end + + # Condition for restart. + sig do + returns( + T.nilable( + Docker::Spec::TaskTemplate::RestartPolicy::Condition::OrSymbol + ) + ) + end + attr_reader :condition + + sig do + params( + condition: + Docker::Spec::TaskTemplate::RestartPolicy::Condition::OrSymbol + ).void + end + attr_writer :condition + + # Delay between restart attempts. + sig { returns(T.nilable(Integer)) } + attr_reader :delay + + sig { params(delay: Integer).void } + attr_writer :delay + + # Maximum attempts to restart a given container before giving up (default value is + # 0, which is ignored). + sig { returns(T.nilable(Integer)) } + attr_reader :max_attempts + + sig { params(max_attempts: Integer).void } + attr_writer :max_attempts + + # Windows is the time window used to evaluate the restart policy (default value is + # 0, which is unbounded). + sig { returns(T.nilable(Integer)) } + attr_reader :window + + sig { params(window: Integer).void } + attr_writer :window + + # Specification for the restart policy which applies to containers created as part + # of this service. + sig do + params( + condition: + Docker::Spec::TaskTemplate::RestartPolicy::Condition::OrSymbol, + delay: Integer, + max_attempts: Integer, + window: Integer + ).returns(T.attached_class) + end + def self.new( + # Condition for restart. + condition: nil, + # Delay between restart attempts. + delay: nil, + # Maximum attempts to restart a given container before giving up (default value is + # 0, which is ignored). + max_attempts: nil, + # Windows is the time window used to evaluate the restart policy (default value is + # 0, which is unbounded). + window: nil + ) + end + + sig do + override.returns( + { + condition: + Docker::Spec::TaskTemplate::RestartPolicy::Condition::OrSymbol, + delay: Integer, + max_attempts: Integer, + window: Integer + } + ) + end + def to_hash + end + + # Condition for restart. + module Condition + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Spec::TaskTemplate::RestartPolicy::Condition + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + NONE = + T.let( + :none, + Docker::Spec::TaskTemplate::RestartPolicy::Condition::TaggedSymbol + ) + ON_FAILURE = + T.let( + :"on-failure", + Docker::Spec::TaskTemplate::RestartPolicy::Condition::TaggedSymbol + ) + ANY = + T.let( + :any, + Docker::Spec::TaskTemplate::RestartPolicy::Condition::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Spec::TaskTemplate::RestartPolicy::Condition::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class UpdateConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Spec::UpdateConfig, Docker::Internal::AnyHash) + end + + # Amount of time between updates, in nanoseconds. + sig { returns(T.nilable(Integer)) } + attr_reader :delay + + sig { params(delay: Integer).void } + attr_writer :delay + + # Action to take if an updated task fails to run, or stops running during the + # update. + sig do + returns( + T.nilable(Docker::Spec::UpdateConfig::FailureAction::OrSymbol) + ) + end + attr_reader :failure_action + + sig do + params( + failure_action: Docker::Spec::UpdateConfig::FailureAction::OrSymbol + ).void + end + attr_writer :failure_action + + # The fraction of tasks that may fail during an update before the failure action + # is invoked, specified as a floating point number between 0 and 1. + sig { returns(T.nilable(Float)) } + attr_reader :max_failure_ratio + + sig { params(max_failure_ratio: Float).void } + attr_writer :max_failure_ratio + + # Amount of time to monitor each updated task for failures, in nanoseconds. + sig { returns(T.nilable(Integer)) } + attr_reader :monitor + + sig { params(monitor: Integer).void } + attr_writer :monitor + + # The order of operations when rolling out an updated task. Either the old task is + # shut down before the new task is started, or the new task is started before the + # old task is shut down. + sig { returns(T.nilable(Docker::Spec::UpdateConfig::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: Docker::Spec::UpdateConfig::Order::OrSymbol).void } + attr_writer :order + + # Maximum number of tasks to be updated in one iteration (0 means unlimited + # parallelism). + sig { returns(T.nilable(Integer)) } + attr_reader :parallelism + + sig { params(parallelism: Integer).void } + attr_writer :parallelism + + # Specification for the update strategy of the service. + sig do + params( + delay: Integer, + failure_action: Docker::Spec::UpdateConfig::FailureAction::OrSymbol, + max_failure_ratio: Float, + monitor: Integer, + order: Docker::Spec::UpdateConfig::Order::OrSymbol, + parallelism: Integer + ).returns(T.attached_class) + end + def self.new( + # Amount of time between updates, in nanoseconds. + delay: nil, + # Action to take if an updated task fails to run, or stops running during the + # update. + failure_action: nil, + # The fraction of tasks that may fail during an update before the failure action + # is invoked, specified as a floating point number between 0 and 1. + max_failure_ratio: nil, + # Amount of time to monitor each updated task for failures, in nanoseconds. + monitor: nil, + # The order of operations when rolling out an updated task. Either the old task is + # shut down before the new task is started, or the new task is started before the + # old task is shut down. + order: nil, + # Maximum number of tasks to be updated in one iteration (0 means unlimited + # parallelism). + parallelism: nil + ) + end + + sig do + override.returns( + { + delay: Integer, + failure_action: + Docker::Spec::UpdateConfig::FailureAction::OrSymbol, + max_failure_ratio: Float, + monitor: Integer, + order: Docker::Spec::UpdateConfig::Order::OrSymbol, + parallelism: Integer + } + ) + end + def to_hash + end + + # Action to take if an updated task fails to run, or stops running during the + # update. + module FailureAction + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Spec::UpdateConfig::FailureAction) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CONTINUE = + T.let( + :continue, + Docker::Spec::UpdateConfig::FailureAction::TaggedSymbol + ) + PAUSE = + T.let( + :pause, + Docker::Spec::UpdateConfig::FailureAction::TaggedSymbol + ) + ROLLBACK = + T.let( + :rollback, + Docker::Spec::UpdateConfig::FailureAction::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Docker::Spec::UpdateConfig::FailureAction::TaggedSymbol] + ) + end + def self.values + end + end + + # The order of operations when rolling out an updated task. Either the old task is + # shut down before the new task is started, or the new task is started before the + # old task is shut down. + module Order + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Docker::Spec::UpdateConfig::Order) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + STOP_FIRST = + T.let( + :"stop-first", + Docker::Spec::UpdateConfig::Order::TaggedSymbol + ) + START_FIRST = + T.let( + :"start-first", + Docker::Spec::UpdateConfig::Order::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Docker::Spec::UpdateConfig::Order::TaggedSymbol] + ) + end + def self.values + end + end + end + end + end +end diff --git a/rbi/docker/models/summary.rbi b/rbi/docker/models/summary.rbi new file mode 100644 index 0000000..2b51324 --- /dev/null +++ b/rbi/docker/models/summary.rbi @@ -0,0 +1,1244 @@ +# typed: strong + +module Docker + module Models + class Summary < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(Docker::Summary, Docker::Internal::AnyHash) } + + # Command to run when starting the container + sig { returns(T.nilable(String)) } + attr_reader :command + + sig { params(command: String).void } + attr_writer :command + + # Date and time at which the container was created as a Unix timestamp (number of + # seconds since EPOCH). + sig { returns(T.nilable(Integer)) } + attr_reader :created + + sig { params(created: Integer).void } + attr_writer :created + + # Summary of health status + # + # Added in v1.52, before that version all container summary not include Health. + # After this attribute introduced, it includes containers with no health checks + # configured, or containers that are not running with none + sig { returns(T.nilable(Docker::Summary::Health)) } + attr_reader :health + + sig { params(health: Docker::Summary::Health::OrHash).void } + attr_writer :health + + # Summary of host-specific runtime information of the container. This is a reduced + # set of information in the container's "HostConfig" as available in the container + # "inspect" response. + sig { returns(T.nilable(Docker::Summary::HostConfig)) } + attr_reader :host_config + + sig { params(host_config: Docker::Summary::HostConfig::OrHash).void } + attr_writer :host_config + + # The ID of this container as a 128-bit (64-character) hexadecimal string (32 + # bytes). + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # The name or ID of the image used to create the container. + # + # This field shows the image reference as was specified when creating the + # container, which can be in its canonical form (e.g., + # `docker.io/library/ubuntu:latest` or + # `docker.io/library/ubuntu@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782`), + # short form (e.g., `ubuntu:latest`)), or the ID(-prefix) of the image (e.g., + # `72297848456d`). + # + # The content of this field can be updated at runtime if the image used to create + # the container is untagged, in which case the field is updated to contain the the + # image ID (digest) it was resolved to in its canonical, non-truncated form (e.g., + # `sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782`). + sig { returns(T.nilable(String)) } + attr_reader :image + + sig { params(image: String).void } + attr_writer :image + + # The ID (digest) of the image that this container was created from. + sig { returns(T.nilable(String)) } + attr_reader :image_id + + sig { params(image_id: String).void } + attr_writer :image_id + + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + sig { returns(T.nilable(Docker::Summary::ImageManifestDescriptor)) } + attr_reader :image_manifest_descriptor + + sig do + params( + image_manifest_descriptor: + Docker::Summary::ImageManifestDescriptor::OrHash + ).void + end + attr_writer :image_manifest_descriptor + + # User-defined key/value metadata. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :labels + + sig { params(labels: T::Hash[Symbol, String]).void } + attr_writer :labels + + # List of mounts used by the container. + sig { returns(T.nilable(T::Array[Docker::Summary::Mount])) } + attr_reader :mounts + + sig { params(mounts: T::Array[Docker::Summary::Mount::OrHash]).void } + attr_writer :mounts + + # The names associated with this container. Most containers have a single name, + # but when using legacy "links", the container can have multiple names. + # + # For historic reasons, names are prefixed with a forward-slash (`/`). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :names + + sig { params(names: T::Array[String]).void } + attr_writer :names + + # Summary of the container's network settings + sig { returns(T.nilable(Docker::Summary::NetworkSettings)) } + attr_reader :network_settings + + sig do + params(network_settings: Docker::Summary::NetworkSettings::OrHash).void + end + attr_writer :network_settings + + # Port-mappings for the container. + sig { returns(T.nilable(T::Array[Docker::Summary::Port])) } + attr_reader :ports + + sig { params(ports: T::Array[Docker::Summary::Port::OrHash]).void } + attr_writer :ports + + # The total size of all files in the read-only layers from the image that the + # container uses. These layers can be shared between containers. + # + # This field is omitted by default, and only set when size is requested in the API + # request. + sig { returns(T.nilable(Integer)) } + attr_accessor :size_root_fs + + # The size of files that have been created or changed by this container. + # + # This field is omitted by default, and only set when size is requested in the API + # request. + sig { returns(T.nilable(Integer)) } + attr_accessor :size_rw + + # The state of this container. + sig { returns(T.nilable(Docker::Summary::State::TaggedSymbol)) } + attr_reader :state + + sig { params(state: Docker::Summary::State::OrSymbol).void } + attr_writer :state + + # Additional human-readable status of this container (e.g. `Exit 0`) + sig { returns(T.nilable(String)) } + attr_reader :status + + sig { params(status: String).void } + attr_writer :status + + sig do + params( + command: String, + created: Integer, + health: Docker::Summary::Health::OrHash, + host_config: Docker::Summary::HostConfig::OrHash, + id: String, + image: String, + image_id: String, + image_manifest_descriptor: + Docker::Summary::ImageManifestDescriptor::OrHash, + labels: T::Hash[Symbol, String], + mounts: T::Array[Docker::Summary::Mount::OrHash], + names: T::Array[String], + network_settings: Docker::Summary::NetworkSettings::OrHash, + ports: T::Array[Docker::Summary::Port::OrHash], + size_root_fs: T.nilable(Integer), + size_rw: T.nilable(Integer), + state: Docker::Summary::State::OrSymbol, + status: String + ).returns(T.attached_class) + end + def self.new( + # Command to run when starting the container + command: nil, + # Date and time at which the container was created as a Unix timestamp (number of + # seconds since EPOCH). + created: nil, + # Summary of health status + # + # Added in v1.52, before that version all container summary not include Health. + # After this attribute introduced, it includes containers with no health checks + # configured, or containers that are not running with none + health: nil, + # Summary of host-specific runtime information of the container. This is a reduced + # set of information in the container's "HostConfig" as available in the container + # "inspect" response. + host_config: nil, + # The ID of this container as a 128-bit (64-character) hexadecimal string (32 + # bytes). + id: nil, + # The name or ID of the image used to create the container. + # + # This field shows the image reference as was specified when creating the + # container, which can be in its canonical form (e.g., + # `docker.io/library/ubuntu:latest` or + # `docker.io/library/ubuntu@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782`), + # short form (e.g., `ubuntu:latest`)), or the ID(-prefix) of the image (e.g., + # `72297848456d`). + # + # The content of this field can be updated at runtime if the image used to create + # the container is untagged, in which case the field is updated to contain the the + # image ID (digest) it was resolved to in its canonical, non-truncated form (e.g., + # `sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782`). + image: nil, + # The ID (digest) of the image that this container was created from. + image_id: nil, + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + image_manifest_descriptor: nil, + # User-defined key/value metadata. + labels: nil, + # List of mounts used by the container. + mounts: nil, + # The names associated with this container. Most containers have a single name, + # but when using legacy "links", the container can have multiple names. + # + # For historic reasons, names are prefixed with a forward-slash (`/`). + names: nil, + # Summary of the container's network settings + network_settings: nil, + # Port-mappings for the container. + ports: nil, + # The total size of all files in the read-only layers from the image that the + # container uses. These layers can be shared between containers. + # + # This field is omitted by default, and only set when size is requested in the API + # request. + size_root_fs: nil, + # The size of files that have been created or changed by this container. + # + # This field is omitted by default, and only set when size is requested in the API + # request. + size_rw: nil, + # The state of this container. + state: nil, + # Additional human-readable status of this container (e.g. `Exit 0`) + status: nil + ) + end + + sig do + override.returns( + { + command: String, + created: Integer, + health: Docker::Summary::Health, + host_config: Docker::Summary::HostConfig, + id: String, + image: String, + image_id: String, + image_manifest_descriptor: Docker::Summary::ImageManifestDescriptor, + labels: T::Hash[Symbol, String], + mounts: T::Array[Docker::Summary::Mount], + names: T::Array[String], + network_settings: Docker::Summary::NetworkSettings, + ports: T::Array[Docker::Summary::Port], + size_root_fs: T.nilable(Integer), + size_rw: T.nilable(Integer), + state: Docker::Summary::State::TaggedSymbol, + status: String + } + ) + end + def to_hash + end + + class Health < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Summary::Health, Docker::Internal::AnyHash) + end + + # FailingStreak is the number of consecutive failures + sig { returns(T.nilable(Integer)) } + attr_reader :failing_streak + + sig { params(failing_streak: Integer).void } + attr_writer :failing_streak + + # the health status of the container + sig do + returns(T.nilable(Docker::Summary::Health::Status::TaggedSymbol)) + end + attr_reader :status + + sig { params(status: Docker::Summary::Health::Status::OrSymbol).void } + attr_writer :status + + # Summary of health status + # + # Added in v1.52, before that version all container summary not include Health. + # After this attribute introduced, it includes containers with no health checks + # configured, or containers that are not running with none + sig do + params( + failing_streak: Integer, + status: Docker::Summary::Health::Status::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # FailingStreak is the number of consecutive failures + failing_streak: nil, + # the health status of the container + status: nil + ) + end + + sig do + override.returns( + { + failing_streak: Integer, + status: Docker::Summary::Health::Status::TaggedSymbol + } + ) + end + def to_hash + end + + # the health status of the container + module Status + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Docker::Summary::Health::Status) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + NONE = T.let(:none, Docker::Summary::Health::Status::TaggedSymbol) + STARTING = + T.let(:starting, Docker::Summary::Health::Status::TaggedSymbol) + HEALTHY = + T.let(:healthy, Docker::Summary::Health::Status::TaggedSymbol) + UNHEALTHY = + T.let(:unhealthy, Docker::Summary::Health::Status::TaggedSymbol) + + sig do + override.returns( + T::Array[Docker::Summary::Health::Status::TaggedSymbol] + ) + end + def self.values + end + end + end + + class HostConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Summary::HostConfig, Docker::Internal::AnyHash) + end + + # Arbitrary key-value metadata attached to the container. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :annotations + + # Networking mode (`host`, `none`, `container:`) or name of the primary + # network the container is using. + # + # This field is primarily for backward compatibility. The container can be + # connected to multiple networks for which information can be found in the + # `NetworkSettings.Networks` field, which enumerates settings per network. + sig { returns(T.nilable(String)) } + attr_reader :network_mode + + sig { params(network_mode: String).void } + attr_writer :network_mode + + # Summary of host-specific runtime information of the container. This is a reduced + # set of information in the container's "HostConfig" as available in the container + # "inspect" response. + sig do + params( + annotations: T.nilable(T::Hash[Symbol, String]), + network_mode: String + ).returns(T.attached_class) + end + def self.new( + # Arbitrary key-value metadata attached to the container. + annotations: nil, + # Networking mode (`host`, `none`, `container:`) or name of the primary + # network the container is using. + # + # This field is primarily for backward compatibility. The container can be + # connected to multiple networks for which information can be found in the + # `NetworkSettings.Networks` field, which enumerates settings per network. + network_mode: nil + ) + end + + sig do + override.returns( + { + annotations: T.nilable(T::Hash[Symbol, String]), + network_mode: String + } + ) + end + def to_hash + end + end + + class ImageManifestDescriptor < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Summary::ImageManifestDescriptor, + Docker::Internal::AnyHash + ) + end + + # Arbitrary metadata relating to the targeted content. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :annotations + + # ArtifactType is the IANA media type of this artifact. + sig { returns(T.nilable(String)) } + attr_accessor :artifact_type + + # Data is an embedding of the targeted content. This is encoded as a base64 string + # when marshalled to JSON (automatically, by encoding/json). If present, Data can + # be used directly to avoid fetching the targeted content. + sig { returns(T.nilable(String)) } + attr_accessor :data + + # The digest of the targeted content. + sig { returns(T.nilable(String)) } + attr_reader :digest + + sig { params(digest: String).void } + attr_writer :digest + + # The media type of the object this schema refers to. + sig { returns(T.nilable(String)) } + attr_reader :media_type + + sig { params(media_type: String).void } + attr_writer :media_type + + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + sig do + returns(T.nilable(Docker::Summary::ImageManifestDescriptor::Platform)) + end + attr_reader :platform + + sig do + params( + platform: + T.nilable( + Docker::Summary::ImageManifestDescriptor::Platform::OrHash + ) + ).void + end + attr_writer :platform + + # The size in bytes of the blob. + sig { returns(T.nilable(Integer)) } + attr_reader :size + + sig { params(size: Integer).void } + attr_writer :size + + # List of URLs from which this object MAY be downloaded. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :urls + + # A descriptor struct containing digest, media type, and size, as defined in the + # [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md). + sig do + params( + annotations: T.nilable(T::Hash[Symbol, String]), + artifact_type: T.nilable(String), + data: T.nilable(String), + digest: String, + media_type: String, + platform: + T.nilable( + Docker::Summary::ImageManifestDescriptor::Platform::OrHash + ), + size: Integer, + urls: T.nilable(T::Array[String]) + ).returns(T.attached_class) + end + def self.new( + # Arbitrary metadata relating to the targeted content. + annotations: nil, + # ArtifactType is the IANA media type of this artifact. + artifact_type: nil, + # Data is an embedding of the targeted content. This is encoded as a base64 string + # when marshalled to JSON (automatically, by encoding/json). If present, Data can + # be used directly to avoid fetching the targeted content. + data: nil, + # The digest of the targeted content. + digest: nil, + # The media type of the object this schema refers to. + media_type: nil, + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + platform: nil, + # The size in bytes of the blob. + size: nil, + # List of URLs from which this object MAY be downloaded. + urls: nil + ) + end + + sig do + override.returns( + { + annotations: T.nilable(T::Hash[Symbol, String]), + artifact_type: T.nilable(String), + data: T.nilable(String), + digest: String, + media_type: String, + platform: + T.nilable(Docker::Summary::ImageManifestDescriptor::Platform), + size: Integer, + urls: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + class Platform < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Summary::ImageManifestDescriptor::Platform, + Docker::Internal::AnyHash + ) + end + + # The CPU architecture, for example `amd64` or `ppc64`. + sig { returns(T.nilable(String)) } + attr_reader :architecture + + sig { params(architecture: String).void } + attr_writer :architecture + + # The operating system, for example `linux` or `windows`. + sig { returns(T.nilable(String)) } + attr_reader :os + + sig { params(os: String).void } + attr_writer :os + + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + sig { returns(T.nilable(T::Array[String])) } + attr_reader :os_features + + sig { params(os_features: T::Array[String]).void } + attr_writer :os_features + + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + sig { returns(T.nilable(String)) } + attr_reader :os_version + + sig { params(os_version: String).void } + attr_writer :os_version + + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + sig { returns(T.nilable(String)) } + attr_reader :variant + + sig { params(variant: String).void } + attr_writer :variant + + # Describes the platform which the image in the manifest runs on, as defined in + # the + # [OCI Image Index Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-index.md). + sig do + params( + architecture: String, + os: String, + os_features: T::Array[String], + os_version: String, + variant: String + ).returns(T.attached_class) + end + def self.new( + # The CPU architecture, for example `amd64` or `ppc64`. + architecture: nil, + # The operating system, for example `linux` or `windows`. + os: nil, + # Optional field specifying an array of strings, each listing a required OS + # feature (for example on Windows `win32k`). + os_features: nil, + # Optional field specifying the operating system version, for example on Windows + # `10.0.19041.1165`. + os_version: nil, + # Optional field specifying a variant of the CPU, for example `v7` to specify + # ARMv7 when architecture is `arm`. + variant: nil + ) + end + + sig do + override.returns( + { + architecture: String, + os: String, + os_features: T::Array[String], + os_version: String, + variant: String + } + ) + end + def to_hash + end + end + end + + class Mount < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Summary::Mount, Docker::Internal::AnyHash) + end + + # Destination is the path relative to the container root (`/`) where the `Source` + # is mounted inside the container. + sig { returns(T.nilable(String)) } + attr_reader :destination + + sig { params(destination: String).void } + attr_writer :destination + + # Driver is the volume driver used to create the volume (if it is a volume). + sig { returns(T.nilable(String)) } + attr_reader :driver + + sig { params(driver: String).void } + attr_writer :driver + + # Mode is a comma separated list of options supplied by the user when creating the + # bind/volume mount. + # + # The default is platform-specific (`"z"` on Linux, empty on Windows). + sig { returns(T.nilable(String)) } + attr_reader :mode + + sig { params(mode: String).void } + attr_writer :mode + + # Name is the name reference to the underlying data defined by `Source` e.g., the + # volume name. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Propagation describes how mounts are propagated from the host into the mount + # point, and vice-versa. Refer to the + # [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + # for details. This field is not used on Windows. + sig { returns(T.nilable(String)) } + attr_reader :propagation + + sig { params(propagation: String).void } + attr_writer :propagation + + # Whether the mount is mounted writable (read-write). + sig { returns(T.nilable(T::Boolean)) } + attr_reader :rw + + sig { params(rw: T::Boolean).void } + attr_writer :rw + + # Source location of the mount. + # + # For volumes, this contains the storage location of the volume (within + # `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains the + # source (host) part of the bind-mount. For `tmpfs` mount points, this field is + # empty. + sig { returns(T.nilable(String)) } + attr_reader :source + + sig { params(source: String).void } + attr_writer :source + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + sig { returns(T.nilable(Docker::Summary::Mount::Type::TaggedSymbol)) } + attr_reader :type + + sig { params(type: Docker::Summary::Mount::Type::OrSymbol).void } + attr_writer :type + + # MountPoint represents a mount point configuration inside the container. This is + # used for reporting the mountpoints in use by a container. + sig do + params( + destination: String, + driver: String, + mode: String, + name: String, + propagation: String, + rw: T::Boolean, + source: String, + type: Docker::Summary::Mount::Type::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Destination is the path relative to the container root (`/`) where the `Source` + # is mounted inside the container. + destination: nil, + # Driver is the volume driver used to create the volume (if it is a volume). + driver: nil, + # Mode is a comma separated list of options supplied by the user when creating the + # bind/volume mount. + # + # The default is platform-specific (`"z"` on Linux, empty on Windows). + mode: nil, + # Name is the name reference to the underlying data defined by `Source` e.g., the + # volume name. + name: nil, + # Propagation describes how mounts are propagated from the host into the mount + # point, and vice-versa. Refer to the + # [Linux kernel documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) + # for details. This field is not used on Windows. + propagation: nil, + # Whether the mount is mounted writable (read-write). + rw: nil, + # Source location of the mount. + # + # For volumes, this contains the storage location of the volume (within + # `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains the + # source (host) part of the bind-mount. For `tmpfs` mount points, this field is + # empty. + source: nil, + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + type: nil + ) + end + + sig do + override.returns( + { + destination: String, + driver: String, + mode: String, + name: String, + propagation: String, + rw: T::Boolean, + source: String, + type: Docker::Summary::Mount::Type::TaggedSymbol + } + ) + end + def to_hash + end + + # The mount type. Available types: + # + # - `bind` a mount of a file or directory from the host into the container. + # - `cluster` a Swarm cluster volume. + # - `image` an OCI image. + # - `npipe` a named pipe from the host into the container. + # - `tmpfs` a `tmpfs`. + # - `volume` a docker volume with the given `Name`. + module Type + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Docker::Summary::Mount::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + BIND = T.let(:bind, Docker::Summary::Mount::Type::TaggedSymbol) + CLUSTER = T.let(:cluster, Docker::Summary::Mount::Type::TaggedSymbol) + IMAGE = T.let(:image, Docker::Summary::Mount::Type::TaggedSymbol) + NPIPE = T.let(:npipe, Docker::Summary::Mount::Type::TaggedSymbol) + TMPFS = T.let(:tmpfs, Docker::Summary::Mount::Type::TaggedSymbol) + VOLUME = T.let(:volume, Docker::Summary::Mount::Type::TaggedSymbol) + + sig do + override.returns( + T::Array[Docker::Summary::Mount::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + + class NetworkSettings < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Summary::NetworkSettings, Docker::Internal::AnyHash) + end + + # Summary of network-settings for each network the container is attached to. + sig do + returns( + T.nilable( + T::Hash[Symbol, Docker::Summary::NetworkSettings::Network] + ) + ) + end + attr_reader :networks + + sig do + params( + networks: + T::Hash[Symbol, Docker::Summary::NetworkSettings::Network::OrHash] + ).void + end + attr_writer :networks + + # Summary of the container's network settings + sig do + params( + networks: + T::Hash[Symbol, Docker::Summary::NetworkSettings::Network::OrHash] + ).returns(T.attached_class) + end + def self.new( + # Summary of network-settings for each network the container is attached to. + networks: nil + ) + end + + sig do + override.returns( + { + networks: + T::Hash[Symbol, Docker::Summary::NetworkSettings::Network] + } + ) + end + def to_hash + end + + class Network < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Summary::NetworkSettings::Network, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :aliases + + sig { params(aliases: T::Array[String]).void } + attr_writer :aliases + + # List of all DNS names an endpoint has on a specific network. This list is based + # on the container name, network aliases, container short ID, and hostname. + # + # These DNS names are non-fully qualified but can contain several dots. You can + # get fully qualified DNS names by appending `.`. For instance, if + # container name is `my.ctr` and the network is named `testnet`, `DNSNames` will + # contain `my.ctr` and the FQDN will be `my.ctr.testnet`. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :dns_names + + sig { params(dns_names: T::Array[String]).void } + attr_writer :dns_names + + # DriverOpts is a mapping of driver options and values. These options are passed + # directly to the driver and are driver specific. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :driver_opts + + # Unique ID for the service endpoint in a Sandbox. + sig { returns(T.nilable(String)) } + attr_reader :endpoint_id + + sig { params(endpoint_id: String).void } + attr_writer :endpoint_id + + # Gateway address for this network. + sig { returns(T.nilable(String)) } + attr_reader :gateway + + sig { params(gateway: String).void } + attr_writer :gateway + + # Global IPv6 address. + sig { returns(T.nilable(String)) } + attr_reader :global_i_pv6_address + + sig { params(global_i_pv6_address: String).void } + attr_writer :global_i_pv6_address + + # Mask length of the global IPv6 address. + sig { returns(T.nilable(Integer)) } + attr_reader :global_i_pv6_prefix_len + + sig { params(global_i_pv6_prefix_len: Integer).void } + attr_writer :global_i_pv6_prefix_len + + # This property determines which endpoint will provide the default gateway for a + # container. The endpoint with the highest priority will be used. If multiple + # endpoints have the same priority, endpoints are lexicographically sorted based + # on their network name, and the one that sorts first is picked. + sig { returns(T.nilable(Integer)) } + attr_reader :gw_priority + + sig { params(gw_priority: Integer).void } + attr_writer :gw_priority + + # IPv4 address. + sig { returns(T.nilable(String)) } + attr_reader :ip_address + + sig { params(ip_address: String).void } + attr_writer :ip_address + + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + sig do + returns( + T.nilable(Docker::Summary::NetworkSettings::Network::IpamConfig) + ) + end + attr_reader :ipam_config + + sig do + params( + ipam_config: + T.nilable( + Docker::Summary::NetworkSettings::Network::IpamConfig::OrHash + ) + ).void + end + attr_writer :ipam_config + + # Mask length of the IPv4 address. + sig { returns(T.nilable(Integer)) } + attr_reader :ip_prefix_len + + sig { params(ip_prefix_len: Integer).void } + attr_writer :ip_prefix_len + + # IPv6 gateway address. + sig { returns(T.nilable(String)) } + attr_reader :i_pv6_gateway + + sig { params(i_pv6_gateway: String).void } + attr_writer :i_pv6_gateway + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :links + + sig { params(links: T::Array[String]).void } + attr_writer :links + + # MAC address for the endpoint on this network. The network driver might ignore + # this parameter. + sig { returns(T.nilable(String)) } + attr_reader :mac_address + + sig { params(mac_address: String).void } + attr_writer :mac_address + + # Unique ID of the network. + sig { returns(T.nilable(String)) } + attr_reader :network_id + + sig { params(network_id: String).void } + attr_writer :network_id + + # Configuration for a network endpoint. + sig do + params( + aliases: T::Array[String], + dns_names: T::Array[String], + driver_opts: T.nilable(T::Hash[Symbol, String]), + endpoint_id: String, + gateway: String, + global_i_pv6_address: String, + global_i_pv6_prefix_len: Integer, + gw_priority: Integer, + ip_address: String, + ipam_config: + T.nilable( + Docker::Summary::NetworkSettings::Network::IpamConfig::OrHash + ), + ip_prefix_len: Integer, + i_pv6_gateway: String, + links: T::Array[String], + mac_address: String, + network_id: String + ).returns(T.attached_class) + end + def self.new( + aliases: nil, + # List of all DNS names an endpoint has on a specific network. This list is based + # on the container name, network aliases, container short ID, and hostname. + # + # These DNS names are non-fully qualified but can contain several dots. You can + # get fully qualified DNS names by appending `.`. For instance, if + # container name is `my.ctr` and the network is named `testnet`, `DNSNames` will + # contain `my.ctr` and the FQDN will be `my.ctr.testnet`. + dns_names: nil, + # DriverOpts is a mapping of driver options and values. These options are passed + # directly to the driver and are driver specific. + driver_opts: nil, + # Unique ID for the service endpoint in a Sandbox. + endpoint_id: nil, + # Gateway address for this network. + gateway: nil, + # Global IPv6 address. + global_i_pv6_address: nil, + # Mask length of the global IPv6 address. + global_i_pv6_prefix_len: nil, + # This property determines which endpoint will provide the default gateway for a + # container. The endpoint with the highest priority will be used. If multiple + # endpoints have the same priority, endpoints are lexicographically sorted based + # on their network name, and the one that sorts first is picked. + gw_priority: nil, + # IPv4 address. + ip_address: nil, + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + ipam_config: nil, + # Mask length of the IPv4 address. + ip_prefix_len: nil, + # IPv6 gateway address. + i_pv6_gateway: nil, + links: nil, + # MAC address for the endpoint on this network. The network driver might ignore + # this parameter. + mac_address: nil, + # Unique ID of the network. + network_id: nil + ) + end + + sig do + override.returns( + { + aliases: T::Array[String], + dns_names: T::Array[String], + driver_opts: T.nilable(T::Hash[Symbol, String]), + endpoint_id: String, + gateway: String, + global_i_pv6_address: String, + global_i_pv6_prefix_len: Integer, + gw_priority: Integer, + ip_address: String, + ipam_config: + T.nilable( + Docker::Summary::NetworkSettings::Network::IpamConfig + ), + ip_prefix_len: Integer, + i_pv6_gateway: String, + links: T::Array[String], + mac_address: String, + network_id: String + } + ) + end + def to_hash + end + + class IpamConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Summary::NetworkSettings::Network::IpamConfig, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :i_pv4_address + + sig { params(i_pv4_address: String).void } + attr_writer :i_pv4_address + + sig { returns(T.nilable(String)) } + attr_reader :i_pv6_address + + sig { params(i_pv6_address: String).void } + attr_writer :i_pv6_address + + sig { returns(T.nilable(T::Array[String])) } + attr_reader :link_local_ips + + sig { params(link_local_ips: T::Array[String]).void } + attr_writer :link_local_ips + + # EndpointIPAMConfig represents an endpoint's IPAM configuration. + sig do + params( + i_pv4_address: String, + i_pv6_address: String, + link_local_ips: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + i_pv4_address: nil, + i_pv6_address: nil, + link_local_ips: nil + ) + end + + sig do + override.returns( + { + i_pv4_address: String, + i_pv6_address: String, + link_local_ips: T::Array[String] + } + ) + end + def to_hash + end + end + end + end + + class Port < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Summary::Port, Docker::Internal::AnyHash) + end + + # Port on the container + sig { returns(Integer) } + attr_accessor :private_port + + sig { returns(Docker::Summary::Port::Type::TaggedSymbol) } + attr_accessor :type + + # Host IP address that the container's port is mapped to + sig { returns(T.nilable(String)) } + attr_reader :ip + + sig { params(ip: String).void } + attr_writer :ip + + # Port exposed on the host + sig { returns(T.nilable(Integer)) } + attr_reader :public_port + + sig { params(public_port: Integer).void } + attr_writer :public_port + + # Describes a port-mapping between the container and the host. + sig do + params( + private_port: Integer, + type: Docker::Summary::Port::Type::OrSymbol, + ip: String, + public_port: Integer + ).returns(T.attached_class) + end + def self.new( + # Port on the container + private_port:, + type:, + # Host IP address that the container's port is mapped to + ip: nil, + # Port exposed on the host + public_port: nil + ) + end + + sig do + override.returns( + { + private_port: Integer, + type: Docker::Summary::Port::Type::TaggedSymbol, + ip: String, + public_port: Integer + } + ) + end + def to_hash + end + + module Type + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Docker::Summary::Port::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TCP = T.let(:tcp, Docker::Summary::Port::Type::TaggedSymbol) + UDP = T.let(:udp, Docker::Summary::Port::Type::TaggedSymbol) + SCTP = T.let(:sctp, Docker::Summary::Port::Type::TaggedSymbol) + + sig do + override.returns( + T::Array[Docker::Summary::Port::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + + # The state of this container. + module State + extend Docker::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, Docker::Summary::State) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CREATED = T.let(:created, Docker::Summary::State::TaggedSymbol) + RUNNING = T.let(:running, Docker::Summary::State::TaggedSymbol) + PAUSED = T.let(:paused, Docker::Summary::State::TaggedSymbol) + RESTARTING = T.let(:restarting, Docker::Summary::State::TaggedSymbol) + EXITED = T.let(:exited, Docker::Summary::State::TaggedSymbol) + REMOVING = T.let(:removing, Docker::Summary::State::TaggedSymbol) + DEAD = T.let(:dead, Docker::Summary::State::TaggedSymbol) + + sig { override.returns(T::Array[Docker::Summary::State::TaggedSymbol]) } + def self.values + end + end + end + end +end diff --git a/rbi/docker/models/system_info_params.rbi b/rbi/docker/models/system_info_params.rbi new file mode 100644 index 0000000..cf8e2c5 --- /dev/null +++ b/rbi/docker/models/system_info_params.rbi @@ -0,0 +1,27 @@ +# typed: strong + +module Docker + module Models + class SystemInfoParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::SystemInfoParams, Docker::Internal::AnyHash) + end + + sig do + params(request_options: Docker::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Docker::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/docker/models/system_info_response.rbi b/rbi/docker/models/system_info_response.rbi new file mode 100644 index 0000000..c63d7e2 --- /dev/null +++ b/rbi/docker/models/system_info_response.rbi @@ -0,0 +1,3523 @@ +# typed: strong + +module Docker + module Models + class SystemInfoResponse < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Models::SystemInfoResponse, Docker::Internal::AnyHash) + end + + # Hardware architecture of the host, as returned by the operating system. This is + # equivalent to the output of `uname -m` on Linux. + # + # Unlike `Arch` (from `/version`), this reports the machine's native architecture, + # which can differ from the Go runtime architecture when running a binary compiled + # for a different architecture (for example, a 32-bit binary running on 64-bit + # hardware). + sig { returns(T.nilable(String)) } + attr_reader :architecture + + sig { params(architecture: String).void } + attr_writer :architecture + + # List of directories where (Container Device Interface) CDI specifications are + # located. + # + # These specifications define vendor-specific modifications to an OCI runtime + # specification for a container being created. + # + # An empty list indicates that CDI device injection is disabled. + # + # Note that since using CDI device injection requires the daemon to have + # experimental enabled. For non-experimental daemons an empty list will always be + # returned. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :cdi_spec_dirs + + sig { params(cdi_spec_dirs: T::Array[String]).void } + attr_writer :cdi_spec_dirs + + # The driver to use for managing cgroups. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::CgroupDriver::TaggedSymbol + ) + ) + end + attr_reader :cgroup_driver + + sig do + params( + cgroup_driver: + Docker::Models::SystemInfoResponse::CgroupDriver::OrSymbol + ).void + end + attr_writer :cgroup_driver + + # The version of the cgroup. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::CgroupVersion::TaggedSymbol + ) + ) + end + attr_reader :cgroup_version + + sig do + params( + cgroup_version: + Docker::Models::SystemInfoResponse::CgroupVersion::OrSymbol + ).void + end + attr_writer :cgroup_version + + # Information for connecting to the containerd instance that is used by the + # daemon. This is included for debugging purposes only. + sig { returns(T.nilable(Docker::Models::SystemInfoResponse::Containerd)) } + attr_reader :containerd + + sig do + params( + containerd: + T.nilable(Docker::Models::SystemInfoResponse::Containerd::OrHash) + ).void + end + attr_writer :containerd + + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + sig do + returns(T.nilable(Docker::Models::SystemInfoResponse::ContainerdCommit)) + end + attr_reader :containerd_commit + + sig do + params( + containerd_commit: + Docker::Models::SystemInfoResponse::ContainerdCommit::OrHash + ).void + end + attr_writer :containerd_commit + + # Total number of containers on the host. + sig { returns(T.nilable(Integer)) } + attr_reader :containers + + sig { params(containers: Integer).void } + attr_writer :containers + + # Number of containers with status `"paused"`. + sig { returns(T.nilable(Integer)) } + attr_reader :containers_paused + + sig { params(containers_paused: Integer).void } + attr_writer :containers_paused + + # Number of containers with status `"running"`. + sig { returns(T.nilable(Integer)) } + attr_reader :containers_running + + sig { params(containers_running: Integer).void } + attr_writer :containers_running + + # Number of containers with status `"stopped"`. + sig { returns(T.nilable(Integer)) } + attr_reader :containers_stopped + + sig { params(containers_stopped: Integer).void } + attr_writer :containers_stopped + + # Indicates if CPU CFS(Completely Fair Scheduler) period is supported by the host. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :cpu_cfs_period + + sig { params(cpu_cfs_period: T::Boolean).void } + attr_writer :cpu_cfs_period + + # Indicates if CPU CFS(Completely Fair Scheduler) quota is supported by the host. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :cpu_cfs_quota + + sig { params(cpu_cfs_quota: T::Boolean).void } + attr_writer :cpu_cfs_quota + + # Indicates if CPUsets (cpuset.cpus, cpuset.mems) are supported by the host. + # + # See [cpuset(7)](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt) + sig { returns(T.nilable(T::Boolean)) } + attr_reader :cpu_set + + sig { params(cpu_set: T::Boolean).void } + attr_writer :cpu_set + + # Indicates if CPU Shares limiting is supported by the host. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :cpu_shares + + sig { params(cpu_shares: T::Boolean).void } + attr_writer :cpu_shares + + # Indicates if the daemon is running in debug-mode / with debug-level logging + # enabled. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :debug + + sig { params(debug: T::Boolean).void } + attr_writer :debug + + # List of custom default address pools for local networks, which can be specified + # in the daemon.json file or dockerd option. + # + # Example: a Base "10.10.0.0/16" with Size 24 will define the set of 256 + # 10.10.[0-255].0/24 address pools. + sig do + returns( + T.nilable( + T::Array[Docker::Models::SystemInfoResponse::DefaultAddressPool] + ) + ) + end + attr_reader :default_address_pools + + sig do + params( + default_address_pools: + T::Array[ + Docker::Models::SystemInfoResponse::DefaultAddressPool::OrHash + ] + ).void + end + attr_writer :default_address_pools + + # Name of the default OCI runtime that is used when starting containers. + # + # The default can be overridden per-container at create time. + sig { returns(T.nilable(String)) } + attr_reader :default_runtime + + sig { params(default_runtime: String).void } + attr_writer :default_runtime + + # List of devices discovered by device drivers. + # + # Each device includes information about its source driver, kind, name, and + # additional driver-specific attributes. + sig do + returns( + T.nilable( + T::Array[Docker::Models::SystemInfoResponse::DiscoveredDevice] + ) + ) + end + attr_reader :discovered_devices + + sig do + params( + discovered_devices: + T::Array[ + Docker::Models::SystemInfoResponse::DiscoveredDevice::OrHash + ] + ).void + end + attr_writer :discovered_devices + + # Root directory of persistent Docker state. + # + # Defaults to `/var/lib/docker` on Linux, and `C:\ProgramData\docker` on Windows. + sig { returns(T.nilable(String)) } + attr_reader :docker_root_dir + + sig { params(docker_root_dir: String).void } + attr_writer :docker_root_dir + + # Name of the storage driver in use. + sig { returns(T.nilable(String)) } + attr_reader :driver + + sig { params(driver: String).void } + attr_writer :driver + + # Information specific to the storage driver, provided as "label" / "value" pairs. + # + # This information is provided by the storage driver, and formatted in a way + # consistent with the output of `docker info` on the command line. + # + #


+ # + # > **Note**: The information returned in this field, including the formatting of + # > values and labels, should not be considered stable, and may change without + # > notice. + sig { returns(T.nilable(T::Array[T::Array[String]])) } + attr_reader :driver_status + + sig { params(driver_status: T::Array[T::Array[String]]).void } + attr_writer :driver_status + + # Indicates if experimental features are enabled on the daemon. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :experimental_build + + sig { params(experimental_build: T::Boolean).void } + attr_writer :experimental_build + + # Information about the daemon's firewalling configuration. + # + # This field is currently only used on Linux, and omitted on other platforms. + sig do + returns(T.nilable(Docker::Models::SystemInfoResponse::FirewallBackend)) + end + attr_reader :firewall_backend + + sig do + params( + firewall_backend: + T.nilable( + Docker::Models::SystemInfoResponse::FirewallBackend::OrHash + ) + ).void + end + attr_writer :firewall_backend + + # User-defined resources can be either Integer resources (e.g, `SSD=3`) or String + # resources (e.g, `GPU=UUID1`). + sig do + returns( + T.nilable( + T::Array[Docker::Models::SystemInfoResponse::GenericResource] + ) + ) + end + attr_reader :generic_resources + + sig do + params( + generic_resources: + T::Array[ + Docker::Models::SystemInfoResponse::GenericResource::OrHash + ] + ).void + end + attr_writer :generic_resources + + # HTTP-proxy configured for the daemon. This value is obtained from the + # [`HTTP_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + # environment variable. Credentials + # ([user info component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in + # the proxy URL are masked in the API response. + # + # Containers do not automatically inherit this configuration. + sig { returns(T.nilable(String)) } + attr_reader :http_proxy + + sig { params(http_proxy: String).void } + attr_writer :http_proxy + + # HTTPS-proxy configured for the daemon. This value is obtained from the + # [`HTTPS_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + # environment variable. Credentials + # ([user info component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in + # the proxy URL are masked in the API response. + # + # Containers do not automatically inherit this configuration. + sig { returns(T.nilable(String)) } + attr_reader :https_proxy + + sig { params(https_proxy: String).void } + attr_writer :https_proxy + + # Unique identifier of the daemon. + # + #


+ # + # > **Note**: The format of the ID itself is not part of the API, and should not + # > be considered stable. + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Total number of images on the host. + # + # Both _tagged_ and _untagged_ (dangling) images are counted. + sig { returns(T.nilable(Integer)) } + attr_reader :images + + sig { params(images: Integer).void } + attr_writer :images + + # Address / URL of the index server that is used for image search, and as a + # default for user authentication for Docker Hub and Docker Cloud. + sig { returns(T.nilable(String)) } + attr_reader :index_server_address + + sig { params(index_server_address: String).void } + attr_writer :index_server_address + + # Name and, optional, path of the `docker-init` binary. + # + # If the path is omitted, the daemon searches the host's `$PATH` for the binary + # and uses the first result. + sig { returns(T.nilable(String)) } + attr_reader :init_binary + + sig { params(init_binary: String).void } + attr_writer :init_binary + + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + sig { returns(T.nilable(Docker::Models::SystemInfoResponse::InitCommit)) } + attr_reader :init_commit + + sig do + params( + init_commit: Docker::Models::SystemInfoResponse::InitCommit::OrHash + ).void + end + attr_writer :init_commit + + # Indicates IPv4 forwarding is enabled. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :i_pv4_forwarding + + sig { params(i_pv4_forwarding: T::Boolean).void } + attr_writer :i_pv4_forwarding + + # Represents the isolation technology to use as a default for containers. The + # supported values are platform-specific. + # + # If no isolation value is specified on daemon start, on Windows client, the + # default is `hyperv`, and on Windows server, the default is `process`. + # + # This option is currently not used on other platforms. + sig do + returns( + T.nilable(Docker::Models::SystemInfoResponse::Isolation::TaggedSymbol) + ) + end + attr_reader :isolation + + sig do + params( + isolation: Docker::Models::SystemInfoResponse::Isolation::OrSymbol + ).void + end + attr_writer :isolation + + # Kernel version of the host. + # + # On Linux, this information obtained from `uname`. On Windows this information is + # queried from the HKEY*LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows + # NT\\CurrentVersion\\ registry value, for example *"10.0 14393 + # (14393.1198.amd64fre.rs1*release_sec.170427-1353)"*. + sig { returns(T.nilable(String)) } + attr_reader :kernel_version + + sig { params(kernel_version: String).void } + attr_writer :kernel_version + + # User-defined labels (key/value metadata) as set on the daemon. + # + #


+ # + # > **Note**: When part of a Swarm, nodes can both have _daemon_ labels, set + # > through the daemon configuration, and _node_ labels, set from a manager node + # > in the Swarm. Node labels are not included in this field. Node labels can be + # > retrieved using the `/nodes/(id)` endpoint on a manager node in the Swarm. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :labels + + sig { params(labels: T::Array[String]).void } + attr_writer :labels + + # Indicates if live restore is enabled. + # + # If enabled, containers are kept running when the daemon is shutdown or upon + # daemon start if running containers are detected. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :live_restore_enabled + + sig { params(live_restore_enabled: T::Boolean).void } + attr_writer :live_restore_enabled + + # The logging driver to use as a default for new containers. + sig { returns(T.nilable(String)) } + attr_reader :logging_driver + + sig { params(logging_driver: String).void } + attr_writer :logging_driver + + # Indicates if the host has memory limit support enabled. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :memory_limit + + sig { params(memory_limit: T::Boolean).void } + attr_writer :memory_limit + + # Total amount of physical memory available on the host, in bytes. + sig { returns(T.nilable(Integer)) } + attr_reader :mem_total + + sig { params(mem_total: Integer).void } + attr_writer :mem_total + + # Hostname of the host. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # The number of logical CPUs usable by the daemon. + # + # The number of available CPUs is checked by querying the operating system when + # the daemon starts. Changes to operating system CPU allocation after the daemon + # is started are not reflected. + sig { returns(T.nilable(Integer)) } + attr_reader :ncpu + + sig { params(ncpu: Integer).void } + attr_writer :ncpu + + # Number of event listeners subscribed. + sig { returns(T.nilable(Integer)) } + attr_reader :n_events_listener + + sig { params(n_events_listener: Integer).void } + attr_writer :n_events_listener + + # The total number of file Descriptors in use by the daemon process. + # + # This information is only returned if debug-mode is enabled. + sig { returns(T.nilable(Integer)) } + attr_reader :n_fd + + sig { params(n_fd: Integer).void } + attr_writer :n_fd + + # The number of goroutines that currently exist. + # + # This information is only returned if debug-mode is enabled. + sig { returns(T.nilable(Integer)) } + attr_reader :n_goroutines + + sig { params(n_goroutines: Integer).void } + attr_writer :n_goroutines + + # Comma-separated list of domain extensions for which no proxy should be used. + # This value is obtained from the + # [`NO_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + # environment variable. + # + # Containers do not automatically inherit this configuration. + sig { returns(T.nilable(String)) } + attr_reader :no_proxy + + sig { params(no_proxy: String).void } + attr_writer :no_proxy + + # Information about the Node Resource Interface (NRI). + # + # This field is only present if NRI is enabled. + sig { returns(T.nilable(Docker::Models::SystemInfoResponse::Nri)) } + attr_reader :nri + + sig do + params( + nri: T.nilable(Docker::Models::SystemInfoResponse::Nri::OrHash) + ).void + end + attr_writer :nri + + # Indicates if OOM killer disable is supported on the host. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :oom_kill_disable + + sig { params(oom_kill_disable: T::Boolean).void } + attr_writer :oom_kill_disable + + # Name of the host's operating system, for example: "Ubuntu 24.04 LTS" or "Windows + # Server 2016 Datacenter" + sig { returns(T.nilable(String)) } + attr_reader :operating_system + + sig { params(operating_system: String).void } + attr_writer :operating_system + + # Generic type of the operating system of the host, as returned by the Go runtime + # (`GOOS`). + # + # Currently returned values are "linux" and "windows". A full list of possible + # values can be found in the + # [Go documentation](https://go.dev/doc/install/source#environment). + sig { returns(T.nilable(String)) } + attr_reader :os_type + + sig { params(os_type: String).void } + attr_writer :os_type + + # Version of the host's operating system + # + #


+ # + # > **Note**: The information returned in this field, including its very + # > existence, and the formatting of values, should not be considered stable, and + # > may change without notice. + sig { returns(T.nilable(String)) } + attr_reader :os_version + + sig { params(os_version: String).void } + attr_writer :os_version + + # Indicates if the host kernel has PID limit support enabled. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :pids_limit + + sig { params(pids_limit: T::Boolean).void } + attr_writer :pids_limit + + # Available plugins per type. + # + #


+ # + # > **Note**: Only unmanaged (V1) plugins are included in this list. V1 plugins + # > are "lazily" loaded, and are not returned in this list if there is no resource + # > using the plugin. + sig { returns(T.nilable(Docker::Models::SystemInfoResponse::Plugins)) } + attr_reader :plugins + + sig do + params( + plugins: Docker::Models::SystemInfoResponse::Plugins::OrHash + ).void + end + attr_writer :plugins + + # Reports a summary of the product license on the daemon. + # + # If a commercial license has been applied to the daemon, information such as + # number of nodes, and expiration are included. + sig { returns(T.nilable(String)) } + attr_reader :product_license + + sig { params(product_license: String).void } + attr_writer :product_license + + # RegistryServiceConfig stores daemon registry services configuration. + sig do + returns(T.nilable(Docker::Models::SystemInfoResponse::RegistryConfig)) + end + attr_reader :registry_config + + sig do + params( + registry_config: + T.nilable( + Docker::Models::SystemInfoResponse::RegistryConfig::OrHash + ) + ).void + end + attr_writer :registry_config + + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + sig { returns(T.nilable(Docker::Models::SystemInfoResponse::RuncCommit)) } + attr_reader :runc_commit + + sig do + params( + runc_commit: Docker::Models::SystemInfoResponse::RuncCommit::OrHash + ).void + end + attr_writer :runc_commit + + # List of [OCI compliant](https://github.com/opencontainers/runtime-spec) runtimes + # configured on the daemon. Keys hold the "name" used to reference the runtime. + # + # The Docker daemon relies on an OCI compliant runtime (invoked via the + # `containerd` daemon) as its interface to the Linux kernel namespaces, cgroups, + # and SELinux. + # + # The default runtime is `runc`, and automatically configured. Additional runtimes + # can be configured by the user and will be listed here. + sig do + returns( + T.nilable( + T::Hash[Symbol, Docker::Models::SystemInfoResponse::Runtime] + ) + ) + end + attr_reader :runtimes + + sig do + params( + runtimes: + T::Hash[Symbol, Docker::Models::SystemInfoResponse::Runtime::OrHash] + ).void + end + attr_writer :runtimes + + # List of security features that are enabled on the daemon, such as apparmor, + # seccomp, SELinux, user-namespaces (userns), rootless and no-new-privileges. + # + # Additional configuration options for each security feature may be present, and + # are included as a comma-separated list of key/value pairs. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :security_options + + sig { params(security_options: T::Array[String]).void } + attr_writer :security_options + + # Version string of the daemon. + sig { returns(T.nilable(String)) } + attr_reader :server_version + + sig { params(server_version: String).void } + attr_writer :server_version + + # Indicates if the host has memory swap limit support enabled. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :swap_limit + + sig { params(swap_limit: T::Boolean).void } + attr_writer :swap_limit + + # Represents generic information about swarm. + sig { returns(T.nilable(Docker::Models::SystemInfoResponse::Swarm)) } + attr_reader :swarm + + sig do + params(swarm: Docker::Models::SystemInfoResponse::Swarm::OrHash).void + end + attr_writer :swarm + + # Current system-time in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format + # with nano-seconds. + sig { returns(T.nilable(String)) } + attr_reader :system_time + + sig { params(system_time: String).void } + attr_writer :system_time + + # List of warnings / informational messages about missing features, or issues + # related to the daemon configuration. + # + # These messages can be printed by the client as information to the user. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :warnings + + sig { params(warnings: T::Array[String]).void } + attr_writer :warnings + + sig do + params( + architecture: String, + cdi_spec_dirs: T::Array[String], + cgroup_driver: + Docker::Models::SystemInfoResponse::CgroupDriver::OrSymbol, + cgroup_version: + Docker::Models::SystemInfoResponse::CgroupVersion::OrSymbol, + containerd: + T.nilable(Docker::Models::SystemInfoResponse::Containerd::OrHash), + containerd_commit: + Docker::Models::SystemInfoResponse::ContainerdCommit::OrHash, + containers: Integer, + containers_paused: Integer, + containers_running: Integer, + containers_stopped: Integer, + cpu_cfs_period: T::Boolean, + cpu_cfs_quota: T::Boolean, + cpu_set: T::Boolean, + cpu_shares: T::Boolean, + debug: T::Boolean, + default_address_pools: + T::Array[ + Docker::Models::SystemInfoResponse::DefaultAddressPool::OrHash + ], + default_runtime: String, + discovered_devices: + T::Array[ + Docker::Models::SystemInfoResponse::DiscoveredDevice::OrHash + ], + docker_root_dir: String, + driver: String, + driver_status: T::Array[T::Array[String]], + experimental_build: T::Boolean, + firewall_backend: + T.nilable( + Docker::Models::SystemInfoResponse::FirewallBackend::OrHash + ), + generic_resources: + T::Array[ + Docker::Models::SystemInfoResponse::GenericResource::OrHash + ], + http_proxy: String, + https_proxy: String, + id: String, + images: Integer, + index_server_address: String, + init_binary: String, + init_commit: Docker::Models::SystemInfoResponse::InitCommit::OrHash, + i_pv4_forwarding: T::Boolean, + isolation: Docker::Models::SystemInfoResponse::Isolation::OrSymbol, + kernel_version: String, + labels: T::Array[String], + live_restore_enabled: T::Boolean, + logging_driver: String, + memory_limit: T::Boolean, + mem_total: Integer, + name: String, + ncpu: Integer, + n_events_listener: Integer, + n_fd: Integer, + n_goroutines: Integer, + no_proxy: String, + nri: T.nilable(Docker::Models::SystemInfoResponse::Nri::OrHash), + oom_kill_disable: T::Boolean, + operating_system: String, + os_type: String, + os_version: String, + pids_limit: T::Boolean, + plugins: Docker::Models::SystemInfoResponse::Plugins::OrHash, + product_license: String, + registry_config: + T.nilable( + Docker::Models::SystemInfoResponse::RegistryConfig::OrHash + ), + runc_commit: Docker::Models::SystemInfoResponse::RuncCommit::OrHash, + runtimes: + T::Hash[ + Symbol, + Docker::Models::SystemInfoResponse::Runtime::OrHash + ], + security_options: T::Array[String], + server_version: String, + swap_limit: T::Boolean, + swarm: Docker::Models::SystemInfoResponse::Swarm::OrHash, + system_time: String, + warnings: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # Hardware architecture of the host, as returned by the operating system. This is + # equivalent to the output of `uname -m` on Linux. + # + # Unlike `Arch` (from `/version`), this reports the machine's native architecture, + # which can differ from the Go runtime architecture when running a binary compiled + # for a different architecture (for example, a 32-bit binary running on 64-bit + # hardware). + architecture: nil, + # List of directories where (Container Device Interface) CDI specifications are + # located. + # + # These specifications define vendor-specific modifications to an OCI runtime + # specification for a container being created. + # + # An empty list indicates that CDI device injection is disabled. + # + # Note that since using CDI device injection requires the daemon to have + # experimental enabled. For non-experimental daemons an empty list will always be + # returned. + cdi_spec_dirs: nil, + # The driver to use for managing cgroups. + cgroup_driver: nil, + # The version of the cgroup. + cgroup_version: nil, + # Information for connecting to the containerd instance that is used by the + # daemon. This is included for debugging purposes only. + containerd: nil, + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + containerd_commit: nil, + # Total number of containers on the host. + containers: nil, + # Number of containers with status `"paused"`. + containers_paused: nil, + # Number of containers with status `"running"`. + containers_running: nil, + # Number of containers with status `"stopped"`. + containers_stopped: nil, + # Indicates if CPU CFS(Completely Fair Scheduler) period is supported by the host. + cpu_cfs_period: nil, + # Indicates if CPU CFS(Completely Fair Scheduler) quota is supported by the host. + cpu_cfs_quota: nil, + # Indicates if CPUsets (cpuset.cpus, cpuset.mems) are supported by the host. + # + # See [cpuset(7)](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt) + cpu_set: nil, + # Indicates if CPU Shares limiting is supported by the host. + cpu_shares: nil, + # Indicates if the daemon is running in debug-mode / with debug-level logging + # enabled. + debug: nil, + # List of custom default address pools for local networks, which can be specified + # in the daemon.json file or dockerd option. + # + # Example: a Base "10.10.0.0/16" with Size 24 will define the set of 256 + # 10.10.[0-255].0/24 address pools. + default_address_pools: nil, + # Name of the default OCI runtime that is used when starting containers. + # + # The default can be overridden per-container at create time. + default_runtime: nil, + # List of devices discovered by device drivers. + # + # Each device includes information about its source driver, kind, name, and + # additional driver-specific attributes. + discovered_devices: nil, + # Root directory of persistent Docker state. + # + # Defaults to `/var/lib/docker` on Linux, and `C:\ProgramData\docker` on Windows. + docker_root_dir: nil, + # Name of the storage driver in use. + driver: nil, + # Information specific to the storage driver, provided as "label" / "value" pairs. + # + # This information is provided by the storage driver, and formatted in a way + # consistent with the output of `docker info` on the command line. + # + #


+ # + # > **Note**: The information returned in this field, including the formatting of + # > values and labels, should not be considered stable, and may change without + # > notice. + driver_status: nil, + # Indicates if experimental features are enabled on the daemon. + experimental_build: nil, + # Information about the daemon's firewalling configuration. + # + # This field is currently only used on Linux, and omitted on other platforms. + firewall_backend: nil, + # User-defined resources can be either Integer resources (e.g, `SSD=3`) or String + # resources (e.g, `GPU=UUID1`). + generic_resources: nil, + # HTTP-proxy configured for the daemon. This value is obtained from the + # [`HTTP_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + # environment variable. Credentials + # ([user info component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in + # the proxy URL are masked in the API response. + # + # Containers do not automatically inherit this configuration. + http_proxy: nil, + # HTTPS-proxy configured for the daemon. This value is obtained from the + # [`HTTPS_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + # environment variable. Credentials + # ([user info component](https://tools.ietf.org/html/rfc3986#section-3.2.1)) in + # the proxy URL are masked in the API response. + # + # Containers do not automatically inherit this configuration. + https_proxy: nil, + # Unique identifier of the daemon. + # + #


+ # + # > **Note**: The format of the ID itself is not part of the API, and should not + # > be considered stable. + id: nil, + # Total number of images on the host. + # + # Both _tagged_ and _untagged_ (dangling) images are counted. + images: nil, + # Address / URL of the index server that is used for image search, and as a + # default for user authentication for Docker Hub and Docker Cloud. + index_server_address: nil, + # Name and, optional, path of the `docker-init` binary. + # + # If the path is omitted, the daemon searches the host's `$PATH` for the binary + # and uses the first result. + init_binary: nil, + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + init_commit: nil, + # Indicates IPv4 forwarding is enabled. + i_pv4_forwarding: nil, + # Represents the isolation technology to use as a default for containers. The + # supported values are platform-specific. + # + # If no isolation value is specified on daemon start, on Windows client, the + # default is `hyperv`, and on Windows server, the default is `process`. + # + # This option is currently not used on other platforms. + isolation: nil, + # Kernel version of the host. + # + # On Linux, this information obtained from `uname`. On Windows this information is + # queried from the HKEY*LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows + # NT\\CurrentVersion\\ registry value, for example *"10.0 14393 + # (14393.1198.amd64fre.rs1*release_sec.170427-1353)"*. + kernel_version: nil, + # User-defined labels (key/value metadata) as set on the daemon. + # + #


+ # + # > **Note**: When part of a Swarm, nodes can both have _daemon_ labels, set + # > through the daemon configuration, and _node_ labels, set from a manager node + # > in the Swarm. Node labels are not included in this field. Node labels can be + # > retrieved using the `/nodes/(id)` endpoint on a manager node in the Swarm. + labels: nil, + # Indicates if live restore is enabled. + # + # If enabled, containers are kept running when the daemon is shutdown or upon + # daemon start if running containers are detected. + live_restore_enabled: nil, + # The logging driver to use as a default for new containers. + logging_driver: nil, + # Indicates if the host has memory limit support enabled. + memory_limit: nil, + # Total amount of physical memory available on the host, in bytes. + mem_total: nil, + # Hostname of the host. + name: nil, + # The number of logical CPUs usable by the daemon. + # + # The number of available CPUs is checked by querying the operating system when + # the daemon starts. Changes to operating system CPU allocation after the daemon + # is started are not reflected. + ncpu: nil, + # Number of event listeners subscribed. + n_events_listener: nil, + # The total number of file Descriptors in use by the daemon process. + # + # This information is only returned if debug-mode is enabled. + n_fd: nil, + # The number of goroutines that currently exist. + # + # This information is only returned if debug-mode is enabled. + n_goroutines: nil, + # Comma-separated list of domain extensions for which no proxy should be used. + # This value is obtained from the + # [`NO_PROXY`](https://www.gnu.org/software/wget/manual/html_node/Proxies.html) + # environment variable. + # + # Containers do not automatically inherit this configuration. + no_proxy: nil, + # Information about the Node Resource Interface (NRI). + # + # This field is only present if NRI is enabled. + nri: nil, + # Indicates if OOM killer disable is supported on the host. + oom_kill_disable: nil, + # Name of the host's operating system, for example: "Ubuntu 24.04 LTS" or "Windows + # Server 2016 Datacenter" + operating_system: nil, + # Generic type of the operating system of the host, as returned by the Go runtime + # (`GOOS`). + # + # Currently returned values are "linux" and "windows". A full list of possible + # values can be found in the + # [Go documentation](https://go.dev/doc/install/source#environment). + os_type: nil, + # Version of the host's operating system + # + #


+ # + # > **Note**: The information returned in this field, including its very + # > existence, and the formatting of values, should not be considered stable, and + # > may change without notice. + os_version: nil, + # Indicates if the host kernel has PID limit support enabled. + pids_limit: nil, + # Available plugins per type. + # + #


+ # + # > **Note**: Only unmanaged (V1) plugins are included in this list. V1 plugins + # > are "lazily" loaded, and are not returned in this list if there is no resource + # > using the plugin. + plugins: nil, + # Reports a summary of the product license on the daemon. + # + # If a commercial license has been applied to the daemon, information such as + # number of nodes, and expiration are included. + product_license: nil, + # RegistryServiceConfig stores daemon registry services configuration. + registry_config: nil, + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + runc_commit: nil, + # List of [OCI compliant](https://github.com/opencontainers/runtime-spec) runtimes + # configured on the daemon. Keys hold the "name" used to reference the runtime. + # + # The Docker daemon relies on an OCI compliant runtime (invoked via the + # `containerd` daemon) as its interface to the Linux kernel namespaces, cgroups, + # and SELinux. + # + # The default runtime is `runc`, and automatically configured. Additional runtimes + # can be configured by the user and will be listed here. + runtimes: nil, + # List of security features that are enabled on the daemon, such as apparmor, + # seccomp, SELinux, user-namespaces (userns), rootless and no-new-privileges. + # + # Additional configuration options for each security feature may be present, and + # are included as a comma-separated list of key/value pairs. + security_options: nil, + # Version string of the daemon. + server_version: nil, + # Indicates if the host has memory swap limit support enabled. + swap_limit: nil, + # Represents generic information about swarm. + swarm: nil, + # Current system-time in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format + # with nano-seconds. + system_time: nil, + # List of warnings / informational messages about missing features, or issues + # related to the daemon configuration. + # + # These messages can be printed by the client as information to the user. + warnings: nil + ) + end + + sig do + override.returns( + { + architecture: String, + cdi_spec_dirs: T::Array[String], + cgroup_driver: + Docker::Models::SystemInfoResponse::CgroupDriver::TaggedSymbol, + cgroup_version: + Docker::Models::SystemInfoResponse::CgroupVersion::TaggedSymbol, + containerd: + T.nilable(Docker::Models::SystemInfoResponse::Containerd), + containerd_commit: + Docker::Models::SystemInfoResponse::ContainerdCommit, + containers: Integer, + containers_paused: Integer, + containers_running: Integer, + containers_stopped: Integer, + cpu_cfs_period: T::Boolean, + cpu_cfs_quota: T::Boolean, + cpu_set: T::Boolean, + cpu_shares: T::Boolean, + debug: T::Boolean, + default_address_pools: + T::Array[Docker::Models::SystemInfoResponse::DefaultAddressPool], + default_runtime: String, + discovered_devices: + T::Array[Docker::Models::SystemInfoResponse::DiscoveredDevice], + docker_root_dir: String, + driver: String, + driver_status: T::Array[T::Array[String]], + experimental_build: T::Boolean, + firewall_backend: + T.nilable(Docker::Models::SystemInfoResponse::FirewallBackend), + generic_resources: + T::Array[Docker::Models::SystemInfoResponse::GenericResource], + http_proxy: String, + https_proxy: String, + id: String, + images: Integer, + index_server_address: String, + init_binary: String, + init_commit: Docker::Models::SystemInfoResponse::InitCommit, + i_pv4_forwarding: T::Boolean, + isolation: + Docker::Models::SystemInfoResponse::Isolation::TaggedSymbol, + kernel_version: String, + labels: T::Array[String], + live_restore_enabled: T::Boolean, + logging_driver: String, + memory_limit: T::Boolean, + mem_total: Integer, + name: String, + ncpu: Integer, + n_events_listener: Integer, + n_fd: Integer, + n_goroutines: Integer, + no_proxy: String, + nri: T.nilable(Docker::Models::SystemInfoResponse::Nri), + oom_kill_disable: T::Boolean, + operating_system: String, + os_type: String, + os_version: String, + pids_limit: T::Boolean, + plugins: Docker::Models::SystemInfoResponse::Plugins, + product_license: String, + registry_config: + T.nilable(Docker::Models::SystemInfoResponse::RegistryConfig), + runc_commit: Docker::Models::SystemInfoResponse::RuncCommit, + runtimes: + T::Hash[Symbol, Docker::Models::SystemInfoResponse::Runtime], + security_options: T::Array[String], + server_version: String, + swap_limit: T::Boolean, + swarm: Docker::Models::SystemInfoResponse::Swarm, + system_time: String, + warnings: T::Array[String] + } + ) + end + def to_hash + end + + # The driver to use for managing cgroups. + module CgroupDriver + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Models::SystemInfoResponse::CgroupDriver) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CGROUPFS = + T.let( + :cgroupfs, + Docker::Models::SystemInfoResponse::CgroupDriver::TaggedSymbol + ) + SYSTEMD = + T.let( + :systemd, + Docker::Models::SystemInfoResponse::CgroupDriver::TaggedSymbol + ) + NONE = + T.let( + :none, + Docker::Models::SystemInfoResponse::CgroupDriver::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Models::SystemInfoResponse::CgroupDriver::TaggedSymbol + ] + ) + end + def self.values + end + end + + # The version of the cgroup. + module CgroupVersion + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Models::SystemInfoResponse::CgroupVersion) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CGROUP_VERSION_1 = + T.let( + :"1", + Docker::Models::SystemInfoResponse::CgroupVersion::TaggedSymbol + ) + CGROUP_VERSION_2 = + T.let( + :"2", + Docker::Models::SystemInfoResponse::CgroupVersion::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Models::SystemInfoResponse::CgroupVersion::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Containerd < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Containerd, + Docker::Internal::AnyHash + ) + end + + # The address of the containerd socket. + sig { returns(T.nilable(String)) } + attr_reader :address + + sig { params(address: String).void } + attr_writer :address + + # The namespaces that the daemon uses for running containers and plugins in + # containerd. These namespaces can be configured in the daemon configuration, and + # are considered to be used exclusively by the daemon, Tampering with the + # containerd instance may cause unexpected behavior. + # + # As these namespaces are considered to be exclusively accessed by the daemon, it + # is not recommended to change these values, or to change them to a value that is + # used by other systems, such as cri-containerd. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Containerd::Namespaces + ) + ) + end + attr_reader :namespaces + + sig do + params( + namespaces: + Docker::Models::SystemInfoResponse::Containerd::Namespaces::OrHash + ).void + end + attr_writer :namespaces + + # Information for connecting to the containerd instance that is used by the + # daemon. This is included for debugging purposes only. + sig do + params( + address: String, + namespaces: + Docker::Models::SystemInfoResponse::Containerd::Namespaces::OrHash + ).returns(T.attached_class) + end + def self.new( + # The address of the containerd socket. + address: nil, + # The namespaces that the daemon uses for running containers and plugins in + # containerd. These namespaces can be configured in the daemon configuration, and + # are considered to be used exclusively by the daemon, Tampering with the + # containerd instance may cause unexpected behavior. + # + # As these namespaces are considered to be exclusively accessed by the daemon, it + # is not recommended to change these values, or to change them to a value that is + # used by other systems, such as cri-containerd. + namespaces: nil + ) + end + + sig do + override.returns( + { + address: String, + namespaces: + Docker::Models::SystemInfoResponse::Containerd::Namespaces + } + ) + end + def to_hash + end + + class Namespaces < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Containerd::Namespaces, + Docker::Internal::AnyHash + ) + end + + # The default containerd namespace used for containers managed by the daemon. + # + # The default namespace for containers is "moby", but will be suffixed with the + # `.` of the remapped `root` if user-namespaces are enabled and the + # containerd image-store is used. + sig { returns(T.nilable(String)) } + attr_reader :containers + + sig { params(containers: String).void } + attr_writer :containers + + # The default containerd namespace used for plugins managed by the daemon. + # + # The default namespace for plugins is "plugins.moby", but will be suffixed with + # the `.` of the remapped `root` if user-namespaces are enabled and the + # containerd image-store is used. + sig { returns(T.nilable(String)) } + attr_reader :plugins + + sig { params(plugins: String).void } + attr_writer :plugins + + # The namespaces that the daemon uses for running containers and plugins in + # containerd. These namespaces can be configured in the daemon configuration, and + # are considered to be used exclusively by the daemon, Tampering with the + # containerd instance may cause unexpected behavior. + # + # As these namespaces are considered to be exclusively accessed by the daemon, it + # is not recommended to change these values, or to change them to a value that is + # used by other systems, such as cri-containerd. + sig do + params(containers: String, plugins: String).returns( + T.attached_class + ) + end + def self.new( + # The default containerd namespace used for containers managed by the daemon. + # + # The default namespace for containers is "moby", but will be suffixed with the + # `.` of the remapped `root` if user-namespaces are enabled and the + # containerd image-store is used. + containers: nil, + # The default containerd namespace used for plugins managed by the daemon. + # + # The default namespace for plugins is "plugins.moby", but will be suffixed with + # the `.` of the remapped `root` if user-namespaces are enabled and the + # containerd image-store is used. + plugins: nil + ) + end + + sig { override.returns({ containers: String, plugins: String }) } + def to_hash + end + end + end + + class ContainerdCommit < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::ContainerdCommit, + Docker::Internal::AnyHash + ) + end + + # Actual commit ID of external tool. + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + sig { params(id: String).returns(T.attached_class) } + def self.new( + # Actual commit ID of external tool. + id: nil + ) + end + + sig { override.returns({ id: String }) } + def to_hash + end + end + + class DefaultAddressPool < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::DefaultAddressPool, + Docker::Internal::AnyHash + ) + end + + # The network address in CIDR format + sig { returns(T.nilable(String)) } + attr_reader :base + + sig { params(base: String).void } + attr_writer :base + + # The network pool size + sig { returns(T.nilable(Integer)) } + attr_reader :size + + sig { params(size: Integer).void } + attr_writer :size + + sig { params(base: String, size: Integer).returns(T.attached_class) } + def self.new( + # The network address in CIDR format + base: nil, + # The network pool size + size: nil + ) + end + + sig { override.returns({ base: String, size: Integer }) } + def to_hash + end + end + + class DiscoveredDevice < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::DiscoveredDevice, + Docker::Internal::AnyHash + ) + end + + # The unique identifier for the device within its source driver. For CDI devices, + # this would be an FQDN like "vendor.com/gpu=0". + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # The origin device driver. + sig { returns(T.nilable(String)) } + attr_reader :source + + sig { params(source: String).void } + attr_writer :source + + # DeviceInfo represents a device that can be used by a container. + sig { params(id: String, source: String).returns(T.attached_class) } + def self.new( + # The unique identifier for the device within its source driver. For CDI devices, + # this would be an FQDN like "vendor.com/gpu=0". + id: nil, + # The origin device driver. + source: nil + ) + end + + sig { override.returns({ id: String, source: String }) } + def to_hash + end + end + + class FirewallBackend < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::FirewallBackend, + Docker::Internal::AnyHash + ) + end + + # The name of the firewall backend driver. + sig { returns(T.nilable(String)) } + attr_reader :driver + + sig { params(driver: String).void } + attr_writer :driver + + # Information about the firewall backend, provided as "label" / "value" pairs. + # + #


+ # + # > **Note**: The information returned in this field, including the formatting of + # > values and labels, should not be considered stable, and may change without + # > notice. + sig { returns(T.nilable(T::Array[T::Array[String]])) } + attr_reader :info + + sig { params(info: T::Array[T::Array[String]]).void } + attr_writer :info + + # Information about the daemon's firewalling configuration. + # + # This field is currently only used on Linux, and omitted on other platforms. + sig do + params(driver: String, info: T::Array[T::Array[String]]).returns( + T.attached_class + ) + end + def self.new( + # The name of the firewall backend driver. + driver: nil, + # Information about the firewall backend, provided as "label" / "value" pairs. + # + #


+ # + # > **Note**: The information returned in this field, including the formatting of + # > values and labels, should not be considered stable, and may change without + # > notice. + info: nil + ) + end + + sig do + override.returns({ driver: String, info: T::Array[T::Array[String]] }) + end + def to_hash + end + end + + class GenericResource < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::GenericResource, + Docker::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec + ) + ) + end + attr_reader :discrete_resource_spec + + sig do + params( + discrete_resource_spec: + Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec::OrHash + ).void + end + attr_writer :discrete_resource_spec + + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec + ) + ) + end + attr_reader :named_resource_spec + + sig do + params( + named_resource_spec: + Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec::OrHash + ).void + end + attr_writer :named_resource_spec + + sig do + params( + discrete_resource_spec: + Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec::OrHash, + named_resource_spec: + Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec::OrHash + ).returns(T.attached_class) + end + def self.new(discrete_resource_spec: nil, named_resource_spec: nil) + end + + sig do + override.returns( + { + discrete_resource_spec: + Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec, + named_resource_spec: + Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec + } + ) + end + def to_hash + end + + class DiscreteResourceSpec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :kind + + sig { params(kind: String).void } + attr_writer :kind + + sig { returns(T.nilable(Integer)) } + attr_reader :value + + sig { params(value: Integer).void } + attr_writer :value + + sig { params(kind: String, value: Integer).returns(T.attached_class) } + def self.new(kind: nil, value: nil) + end + + sig { override.returns({ kind: String, value: Integer }) } + def to_hash + end + end + + class NamedResourceSpec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :kind + + sig { params(kind: String).void } + attr_writer :kind + + sig { returns(T.nilable(String)) } + attr_reader :value + + sig { params(value: String).void } + attr_writer :value + + sig { params(kind: String, value: String).returns(T.attached_class) } + def self.new(kind: nil, value: nil) + end + + sig { override.returns({ kind: String, value: String }) } + def to_hash + end + end + end + + class InitCommit < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::InitCommit, + Docker::Internal::AnyHash + ) + end + + # Actual commit ID of external tool. + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + sig { params(id: String).returns(T.attached_class) } + def self.new( + # Actual commit ID of external tool. + id: nil + ) + end + + sig { override.returns({ id: String }) } + def to_hash + end + end + + # Represents the isolation technology to use as a default for containers. The + # supported values are platform-specific. + # + # If no isolation value is specified on daemon start, on Windows client, the + # default is `hyperv`, and on Windows server, the default is `process`. + # + # This option is currently not used on other platforms. + module Isolation + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Docker::Models::SystemInfoResponse::Isolation) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DEFAULT = + T.let( + :default, + Docker::Models::SystemInfoResponse::Isolation::TaggedSymbol + ) + HYPERV = + T.let( + :hyperv, + Docker::Models::SystemInfoResponse::Isolation::TaggedSymbol + ) + PROCESS = + T.let( + :process, + Docker::Models::SystemInfoResponse::Isolation::TaggedSymbol + ) + EMPTY = + T.let( + :"", + Docker::Models::SystemInfoResponse::Isolation::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Models::SystemInfoResponse::Isolation::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Nri < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Nri, + Docker::Internal::AnyHash + ) + end + + # Information about NRI, provided as "label" / "value" pairs. + # + #


+ # + # > **Note**: The information returned in this field, including the formatting of + # > values and labels, should not be considered stable, and may change without + # > notice. + sig { returns(T.nilable(T::Array[T::Array[String]])) } + attr_reader :info + + sig { params(info: T::Array[T::Array[String]]).void } + attr_writer :info + + # Information about the Node Resource Interface (NRI). + # + # This field is only present if NRI is enabled. + sig do + params(info: T::Array[T::Array[String]]).returns(T.attached_class) + end + def self.new( + # Information about NRI, provided as "label" / "value" pairs. + # + #


+ # + # > **Note**: The information returned in this field, including the formatting of + # > values and labels, should not be considered stable, and may change without + # > notice. + info: nil + ) + end + + sig { override.returns({ info: T::Array[T::Array[String]] }) } + def to_hash + end + end + + class Plugins < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Plugins, + Docker::Internal::AnyHash + ) + end + + # Names of available authorization plugins. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :authorization + + sig { params(authorization: T::Array[String]).void } + attr_writer :authorization + + # Names of available logging-drivers, and logging-driver plugins. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :log + + sig { params(log: T::Array[String]).void } + attr_writer :log + + # Names of available network-drivers, and network-driver plugins. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :network + + sig { params(network: T::Array[String]).void } + attr_writer :network + + # Names of available volume-drivers, and network-driver plugins. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :volume + + sig { params(volume: T::Array[String]).void } + attr_writer :volume + + # Available plugins per type. + # + #


+ # + # > **Note**: Only unmanaged (V1) plugins are included in this list. V1 plugins + # > are "lazily" loaded, and are not returned in this list if there is no resource + # > using the plugin. + sig do + params( + authorization: T::Array[String], + log: T::Array[String], + network: T::Array[String], + volume: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # Names of available authorization plugins. + authorization: nil, + # Names of available logging-drivers, and logging-driver plugins. + log: nil, + # Names of available network-drivers, and network-driver plugins. + network: nil, + # Names of available volume-drivers, and network-driver plugins. + volume: nil + ) + end + + sig do + override.returns( + { + authorization: T::Array[String], + log: T::Array[String], + network: T::Array[String], + volume: T::Array[String] + } + ) + end + def to_hash + end + end + + class RegistryConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::RegistryConfig, + Docker::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + T::Hash[ + Symbol, + T.nilable( + Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig + ) + ] + ) + ) + end + attr_reader :index_configs + + sig do + params( + index_configs: + T::Hash[ + Symbol, + T.nilable( + Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig::OrHash + ) + ] + ).void + end + attr_writer :index_configs + + # List of IP ranges of insecure registries, using the CIDR syntax + # ([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries accept + # un-encrypted (HTTP) and/or untrusted (HTTPS with certificates from unknown CAs) + # communication. + # + # By default, local registries (`::1/128` and `127.0.0.0/8`) are configured as + # insecure. All other registries are secure. Communicating with an insecure + # registry is not possible if the daemon assumes that registry is secure. + # + # This configuration override this behavior, insecure communication with + # registries whose resolved IP address is within the subnet described by the CIDR + # syntax. + # + # Registries can also be marked insecure by hostname. Those registries are listed + # under `IndexConfigs` and have their `Secure` field set to `false`. + # + # > **Warning**: Using this option can be useful when running a local registry, + # > but introduces security vulnerabilities. This option should therefore ONLY be + # > used for testing purposes. For increased security, users should add their CA + # > to their system's list of trusted CAs instead of enabling this option. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :insecure_registry_cid_rs + + sig { params(insecure_registry_cid_rs: T::Array[String]).void } + attr_writer :insecure_registry_cid_rs + + # List of registry URLs that act as a mirror for the official (`docker.io`) + # registry. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :mirrors + + sig { params(mirrors: T::Array[String]).void } + attr_writer :mirrors + + # RegistryServiceConfig stores daemon registry services configuration. + sig do + params( + index_configs: + T::Hash[ + Symbol, + T.nilable( + Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig::OrHash + ) + ], + insecure_registry_cid_rs: T::Array[String], + mirrors: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + index_configs: nil, + # List of IP ranges of insecure registries, using the CIDR syntax + # ([RFC 4632](https://tools.ietf.org/html/4632)). Insecure registries accept + # un-encrypted (HTTP) and/or untrusted (HTTPS with certificates from unknown CAs) + # communication. + # + # By default, local registries (`::1/128` and `127.0.0.0/8`) are configured as + # insecure. All other registries are secure. Communicating with an insecure + # registry is not possible if the daemon assumes that registry is secure. + # + # This configuration override this behavior, insecure communication with + # registries whose resolved IP address is within the subnet described by the CIDR + # syntax. + # + # Registries can also be marked insecure by hostname. Those registries are listed + # under `IndexConfigs` and have their `Secure` field set to `false`. + # + # > **Warning**: Using this option can be useful when running a local registry, + # > but introduces security vulnerabilities. This option should therefore ONLY be + # > used for testing purposes. For increased security, users should add their CA + # > to their system's list of trusted CAs instead of enabling this option. + insecure_registry_cid_rs: nil, + # List of registry URLs that act as a mirror for the official (`docker.io`) + # registry. + mirrors: nil + ) + end + + sig do + override.returns( + { + index_configs: + T::Hash[ + Symbol, + T.nilable( + Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig + ) + ], + insecure_registry_cid_rs: T::Array[String], + mirrors: T::Array[String] + } + ) + end + def to_hash + end + + class IndexConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig, + Docker::Internal::AnyHash + ) + end + + # List of mirrors, expressed as URIs. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :mirrors + + sig { params(mirrors: T::Array[String]).void } + attr_writer :mirrors + + # Name of the registry, such as "docker.io". + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Indicates whether this is an official registry (i.e., Docker Hub / docker.io) + sig { returns(T.nilable(T::Boolean)) } + attr_reader :official + + sig { params(official: T::Boolean).void } + attr_writer :official + + # Indicates if the registry is part of the list of insecure registries. + # + # If `false`, the registry is insecure. Insecure registries accept un-encrypted + # (HTTP) and/or untrusted (HTTPS with certificates from unknown CAs) + # communication. + # + # > **Warning**: Insecure registries can be useful when running a local registry. + # > However, because its use creates security vulnerabilities it should ONLY be + # > enabled for testing purposes. For increased security, users should add their + # > CA to their system's list of trusted CAs instead of enabling this option. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :secure + + sig { params(secure: T::Boolean).void } + attr_writer :secure + + # IndexInfo contains information about a registry. + sig do + params( + mirrors: T::Array[String], + name: String, + official: T::Boolean, + secure: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # List of mirrors, expressed as URIs. + mirrors: nil, + # Name of the registry, such as "docker.io". + name: nil, + # Indicates whether this is an official registry (i.e., Docker Hub / docker.io) + official: nil, + # Indicates if the registry is part of the list of insecure registries. + # + # If `false`, the registry is insecure. Insecure registries accept un-encrypted + # (HTTP) and/or untrusted (HTTPS with certificates from unknown CAs) + # communication. + # + # > **Warning**: Insecure registries can be useful when running a local registry. + # > However, because its use creates security vulnerabilities it should ONLY be + # > enabled for testing purposes. For increased security, users should add their + # > CA to their system's list of trusted CAs instead of enabling this option. + secure: nil + ) + end + + sig do + override.returns( + { + mirrors: T::Array[String], + name: String, + official: T::Boolean, + secure: T::Boolean + } + ) + end + def to_hash + end + end + end + + class RuncCommit < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::RuncCommit, + Docker::Internal::AnyHash + ) + end + + # Actual commit ID of external tool. + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Commit holds the Git-commit (SHA1) that a binary was built from, as reported in + # the version-string of external tools, such as `containerd`, or `runC`. + sig { params(id: String).returns(T.attached_class) } + def self.new( + # Actual commit ID of external tool. + id: nil + ) + end + + sig { override.returns({ id: String }) } + def to_hash + end + end + + class Runtime < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Runtime, + Docker::Internal::AnyHash + ) + end + + # Name and, optional, path, of the OCI executable binary. + # + # If the path is omitted, the daemon searches the host's `$PATH` for the binary + # and uses the first result. + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + # List of command-line arguments to pass to the runtime when invoked. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :runtime_args + + # Information specific to the runtime. + # + # While this API specification does not define data provided by runtimes, the + # following well-known properties may be provided by runtimes: + # + # `org.opencontainers.runtime-spec.features`: features structure as defined in the + # [OCI Runtime Specification](https://github.com/opencontainers/runtime-spec/blob/main/features.md), + # in a JSON string representation. + # + #


+ # + # > **Note**: The information returned in this field, including the formatting of + # > values and labels, should not be considered stable, and may change without + # > notice. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :status + + # Runtime describes an + # [OCI compliant](https://github.com/opencontainers/runtime-spec) runtime. + # + # The runtime is invoked by the daemon via the `containerd` daemon. OCI runtimes + # act as an interface to the Linux kernel namespaces, cgroups, and SELinux. + sig do + params( + path: String, + runtime_args: T.nilable(T::Array[String]), + status: T.nilable(T::Hash[Symbol, String]) + ).returns(T.attached_class) + end + def self.new( + # Name and, optional, path, of the OCI executable binary. + # + # If the path is omitted, the daemon searches the host's `$PATH` for the binary + # and uses the first result. + path: nil, + # List of command-line arguments to pass to the runtime when invoked. + runtime_args: nil, + # Information specific to the runtime. + # + # While this API specification does not define data provided by runtimes, the + # following well-known properties may be provided by runtimes: + # + # `org.opencontainers.runtime-spec.features`: features structure as defined in the + # [OCI Runtime Specification](https://github.com/opencontainers/runtime-spec/blob/main/features.md), + # in a JSON string representation. + # + #


+ # + # > **Note**: The information returned in this field, including the formatting of + # > values and labels, should not be considered stable, and may change without + # > notice. + status: nil + ) + end + + sig do + override.returns( + { + path: String, + runtime_args: T.nilable(T::Array[String]), + status: T.nilable(T::Hash[Symbol, String]) + } + ) + end + def to_hash + end + end + + class Swarm < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm, + Docker::Internal::AnyHash + ) + end + + # ClusterInfo represents information about the swarm as is returned by the "/info" + # endpoint. Join-tokens are not included. + sig do + returns(T.nilable(Docker::Models::SystemInfoResponse::Swarm::Cluster)) + end + attr_reader :cluster + + sig do + params( + cluster: + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::OrHash + ) + ).void + end + attr_writer :cluster + + sig { returns(T.nilable(T::Boolean)) } + attr_reader :control_available + + sig { params(control_available: T::Boolean).void } + attr_writer :control_available + + sig { returns(T.nilable(String)) } + attr_reader :error + + sig { params(error: String).void } + attr_writer :error + + # Current local status of this node. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::LocalNodeState::TaggedSymbol + ) + ) + end + attr_reader :local_node_state + + sig do + params( + local_node_state: + Docker::Models::SystemInfoResponse::Swarm::LocalNodeState::OrSymbol + ).void + end + attr_writer :local_node_state + + # Total number of managers in the swarm. + sig { returns(T.nilable(Integer)) } + attr_accessor :managers + + # IP address at which this node can be reached by other nodes in the swarm. + sig { returns(T.nilable(String)) } + attr_reader :node_addr + + sig { params(node_addr: String).void } + attr_writer :node_addr + + # Unique identifier of for this node in the swarm. + sig { returns(T.nilable(String)) } + attr_reader :node_id + + sig { params(node_id: String).void } + attr_writer :node_id + + # Total number of nodes in the swarm. + sig { returns(T.nilable(Integer)) } + attr_accessor :nodes + + # List of ID's and addresses of other managers in the swarm. + sig do + returns( + T.nilable( + T::Array[Docker::Models::SystemInfoResponse::Swarm::RemoteManager] + ) + ) + end + attr_accessor :remote_managers + + # Represents generic information about swarm. + sig do + params( + cluster: + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::OrHash + ), + control_available: T::Boolean, + error: String, + local_node_state: + Docker::Models::SystemInfoResponse::Swarm::LocalNodeState::OrSymbol, + managers: T.nilable(Integer), + node_addr: String, + node_id: String, + nodes: T.nilable(Integer), + remote_managers: + T.nilable( + T::Array[ + Docker::Models::SystemInfoResponse::Swarm::RemoteManager::OrHash + ] + ) + ).returns(T.attached_class) + end + def self.new( + # ClusterInfo represents information about the swarm as is returned by the "/info" + # endpoint. Join-tokens are not included. + cluster: nil, + control_available: nil, + error: nil, + # Current local status of this node. + local_node_state: nil, + # Total number of managers in the swarm. + managers: nil, + # IP address at which this node can be reached by other nodes in the swarm. + node_addr: nil, + # Unique identifier of for this node in the swarm. + node_id: nil, + # Total number of nodes in the swarm. + nodes: nil, + # List of ID's and addresses of other managers in the swarm. + remote_managers: nil + ) + end + + sig do + override.returns( + { + cluster: + T.nilable(Docker::Models::SystemInfoResponse::Swarm::Cluster), + control_available: T::Boolean, + error: String, + local_node_state: + Docker::Models::SystemInfoResponse::Swarm::LocalNodeState::TaggedSymbol, + managers: T.nilable(Integer), + node_addr: String, + node_id: String, + nodes: T.nilable(Integer), + remote_managers: + T.nilable( + T::Array[ + Docker::Models::SystemInfoResponse::Swarm::RemoteManager + ] + ) + } + ) + end + def to_hash + end + + class Cluster < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::Cluster, + Docker::Internal::AnyHash + ) + end + + # Date and time at which the swarm was initialised in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + sig { returns(T.nilable(String)) } + attr_reader :created_at + + sig { params(created_at: String).void } + attr_writer :created_at + + # DataPathPort specifies the data path port number for data traffic. Acceptable + # port range is 1024 to 49151. If no port is set or is set to 0, the default port + # (4789) is used. + sig { returns(T.nilable(Integer)) } + attr_reader :data_path_port + + sig { params(data_path_port: Integer).void } + attr_writer :data_path_port + + # Default Address Pool specifies default subnet pools for global scope networks. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :default_addr_pool + + sig { params(default_addr_pool: T::Array[String]).void } + attr_writer :default_addr_pool + + # The ID of the swarm. + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Whether there is currently a root CA rotation in progress for the swarm + sig { returns(T.nilable(T::Boolean)) } + attr_reader :root_rotation_in_progress + + sig { params(root_rotation_in_progress: T::Boolean).void } + attr_writer :root_rotation_in_progress + + # User modifiable swarm configuration. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec + ) + ) + end + attr_reader :spec + + sig do + params( + spec: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::OrHash + ).void + end + attr_writer :spec + + # SubnetSize specifies the subnet size of the networks created from the default + # subnet pool. + sig { returns(T.nilable(Integer)) } + attr_reader :subnet_size + + sig { params(subnet_size: Integer).void } + attr_writer :subnet_size + + # Information about the issuer of leaf TLS certificates and the trusted root CA + # certificate. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo + ) + ) + end + attr_reader :tls_info + + sig do + params( + tls_info: + Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo::OrHash + ).void + end + attr_writer :tls_info + + # Date and time at which the swarm was last updated in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + sig { returns(T.nilable(String)) } + attr_reader :updated_at + + sig { params(updated_at: String).void } + attr_writer :updated_at + + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Version + ) + ) + end + attr_reader :version + + sig do + params( + version: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Version::OrHash + ).void + end + attr_writer :version + + # ClusterInfo represents information about the swarm as is returned by the "/info" + # endpoint. Join-tokens are not included. + sig do + params( + created_at: String, + data_path_port: Integer, + default_addr_pool: T::Array[String], + id: String, + root_rotation_in_progress: T::Boolean, + spec: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::OrHash, + subnet_size: Integer, + tls_info: + Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo::OrHash, + updated_at: String, + version: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Version::OrHash + ).returns(T.attached_class) + end + def self.new( + # Date and time at which the swarm was initialised in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + created_at: nil, + # DataPathPort specifies the data path port number for data traffic. Acceptable + # port range is 1024 to 49151. If no port is set or is set to 0, the default port + # (4789) is used. + data_path_port: nil, + # Default Address Pool specifies default subnet pools for global scope networks. + default_addr_pool: nil, + # The ID of the swarm. + id: nil, + # Whether there is currently a root CA rotation in progress for the swarm + root_rotation_in_progress: nil, + # User modifiable swarm configuration. + spec: nil, + # SubnetSize specifies the subnet size of the networks created from the default + # subnet pool. + subnet_size: nil, + # Information about the issuer of leaf TLS certificates and the trusted root CA + # certificate. + tls_info: nil, + # Date and time at which the swarm was last updated in + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. + updated_at: nil, + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + version: nil + ) + end + + sig do + override.returns( + { + created_at: String, + data_path_port: Integer, + default_addr_pool: T::Array[String], + id: String, + root_rotation_in_progress: T::Boolean, + spec: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec, + subnet_size: Integer, + tls_info: + Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo, + updated_at: String, + version: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Version + } + ) + end + def to_hash + end + + class Spec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec, + Docker::Internal::AnyHash + ) + end + + # CA configuration. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig + ) + ) + end + attr_reader :ca_config + + sig do + params( + ca_config: + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::OrHash + ) + ).void + end + attr_writer :ca_config + + # Dispatcher configuration. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher + ) + ) + end + attr_reader :dispatcher + + sig do + params( + dispatcher: + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher::OrHash + ) + ).void + end + attr_writer :dispatcher + + # Parameters related to encryption-at-rest. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig + ) + ) + end + attr_reader :encryption_config + + sig do + params( + encryption_config: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig::OrHash + ).void + end + attr_writer :encryption_config + + # User-defined key/value metadata. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :labels + + sig { params(labels: T::Hash[Symbol, String]).void } + attr_writer :labels + + # Name of the swarm. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Orchestration configuration. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration + ) + ) + end + attr_reader :orchestration + + sig do + params( + orchestration: + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration::OrHash + ) + ).void + end + attr_writer :orchestration + + # Raft configuration. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft + ) + ) + end + attr_reader :raft + + sig do + params( + raft: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft::OrHash + ).void + end + attr_writer :raft + + # Defaults for creating tasks in this cluster. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults + ) + ) + end + attr_reader :task_defaults + + sig do + params( + task_defaults: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::OrHash + ).void + end + attr_writer :task_defaults + + # User modifiable swarm configuration. + sig do + params( + ca_config: + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::OrHash + ), + dispatcher: + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher::OrHash + ), + encryption_config: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig::OrHash, + labels: T::Hash[Symbol, String], + name: String, + orchestration: + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration::OrHash + ), + raft: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft::OrHash, + task_defaults: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::OrHash + ).returns(T.attached_class) + end + def self.new( + # CA configuration. + ca_config: nil, + # Dispatcher configuration. + dispatcher: nil, + # Parameters related to encryption-at-rest. + encryption_config: nil, + # User-defined key/value metadata. + labels: nil, + # Name of the swarm. + name: nil, + # Orchestration configuration. + orchestration: nil, + # Raft configuration. + raft: nil, + # Defaults for creating tasks in this cluster. + task_defaults: nil + ) + end + + sig do + override.returns( + { + ca_config: + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig + ), + dispatcher: + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher + ), + encryption_config: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig, + labels: T::Hash[Symbol, String], + name: String, + orchestration: + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration + ), + raft: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft, + task_defaults: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults + } + ) + end + def to_hash + end + + class CaConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig, + Docker::Internal::AnyHash + ) + end + + # Configuration for forwarding signing requests to an external certificate + # authority. + sig do + returns( + T.nilable( + T::Array[ + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA + ] + ) + ) + end + attr_reader :external_c_as + + sig do + params( + external_c_as: + T::Array[ + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::OrHash + ] + ).void + end + attr_writer :external_c_as + + # An integer whose purpose is to force swarm to generate a new signing CA + # certificate and key, if none have been specified in `SigningCACert` and + # `SigningCAKey` + sig { returns(T.nilable(Integer)) } + attr_reader :force_rotate + + sig { params(force_rotate: Integer).void } + attr_writer :force_rotate + + # The duration node certificates are issued for. + sig { returns(T.nilable(Integer)) } + attr_reader :node_cert_expiry + + sig { params(node_cert_expiry: Integer).void } + attr_writer :node_cert_expiry + + # The desired signing CA certificate for all swarm node TLS leaf certificates, in + # PEM format. + sig { returns(T.nilable(String)) } + attr_reader :signing_ca_cert + + sig { params(signing_ca_cert: String).void } + attr_writer :signing_ca_cert + + # The desired signing CA key for all swarm node TLS leaf certificates, in PEM + # format. + sig { returns(T.nilable(String)) } + attr_reader :signing_ca_key + + sig { params(signing_ca_key: String).void } + attr_writer :signing_ca_key + + # CA configuration. + sig do + params( + external_c_as: + T::Array[ + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::OrHash + ], + force_rotate: Integer, + node_cert_expiry: Integer, + signing_ca_cert: String, + signing_ca_key: String + ).returns(T.attached_class) + end + def self.new( + # Configuration for forwarding signing requests to an external certificate + # authority. + external_c_as: nil, + # An integer whose purpose is to force swarm to generate a new signing CA + # certificate and key, if none have been specified in `SigningCACert` and + # `SigningCAKey` + force_rotate: nil, + # The duration node certificates are issued for. + node_cert_expiry: nil, + # The desired signing CA certificate for all swarm node TLS leaf certificates, in + # PEM format. + signing_ca_cert: nil, + # The desired signing CA key for all swarm node TLS leaf certificates, in PEM + # format. + signing_ca_key: nil + ) + end + + sig do + override.returns( + { + external_c_as: + T::Array[ + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA + ], + force_rotate: Integer, + node_cert_expiry: Integer, + signing_ca_cert: String, + signing_ca_key: String + } + ) + end + def to_hash + end + + class ExternalCA < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA, + Docker::Internal::AnyHash + ) + end + + # The root CA certificate (in PEM format) this external CA uses to issue TLS + # certificates (assumed to be to the current swarm root CA certificate if not + # provided). + sig { returns(T.nilable(String)) } + attr_reader :ca_cert + + sig { params(ca_cert: String).void } + attr_writer :ca_cert + + # An object with key/value pairs that are interpreted as protocol-specific options + # for the external CA driver. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :options + + sig { params(options: T::Hash[Symbol, String]).void } + attr_writer :options + + # Protocol for communication with the external CA (currently only `cfssl` is + # supported). + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::Protocol::TaggedSymbol + ) + ) + end + attr_reader :protocol + + sig do + params( + protocol: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::Protocol::OrSymbol + ).void + end + attr_writer :protocol + + # URL where certificate signing requests should be sent. + sig { returns(T.nilable(String)) } + attr_reader :url + + sig { params(url: String).void } + attr_writer :url + + sig do + params( + ca_cert: String, + options: T::Hash[Symbol, String], + protocol: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::Protocol::OrSymbol, + url: String + ).returns(T.attached_class) + end + def self.new( + # The root CA certificate (in PEM format) this external CA uses to issue TLS + # certificates (assumed to be to the current swarm root CA certificate if not + # provided). + ca_cert: nil, + # An object with key/value pairs that are interpreted as protocol-specific options + # for the external CA driver. + options: nil, + # Protocol for communication with the external CA (currently only `cfssl` is + # supported). + protocol: nil, + # URL where certificate signing requests should be sent. + url: nil + ) + end + + sig do + override.returns( + { + ca_cert: String, + options: T::Hash[Symbol, String], + protocol: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::Protocol::TaggedSymbol, + url: String + } + ) + end + def to_hash + end + + # Protocol for communication with the external CA (currently only `cfssl` is + # supported). + module Protocol + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::Protocol + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CFSSL = + T.let( + :cfssl, + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::Protocol::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::Protocol::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class Dispatcher < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher, + Docker::Internal::AnyHash + ) + end + + # The delay for an agent to send a heartbeat to the dispatcher. + sig { returns(T.nilable(Integer)) } + attr_reader :heartbeat_period + + sig { params(heartbeat_period: Integer).void } + attr_writer :heartbeat_period + + # Dispatcher configuration. + sig do + params(heartbeat_period: Integer).returns(T.attached_class) + end + def self.new( + # The delay for an agent to send a heartbeat to the dispatcher. + heartbeat_period: nil + ) + end + + sig { override.returns({ heartbeat_period: Integer }) } + def to_hash + end + end + + class EncryptionConfig < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig, + Docker::Internal::AnyHash + ) + end + + # If set, generate a key and use it to lock data stored on the managers. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :auto_lock_managers + + sig { params(auto_lock_managers: T::Boolean).void } + attr_writer :auto_lock_managers + + # Parameters related to encryption-at-rest. + sig do + params(auto_lock_managers: T::Boolean).returns(T.attached_class) + end + def self.new( + # If set, generate a key and use it to lock data stored on the managers. + auto_lock_managers: nil + ) + end + + sig { override.returns({ auto_lock_managers: T::Boolean }) } + def to_hash + end + end + + class Orchestration < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration, + Docker::Internal::AnyHash + ) + end + + # The number of historic tasks to keep per instance or node. If negative, never + # remove completed or failed tasks. + sig { returns(T.nilable(Integer)) } + attr_reader :task_history_retention_limit + + sig { params(task_history_retention_limit: Integer).void } + attr_writer :task_history_retention_limit + + # Orchestration configuration. + sig do + params(task_history_retention_limit: Integer).returns( + T.attached_class + ) + end + def self.new( + # The number of historic tasks to keep per instance or node. If negative, never + # remove completed or failed tasks. + task_history_retention_limit: nil + ) + end + + sig do + override.returns({ task_history_retention_limit: Integer }) + end + def to_hash + end + end + + class Raft < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft, + Docker::Internal::AnyHash + ) + end + + # The number of ticks that a follower will wait for a message from the leader + # before becoming a candidate and starting an election. `ElectionTick` must be + # greater than `HeartbeatTick`. + # + # A tick currently defaults to one second, so these translate directly to seconds + # currently, but this is NOT guaranteed. + sig { returns(T.nilable(Integer)) } + attr_reader :election_tick + + sig { params(election_tick: Integer).void } + attr_writer :election_tick + + # The number of ticks between heartbeats. Every HeartbeatTick ticks, the leader + # will send a heartbeat to the followers. + # + # A tick currently defaults to one second, so these translate directly to seconds + # currently, but this is NOT guaranteed. + sig { returns(T.nilable(Integer)) } + attr_reader :heartbeat_tick + + sig { params(heartbeat_tick: Integer).void } + attr_writer :heartbeat_tick + + # The number of snapshots to keep beyond the current snapshot. + sig { returns(T.nilable(Integer)) } + attr_reader :keep_old_snapshots + + sig { params(keep_old_snapshots: Integer).void } + attr_writer :keep_old_snapshots + + # The number of log entries to keep around to sync up slow followers after a + # snapshot is created. + sig { returns(T.nilable(Integer)) } + attr_reader :log_entries_for_slow_followers + + sig { params(log_entries_for_slow_followers: Integer).void } + attr_writer :log_entries_for_slow_followers + + # The number of log entries between snapshots. + sig { returns(T.nilable(Integer)) } + attr_reader :snapshot_interval + + sig { params(snapshot_interval: Integer).void } + attr_writer :snapshot_interval + + # Raft configuration. + sig do + params( + election_tick: Integer, + heartbeat_tick: Integer, + keep_old_snapshots: Integer, + log_entries_for_slow_followers: Integer, + snapshot_interval: Integer + ).returns(T.attached_class) + end + def self.new( + # The number of ticks that a follower will wait for a message from the leader + # before becoming a candidate and starting an election. `ElectionTick` must be + # greater than `HeartbeatTick`. + # + # A tick currently defaults to one second, so these translate directly to seconds + # currently, but this is NOT guaranteed. + election_tick: nil, + # The number of ticks between heartbeats. Every HeartbeatTick ticks, the leader + # will send a heartbeat to the followers. + # + # A tick currently defaults to one second, so these translate directly to seconds + # currently, but this is NOT guaranteed. + heartbeat_tick: nil, + # The number of snapshots to keep beyond the current snapshot. + keep_old_snapshots: nil, + # The number of log entries to keep around to sync up slow followers after a + # snapshot is created. + log_entries_for_slow_followers: nil, + # The number of log entries between snapshots. + snapshot_interval: nil + ) + end + + sig do + override.returns( + { + election_tick: Integer, + heartbeat_tick: Integer, + keep_old_snapshots: Integer, + log_entries_for_slow_followers: Integer, + snapshot_interval: Integer + } + ) + end + def to_hash + end + end + + class TaskDefaults < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults, + Docker::Internal::AnyHash + ) + end + + # The log driver to use for tasks created in the orchestrator if unspecified by a + # service. + # + # Updating this value only affects new tasks. Existing tasks continue to use their + # previously configured log driver until recreated. + sig do + returns( + T.nilable( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver + ) + ) + end + attr_reader :log_driver + + sig do + params( + log_driver: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver::OrHash + ).void + end + attr_writer :log_driver + + # Defaults for creating tasks in this cluster. + sig do + params( + log_driver: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver::OrHash + ).returns(T.attached_class) + end + def self.new( + # The log driver to use for tasks created in the orchestrator if unspecified by a + # service. + # + # Updating this value only affects new tasks. Existing tasks continue to use their + # previously configured log driver until recreated. + log_driver: nil + ) + end + + sig do + override.returns( + { + log_driver: + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver + } + ) + end + def to_hash + end + + class LogDriver < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver, + Docker::Internal::AnyHash + ) + end + + # The log driver to use as a default for new tasks. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Driver-specific options for the selected log driver, specified as key/value + # pairs. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :options + + sig { params(options: T::Hash[Symbol, String]).void } + attr_writer :options + + # The log driver to use for tasks created in the orchestrator if unspecified by a + # service. + # + # Updating this value only affects new tasks. Existing tasks continue to use their + # previously configured log driver until recreated. + sig do + params( + name: String, + options: T::Hash[Symbol, String] + ).returns(T.attached_class) + end + def self.new( + # The log driver to use as a default for new tasks. + name: nil, + # Driver-specific options for the selected log driver, specified as key/value + # pairs. + options: nil + ) + end + + sig do + override.returns( + { name: String, options: T::Hash[Symbol, String] } + ) + end + def to_hash + end + end + end + end + + class TlsInfo < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo, + Docker::Internal::AnyHash + ) + end + + # The base64-url-safe-encoded raw public key bytes of the issuer. + sig { returns(T.nilable(String)) } + attr_reader :cert_issuer_public_key + + sig { params(cert_issuer_public_key: String).void } + attr_writer :cert_issuer_public_key + + # The base64-url-safe-encoded raw subject bytes of the issuer. + sig { returns(T.nilable(String)) } + attr_reader :cert_issuer_subject + + sig { params(cert_issuer_subject: String).void } + attr_writer :cert_issuer_subject + + # The root CA certificate(s) that are used to validate leaf TLS certificates. + sig { returns(T.nilable(String)) } + attr_reader :trust_root + + sig { params(trust_root: String).void } + attr_writer :trust_root + + # Information about the issuer of leaf TLS certificates and the trusted root CA + # certificate. + sig do + params( + cert_issuer_public_key: String, + cert_issuer_subject: String, + trust_root: String + ).returns(T.attached_class) + end + def self.new( + # The base64-url-safe-encoded raw public key bytes of the issuer. + cert_issuer_public_key: nil, + # The base64-url-safe-encoded raw subject bytes of the issuer. + cert_issuer_subject: nil, + # The root CA certificate(s) that are used to validate leaf TLS certificates. + trust_root: nil + ) + end + + sig do + override.returns( + { + cert_issuer_public_key: String, + cert_issuer_subject: String, + trust_root: String + } + ) + end + def to_hash + end + end + + class Version < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Version, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(Integer)) } + attr_reader :index + + sig { params(index: Integer).void } + attr_writer :index + + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + sig { params(index: Integer).returns(T.attached_class) } + def self.new(index: nil) + end + + sig { override.returns({ index: Integer }) } + def to_hash + end + end + end + + # Current local status of this node. + module LocalNodeState + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Models::SystemInfoResponse::Swarm::LocalNodeState + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + EMPTY = + T.let( + :"", + Docker::Models::SystemInfoResponse::Swarm::LocalNodeState::TaggedSymbol + ) + INACTIVE = + T.let( + :inactive, + Docker::Models::SystemInfoResponse::Swarm::LocalNodeState::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Docker::Models::SystemInfoResponse::Swarm::LocalNodeState::TaggedSymbol + ) + ACTIVE = + T.let( + :active, + Docker::Models::SystemInfoResponse::Swarm::LocalNodeState::TaggedSymbol + ) + ERROR = + T.let( + :error, + Docker::Models::SystemInfoResponse::Swarm::LocalNodeState::TaggedSymbol + ) + LOCKED = + T.let( + :locked, + Docker::Models::SystemInfoResponse::Swarm::LocalNodeState::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Models::SystemInfoResponse::Swarm::LocalNodeState::TaggedSymbol + ] + ) + end + def self.values + end + end + + class RemoteManager < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemInfoResponse::Swarm::RemoteManager, + Docker::Internal::AnyHash + ) + end + + # IP address and ports at which this node can be reached. + sig { returns(T.nilable(String)) } + attr_reader :addr + + sig { params(addr: String).void } + attr_writer :addr + + # Unique identifier of for this node in the swarm. + sig { returns(T.nilable(String)) } + attr_reader :node_id + + sig { params(node_id: String).void } + attr_writer :node_id + + # Represents a peer-node in the swarm + sig do + params(addr: String, node_id: String).returns(T.attached_class) + end + def self.new( + # IP address and ports at which this node can be reached. + addr: nil, + # Unique identifier of for this node in the swarm. + node_id: nil + ) + end + + sig { override.returns({ addr: String, node_id: String }) } + def to_hash + end + end + end + end + end +end diff --git a/rbi/docker/models/system_ping_params.rbi b/rbi/docker/models/system_ping_params.rbi new file mode 100644 index 0000000..253be3b --- /dev/null +++ b/rbi/docker/models/system_ping_params.rbi @@ -0,0 +1,27 @@ +# typed: strong + +module Docker + module Models + class SystemPingParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::SystemPingParams, Docker::Internal::AnyHash) + end + + sig do + params(request_options: Docker::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Docker::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/docker/models/system_ping_response.rbi b/rbi/docker/models/system_ping_response.rbi new file mode 100644 index 0000000..ae80bb7 --- /dev/null +++ b/rbi/docker/models/system_ping_response.rbi @@ -0,0 +1,7 @@ +# typed: strong + +module Docker + module Models + SystemPingResponse = String + end +end diff --git a/rbi/docker/models/system_version_params.rbi b/rbi/docker/models/system_version_params.rbi new file mode 100644 index 0000000..ef2f104 --- /dev/null +++ b/rbi/docker/models/system_version_params.rbi @@ -0,0 +1,27 @@ +# typed: strong + +module Docker + module Models + class SystemVersionParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::SystemVersionParams, Docker::Internal::AnyHash) + end + + sig do + params(request_options: Docker::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Docker::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/docker/models/system_version_response.rbi b/rbi/docker/models/system_version_response.rbi new file mode 100644 index 0000000..4ee876b --- /dev/null +++ b/rbi/docker/models/system_version_response.rbi @@ -0,0 +1,272 @@ +# typed: strong + +module Docker + module Models + class SystemVersionResponse < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemVersionResponse, + Docker::Internal::AnyHash + ) + end + + # The default (and highest) API version that is supported by the daemon + sig { returns(T.nilable(String)) } + attr_reader :api_version + + sig { params(api_version: String).void } + attr_writer :api_version + + # Architecture of the daemon, as returned by the Go runtime (`GOARCH`). + # + # A full list of possible values can be found in the + # [Go documentation](https://go.dev/doc/install/source#environment). + sig { returns(T.nilable(String)) } + attr_reader :arch + + sig { params(arch: String).void } + attr_writer :arch + + # The date and time that the daemon was compiled. + sig { returns(T.nilable(String)) } + attr_reader :build_time + + sig { params(build_time: String).void } + attr_writer :build_time + + # Information about system components + sig do + returns( + T.nilable(T::Array[Docker::Models::SystemVersionResponse::Component]) + ) + end + attr_reader :components + + sig do + params( + components: + T::Array[Docker::Models::SystemVersionResponse::Component::OrHash] + ).void + end + attr_writer :components + + # Indicates if the daemon is started with experimental features enabled. + # + # This field is omitted when empty / false. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :experimental + + sig { params(experimental: T::Boolean).void } + attr_writer :experimental + + # The Git commit of the source code that was used to build the daemon + sig { returns(T.nilable(String)) } + attr_reader :git_commit + + sig { params(git_commit: String).void } + attr_writer :git_commit + + # The version Go used to compile the daemon, and the version of the Go runtime in + # use. + sig { returns(T.nilable(String)) } + attr_reader :go_version + + sig { params(go_version: String).void } + attr_writer :go_version + + # The kernel version (`uname -r`) that the daemon is running on. + # + # This field is omitted when empty. + sig { returns(T.nilable(String)) } + attr_reader :kernel_version + + sig { params(kernel_version: String).void } + attr_writer :kernel_version + + # The minimum API version that is supported by the daemon + sig { returns(T.nilable(String)) } + attr_reader :min_api_version + + sig { params(min_api_version: String).void } + attr_writer :min_api_version + + # The operating system that the daemon is running on ("linux" or "windows") + sig { returns(T.nilable(String)) } + attr_reader :os + + sig { params(os: String).void } + attr_writer :os + + sig do + returns(T.nilable(Docker::Models::SystemVersionResponse::Platform)) + end + attr_reader :platform + + sig do + params( + platform: Docker::Models::SystemVersionResponse::Platform::OrHash + ).void + end + attr_writer :platform + + # The version of the daemon + sig { returns(T.nilable(String)) } + attr_reader :version + + sig { params(version: String).void } + attr_writer :version + + # Response of Engine API: GET "/version" + sig do + params( + api_version: String, + arch: String, + build_time: String, + components: + T::Array[Docker::Models::SystemVersionResponse::Component::OrHash], + experimental: T::Boolean, + git_commit: String, + go_version: String, + kernel_version: String, + min_api_version: String, + os: String, + platform: Docker::Models::SystemVersionResponse::Platform::OrHash, + version: String + ).returns(T.attached_class) + end + def self.new( + # The default (and highest) API version that is supported by the daemon + api_version: nil, + # Architecture of the daemon, as returned by the Go runtime (`GOARCH`). + # + # A full list of possible values can be found in the + # [Go documentation](https://go.dev/doc/install/source#environment). + arch: nil, + # The date and time that the daemon was compiled. + build_time: nil, + # Information about system components + components: nil, + # Indicates if the daemon is started with experimental features enabled. + # + # This field is omitted when empty / false. + experimental: nil, + # The Git commit of the source code that was used to build the daemon + git_commit: nil, + # The version Go used to compile the daemon, and the version of the Go runtime in + # use. + go_version: nil, + # The kernel version (`uname -r`) that the daemon is running on. + # + # This field is omitted when empty. + kernel_version: nil, + # The minimum API version that is supported by the daemon + min_api_version: nil, + # The operating system that the daemon is running on ("linux" or "windows") + os: nil, + platform: nil, + # The version of the daemon + version: nil + ) + end + + sig do + override.returns( + { + api_version: String, + arch: String, + build_time: String, + components: + T::Array[Docker::Models::SystemVersionResponse::Component], + experimental: T::Boolean, + git_commit: String, + go_version: String, + kernel_version: String, + min_api_version: String, + os: String, + platform: Docker::Models::SystemVersionResponse::Platform, + version: String + } + ) + end + def to_hash + end + + class Component < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemVersionResponse::Component, + Docker::Internal::AnyHash + ) + end + + # Name of the component + sig { returns(String) } + attr_accessor :name + + # Version of the component + sig { returns(String) } + attr_accessor :version + + # Key/value pairs of strings with additional information about the component. + # These values are intended for informational purposes only, and their content is + # not defined, and not part of the API specification. + # + # These messages can be printed by the client as information to the user. + sig { returns(T.nilable(T.anything)) } + attr_accessor :details + + sig do + params( + name: String, + version: String, + details: T.nilable(T.anything) + ).returns(T.attached_class) + end + def self.new( + # Name of the component + name:, + # Version of the component + version:, + # Key/value pairs of strings with additional information about the component. + # These values are intended for informational purposes only, and their content is + # not defined, and not part of the API specification. + # + # These messages can be printed by the client as information to the user. + details: nil + ) + end + + sig do + override.returns( + { name: String, version: String, details: T.nilable(T.anything) } + ) + end + def to_hash + end + end + + class Platform < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Models::SystemVersionResponse::Platform, + Docker::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :name + + sig { params(name: String).returns(T.attached_class) } + def self.new(name:) + end + + sig { override.returns({ name: String }) } + def to_hash + end + end + end + end +end diff --git a/rbi/docker/models/volume.rbi b/rbi/docker/models/volume.rbi new file mode 100644 index 0000000..994a0e8 --- /dev/null +++ b/rbi/docker/models/volume.rbi @@ -0,0 +1,1187 @@ +# typed: strong + +module Docker + module Models + class Volume < Docker::Internal::Type::BaseModel + OrHash = T.type_alias { T.any(Docker::Volume, Docker::Internal::AnyHash) } + + # Name of the volume driver used by the volume. + sig { returns(String) } + attr_accessor :driver + + # User-defined key/value metadata. + sig { returns(T::Hash[Symbol, String]) } + attr_accessor :labels + + # Mount path of the volume on the host. + sig { returns(String) } + attr_accessor :mountpoint + + # Name of the volume. + sig { returns(String) } + attr_accessor :name + + # The driver specific options used when creating the volume. + sig { returns(T::Hash[Symbol, String]) } + attr_accessor :options + + # The level at which the volume exists. Either `global` for cluster-wide, or + # `local` for machine level. + sig { returns(Docker::Volume::Scope::TaggedSymbol) } + attr_accessor :scope + + # Options and information specific to, and only present on, Swarm CSI cluster + # volumes. + sig { returns(T.nilable(Docker::Volume::ClusterVolume)) } + attr_reader :cluster_volume + + sig { params(cluster_volume: Docker::Volume::ClusterVolume::OrHash).void } + attr_writer :cluster_volume + + # Date/Time the volume was created. + sig { returns(T.nilable(String)) } + attr_reader :created_at + + sig { params(created_at: String).void } + attr_writer :created_at + + # Low-level details about the volume, provided by the volume driver. Details are + # returned as a map with key/value pairs: `{"key":"value","key2":"value2"}`. + # + # The `Status` field is optional, and is omitted if the volume driver does not + # support this feature. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :status + + sig { params(status: T::Hash[Symbol, T.anything]).void } + attr_writer :status + + # Usage details about the volume. This information is used by the `GET /system/df` + # endpoint, and omitted in other endpoints. + sig { returns(T.nilable(Docker::Volume::UsageData)) } + attr_reader :usage_data + + sig do + params(usage_data: T.nilable(Docker::Volume::UsageData::OrHash)).void + end + attr_writer :usage_data + + sig do + params( + driver: String, + labels: T::Hash[Symbol, String], + mountpoint: String, + name: String, + options: T::Hash[Symbol, String], + scope: Docker::Volume::Scope::OrSymbol, + cluster_volume: Docker::Volume::ClusterVolume::OrHash, + created_at: String, + status: T::Hash[Symbol, T.anything], + usage_data: T.nilable(Docker::Volume::UsageData::OrHash) + ).returns(T.attached_class) + end + def self.new( + # Name of the volume driver used by the volume. + driver:, + # User-defined key/value metadata. + labels:, + # Mount path of the volume on the host. + mountpoint:, + # Name of the volume. + name:, + # The driver specific options used when creating the volume. + options:, + # The level at which the volume exists. Either `global` for cluster-wide, or + # `local` for machine level. + scope:, + # Options and information specific to, and only present on, Swarm CSI cluster + # volumes. + cluster_volume: nil, + # Date/Time the volume was created. + created_at: nil, + # Low-level details about the volume, provided by the volume driver. Details are + # returned as a map with key/value pairs: `{"key":"value","key2":"value2"}`. + # + # The `Status` field is optional, and is omitted if the volume driver does not + # support this feature. + status: nil, + # Usage details about the volume. This information is used by the `GET /system/df` + # endpoint, and omitted in other endpoints. + usage_data: nil + ) + end + + sig do + override.returns( + { + driver: String, + labels: T::Hash[Symbol, String], + mountpoint: String, + name: String, + options: T::Hash[Symbol, String], + scope: Docker::Volume::Scope::TaggedSymbol, + cluster_volume: Docker::Volume::ClusterVolume, + created_at: String, + status: T::Hash[Symbol, T.anything], + usage_data: T.nilable(Docker::Volume::UsageData) + } + ) + end + def to_hash + end + + # The level at which the volume exists. Either `global` for cluster-wide, or + # `local` for machine level. + module Scope + extend Docker::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, Docker::Volume::Scope) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LOCAL = T.let(:local, Docker::Volume::Scope::TaggedSymbol) + GLOBAL = T.let(:global, Docker::Volume::Scope::TaggedSymbol) + + sig { override.returns(T::Array[Docker::Volume::Scope::TaggedSymbol]) } + def self.values + end + end + + class ClusterVolume < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Volume::ClusterVolume, Docker::Internal::AnyHash) + end + + sig { returns(T.nilable(String)) } + attr_reader :created_at + + sig { params(created_at: String).void } + attr_writer :created_at + + # The Swarm ID of this volume. Because cluster volumes are Swarm objects, they + # have an ID, unlike non-cluster volumes. This ID can be used to refer to the + # Volume instead of the name. + sig { returns(T.nilable(String)) } + attr_reader :id + + sig { params(id: String).void } + attr_writer :id + + # Information about the global status of the volume. + sig { returns(T.nilable(Docker::Volume::ClusterVolume::Info)) } + attr_reader :info + + sig { params(info: Docker::Volume::ClusterVolume::Info::OrHash).void } + attr_writer :info + + # The status of the volume as it pertains to its publishing and use on specific + # nodes + sig do + returns( + T.nilable(T::Array[Docker::Volume::ClusterVolume::PublishStatus]) + ) + end + attr_reader :publish_status + + sig do + params( + publish_status: + T::Array[Docker::Volume::ClusterVolume::PublishStatus::OrHash] + ).void + end + attr_writer :publish_status + + # Cluster-specific options used to create the volume. + sig { returns(T.nilable(Docker::Volume::ClusterVolume::Spec)) } + attr_reader :spec + + sig { params(spec: Docker::Volume::ClusterVolume::Spec::OrHash).void } + attr_writer :spec + + sig { returns(T.nilable(String)) } + attr_reader :updated_at + + sig { params(updated_at: String).void } + attr_writer :updated_at + + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + sig { returns(T.nilable(Docker::Volume::ClusterVolume::Version)) } + attr_reader :version + + sig do + params(version: Docker::Volume::ClusterVolume::Version::OrHash).void + end + attr_writer :version + + # Options and information specific to, and only present on, Swarm CSI cluster + # volumes. + sig do + params( + created_at: String, + id: String, + info: Docker::Volume::ClusterVolume::Info::OrHash, + publish_status: + T::Array[Docker::Volume::ClusterVolume::PublishStatus::OrHash], + spec: Docker::Volume::ClusterVolume::Spec::OrHash, + updated_at: String, + version: Docker::Volume::ClusterVolume::Version::OrHash + ).returns(T.attached_class) + end + def self.new( + created_at: nil, + # The Swarm ID of this volume. Because cluster volumes are Swarm objects, they + # have an ID, unlike non-cluster volumes. This ID can be used to refer to the + # Volume instead of the name. + id: nil, + # Information about the global status of the volume. + info: nil, + # The status of the volume as it pertains to its publishing and use on specific + # nodes + publish_status: nil, + # Cluster-specific options used to create the volume. + spec: nil, + updated_at: nil, + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + version: nil + ) + end + + sig do + override.returns( + { + created_at: String, + id: String, + info: Docker::Volume::ClusterVolume::Info, + publish_status: + T::Array[Docker::Volume::ClusterVolume::PublishStatus], + spec: Docker::Volume::ClusterVolume::Spec, + updated_at: String, + version: Docker::Volume::ClusterVolume::Version + } + ) + end + def to_hash + end + + class Info < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Volume::ClusterVolume::Info, + Docker::Internal::AnyHash + ) + end + + # The topology this volume is actually accessible from. + sig { returns(T.nilable(T::Array[T::Hash[Symbol, String]])) } + attr_reader :accessible_topology + + sig do + params(accessible_topology: T::Array[T::Hash[Symbol, String]]).void + end + attr_writer :accessible_topology + + # The capacity of the volume in bytes. A value of 0 indicates that the capacity is + # unknown. + sig { returns(T.nilable(Integer)) } + attr_reader :capacity_bytes + + sig { params(capacity_bytes: Integer).void } + attr_writer :capacity_bytes + + # A map of strings to strings returned from the storage plugin when the volume is + # created. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :volume_context + + sig { params(volume_context: T::Hash[Symbol, String]).void } + attr_writer :volume_context + + # The ID of the volume as returned by the CSI storage plugin. This is distinct + # from the volume's ID as provided by Docker. This ID is never used by the user + # when communicating with Docker to refer to this volume. If the ID is blank, then + # the Volume has not been successfully created in the plugin yet. + sig { returns(T.nilable(String)) } + attr_reader :volume_id + + sig { params(volume_id: String).void } + attr_writer :volume_id + + # Information about the global status of the volume. + sig do + params( + accessible_topology: T::Array[T::Hash[Symbol, String]], + capacity_bytes: Integer, + volume_context: T::Hash[Symbol, String], + volume_id: String + ).returns(T.attached_class) + end + def self.new( + # The topology this volume is actually accessible from. + accessible_topology: nil, + # The capacity of the volume in bytes. A value of 0 indicates that the capacity is + # unknown. + capacity_bytes: nil, + # A map of strings to strings returned from the storage plugin when the volume is + # created. + volume_context: nil, + # The ID of the volume as returned by the CSI storage plugin. This is distinct + # from the volume's ID as provided by Docker. This ID is never used by the user + # when communicating with Docker to refer to this volume. If the ID is blank, then + # the Volume has not been successfully created in the plugin yet. + volume_id: nil + ) + end + + sig do + override.returns( + { + accessible_topology: T::Array[T::Hash[Symbol, String]], + capacity_bytes: Integer, + volume_context: T::Hash[Symbol, String], + volume_id: String + } + ) + end + def to_hash + end + end + + class PublishStatus < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Volume::ClusterVolume::PublishStatus, + Docker::Internal::AnyHash + ) + end + + # The ID of the Swarm node the volume is published on. + sig { returns(T.nilable(String)) } + attr_reader :node_id + + sig { params(node_id: String).void } + attr_writer :node_id + + # A map of strings to strings returned by the CSI controller plugin when a volume + # is published. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :publish_context + + sig { params(publish_context: T::Hash[Symbol, String]).void } + attr_writer :publish_context + + # The published state of the volume. + # + # - `pending-publish` The volume should be published to this node, but the call to + # the controller plugin to do so has not yet been successfully completed. + # - `published` The volume is published successfully to the node. + # - `pending-node-unpublish` The volume should be unpublished from the node, and + # the manager is awaiting confirmation from the worker that it has done so. + # - `pending-controller-unpublish` The volume is successfully unpublished from the + # node, but has not yet been successfully unpublished on the controller. + sig do + returns( + T.nilable( + Docker::Volume::ClusterVolume::PublishStatus::State::TaggedSymbol + ) + ) + end + attr_reader :state + + sig do + params( + state: + Docker::Volume::ClusterVolume::PublishStatus::State::OrSymbol + ).void + end + attr_writer :state + + sig do + params( + node_id: String, + publish_context: T::Hash[Symbol, String], + state: + Docker::Volume::ClusterVolume::PublishStatus::State::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # The ID of the Swarm node the volume is published on. + node_id: nil, + # A map of strings to strings returned by the CSI controller plugin when a volume + # is published. + publish_context: nil, + # The published state of the volume. + # + # - `pending-publish` The volume should be published to this node, but the call to + # the controller plugin to do so has not yet been successfully completed. + # - `published` The volume is published successfully to the node. + # - `pending-node-unpublish` The volume should be unpublished from the node, and + # the manager is awaiting confirmation from the worker that it has done so. + # - `pending-controller-unpublish` The volume is successfully unpublished from the + # node, but has not yet been successfully unpublished on the controller. + state: nil + ) + end + + sig do + override.returns( + { + node_id: String, + publish_context: T::Hash[Symbol, String], + state: + Docker::Volume::ClusterVolume::PublishStatus::State::TaggedSymbol + } + ) + end + def to_hash + end + + # The published state of the volume. + # + # - `pending-publish` The volume should be published to this node, but the call to + # the controller plugin to do so has not yet been successfully completed. + # - `published` The volume is published successfully to the node. + # - `pending-node-unpublish` The volume should be unpublished from the node, and + # the manager is awaiting confirmation from the worker that it has done so. + # - `pending-controller-unpublish` The volume is successfully unpublished from the + # node, but has not yet been successfully unpublished on the controller. + module State + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Volume::ClusterVolume::PublishStatus::State + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PENDING_PUBLISH = + T.let( + :"pending-publish", + Docker::Volume::ClusterVolume::PublishStatus::State::TaggedSymbol + ) + PUBLISHED = + T.let( + :published, + Docker::Volume::ClusterVolume::PublishStatus::State::TaggedSymbol + ) + PENDING_NODE_UNPUBLISH = + T.let( + :"pending-node-unpublish", + Docker::Volume::ClusterVolume::PublishStatus::State::TaggedSymbol + ) + PENDING_CONTROLLER_UNPUBLISH = + T.let( + :"pending-controller-unpublish", + Docker::Volume::ClusterVolume::PublishStatus::State::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Volume::ClusterVolume::PublishStatus::State::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Spec < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Volume::ClusterVolume::Spec, + Docker::Internal::AnyHash + ) + end + + # Defines how the volume is used by tasks. + sig do + returns(T.nilable(Docker::Volume::ClusterVolume::Spec::AccessMode)) + end + attr_reader :access_mode + + sig do + params( + access_mode: + Docker::Volume::ClusterVolume::Spec::AccessMode::OrHash + ).void + end + attr_writer :access_mode + + # Group defines the volume group of this volume. Volumes belonging to the same + # group can be referred to by group name when creating Services. Referring to a + # volume by group instructs Swarm to treat volumes in that group interchangeably + # for the purpose of scheduling. Volumes with an empty string for a group + # technically all belong to the same, emptystring group. + sig { returns(T.nilable(String)) } + attr_reader :group + + sig { params(group: String).void } + attr_writer :group + + # Cluster-specific options used to create the volume. + sig do + params( + access_mode: + Docker::Volume::ClusterVolume::Spec::AccessMode::OrHash, + group: String + ).returns(T.attached_class) + end + def self.new( + # Defines how the volume is used by tasks. + access_mode: nil, + # Group defines the volume group of this volume. Volumes belonging to the same + # group can be referred to by group name when creating Services. Referring to a + # volume by group instructs Swarm to treat volumes in that group interchangeably + # for the purpose of scheduling. Volumes with an empty string for a group + # technically all belong to the same, emptystring group. + group: nil + ) + end + + sig do + override.returns( + { + access_mode: Docker::Volume::ClusterVolume::Spec::AccessMode, + group: String + } + ) + end + def to_hash + end + + class AccessMode < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Volume::ClusterVolume::Spec::AccessMode, + Docker::Internal::AnyHash + ) + end + + # Requirements for the accessible topology of the volume. These fields are + # optional. For an in-depth description of what these fields mean, see the CSI + # specification. + sig do + returns( + T.nilable( + Docker::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements + ) + ) + end + attr_reader :accessibility_requirements + + sig do + params( + accessibility_requirements: + Docker::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements::OrHash + ).void + end + attr_writer :accessibility_requirements + + # The availability of the volume for use in tasks. + # + # - `active` The volume is fully available for scheduling on the cluster + # - `pause` No new workloads should use the volume, but existing workloads are not + # stopped. + # - `drain` All workloads using this volume should be stopped and rescheduled, and + # no new ones should be started. + sig do + returns( + T.nilable( + Docker::Volume::ClusterVolume::Spec::AccessMode::Availability::TaggedSymbol + ) + ) + end + attr_reader :availability + + sig do + params( + availability: + Docker::Volume::ClusterVolume::Spec::AccessMode::Availability::OrSymbol + ).void + end + attr_writer :availability + + # The desired capacity that the volume should be created with. If empty, the + # plugin will decide the capacity. + sig do + returns( + T.nilable( + Docker::Volume::ClusterVolume::Spec::AccessMode::CapacityRange + ) + ) + end + attr_reader :capacity_range + + sig do + params( + capacity_range: + Docker::Volume::ClusterVolume::Spec::AccessMode::CapacityRange::OrHash + ).void + end + attr_writer :capacity_range + + # Options for using this volume as a Mount-type volume. + # + # Either MountVolume or BlockVolume, but not both, must be + # present. + # + # properties: FsType: type: "string" description: | Specifies the filesystem type + # for the mount volume. Optional. MountFlags: type: "array" description: | Flags + # to pass when mounting the volume. Optional. items: type: "string" BlockVolume: + # type: "object" description: | Options for using this volume as a Block-type + # volume. Intentionally empty. + sig { returns(T.nilable(T.anything)) } + attr_reader :mount_volume + + sig { params(mount_volume: T.anything).void } + attr_writer :mount_volume + + # The set of nodes this volume can be used on at one time. + # + # - `single` The volume may only be scheduled to one node at a time. + # - `multi` the volume may be scheduled to any supported number of nodes at a + # time. + sig do + returns( + T.nilable( + Docker::Volume::ClusterVolume::Spec::AccessMode::Scope::TaggedSymbol + ) + ) + end + attr_reader :scope + + sig do + params( + scope: + Docker::Volume::ClusterVolume::Spec::AccessMode::Scope::OrSymbol + ).void + end + attr_writer :scope + + # Swarm Secrets that are passed to the CSI storage plugin when operating on this + # volume. + sig do + returns( + T.nilable( + T::Array[ + Docker::Volume::ClusterVolume::Spec::AccessMode::Secret + ] + ) + ) + end + attr_reader :secrets + + sig do + params( + secrets: + T::Array[ + Docker::Volume::ClusterVolume::Spec::AccessMode::Secret::OrHash + ] + ).void + end + attr_writer :secrets + + # The number and way that different tasks can use this volume at one time. + # + # - `none` The volume may only be used by one task at a time. + # - `readonly` The volume may be used by any number of tasks, but they all must + # mount the volume as readonly + # - `onewriter` The volume may be used by any number of tasks, but only one may + # mount it as read/write. + # - `all` The volume may have any number of readers and writers. + sig do + returns( + T.nilable( + Docker::Volume::ClusterVolume::Spec::AccessMode::Sharing::TaggedSymbol + ) + ) + end + attr_reader :sharing + + sig do + params( + sharing: + Docker::Volume::ClusterVolume::Spec::AccessMode::Sharing::OrSymbol + ).void + end + attr_writer :sharing + + # Defines how the volume is used by tasks. + sig do + params( + accessibility_requirements: + Docker::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements::OrHash, + availability: + Docker::Volume::ClusterVolume::Spec::AccessMode::Availability::OrSymbol, + capacity_range: + Docker::Volume::ClusterVolume::Spec::AccessMode::CapacityRange::OrHash, + mount_volume: T.anything, + scope: + Docker::Volume::ClusterVolume::Spec::AccessMode::Scope::OrSymbol, + secrets: + T::Array[ + Docker::Volume::ClusterVolume::Spec::AccessMode::Secret::OrHash + ], + sharing: + Docker::Volume::ClusterVolume::Spec::AccessMode::Sharing::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Requirements for the accessible topology of the volume. These fields are + # optional. For an in-depth description of what these fields mean, see the CSI + # specification. + accessibility_requirements: nil, + # The availability of the volume for use in tasks. + # + # - `active` The volume is fully available for scheduling on the cluster + # - `pause` No new workloads should use the volume, but existing workloads are not + # stopped. + # - `drain` All workloads using this volume should be stopped and rescheduled, and + # no new ones should be started. + availability: nil, + # The desired capacity that the volume should be created with. If empty, the + # plugin will decide the capacity. + capacity_range: nil, + # Options for using this volume as a Mount-type volume. + # + # Either MountVolume or BlockVolume, but not both, must be + # present. + # + # properties: FsType: type: "string" description: | Specifies the filesystem type + # for the mount volume. Optional. MountFlags: type: "array" description: | Flags + # to pass when mounting the volume. Optional. items: type: "string" BlockVolume: + # type: "object" description: | Options for using this volume as a Block-type + # volume. Intentionally empty. + mount_volume: nil, + # The set of nodes this volume can be used on at one time. + # + # - `single` The volume may only be scheduled to one node at a time. + # - `multi` the volume may be scheduled to any supported number of nodes at a + # time. + scope: nil, + # Swarm Secrets that are passed to the CSI storage plugin when operating on this + # volume. + secrets: nil, + # The number and way that different tasks can use this volume at one time. + # + # - `none` The volume may only be used by one task at a time. + # - `readonly` The volume may be used by any number of tasks, but they all must + # mount the volume as readonly + # - `onewriter` The volume may be used by any number of tasks, but only one may + # mount it as read/write. + # - `all` The volume may have any number of readers and writers. + sharing: nil + ) + end + + sig do + override.returns( + { + accessibility_requirements: + Docker::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements, + availability: + Docker::Volume::ClusterVolume::Spec::AccessMode::Availability::TaggedSymbol, + capacity_range: + Docker::Volume::ClusterVolume::Spec::AccessMode::CapacityRange, + mount_volume: T.anything, + scope: + Docker::Volume::ClusterVolume::Spec::AccessMode::Scope::TaggedSymbol, + secrets: + T::Array[ + Docker::Volume::ClusterVolume::Spec::AccessMode::Secret + ], + sharing: + Docker::Volume::ClusterVolume::Spec::AccessMode::Sharing::TaggedSymbol + } + ) + end + def to_hash + end + + class AccessibilityRequirements < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements, + Docker::Internal::AnyHash + ) + end + + # A list of topologies that the volume should attempt to be provisioned in. + sig { returns(T.nilable(T::Array[T::Hash[Symbol, String]])) } + attr_reader :preferred + + sig { params(preferred: T::Array[T::Hash[Symbol, String]]).void } + attr_writer :preferred + + # A list of required topologies, at least one of which the volume must be + # accessible from. + sig { returns(T.nilable(T::Array[T::Hash[Symbol, String]])) } + attr_reader :requisite + + sig { params(requisite: T::Array[T::Hash[Symbol, String]]).void } + attr_writer :requisite + + # Requirements for the accessible topology of the volume. These fields are + # optional. For an in-depth description of what these fields mean, see the CSI + # specification. + sig do + params( + preferred: T::Array[T::Hash[Symbol, String]], + requisite: T::Array[T::Hash[Symbol, String]] + ).returns(T.attached_class) + end + def self.new( + # A list of topologies that the volume should attempt to be provisioned in. + preferred: nil, + # A list of required topologies, at least one of which the volume must be + # accessible from. + requisite: nil + ) + end + + sig do + override.returns( + { + preferred: T::Array[T::Hash[Symbol, String]], + requisite: T::Array[T::Hash[Symbol, String]] + } + ) + end + def to_hash + end + end + + # The availability of the volume for use in tasks. + # + # - `active` The volume is fully available for scheduling on the cluster + # - `pause` No new workloads should use the volume, but existing workloads are not + # stopped. + # - `drain` All workloads using this volume should be stopped and rescheduled, and + # no new ones should be started. + module Availability + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Volume::ClusterVolume::Spec::AccessMode::Availability + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + ACTIVE = + T.let( + :active, + Docker::Volume::ClusterVolume::Spec::AccessMode::Availability::TaggedSymbol + ) + PAUSE = + T.let( + :pause, + Docker::Volume::ClusterVolume::Spec::AccessMode::Availability::TaggedSymbol + ) + DRAIN = + T.let( + :drain, + Docker::Volume::ClusterVolume::Spec::AccessMode::Availability::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Volume::ClusterVolume::Spec::AccessMode::Availability::TaggedSymbol + ] + ) + end + def self.values + end + end + + class CapacityRange < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Volume::ClusterVolume::Spec::AccessMode::CapacityRange, + Docker::Internal::AnyHash + ) + end + + # The volume must not be bigger than this. The value of 0 indicates an unspecified + # maximum. + sig { returns(T.nilable(Integer)) } + attr_reader :limit_bytes + + sig { params(limit_bytes: Integer).void } + attr_writer :limit_bytes + + # The volume must be at least this big. The value of 0 indicates an unspecified + # minimum + sig { returns(T.nilable(Integer)) } + attr_reader :required_bytes + + sig { params(required_bytes: Integer).void } + attr_writer :required_bytes + + # The desired capacity that the volume should be created with. If empty, the + # plugin will decide the capacity. + sig do + params(limit_bytes: Integer, required_bytes: Integer).returns( + T.attached_class + ) + end + def self.new( + # The volume must not be bigger than this. The value of 0 indicates an unspecified + # maximum. + limit_bytes: nil, + # The volume must be at least this big. The value of 0 indicates an unspecified + # minimum + required_bytes: nil + ) + end + + sig do + override.returns( + { limit_bytes: Integer, required_bytes: Integer } + ) + end + def to_hash + end + end + + # The set of nodes this volume can be used on at one time. + # + # - `single` The volume may only be scheduled to one node at a time. + # - `multi` the volume may be scheduled to any supported number of nodes at a + # time. + module Scope + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Volume::ClusterVolume::Spec::AccessMode::Scope + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SINGLE = + T.let( + :single, + Docker::Volume::ClusterVolume::Spec::AccessMode::Scope::TaggedSymbol + ) + MULTI = + T.let( + :multi, + Docker::Volume::ClusterVolume::Spec::AccessMode::Scope::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Volume::ClusterVolume::Spec::AccessMode::Scope::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Secret < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Volume::ClusterVolume::Spec::AccessMode::Secret, + Docker::Internal::AnyHash + ) + end + + # Key is the name of the key of the key-value pair passed to the plugin. + sig { returns(T.nilable(String)) } + attr_reader :key + + sig { params(key: String).void } + attr_writer :key + + # Secret is the swarm Secret object from which to read data. This can be a Secret + # name or ID. The Secret data is retrieved by swarm and used as the value of the + # key-value pair passed to the plugin. + sig { returns(T.nilable(String)) } + attr_reader :secret + + sig { params(secret: String).void } + attr_writer :secret + + # One cluster volume secret entry. Defines a key-value pair that is passed to the + # plugin. + sig do + params(key: String, secret: String).returns(T.attached_class) + end + def self.new( + # Key is the name of the key of the key-value pair passed to the plugin. + key: nil, + # Secret is the swarm Secret object from which to read data. This can be a Secret + # name or ID. The Secret data is retrieved by swarm and used as the value of the + # key-value pair passed to the plugin. + secret: nil + ) + end + + sig { override.returns({ key: String, secret: String }) } + def to_hash + end + end + + # The number and way that different tasks can use this volume at one time. + # + # - `none` The volume may only be used by one task at a time. + # - `readonly` The volume may be used by any number of tasks, but they all must + # mount the volume as readonly + # - `onewriter` The volume may be used by any number of tasks, but only one may + # mount it as read/write. + # - `all` The volume may have any number of readers and writers. + module Sharing + extend Docker::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Docker::Volume::ClusterVolume::Spec::AccessMode::Sharing + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + NONE = + T.let( + :none, + Docker::Volume::ClusterVolume::Spec::AccessMode::Sharing::TaggedSymbol + ) + READONLY = + T.let( + :readonly, + Docker::Volume::ClusterVolume::Spec::AccessMode::Sharing::TaggedSymbol + ) + ONEWRITER = + T.let( + :onewriter, + Docker::Volume::ClusterVolume::Spec::AccessMode::Sharing::TaggedSymbol + ) + ALL = + T.let( + :all, + Docker::Volume::ClusterVolume::Spec::AccessMode::Sharing::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Docker::Volume::ClusterVolume::Spec::AccessMode::Sharing::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + + class Version < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Docker::Volume::ClusterVolume::Version, + Docker::Internal::AnyHash + ) + end + + sig { returns(T.nilable(Integer)) } + attr_reader :index + + sig { params(index: Integer).void } + attr_writer :index + + # The version number of the object such as node, service, etc. This is needed to + # avoid conflicting writes. The client must send the version number along with the + # modified specification when updating these objects. + # + # This approach ensures safe concurrency and determinism in that the change on the + # object may not be applied if the version number has changed from the last read. + # In other words, if two update requests specify the same base version, only one + # of the requests can succeed. As a result, two separate update requests that + # happen at the same time will not unintentionally overwrite each other. + sig { params(index: Integer).returns(T.attached_class) } + def self.new(index: nil) + end + + sig { override.returns({ index: Integer }) } + def to_hash + end + end + end + + class UsageData < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Volume::UsageData, Docker::Internal::AnyHash) + end + + # The number of containers referencing this volume. This field is set to `-1` if + # the reference-count is not available. + sig { returns(Integer) } + attr_accessor :ref_count + + # Amount of disk space used by the volume (in bytes). This information is only + # available for volumes created with the `"local"` volume driver. For volumes + # created with other volume drivers, this field is set to `-1` ("not available") + sig { returns(Integer) } + attr_accessor :size + + # Usage details about the volume. This information is used by the `GET /system/df` + # endpoint, and omitted in other endpoints. + sig do + params(ref_count: Integer, size: Integer).returns(T.attached_class) + end + def self.new( + # The number of containers referencing this volume. This field is set to `-1` if + # the reference-count is not available. + ref_count:, + # Amount of disk space used by the volume (in bytes). This information is only + # available for volumes created with the `"local"` volume driver. For volumes + # created with other volume drivers, this field is set to `-1` ("not available") + size: + ) + end + + sig { override.returns({ ref_count: Integer, size: Integer }) } + def to_hash + end + end + end + end +end diff --git a/rbi/docker/models/volume_create_params.rbi b/rbi/docker/models/volume_create_params.rbi new file mode 100644 index 0000000..a5912a4 --- /dev/null +++ b/rbi/docker/models/volume_create_params.rbi @@ -0,0 +1,27 @@ +# typed: strong + +module Docker + module Models + class VolumeCreateParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::VolumeCreateParams, Docker::Internal::AnyHash) + end + + sig do + params(request_options: Docker::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Docker::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/docker/models/volume_delete_params.rbi b/rbi/docker/models/volume_delete_params.rbi new file mode 100644 index 0000000..d14dede --- /dev/null +++ b/rbi/docker/models/volume_delete_params.rbi @@ -0,0 +1,43 @@ +# typed: strong + +module Docker + module Models + class VolumeDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::VolumeDeleteParams, Docker::Internal::AnyHash) + end + + # Force the removal of the volume + sig { returns(T.nilable(T::Boolean)) } + attr_reader :force + + sig { params(force: T::Boolean).void } + attr_writer :force + + sig do + params( + force: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Force the removal of the volume + force: nil, + request_options: {} + ) + end + + sig do + override.returns( + { force: T::Boolean, request_options: Docker::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/volume_inspect_params.rbi b/rbi/docker/models/volume_inspect_params.rbi new file mode 100644 index 0000000..c2cbfec --- /dev/null +++ b/rbi/docker/models/volume_inspect_params.rbi @@ -0,0 +1,27 @@ +# typed: strong + +module Docker + module Models + class VolumeInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::VolumeInspectParams, Docker::Internal::AnyHash) + end + + sig do + params(request_options: Docker::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Docker::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/docker/models/volume_list_params.rbi b/rbi/docker/models/volume_list_params.rbi new file mode 100644 index 0000000..b055abb --- /dev/null +++ b/rbi/docker/models/volume_list_params.rbi @@ -0,0 +1,61 @@ +# typed: strong + +module Docker + module Models + class VolumeListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Docker::VolumeListParams, Docker::Internal::AnyHash) + end + + # JSON encoded value of the filters (a `map[string][]string`) to process on the + # volumes list. Available filters: + # + # - `dangling=` When set to `true` (or `1`), returns all volumes that are + # not in use by a container. When set to `false` (or `0`), only volumes that are + # in use by one or more containers are returned. + # - `driver=` Matches volumes based on their driver. + # - `label=` or `label=:` Matches volumes based on the presence + # of a `label` alone or a `label` and a value. + # - `name=` Matches all or part of a volume name. + sig { returns(T.nilable(String)) } + attr_reader :filters + + sig { params(filters: String).void } + attr_writer :filters + + sig do + params( + filters: String, + request_options: Docker::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # JSON encoded value of the filters (a `map[string][]string`) to process on the + # volumes list. Available filters: + # + # - `dangling=` When set to `true` (or `1`), returns all volumes that are + # not in use by a container. When set to `false` (or `0`), only volumes that are + # in use by one or more containers are returned. + # - `driver=` Matches volumes based on their driver. + # - `label=` or `label=:` Matches volumes based on the presence + # of a `label` alone or a `label` and a value. + # - `name=` Matches all or part of a volume name. + filters: nil, + request_options: {} + ) + end + + sig do + override.returns( + { filters: String, request_options: Docker::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/models/volume_list_response.rbi b/rbi/docker/models/volume_list_response.rbi new file mode 100644 index 0000000..28be330 --- /dev/null +++ b/rbi/docker/models/volume_list_response.rbi @@ -0,0 +1,49 @@ +# typed: strong + +module Docker + module Models + class VolumeListResponse < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Docker::Models::VolumeListResponse, Docker::Internal::AnyHash) + end + + # List of volumes + sig { returns(T.nilable(T::Array[Docker::Volume])) } + attr_reader :volumes + + sig { params(volumes: T::Array[Docker::Volume::OrHash]).void } + attr_writer :volumes + + # Warnings that occurred when fetching the list of volumes. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :warnings + + sig { params(warnings: T::Array[String]).void } + attr_writer :warnings + + # Volume list response + sig do + params( + volumes: T::Array[Docker::Volume::OrHash], + warnings: T::Array[String] + ).returns(T.attached_class) + end + def self.new( + # List of volumes + volumes: nil, + # Warnings that occurred when fetching the list of volumes. + warnings: nil + ) + end + + sig do + override.returns( + { volumes: T::Array[Docker::Volume], warnings: T::Array[String] } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/docker/request_options.rbi b/rbi/docker/request_options.rbi new file mode 100644 index 0000000..4517a5a --- /dev/null +++ b/rbi/docker/request_options.rbi @@ -0,0 +1,55 @@ +# typed: strong + +module Docker + # Specify HTTP behaviour to use for a specific request. These options supplement + # or override those provided at the client level. + # + # When making a request, you can pass an actual {RequestOptions} instance, or + # simply pass a Hash with symbol keys matching the attributes on this class. + class RequestOptions < Docker::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(Docker::RequestOptions, Docker::Internal::AnyHash) } + + # @api private + sig { params(opts: Docker::RequestOptions::OrHash).void } + def self.validate!(opts) + end + + # Idempotency key to send with request and all associated retries. Will only be + # sent for write requests. + sig { returns(T.nilable(String)) } + attr_accessor :idempotency_key + + # Extra query params to send with the request. These are `.merge`’d into any + # `query` given at the client level. + sig do + returns( + T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))]) + ) + end + attr_accessor :extra_query + + # Extra headers to send with the request. These are `.merged`’d into any + # `extra_headers` given at the client level. + sig { returns(T.nilable(T::Hash[String, T.nilable(String)])) } + attr_accessor :extra_headers + + # Extra data to send with the request. These are deep merged into any data + # generated as part of the normal request. + sig { returns(T.nilable(T.anything)) } + attr_accessor :extra_body + + # Maximum number of retries to attempt after a failed initial request. + sig { returns(T.nilable(Integer)) } + attr_accessor :max_retries + + # Request timeout in seconds. + sig { returns(T.nilable(Float)) } + attr_accessor :timeout + + # Returns a new instance of RequestOptions. + sig { params(values: Docker::Internal::AnyHash).returns(T.attached_class) } + def self.new(values = {}) + end + end +end diff --git a/rbi/docker/resources/auth.rbi b/rbi/docker/resources/auth.rbi new file mode 100644 index 0000000..9bf44cb --- /dev/null +++ b/rbi/docker/resources/auth.rbi @@ -0,0 +1,30 @@ +# typed: strong + +module Docker + module Resources + class Auth + # Validate credentials for a registry and, if available, get an identity token for + # accessing the registry without password. + sig do + params( + password: String, + serveraddress: String, + username: String, + request_options: Docker::RequestOptions::OrHash + ).returns(Docker::AuthResponse) + end + def login( + password: nil, + serveraddress: nil, + username: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: Docker::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/docker/resources/containers.rbi b/rbi/docker/resources/containers.rbi new file mode 100644 index 0000000..bf8bbc3 --- /dev/null +++ b/rbi/docker/resources/containers.rbi @@ -0,0 +1,231 @@ +# typed: strong + +module Docker + module Resources + class Containers + # Create a container + sig do + params( + config: Docker::ContainerCreateParams::Config::OrHash, + name: String, + platform: String, + request_options: Docker::RequestOptions::OrHash + ).returns(Docker::CreateResponse) + end + def create( + # Body param: Configuration for a container that is portable between hosts. + config:, + # Query param: Assign the specified name to the container. Must match + # `/?[a-zA-Z0-9][a-zA-Z0-9_.-]+`. + name: nil, + # Query param: Platform in the format `os[/arch[/variant]]` used for image lookup. + # + # When specified, the daemon checks if the requested image is present in the local + # image cache with the given OS and Architecture, and otherwise returns a `404` + # status. + # + # If the option is not set, the host's native OS and Architecture are used to look + # up the image in the image cache. However, if no platform is passed and the given + # image does exist in the local image cache, but its OS or architecture does not + # match, the container is created with the available image, and a warning is added + # to the `Warnings` field in the response, for example; + # + # WARNING: The requested image's platform (linux/arm64/v8) does not + # match the detected host platform (linux/amd64) and no + # specific platform was requested + platform: nil, + request_options: {} + ) + end + + # Returns a list of containers. For details on the format, see the + # [inspect endpoint](#operation/ContainerInspect). + # + # Note that it uses a different, smaller representation of a container than + # inspecting a single container. For example, the list of linked containers is not + # propagated . + sig do + params( + all: T::Boolean, + filters: String, + limit: Integer, + size: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(T::Array[Docker::Summary]) + end + def list( + # Return all containers. By default, only running containers are shown. + all: nil, + # Filters to process on the container list, encoded as JSON (a + # `map[string][]string`). For example, `{"status": ["paused"]}` will only return + # paused containers. + # + # Available filters: + # + # - `ancestor`=(`[:]`, ``, or ``) + # - `before`=(`` or ``) + # - `expose`=(`[/]`|`/[]`) + # - `exited=` containers with exit code of `` + # - `health`=(`starting`|`healthy`|`unhealthy`|`none`) + # - `id=` a container's ID + # - `isolation=`(`default`|`process`|`hyperv`) (Windows daemon only) + # - `is-task=`(`true`|`false`) + # - `label=key` or `label="key=value"` of a container label + # - `name=` a container's name + # - `network`=(`` or ``) + # - `publish`=(`[/]`|`/[]`) + # - `since`=(`` or ``) + # - `status=`(`created`|`restarting`|`running`|`removing`|`paused`|`exited`|`dead`) + # - `volume`=(`` or ``) + filters: nil, + # Return this number of most recently created containers, including non-running + # ones. + limit: nil, + # Return the size of container as fields `SizeRw` and `SizeRootFs`. + size: nil, + request_options: {} + ) + end + + # Remove a container + sig do + params( + id: String, + force: T::Boolean, + link: T::Boolean, + v: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).void + end + def delete( + # ID or name of the container + id, + # If the container is running, kill it before removing it. + force: nil, + # Remove the specified link associated with the container. + link: nil, + # Remove anonymous volumes associated with the container. + v: nil, + request_options: {} + ) + end + + # Return low-level information about a container. + sig do + params( + id: String, + size: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(Docker::Container) + end + def inspect_( + # ID or name of the container + id, + # Return the size of container as fields `SizeRw` and `SizeRootFs` + size: nil, + request_options: {} + ) + end + + # Send a POSIX signal to a container, defaulting to killing to the container. + sig do + params( + id: String, + signal: String, + request_options: Docker::RequestOptions::OrHash + ).void + end + def kill( + # ID or name of the container + id, + # Signal to send to the container as an integer or string (e.g. `SIGINT`). + signal: nil, + request_options: {} + ) + end + + # Get `stdout` and `stderr` logs from a container. + # + # Note: This endpoint works only for containers with the `json-file` or `journald` + # logging driver. + sig do + params( + id: String, + follow: T::Boolean, + since: Integer, + stderr: T::Boolean, + stdout: T::Boolean, + tail: String, + timestamps: T::Boolean, + until_: Integer, + request_options: Docker::RequestOptions::OrHash + ).returns(StringIO) + end + def logs( + # ID or name of the container + id, + # Keep connection after returning logs. + follow: nil, + # Only return logs since this time, as a UNIX timestamp + since: nil, + # Return logs from `stderr` + stderr: nil, + # Return logs from `stdout` + stdout: nil, + # Only return this number of log lines from the end of the logs. Specify as an + # integer or `all` to output all log lines. + tail: nil, + # Add timestamps to every log line + timestamps: nil, + # Only return logs before this time, as a UNIX timestamp + until_: nil, + request_options: {} + ) + end + + # Start a container + sig do + params( + id: String, + detach_keys: String, + request_options: Docker::RequestOptions::OrHash + ).void + end + def start( + # ID or name of the container + id, + # Override the key sequence for detaching a container. Format is a single + # character `[a-Z]` or `ctrl-` where `` is one of: `a-z`, `@`, `^`, + # `[`, `,` or `_`. + detach_keys: nil, + request_options: {} + ) + end + + # Stop a container + sig do + params( + id: String, + signal: String, + t: Integer, + request_options: Docker::RequestOptions::OrHash + ).void + end + def stop( + # ID or name of the container + id, + # Signal to send to the container as an integer or string (e.g. `SIGINT`). + signal: nil, + # Number of seconds to wait before killing the container + t: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: Docker::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/docker/resources/images.rbi b/rbi/docker/resources/images.rbi new file mode 100644 index 0000000..a87f036 --- /dev/null +++ b/rbi/docker/resources/images.rbi @@ -0,0 +1,164 @@ +# typed: strong + +module Docker + module Resources + class Images + # Returns a list of images on the server. Note that it uses a different, smaller + # representation of an image than inspecting a single image. + sig do + params( + all: T::Boolean, + digests: T::Boolean, + filters: String, + manifests: T::Boolean, + shared_size: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(T::Array[Docker::Summary]) + end + def list( + # Show all images. Only images from a final layer (no children) are shown by + # default. + all: nil, + # Show digest information as a `RepoDigests` field on each image. + digests: nil, + # A JSON encoded value of the filters (a `map[string][]string`) to process on the + # images list. + # + # Available filters: + # + # - `before`=(`[:]`, `` or ``) + # - `dangling=true` + # - `label=key` or `label="key=value"` of an image label + # - `reference`=(`[:]`) + # - `since`=(`[:]`, `` or ``) + # - `until=` + filters: nil, + # Include `Manifests` in the image summary. + manifests: nil, + # Compute and show shared size as a `SharedSize` field on each image. + shared_size: nil, + request_options: {} + ) + end + + # Remove an image, along with any untagged parent images that were referenced by + # that image. + # + # Images can't be removed if they have descendant images, are being used by a + # running container or are being used by a build. + sig do + params( + name: String, + force: T::Boolean, + noprune: T::Boolean, + platforms: T::Array[String], + request_options: Docker::RequestOptions::OrHash + ).returns(T::Array[Docker::Models::ImageDeleteResponseItem]) + end + def delete( + # Image name or ID + name, + # Remove the image even if it is being used by stopped containers or has other + # tags + force: nil, + # Do not delete untagged parent images + noprune: nil, + # Select platform-specific content to delete. Multiple values are accepted. Each + # platform is a OCI platform encoded as a JSON string. + platforms: nil, + request_options: {} + ) + end + + # Return low-level information about an image. + sig do + params( + name: String, + manifests: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(Docker::Image) + end + def inspect_( + # Image name or id + name, + # Include Manifests in the image summary. + manifests: nil, + request_options: {} + ) + end + + # Pull or import an image. + sig do + params( + changes: T::Array[String], + from_image: String, + from_src: String, + message: String, + platform: String, + repo: String, + tag: String, + body: String, + x_registry_auth: String, + request_options: Docker::RequestOptions::OrHash + ).void + end + def pull( + # Query param: Apply `Dockerfile` instructions to the image that is created, for + # example: `changes=ENV DEBUG=true`. Note that `ENV DEBUG=true` should be URI + # component encoded. + # + # Supported `Dockerfile` instructions: + # `CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR` + changes: nil, + # Query param: Name of the image to pull. If the name includes a tag or digest, + # specific behavior applies: + # + # - If only `fromImage` includes a tag, that tag is used. + # - If both `fromImage` and `tag` are provided, `tag` takes precedence. + # - If `fromImage` includes a digest, the image is pulled by digest, and `tag` is + # ignored. + # - If neither a tag nor digest is specified, all tags are pulled. + from_image: nil, + # Query param: Source to import. The value may be a URL from which the image can + # be retrieved or `-` to read the image from the request body. This parameter may + # only be used when importing an image. + from_src: nil, + # Query param: Set commit message for imported image. + message: nil, + # Query param: Platform in the format os[/arch[/variant]]. + # + # When used in combination with the `fromImage` option, the daemon checks if the + # given image is present in the local image cache with the given OS and + # Architecture, and otherwise attempts to pull the image. If the option is not + # set, the host's native OS and Architecture are used. If the given image does not + # exist in the local image cache, the daemon attempts to pull the image with the + # host's native OS and Architecture. If the given image does exists in the local + # image cache, but its OS or architecture does not match, a warning is produced. + # + # When used with the `fromSrc` option to import an image from an archive, this + # option sets the platform information for the imported image. If the option is + # not set, the host's native OS and Architecture are used for the imported image. + platform: nil, + # Query param: Repository name given to an image when it is imported. The repo may + # include a tag. This parameter may only be used when importing an image. + repo: nil, + # Query param: Tag or digest. If empty when pulling an image, this causes all tags + # for the given image to be pulled. + tag: nil, + # Body param + body: nil, + # Header param: A base64url-encoded auth configuration. + # + # Refer to the [authentication section](#section/Authentication) for details. + x_registry_auth: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: Docker::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/docker/resources/networks.rbi b/rbi/docker/resources/networks.rbi new file mode 100644 index 0000000..02ea192 --- /dev/null +++ b/rbi/docker/resources/networks.rbi @@ -0,0 +1,130 @@ +# typed: strong + +module Docker + module Resources + class Networks + # Create a network + sig do + params( + name: String, + attachable: T::Boolean, + config_from: Docker::NetworkCreateParams::ConfigFrom::OrHash, + config_only: T::Boolean, + driver: String, + enable_i_pv4: T::Boolean, + enable_i_pv6: T::Boolean, + ingress: T::Boolean, + internal: T::Boolean, + ipam: Docker::NetworkCreateParams::Ipam::OrHash, + labels: T::Hash[Symbol, String], + options: T::Hash[Symbol, String], + scope: String, + request_options: Docker::RequestOptions::OrHash + ).returns(Docker::Models::NetworkCreateResponse) + end + def create( + # The network's name. + name:, + # Globally scoped network is manually attachable by regular containers from + # workers in swarm mode. + attachable: nil, + # The config-only network source to provide the configuration for this network. + config_from: nil, + # Creates a config-only network. Config-only networks are placeholder networks for + # network configurations to be used by other networks. Config-only networks cannot + # be used directly to run containers or services. + config_only: nil, + # Name of the network driver plugin to use. + driver: nil, + # Enable IPv4 on the network. + enable_i_pv4: nil, + # Enable IPv6 on the network. + enable_i_pv6: nil, + # Ingress network is the network which provides the routing-mesh in swarm mode. + ingress: nil, + # Restrict external access to the network. + internal: nil, + ipam: nil, + # User-defined key/value metadata. + labels: nil, + # Network specific options to be used by the drivers. + options: nil, + # The level at which the network exists (e.g. `swarm` for cluster-wide or `local` + # for machine level). + scope: nil, + request_options: {} + ) + end + + # Returns a list of networks. For details on the format, see the + # [network inspect endpoint](#operation/NetworkInspect). + # + # Note that it uses a different, smaller representation of a network than + # inspecting a single network. For example, the list of containers attached to the + # network is not propagated in API versions 1.28 and up. + sig do + params( + filters: String, + request_options: Docker::RequestOptions::OrHash + ).returns(T::Array[Docker::Summary]) + end + def list( + # JSON encoded value of the filters (a `map[string][]string`) to process on the + # networks list. + # + # Available filters: + # + # - `dangling=` When set to `true` (or `1`), returns all networks that + # are not in use by a container. When set to `false` (or `0`), only networks + # that are in use by one or more containers are returned. + # - `driver=` Matches a network's driver. + # - `id=` Matches all or part of a network ID. + # - `label=` or `label==` of a network label. + # - `name=` Matches all or part of a network name. + # - `scope=["swarm"|"global"|"local"]` Filters networks by scope (`swarm`, + # `global`, or `local`). + # - `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword + # returns all user-defined networks. + filters: nil, + request_options: {} + ) + end + + # Remove a network + sig do + params(id: String, request_options: Docker::RequestOptions::OrHash).void + end + def delete( + # Network ID or name + id, + request_options: {} + ) + end + + # Inspect a network + sig do + params( + id: String, + scope: String, + verbose: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(Docker::Models::NetworkInspectResponse) + end + def inspect_( + # Network ID or name + id, + # Filter the network by scope (swarm, global, or local) + scope: nil, + # Detailed inspect output for troubleshooting + verbose: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: Docker::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/docker/resources/services.rbi b/rbi/docker/resources/services.rbi new file mode 100644 index 0000000..b31b64d --- /dev/null +++ b/rbi/docker/resources/services.rbi @@ -0,0 +1,85 @@ +# typed: strong + +module Docker + module Resources + class Services + # Create a service + sig do + params( + spec: Docker::ServiceCreateParams::Spec::OrHash, + x_registry_auth: String, + request_options: Docker::RequestOptions::OrHash + ).returns(Docker::Models::ServiceCreateResponse) + end + def create( + # Body param: User modifiable configuration for a service. + spec:, + # Header param: A base64url-encoded auth configuration for pulling from private + # registries. + # + # Refer to the [authentication section](#section/Authentication) for details. + x_registry_auth: nil, + request_options: {} + ) + end + + # List services + sig do + params( + filters: String, + status: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(T::Array[Docker::Service]) + end + def list( + # A JSON encoded value of the filters (a `map[string][]string`) to process on the + # services list. + # + # Available filters: + # + # - `id=` + # - `label=` + # - `mode=["replicated"|"global"]` + # - `name=` + filters: nil, + # Include service status, with count of running and desired tasks. + status: nil, + request_options: {} + ) + end + + # Delete a service + sig do + params(id: String, request_options: Docker::RequestOptions::OrHash).void + end + def delete( + # ID or name of service. + id, + request_options: {} + ) + end + + # Inspect a service + sig do + params( + id: String, + insert_defaults: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).returns(Docker::Service) + end + def inspect_( + # ID or name of service. + id, + # Fill empty fields with default values. + insert_defaults: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: Docker::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/docker/resources/system.rbi b/rbi/docker/resources/system.rbi new file mode 100644 index 0000000..1d9472f --- /dev/null +++ b/rbi/docker/resources/system.rbi @@ -0,0 +1,38 @@ +# typed: strong + +module Docker + module Resources + class System + # Get system information + sig do + params(request_options: Docker::RequestOptions::OrHash).returns( + Docker::Models::SystemInfoResponse + ) + end + def info(request_options: {}) + end + + # This is a dummy endpoint you can use to test if the server is accessible. + sig do + params(request_options: Docker::RequestOptions::OrHash).returns(String) + end + def ping(request_options: {}) + end + + # Returns the version of Docker that is running and various information about the + # system that Docker is running on. + sig do + params(request_options: Docker::RequestOptions::OrHash).returns( + Docker::Models::SystemVersionResponse + ) + end + def version(request_options: {}) + end + + # @api private + sig { params(client: Docker::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/docker/resources/volumes.rbi b/rbi/docker/resources/volumes.rbi new file mode 100644 index 0000000..f048fdd --- /dev/null +++ b/rbi/docker/resources/volumes.rbi @@ -0,0 +1,80 @@ +# typed: strong + +module Docker + module Resources + class Volumes + # Create a volume + sig do + params( + create_request: Docker::CreateRequest::OrHash, + request_options: Docker::RequestOptions::OrHash + ).returns(Docker::Volume) + end + def create( + # Volume configuration + create_request:, + request_options: {} + ) + end + + # List volumes + sig do + params( + filters: String, + request_options: Docker::RequestOptions::OrHash + ).returns(Docker::Models::VolumeListResponse) + end + def list( + # JSON encoded value of the filters (a `map[string][]string`) to process on the + # volumes list. Available filters: + # + # - `dangling=` When set to `true` (or `1`), returns all volumes that are + # not in use by a container. When set to `false` (or `0`), only volumes that are + # in use by one or more containers are returned. + # - `driver=` Matches volumes based on their driver. + # - `label=` or `label=:` Matches volumes based on the presence + # of a `label` alone or a `label` and a value. + # - `name=` Matches all or part of a volume name. + filters: nil, + request_options: {} + ) + end + + # Instruct the driver to remove the volume. + sig do + params( + name: String, + force: T::Boolean, + request_options: Docker::RequestOptions::OrHash + ).void + end + def delete( + # Volume name or ID + name, + # Force the removal of the volume + force: nil, + request_options: {} + ) + end + + # Inspect a volume + sig do + params( + name: String, + request_options: Docker::RequestOptions::OrHash + ).returns(Docker::Volume) + end + def inspect_( + # Volume name or ID + name, + request_options: {} + ) + end + + # @api private + sig { params(client: Docker::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/docker/version.rbi b/rbi/docker/version.rbi new file mode 100644 index 0000000..1fc153a --- /dev/null +++ b/rbi/docker/version.rbi @@ -0,0 +1,5 @@ +# typed: strong + +module Docker + VERSION = T.let(T.unsafe(nil), String) +end diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..7398bdc --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,70 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "ruby", + "version-file": "lib/docker/version.rb", + "extra-files": [ + { + "type": "ruby-readme", + "path": "README.md" + } + ] +} \ No newline at end of file diff --git a/scripts/bootstrap b/scripts/bootstrap new file mode 100755 index 0000000..3487864 --- /dev/null +++ b/scripts/bootstrap @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +cd -- "$(dirname -- "$0")/.." + +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then + brew bundle check >/dev/null 2>&1 || { + echo -n "==> Install Homebrew dependencies? (y/N): " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + brew bundle + ;; + *) + ;; + esac + echo + } +fi + +echo "==> Installing Ruby dependencies…" + +exec -- bundle install "$@" diff --git a/scripts/fast-format b/scripts/fast-format new file mode 100755 index 0000000..6d5973f --- /dev/null +++ b/scripts/fast-format @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "Script started with $# arguments" +echo "Arguments: $*" +echo "Script location: $(dirname "$0")" + +cd -- "$(dirname "$0")/.." +echo "Changed to directory: $PWD" + +if [ $# -eq 0 ]; then + echo "Usage: $0 [additional-formatter-args...]" + echo "The file should contain one file path per line" + exit 1 +fi + +exec -- bundle exec rake format FORMAT_FILE="$1" diff --git a/scripts/format b/scripts/format new file mode 100755 index 0000000..177d1e6 --- /dev/null +++ b/scripts/format @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +cd -- "$(dirname -- "$0")/.." + +echo "==> Running formatters" + +exec -- bundle exec rake format "$@" diff --git a/scripts/lint b/scripts/lint new file mode 100755 index 0000000..08b0dbe --- /dev/null +++ b/scripts/lint @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +cd -- "$(dirname -- "$0")/.." + +echo "==> Running linters" + +exec -- bundle exec rake lint "$@" diff --git a/scripts/mock b/scripts/mock new file mode 100755 index 0000000..0b28f6e --- /dev/null +++ b/scripts/mock @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if [[ -n "$1" && "$1" != '--'* ]]; then + URL="$1" + shift +else + URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" +fi + +# Check if the URL is empty +if [ -z "$URL" ]; then + echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" + exit 1 +fi + +echo "==> Starting mock server with URL ${URL}" + +# Run prism mock on the given spec +if [ "$1" == "--daemon" ]; then + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & + + # Wait for server to come online + echo -n "Waiting for server" + while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + echo -n "." + sleep 0.1 + done + + if grep -q "✖ fatal" ".prism.log"; then + cat .prism.log + exit 1 + fi + + echo +else + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" +fi diff --git a/scripts/test b/scripts/test new file mode 100755 index 0000000..e0dc137 --- /dev/null +++ b/scripts/test @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +set -e + +cd -- "$(dirname -- "$0")/.." + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +function prism_is_running() { + curl --silent "http://localhost:4010" >/dev/null 2>&1 +} + +kill_server_on_port() { + pids=$(lsof -t -i tcp:"$1" || echo "") + if [ "$pids" != "" ]; then + kill "$pids" + echo "Stopped $pids." + fi +} + +function is_overriding_api_base_url() { + [ -n "$TEST_API_BASE_URL" ] +} + +if ! is_overriding_api_base_url && ! prism_is_running ; then + # When we exit this script, make sure to kill the background mock server process + trap 'kill_server_on_port 4010' EXIT + + # Start the dev server + ./scripts/mock --daemon +fi + +if is_overriding_api_base_url ; then + echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" + echo +elif ! prism_is_running ; then + echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" + echo -e "running against your OpenAPI spec." + echo + echo -e "To run the server, pass in the path or url of your OpenAPI" + echo -e "spec to the prism command:" + echo + echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" + echo + + exit 1 +else + echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" + echo +fi + +echo "==> Running tests" +bundle exec rake test "$@" diff --git a/sig/docker/client.rbs b/sig/docker/client.rbs new file mode 100644 index 0000000..619b680 --- /dev/null +++ b/sig/docker/client.rbs @@ -0,0 +1,33 @@ +module Docker + class Client < Docker::Internal::Transport::BaseClient + DEFAULT_MAX_RETRIES: 2 + + DEFAULT_TIMEOUT_IN_SECONDS: Float + + DEFAULT_INITIAL_RETRY_DELAY: Float + + DEFAULT_MAX_RETRY_DELAY: Float + + attr_reader auth: Docker::Resources::Auth + + attr_reader system_: Docker::Resources::System + + attr_reader containers: Docker::Resources::Containers + + attr_reader images: Docker::Resources::Images + + attr_reader networks: Docker::Resources::Networks + + attr_reader volumes: Docker::Resources::Volumes + + attr_reader services: Docker::Resources::Services + + def initialize: ( + ?base_url: String?, + ?max_retries: Integer, + ?timeout: Float, + ?initial_retry_delay: Float, + ?max_retry_delay: Float + ) -> void + end +end diff --git a/sig/docker/errors.rbs b/sig/docker/errors.rbs new file mode 100644 index 0000000..f911870 --- /dev/null +++ b/sig/docker/errors.rbs @@ -0,0 +1,117 @@ +module Docker + module Errors + class Error < StandardError + attr_accessor cause: StandardError? + end + + class ConversionError < Docker::Errors::Error + def cause: -> StandardError? + + def initialize: ( + on: Class, + method: Symbol, + target: top, + value: top, + ?cause: StandardError? + ) -> void + end + + class APIError < Docker::Errors::Error + attr_accessor url: URI::Generic + + attr_accessor status: Integer? + + attr_accessor headers: ::Hash[String, String]? + + attr_accessor body: top? + + def initialize: ( + url: URI::Generic, + ?status: Integer?, + ?headers: ::Hash[String, String]?, + ?body: Object?, + ?request: nil, + ?response: nil, + ?message: String? + ) -> void + end + + class APIConnectionError < Docker::Errors::APIError + def initialize: ( + url: URI::Generic, + ?status: nil, + ?headers: ::Hash[String, String]?, + ?body: nil, + ?request: nil, + ?response: nil, + ?message: String? + ) -> void + end + + class APITimeoutError < Docker::Errors::APIConnectionError + def initialize: ( + url: URI::Generic, + ?status: nil, + ?headers: ::Hash[String, String]?, + ?body: nil, + ?request: nil, + ?response: nil, + ?message: String? + ) -> void + end + + class APIStatusError < Docker::Errors::APIError + def self.for: ( + url: URI::Generic, + status: Integer, + headers: ::Hash[String, String]?, + body: Object?, + request: nil, + response: nil, + ?message: String? + ) -> instance + + def initialize: ( + url: URI::Generic, + status: Integer, + headers: ::Hash[String, String]?, + body: Object?, + request: nil, + response: nil, + ?message: String? + ) -> void + end + + class BadRequestError < Docker::Errors::APIStatusError + HTTP_STATUS: 400 + end + + class AuthenticationError < Docker::Errors::APIStatusError + HTTP_STATUS: 401 + end + + class PermissionDeniedError < Docker::Errors::APIStatusError + HTTP_STATUS: 403 + end + + class NotFoundError < Docker::Errors::APIStatusError + HTTP_STATUS: 404 + end + + class ConflictError < Docker::Errors::APIStatusError + HTTP_STATUS: 409 + end + + class UnprocessableEntityError < Docker::Errors::APIStatusError + HTTP_STATUS: 422 + end + + class RateLimitError < Docker::Errors::APIStatusError + HTTP_STATUS: 429 + end + + class InternalServerError < Docker::Errors::APIStatusError + HTTP_STATUS: Range[Integer] + end + end +end diff --git a/sig/docker/file_part.rbs b/sig/docker/file_part.rbs new file mode 100644 index 0000000..5371346 --- /dev/null +++ b/sig/docker/file_part.rbs @@ -0,0 +1,21 @@ +module Docker + class FilePart + attr_reader content: Pathname | StringIO | IO | String + + attr_reader content_type: String? + + attr_reader filename: String? + + private def read: -> String + + def to_json: (*top a) -> String + + def to_yaml: (*top a) -> String + + def initialize: ( + Pathname | StringIO | IO | String content, + ?filename: (Pathname | String)?, + ?content_type: String? + ) -> void + end +end diff --git a/sig/docker/internal.rbs b/sig/docker/internal.rbs new file mode 100644 index 0000000..ac73151 --- /dev/null +++ b/sig/docker/internal.rbs @@ -0,0 +1,9 @@ +module Docker + module Internal + extend Docker::Internal::Util::SorbetRuntimeSupport + + type file_input = Pathname | StringIO | IO | String | Docker::FilePart + + OMIT: Object + end +end diff --git a/sig/docker/internal/transport/base_client.rbs b/sig/docker/internal/transport/base_client.rbs new file mode 100644 index 0000000..5ac2848 --- /dev/null +++ b/sig/docker/internal/transport/base_client.rbs @@ -0,0 +1,131 @@ +module Docker + module Internal + module Transport + class BaseClient + extend Docker::Internal::Util::SorbetRuntimeSupport + + type request_components = + { + method: Symbol, + path: String | ::Array[String], + query: ::Hash[String, (::Array[String] | String)?]?, + headers: ::Hash[String, (String + | Integer + | ::Array[(String | Integer)?])?]?, + body: top?, + unwrap: (Symbol + | Integer + | ::Array[(Symbol | Integer)] + | (^(top arg0) -> top))?, + page: Class?, + stream: Class?, + model: Docker::Internal::Type::Converter::input?, + options: Docker::request_opts? + } + type request_input = + { + method: Symbol, + url: URI::Generic, + headers: ::Hash[String, String], + body: top, + max_retries: Integer, + timeout: Float + } + + MAX_REDIRECTS: 20 + + PLATFORM_HEADERS: ::Hash[String, String] + + def self.validate!: ( + Docker::Internal::Transport::BaseClient::request_components req + ) -> void + + def self.should_retry?: ( + Integer status, + headers: ::Hash[String, String] + ) -> bool + + def self.follow_redirect: ( + Docker::Internal::Transport::BaseClient::request_input request, + status: Integer, + response_headers: ::Hash[String, String] + ) -> Docker::Internal::Transport::BaseClient::request_input + + def self.reap_connection!: ( + Integer | Docker::Errors::APIConnectionError status, + stream: Enumerable[String]? + ) -> void + + attr_reader base_url: URI::Generic + + attr_reader timeout: Float + + attr_reader max_retries: Integer + + attr_reader initial_retry_delay: Float + + attr_reader max_retry_delay: Float + + attr_reader headers: ::Hash[String, String] + + attr_reader idempotency_header: String? + + # @api private + attr_reader requester: Docker::Internal::Transport::PooledNetRequester + + def initialize: ( + base_url: String, + ?timeout: Float, + ?max_retries: Integer, + ?initial_retry_delay: Float, + ?max_retry_delay: Float, + ?headers: ::Hash[String, (String + | Integer + | ::Array[(String | Integer)?])?], + ?idempotency_header: String? + ) -> void + + private def user_agent: -> String + + private def generate_idempotency_key: -> String + + private def build_request: ( + Docker::Internal::Transport::BaseClient::request_components req, + Docker::request_options opts + ) -> Docker::Internal::Transport::BaseClient::request_input + + private def retry_delay: ( + ::Hash[String, String] headers, + retry_count: Integer + ) -> Float + + def send_request: ( + Docker::Internal::Transport::BaseClient::request_input request, + redirect_count: Integer, + retry_count: Integer, + send_retry_header: bool + ) -> [Integer, top, Enumerable[String]] + + def request: ( + Symbol method, + String | ::Array[String] path, + ?query: ::Hash[String, (::Array[String] | String)?]?, + ?headers: ::Hash[String, (String + | Integer + | ::Array[(String | Integer)?])?]?, + ?body: top?, + ?unwrap: (Symbol + | Integer + | ::Array[(Symbol | Integer)] + | (^(top arg0) -> top))?, + ?page: Class?, + ?stream: Class?, + ?model: Docker::Internal::Type::Converter::input?, + ?options: Docker::request_opts? + ) -> top + + def inspect: -> String + end + end + end +end diff --git a/sig/docker/internal/transport/pooled_net_requester.rbs b/sig/docker/internal/transport/pooled_net_requester.rbs new file mode 100644 index 0000000..48da888 --- /dev/null +++ b/sig/docker/internal/transport/pooled_net_requester.rbs @@ -0,0 +1,48 @@ +module Docker + module Internal + module Transport + class PooledNetRequester + extend Docker::Internal::Util::SorbetRuntimeSupport + + type request = + { + method: Symbol, + url: URI::Generic, + headers: ::Hash[String, String], + body: top, + deadline: Float + } + + KEEP_ALIVE_TIMEOUT: 30 + + DEFAULT_MAX_CONNECTIONS: Integer + + def self.connect: ( + cert_store: OpenSSL::X509::Store, + url: URI::Generic + ) -> top + + def self.calibrate_socket_timeout: (top conn, Float deadline) -> void + + def self.build_request: ( + Docker::Internal::Transport::PooledNetRequester::request request + ) { + (String arg0) -> void + } -> [top, (^-> void)] + + private def with_pool: ( + URI::Generic url, + deadline: Float + ) { + (top arg0) -> void + } -> void + + def execute: ( + Docker::Internal::Transport::PooledNetRequester::request request + ) -> [Integer, top, Enumerable[String]] + + def initialize: (?size: Integer) -> void + end + end + end +end diff --git a/sig/docker/internal/type/array_of.rbs b/sig/docker/internal/type/array_of.rbs new file mode 100644 index 0000000..2d8a67b --- /dev/null +++ b/sig/docker/internal/type/array_of.rbs @@ -0,0 +1,48 @@ +module Docker + module Internal + module Type + class ArrayOf[Elem] + include Docker::Internal::Type::Converter + include Docker::Internal::Util::SorbetRuntimeSupport + + def self.[]: ( + ::Hash[Symbol, top] + | ^-> Docker::Internal::Type::Converter::input + | Docker::Internal::Type::Converter::input type_info, + ?::Hash[Symbol, top] spec + ) -> instance + + def ===: (top other) -> bool + + def ==: (top other) -> bool + + def hash: -> Integer + + def coerce: ( + ::Array[top] | top value, + state: Docker::Internal::Type::Converter::coerce_state + ) -> (::Array[top] | top) + + def dump: ( + ::Array[top] | top value, + state: Docker::Internal::Type::Converter::dump_state + ) -> (::Array[top] | top) + + def to_sorbet_type: -> top + + def item_type: -> Elem + + def nilable?: -> bool + + def initialize: ( + ::Hash[Symbol, top] + | ^-> Docker::Internal::Type::Converter::input + | Docker::Internal::Type::Converter::input type_info, + ?::Hash[Symbol, top] spec + ) -> void + + def inspect: (?depth: Integer) -> String + end + end + end +end diff --git a/sig/docker/internal/type/base_model.rbs b/sig/docker/internal/type/base_model.rbs new file mode 100644 index 0000000..43bd94e --- /dev/null +++ b/sig/docker/internal/type/base_model.rbs @@ -0,0 +1,102 @@ +module Docker + module Internal + module Type + class BaseModel + extend Docker::Internal::Type::Converter + extend Docker::Internal::Util::SorbetRuntimeSupport + + type known_field = + { mode: (:coerce | :dump)?, required: bool, nilable: bool } + + def self.inherited: (self child) -> void + + def self.known_fields: -> ::Hash[Symbol, (Docker::Internal::Type::BaseModel::known_field + & { type_fn: (^-> Docker::Internal::Type::Converter::input) })] + + def self.fields: -> ::Hash[Symbol, (Docker::Internal::Type::BaseModel::known_field + & { type: Docker::Internal::Type::Converter::input })] + + private def self.add_field: ( + Symbol name_sym, + required: bool, + type_info: { + const: (nil | bool | Integer | Float | Symbol)?, + enum: ^-> Docker::Internal::Type::Converter::input?, + union: ^-> Docker::Internal::Type::Converter::input?, + api_name: Symbol + } + | ^-> Docker::Internal::Type::Converter::input + | Docker::Internal::Type::Converter::input, + spec: ::Hash[Symbol, top] + ) -> void + + def self.required: ( + Symbol name_sym, + ::Hash[Symbol, top] + | ^-> Docker::Internal::Type::Converter::input + | Docker::Internal::Type::Converter::input type_info, + ?::Hash[Symbol, top] spec + ) -> void + + def self.optional: ( + Symbol name_sym, + ::Hash[Symbol, top] + | ^-> Docker::Internal::Type::Converter::input + | Docker::Internal::Type::Converter::input type_info, + ?::Hash[Symbol, top] spec + ) -> void + + private def self.request_only: { -> void } -> void + + private def self.response_only: { -> void } -> void + + def self.==: (top other) -> bool + + def self.hash: -> Integer + + def ==: (top other) -> bool + + def hash: -> Integer + + def self.coerce: ( + Docker::Internal::Type::BaseModel | ::Hash[top, top] | top value, + state: Docker::Internal::Type::Converter::coerce_state + ) -> (instance | top) + + def self.dump: ( + instance | top value, + state: Docker::Internal::Type::Converter::dump_state + ) -> (::Hash[top, top] | top) + + def self.to_sorbet_type: -> top + + def self.recursively_to_h: ( + Docker::Internal::Type::BaseModel model, + convert: bool + ) -> ::Hash[Symbol, top] + + def []: (Symbol key) -> top? + + def to_h: -> ::Hash[Symbol, top] + + alias to_hash to_h + + def deep_to_h: -> ::Hash[Symbol, top] + + def deconstruct_keys: (::Array[Symbol]? keys) -> ::Hash[Symbol, top] + + def to_json: (*top a) -> String + + def to_yaml: (*top a) -> String + + def initialize: (?::Hash[Symbol, top] | instance data) -> void + + def self.inspect: (?depth: Integer) -> String + + def to_s: -> String + + def inspect: -> String + end + end + end +end diff --git a/sig/docker/internal/type/base_page.rbs b/sig/docker/internal/type/base_page.rbs new file mode 100644 index 0000000..1198d83 --- /dev/null +++ b/sig/docker/internal/type/base_page.rbs @@ -0,0 +1,24 @@ +module Docker + module Internal + module Type + module BasePage[Elem] + def next_page?: -> bool + + def next_page: -> instance + + def auto_paging_each: { (Elem arg0) -> void } -> void + + def to_enum: -> Enumerable[Elem] + + alias enum_for to_enum + + def initialize: ( + client: Docker::Internal::Transport::BaseClient, + req: Docker::Internal::Transport::BaseClient::request_components, + headers: ::Hash[String, String], + page_data: top + ) -> void + end + end + end +end diff --git a/sig/docker/internal/type/boolean.rbs b/sig/docker/internal/type/boolean.rbs new file mode 100644 index 0000000..d4321b6 --- /dev/null +++ b/sig/docker/internal/type/boolean.rbs @@ -0,0 +1,26 @@ +module Docker + module Internal + module Type + class Boolean + extend Docker::Internal::Type::Converter + extend Docker::Internal::Util::SorbetRuntimeSupport + + def self.===: (top other) -> bool + + def self.==: (top other) -> bool + + def self.coerce: ( + bool | top value, + state: Docker::Internal::Type::Converter::coerce_state + ) -> (bool | top) + + def self.dump: ( + bool | top value, + state: Docker::Internal::Type::Converter::dump_state + ) -> (bool | top) + + def self.to_sorbet_type: -> top + end + end + end +end diff --git a/sig/docker/internal/type/converter.rbs b/sig/docker/internal/type/converter.rbs new file mode 100644 index 0000000..947e759 --- /dev/null +++ b/sig/docker/internal/type/converter.rbs @@ -0,0 +1,79 @@ +module Docker + module Internal + module Type + module Converter + extend Docker::Internal::Util::SorbetRuntimeSupport + + type input = Docker::Internal::Type::Converter | Class + + type coerce_state = + { + translate_names: bool, + strictness: bool, + exactness: { yes: Integer, no: Integer, maybe: Integer }, + error: Class, + branched: Integer + } + + type dump_state = { can_retry: bool } + + def coerce: ( + top value, + state: Docker::Internal::Type::Converter::coerce_state + ) -> top + + def dump: ( + top value, + state: Docker::Internal::Type::Converter::dump_state + ) -> top + + def inspect: (?depth: Integer) -> String + + def self.type_info: ( + { + const: (nil | bool | Integer | Float | Symbol)?, + enum: ^-> Docker::Internal::Type::Converter::input?, + union: ^-> Docker::Internal::Type::Converter::input? + } + | ^-> Docker::Internal::Type::Converter::input + | Docker::Internal::Type::Converter::input spec + ) -> (^-> top) + + def self.meta_info: ( + { + const: (nil | bool | Integer | Float | Symbol)?, + enum: ^-> Docker::Internal::Type::Converter::input?, + union: ^-> Docker::Internal::Type::Converter::input? + } + | ^-> Docker::Internal::Type::Converter::input + | Docker::Internal::Type::Converter::input type_info, + { + const: (nil | bool | Integer | Float | Symbol)?, + enum: ^-> Docker::Internal::Type::Converter::input?, + union: ^-> Docker::Internal::Type::Converter::input? + } + | ^-> Docker::Internal::Type::Converter::input + | Docker::Internal::Type::Converter::input spec + ) -> ::Hash[Symbol, top] + + def self.new_coerce_state: ( + ?translate_names: bool + ) -> Docker::Internal::Type::Converter::coerce_state + + def self.coerce: ( + Docker::Internal::Type::Converter::input target, + top value, + ?state: Docker::Internal::Type::Converter::coerce_state + ) -> top + + def self.dump: ( + Docker::Internal::Type::Converter::input target, + top value, + ?state: Docker::Internal::Type::Converter::dump_state + ) -> top + + def self.inspect: (top target, depth: Integer) -> String + end + end + end +end diff --git a/sig/docker/internal/type/enum.rbs b/sig/docker/internal/type/enum.rbs new file mode 100644 index 0000000..124c260 --- /dev/null +++ b/sig/docker/internal/type/enum.rbs @@ -0,0 +1,32 @@ +module Docker + module Internal + module Type + module Enum + include Docker::Internal::Type::Converter + include Docker::Internal::Util::SorbetRuntimeSupport + + def self.values: -> ::Array[(nil | bool | Integer | Float | Symbol)] + + def ===: (top other) -> bool + + def ==: (top other) -> bool + + def hash: -> Integer + + def coerce: ( + String | Symbol | top value, + state: Docker::Internal::Type::Converter::coerce_state + ) -> (Symbol | top) + + def dump: ( + Symbol | top value, + state: Docker::Internal::Type::Converter::dump_state + ) -> (Symbol | top) + + def to_sorbet_type: -> top + + def inspect: (?depth: Integer) -> String + end + end + end +end diff --git a/sig/docker/internal/type/file_input.rbs b/sig/docker/internal/type/file_input.rbs new file mode 100644 index 0000000..6c0642f --- /dev/null +++ b/sig/docker/internal/type/file_input.rbs @@ -0,0 +1,25 @@ +module Docker + module Internal + module Type + class FileInput + extend Docker::Internal::Type::Converter + + def self.===: (top other) -> bool + + def self.==: (top other) -> bool + + def self.coerce: ( + StringIO | String | top value, + state: Docker::Internal::Type::Converter::coerce_state + ) -> (StringIO | top) + + def self.dump: ( + Pathname | StringIO | IO | String | top value, + state: Docker::Internal::Type::Converter::dump_state + ) -> (Pathname | StringIO | IO | String | top) + + def self.to_sorbet_type: -> top + end + end + end +end diff --git a/sig/docker/internal/type/hash_of.rbs b/sig/docker/internal/type/hash_of.rbs new file mode 100644 index 0000000..4d1efa7 --- /dev/null +++ b/sig/docker/internal/type/hash_of.rbs @@ -0,0 +1,48 @@ +module Docker + module Internal + module Type + class HashOf[Elem] + include Docker::Internal::Type::Converter + include Docker::Internal::Util::SorbetRuntimeSupport + + def self.[]: ( + ::Hash[Symbol, top] + | ^-> Docker::Internal::Type::Converter::input + | Docker::Internal::Type::Converter::input type_info, + ?::Hash[Symbol, top] spec + ) -> instance + + def ===: (top other) -> bool + + def ==: (top other) -> bool + + def hash: -> Integer + + def coerce: ( + ::Hash[top, top] | top value, + state: Docker::Internal::Type::Converter::coerce_state + ) -> (::Hash[Symbol, top] | top) + + def dump: ( + ::Hash[top, top] | top value, + state: Docker::Internal::Type::Converter::dump_state + ) -> (::Hash[Symbol, top] | top) + + def to_sorbet_type: -> top + + def item_type: -> Elem + + def nilable?: -> bool + + def initialize: ( + ::Hash[Symbol, top] + | ^-> Docker::Internal::Type::Converter::input + | Docker::Internal::Type::Converter::input type_info, + ?::Hash[Symbol, top] spec + ) -> void + + def inspect: (?depth: Integer) -> String + end + end + end +end diff --git a/sig/docker/internal/type/request_parameters.rbs b/sig/docker/internal/type/request_parameters.rbs new file mode 100644 index 0000000..30ebd46 --- /dev/null +++ b/sig/docker/internal/type/request_parameters.rbs @@ -0,0 +1,17 @@ +module Docker + module Internal + module Type + type request_parameters = { request_options: Docker::request_opts } + + module RequestParameters + attr_reader request_options: Docker::request_opts + + def request_options=: (Docker::request_opts) -> Docker::request_opts + + module Converter + def dump_request: (top params) -> [top, ::Hash[Symbol, top]] + end + end + end + end +end diff --git a/sig/docker/internal/type/union.rbs b/sig/docker/internal/type/union.rbs new file mode 100644 index 0000000..0645135 --- /dev/null +++ b/sig/docker/internal/type/union.rbs @@ -0,0 +1,52 @@ +module Docker + module Internal + module Type + module Union + include Docker::Internal::Type::Converter + include Docker::Internal::Util::SorbetRuntimeSupport + + private def self.known_variants: -> ::Array[[Symbol?, (^-> Docker::Internal::Type::Converter::input), ::Hash[Symbol, top]]] + + def self.derefed_variants: -> ::Array[[Symbol?, top, ::Hash[Symbol, top]]] + + def self.variants: -> ::Array[top] + + private def self.discriminator: (Symbol property) -> void + + private def self.variant: ( + Symbol + | ::Hash[Symbol, top] + | ^-> Docker::Internal::Type::Converter::input + | Docker::Internal::Type::Converter::input key, + ?::Hash[Symbol, top] + | ^-> Docker::Internal::Type::Converter::input + | Docker::Internal::Type::Converter::input spec + ) -> void + + private def self.resolve_variant: ( + top value + ) -> Docker::Internal::Type::Converter::input? + + def ===: (top other) -> bool + + def ==: (top other) -> bool + + def hash: -> Integer + + def coerce: ( + top value, + state: Docker::Internal::Type::Converter::coerce_state + ) -> top + + def dump: ( + top value, + state: Docker::Internal::Type::Converter::dump_state + ) -> top + + def to_sorbet_type: -> top + + def inspect: (?depth: Integer) -> String + end + end + end +end diff --git a/sig/docker/internal/type/unknown.rbs b/sig/docker/internal/type/unknown.rbs new file mode 100644 index 0000000..687f315 --- /dev/null +++ b/sig/docker/internal/type/unknown.rbs @@ -0,0 +1,26 @@ +module Docker + module Internal + module Type + class Unknown + extend Docker::Internal::Type::Converter + extend Docker::Internal::Util::SorbetRuntimeSupport + + def self.===: (top other) -> bool + + def self.==: (top other) -> bool + + def self.coerce: ( + top value, + state: Docker::Internal::Type::Converter::coerce_state + ) -> top + + def self.dump: ( + top value, + state: Docker::Internal::Type::Converter::dump_state + ) -> top + + def self.to_sorbet_type: -> top + end + end + end +end diff --git a/sig/docker/internal/util.rbs b/sig/docker/internal/util.rbs new file mode 100644 index 0000000..2b48e0e --- /dev/null +++ b/sig/docker/internal/util.rbs @@ -0,0 +1,185 @@ +module Docker + module Internal + module Util + extend Docker::Internal::Util::SorbetRuntimeSupport + + def self?.monotonic_secs: -> Float + + def self?.walk_namespaces: ( + Module | Class ns + ) -> Enumerable[(Module | Class)] + + def self?.arch: -> String + + def self?.os: -> String + + def self?.primitive?: (top input) -> bool + + def self?.coerce_boolean: (String | bool input) -> (bool | top) + + def self?.coerce_boolean!: (String | bool input) -> bool? + + def self?.coerce_integer: (String | Integer input) -> (Integer | top) + + def self?.coerce_float: (String | Integer | Float input) -> (Float | top) + + def self?.coerce_hash: (top input) -> (::Hash[top, top] | top) + + def self?.coerce_hash!: (top input) -> ::Hash[top, top]? + + def self?.deep_merge_lr: (top lhs, top rhs, ?concat: bool) -> top + + def self?.deep_merge: ( + *::Array[top] values, + ?sentinel: top?, + ?concat: bool + ) -> top + + def self?.dig: ( + ::Hash[Symbol, top] | ::Array[top] | top data, + (Symbol + | Integer + | ::Array[(Symbol | Integer)] + | (^(top arg0) -> top))? pick + ) { + -> top? + } -> top? + + def self?.uri_origin: (URI::Generic uri) -> String + + def self?.interpolate_path: (String | ::Array[String] path) -> String + + def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]] + + def self?.encode_query: ( + ::Hash[String, (::Array[String] | String)?]? query + ) -> String? + + type parsed_uri = + { + scheme: String?, + host: String?, + port: Integer?, + path: String?, + query: ::Hash[String, ::Array[String]] + } + + def self?.parse_uri: ( + URI::Generic | String url + ) -> Docker::Internal::Util::parsed_uri + + def self?.unparse_uri: ( + Docker::Internal::Util::parsed_uri parsed + ) -> URI::Generic + + def self?.join_parsed_uri: ( + Docker::Internal::Util::parsed_uri lhs, + Docker::Internal::Util::parsed_uri rhs + ) -> URI::Generic + + def self?.normalized_headers: ( + *::Hash[String, (String + | Integer + | ::Array[(String | Integer)?])?] headers + ) -> ::Hash[String, String] + + class ReadIOAdapter + def close?: -> bool? + + def close: -> void + + private def read_enum: (Integer? max_len) -> String + + def read: (?Integer? max_len, ?String? out_string) -> String? + + def initialize: ( + String | Pathname | StringIO | Enumerable[String] src + ) { + (String arg0) -> void + } -> void + end + + def self?.writable_enum: { + (Enumerator::Yielder y) -> void + } -> Enumerable[String] + + JSON_CONTENT: Regexp + JSONL_CONTENT: Regexp + + def self?.write_multipart_content: ( + Enumerator::Yielder y, + val: top, + closing: ::Array[^-> void], + ?content_type: String? + ) -> void + + def self?.write_multipart_chunk: ( + Enumerator::Yielder y, + boundary: String, + key: Symbol | String, + val: top, + closing: ::Array[^-> void] + ) -> void + + def self?.encode_multipart_streaming: ( + top body + ) -> [String, Enumerable[String]] + + def self?.encode_content: ( + ::Hash[String, String] headers, + top body + ) -> top + + def self?.force_charset!: (String content_type, text: String) -> void + + def self?.decode_content: ( + ::Hash[String, String] headers, + stream: Enumerable[String], + ?suppress_error: bool + ) -> top + + def self?.fused_enum: ( + Enumerable[top] enum, + ?external: bool + ) { + -> void + } -> Enumerable[top] + + def self?.close_fused!: (Enumerable[top]? enum) -> void + + def self?.chain_fused: ( + Enumerable[top]? enum + ) { + (Enumerator::Yielder arg0) -> void + } -> Enumerable[top] + + type server_sent_event = + { event: String?, data: String?, id: String?, retry: Integer? } + + def self?.decode_lines: (Enumerable[String] enum) -> Enumerable[String] + + def self?.decode_sse: ( + Enumerable[String] lines + ) -> Enumerable[Docker::Internal::Util::server_sent_event] + + module SorbetRuntimeSupport + class MissingSorbetRuntimeError < ::RuntimeError + end + + private def sorbet_runtime_constants: -> ::Hash[Symbol, top] + + def const_missing: (Symbol name) -> void + + def sorbet_constant_defined?: (Symbol name) -> bool + + def define_sorbet_constant!: (Symbol name) { -> top } -> void + + def to_sorbet_type: -> top + + def self.to_sorbet_type: ( + Docker::Internal::Util::SorbetRuntimeSupport | top `type` + ) -> top + end + end + end +end diff --git a/sig/docker/models.rbs b/sig/docker/models.rbs new file mode 100644 index 0000000..1165c1c --- /dev/null +++ b/sig/docker/models.rbs @@ -0,0 +1,81 @@ +module Docker + class AuthLoginParams = Docker::Models::AuthLoginParams + + class AuthResponse = Docker::Models::AuthResponse + + class Config = Docker::Models::Config + + class Container = Docker::Models::Container + + class ContainerCreateParams = Docker::Models::ContainerCreateParams + + class ContainerDeleteParams = Docker::Models::ContainerDeleteParams + + class ContainerInspectParams = Docker::Models::ContainerInspectParams + + class ContainerKillParams = Docker::Models::ContainerKillParams + + class ContainerListParams = Docker::Models::ContainerListParams + + class ContainerLogsParams = Docker::Models::ContainerLogsParams + + class ContainerStartParams = Docker::Models::ContainerStartParams + + class ContainerStopParams = Docker::Models::ContainerStopParams + + class CreateRequest = Docker::Models::CreateRequest + + class CreateResponse = Docker::Models::CreateResponse + + class Error = Docker::Models::Error + + class Image = Docker::Models::Image + + class ImageDeleteParams = Docker::Models::ImageDeleteParams + + class ImageInspectParams = Docker::Models::ImageInspectParams + + class ImageListParams = Docker::Models::ImageListParams + + class ImagePullParams = Docker::Models::ImagePullParams + + class Network = Docker::Models::Network + + class NetworkCreateParams = Docker::Models::NetworkCreateParams + + class NetworkDeleteParams = Docker::Models::NetworkDeleteParams + + class NetworkInspectParams = Docker::Models::NetworkInspectParams + + class NetworkListParams = Docker::Models::NetworkListParams + + class Service = Docker::Models::Service + + class ServiceCreateParams = Docker::Models::ServiceCreateParams + + class ServiceDeleteParams = Docker::Models::ServiceDeleteParams + + class ServiceInspectParams = Docker::Models::ServiceInspectParams + + class ServiceListParams = Docker::Models::ServiceListParams + + class Spec = Docker::Models::Spec + + class Summary = Docker::Models::Summary + + class SystemInfoParams = Docker::Models::SystemInfoParams + + class SystemPingParams = Docker::Models::SystemPingParams + + class SystemVersionParams = Docker::Models::SystemVersionParams + + class Volume = Docker::Models::Volume + + class VolumeCreateParams = Docker::Models::VolumeCreateParams + + class VolumeDeleteParams = Docker::Models::VolumeDeleteParams + + class VolumeInspectParams = Docker::Models::VolumeInspectParams + + class VolumeListParams = Docker::Models::VolumeListParams +end diff --git a/sig/docker/models/auth_login_params.rbs b/sig/docker/models/auth_login_params.rbs new file mode 100644 index 0000000..736a8cc --- /dev/null +++ b/sig/docker/models/auth_login_params.rbs @@ -0,0 +1,38 @@ +module Docker + module Models + type auth_login_params = + { password: String, serveraddress: String, username: String } + & Docker::Internal::Type::request_parameters + + class AuthLoginParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader password: String? + + def password=: (String) -> String + + attr_reader serveraddress: String? + + def serveraddress=: (String) -> String + + attr_reader username: String? + + def username=: (String) -> String + + def initialize: ( + ?password: String, + ?serveraddress: String, + ?username: String, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + password: String, + serveraddress: String, + username: String, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/auth_response.rbs b/sig/docker/models/auth_response.rbs new file mode 100644 index 0000000..dfa5d1e --- /dev/null +++ b/sig/docker/models/auth_response.rbs @@ -0,0 +1,17 @@ +module Docker + module Models + type auth_response = { status: String, identity_token: String } + + class AuthResponse < Docker::Internal::Type::BaseModel + attr_accessor status: String + + attr_reader identity_token: String? + + def identity_token=: (String) -> String + + def initialize: (status: String, ?identity_token: String) -> void + + def to_hash: -> { status: String, identity_token: String } + end + end +end diff --git a/sig/docker/models/config.rbs b/sig/docker/models/config.rbs new file mode 100644 index 0000000..54738dd --- /dev/null +++ b/sig/docker/models/config.rbs @@ -0,0 +1,225 @@ +module Docker + module Models + type config = + { + args_escaped: bool?, + attach_stderr: bool, + attach_stdin: bool, + attach_stdout: bool, + cmd: ::Array[String], + domainname: String, + entrypoint: ::Array[String], + env: ::Array[String], + exposed_ports: ::Hash[Symbol, top]?, + healthcheck: Docker::Config::Healthcheck, + hostname: String, + image: String, + labels: ::Hash[Symbol, String], + network_disabled: bool?, + on_build: ::Array[String]?, + open_stdin: bool, + shell: ::Array[String]?, + stdin_once: bool, + stop_signal: String?, + stop_timeout: Integer?, + tty: bool, + user: String, + volumes: ::Hash[Symbol, top], + working_dir: String + } + + class Config < Docker::Internal::Type::BaseModel + attr_accessor args_escaped: bool? + + attr_reader attach_stderr: bool? + + def attach_stderr=: (bool) -> bool + + attr_reader attach_stdin: bool? + + def attach_stdin=: (bool) -> bool + + attr_reader attach_stdout: bool? + + def attach_stdout=: (bool) -> bool + + attr_reader cmd: ::Array[String]? + + def cmd=: (::Array[String]) -> ::Array[String] + + attr_reader domainname: String? + + def domainname=: (String) -> String + + attr_reader entrypoint: ::Array[String]? + + def entrypoint=: (::Array[String]) -> ::Array[String] + + attr_reader env: ::Array[String]? + + def env=: (::Array[String]) -> ::Array[String] + + attr_accessor exposed_ports: ::Hash[Symbol, top]? + + attr_reader healthcheck: Docker::Config::Healthcheck? + + def healthcheck=: ( + Docker::Config::Healthcheck + ) -> Docker::Config::Healthcheck + + attr_reader hostname: String? + + def hostname=: (String) -> String + + attr_reader image: String? + + def image=: (String) -> String + + attr_reader labels: ::Hash[Symbol, String]? + + def labels=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_accessor network_disabled: bool? + + attr_accessor on_build: ::Array[String]? + + attr_reader open_stdin: bool? + + def open_stdin=: (bool) -> bool + + attr_accessor shell: ::Array[String]? + + attr_reader stdin_once: bool? + + def stdin_once=: (bool) -> bool + + attr_accessor stop_signal: String? + + attr_accessor stop_timeout: Integer? + + attr_reader tty: bool? + + def tty=: (bool) -> bool + + attr_reader user: String? + + def user=: (String) -> String + + attr_reader volumes: ::Hash[Symbol, top]? + + def volumes=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader working_dir: String? + + def working_dir=: (String) -> String + + def initialize: ( + ?args_escaped: bool?, + ?attach_stderr: bool, + ?attach_stdin: bool, + ?attach_stdout: bool, + ?cmd: ::Array[String], + ?domainname: String, + ?entrypoint: ::Array[String], + ?env: ::Array[String], + ?exposed_ports: ::Hash[Symbol, top]?, + ?healthcheck: Docker::Config::Healthcheck, + ?hostname: String, + ?image: String, + ?labels: ::Hash[Symbol, String], + ?network_disabled: bool?, + ?on_build: ::Array[String]?, + ?open_stdin: bool, + ?shell: ::Array[String]?, + ?stdin_once: bool, + ?stop_signal: String?, + ?stop_timeout: Integer?, + ?tty: bool, + ?user: String, + ?volumes: ::Hash[Symbol, top], + ?working_dir: String + ) -> void + + def to_hash: -> { + args_escaped: bool?, + attach_stderr: bool, + attach_stdin: bool, + attach_stdout: bool, + cmd: ::Array[String], + domainname: String, + entrypoint: ::Array[String], + env: ::Array[String], + exposed_ports: ::Hash[Symbol, top]?, + healthcheck: Docker::Config::Healthcheck, + hostname: String, + image: String, + labels: ::Hash[Symbol, String], + network_disabled: bool?, + on_build: ::Array[String]?, + open_stdin: bool, + shell: ::Array[String]?, + stdin_once: bool, + stop_signal: String?, + stop_timeout: Integer?, + tty: bool, + user: String, + volumes: ::Hash[Symbol, top], + working_dir: String + } + + type healthcheck = + { + interval: Integer, + retries: Integer, + start_interval: Integer, + start_period: Integer, + test_: ::Array[String], + timeout: Integer + } + + class Healthcheck < Docker::Internal::Type::BaseModel + attr_reader interval: Integer? + + def interval=: (Integer) -> Integer + + attr_reader retries: Integer? + + def retries=: (Integer) -> Integer + + attr_reader start_interval: Integer? + + def start_interval=: (Integer) -> Integer + + attr_reader start_period: Integer? + + def start_period=: (Integer) -> Integer + + attr_reader test_: ::Array[String]? + + def test_=: (::Array[String]) -> ::Array[String] + + attr_reader timeout: Integer? + + def timeout=: (Integer) -> Integer + + def initialize: ( + ?interval: Integer, + ?retries: Integer, + ?start_interval: Integer, + ?start_period: Integer, + ?test_: ::Array[String], + ?timeout: Integer + ) -> void + + def to_hash: -> { + interval: Integer, + retries: Integer, + start_interval: Integer, + start_period: Integer, + test_: ::Array[String], + timeout: Integer + } + end + end + end +end diff --git a/sig/docker/models/container.rbs b/sig/docker/models/container.rbs new file mode 100644 index 0000000..2dd0e20 --- /dev/null +++ b/sig/docker/models/container.rbs @@ -0,0 +1,1969 @@ +module Docker + module Models + type container = + { + app_armor_profile: String, + args: ::Array[String], + config: Docker::Config, + created: String?, + driver: String, + exec_ids: ::Array[String]?, + graph_driver: Docker::Container::GraphDriver, + host_config: Docker::Container::HostConfig, + hostname_path: String, + hosts_path: String, + id: String, + image: String, + image_manifest_descriptor: Docker::Container::ImageManifestDescriptor, + log_path: String?, + mount_label: String, + mounts: ::Array[Docker::Container::Mount], + name: String, + network_settings: Docker::Container::NetworkSettings, + path: String, + platform: String, + process_label: String, + resolv_conf_path: String, + restart_count: Integer, + size_root_fs: Integer?, + size_rw: Integer?, + state: Docker::Container::State?, + storage: Docker::Container::Storage + } + + class Container < Docker::Internal::Type::BaseModel + attr_reader app_armor_profile: String? + + def app_armor_profile=: (String) -> String + + attr_reader args: ::Array[String]? + + def args=: (::Array[String]) -> ::Array[String] + + attr_reader config: Docker::Config? + + def config=: (Docker::Config) -> Docker::Config + + attr_accessor created: String? + + attr_reader driver: String? + + def driver=: (String) -> String + + attr_accessor exec_ids: ::Array[String]? + + attr_reader graph_driver: Docker::Container::GraphDriver? + + def graph_driver=: ( + Docker::Container::GraphDriver + ) -> Docker::Container::GraphDriver + + attr_reader host_config: Docker::Container::HostConfig? + + def host_config=: ( + Docker::Container::HostConfig + ) -> Docker::Container::HostConfig + + attr_reader hostname_path: String? + + def hostname_path=: (String) -> String + + attr_reader hosts_path: String? + + def hosts_path=: (String) -> String + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader image: String? + + def image=: (String) -> String + + attr_reader image_manifest_descriptor: Docker::Container::ImageManifestDescriptor? + + def image_manifest_descriptor=: ( + Docker::Container::ImageManifestDescriptor + ) -> Docker::Container::ImageManifestDescriptor + + attr_accessor log_path: String? + + attr_reader mount_label: String? + + def mount_label=: (String) -> String + + attr_reader mounts: ::Array[Docker::Container::Mount]? + + def mounts=: ( + ::Array[Docker::Container::Mount] + ) -> ::Array[Docker::Container::Mount] + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader network_settings: Docker::Container::NetworkSettings? + + def network_settings=: ( + Docker::Container::NetworkSettings + ) -> Docker::Container::NetworkSettings + + attr_reader path: String? + + def path=: (String) -> String + + attr_reader platform: String? + + def platform=: (String) -> String + + attr_reader process_label: String? + + def process_label=: (String) -> String + + attr_reader resolv_conf_path: String? + + def resolv_conf_path=: (String) -> String + + attr_reader restart_count: Integer? + + def restart_count=: (Integer) -> Integer + + attr_accessor size_root_fs: Integer? + + attr_accessor size_rw: Integer? + + attr_accessor state: Docker::Container::State? + + attr_reader storage: Docker::Container::Storage? + + def storage=: (Docker::Container::Storage) -> Docker::Container::Storage + + def initialize: ( + ?app_armor_profile: String, + ?args: ::Array[String], + ?config: Docker::Config, + ?created: String?, + ?driver: String, + ?exec_ids: ::Array[String]?, + ?graph_driver: Docker::Container::GraphDriver, + ?host_config: Docker::Container::HostConfig, + ?hostname_path: String, + ?hosts_path: String, + ?id: String, + ?image: String, + ?image_manifest_descriptor: Docker::Container::ImageManifestDescriptor, + ?log_path: String?, + ?mount_label: String, + ?mounts: ::Array[Docker::Container::Mount], + ?name: String, + ?network_settings: Docker::Container::NetworkSettings, + ?path: String, + ?platform: String, + ?process_label: String, + ?resolv_conf_path: String, + ?restart_count: Integer, + ?size_root_fs: Integer?, + ?size_rw: Integer?, + ?state: Docker::Container::State?, + ?storage: Docker::Container::Storage + ) -> void + + def to_hash: -> { + app_armor_profile: String, + args: ::Array[String], + config: Docker::Config, + created: String?, + driver: String, + exec_ids: ::Array[String]?, + graph_driver: Docker::Container::GraphDriver, + host_config: Docker::Container::HostConfig, + hostname_path: String, + hosts_path: String, + id: String, + image: String, + image_manifest_descriptor: Docker::Container::ImageManifestDescriptor, + log_path: String?, + mount_label: String, + mounts: ::Array[Docker::Container::Mount], + name: String, + network_settings: Docker::Container::NetworkSettings, + path: String, + platform: String, + process_label: String, + resolv_conf_path: String, + restart_count: Integer, + size_root_fs: Integer?, + size_rw: Integer?, + state: Docker::Container::State?, + storage: Docker::Container::Storage + } + + type graph_driver = { data: ::Hash[Symbol, String], name: String } + + class GraphDriver < Docker::Internal::Type::BaseModel + attr_accessor data: ::Hash[Symbol, String] + + attr_accessor name: String + + def initialize: (data: ::Hash[Symbol, String], name: String) -> void + + def to_hash: -> { data: ::Hash[Symbol, String], name: String } + end + + type host_config = + { + annotations: ::Hash[Symbol, String], + auto_remove: bool, + binds: ::Array[String], + blkio_device_read_bps: ::Array[Docker::Container::HostConfig::BlkioDeviceReadBp], + blkio_device_read_i_ops: ::Array[Docker::Container::HostConfig::BlkioDeviceReadIOp], + blkio_device_write_bps: ::Array[Docker::Container::HostConfig::BlkioDeviceWriteBp], + blkio_device_write_i_ops: ::Array[Docker::Container::HostConfig::BlkioDeviceWriteIOp], + blkio_weight: Integer, + blkio_weight_device: ::Array[Docker::Container::HostConfig::BlkioWeightDevice], + cap_add: ::Array[String], + cap_drop: ::Array[String], + cgroup: String, + cgroupns_mode: Docker::Models::Container::HostConfig::cgroupns_mode, + cgroup_parent: String, + console_size: ::Array[Integer]?, + container_id_file: String, + cpu_count: Integer, + cpu_percent: Integer, + cpu_period: Integer, + cpu_quota: Integer, + cpu_realtime_period: Integer, + cpu_realtime_runtime: Integer, + cpuset_cpus: String, + cpuset_mems: String, + cpu_shares: Integer, + device_cgroup_rules: ::Array[String], + device_requests: ::Array[Docker::Container::HostConfig::DeviceRequest], + devices: ::Array[Docker::Container::HostConfig::Device], + dns: ::Array[String], + dns_options: ::Array[String], + dns_search: ::Array[String], + extra_hosts: ::Array[String], + group_add: ::Array[String], + init: bool?, + io_maximum_bandwidth: Integer, + io_maximum_i_ops: Integer, + ipc_mode: String, + isolation: Docker::Models::Container::HostConfig::isolation, + links: ::Array[String], + log_config: Docker::Container::HostConfig::LogConfig, + masked_paths: ::Array[String], + memory: Integer, + memory_reservation: Integer, + memory_swap: Integer, + memory_swappiness: Integer, + mounts: ::Array[Docker::Container::HostConfig::Mount], + nano_cpus: Integer, + network_mode: String, + oom_kill_disable: bool, + oom_score_adj: Integer, + pid_mode: String, + pids_limit: Integer?, + port_bindings: ::Hash[Symbol, ::Array[Docker::Container::HostConfig::PortBinding]], + privileged: bool, + publish_all_ports: bool, + readonly_paths: ::Array[String], + readonly_rootfs: bool, + restart_policy: Docker::Container::HostConfig::RestartPolicy, + runtime: String?, + security_opt: ::Array[String], + shm_size: Integer, + storage_opt: ::Hash[Symbol, String], + sysctls: ::Hash[Symbol, String]?, + tmpfs: ::Hash[Symbol, String], + ulimits: ::Array[Docker::Container::HostConfig::Ulimit], + userns_mode: String, + uts_mode: String, + volume_driver: String, + volumes_from: ::Array[String] + } + + class HostConfig < Docker::Internal::Type::BaseModel + attr_reader annotations: ::Hash[Symbol, String]? + + def annotations=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader auto_remove: bool? + + def auto_remove=: (bool) -> bool + + attr_reader binds: ::Array[String]? + + def binds=: (::Array[String]) -> ::Array[String] + + attr_reader blkio_device_read_bps: ::Array[Docker::Container::HostConfig::BlkioDeviceReadBp]? + + def blkio_device_read_bps=: ( + ::Array[Docker::Container::HostConfig::BlkioDeviceReadBp] + ) -> ::Array[Docker::Container::HostConfig::BlkioDeviceReadBp] + + attr_reader blkio_device_read_i_ops: ::Array[Docker::Container::HostConfig::BlkioDeviceReadIOp]? + + def blkio_device_read_i_ops=: ( + ::Array[Docker::Container::HostConfig::BlkioDeviceReadIOp] + ) -> ::Array[Docker::Container::HostConfig::BlkioDeviceReadIOp] + + attr_reader blkio_device_write_bps: ::Array[Docker::Container::HostConfig::BlkioDeviceWriteBp]? + + def blkio_device_write_bps=: ( + ::Array[Docker::Container::HostConfig::BlkioDeviceWriteBp] + ) -> ::Array[Docker::Container::HostConfig::BlkioDeviceWriteBp] + + attr_reader blkio_device_write_i_ops: ::Array[Docker::Container::HostConfig::BlkioDeviceWriteIOp]? + + def blkio_device_write_i_ops=: ( + ::Array[Docker::Container::HostConfig::BlkioDeviceWriteIOp] + ) -> ::Array[Docker::Container::HostConfig::BlkioDeviceWriteIOp] + + attr_reader blkio_weight: Integer? + + def blkio_weight=: (Integer) -> Integer + + attr_reader blkio_weight_device: ::Array[Docker::Container::HostConfig::BlkioWeightDevice]? + + def blkio_weight_device=: ( + ::Array[Docker::Container::HostConfig::BlkioWeightDevice] + ) -> ::Array[Docker::Container::HostConfig::BlkioWeightDevice] + + attr_reader cap_add: ::Array[String]? + + def cap_add=: (::Array[String]) -> ::Array[String] + + attr_reader cap_drop: ::Array[String]? + + def cap_drop=: (::Array[String]) -> ::Array[String] + + attr_reader cgroup: String? + + def cgroup=: (String) -> String + + attr_reader cgroupns_mode: Docker::Models::Container::HostConfig::cgroupns_mode? + + def cgroupns_mode=: ( + Docker::Models::Container::HostConfig::cgroupns_mode + ) -> Docker::Models::Container::HostConfig::cgroupns_mode + + attr_reader cgroup_parent: String? + + def cgroup_parent=: (String) -> String + + attr_accessor console_size: ::Array[Integer]? + + attr_reader container_id_file: String? + + def container_id_file=: (String) -> String + + attr_reader cpu_count: Integer? + + def cpu_count=: (Integer) -> Integer + + attr_reader cpu_percent: Integer? + + def cpu_percent=: (Integer) -> Integer + + attr_reader cpu_period: Integer? + + def cpu_period=: (Integer) -> Integer + + attr_reader cpu_quota: Integer? + + def cpu_quota=: (Integer) -> Integer + + attr_reader cpu_realtime_period: Integer? + + def cpu_realtime_period=: (Integer) -> Integer + + attr_reader cpu_realtime_runtime: Integer? + + def cpu_realtime_runtime=: (Integer) -> Integer + + attr_reader cpuset_cpus: String? + + def cpuset_cpus=: (String) -> String + + attr_reader cpuset_mems: String? + + def cpuset_mems=: (String) -> String + + attr_reader cpu_shares: Integer? + + def cpu_shares=: (Integer) -> Integer + + attr_reader device_cgroup_rules: ::Array[String]? + + def device_cgroup_rules=: (::Array[String]) -> ::Array[String] + + attr_reader device_requests: ::Array[Docker::Container::HostConfig::DeviceRequest]? + + def device_requests=: ( + ::Array[Docker::Container::HostConfig::DeviceRequest] + ) -> ::Array[Docker::Container::HostConfig::DeviceRequest] + + attr_reader devices: ::Array[Docker::Container::HostConfig::Device]? + + def devices=: ( + ::Array[Docker::Container::HostConfig::Device] + ) -> ::Array[Docker::Container::HostConfig::Device] + + attr_reader dns: ::Array[String]? + + def dns=: (::Array[String]) -> ::Array[String] + + attr_reader dns_options: ::Array[String]? + + def dns_options=: (::Array[String]) -> ::Array[String] + + attr_reader dns_search: ::Array[String]? + + def dns_search=: (::Array[String]) -> ::Array[String] + + attr_reader extra_hosts: ::Array[String]? + + def extra_hosts=: (::Array[String]) -> ::Array[String] + + attr_reader group_add: ::Array[String]? + + def group_add=: (::Array[String]) -> ::Array[String] + + attr_accessor init: bool? + + attr_reader io_maximum_bandwidth: Integer? + + def io_maximum_bandwidth=: (Integer) -> Integer + + attr_reader io_maximum_i_ops: Integer? + + def io_maximum_i_ops=: (Integer) -> Integer + + attr_reader ipc_mode: String? + + def ipc_mode=: (String) -> String + + attr_reader isolation: Docker::Models::Container::HostConfig::isolation? + + def isolation=: ( + Docker::Models::Container::HostConfig::isolation + ) -> Docker::Models::Container::HostConfig::isolation + + attr_reader links: ::Array[String]? + + def links=: (::Array[String]) -> ::Array[String] + + attr_reader log_config: Docker::Container::HostConfig::LogConfig? + + def log_config=: ( + Docker::Container::HostConfig::LogConfig + ) -> Docker::Container::HostConfig::LogConfig + + attr_reader masked_paths: ::Array[String]? + + def masked_paths=: (::Array[String]) -> ::Array[String] + + attr_reader memory: Integer? + + def memory=: (Integer) -> Integer + + attr_reader memory_reservation: Integer? + + def memory_reservation=: (Integer) -> Integer + + attr_reader memory_swap: Integer? + + def memory_swap=: (Integer) -> Integer + + attr_reader memory_swappiness: Integer? + + def memory_swappiness=: (Integer) -> Integer + + attr_reader mounts: ::Array[Docker::Container::HostConfig::Mount]? + + def mounts=: ( + ::Array[Docker::Container::HostConfig::Mount] + ) -> ::Array[Docker::Container::HostConfig::Mount] + + attr_reader nano_cpus: Integer? + + def nano_cpus=: (Integer) -> Integer + + attr_reader network_mode: String? + + def network_mode=: (String) -> String + + attr_reader oom_kill_disable: bool? + + def oom_kill_disable=: (bool) -> bool + + attr_reader oom_score_adj: Integer? + + def oom_score_adj=: (Integer) -> Integer + + attr_reader pid_mode: String? + + def pid_mode=: (String) -> String + + attr_accessor pids_limit: Integer? + + attr_reader port_bindings: ::Hash[Symbol, ::Array[Docker::Container::HostConfig::PortBinding]]? + + def port_bindings=: ( + ::Hash[Symbol, ::Array[Docker::Container::HostConfig::PortBinding]] + ) -> ::Hash[Symbol, ::Array[Docker::Container::HostConfig::PortBinding]] + + attr_reader privileged: bool? + + def privileged=: (bool) -> bool + + attr_reader publish_all_ports: bool? + + def publish_all_ports=: (bool) -> bool + + attr_reader readonly_paths: ::Array[String]? + + def readonly_paths=: (::Array[String]) -> ::Array[String] + + attr_reader readonly_rootfs: bool? + + def readonly_rootfs=: (bool) -> bool + + attr_reader restart_policy: Docker::Container::HostConfig::RestartPolicy? + + def restart_policy=: ( + Docker::Container::HostConfig::RestartPolicy + ) -> Docker::Container::HostConfig::RestartPolicy + + attr_accessor runtime: String? + + attr_reader security_opt: ::Array[String]? + + def security_opt=: (::Array[String]) -> ::Array[String] + + attr_reader shm_size: Integer? + + def shm_size=: (Integer) -> Integer + + attr_reader storage_opt: ::Hash[Symbol, String]? + + def storage_opt=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_accessor sysctls: ::Hash[Symbol, String]? + + attr_reader tmpfs: ::Hash[Symbol, String]? + + def tmpfs=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader ulimits: ::Array[Docker::Container::HostConfig::Ulimit]? + + def ulimits=: ( + ::Array[Docker::Container::HostConfig::Ulimit] + ) -> ::Array[Docker::Container::HostConfig::Ulimit] + + attr_reader userns_mode: String? + + def userns_mode=: (String) -> String + + attr_reader uts_mode: String? + + def uts_mode=: (String) -> String + + attr_reader volume_driver: String? + + def volume_driver=: (String) -> String + + attr_reader volumes_from: ::Array[String]? + + def volumes_from=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?annotations: ::Hash[Symbol, String], + ?auto_remove: bool, + ?binds: ::Array[String], + ?blkio_device_read_bps: ::Array[Docker::Container::HostConfig::BlkioDeviceReadBp], + ?blkio_device_read_i_ops: ::Array[Docker::Container::HostConfig::BlkioDeviceReadIOp], + ?blkio_device_write_bps: ::Array[Docker::Container::HostConfig::BlkioDeviceWriteBp], + ?blkio_device_write_i_ops: ::Array[Docker::Container::HostConfig::BlkioDeviceWriteIOp], + ?blkio_weight: Integer, + ?blkio_weight_device: ::Array[Docker::Container::HostConfig::BlkioWeightDevice], + ?cap_add: ::Array[String], + ?cap_drop: ::Array[String], + ?cgroup: String, + ?cgroupns_mode: Docker::Models::Container::HostConfig::cgroupns_mode, + ?cgroup_parent: String, + ?console_size: ::Array[Integer]?, + ?container_id_file: String, + ?cpu_count: Integer, + ?cpu_percent: Integer, + ?cpu_period: Integer, + ?cpu_quota: Integer, + ?cpu_realtime_period: Integer, + ?cpu_realtime_runtime: Integer, + ?cpuset_cpus: String, + ?cpuset_mems: String, + ?cpu_shares: Integer, + ?device_cgroup_rules: ::Array[String], + ?device_requests: ::Array[Docker::Container::HostConfig::DeviceRequest], + ?devices: ::Array[Docker::Container::HostConfig::Device], + ?dns: ::Array[String], + ?dns_options: ::Array[String], + ?dns_search: ::Array[String], + ?extra_hosts: ::Array[String], + ?group_add: ::Array[String], + ?init: bool?, + ?io_maximum_bandwidth: Integer, + ?io_maximum_i_ops: Integer, + ?ipc_mode: String, + ?isolation: Docker::Models::Container::HostConfig::isolation, + ?links: ::Array[String], + ?log_config: Docker::Container::HostConfig::LogConfig, + ?masked_paths: ::Array[String], + ?memory: Integer, + ?memory_reservation: Integer, + ?memory_swap: Integer, + ?memory_swappiness: Integer, + ?mounts: ::Array[Docker::Container::HostConfig::Mount], + ?nano_cpus: Integer, + ?network_mode: String, + ?oom_kill_disable: bool, + ?oom_score_adj: Integer, + ?pid_mode: String, + ?pids_limit: Integer?, + ?port_bindings: ::Hash[Symbol, ::Array[Docker::Container::HostConfig::PortBinding]], + ?privileged: bool, + ?publish_all_ports: bool, + ?readonly_paths: ::Array[String], + ?readonly_rootfs: bool, + ?restart_policy: Docker::Container::HostConfig::RestartPolicy, + ?runtime: String?, + ?security_opt: ::Array[String], + ?shm_size: Integer, + ?storage_opt: ::Hash[Symbol, String], + ?sysctls: ::Hash[Symbol, String]?, + ?tmpfs: ::Hash[Symbol, String], + ?ulimits: ::Array[Docker::Container::HostConfig::Ulimit], + ?userns_mode: String, + ?uts_mode: String, + ?volume_driver: String, + ?volumes_from: ::Array[String] + ) -> void + + def to_hash: -> { + annotations: ::Hash[Symbol, String], + auto_remove: bool, + binds: ::Array[String], + blkio_device_read_bps: ::Array[Docker::Container::HostConfig::BlkioDeviceReadBp], + blkio_device_read_i_ops: ::Array[Docker::Container::HostConfig::BlkioDeviceReadIOp], + blkio_device_write_bps: ::Array[Docker::Container::HostConfig::BlkioDeviceWriteBp], + blkio_device_write_i_ops: ::Array[Docker::Container::HostConfig::BlkioDeviceWriteIOp], + blkio_weight: Integer, + blkio_weight_device: ::Array[Docker::Container::HostConfig::BlkioWeightDevice], + cap_add: ::Array[String], + cap_drop: ::Array[String], + cgroup: String, + cgroupns_mode: Docker::Models::Container::HostConfig::cgroupns_mode, + cgroup_parent: String, + console_size: ::Array[Integer]?, + container_id_file: String, + cpu_count: Integer, + cpu_percent: Integer, + cpu_period: Integer, + cpu_quota: Integer, + cpu_realtime_period: Integer, + cpu_realtime_runtime: Integer, + cpuset_cpus: String, + cpuset_mems: String, + cpu_shares: Integer, + device_cgroup_rules: ::Array[String], + device_requests: ::Array[Docker::Container::HostConfig::DeviceRequest], + devices: ::Array[Docker::Container::HostConfig::Device], + dns: ::Array[String], + dns_options: ::Array[String], + dns_search: ::Array[String], + extra_hosts: ::Array[String], + group_add: ::Array[String], + init: bool?, + io_maximum_bandwidth: Integer, + io_maximum_i_ops: Integer, + ipc_mode: String, + isolation: Docker::Models::Container::HostConfig::isolation, + links: ::Array[String], + log_config: Docker::Container::HostConfig::LogConfig, + masked_paths: ::Array[String], + memory: Integer, + memory_reservation: Integer, + memory_swap: Integer, + memory_swappiness: Integer, + mounts: ::Array[Docker::Container::HostConfig::Mount], + nano_cpus: Integer, + network_mode: String, + oom_kill_disable: bool, + oom_score_adj: Integer, + pid_mode: String, + pids_limit: Integer?, + port_bindings: ::Hash[Symbol, ::Array[Docker::Container::HostConfig::PortBinding]], + privileged: bool, + publish_all_ports: bool, + readonly_paths: ::Array[String], + readonly_rootfs: bool, + restart_policy: Docker::Container::HostConfig::RestartPolicy, + runtime: String?, + security_opt: ::Array[String], + shm_size: Integer, + storage_opt: ::Hash[Symbol, String], + sysctls: ::Hash[Symbol, String]?, + tmpfs: ::Hash[Symbol, String], + ulimits: ::Array[Docker::Container::HostConfig::Ulimit], + userns_mode: String, + uts_mode: String, + volume_driver: String, + volumes_from: ::Array[String] + } + + type blkio_device_read_bp = { path: String, rate: Integer } + + class BlkioDeviceReadBp < Docker::Internal::Type::BaseModel + attr_reader path: String? + + def path=: (String) -> String + + attr_reader rate: Integer? + + def rate=: (Integer) -> Integer + + def initialize: (?path: String, ?rate: Integer) -> void + + def to_hash: -> { path: String, rate: Integer } + end + + type blkio_device_read_i_op = { path: String, rate: Integer } + + class BlkioDeviceReadIOp < Docker::Internal::Type::BaseModel + attr_reader path: String? + + def path=: (String) -> String + + attr_reader rate: Integer? + + def rate=: (Integer) -> Integer + + def initialize: (?path: String, ?rate: Integer) -> void + + def to_hash: -> { path: String, rate: Integer } + end + + type blkio_device_write_bp = { path: String, rate: Integer } + + class BlkioDeviceWriteBp < Docker::Internal::Type::BaseModel + attr_reader path: String? + + def path=: (String) -> String + + attr_reader rate: Integer? + + def rate=: (Integer) -> Integer + + def initialize: (?path: String, ?rate: Integer) -> void + + def to_hash: -> { path: String, rate: Integer } + end + + type blkio_device_write_i_op = { path: String, rate: Integer } + + class BlkioDeviceWriteIOp < Docker::Internal::Type::BaseModel + attr_reader path: String? + + def path=: (String) -> String + + attr_reader rate: Integer? + + def rate=: (Integer) -> Integer + + def initialize: (?path: String, ?rate: Integer) -> void + + def to_hash: -> { path: String, rate: Integer } + end + + type blkio_weight_device = { path: String, weight: Integer } + + class BlkioWeightDevice < Docker::Internal::Type::BaseModel + attr_reader path: String? + + def path=: (String) -> String + + attr_reader weight: Integer? + + def weight=: (Integer) -> Integer + + def initialize: (?path: String, ?weight: Integer) -> void + + def to_hash: -> { path: String, weight: Integer } + end + + type cgroupns_mode = :private | :host + + module CgroupnsMode + extend Docker::Internal::Type::Enum + + PRIVATE: :private + HOST: :host + + def self?.values: -> ::Array[Docker::Models::Container::HostConfig::cgroupns_mode] + end + + type device_request = + { + capabilities: ::Array[::Array[String]], + count: Integer, + device_ids: ::Array[String], + driver: String, + options: ::Hash[Symbol, String] + } + + class DeviceRequest < Docker::Internal::Type::BaseModel + attr_reader capabilities: ::Array[::Array[String]]? + + def capabilities=: ( + ::Array[::Array[String]] + ) -> ::Array[::Array[String]] + + attr_reader count: Integer? + + def count=: (Integer) -> Integer + + attr_reader device_ids: ::Array[String]? + + def device_ids=: (::Array[String]) -> ::Array[String] + + attr_reader driver: String? + + def driver=: (String) -> String + + attr_reader options: ::Hash[Symbol, String]? + + def options=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + def initialize: ( + ?capabilities: ::Array[::Array[String]], + ?count: Integer, + ?device_ids: ::Array[String], + ?driver: String, + ?options: ::Hash[Symbol, String] + ) -> void + + def to_hash: -> { + capabilities: ::Array[::Array[String]], + count: Integer, + device_ids: ::Array[String], + driver: String, + options: ::Hash[Symbol, String] + } + end + + type device = + { + cgroup_permissions: String, + path_in_container: String, + path_on_host: String + } + + class Device < Docker::Internal::Type::BaseModel + attr_reader cgroup_permissions: String? + + def cgroup_permissions=: (String) -> String + + attr_reader path_in_container: String? + + def path_in_container=: (String) -> String + + attr_reader path_on_host: String? + + def path_on_host=: (String) -> String + + def initialize: ( + ?cgroup_permissions: String, + ?path_in_container: String, + ?path_on_host: String + ) -> void + + def to_hash: -> { + cgroup_permissions: String, + path_in_container: String, + path_on_host: String + } + end + + type isolation = :default | :process | :hyperv | :"" + + module Isolation + extend Docker::Internal::Type::Enum + + DEFAULT: :default + PROCESS: :process + HYPERV: :hyperv + EMPTY: :"" + + def self?.values: -> ::Array[Docker::Models::Container::HostConfig::isolation] + end + + type log_config = + { + config: ::Hash[Symbol, String], + type: Docker::Models::Container::HostConfig::LogConfig::type_ + } + + class LogConfig < Docker::Internal::Type::BaseModel + attr_reader config: ::Hash[Symbol, String]? + + def config=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader type: Docker::Models::Container::HostConfig::LogConfig::type_? + + def type=: ( + Docker::Models::Container::HostConfig::LogConfig::type_ + ) -> Docker::Models::Container::HostConfig::LogConfig::type_ + + def initialize: ( + ?config: ::Hash[Symbol, String], + ?type: Docker::Models::Container::HostConfig::LogConfig::type_ + ) -> void + + def to_hash: -> { + config: ::Hash[Symbol, String], + type: Docker::Models::Container::HostConfig::LogConfig::type_ + } + + type type_ = + :local + | :"json-file" + | :syslog + | :journald + | :gelf + | :fluentd + | :awslogs + | :splunk + | :etwlogs + | :none + + module Type + extend Docker::Internal::Type::Enum + + LOCAL: :local + JSON_FILE: :"json-file" + SYSLOG: :syslog + JOURNALD: :journald + GELF: :gelf + FLUENTD: :fluentd + AWSLOGS: :awslogs + SPLUNK: :splunk + ETWLOGS: :etwlogs + NONE: :none + + def self?.values: -> ::Array[Docker::Models::Container::HostConfig::LogConfig::type_] + end + end + + type mount = + { + bind_options: Docker::Container::HostConfig::Mount::BindOptions, + consistency: String, + image_options: Docker::Container::HostConfig::Mount::ImageOptions, + read_only: bool, + source: String, + target: String, + tmpfs_options: Docker::Container::HostConfig::Mount::TmpfsOptions, + type: Docker::Models::Container::HostConfig::Mount::type_, + volume_options: Docker::Container::HostConfig::Mount::VolumeOptions + } + + class Mount < Docker::Internal::Type::BaseModel + attr_reader bind_options: Docker::Container::HostConfig::Mount::BindOptions? + + def bind_options=: ( + Docker::Container::HostConfig::Mount::BindOptions + ) -> Docker::Container::HostConfig::Mount::BindOptions + + attr_reader consistency: String? + + def consistency=: (String) -> String + + attr_reader image_options: Docker::Container::HostConfig::Mount::ImageOptions? + + def image_options=: ( + Docker::Container::HostConfig::Mount::ImageOptions + ) -> Docker::Container::HostConfig::Mount::ImageOptions + + attr_reader read_only: bool? + + def read_only=: (bool) -> bool + + attr_reader source: String? + + def source=: (String) -> String + + attr_reader target: String? + + def target=: (String) -> String + + attr_reader tmpfs_options: Docker::Container::HostConfig::Mount::TmpfsOptions? + + def tmpfs_options=: ( + Docker::Container::HostConfig::Mount::TmpfsOptions + ) -> Docker::Container::HostConfig::Mount::TmpfsOptions + + attr_reader type: Docker::Models::Container::HostConfig::Mount::type_? + + def type=: ( + Docker::Models::Container::HostConfig::Mount::type_ + ) -> Docker::Models::Container::HostConfig::Mount::type_ + + attr_reader volume_options: Docker::Container::HostConfig::Mount::VolumeOptions? + + def volume_options=: ( + Docker::Container::HostConfig::Mount::VolumeOptions + ) -> Docker::Container::HostConfig::Mount::VolumeOptions + + def initialize: ( + ?bind_options: Docker::Container::HostConfig::Mount::BindOptions, + ?consistency: String, + ?image_options: Docker::Container::HostConfig::Mount::ImageOptions, + ?read_only: bool, + ?source: String, + ?target: String, + ?tmpfs_options: Docker::Container::HostConfig::Mount::TmpfsOptions, + ?type: Docker::Models::Container::HostConfig::Mount::type_, + ?volume_options: Docker::Container::HostConfig::Mount::VolumeOptions + ) -> void + + def to_hash: -> { + bind_options: Docker::Container::HostConfig::Mount::BindOptions, + consistency: String, + image_options: Docker::Container::HostConfig::Mount::ImageOptions, + read_only: bool, + source: String, + target: String, + tmpfs_options: Docker::Container::HostConfig::Mount::TmpfsOptions, + type: Docker::Models::Container::HostConfig::Mount::type_, + volume_options: Docker::Container::HostConfig::Mount::VolumeOptions + } + + type bind_options = + { + create_mountpoint: bool, + non_recursive: bool, + propagation: Docker::Models::Container::HostConfig::Mount::BindOptions::propagation, + read_only_force_recursive: bool, + read_only_non_recursive: bool + } + + class BindOptions < Docker::Internal::Type::BaseModel + attr_reader create_mountpoint: bool? + + def create_mountpoint=: (bool) -> bool + + attr_reader non_recursive: bool? + + def non_recursive=: (bool) -> bool + + attr_reader propagation: Docker::Models::Container::HostConfig::Mount::BindOptions::propagation? + + def propagation=: ( + Docker::Models::Container::HostConfig::Mount::BindOptions::propagation + ) -> Docker::Models::Container::HostConfig::Mount::BindOptions::propagation + + attr_reader read_only_force_recursive: bool? + + def read_only_force_recursive=: (bool) -> bool + + attr_reader read_only_non_recursive: bool? + + def read_only_non_recursive=: (bool) -> bool + + def initialize: ( + ?create_mountpoint: bool, + ?non_recursive: bool, + ?propagation: Docker::Models::Container::HostConfig::Mount::BindOptions::propagation, + ?read_only_force_recursive: bool, + ?read_only_non_recursive: bool + ) -> void + + def to_hash: -> { + create_mountpoint: bool, + non_recursive: bool, + propagation: Docker::Models::Container::HostConfig::Mount::BindOptions::propagation, + read_only_force_recursive: bool, + read_only_non_recursive: bool + } + + type propagation = + :private | :rprivate | :shared | :rshared | :slave | :rslave + + module Propagation + extend Docker::Internal::Type::Enum + + PRIVATE: :private + RPRIVATE: :rprivate + SHARED: :shared + RSHARED: :rshared + SLAVE: :slave + RSLAVE: :rslave + + def self?.values: -> ::Array[Docker::Models::Container::HostConfig::Mount::BindOptions::propagation] + end + end + + type image_options = { subpath: String } + + class ImageOptions < Docker::Internal::Type::BaseModel + attr_reader subpath: String? + + def subpath=: (String) -> String + + def initialize: (?subpath: String) -> void + + def to_hash: -> { subpath: String } + end + + type tmpfs_options = + { + mode: Integer, + options: ::Array[::Array[String]], + size_bytes: Integer + } + + class TmpfsOptions < Docker::Internal::Type::BaseModel + attr_reader mode: Integer? + + def mode=: (Integer) -> Integer + + attr_reader options: ::Array[::Array[String]]? + + def options=: (::Array[::Array[String]]) -> ::Array[::Array[String]] + + attr_reader size_bytes: Integer? + + def size_bytes=: (Integer) -> Integer + + def initialize: ( + ?mode: Integer, + ?options: ::Array[::Array[String]], + ?size_bytes: Integer + ) -> void + + def to_hash: -> { + mode: Integer, + options: ::Array[::Array[String]], + size_bytes: Integer + } + end + + type type_ = :bind | :cluster | :image | :npipe | :tmpfs | :volume + + module Type + extend Docker::Internal::Type::Enum + + BIND: :bind + CLUSTER: :cluster + IMAGE: :image + NPIPE: :npipe + TMPFS: :tmpfs + VOLUME: :volume + + def self?.values: -> ::Array[Docker::Models::Container::HostConfig::Mount::type_] + end + + type volume_options = + { + driver_config: Docker::Container::HostConfig::Mount::VolumeOptions::DriverConfig, + labels: ::Hash[Symbol, String], + no_copy: bool, + subpath: String + } + + class VolumeOptions < Docker::Internal::Type::BaseModel + attr_reader driver_config: Docker::Container::HostConfig::Mount::VolumeOptions::DriverConfig? + + def driver_config=: ( + Docker::Container::HostConfig::Mount::VolumeOptions::DriverConfig + ) -> Docker::Container::HostConfig::Mount::VolumeOptions::DriverConfig + + attr_reader labels: ::Hash[Symbol, String]? + + def labels=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader no_copy: bool? + + def no_copy=: (bool) -> bool + + attr_reader subpath: String? + + def subpath=: (String) -> String + + def initialize: ( + ?driver_config: Docker::Container::HostConfig::Mount::VolumeOptions::DriverConfig, + ?labels: ::Hash[Symbol, String], + ?no_copy: bool, + ?subpath: String + ) -> void + + def to_hash: -> { + driver_config: Docker::Container::HostConfig::Mount::VolumeOptions::DriverConfig, + labels: ::Hash[Symbol, String], + no_copy: bool, + subpath: String + } + + type driver_config = + { name: String, options: ::Hash[Symbol, String] } + + class DriverConfig < Docker::Internal::Type::BaseModel + attr_reader name: String? + + def name=: (String) -> String + + attr_reader options: ::Hash[Symbol, String]? + + def options=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + def initialize: ( + ?name: String, + ?options: ::Hash[Symbol, String] + ) -> void + + def to_hash: -> { name: String, options: ::Hash[Symbol, String] } + end + end + end + + type port_binding = { host_ip: String, host_port: String } + + class PortBinding < Docker::Internal::Type::BaseModel + attr_reader host_ip: String? + + def host_ip=: (String) -> String + + attr_reader host_port: String? + + def host_port=: (String) -> String + + def initialize: (?host_ip: String, ?host_port: String) -> void + + def to_hash: -> { host_ip: String, host_port: String } + end + + type restart_policy = + { + maximum_retry_count: Integer, + name: Docker::Models::Container::HostConfig::RestartPolicy::name_ + } + + class RestartPolicy < Docker::Internal::Type::BaseModel + attr_reader maximum_retry_count: Integer? + + def maximum_retry_count=: (Integer) -> Integer + + attr_reader name: Docker::Models::Container::HostConfig::RestartPolicy::name_? + + def name=: ( + Docker::Models::Container::HostConfig::RestartPolicy::name_ + ) -> Docker::Models::Container::HostConfig::RestartPolicy::name_ + + def initialize: ( + ?maximum_retry_count: Integer, + ?name: Docker::Models::Container::HostConfig::RestartPolicy::name_ + ) -> void + + def to_hash: -> { + maximum_retry_count: Integer, + name: Docker::Models::Container::HostConfig::RestartPolicy::name_ + } + + type name_ = :"" | :no | :always | :"unless-stopped" | :"on-failure" + + module Name + extend Docker::Internal::Type::Enum + + EMPTY: :"" + NO: :no + ALWAYS: :always + UNLESS_STOPPED: :"unless-stopped" + ON_FAILURE: :"on-failure" + + def self?.values: -> ::Array[Docker::Models::Container::HostConfig::RestartPolicy::name_] + end + end + + type ulimit = { hard: Integer, name: String, soft: Integer } + + class Ulimit < Docker::Internal::Type::BaseModel + attr_reader hard: Integer? + + def hard=: (Integer) -> Integer + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader soft: Integer? + + def soft=: (Integer) -> Integer + + def initialize: ( + ?hard: Integer, + ?name: String, + ?soft: Integer + ) -> void + + def to_hash: -> { hard: Integer, name: String, soft: Integer } + end + end + + type image_manifest_descriptor = + { + annotations: ::Hash[Symbol, String]?, + artifact_type: String?, + data: String?, + digest: String, + media_type: String, + platform: Docker::Container::ImageManifestDescriptor::Platform?, + size: Integer, + urls: ::Array[String]? + } + + class ImageManifestDescriptor < Docker::Internal::Type::BaseModel + attr_accessor annotations: ::Hash[Symbol, String]? + + attr_accessor artifact_type: String? + + attr_accessor data: String? + + attr_reader digest: String? + + def digest=: (String) -> String + + attr_reader media_type: String? + + def media_type=: (String) -> String + + attr_accessor platform: Docker::Container::ImageManifestDescriptor::Platform? + + attr_reader size: Integer? + + def size=: (Integer) -> Integer + + attr_accessor urls: ::Array[String]? + + def initialize: ( + ?annotations: ::Hash[Symbol, String]?, + ?artifact_type: String?, + ?data: String?, + ?digest: String, + ?media_type: String, + ?platform: Docker::Container::ImageManifestDescriptor::Platform?, + ?size: Integer, + ?urls: ::Array[String]? + ) -> void + + def to_hash: -> { + annotations: ::Hash[Symbol, String]?, + artifact_type: String?, + data: String?, + digest: String, + media_type: String, + platform: Docker::Container::ImageManifestDescriptor::Platform?, + size: Integer, + urls: ::Array[String]? + } + + type platform = + { + architecture: String, + os: String, + os_features: ::Array[String], + os_version: String, + variant: String + } + + class Platform < Docker::Internal::Type::BaseModel + attr_reader architecture: String? + + def architecture=: (String) -> String + + attr_reader os: String? + + def os=: (String) -> String + + attr_reader os_features: ::Array[String]? + + def os_features=: (::Array[String]) -> ::Array[String] + + attr_reader os_version: String? + + def os_version=: (String) -> String + + attr_reader variant: String? + + def variant=: (String) -> String + + def initialize: ( + ?architecture: String, + ?os: String, + ?os_features: ::Array[String], + ?os_version: String, + ?variant: String + ) -> void + + def to_hash: -> { + architecture: String, + os: String, + os_features: ::Array[String], + os_version: String, + variant: String + } + end + end + + type mount = + { + destination: String, + driver: String, + mode: String, + name: String, + propagation: String, + rw: bool, + source: String, + type: Docker::Models::Container::Mount::type_ + } + + class Mount < Docker::Internal::Type::BaseModel + attr_reader destination: String? + + def destination=: (String) -> String + + attr_reader driver: String? + + def driver=: (String) -> String + + attr_reader mode: String? + + def mode=: (String) -> String + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader propagation: String? + + def propagation=: (String) -> String + + attr_reader rw: bool? + + def rw=: (bool) -> bool + + attr_reader source: String? + + def source=: (String) -> String + + attr_reader type: Docker::Models::Container::Mount::type_? + + def type=: ( + Docker::Models::Container::Mount::type_ + ) -> Docker::Models::Container::Mount::type_ + + def initialize: ( + ?destination: String, + ?driver: String, + ?mode: String, + ?name: String, + ?propagation: String, + ?rw: bool, + ?source: String, + ?type: Docker::Models::Container::Mount::type_ + ) -> void + + def to_hash: -> { + destination: String, + driver: String, + mode: String, + name: String, + propagation: String, + rw: bool, + source: String, + type: Docker::Models::Container::Mount::type_ + } + + type type_ = :bind | :cluster | :image | :npipe | :tmpfs | :volume + + module Type + extend Docker::Internal::Type::Enum + + BIND: :bind + CLUSTER: :cluster + IMAGE: :image + NPIPE: :npipe + TMPFS: :tmpfs + VOLUME: :volume + + def self?.values: -> ::Array[Docker::Models::Container::Mount::type_] + end + end + + type network_settings = + { + networks: ::Hash[Symbol, Docker::Container::NetworkSettings::Network], + ports: ::Hash[Symbol, ::Array[Docker::Container::NetworkSettings::Port]], + sandbox_id: String, + sandbox_key: String + } + + class NetworkSettings < Docker::Internal::Type::BaseModel + attr_reader networks: ::Hash[Symbol, Docker::Container::NetworkSettings::Network]? + + def networks=: ( + ::Hash[Symbol, Docker::Container::NetworkSettings::Network] + ) -> ::Hash[Symbol, Docker::Container::NetworkSettings::Network] + + attr_reader ports: ::Hash[Symbol, ::Array[Docker::Container::NetworkSettings::Port]]? + + def ports=: ( + ::Hash[Symbol, ::Array[Docker::Container::NetworkSettings::Port]] + ) -> ::Hash[Symbol, ::Array[Docker::Container::NetworkSettings::Port]] + + attr_reader sandbox_id: String? + + def sandbox_id=: (String) -> String + + attr_reader sandbox_key: String? + + def sandbox_key=: (String) -> String + + def initialize: ( + ?networks: ::Hash[Symbol, Docker::Container::NetworkSettings::Network], + ?ports: ::Hash[Symbol, ::Array[Docker::Container::NetworkSettings::Port]], + ?sandbox_id: String, + ?sandbox_key: String + ) -> void + + def to_hash: -> { + networks: ::Hash[Symbol, Docker::Container::NetworkSettings::Network], + ports: ::Hash[Symbol, ::Array[Docker::Container::NetworkSettings::Port]], + sandbox_id: String, + sandbox_key: String + } + + type network = + { + aliases: ::Array[String], + dns_names: ::Array[String], + driver_opts: ::Hash[Symbol, String]?, + endpoint_id: String, + gateway: String, + :global_i_pv6_address => String, + :global_i_pv6_prefix_len => Integer, + gw_priority: Integer, + ip_address: String, + ipam_config: Docker::Container::NetworkSettings::Network::IpamConfig?, + ip_prefix_len: Integer, + :i_pv6_gateway => String, + links: ::Array[String], + mac_address: String, + network_id: String + } + + class Network < Docker::Internal::Type::BaseModel + attr_reader aliases: ::Array[String]? + + def aliases=: (::Array[String]) -> ::Array[String] + + attr_reader dns_names: ::Array[String]? + + def dns_names=: (::Array[String]) -> ::Array[String] + + attr_accessor driver_opts: ::Hash[Symbol, String]? + + attr_reader endpoint_id: String? + + def endpoint_id=: (String) -> String + + attr_reader gateway: String? + + def gateway=: (String) -> String + + attr_reader global_i_pv6_address: String? + + def global_i_pv6_address=: (String) -> String + + attr_reader global_i_pv6_prefix_len: Integer? + + def global_i_pv6_prefix_len=: (Integer) -> Integer + + attr_reader gw_priority: Integer? + + def gw_priority=: (Integer) -> Integer + + attr_reader ip_address: String? + + def ip_address=: (String) -> String + + attr_accessor ipam_config: Docker::Container::NetworkSettings::Network::IpamConfig? + + attr_reader ip_prefix_len: Integer? + + def ip_prefix_len=: (Integer) -> Integer + + attr_reader i_pv6_gateway: String? + + def i_pv6_gateway=: (String) -> String + + attr_reader links: ::Array[String]? + + def links=: (::Array[String]) -> ::Array[String] + + attr_reader mac_address: String? + + def mac_address=: (String) -> String + + attr_reader network_id: String? + + def network_id=: (String) -> String + + def initialize: ( + ?aliases: ::Array[String], + ?dns_names: ::Array[String], + ?driver_opts: ::Hash[Symbol, String]?, + ?endpoint_id: String, + ?gateway: String, + ?global_i_pv6_address: String, + ?global_i_pv6_prefix_len: Integer, + ?gw_priority: Integer, + ?ip_address: String, + ?ipam_config: Docker::Container::NetworkSettings::Network::IpamConfig?, + ?ip_prefix_len: Integer, + ?i_pv6_gateway: String, + ?links: ::Array[String], + ?mac_address: String, + ?network_id: String + ) -> void + + def to_hash: -> { + aliases: ::Array[String], + dns_names: ::Array[String], + driver_opts: ::Hash[Symbol, String]?, + endpoint_id: String, + gateway: String, + :global_i_pv6_address => String, + :global_i_pv6_prefix_len => Integer, + gw_priority: Integer, + ip_address: String, + ipam_config: Docker::Container::NetworkSettings::Network::IpamConfig?, + ip_prefix_len: Integer, + :i_pv6_gateway => String, + links: ::Array[String], + mac_address: String, + network_id: String + } + + type ipam_config = + { + :i_pv4_address => String, + :i_pv6_address => String, + link_local_ips: ::Array[String] + } + + class IpamConfig < Docker::Internal::Type::BaseModel + attr_reader i_pv4_address: String? + + def i_pv4_address=: (String) -> String + + attr_reader i_pv6_address: String? + + def i_pv6_address=: (String) -> String + + attr_reader link_local_ips: ::Array[String]? + + def link_local_ips=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?i_pv4_address: String, + ?i_pv6_address: String, + ?link_local_ips: ::Array[String] + ) -> void + + def to_hash: -> { + :i_pv4_address => String, + :i_pv6_address => String, + link_local_ips: ::Array[String] + } + end + end + + type port = { host_ip: String, host_port: String } + + class Port < Docker::Internal::Type::BaseModel + attr_reader host_ip: String? + + def host_ip=: (String) -> String + + attr_reader host_port: String? + + def host_port=: (String) -> String + + def initialize: (?host_ip: String, ?host_port: String) -> void + + def to_hash: -> { host_ip: String, host_port: String } + end + end + + type state = + { + dead: bool, + error: String, + exit_code: Integer, + finished_at: String, + health: Docker::Container::State::Health?, + oom_killed: bool, + paused: bool, + pid: Integer, + restarting: bool, + running: bool, + started_at: String, + status: Docker::Models::Container::State::status + } + + class State < Docker::Internal::Type::BaseModel + attr_reader dead: bool? + + def dead=: (bool) -> bool + + attr_reader error: String? + + def error=: (String) -> String + + attr_reader exit_code: Integer? + + def exit_code=: (Integer) -> Integer + + attr_reader finished_at: String? + + def finished_at=: (String) -> String + + attr_accessor health: Docker::Container::State::Health? + + attr_reader oom_killed: bool? + + def oom_killed=: (bool) -> bool + + attr_reader paused: bool? + + def paused=: (bool) -> bool + + attr_reader pid: Integer? + + def pid=: (Integer) -> Integer + + attr_reader restarting: bool? + + def restarting=: (bool) -> bool + + attr_reader running: bool? + + def running=: (bool) -> bool + + attr_reader started_at: String? + + def started_at=: (String) -> String + + attr_reader status: Docker::Models::Container::State::status? + + def status=: ( + Docker::Models::Container::State::status + ) -> Docker::Models::Container::State::status + + def initialize: ( + ?dead: bool, + ?error: String, + ?exit_code: Integer, + ?finished_at: String, + ?health: Docker::Container::State::Health?, + ?oom_killed: bool, + ?paused: bool, + ?pid: Integer, + ?restarting: bool, + ?running: bool, + ?started_at: String, + ?status: Docker::Models::Container::State::status + ) -> void + + def to_hash: -> { + dead: bool, + error: String, + exit_code: Integer, + finished_at: String, + health: Docker::Container::State::Health?, + oom_killed: bool, + paused: bool, + pid: Integer, + restarting: bool, + running: bool, + started_at: String, + status: Docker::Models::Container::State::status + } + + type health = + { + failing_streak: Integer, + log: ::Array[Docker::Container::State::Health::Log?], + status: Docker::Models::Container::State::Health::status + } + + class Health < Docker::Internal::Type::BaseModel + attr_reader failing_streak: Integer? + + def failing_streak=: (Integer) -> Integer + + attr_reader log: ::Array[Docker::Container::State::Health::Log?]? + + def log=: ( + ::Array[Docker::Container::State::Health::Log?] + ) -> ::Array[Docker::Container::State::Health::Log?] + + attr_reader status: Docker::Models::Container::State::Health::status? + + def status=: ( + Docker::Models::Container::State::Health::status + ) -> Docker::Models::Container::State::Health::status + + def initialize: ( + ?failing_streak: Integer, + ?log: ::Array[Docker::Container::State::Health::Log?], + ?status: Docker::Models::Container::State::Health::status + ) -> void + + def to_hash: -> { + failing_streak: Integer, + log: ::Array[Docker::Container::State::Health::Log?], + status: Docker::Models::Container::State::Health::status + } + + type log = + { end_: String, exit_code: Integer, output: String, start: Time } + + class Log < Docker::Internal::Type::BaseModel + attr_reader end_: String? + + def end_=: (String) -> String + + attr_reader exit_code: Integer? + + def exit_code=: (Integer) -> Integer + + attr_reader output: String? + + def output=: (String) -> String + + attr_reader start: Time? + + def start=: (Time) -> Time + + def initialize: ( + ?end_: String, + ?exit_code: Integer, + ?output: String, + ?start: Time + ) -> void + + def to_hash: -> { + end_: String, + exit_code: Integer, + output: String, + start: Time + } + end + + type status = :none | :starting | :healthy | :unhealthy + + module Status + extend Docker::Internal::Type::Enum + + NONE: :none + STARTING: :starting + HEALTHY: :healthy + UNHEALTHY: :unhealthy + + def self?.values: -> ::Array[Docker::Models::Container::State::Health::status] + end + end + + type status = + :created + | :running + | :paused + | :restarting + | :removing + | :exited + | :dead + + module Status + extend Docker::Internal::Type::Enum + + CREATED: :created + RUNNING: :running + PAUSED: :paused + RESTARTING: :restarting + REMOVING: :removing + EXITED: :exited + DEAD: :dead + + def self?.values: -> ::Array[Docker::Models::Container::State::status] + end + end + + type storage = { root_fs: Docker::Container::Storage::RootFs } + + class Storage < Docker::Internal::Type::BaseModel + attr_reader root_fs: Docker::Container::Storage::RootFs? + + def root_fs=: ( + Docker::Container::Storage::RootFs + ) -> Docker::Container::Storage::RootFs + + def initialize: (?root_fs: Docker::Container::Storage::RootFs) -> void + + def to_hash: -> { root_fs: Docker::Container::Storage::RootFs } + + type root_fs = + { snapshot: Docker::Container::Storage::RootFs::Snapshot } + + class RootFs < Docker::Internal::Type::BaseModel + attr_reader snapshot: Docker::Container::Storage::RootFs::Snapshot? + + def snapshot=: ( + Docker::Container::Storage::RootFs::Snapshot + ) -> Docker::Container::Storage::RootFs::Snapshot + + def initialize: ( + ?snapshot: Docker::Container::Storage::RootFs::Snapshot + ) -> void + + def to_hash: -> { + snapshot: Docker::Container::Storage::RootFs::Snapshot + } + + type snapshot = { name: String } + + class Snapshot < Docker::Internal::Type::BaseModel + attr_reader name: String? + + def name=: (String) -> String + + def initialize: (?name: String) -> void + + def to_hash: -> { name: String } + end + end + end + end + end +end diff --git a/sig/docker/models/container_create_params.rbs b/sig/docker/models/container_create_params.rbs new file mode 100644 index 0000000..7d8e79e --- /dev/null +++ b/sig/docker/models/container_create_params.rbs @@ -0,0 +1,1352 @@ +module Docker + module Models + type container_create_params = + { + config: Docker::ContainerCreateParams::Config, + name: String, + platform: String + } + & Docker::Internal::Type::request_parameters + + class ContainerCreateParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_accessor config: Docker::ContainerCreateParams::Config + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader platform: String? + + def platform=: (String) -> String + + def initialize: ( + config: Docker::ContainerCreateParams::Config, + ?name: String, + ?platform: String, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + config: Docker::ContainerCreateParams::Config, + name: String, + platform: String, + request_options: Docker::RequestOptions + } + + type config = + { + host_config: Docker::ContainerCreateParams::Config::HostConfig, + networking_config: Docker::ContainerCreateParams::Config::NetworkingConfig + } + + class Config < Docker::Models::Config + def host_config: -> Docker::ContainerCreateParams::Config::HostConfig? + + def host_config=: ( + Docker::ContainerCreateParams::Config::HostConfig _ + ) -> Docker::ContainerCreateParams::Config::HostConfig + + def networking_config: -> Docker::ContainerCreateParams::Config::NetworkingConfig? + + def networking_config=: ( + Docker::ContainerCreateParams::Config::NetworkingConfig _ + ) -> Docker::ContainerCreateParams::Config::NetworkingConfig + + def initialize: ( + ?host_config: Docker::ContainerCreateParams::Config::HostConfig, + ?networking_config: Docker::ContainerCreateParams::Config::NetworkingConfig + ) -> void + + def to_hash: -> { + host_config: Docker::ContainerCreateParams::Config::HostConfig, + networking_config: Docker::ContainerCreateParams::Config::NetworkingConfig + } + + type host_config = + { + annotations: ::Hash[Symbol, String], + auto_remove: bool, + binds: ::Array[String], + blkio_device_read_bps: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadBp], + blkio_device_read_i_ops: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadIOp], + blkio_device_write_bps: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteBp], + blkio_device_write_i_ops: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteIOp], + blkio_weight: Integer, + blkio_weight_device: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioWeightDevice], + cap_add: ::Array[String], + cap_drop: ::Array[String], + cgroup: String, + cgroupns_mode: Docker::Models::ContainerCreateParams::Config::HostConfig::cgroupns_mode, + cgroup_parent: String, + console_size: ::Array[Integer]?, + container_id_file: String, + cpu_count: Integer, + cpu_percent: Integer, + cpu_period: Integer, + cpu_quota: Integer, + cpu_realtime_period: Integer, + cpu_realtime_runtime: Integer, + cpuset_cpus: String, + cpuset_mems: String, + cpu_shares: Integer, + device_cgroup_rules: ::Array[String], + device_requests: ::Array[Docker::ContainerCreateParams::Config::HostConfig::DeviceRequest], + devices: ::Array[Docker::ContainerCreateParams::Config::HostConfig::Device], + dns: ::Array[String], + dns_options: ::Array[String], + dns_search: ::Array[String], + extra_hosts: ::Array[String], + group_add: ::Array[String], + init: bool?, + io_maximum_bandwidth: Integer, + io_maximum_i_ops: Integer, + ipc_mode: String, + isolation: Docker::Models::ContainerCreateParams::Config::HostConfig::isolation, + links: ::Array[String], + log_config: Docker::ContainerCreateParams::Config::HostConfig::LogConfig, + masked_paths: ::Array[String], + memory: Integer, + memory_reservation: Integer, + memory_swap: Integer, + memory_swappiness: Integer, + mounts: ::Array[Docker::ContainerCreateParams::Config::HostConfig::Mount], + nano_cpus: Integer, + network_mode: String, + oom_kill_disable: bool, + oom_score_adj: Integer, + pid_mode: String, + pids_limit: Integer?, + port_bindings: ::Hash[Symbol, ::Array[Docker::ContainerCreateParams::Config::HostConfig::PortBinding]], + privileged: bool, + publish_all_ports: bool, + readonly_paths: ::Array[String], + readonly_rootfs: bool, + restart_policy: Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy, + runtime: String?, + security_opt: ::Array[String], + shm_size: Integer, + storage_opt: ::Hash[Symbol, String], + sysctls: ::Hash[Symbol, String]?, + tmpfs: ::Hash[Symbol, String], + ulimits: ::Array[Docker::ContainerCreateParams::Config::HostConfig::Ulimit], + userns_mode: String, + uts_mode: String, + volume_driver: String, + volumes_from: ::Array[String] + } + + class HostConfig < Docker::Internal::Type::BaseModel + attr_reader annotations: ::Hash[Symbol, String]? + + def annotations=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader auto_remove: bool? + + def auto_remove=: (bool) -> bool + + attr_reader binds: ::Array[String]? + + def binds=: (::Array[String]) -> ::Array[String] + + attr_reader blkio_device_read_bps: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadBp]? + + def blkio_device_read_bps=: ( + ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadBp] + ) -> ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadBp] + + attr_reader blkio_device_read_i_ops: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadIOp]? + + def blkio_device_read_i_ops=: ( + ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadIOp] + ) -> ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadIOp] + + attr_reader blkio_device_write_bps: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteBp]? + + def blkio_device_write_bps=: ( + ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteBp] + ) -> ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteBp] + + attr_reader blkio_device_write_i_ops: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteIOp]? + + def blkio_device_write_i_ops=: ( + ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteIOp] + ) -> ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteIOp] + + attr_reader blkio_weight: Integer? + + def blkio_weight=: (Integer) -> Integer + + attr_reader blkio_weight_device: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioWeightDevice]? + + def blkio_weight_device=: ( + ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioWeightDevice] + ) -> ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioWeightDevice] + + attr_reader cap_add: ::Array[String]? + + def cap_add=: (::Array[String]) -> ::Array[String] + + attr_reader cap_drop: ::Array[String]? + + def cap_drop=: (::Array[String]) -> ::Array[String] + + attr_reader cgroup: String? + + def cgroup=: (String) -> String + + attr_reader cgroupns_mode: Docker::Models::ContainerCreateParams::Config::HostConfig::cgroupns_mode? + + def cgroupns_mode=: ( + Docker::Models::ContainerCreateParams::Config::HostConfig::cgroupns_mode + ) -> Docker::Models::ContainerCreateParams::Config::HostConfig::cgroupns_mode + + attr_reader cgroup_parent: String? + + def cgroup_parent=: (String) -> String + + attr_accessor console_size: ::Array[Integer]? + + attr_reader container_id_file: String? + + def container_id_file=: (String) -> String + + attr_reader cpu_count: Integer? + + def cpu_count=: (Integer) -> Integer + + attr_reader cpu_percent: Integer? + + def cpu_percent=: (Integer) -> Integer + + attr_reader cpu_period: Integer? + + def cpu_period=: (Integer) -> Integer + + attr_reader cpu_quota: Integer? + + def cpu_quota=: (Integer) -> Integer + + attr_reader cpu_realtime_period: Integer? + + def cpu_realtime_period=: (Integer) -> Integer + + attr_reader cpu_realtime_runtime: Integer? + + def cpu_realtime_runtime=: (Integer) -> Integer + + attr_reader cpuset_cpus: String? + + def cpuset_cpus=: (String) -> String + + attr_reader cpuset_mems: String? + + def cpuset_mems=: (String) -> String + + attr_reader cpu_shares: Integer? + + def cpu_shares=: (Integer) -> Integer + + attr_reader device_cgroup_rules: ::Array[String]? + + def device_cgroup_rules=: (::Array[String]) -> ::Array[String] + + attr_reader device_requests: ::Array[Docker::ContainerCreateParams::Config::HostConfig::DeviceRequest]? + + def device_requests=: ( + ::Array[Docker::ContainerCreateParams::Config::HostConfig::DeviceRequest] + ) -> ::Array[Docker::ContainerCreateParams::Config::HostConfig::DeviceRequest] + + attr_reader devices: ::Array[Docker::ContainerCreateParams::Config::HostConfig::Device]? + + def devices=: ( + ::Array[Docker::ContainerCreateParams::Config::HostConfig::Device] + ) -> ::Array[Docker::ContainerCreateParams::Config::HostConfig::Device] + + attr_reader dns: ::Array[String]? + + def dns=: (::Array[String]) -> ::Array[String] + + attr_reader dns_options: ::Array[String]? + + def dns_options=: (::Array[String]) -> ::Array[String] + + attr_reader dns_search: ::Array[String]? + + def dns_search=: (::Array[String]) -> ::Array[String] + + attr_reader extra_hosts: ::Array[String]? + + def extra_hosts=: (::Array[String]) -> ::Array[String] + + attr_reader group_add: ::Array[String]? + + def group_add=: (::Array[String]) -> ::Array[String] + + attr_accessor init: bool? + + attr_reader io_maximum_bandwidth: Integer? + + def io_maximum_bandwidth=: (Integer) -> Integer + + attr_reader io_maximum_i_ops: Integer? + + def io_maximum_i_ops=: (Integer) -> Integer + + attr_reader ipc_mode: String? + + def ipc_mode=: (String) -> String + + attr_reader isolation: Docker::Models::ContainerCreateParams::Config::HostConfig::isolation? + + def isolation=: ( + Docker::Models::ContainerCreateParams::Config::HostConfig::isolation + ) -> Docker::Models::ContainerCreateParams::Config::HostConfig::isolation + + attr_reader links: ::Array[String]? + + def links=: (::Array[String]) -> ::Array[String] + + attr_reader log_config: Docker::ContainerCreateParams::Config::HostConfig::LogConfig? + + def log_config=: ( + Docker::ContainerCreateParams::Config::HostConfig::LogConfig + ) -> Docker::ContainerCreateParams::Config::HostConfig::LogConfig + + attr_reader masked_paths: ::Array[String]? + + def masked_paths=: (::Array[String]) -> ::Array[String] + + attr_reader memory: Integer? + + def memory=: (Integer) -> Integer + + attr_reader memory_reservation: Integer? + + def memory_reservation=: (Integer) -> Integer + + attr_reader memory_swap: Integer? + + def memory_swap=: (Integer) -> Integer + + attr_reader memory_swappiness: Integer? + + def memory_swappiness=: (Integer) -> Integer + + attr_reader mounts: ::Array[Docker::ContainerCreateParams::Config::HostConfig::Mount]? + + def mounts=: ( + ::Array[Docker::ContainerCreateParams::Config::HostConfig::Mount] + ) -> ::Array[Docker::ContainerCreateParams::Config::HostConfig::Mount] + + attr_reader nano_cpus: Integer? + + def nano_cpus=: (Integer) -> Integer + + attr_reader network_mode: String? + + def network_mode=: (String) -> String + + attr_reader oom_kill_disable: bool? + + def oom_kill_disable=: (bool) -> bool + + attr_reader oom_score_adj: Integer? + + def oom_score_adj=: (Integer) -> Integer + + attr_reader pid_mode: String? + + def pid_mode=: (String) -> String + + attr_accessor pids_limit: Integer? + + attr_reader port_bindings: ::Hash[Symbol, ::Array[Docker::ContainerCreateParams::Config::HostConfig::PortBinding]]? + + def port_bindings=: ( + ::Hash[Symbol, ::Array[Docker::ContainerCreateParams::Config::HostConfig::PortBinding]] + ) -> ::Hash[Symbol, ::Array[Docker::ContainerCreateParams::Config::HostConfig::PortBinding]] + + attr_reader privileged: bool? + + def privileged=: (bool) -> bool + + attr_reader publish_all_ports: bool? + + def publish_all_ports=: (bool) -> bool + + attr_reader readonly_paths: ::Array[String]? + + def readonly_paths=: (::Array[String]) -> ::Array[String] + + attr_reader readonly_rootfs: bool? + + def readonly_rootfs=: (bool) -> bool + + attr_reader restart_policy: Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy? + + def restart_policy=: ( + Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy + ) -> Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy + + attr_accessor runtime: String? + + attr_reader security_opt: ::Array[String]? + + def security_opt=: (::Array[String]) -> ::Array[String] + + attr_reader shm_size: Integer? + + def shm_size=: (Integer) -> Integer + + attr_reader storage_opt: ::Hash[Symbol, String]? + + def storage_opt=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_accessor sysctls: ::Hash[Symbol, String]? + + attr_reader tmpfs: ::Hash[Symbol, String]? + + def tmpfs=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader ulimits: ::Array[Docker::ContainerCreateParams::Config::HostConfig::Ulimit]? + + def ulimits=: ( + ::Array[Docker::ContainerCreateParams::Config::HostConfig::Ulimit] + ) -> ::Array[Docker::ContainerCreateParams::Config::HostConfig::Ulimit] + + attr_reader userns_mode: String? + + def userns_mode=: (String) -> String + + attr_reader uts_mode: String? + + def uts_mode=: (String) -> String + + attr_reader volume_driver: String? + + def volume_driver=: (String) -> String + + attr_reader volumes_from: ::Array[String]? + + def volumes_from=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?annotations: ::Hash[Symbol, String], + ?auto_remove: bool, + ?binds: ::Array[String], + ?blkio_device_read_bps: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadBp], + ?blkio_device_read_i_ops: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadIOp], + ?blkio_device_write_bps: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteBp], + ?blkio_device_write_i_ops: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteIOp], + ?blkio_weight: Integer, + ?blkio_weight_device: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioWeightDevice], + ?cap_add: ::Array[String], + ?cap_drop: ::Array[String], + ?cgroup: String, + ?cgroupns_mode: Docker::Models::ContainerCreateParams::Config::HostConfig::cgroupns_mode, + ?cgroup_parent: String, + ?console_size: ::Array[Integer]?, + ?container_id_file: String, + ?cpu_count: Integer, + ?cpu_percent: Integer, + ?cpu_period: Integer, + ?cpu_quota: Integer, + ?cpu_realtime_period: Integer, + ?cpu_realtime_runtime: Integer, + ?cpuset_cpus: String, + ?cpuset_mems: String, + ?cpu_shares: Integer, + ?device_cgroup_rules: ::Array[String], + ?device_requests: ::Array[Docker::ContainerCreateParams::Config::HostConfig::DeviceRequest], + ?devices: ::Array[Docker::ContainerCreateParams::Config::HostConfig::Device], + ?dns: ::Array[String], + ?dns_options: ::Array[String], + ?dns_search: ::Array[String], + ?extra_hosts: ::Array[String], + ?group_add: ::Array[String], + ?init: bool?, + ?io_maximum_bandwidth: Integer, + ?io_maximum_i_ops: Integer, + ?ipc_mode: String, + ?isolation: Docker::Models::ContainerCreateParams::Config::HostConfig::isolation, + ?links: ::Array[String], + ?log_config: Docker::ContainerCreateParams::Config::HostConfig::LogConfig, + ?masked_paths: ::Array[String], + ?memory: Integer, + ?memory_reservation: Integer, + ?memory_swap: Integer, + ?memory_swappiness: Integer, + ?mounts: ::Array[Docker::ContainerCreateParams::Config::HostConfig::Mount], + ?nano_cpus: Integer, + ?network_mode: String, + ?oom_kill_disable: bool, + ?oom_score_adj: Integer, + ?pid_mode: String, + ?pids_limit: Integer?, + ?port_bindings: ::Hash[Symbol, ::Array[Docker::ContainerCreateParams::Config::HostConfig::PortBinding]], + ?privileged: bool, + ?publish_all_ports: bool, + ?readonly_paths: ::Array[String], + ?readonly_rootfs: bool, + ?restart_policy: Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy, + ?runtime: String?, + ?security_opt: ::Array[String], + ?shm_size: Integer, + ?storage_opt: ::Hash[Symbol, String], + ?sysctls: ::Hash[Symbol, String]?, + ?tmpfs: ::Hash[Symbol, String], + ?ulimits: ::Array[Docker::ContainerCreateParams::Config::HostConfig::Ulimit], + ?userns_mode: String, + ?uts_mode: String, + ?volume_driver: String, + ?volumes_from: ::Array[String] + ) -> void + + def to_hash: -> { + annotations: ::Hash[Symbol, String], + auto_remove: bool, + binds: ::Array[String], + blkio_device_read_bps: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadBp], + blkio_device_read_i_ops: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceReadIOp], + blkio_device_write_bps: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteBp], + blkio_device_write_i_ops: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioDeviceWriteIOp], + blkio_weight: Integer, + blkio_weight_device: ::Array[Docker::ContainerCreateParams::Config::HostConfig::BlkioWeightDevice], + cap_add: ::Array[String], + cap_drop: ::Array[String], + cgroup: String, + cgroupns_mode: Docker::Models::ContainerCreateParams::Config::HostConfig::cgroupns_mode, + cgroup_parent: String, + console_size: ::Array[Integer]?, + container_id_file: String, + cpu_count: Integer, + cpu_percent: Integer, + cpu_period: Integer, + cpu_quota: Integer, + cpu_realtime_period: Integer, + cpu_realtime_runtime: Integer, + cpuset_cpus: String, + cpuset_mems: String, + cpu_shares: Integer, + device_cgroup_rules: ::Array[String], + device_requests: ::Array[Docker::ContainerCreateParams::Config::HostConfig::DeviceRequest], + devices: ::Array[Docker::ContainerCreateParams::Config::HostConfig::Device], + dns: ::Array[String], + dns_options: ::Array[String], + dns_search: ::Array[String], + extra_hosts: ::Array[String], + group_add: ::Array[String], + init: bool?, + io_maximum_bandwidth: Integer, + io_maximum_i_ops: Integer, + ipc_mode: String, + isolation: Docker::Models::ContainerCreateParams::Config::HostConfig::isolation, + links: ::Array[String], + log_config: Docker::ContainerCreateParams::Config::HostConfig::LogConfig, + masked_paths: ::Array[String], + memory: Integer, + memory_reservation: Integer, + memory_swap: Integer, + memory_swappiness: Integer, + mounts: ::Array[Docker::ContainerCreateParams::Config::HostConfig::Mount], + nano_cpus: Integer, + network_mode: String, + oom_kill_disable: bool, + oom_score_adj: Integer, + pid_mode: String, + pids_limit: Integer?, + port_bindings: ::Hash[Symbol, ::Array[Docker::ContainerCreateParams::Config::HostConfig::PortBinding]], + privileged: bool, + publish_all_ports: bool, + readonly_paths: ::Array[String], + readonly_rootfs: bool, + restart_policy: Docker::ContainerCreateParams::Config::HostConfig::RestartPolicy, + runtime: String?, + security_opt: ::Array[String], + shm_size: Integer, + storage_opt: ::Hash[Symbol, String], + sysctls: ::Hash[Symbol, String]?, + tmpfs: ::Hash[Symbol, String], + ulimits: ::Array[Docker::ContainerCreateParams::Config::HostConfig::Ulimit], + userns_mode: String, + uts_mode: String, + volume_driver: String, + volumes_from: ::Array[String] + } + + type blkio_device_read_bp = { path: String, rate: Integer } + + class BlkioDeviceReadBp < Docker::Internal::Type::BaseModel + attr_reader path: String? + + def path=: (String) -> String + + attr_reader rate: Integer? + + def rate=: (Integer) -> Integer + + def initialize: (?path: String, ?rate: Integer) -> void + + def to_hash: -> { path: String, rate: Integer } + end + + type blkio_device_read_i_op = { path: String, rate: Integer } + + class BlkioDeviceReadIOp < Docker::Internal::Type::BaseModel + attr_reader path: String? + + def path=: (String) -> String + + attr_reader rate: Integer? + + def rate=: (Integer) -> Integer + + def initialize: (?path: String, ?rate: Integer) -> void + + def to_hash: -> { path: String, rate: Integer } + end + + type blkio_device_write_bp = { path: String, rate: Integer } + + class BlkioDeviceWriteBp < Docker::Internal::Type::BaseModel + attr_reader path: String? + + def path=: (String) -> String + + attr_reader rate: Integer? + + def rate=: (Integer) -> Integer + + def initialize: (?path: String, ?rate: Integer) -> void + + def to_hash: -> { path: String, rate: Integer } + end + + type blkio_device_write_i_op = { path: String, rate: Integer } + + class BlkioDeviceWriteIOp < Docker::Internal::Type::BaseModel + attr_reader path: String? + + def path=: (String) -> String + + attr_reader rate: Integer? + + def rate=: (Integer) -> Integer + + def initialize: (?path: String, ?rate: Integer) -> void + + def to_hash: -> { path: String, rate: Integer } + end + + type blkio_weight_device = { path: String, weight: Integer } + + class BlkioWeightDevice < Docker::Internal::Type::BaseModel + attr_reader path: String? + + def path=: (String) -> String + + attr_reader weight: Integer? + + def weight=: (Integer) -> Integer + + def initialize: (?path: String, ?weight: Integer) -> void + + def to_hash: -> { path: String, weight: Integer } + end + + type cgroupns_mode = :private | :host + + module CgroupnsMode + extend Docker::Internal::Type::Enum + + PRIVATE: :private + HOST: :host + + def self?.values: -> ::Array[Docker::Models::ContainerCreateParams::Config::HostConfig::cgroupns_mode] + end + + type device_request = + { + capabilities: ::Array[::Array[String]], + count: Integer, + device_ids: ::Array[String], + driver: String, + options: ::Hash[Symbol, String] + } + + class DeviceRequest < Docker::Internal::Type::BaseModel + attr_reader capabilities: ::Array[::Array[String]]? + + def capabilities=: ( + ::Array[::Array[String]] + ) -> ::Array[::Array[String]] + + attr_reader count: Integer? + + def count=: (Integer) -> Integer + + attr_reader device_ids: ::Array[String]? + + def device_ids=: (::Array[String]) -> ::Array[String] + + attr_reader driver: String? + + def driver=: (String) -> String + + attr_reader options: ::Hash[Symbol, String]? + + def options=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + def initialize: ( + ?capabilities: ::Array[::Array[String]], + ?count: Integer, + ?device_ids: ::Array[String], + ?driver: String, + ?options: ::Hash[Symbol, String] + ) -> void + + def to_hash: -> { + capabilities: ::Array[::Array[String]], + count: Integer, + device_ids: ::Array[String], + driver: String, + options: ::Hash[Symbol, String] + } + end + + type device = + { + cgroup_permissions: String, + path_in_container: String, + path_on_host: String + } + + class Device < Docker::Internal::Type::BaseModel + attr_reader cgroup_permissions: String? + + def cgroup_permissions=: (String) -> String + + attr_reader path_in_container: String? + + def path_in_container=: (String) -> String + + attr_reader path_on_host: String? + + def path_on_host=: (String) -> String + + def initialize: ( + ?cgroup_permissions: String, + ?path_in_container: String, + ?path_on_host: String + ) -> void + + def to_hash: -> { + cgroup_permissions: String, + path_in_container: String, + path_on_host: String + } + end + + type isolation = :default | :process | :hyperv | :"" + + module Isolation + extend Docker::Internal::Type::Enum + + DEFAULT: :default + PROCESS: :process + HYPERV: :hyperv + EMPTY: :"" + + def self?.values: -> ::Array[Docker::Models::ContainerCreateParams::Config::HostConfig::isolation] + end + + type log_config = + { + config: ::Hash[Symbol, String], + type: Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig::type_ + } + + class LogConfig < Docker::Internal::Type::BaseModel + attr_reader config: ::Hash[Symbol, String]? + + def config=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader type: Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig::type_? + + def type=: ( + Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig::type_ + ) -> Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig::type_ + + def initialize: ( + ?config: ::Hash[Symbol, String], + ?type: Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig::type_ + ) -> void + + def to_hash: -> { + config: ::Hash[Symbol, String], + type: Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig::type_ + } + + type type_ = + :local + | :"json-file" + | :syslog + | :journald + | :gelf + | :fluentd + | :awslogs + | :splunk + | :etwlogs + | :none + + module Type + extend Docker::Internal::Type::Enum + + LOCAL: :local + JSON_FILE: :"json-file" + SYSLOG: :syslog + JOURNALD: :journald + GELF: :gelf + FLUENTD: :fluentd + AWSLOGS: :awslogs + SPLUNK: :splunk + ETWLOGS: :etwlogs + NONE: :none + + def self?.values: -> ::Array[Docker::Models::ContainerCreateParams::Config::HostConfig::LogConfig::type_] + end + end + + type mount = + { + bind_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions, + consistency: String, + image_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions, + read_only: bool, + source: String, + target: String, + tmpfs_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions, + type: Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::type_, + volume_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions + } + + class Mount < Docker::Internal::Type::BaseModel + attr_reader bind_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions? + + def bind_options=: ( + Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions + ) -> Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions + + attr_reader consistency: String? + + def consistency=: (String) -> String + + attr_reader image_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions? + + def image_options=: ( + Docker::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions + ) -> Docker::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions + + attr_reader read_only: bool? + + def read_only=: (bool) -> bool + + attr_reader source: String? + + def source=: (String) -> String + + attr_reader target: String? + + def target=: (String) -> String + + attr_reader tmpfs_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions? + + def tmpfs_options=: ( + Docker::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions + ) -> Docker::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions + + attr_reader type: Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::type_? + + def type=: ( + Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::type_ + ) -> Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::type_ + + attr_reader volume_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions? + + def volume_options=: ( + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions + ) -> Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions + + def initialize: ( + ?bind_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions, + ?consistency: String, + ?image_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions, + ?read_only: bool, + ?source: String, + ?target: String, + ?tmpfs_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions, + ?type: Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::type_, + ?volume_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions + ) -> void + + def to_hash: -> { + bind_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::BindOptions, + consistency: String, + image_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::ImageOptions, + read_only: bool, + source: String, + target: String, + tmpfs_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::TmpfsOptions, + type: Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::type_, + volume_options: Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions + } + + type bind_options = + { + create_mountpoint: bool, + non_recursive: bool, + propagation: Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::propagation, + read_only_force_recursive: bool, + read_only_non_recursive: bool + } + + class BindOptions < Docker::Internal::Type::BaseModel + attr_reader create_mountpoint: bool? + + def create_mountpoint=: (bool) -> bool + + attr_reader non_recursive: bool? + + def non_recursive=: (bool) -> bool + + attr_reader propagation: Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::propagation? + + def propagation=: ( + Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::propagation + ) -> Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::propagation + + attr_reader read_only_force_recursive: bool? + + def read_only_force_recursive=: (bool) -> bool + + attr_reader read_only_non_recursive: bool? + + def read_only_non_recursive=: (bool) -> bool + + def initialize: ( + ?create_mountpoint: bool, + ?non_recursive: bool, + ?propagation: Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::propagation, + ?read_only_force_recursive: bool, + ?read_only_non_recursive: bool + ) -> void + + def to_hash: -> { + create_mountpoint: bool, + non_recursive: bool, + propagation: Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::propagation, + read_only_force_recursive: bool, + read_only_non_recursive: bool + } + + type propagation = + :private | :rprivate | :shared | :rshared | :slave | :rslave + + module Propagation + extend Docker::Internal::Type::Enum + + PRIVATE: :private + RPRIVATE: :rprivate + SHARED: :shared + RSHARED: :rshared + SLAVE: :slave + RSLAVE: :rslave + + def self?.values: -> ::Array[Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::BindOptions::propagation] + end + end + + type image_options = { subpath: String } + + class ImageOptions < Docker::Internal::Type::BaseModel + attr_reader subpath: String? + + def subpath=: (String) -> String + + def initialize: (?subpath: String) -> void + + def to_hash: -> { subpath: String } + end + + type tmpfs_options = + { + mode: Integer, + options: ::Array[::Array[String]], + size_bytes: Integer + } + + class TmpfsOptions < Docker::Internal::Type::BaseModel + attr_reader mode: Integer? + + def mode=: (Integer) -> Integer + + attr_reader options: ::Array[::Array[String]]? + + def options=: ( + ::Array[::Array[String]] + ) -> ::Array[::Array[String]] + + attr_reader size_bytes: Integer? + + def size_bytes=: (Integer) -> Integer + + def initialize: ( + ?mode: Integer, + ?options: ::Array[::Array[String]], + ?size_bytes: Integer + ) -> void + + def to_hash: -> { + mode: Integer, + options: ::Array[::Array[String]], + size_bytes: Integer + } + end + + type type_ = :bind | :cluster | :image | :npipe | :tmpfs | :volume + + module Type + extend Docker::Internal::Type::Enum + + BIND: :bind + CLUSTER: :cluster + IMAGE: :image + NPIPE: :npipe + TMPFS: :tmpfs + VOLUME: :volume + + def self?.values: -> ::Array[Docker::Models::ContainerCreateParams::Config::HostConfig::Mount::type_] + end + + type volume_options = + { + driver_config: Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig, + labels: ::Hash[Symbol, String], + no_copy: bool, + subpath: String + } + + class VolumeOptions < Docker::Internal::Type::BaseModel + attr_reader driver_config: Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig? + + def driver_config=: ( + Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig + ) -> Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig + + attr_reader labels: ::Hash[Symbol, String]? + + def labels=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader no_copy: bool? + + def no_copy=: (bool) -> bool + + attr_reader subpath: String? + + def subpath=: (String) -> String + + def initialize: ( + ?driver_config: Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig, + ?labels: ::Hash[Symbol, String], + ?no_copy: bool, + ?subpath: String + ) -> void + + def to_hash: -> { + driver_config: Docker::ContainerCreateParams::Config::HostConfig::Mount::VolumeOptions::DriverConfig, + labels: ::Hash[Symbol, String], + no_copy: bool, + subpath: String + } + + type driver_config = + { name: String, options: ::Hash[Symbol, String] } + + class DriverConfig < Docker::Internal::Type::BaseModel + attr_reader name: String? + + def name=: (String) -> String + + attr_reader options: ::Hash[Symbol, String]? + + def options=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + def initialize: ( + ?name: String, + ?options: ::Hash[Symbol, String] + ) -> void + + def to_hash: -> { + name: String, + options: ::Hash[Symbol, String] + } + end + end + end + + type port_binding = { host_ip: String, host_port: String } + + class PortBinding < Docker::Internal::Type::BaseModel + attr_reader host_ip: String? + + def host_ip=: (String) -> String + + attr_reader host_port: String? + + def host_port=: (String) -> String + + def initialize: (?host_ip: String, ?host_port: String) -> void + + def to_hash: -> { host_ip: String, host_port: String } + end + + type restart_policy = + { + maximum_retry_count: Integer, + name: Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy::name_ + } + + class RestartPolicy < Docker::Internal::Type::BaseModel + attr_reader maximum_retry_count: Integer? + + def maximum_retry_count=: (Integer) -> Integer + + attr_reader name: Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy::name_? + + def name=: ( + Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy::name_ + ) -> Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy::name_ + + def initialize: ( + ?maximum_retry_count: Integer, + ?name: Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy::name_ + ) -> void + + def to_hash: -> { + maximum_retry_count: Integer, + name: Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy::name_ + } + + type name_ = :"" | :no | :always | :"unless-stopped" | :"on-failure" + + module Name + extend Docker::Internal::Type::Enum + + EMPTY: :"" + NO: :no + ALWAYS: :always + UNLESS_STOPPED: :"unless-stopped" + ON_FAILURE: :"on-failure" + + def self?.values: -> ::Array[Docker::Models::ContainerCreateParams::Config::HostConfig::RestartPolicy::name_] + end + end + + type ulimit = { hard: Integer, name: String, soft: Integer } + + class Ulimit < Docker::Internal::Type::BaseModel + attr_reader hard: Integer? + + def hard=: (Integer) -> Integer + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader soft: Integer? + + def soft=: (Integer) -> Integer + + def initialize: ( + ?hard: Integer, + ?name: String, + ?soft: Integer + ) -> void + + def to_hash: -> { hard: Integer, name: String, soft: Integer } + end + end + + type networking_config = + { + endpoints_config: ::Hash[Symbol, Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig] + } + + class NetworkingConfig < Docker::Internal::Type::BaseModel + attr_reader endpoints_config: ::Hash[Symbol, Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig]? + + def endpoints_config=: ( + ::Hash[Symbol, Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig] + ) -> ::Hash[Symbol, Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig] + + def initialize: ( + ?endpoints_config: ::Hash[Symbol, Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig] + ) -> void + + def to_hash: -> { + endpoints_config: ::Hash[Symbol, Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig] + } + + type endpoints_config = + { + aliases: ::Array[String], + dns_names: ::Array[String], + driver_opts: ::Hash[Symbol, String]?, + endpoint_id: String, + gateway: String, + :global_i_pv6_address => String, + :global_i_pv6_prefix_len => Integer, + gw_priority: Integer, + ip_address: String, + ipam_config: Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::IpamConfig?, + ip_prefix_len: Integer, + :i_pv6_gateway => String, + links: ::Array[String], + mac_address: String, + network_id: String + } + + class EndpointsConfig < Docker::Internal::Type::BaseModel + attr_reader aliases: ::Array[String]? + + def aliases=: (::Array[String]) -> ::Array[String] + + attr_reader dns_names: ::Array[String]? + + def dns_names=: (::Array[String]) -> ::Array[String] + + attr_accessor driver_opts: ::Hash[Symbol, String]? + + attr_reader endpoint_id: String? + + def endpoint_id=: (String) -> String + + attr_reader gateway: String? + + def gateway=: (String) -> String + + attr_reader global_i_pv6_address: String? + + def global_i_pv6_address=: (String) -> String + + attr_reader global_i_pv6_prefix_len: Integer? + + def global_i_pv6_prefix_len=: (Integer) -> Integer + + attr_reader gw_priority: Integer? + + def gw_priority=: (Integer) -> Integer + + attr_reader ip_address: String? + + def ip_address=: (String) -> String + + attr_accessor ipam_config: Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::IpamConfig? + + attr_reader ip_prefix_len: Integer? + + def ip_prefix_len=: (Integer) -> Integer + + attr_reader i_pv6_gateway: String? + + def i_pv6_gateway=: (String) -> String + + attr_reader links: ::Array[String]? + + def links=: (::Array[String]) -> ::Array[String] + + attr_reader mac_address: String? + + def mac_address=: (String) -> String + + attr_reader network_id: String? + + def network_id=: (String) -> String + + def initialize: ( + ?aliases: ::Array[String], + ?dns_names: ::Array[String], + ?driver_opts: ::Hash[Symbol, String]?, + ?endpoint_id: String, + ?gateway: String, + ?global_i_pv6_address: String, + ?global_i_pv6_prefix_len: Integer, + ?gw_priority: Integer, + ?ip_address: String, + ?ipam_config: Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::IpamConfig?, + ?ip_prefix_len: Integer, + ?i_pv6_gateway: String, + ?links: ::Array[String], + ?mac_address: String, + ?network_id: String + ) -> void + + def to_hash: -> { + aliases: ::Array[String], + dns_names: ::Array[String], + driver_opts: ::Hash[Symbol, String]?, + endpoint_id: String, + gateway: String, + :global_i_pv6_address => String, + :global_i_pv6_prefix_len => Integer, + gw_priority: Integer, + ip_address: String, + ipam_config: Docker::ContainerCreateParams::Config::NetworkingConfig::EndpointsConfig::IpamConfig?, + ip_prefix_len: Integer, + :i_pv6_gateway => String, + links: ::Array[String], + mac_address: String, + network_id: String + } + + type ipam_config = + { + :i_pv4_address => String, + :i_pv6_address => String, + link_local_ips: ::Array[String] + } + + class IpamConfig < Docker::Internal::Type::BaseModel + attr_reader i_pv4_address: String? + + def i_pv4_address=: (String) -> String + + attr_reader i_pv6_address: String? + + def i_pv6_address=: (String) -> String + + attr_reader link_local_ips: ::Array[String]? + + def link_local_ips=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?i_pv4_address: String, + ?i_pv6_address: String, + ?link_local_ips: ::Array[String] + ) -> void + + def to_hash: -> { + :i_pv4_address => String, + :i_pv6_address => String, + link_local_ips: ::Array[String] + } + end + end + end + end + end + end +end diff --git a/sig/docker/models/container_delete_params.rbs b/sig/docker/models/container_delete_params.rbs new file mode 100644 index 0000000..a008310 --- /dev/null +++ b/sig/docker/models/container_delete_params.rbs @@ -0,0 +1,38 @@ +module Docker + module Models + type container_delete_params = + { force: bool, link: bool, v: bool } + & Docker::Internal::Type::request_parameters + + class ContainerDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader force: bool? + + def force=: (bool) -> bool + + attr_reader link: bool? + + def link=: (bool) -> bool + + attr_reader v: bool? + + def v=: (bool) -> bool + + def initialize: ( + ?force: bool, + ?link: bool, + ?v: bool, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + force: bool, + link: bool, + v: bool, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/container_inspect_params.rbs b/sig/docker/models/container_inspect_params.rbs new file mode 100644 index 0000000..5c1745e --- /dev/null +++ b/sig/docker/models/container_inspect_params.rbs @@ -0,0 +1,22 @@ +module Docker + module Models + type container_inspect_params = + { size: bool } & Docker::Internal::Type::request_parameters + + class ContainerInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader size: bool? + + def size=: (bool) -> bool + + def initialize: ( + ?size: bool, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { size: bool, request_options: Docker::RequestOptions } + end + end +end diff --git a/sig/docker/models/container_kill_params.rbs b/sig/docker/models/container_kill_params.rbs new file mode 100644 index 0000000..d728be6 --- /dev/null +++ b/sig/docker/models/container_kill_params.rbs @@ -0,0 +1,25 @@ +module Docker + module Models + type container_kill_params = + { signal: String } & Docker::Internal::Type::request_parameters + + class ContainerKillParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader signal: String? + + def signal=: (String) -> String + + def initialize: ( + ?signal: String, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + signal: String, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/container_list_params.rbs b/sig/docker/models/container_list_params.rbs new file mode 100644 index 0000000..32d5823 --- /dev/null +++ b/sig/docker/models/container_list_params.rbs @@ -0,0 +1,44 @@ +module Docker + module Models + type container_list_params = + { all: bool, filters: String, limit: Integer, size: bool } + & Docker::Internal::Type::request_parameters + + class ContainerListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader all: bool? + + def all=: (bool) -> bool + + attr_reader filters: String? + + def filters=: (String) -> String + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + attr_reader size: bool? + + def size=: (bool) -> bool + + def initialize: ( + ?all: bool, + ?filters: String, + ?limit: Integer, + ?size: bool, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + all: bool, + filters: String, + limit: Integer, + size: bool, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/container_list_response.rbs b/sig/docker/models/container_list_response.rbs new file mode 100644 index 0000000..c4f5534 --- /dev/null +++ b/sig/docker/models/container_list_response.rbs @@ -0,0 +1,7 @@ +module Docker + module Models + type container_list_response = ::Array[Docker::Summary] + + ContainerListResponse: Docker::Internal::Type::Converter + end +end diff --git a/sig/docker/models/container_logs_params.rbs b/sig/docker/models/container_logs_params.rbs new file mode 100644 index 0000000..e129666 --- /dev/null +++ b/sig/docker/models/container_logs_params.rbs @@ -0,0 +1,70 @@ +module Docker + module Models + type container_logs_params = + { + follow: bool, + since: Integer, + stderr: bool, + stdout: bool, + tail: String, + timestamps: bool, + until_: Integer + } + & Docker::Internal::Type::request_parameters + + class ContainerLogsParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader follow: bool? + + def follow=: (bool) -> bool + + attr_reader since: Integer? + + def since=: (Integer) -> Integer + + attr_reader stderr: bool? + + def stderr=: (bool) -> bool + + attr_reader stdout: bool? + + def stdout=: (bool) -> bool + + attr_reader tail: String? + + def tail=: (String) -> String + + attr_reader timestamps: bool? + + def timestamps=: (bool) -> bool + + attr_reader until_: Integer? + + def until_=: (Integer) -> Integer + + def initialize: ( + ?follow: bool, + ?since: Integer, + ?stderr: bool, + ?stdout: bool, + ?tail: String, + ?timestamps: bool, + ?until_: Integer, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + follow: bool, + since: Integer, + stderr: bool, + stdout: bool, + tail: String, + timestamps: bool, + until_: Integer, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/container_start_params.rbs b/sig/docker/models/container_start_params.rbs new file mode 100644 index 0000000..b2e7595 --- /dev/null +++ b/sig/docker/models/container_start_params.rbs @@ -0,0 +1,25 @@ +module Docker + module Models + type container_start_params = + { detach_keys: String } & Docker::Internal::Type::request_parameters + + class ContainerStartParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader detach_keys: String? + + def detach_keys=: (String) -> String + + def initialize: ( + ?detach_keys: String, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + detach_keys: String, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/container_stop_params.rbs b/sig/docker/models/container_stop_params.rbs new file mode 100644 index 0000000..30d7543 --- /dev/null +++ b/sig/docker/models/container_stop_params.rbs @@ -0,0 +1,32 @@ +module Docker + module Models + type container_stop_params = + { signal: String, t: Integer } + & Docker::Internal::Type::request_parameters + + class ContainerStopParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader signal: String? + + def signal=: (String) -> String + + attr_reader t: Integer? + + def t=: (Integer) -> Integer + + def initialize: ( + ?signal: String, + ?t: Integer, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + signal: String, + t: Integer, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/create_request.rbs b/sig/docker/models/create_request.rbs new file mode 100644 index 0000000..4f3c7aa --- /dev/null +++ b/sig/docker/models/create_request.rbs @@ -0,0 +1,255 @@ +module Docker + module Models + type create_request = + { + cluster_volume_spec: Docker::CreateRequest::ClusterVolumeSpec, + driver: String, + driver_opts: ::Hash[Symbol, String], + labels: ::Hash[Symbol, String], + name: String + } + + class CreateRequest < Docker::Internal::Type::BaseModel + attr_reader cluster_volume_spec: Docker::CreateRequest::ClusterVolumeSpec? + + def cluster_volume_spec=: ( + Docker::CreateRequest::ClusterVolumeSpec + ) -> Docker::CreateRequest::ClusterVolumeSpec + + attr_reader driver: String? + + def driver=: (String) -> String + + attr_reader driver_opts: ::Hash[Symbol, String]? + + def driver_opts=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader labels: ::Hash[Symbol, String]? + + def labels=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader name: String? + + def name=: (String) -> String + + def initialize: ( + ?cluster_volume_spec: Docker::CreateRequest::ClusterVolumeSpec, + ?driver: String, + ?driver_opts: ::Hash[Symbol, String], + ?labels: ::Hash[Symbol, String], + ?name: String + ) -> void + + def to_hash: -> { + cluster_volume_spec: Docker::CreateRequest::ClusterVolumeSpec, + driver: String, + driver_opts: ::Hash[Symbol, String], + labels: ::Hash[Symbol, String], + name: String + } + + type cluster_volume_spec = + { + access_mode: Docker::CreateRequest::ClusterVolumeSpec::AccessMode, + group: String + } + + class ClusterVolumeSpec < Docker::Internal::Type::BaseModel + attr_reader access_mode: Docker::CreateRequest::ClusterVolumeSpec::AccessMode? + + def access_mode=: ( + Docker::CreateRequest::ClusterVolumeSpec::AccessMode + ) -> Docker::CreateRequest::ClusterVolumeSpec::AccessMode + + attr_reader group: String? + + def group=: (String) -> String + + def initialize: ( + ?access_mode: Docker::CreateRequest::ClusterVolumeSpec::AccessMode, + ?group: String + ) -> void + + def to_hash: -> { + access_mode: Docker::CreateRequest::ClusterVolumeSpec::AccessMode, + group: String + } + + type access_mode = + { + accessibility_requirements: Docker::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements, + availability: Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::availability, + capacity_range: Docker::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange, + mount_volume: top, + scope: Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::scope, + secrets: ::Array[Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Secret], + sharing: Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::sharing + } + + class AccessMode < Docker::Internal::Type::BaseModel + attr_reader accessibility_requirements: Docker::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements? + + def accessibility_requirements=: ( + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements + ) -> Docker::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements + + attr_reader availability: Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::availability? + + def availability=: ( + Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::availability + ) -> Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::availability + + attr_reader capacity_range: Docker::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange? + + def capacity_range=: ( + Docker::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange + ) -> Docker::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange + + attr_reader mount_volume: top? + + def mount_volume=: (top) -> top + + attr_reader scope: Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::scope? + + def scope=: ( + Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::scope + ) -> Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::scope + + attr_reader secrets: ::Array[Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Secret]? + + def secrets=: ( + ::Array[Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Secret] + ) -> ::Array[Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Secret] + + attr_reader sharing: Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::sharing? + + def sharing=: ( + Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::sharing + ) -> Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::sharing + + def initialize: ( + ?accessibility_requirements: Docker::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements, + ?availability: Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::availability, + ?capacity_range: Docker::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange, + ?mount_volume: top, + ?scope: Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::scope, + ?secrets: ::Array[Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Secret], + ?sharing: Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::sharing + ) -> void + + def to_hash: -> { + accessibility_requirements: Docker::CreateRequest::ClusterVolumeSpec::AccessMode::AccessibilityRequirements, + availability: Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::availability, + capacity_range: Docker::CreateRequest::ClusterVolumeSpec::AccessMode::CapacityRange, + mount_volume: top, + scope: Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::scope, + secrets: ::Array[Docker::CreateRequest::ClusterVolumeSpec::AccessMode::Secret], + sharing: Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::sharing + } + + type accessibility_requirements = + { + preferred: ::Array[::Hash[Symbol, String]], + requisite: ::Array[::Hash[Symbol, String]] + } + + class AccessibilityRequirements < Docker::Internal::Type::BaseModel + attr_reader preferred: ::Array[::Hash[Symbol, String]]? + + def preferred=: ( + ::Array[::Hash[Symbol, String]] + ) -> ::Array[::Hash[Symbol, String]] + + attr_reader requisite: ::Array[::Hash[Symbol, String]]? + + def requisite=: ( + ::Array[::Hash[Symbol, String]] + ) -> ::Array[::Hash[Symbol, String]] + + def initialize: ( + ?preferred: ::Array[::Hash[Symbol, String]], + ?requisite: ::Array[::Hash[Symbol, String]] + ) -> void + + def to_hash: -> { + preferred: ::Array[::Hash[Symbol, String]], + requisite: ::Array[::Hash[Symbol, String]] + } + end + + type availability = :active | :pause | :drain + + module Availability + extend Docker::Internal::Type::Enum + + ACTIVE: :active + PAUSE: :pause + DRAIN: :drain + + def self?.values: -> ::Array[Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::availability] + end + + type capacity_range = + { limit_bytes: Integer, required_bytes: Integer } + + class CapacityRange < Docker::Internal::Type::BaseModel + attr_reader limit_bytes: Integer? + + def limit_bytes=: (Integer) -> Integer + + attr_reader required_bytes: Integer? + + def required_bytes=: (Integer) -> Integer + + def initialize: ( + ?limit_bytes: Integer, + ?required_bytes: Integer + ) -> void + + def to_hash: -> { limit_bytes: Integer, required_bytes: Integer } + end + + type scope = :single | :multi + + module Scope + extend Docker::Internal::Type::Enum + + SINGLE: :single + MULTI: :multi + + def self?.values: -> ::Array[Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::scope] + end + + type secret = { key: String, secret: String } + + class Secret < Docker::Internal::Type::BaseModel + attr_reader key: String? + + def key=: (String) -> String + + attr_reader secret: String? + + def secret=: (String) -> String + + def initialize: (?key: String, ?secret: String) -> void + + def to_hash: -> { key: String, secret: String } + end + + type sharing = :none | :readonly | :onewriter | :all + + module Sharing + extend Docker::Internal::Type::Enum + + NONE: :none + READONLY: :readonly + ONEWRITER: :onewriter + ALL: :all + + def self?.values: -> ::Array[Docker::Models::CreateRequest::ClusterVolumeSpec::AccessMode::sharing] + end + end + end + end + end +end diff --git a/sig/docker/models/create_response.rbs b/sig/docker/models/create_response.rbs new file mode 100644 index 0000000..8ad5c49 --- /dev/null +++ b/sig/docker/models/create_response.rbs @@ -0,0 +1,15 @@ +module Docker + module Models + type create_response = { id: String, warnings: ::Array[String] } + + class CreateResponse < Docker::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor warnings: ::Array[String] + + def initialize: (id: String, warnings: ::Array[String]) -> void + + def to_hash: -> { id: String, warnings: ::Array[String] } + end + end +end diff --git a/sig/docker/models/error.rbs b/sig/docker/models/error.rbs new file mode 100644 index 0000000..0160dd5 --- /dev/null +++ b/sig/docker/models/error.rbs @@ -0,0 +1,13 @@ +module Docker + module Models + type error = { message: String } + + class Error < Docker::Internal::Type::BaseModel + attr_accessor message: String + + def initialize: (message: String) -> void + + def to_hash: -> { message: String } + end + end +end diff --git a/sig/docker/models/image.rbs b/sig/docker/models/image.rbs new file mode 100644 index 0000000..e86dd8a --- /dev/null +++ b/sig/docker/models/image.rbs @@ -0,0 +1,1032 @@ +module Docker + module Models + type image = + { + architecture: String, + author: String?, + comment: String?, + config: Docker::Image::Config, + created: String?, + descriptor: Docker::Image::Descriptor, + graph_driver: Docker::Image::GraphDriver, + id: String, + identity: Docker::Image::Identity, + manifests: ::Array[Docker::Image::Manifest]?, + metadata: Docker::Image::Metadata, + os: String, + os_version: String?, + repo_digests: ::Array[String], + repo_tags: ::Array[String], + root_fs: Docker::Image::RootFs, + size: Integer, + variant: String? + } + + class Image < Docker::Internal::Type::BaseModel + attr_reader architecture: String? + + def architecture=: (String) -> String + + attr_accessor author: String? + + attr_accessor comment: String? + + attr_reader config: Docker::Image::Config? + + def config=: (Docker::Image::Config) -> Docker::Image::Config + + attr_accessor created: String? + + attr_reader descriptor: Docker::Image::Descriptor? + + def descriptor=: (Docker::Image::Descriptor) -> Docker::Image::Descriptor + + attr_reader graph_driver: Docker::Image::GraphDriver? + + def graph_driver=: ( + Docker::Image::GraphDriver + ) -> Docker::Image::GraphDriver + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader identity: Docker::Image::Identity? + + def identity=: (Docker::Image::Identity) -> Docker::Image::Identity + + attr_accessor manifests: ::Array[Docker::Image::Manifest]? + + attr_reader metadata: Docker::Image::Metadata? + + def metadata=: (Docker::Image::Metadata) -> Docker::Image::Metadata + + attr_reader os: String? + + def os=: (String) -> String + + attr_accessor os_version: String? + + attr_reader repo_digests: ::Array[String]? + + def repo_digests=: (::Array[String]) -> ::Array[String] + + attr_reader repo_tags: ::Array[String]? + + def repo_tags=: (::Array[String]) -> ::Array[String] + + attr_reader root_fs: Docker::Image::RootFs? + + def root_fs=: (Docker::Image::RootFs) -> Docker::Image::RootFs + + attr_reader size: Integer? + + def size=: (Integer) -> Integer + + attr_accessor variant: String? + + def initialize: ( + ?architecture: String, + ?author: String?, + ?comment: String?, + ?config: Docker::Image::Config, + ?created: String?, + ?descriptor: Docker::Image::Descriptor, + ?graph_driver: Docker::Image::GraphDriver, + ?id: String, + ?identity: Docker::Image::Identity, + ?manifests: ::Array[Docker::Image::Manifest]?, + ?metadata: Docker::Image::Metadata, + ?os: String, + ?os_version: String?, + ?repo_digests: ::Array[String], + ?repo_tags: ::Array[String], + ?root_fs: Docker::Image::RootFs, + ?size: Integer, + ?variant: String? + ) -> void + + def to_hash: -> { + architecture: String, + author: String?, + comment: String?, + config: Docker::Image::Config, + created: String?, + descriptor: Docker::Image::Descriptor, + graph_driver: Docker::Image::GraphDriver, + id: String, + identity: Docker::Image::Identity, + manifests: ::Array[Docker::Image::Manifest]?, + metadata: Docker::Image::Metadata, + os: String, + os_version: String?, + repo_digests: ::Array[String], + repo_tags: ::Array[String], + root_fs: Docker::Image::RootFs, + size: Integer, + variant: String? + } + + type config = + { + args_escaped: bool?, + cmd: ::Array[String], + entrypoint: ::Array[String], + env: ::Array[String], + exposed_ports: ::Hash[Symbol, top]?, + healthcheck: Docker::Image::Config::Healthcheck, + labels: ::Hash[Symbol, String], + on_build: ::Array[String]?, + shell: ::Array[String]?, + stop_signal: String?, + user: String, + volumes: ::Hash[Symbol, top], + working_dir: String + } + + class Config < Docker::Internal::Type::BaseModel + attr_accessor args_escaped: bool? + + attr_reader cmd: ::Array[String]? + + def cmd=: (::Array[String]) -> ::Array[String] + + attr_reader entrypoint: ::Array[String]? + + def entrypoint=: (::Array[String]) -> ::Array[String] + + attr_reader env: ::Array[String]? + + def env=: (::Array[String]) -> ::Array[String] + + attr_accessor exposed_ports: ::Hash[Symbol, top]? + + attr_reader healthcheck: Docker::Image::Config::Healthcheck? + + def healthcheck=: ( + Docker::Image::Config::Healthcheck + ) -> Docker::Image::Config::Healthcheck + + attr_reader labels: ::Hash[Symbol, String]? + + def labels=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_accessor on_build: ::Array[String]? + + attr_accessor shell: ::Array[String]? + + attr_accessor stop_signal: String? + + attr_reader user: String? + + def user=: (String) -> String + + attr_reader volumes: ::Hash[Symbol, top]? + + def volumes=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader working_dir: String? + + def working_dir=: (String) -> String + + def initialize: ( + ?args_escaped: bool?, + ?cmd: ::Array[String], + ?entrypoint: ::Array[String], + ?env: ::Array[String], + ?exposed_ports: ::Hash[Symbol, top]?, + ?healthcheck: Docker::Image::Config::Healthcheck, + ?labels: ::Hash[Symbol, String], + ?on_build: ::Array[String]?, + ?shell: ::Array[String]?, + ?stop_signal: String?, + ?user: String, + ?volumes: ::Hash[Symbol, top], + ?working_dir: String + ) -> void + + def to_hash: -> { + args_escaped: bool?, + cmd: ::Array[String], + entrypoint: ::Array[String], + env: ::Array[String], + exposed_ports: ::Hash[Symbol, top]?, + healthcheck: Docker::Image::Config::Healthcheck, + labels: ::Hash[Symbol, String], + on_build: ::Array[String]?, + shell: ::Array[String]?, + stop_signal: String?, + user: String, + volumes: ::Hash[Symbol, top], + working_dir: String + } + + type healthcheck = + { + interval: Integer, + retries: Integer, + start_interval: Integer, + start_period: Integer, + test_: ::Array[String], + timeout: Integer + } + + class Healthcheck < Docker::Internal::Type::BaseModel + attr_reader interval: Integer? + + def interval=: (Integer) -> Integer + + attr_reader retries: Integer? + + def retries=: (Integer) -> Integer + + attr_reader start_interval: Integer? + + def start_interval=: (Integer) -> Integer + + attr_reader start_period: Integer? + + def start_period=: (Integer) -> Integer + + attr_reader test_: ::Array[String]? + + def test_=: (::Array[String]) -> ::Array[String] + + attr_reader timeout: Integer? + + def timeout=: (Integer) -> Integer + + def initialize: ( + ?interval: Integer, + ?retries: Integer, + ?start_interval: Integer, + ?start_period: Integer, + ?test_: ::Array[String], + ?timeout: Integer + ) -> void + + def to_hash: -> { + interval: Integer, + retries: Integer, + start_interval: Integer, + start_period: Integer, + test_: ::Array[String], + timeout: Integer + } + end + end + + type descriptor = + { + annotations: ::Hash[Symbol, String]?, + artifact_type: String?, + data: String?, + digest: String, + media_type: String, + platform: Docker::Image::Descriptor::Platform?, + size: Integer, + urls: ::Array[String]? + } + + class Descriptor < Docker::Internal::Type::BaseModel + attr_accessor annotations: ::Hash[Symbol, String]? + + attr_accessor artifact_type: String? + + attr_accessor data: String? + + attr_reader digest: String? + + def digest=: (String) -> String + + attr_reader media_type: String? + + def media_type=: (String) -> String + + attr_accessor platform: Docker::Image::Descriptor::Platform? + + attr_reader size: Integer? + + def size=: (Integer) -> Integer + + attr_accessor urls: ::Array[String]? + + def initialize: ( + ?annotations: ::Hash[Symbol, String]?, + ?artifact_type: String?, + ?data: String?, + ?digest: String, + ?media_type: String, + ?platform: Docker::Image::Descriptor::Platform?, + ?size: Integer, + ?urls: ::Array[String]? + ) -> void + + def to_hash: -> { + annotations: ::Hash[Symbol, String]?, + artifact_type: String?, + data: String?, + digest: String, + media_type: String, + platform: Docker::Image::Descriptor::Platform?, + size: Integer, + urls: ::Array[String]? + } + + type platform = + { + architecture: String, + os: String, + os_features: ::Array[String], + os_version: String, + variant: String + } + + class Platform < Docker::Internal::Type::BaseModel + attr_reader architecture: String? + + def architecture=: (String) -> String + + attr_reader os: String? + + def os=: (String) -> String + + attr_reader os_features: ::Array[String]? + + def os_features=: (::Array[String]) -> ::Array[String] + + attr_reader os_version: String? + + def os_version=: (String) -> String + + attr_reader variant: String? + + def variant=: (String) -> String + + def initialize: ( + ?architecture: String, + ?os: String, + ?os_features: ::Array[String], + ?os_version: String, + ?variant: String + ) -> void + + def to_hash: -> { + architecture: String, + os: String, + os_features: ::Array[String], + os_version: String, + variant: String + } + end + end + + type graph_driver = { data: ::Hash[Symbol, String], name: String } + + class GraphDriver < Docker::Internal::Type::BaseModel + attr_accessor data: ::Hash[Symbol, String] + + attr_accessor name: String + + def initialize: (data: ::Hash[Symbol, String], name: String) -> void + + def to_hash: -> { data: ::Hash[Symbol, String], name: String } + end + + type identity = + { + build: ::Array[Docker::Image::Identity::Build], + pull: ::Array[Docker::Image::Identity::Pull], + signature: ::Array[Docker::Image::Identity::Signature] + } + + class Identity < Docker::Internal::Type::BaseModel + attr_reader build: ::Array[Docker::Image::Identity::Build]? + + def build=: ( + ::Array[Docker::Image::Identity::Build] + ) -> ::Array[Docker::Image::Identity::Build] + + attr_reader pull: ::Array[Docker::Image::Identity::Pull]? + + def pull=: ( + ::Array[Docker::Image::Identity::Pull] + ) -> ::Array[Docker::Image::Identity::Pull] + + attr_reader signature: ::Array[Docker::Image::Identity::Signature]? + + def signature=: ( + ::Array[Docker::Image::Identity::Signature] + ) -> ::Array[Docker::Image::Identity::Signature] + + def initialize: ( + ?build: ::Array[Docker::Image::Identity::Build], + ?pull: ::Array[Docker::Image::Identity::Pull], + ?signature: ::Array[Docker::Image::Identity::Signature] + ) -> void + + def to_hash: -> { + build: ::Array[Docker::Image::Identity::Build], + pull: ::Array[Docker::Image::Identity::Pull], + signature: ::Array[Docker::Image::Identity::Signature] + } + + type build = { created_at: Time, ref: String } + + class Build < Docker::Internal::Type::BaseModel + attr_reader created_at: Time? + + def created_at=: (Time) -> Time + + attr_reader ref: String? + + def ref=: (String) -> String + + def initialize: (?created_at: Time, ?ref: String) -> void + + def to_hash: -> { created_at: Time, ref: String } + end + + type pull = { repository: String } + + class Pull < Docker::Internal::Type::BaseModel + attr_reader repository: String? + + def repository=: (String) -> String + + def initialize: (?repository: String) -> void + + def to_hash: -> { repository: String } + end + + type signature = + { + docker_reference: String, + error: String, + known_signer: Docker::Models::Image::Identity::Signature::known_signer, + name: String, + signature_type: Docker::Models::Image::Identity::Signature::signature_type, + signer: Docker::Image::Identity::Signature::Signer, + timestamps: ::Array[Docker::Image::Identity::Signature::Timestamp], + warnings: ::Array[String] + } + + class Signature < Docker::Internal::Type::BaseModel + attr_reader docker_reference: String? + + def docker_reference=: (String) -> String + + attr_reader error: String? + + def error=: (String) -> String + + attr_reader known_signer: Docker::Models::Image::Identity::Signature::known_signer? + + def known_signer=: ( + Docker::Models::Image::Identity::Signature::known_signer + ) -> Docker::Models::Image::Identity::Signature::known_signer + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader signature_type: Docker::Models::Image::Identity::Signature::signature_type? + + def signature_type=: ( + Docker::Models::Image::Identity::Signature::signature_type + ) -> Docker::Models::Image::Identity::Signature::signature_type + + attr_reader signer: Docker::Image::Identity::Signature::Signer? + + def signer=: ( + Docker::Image::Identity::Signature::Signer + ) -> Docker::Image::Identity::Signature::Signer + + attr_reader timestamps: ::Array[Docker::Image::Identity::Signature::Timestamp]? + + def timestamps=: ( + ::Array[Docker::Image::Identity::Signature::Timestamp] + ) -> ::Array[Docker::Image::Identity::Signature::Timestamp] + + attr_reader warnings: ::Array[String]? + + def warnings=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?docker_reference: String, + ?error: String, + ?known_signer: Docker::Models::Image::Identity::Signature::known_signer, + ?name: String, + ?signature_type: Docker::Models::Image::Identity::Signature::signature_type, + ?signer: Docker::Image::Identity::Signature::Signer, + ?timestamps: ::Array[Docker::Image::Identity::Signature::Timestamp], + ?warnings: ::Array[String] + ) -> void + + def to_hash: -> { + docker_reference: String, + error: String, + known_signer: Docker::Models::Image::Identity::Signature::known_signer, + name: String, + signature_type: Docker::Models::Image::Identity::Signature::signature_type, + signer: Docker::Image::Identity::Signature::Signer, + timestamps: ::Array[Docker::Image::Identity::Signature::Timestamp], + warnings: ::Array[String] + } + + type known_signer = :DHI + + module KnownSigner + extend Docker::Internal::Type::Enum + + DHI: :DHI + + def self?.values: -> ::Array[Docker::Models::Image::Identity::Signature::known_signer] + end + + type signature_type = :"bundle-v0.3" | :"simplesigning-v1" + + module SignatureType + extend Docker::Internal::Type::Enum + + BUNDLE_V0_3: :"bundle-v0.3" + SIMPLESIGNING_V1: :"simplesigning-v1" + + def self?.values: -> ::Array[Docker::Models::Image::Identity::Signature::signature_type] + end + + type signer = + { + build_config_digest: String, + build_config_uri: String, + build_signer_digest: String, + build_signer_uri: String, + build_trigger: String, + certificate_issuer: String, + issuer: String, + run_invocation_uri: String, + runner_environment: String, + source_repository_digest: String, + source_repository_identifier: String, + source_repository_owner_identifier: String, + source_repository_owner_uri: String, + source_repository_ref: String, + source_repository_uri: String, + source_repository_visibility_at_signing: String, + subject_alternative_name: String + } + + class Signer < Docker::Internal::Type::BaseModel + attr_reader build_config_digest: String? + + def build_config_digest=: (String) -> String + + attr_reader build_config_uri: String? + + def build_config_uri=: (String) -> String + + attr_reader build_signer_digest: String? + + def build_signer_digest=: (String) -> String + + attr_reader build_signer_uri: String? + + def build_signer_uri=: (String) -> String + + attr_reader build_trigger: String? + + def build_trigger=: (String) -> String + + attr_reader certificate_issuer: String? + + def certificate_issuer=: (String) -> String + + attr_reader issuer: String? + + def issuer=: (String) -> String + + attr_reader run_invocation_uri: String? + + def run_invocation_uri=: (String) -> String + + attr_reader runner_environment: String? + + def runner_environment=: (String) -> String + + attr_reader source_repository_digest: String? + + def source_repository_digest=: (String) -> String + + attr_reader source_repository_identifier: String? + + def source_repository_identifier=: (String) -> String + + attr_reader source_repository_owner_identifier: String? + + def source_repository_owner_identifier=: (String) -> String + + attr_reader source_repository_owner_uri: String? + + def source_repository_owner_uri=: (String) -> String + + attr_reader source_repository_ref: String? + + def source_repository_ref=: (String) -> String + + attr_reader source_repository_uri: String? + + def source_repository_uri=: (String) -> String + + attr_reader source_repository_visibility_at_signing: String? + + def source_repository_visibility_at_signing=: (String) -> String + + attr_reader subject_alternative_name: String? + + def subject_alternative_name=: (String) -> String + + def initialize: ( + ?build_config_digest: String, + ?build_config_uri: String, + ?build_signer_digest: String, + ?build_signer_uri: String, + ?build_trigger: String, + ?certificate_issuer: String, + ?issuer: String, + ?run_invocation_uri: String, + ?runner_environment: String, + ?source_repository_digest: String, + ?source_repository_identifier: String, + ?source_repository_owner_identifier: String, + ?source_repository_owner_uri: String, + ?source_repository_ref: String, + ?source_repository_uri: String, + ?source_repository_visibility_at_signing: String, + ?subject_alternative_name: String + ) -> void + + def to_hash: -> { + build_config_digest: String, + build_config_uri: String, + build_signer_digest: String, + build_signer_uri: String, + build_trigger: String, + certificate_issuer: String, + issuer: String, + run_invocation_uri: String, + runner_environment: String, + source_repository_digest: String, + source_repository_identifier: String, + source_repository_owner_identifier: String, + source_repository_owner_uri: String, + source_repository_ref: String, + source_repository_uri: String, + source_repository_visibility_at_signing: String, + subject_alternative_name: String + } + end + + type timestamp = + { + timestamp: Time, + type: Docker::Models::Image::Identity::Signature::Timestamp::type_, + uri: String + } + + class Timestamp < Docker::Internal::Type::BaseModel + attr_reader timestamp: Time? + + def timestamp=: (Time) -> Time + + attr_reader type: Docker::Models::Image::Identity::Signature::Timestamp::type_? + + def type=: ( + Docker::Models::Image::Identity::Signature::Timestamp::type_ + ) -> Docker::Models::Image::Identity::Signature::Timestamp::type_ + + attr_reader uri: String? + + def uri=: (String) -> String + + def initialize: ( + ?timestamp: Time, + ?type: Docker::Models::Image::Identity::Signature::Timestamp::type_, + ?uri: String + ) -> void + + def to_hash: -> { + timestamp: Time, + type: Docker::Models::Image::Identity::Signature::Timestamp::type_, + uri: String + } + + type type_ = :Tlog | :TimestampAuthority + + module Type + extend Docker::Internal::Type::Enum + + TLOG: :Tlog + TIMESTAMP_AUTHORITY: :TimestampAuthority + + def self?.values: -> ::Array[Docker::Models::Image::Identity::Signature::Timestamp::type_] + end + end + end + end + + type manifest = + { + available: bool, + descriptor: Docker::Image::Manifest::Descriptor, + id: String, + kind: Docker::Models::Image::Manifest::kind, + size: Docker::Image::Manifest::Size, + attestation_data: Docker::Image::Manifest::AttestationData?, + image_data: Docker::Image::Manifest::ImageData? + } + + class Manifest < Docker::Internal::Type::BaseModel + attr_accessor available: bool + + attr_accessor descriptor: Docker::Image::Manifest::Descriptor + + attr_accessor id: String + + attr_accessor kind: Docker::Models::Image::Manifest::kind + + attr_accessor size: Docker::Image::Manifest::Size + + attr_accessor attestation_data: Docker::Image::Manifest::AttestationData? + + attr_accessor image_data: Docker::Image::Manifest::ImageData? + + def initialize: ( + available: bool, + descriptor: Docker::Image::Manifest::Descriptor, + id: String, + kind: Docker::Models::Image::Manifest::kind, + size: Docker::Image::Manifest::Size, + ?attestation_data: Docker::Image::Manifest::AttestationData?, + ?image_data: Docker::Image::Manifest::ImageData? + ) -> void + + def to_hash: -> { + available: bool, + descriptor: Docker::Image::Manifest::Descriptor, + id: String, + kind: Docker::Models::Image::Manifest::kind, + size: Docker::Image::Manifest::Size, + attestation_data: Docker::Image::Manifest::AttestationData?, + image_data: Docker::Image::Manifest::ImageData? + } + + type descriptor = + { + annotations: ::Hash[Symbol, String]?, + artifact_type: String?, + data: String?, + digest: String, + media_type: String, + platform: Docker::Image::Manifest::Descriptor::Platform?, + size: Integer, + urls: ::Array[String]? + } + + class Descriptor < Docker::Internal::Type::BaseModel + attr_accessor annotations: ::Hash[Symbol, String]? + + attr_accessor artifact_type: String? + + attr_accessor data: String? + + attr_reader digest: String? + + def digest=: (String) -> String + + attr_reader media_type: String? + + def media_type=: (String) -> String + + attr_accessor platform: Docker::Image::Manifest::Descriptor::Platform? + + attr_reader size: Integer? + + def size=: (Integer) -> Integer + + attr_accessor urls: ::Array[String]? + + def initialize: ( + ?annotations: ::Hash[Symbol, String]?, + ?artifact_type: String?, + ?data: String?, + ?digest: String, + ?media_type: String, + ?platform: Docker::Image::Manifest::Descriptor::Platform?, + ?size: Integer, + ?urls: ::Array[String]? + ) -> void + + def to_hash: -> { + annotations: ::Hash[Symbol, String]?, + artifact_type: String?, + data: String?, + digest: String, + media_type: String, + platform: Docker::Image::Manifest::Descriptor::Platform?, + size: Integer, + urls: ::Array[String]? + } + + type platform = + { + architecture: String, + os: String, + os_features: ::Array[String], + os_version: String, + variant: String + } + + class Platform < Docker::Internal::Type::BaseModel + attr_reader architecture: String? + + def architecture=: (String) -> String + + attr_reader os: String? + + def os=: (String) -> String + + attr_reader os_features: ::Array[String]? + + def os_features=: (::Array[String]) -> ::Array[String] + + attr_reader os_version: String? + + def os_version=: (String) -> String + + attr_reader variant: String? + + def variant=: (String) -> String + + def initialize: ( + ?architecture: String, + ?os: String, + ?os_features: ::Array[String], + ?os_version: String, + ?variant: String + ) -> void + + def to_hash: -> { + architecture: String, + os: String, + os_features: ::Array[String], + os_version: String, + variant: String + } + end + end + + type kind = :image | :attestation | :unknown + + module Kind + extend Docker::Internal::Type::Enum + + IMAGE: :image + ATTESTATION: :attestation + UNKNOWN: :unknown + + def self?.values: -> ::Array[Docker::Models::Image::Manifest::kind] + end + + type size = { content: Integer, total: Integer } + + class Size < Docker::Internal::Type::BaseModel + attr_accessor content: Integer + + attr_accessor total: Integer + + def initialize: (content: Integer, total: Integer) -> void + + def to_hash: -> { content: Integer, total: Integer } + end + + type attestation_data = { for_: String } + + class AttestationData < Docker::Internal::Type::BaseModel + attr_accessor for_: String + + def initialize: (for_: String) -> void + + def to_hash: -> { for_: String } + end + + type image_data = + { + containers: ::Array[String], + platform: Docker::Image::Manifest::ImageData::Platform?, + size: Docker::Image::Manifest::ImageData::Size + } + + class ImageData < Docker::Internal::Type::BaseModel + attr_accessor containers: ::Array[String] + + attr_accessor platform: Docker::Image::Manifest::ImageData::Platform? + + attr_accessor size: Docker::Image::Manifest::ImageData::Size + + def initialize: ( + containers: ::Array[String], + platform: Docker::Image::Manifest::ImageData::Platform?, + size: Docker::Image::Manifest::ImageData::Size + ) -> void + + def to_hash: -> { + containers: ::Array[String], + platform: Docker::Image::Manifest::ImageData::Platform?, + size: Docker::Image::Manifest::ImageData::Size + } + + type platform = + { + architecture: String, + os: String, + os_features: ::Array[String], + os_version: String, + variant: String + } + + class Platform < Docker::Internal::Type::BaseModel + attr_reader architecture: String? + + def architecture=: (String) -> String + + attr_reader os: String? + + def os=: (String) -> String + + attr_reader os_features: ::Array[String]? + + def os_features=: (::Array[String]) -> ::Array[String] + + attr_reader os_version: String? + + def os_version=: (String) -> String + + attr_reader variant: String? + + def variant=: (String) -> String + + def initialize: ( + ?architecture: String, + ?os: String, + ?os_features: ::Array[String], + ?os_version: String, + ?variant: String + ) -> void + + def to_hash: -> { + architecture: String, + os: String, + os_features: ::Array[String], + os_version: String, + variant: String + } + end + + type size = { unpacked: Integer } + + class Size < Docker::Internal::Type::BaseModel + attr_accessor unpacked: Integer + + def initialize: (unpacked: Integer) -> void + + def to_hash: -> { unpacked: Integer } + end + end + end + + type metadata = { last_tag_time: String? } + + class Metadata < Docker::Internal::Type::BaseModel + attr_accessor last_tag_time: String? + + def initialize: (?last_tag_time: String?) -> void + + def to_hash: -> { last_tag_time: String? } + end + + type root_fs = { type: String, layers: ::Array[String] } + + class RootFs < Docker::Internal::Type::BaseModel + attr_accessor type: String + + attr_reader layers: ::Array[String]? + + def layers=: (::Array[String]) -> ::Array[String] + + def initialize: (type: String, ?layers: ::Array[String]) -> void + + def to_hash: -> { type: String, layers: ::Array[String] } + end + end + end +end diff --git a/sig/docker/models/image_delete_params.rbs b/sig/docker/models/image_delete_params.rbs new file mode 100644 index 0000000..303de44 --- /dev/null +++ b/sig/docker/models/image_delete_params.rbs @@ -0,0 +1,38 @@ +module Docker + module Models + type image_delete_params = + { force: bool, noprune: bool, platforms: ::Array[String] } + & Docker::Internal::Type::request_parameters + + class ImageDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader force: bool? + + def force=: (bool) -> bool + + attr_reader noprune: bool? + + def noprune=: (bool) -> bool + + attr_reader platforms: ::Array[String]? + + def platforms=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?force: bool, + ?noprune: bool, + ?platforms: ::Array[String], + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + force: bool, + noprune: bool, + platforms: ::Array[String], + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/image_delete_response.rbs b/sig/docker/models/image_delete_response.rbs new file mode 100644 index 0000000..b22e528 --- /dev/null +++ b/sig/docker/models/image_delete_response.rbs @@ -0,0 +1,24 @@ +module Docker + module Models + type image_delete_response_item = { deleted: String, untagged: String } + + class ImageDeleteResponseItem < Docker::Internal::Type::BaseModel + attr_reader deleted: String? + + def deleted=: (String) -> String + + attr_reader untagged: String? + + def untagged=: (String) -> String + + def initialize: (?deleted: String, ?untagged: String) -> void + + def to_hash: -> { deleted: String, untagged: String } + end + + type image_delete_response = + ::Array[Docker::Models::ImageDeleteResponseItem] + + ImageDeleteResponse: Docker::Internal::Type::Converter + end +end diff --git a/sig/docker/models/image_inspect_params.rbs b/sig/docker/models/image_inspect_params.rbs new file mode 100644 index 0000000..29029df --- /dev/null +++ b/sig/docker/models/image_inspect_params.rbs @@ -0,0 +1,25 @@ +module Docker + module Models + type image_inspect_params = + { manifests: bool } & Docker::Internal::Type::request_parameters + + class ImageInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader manifests: bool? + + def manifests=: (bool) -> bool + + def initialize: ( + ?manifests: bool, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + manifests: bool, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/image_list_params.rbs b/sig/docker/models/image_list_params.rbs new file mode 100644 index 0000000..cd57d6b --- /dev/null +++ b/sig/docker/models/image_list_params.rbs @@ -0,0 +1,56 @@ +module Docker + module Models + type image_list_params = + { + all: bool, + digests: bool, + filters: String, + manifests: bool, + shared_size: bool + } + & Docker::Internal::Type::request_parameters + + class ImageListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader all: bool? + + def all=: (bool) -> bool + + attr_reader digests: bool? + + def digests=: (bool) -> bool + + attr_reader filters: String? + + def filters=: (String) -> String + + attr_reader manifests: bool? + + def manifests=: (bool) -> bool + + attr_reader shared_size: bool? + + def shared_size=: (bool) -> bool + + def initialize: ( + ?all: bool, + ?digests: bool, + ?filters: String, + ?manifests: bool, + ?shared_size: bool, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + all: bool, + digests: bool, + filters: String, + manifests: bool, + shared_size: bool, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/image_list_response.rbs b/sig/docker/models/image_list_response.rbs new file mode 100644 index 0000000..468deb3 --- /dev/null +++ b/sig/docker/models/image_list_response.rbs @@ -0,0 +1,7 @@ +module Docker + module Models + type image_list_response = ::Array[Docker::Summary] + + ImageListResponse: Docker::Internal::Type::Converter + end +end diff --git a/sig/docker/models/image_pull_params.rbs b/sig/docker/models/image_pull_params.rbs new file mode 100644 index 0000000..67dca90 --- /dev/null +++ b/sig/docker/models/image_pull_params.rbs @@ -0,0 +1,84 @@ +module Docker + module Models + type image_pull_params = + { + changes: ::Array[String], + from_image: String, + from_src: String, + message: String, + platform: String, + repo: String, + tag: String, + body: String, + x_registry_auth: String + } + & Docker::Internal::Type::request_parameters + + class ImagePullParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader changes: ::Array[String]? + + def changes=: (::Array[String]) -> ::Array[String] + + attr_reader from_image: String? + + def from_image=: (String) -> String + + attr_reader from_src: String? + + def from_src=: (String) -> String + + attr_reader message: String? + + def message=: (String) -> String + + attr_reader platform: String? + + def platform=: (String) -> String + + attr_reader repo: String? + + def repo=: (String) -> String + + attr_reader tag: String? + + def tag=: (String) -> String + + attr_reader body: String? + + def body=: (String) -> String + + attr_reader x_registry_auth: String? + + def x_registry_auth=: (String) -> String + + def initialize: ( + ?changes: ::Array[String], + ?from_image: String, + ?from_src: String, + ?message: String, + ?platform: String, + ?repo: String, + ?tag: String, + ?body: String, + ?x_registry_auth: String, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + changes: ::Array[String], + from_image: String, + from_src: String, + message: String, + platform: String, + repo: String, + tag: String, + body: String, + x_registry_auth: String, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/network.rbs b/sig/docker/models/network.rbs new file mode 100644 index 0000000..b42737e --- /dev/null +++ b/sig/docker/models/network.rbs @@ -0,0 +1,236 @@ +module Docker + module Models + type network = + { + attachable: bool, + config_from: Docker::Network::ConfigFrom, + config_only: bool, + created: String, + driver: String, + :enable_i_pv4 => bool, + :enable_i_pv6 => bool, + id: String, + ingress: bool, + internal: bool, + ipam: Docker::Network::Ipam, + labels: ::Hash[Symbol, String], + name: String, + options: ::Hash[Symbol, String], + peers: ::Array[Docker::Network::Peer], + scope: String + } + + class Network < Docker::Internal::Type::BaseModel + attr_reader attachable: bool? + + def attachable=: (bool) -> bool + + attr_reader config_from: Docker::Network::ConfigFrom? + + def config_from=: ( + Docker::Network::ConfigFrom + ) -> Docker::Network::ConfigFrom + + attr_reader config_only: bool? + + def config_only=: (bool) -> bool + + attr_reader created: String? + + def created=: (String) -> String + + attr_reader driver: String? + + def driver=: (String) -> String + + attr_reader enable_i_pv4: bool? + + def enable_i_pv4=: (bool) -> bool + + attr_reader enable_i_pv6: bool? + + def enable_i_pv6=: (bool) -> bool + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader ingress: bool? + + def ingress=: (bool) -> bool + + attr_reader internal: bool? + + def internal=: (bool) -> bool + + attr_reader ipam: Docker::Network::Ipam? + + def ipam=: (Docker::Network::Ipam) -> Docker::Network::Ipam + + attr_reader labels: ::Hash[Symbol, String]? + + def labels=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader options: ::Hash[Symbol, String]? + + def options=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader peers: ::Array[Docker::Network::Peer]? + + def peers=: ( + ::Array[Docker::Network::Peer] + ) -> ::Array[Docker::Network::Peer] + + attr_reader scope: String? + + def scope=: (String) -> String + + def initialize: ( + ?attachable: bool, + ?config_from: Docker::Network::ConfigFrom, + ?config_only: bool, + ?created: String, + ?driver: String, + ?enable_i_pv4: bool, + ?enable_i_pv6: bool, + ?id: String, + ?ingress: bool, + ?internal: bool, + ?ipam: Docker::Network::Ipam, + ?labels: ::Hash[Symbol, String], + ?name: String, + ?options: ::Hash[Symbol, String], + ?peers: ::Array[Docker::Network::Peer], + ?scope: String + ) -> void + + def to_hash: -> { + attachable: bool, + config_from: Docker::Network::ConfigFrom, + config_only: bool, + created: String, + driver: String, + :enable_i_pv4 => bool, + :enable_i_pv6 => bool, + id: String, + ingress: bool, + internal: bool, + ipam: Docker::Network::Ipam, + labels: ::Hash[Symbol, String], + name: String, + options: ::Hash[Symbol, String], + peers: ::Array[Docker::Network::Peer], + scope: String + } + + type config_from = { network: String } + + class ConfigFrom < Docker::Internal::Type::BaseModel + attr_reader network: String? + + def network=: (String) -> String + + def initialize: (?network: String) -> void + + def to_hash: -> { network: String } + end + + type ipam = + { + config: ::Array[Docker::Network::Ipam::Config], + driver: String, + options: ::Hash[Symbol, String] + } + + class Ipam < Docker::Internal::Type::BaseModel + attr_reader config: ::Array[Docker::Network::Ipam::Config]? + + def config=: ( + ::Array[Docker::Network::Ipam::Config] + ) -> ::Array[Docker::Network::Ipam::Config] + + attr_reader driver: String? + + def driver=: (String) -> String + + attr_reader options: ::Hash[Symbol, String]? + + def options=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + def initialize: ( + ?config: ::Array[Docker::Network::Ipam::Config], + ?driver: String, + ?options: ::Hash[Symbol, String] + ) -> void + + def to_hash: -> { + config: ::Array[Docker::Network::Ipam::Config], + driver: String, + options: ::Hash[Symbol, String] + } + + type config = + { + auxiliary_addresses: ::Hash[Symbol, String], + gateway: String, + ip_range: String, + subnet: String + } + + class Config < Docker::Internal::Type::BaseModel + attr_reader auxiliary_addresses: ::Hash[Symbol, String]? + + def auxiliary_addresses=: ( + ::Hash[Symbol, String] + ) -> ::Hash[Symbol, String] + + attr_reader gateway: String? + + def gateway=: (String) -> String + + attr_reader ip_range: String? + + def ip_range=: (String) -> String + + attr_reader subnet: String? + + def subnet=: (String) -> String + + def initialize: ( + ?auxiliary_addresses: ::Hash[Symbol, String], + ?gateway: String, + ?ip_range: String, + ?subnet: String + ) -> void + + def to_hash: -> { + auxiliary_addresses: ::Hash[Symbol, String], + gateway: String, + ip_range: String, + subnet: String + } + end + end + + type peer = { ip: String, name: String } + + class Peer < Docker::Internal::Type::BaseModel + attr_reader ip: String? + + def ip=: (String) -> String + + attr_reader name: String? + + def name=: (String) -> String + + def initialize: (?ip: String, ?name: String) -> void + + def to_hash: -> { ip: String, name: String } + end + end + end +end diff --git a/sig/docker/models/network_create_params.rbs b/sig/docker/models/network_create_params.rbs new file mode 100644 index 0000000..a8af9f4 --- /dev/null +++ b/sig/docker/models/network_create_params.rbs @@ -0,0 +1,203 @@ +module Docker + module Models + type network_create_params = + { + name: String, + attachable: bool, + config_from: Docker::NetworkCreateParams::ConfigFrom, + config_only: bool, + driver: String, + :enable_i_pv4 => bool, + :enable_i_pv6 => bool, + ingress: bool, + internal: bool, + ipam: Docker::NetworkCreateParams::Ipam, + labels: ::Hash[Symbol, String], + options: ::Hash[Symbol, String], + scope: String + } + & Docker::Internal::Type::request_parameters + + class NetworkCreateParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_accessor name: String + + attr_reader attachable: bool? + + def attachable=: (bool) -> bool + + attr_reader config_from: Docker::NetworkCreateParams::ConfigFrom? + + def config_from=: ( + Docker::NetworkCreateParams::ConfigFrom + ) -> Docker::NetworkCreateParams::ConfigFrom + + attr_reader config_only: bool? + + def config_only=: (bool) -> bool + + attr_reader driver: String? + + def driver=: (String) -> String + + attr_reader enable_i_pv4: bool? + + def enable_i_pv4=: (bool) -> bool + + attr_reader enable_i_pv6: bool? + + def enable_i_pv6=: (bool) -> bool + + attr_reader ingress: bool? + + def ingress=: (bool) -> bool + + attr_reader internal: bool? + + def internal=: (bool) -> bool + + attr_reader ipam: Docker::NetworkCreateParams::Ipam? + + def ipam=: ( + Docker::NetworkCreateParams::Ipam + ) -> Docker::NetworkCreateParams::Ipam + + attr_reader labels: ::Hash[Symbol, String]? + + def labels=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader options: ::Hash[Symbol, String]? + + def options=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader scope: String? + + def scope=: (String) -> String + + def initialize: ( + name: String, + ?attachable: bool, + ?config_from: Docker::NetworkCreateParams::ConfigFrom, + ?config_only: bool, + ?driver: String, + ?enable_i_pv4: bool, + ?enable_i_pv6: bool, + ?ingress: bool, + ?internal: bool, + ?ipam: Docker::NetworkCreateParams::Ipam, + ?labels: ::Hash[Symbol, String], + ?options: ::Hash[Symbol, String], + ?scope: String, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + name: String, + attachable: bool, + config_from: Docker::NetworkCreateParams::ConfigFrom, + config_only: bool, + driver: String, + :enable_i_pv4 => bool, + :enable_i_pv6 => bool, + ingress: bool, + internal: bool, + ipam: Docker::NetworkCreateParams::Ipam, + labels: ::Hash[Symbol, String], + options: ::Hash[Symbol, String], + scope: String, + request_options: Docker::RequestOptions + } + + type config_from = { network: String } + + class ConfigFrom < Docker::Internal::Type::BaseModel + attr_reader network: String? + + def network=: (String) -> String + + def initialize: (?network: String) -> void + + def to_hash: -> { network: String } + end + + type ipam = + { + config: ::Array[Docker::NetworkCreateParams::Ipam::Config], + driver: String, + options: ::Hash[Symbol, String] + } + + class Ipam < Docker::Internal::Type::BaseModel + attr_reader config: ::Array[Docker::NetworkCreateParams::Ipam::Config]? + + def config=: ( + ::Array[Docker::NetworkCreateParams::Ipam::Config] + ) -> ::Array[Docker::NetworkCreateParams::Ipam::Config] + + attr_reader driver: String? + + def driver=: (String) -> String + + attr_reader options: ::Hash[Symbol, String]? + + def options=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + def initialize: ( + ?config: ::Array[Docker::NetworkCreateParams::Ipam::Config], + ?driver: String, + ?options: ::Hash[Symbol, String] + ) -> void + + def to_hash: -> { + config: ::Array[Docker::NetworkCreateParams::Ipam::Config], + driver: String, + options: ::Hash[Symbol, String] + } + + type config = + { + auxiliary_addresses: ::Hash[Symbol, String], + gateway: String, + ip_range: String, + subnet: String + } + + class Config < Docker::Internal::Type::BaseModel + attr_reader auxiliary_addresses: ::Hash[Symbol, String]? + + def auxiliary_addresses=: ( + ::Hash[Symbol, String] + ) -> ::Hash[Symbol, String] + + attr_reader gateway: String? + + def gateway=: (String) -> String + + attr_reader ip_range: String? + + def ip_range=: (String) -> String + + attr_reader subnet: String? + + def subnet=: (String) -> String + + def initialize: ( + ?auxiliary_addresses: ::Hash[Symbol, String], + ?gateway: String, + ?ip_range: String, + ?subnet: String + ) -> void + + def to_hash: -> { + auxiliary_addresses: ::Hash[Symbol, String], + gateway: String, + ip_range: String, + subnet: String + } + end + end + end + end +end diff --git a/sig/docker/models/network_create_response.rbs b/sig/docker/models/network_create_response.rbs new file mode 100644 index 0000000..19f0729 --- /dev/null +++ b/sig/docker/models/network_create_response.rbs @@ -0,0 +1,15 @@ +module Docker + module Models + type network_create_response = { id: String, warning: String } + + class NetworkCreateResponse < Docker::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor warning: String + + def initialize: (id: String, warning: String) -> void + + def to_hash: -> { id: String, warning: String } + end + end +end diff --git a/sig/docker/models/network_delete_params.rbs b/sig/docker/models/network_delete_params.rbs new file mode 100644 index 0000000..536c424 --- /dev/null +++ b/sig/docker/models/network_delete_params.rbs @@ -0,0 +1,15 @@ +module Docker + module Models + type network_delete_params = + { } & Docker::Internal::Type::request_parameters + + class NetworkDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + def initialize: (?request_options: Docker::request_opts) -> void + + def to_hash: -> { request_options: Docker::RequestOptions } + end + end +end diff --git a/sig/docker/models/network_inspect_params.rbs b/sig/docker/models/network_inspect_params.rbs new file mode 100644 index 0000000..3fb6399 --- /dev/null +++ b/sig/docker/models/network_inspect_params.rbs @@ -0,0 +1,32 @@ +module Docker + module Models + type network_inspect_params = + { scope: String, verbose: bool } + & Docker::Internal::Type::request_parameters + + class NetworkInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader scope: String? + + def scope=: (String) -> String + + attr_reader verbose: bool? + + def verbose=: (bool) -> bool + + def initialize: ( + ?scope: String, + ?verbose: bool, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + scope: String, + verbose: bool, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/network_inspect_response.rbs b/sig/docker/models/network_inspect_response.rbs new file mode 100644 index 0000000..dcce9ac --- /dev/null +++ b/sig/docker/models/network_inspect_response.rbs @@ -0,0 +1,149 @@ +module Docker + module Models + type network_inspect_response = + { + containers: ::Hash[Symbol, Docker::Models::NetworkInspectResponse::Container], + services: ::Hash[Symbol, top], + status: Docker::Models::NetworkInspectResponse::Status + } + + class NetworkInspectResponse < Docker::Models::Network + def containers: -> ::Hash[Symbol, Docker::Models::NetworkInspectResponse::Container]? + + def containers=: ( + ::Hash[Symbol, Docker::Models::NetworkInspectResponse::Container] _ + ) -> ::Hash[Symbol, Docker::Models::NetworkInspectResponse::Container] + + def services: -> ::Hash[Symbol, top]? + + def services=: (::Hash[Symbol, top] _) -> ::Hash[Symbol, top] + + def status: -> Docker::Models::NetworkInspectResponse::Status? + + def status=: ( + Docker::Models::NetworkInspectResponse::Status _ + ) -> Docker::Models::NetworkInspectResponse::Status + + def initialize: ( + ?containers: ::Hash[Symbol, Docker::Models::NetworkInspectResponse::Container], + ?services: ::Hash[Symbol, top], + ?status: Docker::Models::NetworkInspectResponse::Status + ) -> void + + def to_hash: -> { + containers: ::Hash[Symbol, Docker::Models::NetworkInspectResponse::Container], + services: ::Hash[Symbol, top], + status: Docker::Models::NetworkInspectResponse::Status + } + + type container = + { + endpoint_id: String, + :i_pv4_address => String, + :i_pv6_address => String, + mac_address: String, + name: String + } + + class Container < Docker::Internal::Type::BaseModel + attr_reader endpoint_id: String? + + def endpoint_id=: (String) -> String + + attr_reader i_pv4_address: String? + + def i_pv4_address=: (String) -> String + + attr_reader i_pv6_address: String? + + def i_pv6_address=: (String) -> String + + attr_reader mac_address: String? + + def mac_address=: (String) -> String + + attr_reader name: String? + + def name=: (String) -> String + + def initialize: ( + ?endpoint_id: String, + ?i_pv4_address: String, + ?i_pv6_address: String, + ?mac_address: String, + ?name: String + ) -> void + + def to_hash: -> { + endpoint_id: String, + :i_pv4_address => String, + :i_pv6_address => String, + mac_address: String, + name: String + } + end + + type status = + { ipam: Docker::Models::NetworkInspectResponse::Status::Ipam } + + class Status < Docker::Internal::Type::BaseModel + attr_reader ipam: Docker::Models::NetworkInspectResponse::Status::Ipam? + + def ipam=: ( + Docker::Models::NetworkInspectResponse::Status::Ipam + ) -> Docker::Models::NetworkInspectResponse::Status::Ipam + + def initialize: ( + ?ipam: Docker::Models::NetworkInspectResponse::Status::Ipam + ) -> void + + def to_hash: -> { + ipam: Docker::Models::NetworkInspectResponse::Status::Ipam + } + + type ipam = + { + subnets: ::Hash[Symbol, Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet] + } + + class Ipam < Docker::Internal::Type::BaseModel + attr_reader subnets: ::Hash[Symbol, Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet]? + + def subnets=: ( + ::Hash[Symbol, Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet] + ) -> ::Hash[Symbol, Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet] + + def initialize: ( + ?subnets: ::Hash[Symbol, Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet] + ) -> void + + def to_hash: -> { + subnets: ::Hash[Symbol, Docker::Models::NetworkInspectResponse::Status::Ipam::Subnet] + } + + type subnet = { dynamic_ips_available: Integer, ips_in_use: Integer } + + class Subnet < Docker::Internal::Type::BaseModel + attr_reader dynamic_ips_available: Integer? + + def dynamic_ips_available=: (Integer) -> Integer + + attr_reader ips_in_use: Integer? + + def ips_in_use=: (Integer) -> Integer + + def initialize: ( + ?dynamic_ips_available: Integer, + ?ips_in_use: Integer + ) -> void + + def to_hash: -> { + dynamic_ips_available: Integer, + ips_in_use: Integer + } + end + end + end + end + end +end diff --git a/sig/docker/models/network_list_params.rbs b/sig/docker/models/network_list_params.rbs new file mode 100644 index 0000000..65a162d --- /dev/null +++ b/sig/docker/models/network_list_params.rbs @@ -0,0 +1,25 @@ +module Docker + module Models + type network_list_params = + { filters: String } & Docker::Internal::Type::request_parameters + + class NetworkListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader filters: String? + + def filters=: (String) -> String + + def initialize: ( + ?filters: String, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + filters: String, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/network_list_response.rbs b/sig/docker/models/network_list_response.rbs new file mode 100644 index 0000000..0df480b --- /dev/null +++ b/sig/docker/models/network_list_response.rbs @@ -0,0 +1,7 @@ +module Docker + module Models + type network_list_response = ::Array[Docker::Summary] + + NetworkListResponse: Docker::Internal::Type::Converter + end +end diff --git a/sig/docker/models/service.rbs b/sig/docker/models/service.rbs new file mode 100644 index 0000000..41e6f03 --- /dev/null +++ b/sig/docker/models/service.rbs @@ -0,0 +1,467 @@ +module Docker + module Models + type service = + { + created_at: String, + endpoint: Docker::Service::Endpoint, + id: String, + job_status: Docker::Service::JobStatus, + service_status: Docker::Service::ServiceStatus, + spec: Docker::Spec, + updated_at: String, + update_status: Docker::Service::UpdateStatus, + version: Docker::Service::Version + } + + class Service < Docker::Internal::Type::BaseModel + attr_reader created_at: String? + + def created_at=: (String) -> String + + attr_reader endpoint: Docker::Service::Endpoint? + + def endpoint=: (Docker::Service::Endpoint) -> Docker::Service::Endpoint + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader job_status: Docker::Service::JobStatus? + + def job_status=: ( + Docker::Service::JobStatus + ) -> Docker::Service::JobStatus + + attr_reader service_status: Docker::Service::ServiceStatus? + + def service_status=: ( + Docker::Service::ServiceStatus + ) -> Docker::Service::ServiceStatus + + attr_reader spec: Docker::Spec? + + def spec=: (Docker::Spec) -> Docker::Spec + + attr_reader updated_at: String? + + def updated_at=: (String) -> String + + attr_reader update_status: Docker::Service::UpdateStatus? + + def update_status=: ( + Docker::Service::UpdateStatus + ) -> Docker::Service::UpdateStatus + + attr_reader version: Docker::Service::Version? + + def version=: (Docker::Service::Version) -> Docker::Service::Version + + def initialize: ( + ?created_at: String, + ?endpoint: Docker::Service::Endpoint, + ?id: String, + ?job_status: Docker::Service::JobStatus, + ?service_status: Docker::Service::ServiceStatus, + ?spec: Docker::Spec, + ?updated_at: String, + ?update_status: Docker::Service::UpdateStatus, + ?version: Docker::Service::Version + ) -> void + + def to_hash: -> { + created_at: String, + endpoint: Docker::Service::Endpoint, + id: String, + job_status: Docker::Service::JobStatus, + service_status: Docker::Service::ServiceStatus, + spec: Docker::Spec, + updated_at: String, + update_status: Docker::Service::UpdateStatus, + version: Docker::Service::Version + } + + type endpoint = + { + ports: ::Array[Docker::Service::Endpoint::Port], + spec: Docker::Service::Endpoint::Spec, + virtual_ips: ::Array[Docker::Service::Endpoint::VirtualIP] + } + + class Endpoint < Docker::Internal::Type::BaseModel + attr_reader ports: ::Array[Docker::Service::Endpoint::Port]? + + def ports=: ( + ::Array[Docker::Service::Endpoint::Port] + ) -> ::Array[Docker::Service::Endpoint::Port] + + attr_reader spec: Docker::Service::Endpoint::Spec? + + def spec=: ( + Docker::Service::Endpoint::Spec + ) -> Docker::Service::Endpoint::Spec + + attr_reader virtual_ips: ::Array[Docker::Service::Endpoint::VirtualIP]? + + def virtual_ips=: ( + ::Array[Docker::Service::Endpoint::VirtualIP] + ) -> ::Array[Docker::Service::Endpoint::VirtualIP] + + def initialize: ( + ?ports: ::Array[Docker::Service::Endpoint::Port], + ?spec: Docker::Service::Endpoint::Spec, + ?virtual_ips: ::Array[Docker::Service::Endpoint::VirtualIP] + ) -> void + + def to_hash: -> { + ports: ::Array[Docker::Service::Endpoint::Port], + spec: Docker::Service::Endpoint::Spec, + virtual_ips: ::Array[Docker::Service::Endpoint::VirtualIP] + } + + type port = + { + name: String, + protocol: Docker::Models::Service::Endpoint::Port::protocol, + published_port: Integer, + publish_mode: Docker::Models::Service::Endpoint::Port::publish_mode, + target_port: Integer + } + + class Port < Docker::Internal::Type::BaseModel + attr_reader name: String? + + def name=: (String) -> String + + attr_reader protocol: Docker::Models::Service::Endpoint::Port::protocol? + + def protocol=: ( + Docker::Models::Service::Endpoint::Port::protocol + ) -> Docker::Models::Service::Endpoint::Port::protocol + + attr_reader published_port: Integer? + + def published_port=: (Integer) -> Integer + + attr_reader publish_mode: Docker::Models::Service::Endpoint::Port::publish_mode? + + def publish_mode=: ( + Docker::Models::Service::Endpoint::Port::publish_mode + ) -> Docker::Models::Service::Endpoint::Port::publish_mode + + attr_reader target_port: Integer? + + def target_port=: (Integer) -> Integer + + def initialize: ( + ?name: String, + ?protocol: Docker::Models::Service::Endpoint::Port::protocol, + ?published_port: Integer, + ?publish_mode: Docker::Models::Service::Endpoint::Port::publish_mode, + ?target_port: Integer + ) -> void + + def to_hash: -> { + name: String, + protocol: Docker::Models::Service::Endpoint::Port::protocol, + published_port: Integer, + publish_mode: Docker::Models::Service::Endpoint::Port::publish_mode, + target_port: Integer + } + + type protocol = :tcp | :udp | :sctp + + module Protocol + extend Docker::Internal::Type::Enum + + TCP: :tcp + UDP: :udp + SCTP: :sctp + + def self?.values: -> ::Array[Docker::Models::Service::Endpoint::Port::protocol] + end + + type publish_mode = :ingress | :host + + module PublishMode + extend Docker::Internal::Type::Enum + + INGRESS: :ingress + HOST: :host + + def self?.values: -> ::Array[Docker::Models::Service::Endpoint::Port::publish_mode] + end + end + + type spec = + { + mode: Docker::Models::Service::Endpoint::Spec::mode, + ports: ::Array[Docker::Service::Endpoint::Spec::Port] + } + + class Spec < Docker::Internal::Type::BaseModel + attr_reader mode: Docker::Models::Service::Endpoint::Spec::mode? + + def mode=: ( + Docker::Models::Service::Endpoint::Spec::mode + ) -> Docker::Models::Service::Endpoint::Spec::mode + + attr_reader ports: ::Array[Docker::Service::Endpoint::Spec::Port]? + + def ports=: ( + ::Array[Docker::Service::Endpoint::Spec::Port] + ) -> ::Array[Docker::Service::Endpoint::Spec::Port] + + def initialize: ( + ?mode: Docker::Models::Service::Endpoint::Spec::mode, + ?ports: ::Array[Docker::Service::Endpoint::Spec::Port] + ) -> void + + def to_hash: -> { + mode: Docker::Models::Service::Endpoint::Spec::mode, + ports: ::Array[Docker::Service::Endpoint::Spec::Port] + } + + type mode = :vip | :dnsrr + + module Mode + extend Docker::Internal::Type::Enum + + VIP: :vip + DNSRR: :dnsrr + + def self?.values: -> ::Array[Docker::Models::Service::Endpoint::Spec::mode] + end + + type port = + { + name: String, + protocol: Docker::Models::Service::Endpoint::Spec::Port::protocol, + published_port: Integer, + publish_mode: Docker::Models::Service::Endpoint::Spec::Port::publish_mode, + target_port: Integer + } + + class Port < Docker::Internal::Type::BaseModel + attr_reader name: String? + + def name=: (String) -> String + + attr_reader protocol: Docker::Models::Service::Endpoint::Spec::Port::protocol? + + def protocol=: ( + Docker::Models::Service::Endpoint::Spec::Port::protocol + ) -> Docker::Models::Service::Endpoint::Spec::Port::protocol + + attr_reader published_port: Integer? + + def published_port=: (Integer) -> Integer + + attr_reader publish_mode: Docker::Models::Service::Endpoint::Spec::Port::publish_mode? + + def publish_mode=: ( + Docker::Models::Service::Endpoint::Spec::Port::publish_mode + ) -> Docker::Models::Service::Endpoint::Spec::Port::publish_mode + + attr_reader target_port: Integer? + + def target_port=: (Integer) -> Integer + + def initialize: ( + ?name: String, + ?protocol: Docker::Models::Service::Endpoint::Spec::Port::protocol, + ?published_port: Integer, + ?publish_mode: Docker::Models::Service::Endpoint::Spec::Port::publish_mode, + ?target_port: Integer + ) -> void + + def to_hash: -> { + name: String, + protocol: Docker::Models::Service::Endpoint::Spec::Port::protocol, + published_port: Integer, + publish_mode: Docker::Models::Service::Endpoint::Spec::Port::publish_mode, + target_port: Integer + } + + type protocol = :tcp | :udp | :sctp + + module Protocol + extend Docker::Internal::Type::Enum + + TCP: :tcp + UDP: :udp + SCTP: :sctp + + def self?.values: -> ::Array[Docker::Models::Service::Endpoint::Spec::Port::protocol] + end + + type publish_mode = :ingress | :host + + module PublishMode + extend Docker::Internal::Type::Enum + + INGRESS: :ingress + HOST: :host + + def self?.values: -> ::Array[Docker::Models::Service::Endpoint::Spec::Port::publish_mode] + end + end + end + + type virtual_ip = { addr: String, network_id: String } + + class VirtualIP < Docker::Internal::Type::BaseModel + attr_reader addr: String? + + def addr=: (String) -> String + + attr_reader network_id: String? + + def network_id=: (String) -> String + + def initialize: (?addr: String, ?network_id: String) -> void + + def to_hash: -> { addr: String, network_id: String } + end + end + + type job_status = + { + job_iteration: Docker::Service::JobStatus::JobIteration, + last_execution: String + } + + class JobStatus < Docker::Internal::Type::BaseModel + attr_reader job_iteration: Docker::Service::JobStatus::JobIteration? + + def job_iteration=: ( + Docker::Service::JobStatus::JobIteration + ) -> Docker::Service::JobStatus::JobIteration + + attr_reader last_execution: String? + + def last_execution=: (String) -> String + + def initialize: ( + ?job_iteration: Docker::Service::JobStatus::JobIteration, + ?last_execution: String + ) -> void + + def to_hash: -> { + job_iteration: Docker::Service::JobStatus::JobIteration, + last_execution: String + } + + type job_iteration = { index: Integer } + + class JobIteration < Docker::Internal::Type::BaseModel + attr_reader index: Integer? + + def index=: (Integer) -> Integer + + def initialize: (?index: Integer) -> void + + def to_hash: -> { index: Integer } + end + end + + type service_status = + { + completed_tasks: Integer, + desired_tasks: Integer, + running_tasks: Integer + } + + class ServiceStatus < Docker::Internal::Type::BaseModel + attr_reader completed_tasks: Integer? + + def completed_tasks=: (Integer) -> Integer + + attr_reader desired_tasks: Integer? + + def desired_tasks=: (Integer) -> Integer + + attr_reader running_tasks: Integer? + + def running_tasks=: (Integer) -> Integer + + def initialize: ( + ?completed_tasks: Integer, + ?desired_tasks: Integer, + ?running_tasks: Integer + ) -> void + + def to_hash: -> { + completed_tasks: Integer, + desired_tasks: Integer, + running_tasks: Integer + } + end + + type update_status = + { + completed_at: String, + message: String, + started_at: String, + state: Docker::Models::Service::UpdateStatus::state + } + + class UpdateStatus < Docker::Internal::Type::BaseModel + attr_reader completed_at: String? + + def completed_at=: (String) -> String + + attr_reader message: String? + + def message=: (String) -> String + + attr_reader started_at: String? + + def started_at=: (String) -> String + + attr_reader state: Docker::Models::Service::UpdateStatus::state? + + def state=: ( + Docker::Models::Service::UpdateStatus::state + ) -> Docker::Models::Service::UpdateStatus::state + + def initialize: ( + ?completed_at: String, + ?message: String, + ?started_at: String, + ?state: Docker::Models::Service::UpdateStatus::state + ) -> void + + def to_hash: -> { + completed_at: String, + message: String, + started_at: String, + state: Docker::Models::Service::UpdateStatus::state + } + + type state = :updating | :paused | :completed + + module State + extend Docker::Internal::Type::Enum + + UPDATING: :updating + PAUSED: :paused + COMPLETED: :completed + + def self?.values: -> ::Array[Docker::Models::Service::UpdateStatus::state] + end + end + + type version = { index: Integer } + + class Version < Docker::Internal::Type::BaseModel + attr_reader index: Integer? + + def index=: (Integer) -> Integer + + def initialize: (?index: Integer) -> void + + def to_hash: -> { index: Integer } + end + end + end +end diff --git a/sig/docker/models/service_create_params.rbs b/sig/docker/models/service_create_params.rbs new file mode 100644 index 0000000..6f944f0 --- /dev/null +++ b/sig/docker/models/service_create_params.rbs @@ -0,0 +1,38 @@ +module Docker + module Models + type service_create_params = + { spec: Docker::ServiceCreateParams::Spec, x_registry_auth: String } + & Docker::Internal::Type::request_parameters + + class ServiceCreateParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_accessor spec: Docker::ServiceCreateParams::Spec + + attr_reader x_registry_auth: String? + + def x_registry_auth=: (String) -> String + + def initialize: ( + spec: Docker::ServiceCreateParams::Spec, + ?x_registry_auth: String, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + spec: Docker::ServiceCreateParams::Spec, + x_registry_auth: String, + request_options: Docker::RequestOptions + } + + type spec = { } + + class Spec < Docker::Models::Spec + def initialize: -> void + + def to_hash: -> { } + end + end + end +end diff --git a/sig/docker/models/service_create_response.rbs b/sig/docker/models/service_create_response.rbs new file mode 100644 index 0000000..abb7596 --- /dev/null +++ b/sig/docker/models/service_create_response.rbs @@ -0,0 +1,17 @@ +module Docker + module Models + type service_create_response = { id: String, warnings: ::Array[String]? } + + class ServiceCreateResponse < Docker::Internal::Type::BaseModel + attr_reader id: String? + + def id=: (String) -> String + + attr_accessor warnings: ::Array[String]? + + def initialize: (?id: String, ?warnings: ::Array[String]?) -> void + + def to_hash: -> { id: String, warnings: ::Array[String]? } + end + end +end diff --git a/sig/docker/models/service_delete_params.rbs b/sig/docker/models/service_delete_params.rbs new file mode 100644 index 0000000..61f2996 --- /dev/null +++ b/sig/docker/models/service_delete_params.rbs @@ -0,0 +1,15 @@ +module Docker + module Models + type service_delete_params = + { } & Docker::Internal::Type::request_parameters + + class ServiceDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + def initialize: (?request_options: Docker::request_opts) -> void + + def to_hash: -> { request_options: Docker::RequestOptions } + end + end +end diff --git a/sig/docker/models/service_inspect_params.rbs b/sig/docker/models/service_inspect_params.rbs new file mode 100644 index 0000000..5a42287 --- /dev/null +++ b/sig/docker/models/service_inspect_params.rbs @@ -0,0 +1,25 @@ +module Docker + module Models + type service_inspect_params = + { insert_defaults: bool } & Docker::Internal::Type::request_parameters + + class ServiceInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader insert_defaults: bool? + + def insert_defaults=: (bool) -> bool + + def initialize: ( + ?insert_defaults: bool, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + insert_defaults: bool, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/service_list_params.rbs b/sig/docker/models/service_list_params.rbs new file mode 100644 index 0000000..1352d82 --- /dev/null +++ b/sig/docker/models/service_list_params.rbs @@ -0,0 +1,32 @@ +module Docker + module Models + type service_list_params = + { filters: String, status: bool } + & Docker::Internal::Type::request_parameters + + class ServiceListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader filters: String? + + def filters=: (String) -> String + + attr_reader status: bool? + + def status=: (bool) -> bool + + def initialize: ( + ?filters: String, + ?status: bool, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + filters: String, + status: bool, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/service_list_response.rbs b/sig/docker/models/service_list_response.rbs new file mode 100644 index 0000000..e823ba0 --- /dev/null +++ b/sig/docker/models/service_list_response.rbs @@ -0,0 +1,7 @@ +module Docker + module Models + type service_list_response = ::Array[Docker::Service] + + ServiceListResponse: Docker::Internal::Type::Converter + end +end diff --git a/sig/docker/models/spec.rbs b/sig/docker/models/spec.rbs new file mode 100644 index 0000000..54a6ef6 --- /dev/null +++ b/sig/docker/models/spec.rbs @@ -0,0 +1,1984 @@ +module Docker + module Models + type spec = + { + endpoint_spec: Docker::Spec::EndpointSpec, + labels: ::Hash[Symbol, String], + mode: Docker::Spec::Mode, + name: String, + networks: ::Array[Docker::Spec::Network], + rollback_config: Docker::Spec::RollbackConfig, + task_template: Docker::Spec::TaskTemplate, + update_config: Docker::Spec::UpdateConfig + } + + class Spec < Docker::Internal::Type::BaseModel + attr_reader endpoint_spec: Docker::Spec::EndpointSpec? + + def endpoint_spec=: ( + Docker::Spec::EndpointSpec + ) -> Docker::Spec::EndpointSpec + + attr_reader labels: ::Hash[Symbol, String]? + + def labels=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader mode: Docker::Spec::Mode? + + def mode=: (Docker::Spec::Mode) -> Docker::Spec::Mode + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader networks: ::Array[Docker::Spec::Network]? + + def networks=: ( + ::Array[Docker::Spec::Network] + ) -> ::Array[Docker::Spec::Network] + + attr_reader rollback_config: Docker::Spec::RollbackConfig? + + def rollback_config=: ( + Docker::Spec::RollbackConfig + ) -> Docker::Spec::RollbackConfig + + attr_reader task_template: Docker::Spec::TaskTemplate? + + def task_template=: ( + Docker::Spec::TaskTemplate + ) -> Docker::Spec::TaskTemplate + + attr_reader update_config: Docker::Spec::UpdateConfig? + + def update_config=: ( + Docker::Spec::UpdateConfig + ) -> Docker::Spec::UpdateConfig + + def initialize: ( + ?endpoint_spec: Docker::Spec::EndpointSpec, + ?labels: ::Hash[Symbol, String], + ?mode: Docker::Spec::Mode, + ?name: String, + ?networks: ::Array[Docker::Spec::Network], + ?rollback_config: Docker::Spec::RollbackConfig, + ?task_template: Docker::Spec::TaskTemplate, + ?update_config: Docker::Spec::UpdateConfig + ) -> void + + def to_hash: -> { + endpoint_spec: Docker::Spec::EndpointSpec, + labels: ::Hash[Symbol, String], + mode: Docker::Spec::Mode, + name: String, + networks: ::Array[Docker::Spec::Network], + rollback_config: Docker::Spec::RollbackConfig, + task_template: Docker::Spec::TaskTemplate, + update_config: Docker::Spec::UpdateConfig + } + + type endpoint_spec = + { + mode: Docker::Models::Spec::EndpointSpec::mode, + ports: ::Array[Docker::Spec::EndpointSpec::Port] + } + + class EndpointSpec < Docker::Internal::Type::BaseModel + attr_reader mode: Docker::Models::Spec::EndpointSpec::mode? + + def mode=: ( + Docker::Models::Spec::EndpointSpec::mode + ) -> Docker::Models::Spec::EndpointSpec::mode + + attr_reader ports: ::Array[Docker::Spec::EndpointSpec::Port]? + + def ports=: ( + ::Array[Docker::Spec::EndpointSpec::Port] + ) -> ::Array[Docker::Spec::EndpointSpec::Port] + + def initialize: ( + ?mode: Docker::Models::Spec::EndpointSpec::mode, + ?ports: ::Array[Docker::Spec::EndpointSpec::Port] + ) -> void + + def to_hash: -> { + mode: Docker::Models::Spec::EndpointSpec::mode, + ports: ::Array[Docker::Spec::EndpointSpec::Port] + } + + type mode = :vip | :dnsrr + + module Mode + extend Docker::Internal::Type::Enum + + VIP: :vip + DNSRR: :dnsrr + + def self?.values: -> ::Array[Docker::Models::Spec::EndpointSpec::mode] + end + + type port = + { + name: String, + protocol: Docker::Models::Spec::EndpointSpec::Port::protocol, + published_port: Integer, + publish_mode: Docker::Models::Spec::EndpointSpec::Port::publish_mode, + target_port: Integer + } + + class Port < Docker::Internal::Type::BaseModel + attr_reader name: String? + + def name=: (String) -> String + + attr_reader protocol: Docker::Models::Spec::EndpointSpec::Port::protocol? + + def protocol=: ( + Docker::Models::Spec::EndpointSpec::Port::protocol + ) -> Docker::Models::Spec::EndpointSpec::Port::protocol + + attr_reader published_port: Integer? + + def published_port=: (Integer) -> Integer + + attr_reader publish_mode: Docker::Models::Spec::EndpointSpec::Port::publish_mode? + + def publish_mode=: ( + Docker::Models::Spec::EndpointSpec::Port::publish_mode + ) -> Docker::Models::Spec::EndpointSpec::Port::publish_mode + + attr_reader target_port: Integer? + + def target_port=: (Integer) -> Integer + + def initialize: ( + ?name: String, + ?protocol: Docker::Models::Spec::EndpointSpec::Port::protocol, + ?published_port: Integer, + ?publish_mode: Docker::Models::Spec::EndpointSpec::Port::publish_mode, + ?target_port: Integer + ) -> void + + def to_hash: -> { + name: String, + protocol: Docker::Models::Spec::EndpointSpec::Port::protocol, + published_port: Integer, + publish_mode: Docker::Models::Spec::EndpointSpec::Port::publish_mode, + target_port: Integer + } + + type protocol = :tcp | :udp | :sctp + + module Protocol + extend Docker::Internal::Type::Enum + + TCP: :tcp + UDP: :udp + SCTP: :sctp + + def self?.values: -> ::Array[Docker::Models::Spec::EndpointSpec::Port::protocol] + end + + type publish_mode = :ingress | :host + + module PublishMode + extend Docker::Internal::Type::Enum + + INGRESS: :ingress + HOST: :host + + def self?.values: -> ::Array[Docker::Models::Spec::EndpointSpec::Port::publish_mode] + end + end + end + + type mode = + { + global: top, + global_job: top, + replicated: Docker::Spec::Mode::Replicated, + replicated_job: Docker::Spec::Mode::ReplicatedJob + } + + class Mode < Docker::Internal::Type::BaseModel + attr_reader global: top? + + def global=: (top) -> top + + attr_reader global_job: top? + + def global_job=: (top) -> top + + attr_reader replicated: Docker::Spec::Mode::Replicated? + + def replicated=: ( + Docker::Spec::Mode::Replicated + ) -> Docker::Spec::Mode::Replicated + + attr_reader replicated_job: Docker::Spec::Mode::ReplicatedJob? + + def replicated_job=: ( + Docker::Spec::Mode::ReplicatedJob + ) -> Docker::Spec::Mode::ReplicatedJob + + def initialize: ( + ?global: top, + ?global_job: top, + ?replicated: Docker::Spec::Mode::Replicated, + ?replicated_job: Docker::Spec::Mode::ReplicatedJob + ) -> void + + def to_hash: -> { + global: top, + global_job: top, + replicated: Docker::Spec::Mode::Replicated, + replicated_job: Docker::Spec::Mode::ReplicatedJob + } + + type replicated = { replicas: Integer } + + class Replicated < Docker::Internal::Type::BaseModel + attr_reader replicas: Integer? + + def replicas=: (Integer) -> Integer + + def initialize: (?replicas: Integer) -> void + + def to_hash: -> { replicas: Integer } + end + + type replicated_job = + { max_concurrent: Integer, total_completions: Integer } + + class ReplicatedJob < Docker::Internal::Type::BaseModel + attr_reader max_concurrent: Integer? + + def max_concurrent=: (Integer) -> Integer + + attr_reader total_completions: Integer? + + def total_completions=: (Integer) -> Integer + + def initialize: ( + ?max_concurrent: Integer, + ?total_completions: Integer + ) -> void + + def to_hash: -> { + max_concurrent: Integer, + total_completions: Integer + } + end + end + + type network = + { + aliases: ::Array[String], + driver_opts: ::Hash[Symbol, String], + target: String + } + + class Network < Docker::Internal::Type::BaseModel + attr_reader aliases: ::Array[String]? + + def aliases=: (::Array[String]) -> ::Array[String] + + attr_reader driver_opts: ::Hash[Symbol, String]? + + def driver_opts=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader target: String? + + def target=: (String) -> String + + def initialize: ( + ?aliases: ::Array[String], + ?driver_opts: ::Hash[Symbol, String], + ?target: String + ) -> void + + def to_hash: -> { + aliases: ::Array[String], + driver_opts: ::Hash[Symbol, String], + target: String + } + end + + type rollback_config = + { + delay: Integer, + failure_action: Docker::Models::Spec::RollbackConfig::failure_action, + max_failure_ratio: Float, + monitor: Integer, + order: Docker::Models::Spec::RollbackConfig::order, + parallelism: Integer + } + + class RollbackConfig < Docker::Internal::Type::BaseModel + attr_reader delay: Integer? + + def delay=: (Integer) -> Integer + + attr_reader failure_action: Docker::Models::Spec::RollbackConfig::failure_action? + + def failure_action=: ( + Docker::Models::Spec::RollbackConfig::failure_action + ) -> Docker::Models::Spec::RollbackConfig::failure_action + + attr_reader max_failure_ratio: Float? + + def max_failure_ratio=: (Float) -> Float + + attr_reader monitor: Integer? + + def monitor=: (Integer) -> Integer + + attr_reader order: Docker::Models::Spec::RollbackConfig::order? + + def order=: ( + Docker::Models::Spec::RollbackConfig::order + ) -> Docker::Models::Spec::RollbackConfig::order + + attr_reader parallelism: Integer? + + def parallelism=: (Integer) -> Integer + + def initialize: ( + ?delay: Integer, + ?failure_action: Docker::Models::Spec::RollbackConfig::failure_action, + ?max_failure_ratio: Float, + ?monitor: Integer, + ?order: Docker::Models::Spec::RollbackConfig::order, + ?parallelism: Integer + ) -> void + + def to_hash: -> { + delay: Integer, + failure_action: Docker::Models::Spec::RollbackConfig::failure_action, + max_failure_ratio: Float, + monitor: Integer, + order: Docker::Models::Spec::RollbackConfig::order, + parallelism: Integer + } + + type failure_action = :continue | :pause + + module FailureAction + extend Docker::Internal::Type::Enum + + CONTINUE: :continue + PAUSE: :pause + + def self?.values: -> ::Array[Docker::Models::Spec::RollbackConfig::failure_action] + end + + type order = :"stop-first" | :"start-first" + + module Order + extend Docker::Internal::Type::Enum + + STOP_FIRST: :"stop-first" + START_FIRST: :"start-first" + + def self?.values: -> ::Array[Docker::Models::Spec::RollbackConfig::order] + end + end + + type task_template = + { + container_spec: Docker::Spec::TaskTemplate::ContainerSpec, + force_update: Integer, + log_driver: Docker::Spec::TaskTemplate::LogDriver, + network_attachment_spec: Docker::Spec::TaskTemplate::NetworkAttachmentSpec, + networks: ::Array[Docker::Spec::TaskTemplate::Network], + placement: Docker::Spec::TaskTemplate::Placement, + plugin_spec: Docker::Spec::TaskTemplate::PluginSpec, + resources: Docker::Spec::TaskTemplate::Resources, + restart_policy: Docker::Spec::TaskTemplate::RestartPolicy, + runtime: String + } + + class TaskTemplate < Docker::Internal::Type::BaseModel + attr_reader container_spec: Docker::Spec::TaskTemplate::ContainerSpec? + + def container_spec=: ( + Docker::Spec::TaskTemplate::ContainerSpec + ) -> Docker::Spec::TaskTemplate::ContainerSpec + + attr_reader force_update: Integer? + + def force_update=: (Integer) -> Integer + + attr_reader log_driver: Docker::Spec::TaskTemplate::LogDriver? + + def log_driver=: ( + Docker::Spec::TaskTemplate::LogDriver + ) -> Docker::Spec::TaskTemplate::LogDriver + + attr_reader network_attachment_spec: Docker::Spec::TaskTemplate::NetworkAttachmentSpec? + + def network_attachment_spec=: ( + Docker::Spec::TaskTemplate::NetworkAttachmentSpec + ) -> Docker::Spec::TaskTemplate::NetworkAttachmentSpec + + attr_reader networks: ::Array[Docker::Spec::TaskTemplate::Network]? + + def networks=: ( + ::Array[Docker::Spec::TaskTemplate::Network] + ) -> ::Array[Docker::Spec::TaskTemplate::Network] + + attr_reader placement: Docker::Spec::TaskTemplate::Placement? + + def placement=: ( + Docker::Spec::TaskTemplate::Placement + ) -> Docker::Spec::TaskTemplate::Placement + + attr_reader plugin_spec: Docker::Spec::TaskTemplate::PluginSpec? + + def plugin_spec=: ( + Docker::Spec::TaskTemplate::PluginSpec + ) -> Docker::Spec::TaskTemplate::PluginSpec + + attr_reader resources: Docker::Spec::TaskTemplate::Resources? + + def resources=: ( + Docker::Spec::TaskTemplate::Resources + ) -> Docker::Spec::TaskTemplate::Resources + + attr_reader restart_policy: Docker::Spec::TaskTemplate::RestartPolicy? + + def restart_policy=: ( + Docker::Spec::TaskTemplate::RestartPolicy + ) -> Docker::Spec::TaskTemplate::RestartPolicy + + attr_reader runtime: String? + + def runtime=: (String) -> String + + def initialize: ( + ?container_spec: Docker::Spec::TaskTemplate::ContainerSpec, + ?force_update: Integer, + ?log_driver: Docker::Spec::TaskTemplate::LogDriver, + ?network_attachment_spec: Docker::Spec::TaskTemplate::NetworkAttachmentSpec, + ?networks: ::Array[Docker::Spec::TaskTemplate::Network], + ?placement: Docker::Spec::TaskTemplate::Placement, + ?plugin_spec: Docker::Spec::TaskTemplate::PluginSpec, + ?resources: Docker::Spec::TaskTemplate::Resources, + ?restart_policy: Docker::Spec::TaskTemplate::RestartPolicy, + ?runtime: String + ) -> void + + def to_hash: -> { + container_spec: Docker::Spec::TaskTemplate::ContainerSpec, + force_update: Integer, + log_driver: Docker::Spec::TaskTemplate::LogDriver, + network_attachment_spec: Docker::Spec::TaskTemplate::NetworkAttachmentSpec, + networks: ::Array[Docker::Spec::TaskTemplate::Network], + placement: Docker::Spec::TaskTemplate::Placement, + plugin_spec: Docker::Spec::TaskTemplate::PluginSpec, + resources: Docker::Spec::TaskTemplate::Resources, + restart_policy: Docker::Spec::TaskTemplate::RestartPolicy, + runtime: String + } + + type container_spec = + { + args: ::Array[String], + capability_add: ::Array[String], + capability_drop: ::Array[String], + command: ::Array[String], + configs: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Config], + dir: String, + dns_config: Docker::Spec::TaskTemplate::ContainerSpec::DNSConfig, + env: ::Array[String], + groups: ::Array[String], + health_check: Docker::Spec::TaskTemplate::ContainerSpec::HealthCheck, + hostname: String, + hosts: ::Array[String], + image: String, + init: bool?, + isolation: Docker::Models::Spec::TaskTemplate::ContainerSpec::isolation, + labels: ::Hash[Symbol, String], + mounts: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Mount], + oom_score_adj: Integer, + open_stdin: bool, + privileges: Docker::Spec::TaskTemplate::ContainerSpec::Privileges, + read_only: bool, + secrets: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Secret], + stop_grace_period: Integer, + stop_signal: String, + sysctls: ::Hash[Symbol, String], + tty: bool, + ulimits: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Ulimit], + user: String + } + + class ContainerSpec < Docker::Internal::Type::BaseModel + attr_reader args: ::Array[String]? + + def args=: (::Array[String]) -> ::Array[String] + + attr_reader capability_add: ::Array[String]? + + def capability_add=: (::Array[String]) -> ::Array[String] + + attr_reader capability_drop: ::Array[String]? + + def capability_drop=: (::Array[String]) -> ::Array[String] + + attr_reader command: ::Array[String]? + + def command=: (::Array[String]) -> ::Array[String] + + attr_reader configs: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Config]? + + def configs=: ( + ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Config] + ) -> ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Config] + + attr_reader dir: String? + + def dir=: (String) -> String + + attr_reader dns_config: Docker::Spec::TaskTemplate::ContainerSpec::DNSConfig? + + def dns_config=: ( + Docker::Spec::TaskTemplate::ContainerSpec::DNSConfig + ) -> Docker::Spec::TaskTemplate::ContainerSpec::DNSConfig + + attr_reader env: ::Array[String]? + + def env=: (::Array[String]) -> ::Array[String] + + attr_reader groups: ::Array[String]? + + def groups=: (::Array[String]) -> ::Array[String] + + attr_reader health_check: Docker::Spec::TaskTemplate::ContainerSpec::HealthCheck? + + def health_check=: ( + Docker::Spec::TaskTemplate::ContainerSpec::HealthCheck + ) -> Docker::Spec::TaskTemplate::ContainerSpec::HealthCheck + + attr_reader hostname: String? + + def hostname=: (String) -> String + + attr_reader hosts: ::Array[String]? + + def hosts=: (::Array[String]) -> ::Array[String] + + attr_reader image: String? + + def image=: (String) -> String + + attr_accessor init: bool? + + attr_reader isolation: Docker::Models::Spec::TaskTemplate::ContainerSpec::isolation? + + def isolation=: ( + Docker::Models::Spec::TaskTemplate::ContainerSpec::isolation + ) -> Docker::Models::Spec::TaskTemplate::ContainerSpec::isolation + + attr_reader labels: ::Hash[Symbol, String]? + + def labels=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader mounts: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Mount]? + + def mounts=: ( + ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Mount] + ) -> ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Mount] + + attr_reader oom_score_adj: Integer? + + def oom_score_adj=: (Integer) -> Integer + + attr_reader open_stdin: bool? + + def open_stdin=: (bool) -> bool + + attr_reader privileges: Docker::Spec::TaskTemplate::ContainerSpec::Privileges? + + def privileges=: ( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges + ) -> Docker::Spec::TaskTemplate::ContainerSpec::Privileges + + attr_reader read_only: bool? + + def read_only=: (bool) -> bool + + attr_reader secrets: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Secret]? + + def secrets=: ( + ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Secret] + ) -> ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Secret] + + attr_reader stop_grace_period: Integer? + + def stop_grace_period=: (Integer) -> Integer + + attr_reader stop_signal: String? + + def stop_signal=: (String) -> String + + attr_reader sysctls: ::Hash[Symbol, String]? + + def sysctls=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader tty: bool? + + def tty=: (bool) -> bool + + attr_reader ulimits: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Ulimit]? + + def ulimits=: ( + ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Ulimit] + ) -> ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Ulimit] + + attr_reader user: String? + + def user=: (String) -> String + + def initialize: ( + ?args: ::Array[String], + ?capability_add: ::Array[String], + ?capability_drop: ::Array[String], + ?command: ::Array[String], + ?configs: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Config], + ?dir: String, + ?dns_config: Docker::Spec::TaskTemplate::ContainerSpec::DNSConfig, + ?env: ::Array[String], + ?groups: ::Array[String], + ?health_check: Docker::Spec::TaskTemplate::ContainerSpec::HealthCheck, + ?hostname: String, + ?hosts: ::Array[String], + ?image: String, + ?init: bool?, + ?isolation: Docker::Models::Spec::TaskTemplate::ContainerSpec::isolation, + ?labels: ::Hash[Symbol, String], + ?mounts: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Mount], + ?oom_score_adj: Integer, + ?open_stdin: bool, + ?privileges: Docker::Spec::TaskTemplate::ContainerSpec::Privileges, + ?read_only: bool, + ?secrets: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Secret], + ?stop_grace_period: Integer, + ?stop_signal: String, + ?sysctls: ::Hash[Symbol, String], + ?tty: bool, + ?ulimits: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Ulimit], + ?user: String + ) -> void + + def to_hash: -> { + args: ::Array[String], + capability_add: ::Array[String], + capability_drop: ::Array[String], + command: ::Array[String], + configs: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Config], + dir: String, + dns_config: Docker::Spec::TaskTemplate::ContainerSpec::DNSConfig, + env: ::Array[String], + groups: ::Array[String], + health_check: Docker::Spec::TaskTemplate::ContainerSpec::HealthCheck, + hostname: String, + hosts: ::Array[String], + image: String, + init: bool?, + isolation: Docker::Models::Spec::TaskTemplate::ContainerSpec::isolation, + labels: ::Hash[Symbol, String], + mounts: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Mount], + oom_score_adj: Integer, + open_stdin: bool, + privileges: Docker::Spec::TaskTemplate::ContainerSpec::Privileges, + read_only: bool, + secrets: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Secret], + stop_grace_period: Integer, + stop_signal: String, + sysctls: ::Hash[Symbol, String], + tty: bool, + ulimits: ::Array[Docker::Spec::TaskTemplate::ContainerSpec::Ulimit], + user: String + } + + type config = + { + config_id: String, + config_name: String, + file: Docker::Spec::TaskTemplate::ContainerSpec::Config::File, + runtime: top + } + + class Config < Docker::Internal::Type::BaseModel + attr_reader config_id: String? + + def config_id=: (String) -> String + + attr_reader config_name: String? + + def config_name=: (String) -> String + + attr_reader file: Docker::Spec::TaskTemplate::ContainerSpec::Config::File? + + def file=: ( + Docker::Spec::TaskTemplate::ContainerSpec::Config::File + ) -> Docker::Spec::TaskTemplate::ContainerSpec::Config::File + + attr_reader runtime: top? + + def runtime=: (top) -> top + + def initialize: ( + ?config_id: String, + ?config_name: String, + ?file: Docker::Spec::TaskTemplate::ContainerSpec::Config::File, + ?runtime: top + ) -> void + + def to_hash: -> { + config_id: String, + config_name: String, + file: Docker::Spec::TaskTemplate::ContainerSpec::Config::File, + runtime: top + } + + type file = + { gid: String, mode: Integer, name: String, uid: String } + + class File < Docker::Internal::Type::BaseModel + attr_reader gid: String? + + def gid=: (String) -> String + + attr_reader mode: Integer? + + def mode=: (Integer) -> Integer + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader uid: String? + + def uid=: (String) -> String + + def initialize: ( + ?gid: String, + ?mode: Integer, + ?name: String, + ?uid: String + ) -> void + + def to_hash: -> { + gid: String, + mode: Integer, + name: String, + uid: String + } + end + end + + type dns_config = + { + nameservers: ::Array[String], + options: ::Array[String], + search: ::Array[String] + } + + class DNSConfig < Docker::Internal::Type::BaseModel + attr_reader nameservers: ::Array[String]? + + def nameservers=: (::Array[String]) -> ::Array[String] + + attr_reader options: ::Array[String]? + + def options=: (::Array[String]) -> ::Array[String] + + attr_reader search: ::Array[String]? + + def search=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?nameservers: ::Array[String], + ?options: ::Array[String], + ?search: ::Array[String] + ) -> void + + def to_hash: -> { + nameservers: ::Array[String], + options: ::Array[String], + search: ::Array[String] + } + end + + type health_check = + { + interval: Integer, + retries: Integer, + start_interval: Integer, + start_period: Integer, + test_: ::Array[String], + timeout: Integer + } + + class HealthCheck < Docker::Internal::Type::BaseModel + attr_reader interval: Integer? + + def interval=: (Integer) -> Integer + + attr_reader retries: Integer? + + def retries=: (Integer) -> Integer + + attr_reader start_interval: Integer? + + def start_interval=: (Integer) -> Integer + + attr_reader start_period: Integer? + + def start_period=: (Integer) -> Integer + + attr_reader test_: ::Array[String]? + + def test_=: (::Array[String]) -> ::Array[String] + + attr_reader timeout: Integer? + + def timeout=: (Integer) -> Integer + + def initialize: ( + ?interval: Integer, + ?retries: Integer, + ?start_interval: Integer, + ?start_period: Integer, + ?test_: ::Array[String], + ?timeout: Integer + ) -> void + + def to_hash: -> { + interval: Integer, + retries: Integer, + start_interval: Integer, + start_period: Integer, + test_: ::Array[String], + timeout: Integer + } + end + + type isolation = :default | :process | :hyperv | :"" + + module Isolation + extend Docker::Internal::Type::Enum + + DEFAULT: :default + PROCESS: :process + HYPERV: :hyperv + EMPTY: :"" + + def self?.values: -> ::Array[Docker::Models::Spec::TaskTemplate::ContainerSpec::isolation] + end + + type mount = + { + bind_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions, + consistency: String, + image_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions, + read_only: bool, + source: String, + target: String, + tmpfs_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions, + type: Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::type_, + volume_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions + } + + class Mount < Docker::Internal::Type::BaseModel + attr_reader bind_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions? + + def bind_options=: ( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions + ) -> Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions + + attr_reader consistency: String? + + def consistency=: (String) -> String + + attr_reader image_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions? + + def image_options=: ( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions + ) -> Docker::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions + + attr_reader read_only: bool? + + def read_only=: (bool) -> bool + + attr_reader source: String? + + def source=: (String) -> String + + attr_reader target: String? + + def target=: (String) -> String + + attr_reader tmpfs_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions? + + def tmpfs_options=: ( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions + ) -> Docker::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions + + attr_reader type: Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::type_? + + def type=: ( + Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::type_ + ) -> Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::type_ + + attr_reader volume_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions? + + def volume_options=: ( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions + ) -> Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions + + def initialize: ( + ?bind_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions, + ?consistency: String, + ?image_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions, + ?read_only: bool, + ?source: String, + ?target: String, + ?tmpfs_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions, + ?type: Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::type_, + ?volume_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions + ) -> void + + def to_hash: -> { + bind_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions, + consistency: String, + image_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::ImageOptions, + read_only: bool, + source: String, + target: String, + tmpfs_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::TmpfsOptions, + type: Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::type_, + volume_options: Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions + } + + type bind_options = + { + create_mountpoint: bool, + non_recursive: bool, + propagation: Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::propagation, + read_only_force_recursive: bool, + read_only_non_recursive: bool + } + + class BindOptions < Docker::Internal::Type::BaseModel + attr_reader create_mountpoint: bool? + + def create_mountpoint=: (bool) -> bool + + attr_reader non_recursive: bool? + + def non_recursive=: (bool) -> bool + + attr_reader propagation: Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::propagation? + + def propagation=: ( + Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::propagation + ) -> Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::propagation + + attr_reader read_only_force_recursive: bool? + + def read_only_force_recursive=: (bool) -> bool + + attr_reader read_only_non_recursive: bool? + + def read_only_non_recursive=: (bool) -> bool + + def initialize: ( + ?create_mountpoint: bool, + ?non_recursive: bool, + ?propagation: Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::propagation, + ?read_only_force_recursive: bool, + ?read_only_non_recursive: bool + ) -> void + + def to_hash: -> { + create_mountpoint: bool, + non_recursive: bool, + propagation: Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::propagation, + read_only_force_recursive: bool, + read_only_non_recursive: bool + } + + type propagation = + :private | :rprivate | :shared | :rshared | :slave | :rslave + + module Propagation + extend Docker::Internal::Type::Enum + + PRIVATE: :private + RPRIVATE: :rprivate + SHARED: :shared + RSHARED: :rshared + SLAVE: :slave + RSLAVE: :rslave + + def self?.values: -> ::Array[Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::BindOptions::propagation] + end + end + + type image_options = { subpath: String } + + class ImageOptions < Docker::Internal::Type::BaseModel + attr_reader subpath: String? + + def subpath=: (String) -> String + + def initialize: (?subpath: String) -> void + + def to_hash: -> { subpath: String } + end + + type tmpfs_options = + { + mode: Integer, + options: ::Array[::Array[String]], + size_bytes: Integer + } + + class TmpfsOptions < Docker::Internal::Type::BaseModel + attr_reader mode: Integer? + + def mode=: (Integer) -> Integer + + attr_reader options: ::Array[::Array[String]]? + + def options=: ( + ::Array[::Array[String]] + ) -> ::Array[::Array[String]] + + attr_reader size_bytes: Integer? + + def size_bytes=: (Integer) -> Integer + + def initialize: ( + ?mode: Integer, + ?options: ::Array[::Array[String]], + ?size_bytes: Integer + ) -> void + + def to_hash: -> { + mode: Integer, + options: ::Array[::Array[String]], + size_bytes: Integer + } + end + + type type_ = :bind | :cluster | :image | :npipe | :tmpfs | :volume + + module Type + extend Docker::Internal::Type::Enum + + BIND: :bind + CLUSTER: :cluster + IMAGE: :image + NPIPE: :npipe + TMPFS: :tmpfs + VOLUME: :volume + + def self?.values: -> ::Array[Docker::Models::Spec::TaskTemplate::ContainerSpec::Mount::type_] + end + + type volume_options = + { + driver_config: Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig, + labels: ::Hash[Symbol, String], + no_copy: bool, + subpath: String + } + + class VolumeOptions < Docker::Internal::Type::BaseModel + attr_reader driver_config: Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig? + + def driver_config=: ( + Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig + ) -> Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig + + attr_reader labels: ::Hash[Symbol, String]? + + def labels=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader no_copy: bool? + + def no_copy=: (bool) -> bool + + attr_reader subpath: String? + + def subpath=: (String) -> String + + def initialize: ( + ?driver_config: Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig, + ?labels: ::Hash[Symbol, String], + ?no_copy: bool, + ?subpath: String + ) -> void + + def to_hash: -> { + driver_config: Docker::Spec::TaskTemplate::ContainerSpec::Mount::VolumeOptions::DriverConfig, + labels: ::Hash[Symbol, String], + no_copy: bool, + subpath: String + } + + type driver_config = + { name: String, options: ::Hash[Symbol, String] } + + class DriverConfig < Docker::Internal::Type::BaseModel + attr_reader name: String? + + def name=: (String) -> String + + attr_reader options: ::Hash[Symbol, String]? + + def options=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + def initialize: ( + ?name: String, + ?options: ::Hash[Symbol, String] + ) -> void + + def to_hash: -> { + name: String, + options: ::Hash[Symbol, String] + } + end + end + end + + type privileges = + { + app_armor: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor, + credential_spec: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec, + no_new_privileges: bool, + seccomp: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp, + se_linux_context: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext + } + + class Privileges < Docker::Internal::Type::BaseModel + attr_reader app_armor: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor? + + def app_armor=: ( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor + ) -> Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor + + attr_reader credential_spec: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec? + + def credential_spec=: ( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec + ) -> Docker::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec + + attr_reader no_new_privileges: bool? + + def no_new_privileges=: (bool) -> bool + + attr_reader seccomp: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp? + + def seccomp=: ( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp + ) -> Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp + + attr_reader se_linux_context: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext? + + def se_linux_context=: ( + Docker::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext + ) -> Docker::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext + + def initialize: ( + ?app_armor: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor, + ?credential_spec: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec, + ?no_new_privileges: bool, + ?seccomp: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp, + ?se_linux_context: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext + ) -> void + + def to_hash: -> { + app_armor: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor, + credential_spec: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::CredentialSpec, + no_new_privileges: bool, + seccomp: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp, + se_linux_context: Docker::Spec::TaskTemplate::ContainerSpec::Privileges::SeLinuxContext + } + + type app_armor = + { + mode: Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::mode + } + + class AppArmor < Docker::Internal::Type::BaseModel + attr_reader mode: Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::mode? + + def mode=: ( + Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::mode + ) -> Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::mode + + def initialize: ( + ?mode: Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::mode + ) -> void + + def to_hash: -> { + mode: Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::mode + } + + type mode = :default | :disabled + + module Mode + extend Docker::Internal::Type::Enum + + DEFAULT: :default + DISABLED: :disabled + + def self?.values: -> ::Array[Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::AppArmor::mode] + end + end + + type credential_spec = + { config: String, file: String, registry: String } + + class CredentialSpec < Docker::Internal::Type::BaseModel + attr_reader config: String? + + def config=: (String) -> String + + attr_reader file: String? + + def file=: (String) -> String + + attr_reader registry: String? + + def registry=: (String) -> String + + def initialize: ( + ?config: String, + ?file: String, + ?registry: String + ) -> void + + def to_hash: -> { config: String, file: String, registry: String } + end + + type seccomp = + { + mode: Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::mode, + profile: String + } + + class Seccomp < Docker::Internal::Type::BaseModel + attr_reader mode: Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::mode? + + def mode=: ( + Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::mode + ) -> Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::mode + + attr_reader profile: String? + + def profile=: (String) -> String + + def initialize: ( + ?mode: Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::mode, + ?profile: String + ) -> void + + def to_hash: -> { + mode: Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::mode, + profile: String + } + + type mode = :default | :unconfined | :custom + + module Mode + extend Docker::Internal::Type::Enum + + DEFAULT: :default + UNCONFINED: :unconfined + CUSTOM: :custom + + def self?.values: -> ::Array[Docker::Models::Spec::TaskTemplate::ContainerSpec::Privileges::Seccomp::mode] + end + end + + type se_linux_context = + { + disable: bool, + level: String, + role: String, + type: String, + user: String + } + + class SeLinuxContext < Docker::Internal::Type::BaseModel + attr_reader disable: bool? + + def disable=: (bool) -> bool + + attr_reader level: String? + + def level=: (String) -> String + + attr_reader role: String? + + def role=: (String) -> String + + attr_reader type: String? + + def type=: (String) -> String + + attr_reader user: String? + + def user=: (String) -> String + + def initialize: ( + ?disable: bool, + ?level: String, + ?role: String, + ?type: String, + ?user: String + ) -> void + + def to_hash: -> { + disable: bool, + level: String, + role: String, + type: String, + user: String + } + end + end + + type secret = + { + file: Docker::Spec::TaskTemplate::ContainerSpec::Secret::File, + secret_id: String, + secret_name: String + } + + class Secret < Docker::Internal::Type::BaseModel + attr_reader file: Docker::Spec::TaskTemplate::ContainerSpec::Secret::File? + + def file=: ( + Docker::Spec::TaskTemplate::ContainerSpec::Secret::File + ) -> Docker::Spec::TaskTemplate::ContainerSpec::Secret::File + + attr_reader secret_id: String? + + def secret_id=: (String) -> String + + attr_reader secret_name: String? + + def secret_name=: (String) -> String + + def initialize: ( + ?file: Docker::Spec::TaskTemplate::ContainerSpec::Secret::File, + ?secret_id: String, + ?secret_name: String + ) -> void + + def to_hash: -> { + file: Docker::Spec::TaskTemplate::ContainerSpec::Secret::File, + secret_id: String, + secret_name: String + } + + type file = + { gid: String, mode: Integer, name: String, uid: String } + + class File < Docker::Internal::Type::BaseModel + attr_reader gid: String? + + def gid=: (String) -> String + + attr_reader mode: Integer? + + def mode=: (Integer) -> Integer + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader uid: String? + + def uid=: (String) -> String + + def initialize: ( + ?gid: String, + ?mode: Integer, + ?name: String, + ?uid: String + ) -> void + + def to_hash: -> { + gid: String, + mode: Integer, + name: String, + uid: String + } + end + end + + type ulimit = { hard: Integer, name: String, soft: Integer } + + class Ulimit < Docker::Internal::Type::BaseModel + attr_reader hard: Integer? + + def hard=: (Integer) -> Integer + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader soft: Integer? + + def soft=: (Integer) -> Integer + + def initialize: ( + ?hard: Integer, + ?name: String, + ?soft: Integer + ) -> void + + def to_hash: -> { hard: Integer, name: String, soft: Integer } + end + end + + type log_driver = { name: String, options: ::Hash[Symbol, String] } + + class LogDriver < Docker::Internal::Type::BaseModel + attr_reader name: String? + + def name=: (String) -> String + + attr_reader options: ::Hash[Symbol, String]? + + def options=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + def initialize: ( + ?name: String, + ?options: ::Hash[Symbol, String] + ) -> void + + def to_hash: -> { name: String, options: ::Hash[Symbol, String] } + end + + type network_attachment_spec = { container_id: String } + + class NetworkAttachmentSpec < Docker::Internal::Type::BaseModel + attr_reader container_id: String? + + def container_id=: (String) -> String + + def initialize: (?container_id: String) -> void + + def to_hash: -> { container_id: String } + end + + type network = + { + aliases: ::Array[String], + driver_opts: ::Hash[Symbol, String], + target: String + } + + class Network < Docker::Internal::Type::BaseModel + attr_reader aliases: ::Array[String]? + + def aliases=: (::Array[String]) -> ::Array[String] + + attr_reader driver_opts: ::Hash[Symbol, String]? + + def driver_opts=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader target: String? + + def target=: (String) -> String + + def initialize: ( + ?aliases: ::Array[String], + ?driver_opts: ::Hash[Symbol, String], + ?target: String + ) -> void + + def to_hash: -> { + aliases: ::Array[String], + driver_opts: ::Hash[Symbol, String], + target: String + } + end + + type placement = + { + constraints: ::Array[String], + max_replicas: Integer, + platforms: ::Array[Docker::Spec::TaskTemplate::Placement::Platform], + preferences: ::Array[Docker::Spec::TaskTemplate::Placement::Preference] + } + + class Placement < Docker::Internal::Type::BaseModel + attr_reader constraints: ::Array[String]? + + def constraints=: (::Array[String]) -> ::Array[String] + + attr_reader max_replicas: Integer? + + def max_replicas=: (Integer) -> Integer + + attr_reader platforms: ::Array[Docker::Spec::TaskTemplate::Placement::Platform]? + + def platforms=: ( + ::Array[Docker::Spec::TaskTemplate::Placement::Platform] + ) -> ::Array[Docker::Spec::TaskTemplate::Placement::Platform] + + attr_reader preferences: ::Array[Docker::Spec::TaskTemplate::Placement::Preference]? + + def preferences=: ( + ::Array[Docker::Spec::TaskTemplate::Placement::Preference] + ) -> ::Array[Docker::Spec::TaskTemplate::Placement::Preference] + + def initialize: ( + ?constraints: ::Array[String], + ?max_replicas: Integer, + ?platforms: ::Array[Docker::Spec::TaskTemplate::Placement::Platform], + ?preferences: ::Array[Docker::Spec::TaskTemplate::Placement::Preference] + ) -> void + + def to_hash: -> { + constraints: ::Array[String], + max_replicas: Integer, + platforms: ::Array[Docker::Spec::TaskTemplate::Placement::Platform], + preferences: ::Array[Docker::Spec::TaskTemplate::Placement::Preference] + } + + type platform = { architecture: String, os: String } + + class Platform < Docker::Internal::Type::BaseModel + attr_reader architecture: String? + + def architecture=: (String) -> String + + attr_reader os: String? + + def os=: (String) -> String + + def initialize: (?architecture: String, ?os: String) -> void + + def to_hash: -> { architecture: String, os: String } + end + + type preference = + { + spread: Docker::Spec::TaskTemplate::Placement::Preference::Spread + } + + class Preference < Docker::Internal::Type::BaseModel + attr_reader spread: Docker::Spec::TaskTemplate::Placement::Preference::Spread? + + def spread=: ( + Docker::Spec::TaskTemplate::Placement::Preference::Spread + ) -> Docker::Spec::TaskTemplate::Placement::Preference::Spread + + def initialize: ( + ?spread: Docker::Spec::TaskTemplate::Placement::Preference::Spread + ) -> void + + def to_hash: -> { + spread: Docker::Spec::TaskTemplate::Placement::Preference::Spread + } + + type spread = { spread_descriptor: String } + + class Spread < Docker::Internal::Type::BaseModel + attr_reader spread_descriptor: String? + + def spread_descriptor=: (String) -> String + + def initialize: (?spread_descriptor: String) -> void + + def to_hash: -> { spread_descriptor: String } + end + end + end + + type plugin_spec = + { + disabled: bool, + name: String, + plugin_privilege: ::Array[Docker::Spec::TaskTemplate::PluginSpec::PluginPrivilege], + remote: String + } + + class PluginSpec < Docker::Internal::Type::BaseModel + attr_reader disabled: bool? + + def disabled=: (bool) -> bool + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader plugin_privilege: ::Array[Docker::Spec::TaskTemplate::PluginSpec::PluginPrivilege]? + + def plugin_privilege=: ( + ::Array[Docker::Spec::TaskTemplate::PluginSpec::PluginPrivilege] + ) -> ::Array[Docker::Spec::TaskTemplate::PluginSpec::PluginPrivilege] + + attr_reader remote: String? + + def remote=: (String) -> String + + def initialize: ( + ?disabled: bool, + ?name: String, + ?plugin_privilege: ::Array[Docker::Spec::TaskTemplate::PluginSpec::PluginPrivilege], + ?remote: String + ) -> void + + def to_hash: -> { + disabled: bool, + name: String, + plugin_privilege: ::Array[Docker::Spec::TaskTemplate::PluginSpec::PluginPrivilege], + remote: String + } + + type plugin_privilege = + { description: String, name: String, value: ::Array[String] } + + class PluginPrivilege < Docker::Internal::Type::BaseModel + attr_reader description: String? + + def description=: (String) -> String + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader value: ::Array[String]? + + def value=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?description: String, + ?name: String, + ?value: ::Array[String] + ) -> void + + def to_hash: -> { + description: String, + name: String, + value: ::Array[String] + } + end + end + + type resources = + { + limits: Docker::Spec::TaskTemplate::Resources::Limits, + memory_swappiness: Integer?, + reservations: Docker::Spec::TaskTemplate::Resources::Reservations, + swap_bytes: Integer? + } + + class Resources < Docker::Internal::Type::BaseModel + attr_reader limits: Docker::Spec::TaskTemplate::Resources::Limits? + + def limits=: ( + Docker::Spec::TaskTemplate::Resources::Limits + ) -> Docker::Spec::TaskTemplate::Resources::Limits + + attr_accessor memory_swappiness: Integer? + + attr_reader reservations: Docker::Spec::TaskTemplate::Resources::Reservations? + + def reservations=: ( + Docker::Spec::TaskTemplate::Resources::Reservations + ) -> Docker::Spec::TaskTemplate::Resources::Reservations + + attr_accessor swap_bytes: Integer? + + def initialize: ( + ?limits: Docker::Spec::TaskTemplate::Resources::Limits, + ?memory_swappiness: Integer?, + ?reservations: Docker::Spec::TaskTemplate::Resources::Reservations, + ?swap_bytes: Integer? + ) -> void + + def to_hash: -> { + limits: Docker::Spec::TaskTemplate::Resources::Limits, + memory_swappiness: Integer?, + reservations: Docker::Spec::TaskTemplate::Resources::Reservations, + swap_bytes: Integer? + } + + type limits = + { memory_bytes: Integer, nano_cpus: Integer, pids: Integer } + + class Limits < Docker::Internal::Type::BaseModel + attr_reader memory_bytes: Integer? + + def memory_bytes=: (Integer) -> Integer + + attr_reader nano_cpus: Integer? + + def nano_cpus=: (Integer) -> Integer + + attr_reader pids: Integer? + + def pids=: (Integer) -> Integer + + def initialize: ( + ?memory_bytes: Integer, + ?nano_cpus: Integer, + ?pids: Integer + ) -> void + + def to_hash: -> { + memory_bytes: Integer, + nano_cpus: Integer, + pids: Integer + } + end + + type reservations = + { + generic_resources: ::Array[Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource], + memory_bytes: Integer, + nano_cpus: Integer + } + + class Reservations < Docker::Internal::Type::BaseModel + attr_reader generic_resources: ::Array[Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource]? + + def generic_resources=: ( + ::Array[Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource] + ) -> ::Array[Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource] + + attr_reader memory_bytes: Integer? + + def memory_bytes=: (Integer) -> Integer + + attr_reader nano_cpus: Integer? + + def nano_cpus=: (Integer) -> Integer + + def initialize: ( + ?generic_resources: ::Array[Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource], + ?memory_bytes: Integer, + ?nano_cpus: Integer + ) -> void + + def to_hash: -> { + generic_resources: ::Array[Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource], + memory_bytes: Integer, + nano_cpus: Integer + } + + type generic_resource = + { + discrete_resource_spec: Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec, + named_resource_spec: Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec + } + + class GenericResource < Docker::Internal::Type::BaseModel + attr_reader discrete_resource_spec: Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec? + + def discrete_resource_spec=: ( + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec + ) -> Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec + + attr_reader named_resource_spec: Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec? + + def named_resource_spec=: ( + Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec + ) -> Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec + + def initialize: ( + ?discrete_resource_spec: Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec, + ?named_resource_spec: Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec + ) -> void + + def to_hash: -> { + discrete_resource_spec: Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::DiscreteResourceSpec, + named_resource_spec: Docker::Spec::TaskTemplate::Resources::Reservations::GenericResource::NamedResourceSpec + } + + type discrete_resource_spec = { kind: String, value: Integer } + + class DiscreteResourceSpec < Docker::Internal::Type::BaseModel + attr_reader kind: String? + + def kind=: (String) -> String + + attr_reader value: Integer? + + def value=: (Integer) -> Integer + + def initialize: (?kind: String, ?value: Integer) -> void + + def to_hash: -> { kind: String, value: Integer } + end + + type named_resource_spec = { kind: String, value: String } + + class NamedResourceSpec < Docker::Internal::Type::BaseModel + attr_reader kind: String? + + def kind=: (String) -> String + + attr_reader value: String? + + def value=: (String) -> String + + def initialize: (?kind: String, ?value: String) -> void + + def to_hash: -> { kind: String, value: String } + end + end + end + end + + type restart_policy = + { + condition: Docker::Models::Spec::TaskTemplate::RestartPolicy::condition, + delay: Integer, + max_attempts: Integer, + window: Integer + } + + class RestartPolicy < Docker::Internal::Type::BaseModel + attr_reader condition: Docker::Models::Spec::TaskTemplate::RestartPolicy::condition? + + def condition=: ( + Docker::Models::Spec::TaskTemplate::RestartPolicy::condition + ) -> Docker::Models::Spec::TaskTemplate::RestartPolicy::condition + + attr_reader delay: Integer? + + def delay=: (Integer) -> Integer + + attr_reader max_attempts: Integer? + + def max_attempts=: (Integer) -> Integer + + attr_reader window: Integer? + + def window=: (Integer) -> Integer + + def initialize: ( + ?condition: Docker::Models::Spec::TaskTemplate::RestartPolicy::condition, + ?delay: Integer, + ?max_attempts: Integer, + ?window: Integer + ) -> void + + def to_hash: -> { + condition: Docker::Models::Spec::TaskTemplate::RestartPolicy::condition, + delay: Integer, + max_attempts: Integer, + window: Integer + } + + type condition = :none | :"on-failure" | :any + + module Condition + extend Docker::Internal::Type::Enum + + NONE: :none + ON_FAILURE: :"on-failure" + ANY: :any + + def self?.values: -> ::Array[Docker::Models::Spec::TaskTemplate::RestartPolicy::condition] + end + end + end + + type update_config = + { + delay: Integer, + failure_action: Docker::Models::Spec::UpdateConfig::failure_action, + max_failure_ratio: Float, + monitor: Integer, + order: Docker::Models::Spec::UpdateConfig::order, + parallelism: Integer + } + + class UpdateConfig < Docker::Internal::Type::BaseModel + attr_reader delay: Integer? + + def delay=: (Integer) -> Integer + + attr_reader failure_action: Docker::Models::Spec::UpdateConfig::failure_action? + + def failure_action=: ( + Docker::Models::Spec::UpdateConfig::failure_action + ) -> Docker::Models::Spec::UpdateConfig::failure_action + + attr_reader max_failure_ratio: Float? + + def max_failure_ratio=: (Float) -> Float + + attr_reader monitor: Integer? + + def monitor=: (Integer) -> Integer + + attr_reader order: Docker::Models::Spec::UpdateConfig::order? + + def order=: ( + Docker::Models::Spec::UpdateConfig::order + ) -> Docker::Models::Spec::UpdateConfig::order + + attr_reader parallelism: Integer? + + def parallelism=: (Integer) -> Integer + + def initialize: ( + ?delay: Integer, + ?failure_action: Docker::Models::Spec::UpdateConfig::failure_action, + ?max_failure_ratio: Float, + ?monitor: Integer, + ?order: Docker::Models::Spec::UpdateConfig::order, + ?parallelism: Integer + ) -> void + + def to_hash: -> { + delay: Integer, + failure_action: Docker::Models::Spec::UpdateConfig::failure_action, + max_failure_ratio: Float, + monitor: Integer, + order: Docker::Models::Spec::UpdateConfig::order, + parallelism: Integer + } + + type failure_action = :continue | :pause | :rollback + + module FailureAction + extend Docker::Internal::Type::Enum + + CONTINUE: :continue + PAUSE: :pause + ROLLBACK: :rollback + + def self?.values: -> ::Array[Docker::Models::Spec::UpdateConfig::failure_action] + end + + type order = :"stop-first" | :"start-first" + + module Order + extend Docker::Internal::Type::Enum + + STOP_FIRST: :"stop-first" + START_FIRST: :"start-first" + + def self?.values: -> ::Array[Docker::Models::Spec::UpdateConfig::order] + end + end + end + end +end diff --git a/sig/docker/models/summary.rbs b/sig/docker/models/summary.rbs new file mode 100644 index 0000000..d5b18f8 --- /dev/null +++ b/sig/docker/models/summary.rbs @@ -0,0 +1,630 @@ +module Docker + module Models + type summary = + { + command: String, + created: Integer, + health: Docker::Summary::Health, + host_config: Docker::Summary::HostConfig, + id: String, + image: String, + image_id: String, + image_manifest_descriptor: Docker::Summary::ImageManifestDescriptor, + labels: ::Hash[Symbol, String], + mounts: ::Array[Docker::Summary::Mount], + names: ::Array[String], + network_settings: Docker::Summary::NetworkSettings, + ports: ::Array[Docker::Summary::Port], + size_root_fs: Integer?, + size_rw: Integer?, + state: Docker::Models::Summary::state, + status: String + } + + class Summary < Docker::Internal::Type::BaseModel + attr_reader command: String? + + def command=: (String) -> String + + attr_reader created: Integer? + + def created=: (Integer) -> Integer + + attr_reader health: Docker::Summary::Health? + + def health=: (Docker::Summary::Health) -> Docker::Summary::Health + + attr_reader host_config: Docker::Summary::HostConfig? + + def host_config=: ( + Docker::Summary::HostConfig + ) -> Docker::Summary::HostConfig + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader image: String? + + def image=: (String) -> String + + attr_reader image_id: String? + + def image_id=: (String) -> String + + attr_reader image_manifest_descriptor: Docker::Summary::ImageManifestDescriptor? + + def image_manifest_descriptor=: ( + Docker::Summary::ImageManifestDescriptor + ) -> Docker::Summary::ImageManifestDescriptor + + attr_reader labels: ::Hash[Symbol, String]? + + def labels=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader mounts: ::Array[Docker::Summary::Mount]? + + def mounts=: ( + ::Array[Docker::Summary::Mount] + ) -> ::Array[Docker::Summary::Mount] + + attr_reader names: ::Array[String]? + + def names=: (::Array[String]) -> ::Array[String] + + attr_reader network_settings: Docker::Summary::NetworkSettings? + + def network_settings=: ( + Docker::Summary::NetworkSettings + ) -> Docker::Summary::NetworkSettings + + attr_reader ports: ::Array[Docker::Summary::Port]? + + def ports=: ( + ::Array[Docker::Summary::Port] + ) -> ::Array[Docker::Summary::Port] + + attr_accessor size_root_fs: Integer? + + attr_accessor size_rw: Integer? + + attr_reader state: Docker::Models::Summary::state? + + def state=: ( + Docker::Models::Summary::state + ) -> Docker::Models::Summary::state + + attr_reader status: String? + + def status=: (String) -> String + + def initialize: ( + ?command: String, + ?created: Integer, + ?health: Docker::Summary::Health, + ?host_config: Docker::Summary::HostConfig, + ?id: String, + ?image: String, + ?image_id: String, + ?image_manifest_descriptor: Docker::Summary::ImageManifestDescriptor, + ?labels: ::Hash[Symbol, String], + ?mounts: ::Array[Docker::Summary::Mount], + ?names: ::Array[String], + ?network_settings: Docker::Summary::NetworkSettings, + ?ports: ::Array[Docker::Summary::Port], + ?size_root_fs: Integer?, + ?size_rw: Integer?, + ?state: Docker::Models::Summary::state, + ?status: String + ) -> void + + def to_hash: -> { + command: String, + created: Integer, + health: Docker::Summary::Health, + host_config: Docker::Summary::HostConfig, + id: String, + image: String, + image_id: String, + image_manifest_descriptor: Docker::Summary::ImageManifestDescriptor, + labels: ::Hash[Symbol, String], + mounts: ::Array[Docker::Summary::Mount], + names: ::Array[String], + network_settings: Docker::Summary::NetworkSettings, + ports: ::Array[Docker::Summary::Port], + size_root_fs: Integer?, + size_rw: Integer?, + state: Docker::Models::Summary::state, + status: String + } + + type health = + { + failing_streak: Integer, + status: Docker::Models::Summary::Health::status + } + + class Health < Docker::Internal::Type::BaseModel + attr_reader failing_streak: Integer? + + def failing_streak=: (Integer) -> Integer + + attr_reader status: Docker::Models::Summary::Health::status? + + def status=: ( + Docker::Models::Summary::Health::status + ) -> Docker::Models::Summary::Health::status + + def initialize: ( + ?failing_streak: Integer, + ?status: Docker::Models::Summary::Health::status + ) -> void + + def to_hash: -> { + failing_streak: Integer, + status: Docker::Models::Summary::Health::status + } + + type status = :none | :starting | :healthy | :unhealthy + + module Status + extend Docker::Internal::Type::Enum + + NONE: :none + STARTING: :starting + HEALTHY: :healthy + UNHEALTHY: :unhealthy + + def self?.values: -> ::Array[Docker::Models::Summary::Health::status] + end + end + + type host_config = + { annotations: ::Hash[Symbol, String]?, network_mode: String } + + class HostConfig < Docker::Internal::Type::BaseModel + attr_accessor annotations: ::Hash[Symbol, String]? + + attr_reader network_mode: String? + + def network_mode=: (String) -> String + + def initialize: ( + ?annotations: ::Hash[Symbol, String]?, + ?network_mode: String + ) -> void + + def to_hash: -> { + annotations: ::Hash[Symbol, String]?, + network_mode: String + } + end + + type image_manifest_descriptor = + { + annotations: ::Hash[Symbol, String]?, + artifact_type: String?, + data: String?, + digest: String, + media_type: String, + platform: Docker::Summary::ImageManifestDescriptor::Platform?, + size: Integer, + urls: ::Array[String]? + } + + class ImageManifestDescriptor < Docker::Internal::Type::BaseModel + attr_accessor annotations: ::Hash[Symbol, String]? + + attr_accessor artifact_type: String? + + attr_accessor data: String? + + attr_reader digest: String? + + def digest=: (String) -> String + + attr_reader media_type: String? + + def media_type=: (String) -> String + + attr_accessor platform: Docker::Summary::ImageManifestDescriptor::Platform? + + attr_reader size: Integer? + + def size=: (Integer) -> Integer + + attr_accessor urls: ::Array[String]? + + def initialize: ( + ?annotations: ::Hash[Symbol, String]?, + ?artifact_type: String?, + ?data: String?, + ?digest: String, + ?media_type: String, + ?platform: Docker::Summary::ImageManifestDescriptor::Platform?, + ?size: Integer, + ?urls: ::Array[String]? + ) -> void + + def to_hash: -> { + annotations: ::Hash[Symbol, String]?, + artifact_type: String?, + data: String?, + digest: String, + media_type: String, + platform: Docker::Summary::ImageManifestDescriptor::Platform?, + size: Integer, + urls: ::Array[String]? + } + + type platform = + { + architecture: String, + os: String, + os_features: ::Array[String], + os_version: String, + variant: String + } + + class Platform < Docker::Internal::Type::BaseModel + attr_reader architecture: String? + + def architecture=: (String) -> String + + attr_reader os: String? + + def os=: (String) -> String + + attr_reader os_features: ::Array[String]? + + def os_features=: (::Array[String]) -> ::Array[String] + + attr_reader os_version: String? + + def os_version=: (String) -> String + + attr_reader variant: String? + + def variant=: (String) -> String + + def initialize: ( + ?architecture: String, + ?os: String, + ?os_features: ::Array[String], + ?os_version: String, + ?variant: String + ) -> void + + def to_hash: -> { + architecture: String, + os: String, + os_features: ::Array[String], + os_version: String, + variant: String + } + end + end + + type mount = + { + destination: String, + driver: String, + mode: String, + name: String, + propagation: String, + rw: bool, + source: String, + type: Docker::Models::Summary::Mount::type_ + } + + class Mount < Docker::Internal::Type::BaseModel + attr_reader destination: String? + + def destination=: (String) -> String + + attr_reader driver: String? + + def driver=: (String) -> String + + attr_reader mode: String? + + def mode=: (String) -> String + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader propagation: String? + + def propagation=: (String) -> String + + attr_reader rw: bool? + + def rw=: (bool) -> bool + + attr_reader source: String? + + def source=: (String) -> String + + attr_reader type: Docker::Models::Summary::Mount::type_? + + def type=: ( + Docker::Models::Summary::Mount::type_ + ) -> Docker::Models::Summary::Mount::type_ + + def initialize: ( + ?destination: String, + ?driver: String, + ?mode: String, + ?name: String, + ?propagation: String, + ?rw: bool, + ?source: String, + ?type: Docker::Models::Summary::Mount::type_ + ) -> void + + def to_hash: -> { + destination: String, + driver: String, + mode: String, + name: String, + propagation: String, + rw: bool, + source: String, + type: Docker::Models::Summary::Mount::type_ + } + + type type_ = :bind | :cluster | :image | :npipe | :tmpfs | :volume + + module Type + extend Docker::Internal::Type::Enum + + BIND: :bind + CLUSTER: :cluster + IMAGE: :image + NPIPE: :npipe + TMPFS: :tmpfs + VOLUME: :volume + + def self?.values: -> ::Array[Docker::Models::Summary::Mount::type_] + end + end + + type network_settings = + { networks: ::Hash[Symbol, Docker::Summary::NetworkSettings::Network] } + + class NetworkSettings < Docker::Internal::Type::BaseModel + attr_reader networks: ::Hash[Symbol, Docker::Summary::NetworkSettings::Network]? + + def networks=: ( + ::Hash[Symbol, Docker::Summary::NetworkSettings::Network] + ) -> ::Hash[Symbol, Docker::Summary::NetworkSettings::Network] + + def initialize: ( + ?networks: ::Hash[Symbol, Docker::Summary::NetworkSettings::Network] + ) -> void + + def to_hash: -> { + networks: ::Hash[Symbol, Docker::Summary::NetworkSettings::Network] + } + + type network = + { + aliases: ::Array[String], + dns_names: ::Array[String], + driver_opts: ::Hash[Symbol, String]?, + endpoint_id: String, + gateway: String, + :global_i_pv6_address => String, + :global_i_pv6_prefix_len => Integer, + gw_priority: Integer, + ip_address: String, + ipam_config: Docker::Summary::NetworkSettings::Network::IpamConfig?, + ip_prefix_len: Integer, + :i_pv6_gateway => String, + links: ::Array[String], + mac_address: String, + network_id: String + } + + class Network < Docker::Internal::Type::BaseModel + attr_reader aliases: ::Array[String]? + + def aliases=: (::Array[String]) -> ::Array[String] + + attr_reader dns_names: ::Array[String]? + + def dns_names=: (::Array[String]) -> ::Array[String] + + attr_accessor driver_opts: ::Hash[Symbol, String]? + + attr_reader endpoint_id: String? + + def endpoint_id=: (String) -> String + + attr_reader gateway: String? + + def gateway=: (String) -> String + + attr_reader global_i_pv6_address: String? + + def global_i_pv6_address=: (String) -> String + + attr_reader global_i_pv6_prefix_len: Integer? + + def global_i_pv6_prefix_len=: (Integer) -> Integer + + attr_reader gw_priority: Integer? + + def gw_priority=: (Integer) -> Integer + + attr_reader ip_address: String? + + def ip_address=: (String) -> String + + attr_accessor ipam_config: Docker::Summary::NetworkSettings::Network::IpamConfig? + + attr_reader ip_prefix_len: Integer? + + def ip_prefix_len=: (Integer) -> Integer + + attr_reader i_pv6_gateway: String? + + def i_pv6_gateway=: (String) -> String + + attr_reader links: ::Array[String]? + + def links=: (::Array[String]) -> ::Array[String] + + attr_reader mac_address: String? + + def mac_address=: (String) -> String + + attr_reader network_id: String? + + def network_id=: (String) -> String + + def initialize: ( + ?aliases: ::Array[String], + ?dns_names: ::Array[String], + ?driver_opts: ::Hash[Symbol, String]?, + ?endpoint_id: String, + ?gateway: String, + ?global_i_pv6_address: String, + ?global_i_pv6_prefix_len: Integer, + ?gw_priority: Integer, + ?ip_address: String, + ?ipam_config: Docker::Summary::NetworkSettings::Network::IpamConfig?, + ?ip_prefix_len: Integer, + ?i_pv6_gateway: String, + ?links: ::Array[String], + ?mac_address: String, + ?network_id: String + ) -> void + + def to_hash: -> { + aliases: ::Array[String], + dns_names: ::Array[String], + driver_opts: ::Hash[Symbol, String]?, + endpoint_id: String, + gateway: String, + :global_i_pv6_address => String, + :global_i_pv6_prefix_len => Integer, + gw_priority: Integer, + ip_address: String, + ipam_config: Docker::Summary::NetworkSettings::Network::IpamConfig?, + ip_prefix_len: Integer, + :i_pv6_gateway => String, + links: ::Array[String], + mac_address: String, + network_id: String + } + + type ipam_config = + { + :i_pv4_address => String, + :i_pv6_address => String, + link_local_ips: ::Array[String] + } + + class IpamConfig < Docker::Internal::Type::BaseModel + attr_reader i_pv4_address: String? + + def i_pv4_address=: (String) -> String + + attr_reader i_pv6_address: String? + + def i_pv6_address=: (String) -> String + + attr_reader link_local_ips: ::Array[String]? + + def link_local_ips=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?i_pv4_address: String, + ?i_pv6_address: String, + ?link_local_ips: ::Array[String] + ) -> void + + def to_hash: -> { + :i_pv4_address => String, + :i_pv6_address => String, + link_local_ips: ::Array[String] + } + end + end + end + + type port = + { + private_port: Integer, + type: Docker::Models::Summary::Port::type_, + ip: String, + public_port: Integer + } + + class Port < Docker::Internal::Type::BaseModel + attr_accessor private_port: Integer + + attr_accessor type: Docker::Models::Summary::Port::type_ + + attr_reader ip: String? + + def ip=: (String) -> String + + attr_reader public_port: Integer? + + def public_port=: (Integer) -> Integer + + def initialize: ( + private_port: Integer, + type: Docker::Models::Summary::Port::type_, + ?ip: String, + ?public_port: Integer + ) -> void + + def to_hash: -> { + private_port: Integer, + type: Docker::Models::Summary::Port::type_, + ip: String, + public_port: Integer + } + + type type_ = :tcp | :udp | :sctp + + module Type + extend Docker::Internal::Type::Enum + + TCP: :tcp + UDP: :udp + SCTP: :sctp + + def self?.values: -> ::Array[Docker::Models::Summary::Port::type_] + end + end + + type state = + :created + | :running + | :paused + | :restarting + | :exited + | :removing + | :dead + + module State + extend Docker::Internal::Type::Enum + + CREATED: :created + RUNNING: :running + PAUSED: :paused + RESTARTING: :restarting + EXITED: :exited + REMOVING: :removing + DEAD: :dead + + def self?.values: -> ::Array[Docker::Models::Summary::state] + end + end + end +end diff --git a/sig/docker/models/system_info_params.rbs b/sig/docker/models/system_info_params.rbs new file mode 100644 index 0000000..4c5d2ca --- /dev/null +++ b/sig/docker/models/system_info_params.rbs @@ -0,0 +1,14 @@ +module Docker + module Models + type system_info_params = { } & Docker::Internal::Type::request_parameters + + class SystemInfoParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + def initialize: (?request_options: Docker::request_opts) -> void + + def to_hash: -> { request_options: Docker::RequestOptions } + end + end +end diff --git a/sig/docker/models/system_info_response.rbs b/sig/docker/models/system_info_response.rbs new file mode 100644 index 0000000..f763978 --- /dev/null +++ b/sig/docker/models/system_info_response.rbs @@ -0,0 +1,1380 @@ +module Docker + module Models + type system_info_response = + { + architecture: String, + cdi_spec_dirs: ::Array[String], + cgroup_driver: Docker::Models::SystemInfoResponse::cgroup_driver, + cgroup_version: Docker::Models::SystemInfoResponse::cgroup_version, + containerd: Docker::Models::SystemInfoResponse::Containerd?, + containerd_commit: Docker::Models::SystemInfoResponse::ContainerdCommit, + containers: Integer, + containers_paused: Integer, + containers_running: Integer, + containers_stopped: Integer, + cpu_cfs_period: bool, + cpu_cfs_quota: bool, + cpu_set: bool, + cpu_shares: bool, + debug: bool, + default_address_pools: ::Array[Docker::Models::SystemInfoResponse::DefaultAddressPool], + default_runtime: String, + discovered_devices: ::Array[Docker::Models::SystemInfoResponse::DiscoveredDevice], + docker_root_dir: String, + driver: String, + driver_status: ::Array[::Array[String]], + experimental_build: bool, + firewall_backend: Docker::Models::SystemInfoResponse::FirewallBackend?, + generic_resources: ::Array[Docker::Models::SystemInfoResponse::GenericResource], + http_proxy: String, + https_proxy: String, + id: String, + images: Integer, + index_server_address: String, + init_binary: String, + init_commit: Docker::Models::SystemInfoResponse::InitCommit, + :i_pv4_forwarding => bool, + isolation: Docker::Models::SystemInfoResponse::isolation, + kernel_version: String, + labels: ::Array[String], + live_restore_enabled: bool, + logging_driver: String, + memory_limit: bool, + mem_total: Integer, + name: String, + ncpu: Integer, + n_events_listener: Integer, + n_fd: Integer, + n_goroutines: Integer, + no_proxy: String, + nri: Docker::Models::SystemInfoResponse::Nri?, + oom_kill_disable: bool, + operating_system: String, + os_type: String, + os_version: String, + pids_limit: bool, + plugins: Docker::Models::SystemInfoResponse::Plugins, + product_license: String, + registry_config: Docker::Models::SystemInfoResponse::RegistryConfig?, + runc_commit: Docker::Models::SystemInfoResponse::RuncCommit, + runtimes: ::Hash[Symbol, Docker::Models::SystemInfoResponse::Runtime], + security_options: ::Array[String], + server_version: String, + swap_limit: bool, + swarm: Docker::Models::SystemInfoResponse::Swarm, + system_time: String, + warnings: ::Array[String] + } + + class SystemInfoResponse < Docker::Internal::Type::BaseModel + attr_reader architecture: String? + + def architecture=: (String) -> String + + attr_reader cdi_spec_dirs: ::Array[String]? + + def cdi_spec_dirs=: (::Array[String]) -> ::Array[String] + + attr_reader cgroup_driver: Docker::Models::SystemInfoResponse::cgroup_driver? + + def cgroup_driver=: ( + Docker::Models::SystemInfoResponse::cgroup_driver + ) -> Docker::Models::SystemInfoResponse::cgroup_driver + + attr_reader cgroup_version: Docker::Models::SystemInfoResponse::cgroup_version? + + def cgroup_version=: ( + Docker::Models::SystemInfoResponse::cgroup_version + ) -> Docker::Models::SystemInfoResponse::cgroup_version + + attr_accessor containerd: Docker::Models::SystemInfoResponse::Containerd? + + attr_reader containerd_commit: Docker::Models::SystemInfoResponse::ContainerdCommit? + + def containerd_commit=: ( + Docker::Models::SystemInfoResponse::ContainerdCommit + ) -> Docker::Models::SystemInfoResponse::ContainerdCommit + + attr_reader containers: Integer? + + def containers=: (Integer) -> Integer + + attr_reader containers_paused: Integer? + + def containers_paused=: (Integer) -> Integer + + attr_reader containers_running: Integer? + + def containers_running=: (Integer) -> Integer + + attr_reader containers_stopped: Integer? + + def containers_stopped=: (Integer) -> Integer + + attr_reader cpu_cfs_period: bool? + + def cpu_cfs_period=: (bool) -> bool + + attr_reader cpu_cfs_quota: bool? + + def cpu_cfs_quota=: (bool) -> bool + + attr_reader cpu_set: bool? + + def cpu_set=: (bool) -> bool + + attr_reader cpu_shares: bool? + + def cpu_shares=: (bool) -> bool + + attr_reader debug: bool? + + def debug=: (bool) -> bool + + attr_reader default_address_pools: ::Array[Docker::Models::SystemInfoResponse::DefaultAddressPool]? + + def default_address_pools=: ( + ::Array[Docker::Models::SystemInfoResponse::DefaultAddressPool] + ) -> ::Array[Docker::Models::SystemInfoResponse::DefaultAddressPool] + + attr_reader default_runtime: String? + + def default_runtime=: (String) -> String + + attr_reader discovered_devices: ::Array[Docker::Models::SystemInfoResponse::DiscoveredDevice]? + + def discovered_devices=: ( + ::Array[Docker::Models::SystemInfoResponse::DiscoveredDevice] + ) -> ::Array[Docker::Models::SystemInfoResponse::DiscoveredDevice] + + attr_reader docker_root_dir: String? + + def docker_root_dir=: (String) -> String + + attr_reader driver: String? + + def driver=: (String) -> String + + attr_reader driver_status: ::Array[::Array[String]]? + + def driver_status=: (::Array[::Array[String]]) -> ::Array[::Array[String]] + + attr_reader experimental_build: bool? + + def experimental_build=: (bool) -> bool + + attr_accessor firewall_backend: Docker::Models::SystemInfoResponse::FirewallBackend? + + attr_reader generic_resources: ::Array[Docker::Models::SystemInfoResponse::GenericResource]? + + def generic_resources=: ( + ::Array[Docker::Models::SystemInfoResponse::GenericResource] + ) -> ::Array[Docker::Models::SystemInfoResponse::GenericResource] + + attr_reader http_proxy: String? + + def http_proxy=: (String) -> String + + attr_reader https_proxy: String? + + def https_proxy=: (String) -> String + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader images: Integer? + + def images=: (Integer) -> Integer + + attr_reader index_server_address: String? + + def index_server_address=: (String) -> String + + attr_reader init_binary: String? + + def init_binary=: (String) -> String + + attr_reader init_commit: Docker::Models::SystemInfoResponse::InitCommit? + + def init_commit=: ( + Docker::Models::SystemInfoResponse::InitCommit + ) -> Docker::Models::SystemInfoResponse::InitCommit + + attr_reader i_pv4_forwarding: bool? + + def i_pv4_forwarding=: (bool) -> bool + + attr_reader isolation: Docker::Models::SystemInfoResponse::isolation? + + def isolation=: ( + Docker::Models::SystemInfoResponse::isolation + ) -> Docker::Models::SystemInfoResponse::isolation + + attr_reader kernel_version: String? + + def kernel_version=: (String) -> String + + attr_reader labels: ::Array[String]? + + def labels=: (::Array[String]) -> ::Array[String] + + attr_reader live_restore_enabled: bool? + + def live_restore_enabled=: (bool) -> bool + + attr_reader logging_driver: String? + + def logging_driver=: (String) -> String + + attr_reader memory_limit: bool? + + def memory_limit=: (bool) -> bool + + attr_reader mem_total: Integer? + + def mem_total=: (Integer) -> Integer + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader ncpu: Integer? + + def ncpu=: (Integer) -> Integer + + attr_reader n_events_listener: Integer? + + def n_events_listener=: (Integer) -> Integer + + attr_reader n_fd: Integer? + + def n_fd=: (Integer) -> Integer + + attr_reader n_goroutines: Integer? + + def n_goroutines=: (Integer) -> Integer + + attr_reader no_proxy: String? + + def no_proxy=: (String) -> String + + attr_accessor nri: Docker::Models::SystemInfoResponse::Nri? + + attr_reader oom_kill_disable: bool? + + def oom_kill_disable=: (bool) -> bool + + attr_reader operating_system: String? + + def operating_system=: (String) -> String + + attr_reader os_type: String? + + def os_type=: (String) -> String + + attr_reader os_version: String? + + def os_version=: (String) -> String + + attr_reader pids_limit: bool? + + def pids_limit=: (bool) -> bool + + attr_reader plugins: Docker::Models::SystemInfoResponse::Plugins? + + def plugins=: ( + Docker::Models::SystemInfoResponse::Plugins + ) -> Docker::Models::SystemInfoResponse::Plugins + + attr_reader product_license: String? + + def product_license=: (String) -> String + + attr_accessor registry_config: Docker::Models::SystemInfoResponse::RegistryConfig? + + attr_reader runc_commit: Docker::Models::SystemInfoResponse::RuncCommit? + + def runc_commit=: ( + Docker::Models::SystemInfoResponse::RuncCommit + ) -> Docker::Models::SystemInfoResponse::RuncCommit + + attr_reader runtimes: ::Hash[Symbol, Docker::Models::SystemInfoResponse::Runtime]? + + def runtimes=: ( + ::Hash[Symbol, Docker::Models::SystemInfoResponse::Runtime] + ) -> ::Hash[Symbol, Docker::Models::SystemInfoResponse::Runtime] + + attr_reader security_options: ::Array[String]? + + def security_options=: (::Array[String]) -> ::Array[String] + + attr_reader server_version: String? + + def server_version=: (String) -> String + + attr_reader swap_limit: bool? + + def swap_limit=: (bool) -> bool + + attr_reader swarm: Docker::Models::SystemInfoResponse::Swarm? + + def swarm=: ( + Docker::Models::SystemInfoResponse::Swarm + ) -> Docker::Models::SystemInfoResponse::Swarm + + attr_reader system_time: String? + + def system_time=: (String) -> String + + attr_reader warnings: ::Array[String]? + + def warnings=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?architecture: String, + ?cdi_spec_dirs: ::Array[String], + ?cgroup_driver: Docker::Models::SystemInfoResponse::cgroup_driver, + ?cgroup_version: Docker::Models::SystemInfoResponse::cgroup_version, + ?containerd: Docker::Models::SystemInfoResponse::Containerd?, + ?containerd_commit: Docker::Models::SystemInfoResponse::ContainerdCommit, + ?containers: Integer, + ?containers_paused: Integer, + ?containers_running: Integer, + ?containers_stopped: Integer, + ?cpu_cfs_period: bool, + ?cpu_cfs_quota: bool, + ?cpu_set: bool, + ?cpu_shares: bool, + ?debug: bool, + ?default_address_pools: ::Array[Docker::Models::SystemInfoResponse::DefaultAddressPool], + ?default_runtime: String, + ?discovered_devices: ::Array[Docker::Models::SystemInfoResponse::DiscoveredDevice], + ?docker_root_dir: String, + ?driver: String, + ?driver_status: ::Array[::Array[String]], + ?experimental_build: bool, + ?firewall_backend: Docker::Models::SystemInfoResponse::FirewallBackend?, + ?generic_resources: ::Array[Docker::Models::SystemInfoResponse::GenericResource], + ?http_proxy: String, + ?https_proxy: String, + ?id: String, + ?images: Integer, + ?index_server_address: String, + ?init_binary: String, + ?init_commit: Docker::Models::SystemInfoResponse::InitCommit, + ?i_pv4_forwarding: bool, + ?isolation: Docker::Models::SystemInfoResponse::isolation, + ?kernel_version: String, + ?labels: ::Array[String], + ?live_restore_enabled: bool, + ?logging_driver: String, + ?memory_limit: bool, + ?mem_total: Integer, + ?name: String, + ?ncpu: Integer, + ?n_events_listener: Integer, + ?n_fd: Integer, + ?n_goroutines: Integer, + ?no_proxy: String, + ?nri: Docker::Models::SystemInfoResponse::Nri?, + ?oom_kill_disable: bool, + ?operating_system: String, + ?os_type: String, + ?os_version: String, + ?pids_limit: bool, + ?plugins: Docker::Models::SystemInfoResponse::Plugins, + ?product_license: String, + ?registry_config: Docker::Models::SystemInfoResponse::RegistryConfig?, + ?runc_commit: Docker::Models::SystemInfoResponse::RuncCommit, + ?runtimes: ::Hash[Symbol, Docker::Models::SystemInfoResponse::Runtime], + ?security_options: ::Array[String], + ?server_version: String, + ?swap_limit: bool, + ?swarm: Docker::Models::SystemInfoResponse::Swarm, + ?system_time: String, + ?warnings: ::Array[String] + ) -> void + + def to_hash: -> { + architecture: String, + cdi_spec_dirs: ::Array[String], + cgroup_driver: Docker::Models::SystemInfoResponse::cgroup_driver, + cgroup_version: Docker::Models::SystemInfoResponse::cgroup_version, + containerd: Docker::Models::SystemInfoResponse::Containerd?, + containerd_commit: Docker::Models::SystemInfoResponse::ContainerdCommit, + containers: Integer, + containers_paused: Integer, + containers_running: Integer, + containers_stopped: Integer, + cpu_cfs_period: bool, + cpu_cfs_quota: bool, + cpu_set: bool, + cpu_shares: bool, + debug: bool, + default_address_pools: ::Array[Docker::Models::SystemInfoResponse::DefaultAddressPool], + default_runtime: String, + discovered_devices: ::Array[Docker::Models::SystemInfoResponse::DiscoveredDevice], + docker_root_dir: String, + driver: String, + driver_status: ::Array[::Array[String]], + experimental_build: bool, + firewall_backend: Docker::Models::SystemInfoResponse::FirewallBackend?, + generic_resources: ::Array[Docker::Models::SystemInfoResponse::GenericResource], + http_proxy: String, + https_proxy: String, + id: String, + images: Integer, + index_server_address: String, + init_binary: String, + init_commit: Docker::Models::SystemInfoResponse::InitCommit, + :i_pv4_forwarding => bool, + isolation: Docker::Models::SystemInfoResponse::isolation, + kernel_version: String, + labels: ::Array[String], + live_restore_enabled: bool, + logging_driver: String, + memory_limit: bool, + mem_total: Integer, + name: String, + ncpu: Integer, + n_events_listener: Integer, + n_fd: Integer, + n_goroutines: Integer, + no_proxy: String, + nri: Docker::Models::SystemInfoResponse::Nri?, + oom_kill_disable: bool, + operating_system: String, + os_type: String, + os_version: String, + pids_limit: bool, + plugins: Docker::Models::SystemInfoResponse::Plugins, + product_license: String, + registry_config: Docker::Models::SystemInfoResponse::RegistryConfig?, + runc_commit: Docker::Models::SystemInfoResponse::RuncCommit, + runtimes: ::Hash[Symbol, Docker::Models::SystemInfoResponse::Runtime], + security_options: ::Array[String], + server_version: String, + swap_limit: bool, + swarm: Docker::Models::SystemInfoResponse::Swarm, + system_time: String, + warnings: ::Array[String] + } + + type cgroup_driver = :cgroupfs | :systemd | :none + + module CgroupDriver + extend Docker::Internal::Type::Enum + + CGROUPFS: :cgroupfs + SYSTEMD: :systemd + NONE: :none + + def self?.values: -> ::Array[Docker::Models::SystemInfoResponse::cgroup_driver] + end + + type cgroup_version = :"1" | :"2" + + module CgroupVersion + extend Docker::Internal::Type::Enum + + CGROUP_VERSION_1: :"1" + CGROUP_VERSION_2: :"2" + + def self?.values: -> ::Array[Docker::Models::SystemInfoResponse::cgroup_version] + end + + type containerd = + { + address: String, + namespaces: Docker::Models::SystemInfoResponse::Containerd::Namespaces + } + + class Containerd < Docker::Internal::Type::BaseModel + attr_reader address: String? + + def address=: (String) -> String + + attr_reader namespaces: Docker::Models::SystemInfoResponse::Containerd::Namespaces? + + def namespaces=: ( + Docker::Models::SystemInfoResponse::Containerd::Namespaces + ) -> Docker::Models::SystemInfoResponse::Containerd::Namespaces + + def initialize: ( + ?address: String, + ?namespaces: Docker::Models::SystemInfoResponse::Containerd::Namespaces + ) -> void + + def to_hash: -> { + address: String, + namespaces: Docker::Models::SystemInfoResponse::Containerd::Namespaces + } + + type namespaces = { containers: String, plugins: String } + + class Namespaces < Docker::Internal::Type::BaseModel + attr_reader containers: String? + + def containers=: (String) -> String + + attr_reader plugins: String? + + def plugins=: (String) -> String + + def initialize: (?containers: String, ?plugins: String) -> void + + def to_hash: -> { containers: String, plugins: String } + end + end + + type containerd_commit = { id: String } + + class ContainerdCommit < Docker::Internal::Type::BaseModel + attr_reader id: String? + + def id=: (String) -> String + + def initialize: (?id: String) -> void + + def to_hash: -> { id: String } + end + + type default_address_pool = { base: String, size: Integer } + + class DefaultAddressPool < Docker::Internal::Type::BaseModel + attr_reader base: String? + + def base=: (String) -> String + + attr_reader size: Integer? + + def size=: (Integer) -> Integer + + def initialize: (?base: String, ?size: Integer) -> void + + def to_hash: -> { base: String, size: Integer } + end + + type discovered_device = { id: String, source: String } + + class DiscoveredDevice < Docker::Internal::Type::BaseModel + attr_reader id: String? + + def id=: (String) -> String + + attr_reader source: String? + + def source=: (String) -> String + + def initialize: (?id: String, ?source: String) -> void + + def to_hash: -> { id: String, source: String } + end + + type firewall_backend = { driver: String, info: ::Array[::Array[String]] } + + class FirewallBackend < Docker::Internal::Type::BaseModel + attr_reader driver: String? + + def driver=: (String) -> String + + attr_reader info: ::Array[::Array[String]]? + + def info=: (::Array[::Array[String]]) -> ::Array[::Array[String]] + + def initialize: ( + ?driver: String, + ?info: ::Array[::Array[String]] + ) -> void + + def to_hash: -> { driver: String, info: ::Array[::Array[String]] } + end + + type generic_resource = + { + discrete_resource_spec: Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec, + named_resource_spec: Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec + } + + class GenericResource < Docker::Internal::Type::BaseModel + attr_reader discrete_resource_spec: Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec? + + def discrete_resource_spec=: ( + Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec + ) -> Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec + + attr_reader named_resource_spec: Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec? + + def named_resource_spec=: ( + Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec + ) -> Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec + + def initialize: ( + ?discrete_resource_spec: Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec, + ?named_resource_spec: Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec + ) -> void + + def to_hash: -> { + discrete_resource_spec: Docker::Models::SystemInfoResponse::GenericResource::DiscreteResourceSpec, + named_resource_spec: Docker::Models::SystemInfoResponse::GenericResource::NamedResourceSpec + } + + type discrete_resource_spec = { kind: String, value: Integer } + + class DiscreteResourceSpec < Docker::Internal::Type::BaseModel + attr_reader kind: String? + + def kind=: (String) -> String + + attr_reader value: Integer? + + def value=: (Integer) -> Integer + + def initialize: (?kind: String, ?value: Integer) -> void + + def to_hash: -> { kind: String, value: Integer } + end + + type named_resource_spec = { kind: String, value: String } + + class NamedResourceSpec < Docker::Internal::Type::BaseModel + attr_reader kind: String? + + def kind=: (String) -> String + + attr_reader value: String? + + def value=: (String) -> String + + def initialize: (?kind: String, ?value: String) -> void + + def to_hash: -> { kind: String, value: String } + end + end + + type init_commit = { id: String } + + class InitCommit < Docker::Internal::Type::BaseModel + attr_reader id: String? + + def id=: (String) -> String + + def initialize: (?id: String) -> void + + def to_hash: -> { id: String } + end + + type isolation = :default | :hyperv | :process | :"" + + module Isolation + extend Docker::Internal::Type::Enum + + DEFAULT: :default + HYPERV: :hyperv + PROCESS: :process + EMPTY: :"" + + def self?.values: -> ::Array[Docker::Models::SystemInfoResponse::isolation] + end + + type nri = { info: ::Array[::Array[String]] } + + class Nri < Docker::Internal::Type::BaseModel + attr_reader info: ::Array[::Array[String]]? + + def info=: (::Array[::Array[String]]) -> ::Array[::Array[String]] + + def initialize: (?info: ::Array[::Array[String]]) -> void + + def to_hash: -> { info: ::Array[::Array[String]] } + end + + type plugins = + { + authorization: ::Array[String], + log: ::Array[String], + network: ::Array[String], + volume: ::Array[String] + } + + class Plugins < Docker::Internal::Type::BaseModel + attr_reader authorization: ::Array[String]? + + def authorization=: (::Array[String]) -> ::Array[String] + + attr_reader log: ::Array[String]? + + def log=: (::Array[String]) -> ::Array[String] + + attr_reader network: ::Array[String]? + + def network=: (::Array[String]) -> ::Array[String] + + attr_reader volume: ::Array[String]? + + def volume=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?authorization: ::Array[String], + ?log: ::Array[String], + ?network: ::Array[String], + ?volume: ::Array[String] + ) -> void + + def to_hash: -> { + authorization: ::Array[String], + log: ::Array[String], + network: ::Array[String], + volume: ::Array[String] + } + end + + type registry_config = + { + index_configs: ::Hash[Symbol, Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig?], + insecure_registry_cid_rs: ::Array[String], + mirrors: ::Array[String] + } + + class RegistryConfig < Docker::Internal::Type::BaseModel + attr_reader index_configs: ::Hash[Symbol, Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig?]? + + def index_configs=: ( + ::Hash[Symbol, Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig?] + ) -> ::Hash[Symbol, Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig?] + + attr_reader insecure_registry_cid_rs: ::Array[String]? + + def insecure_registry_cid_rs=: (::Array[String]) -> ::Array[String] + + attr_reader mirrors: ::Array[String]? + + def mirrors=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?index_configs: ::Hash[Symbol, Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig?], + ?insecure_registry_cid_rs: ::Array[String], + ?mirrors: ::Array[String] + ) -> void + + def to_hash: -> { + index_configs: ::Hash[Symbol, Docker::Models::SystemInfoResponse::RegistryConfig::IndexConfig?], + insecure_registry_cid_rs: ::Array[String], + mirrors: ::Array[String] + } + + type index_config = + { + mirrors: ::Array[String], + name: String, + official: bool, + secure: bool + } + + class IndexConfig < Docker::Internal::Type::BaseModel + attr_reader mirrors: ::Array[String]? + + def mirrors=: (::Array[String]) -> ::Array[String] + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader official: bool? + + def official=: (bool) -> bool + + attr_reader secure: bool? + + def secure=: (bool) -> bool + + def initialize: ( + ?mirrors: ::Array[String], + ?name: String, + ?official: bool, + ?secure: bool + ) -> void + + def to_hash: -> { + mirrors: ::Array[String], + name: String, + official: bool, + secure: bool + } + end + end + + type runc_commit = { id: String } + + class RuncCommit < Docker::Internal::Type::BaseModel + attr_reader id: String? + + def id=: (String) -> String + + def initialize: (?id: String) -> void + + def to_hash: -> { id: String } + end + + type runtime = + { + path: String, + runtime_args: ::Array[String]?, + status: ::Hash[Symbol, String]? + } + + class Runtime < Docker::Internal::Type::BaseModel + attr_reader path: String? + + def path=: (String) -> String + + attr_accessor runtime_args: ::Array[String]? + + attr_accessor status: ::Hash[Symbol, String]? + + def initialize: ( + ?path: String, + ?runtime_args: ::Array[String]?, + ?status: ::Hash[Symbol, String]? + ) -> void + + def to_hash: -> { + path: String, + runtime_args: ::Array[String]?, + status: ::Hash[Symbol, String]? + } + end + + type swarm = + { + cluster: Docker::Models::SystemInfoResponse::Swarm::Cluster?, + control_available: bool, + error: String, + local_node_state: Docker::Models::SystemInfoResponse::Swarm::local_node_state, + managers: Integer?, + node_addr: String, + node_id: String, + nodes: Integer?, + remote_managers: ::Array[Docker::Models::SystemInfoResponse::Swarm::RemoteManager]? + } + + class Swarm < Docker::Internal::Type::BaseModel + attr_accessor cluster: Docker::Models::SystemInfoResponse::Swarm::Cluster? + + attr_reader control_available: bool? + + def control_available=: (bool) -> bool + + attr_reader error: String? + + def error=: (String) -> String + + attr_reader local_node_state: Docker::Models::SystemInfoResponse::Swarm::local_node_state? + + def local_node_state=: ( + Docker::Models::SystemInfoResponse::Swarm::local_node_state + ) -> Docker::Models::SystemInfoResponse::Swarm::local_node_state + + attr_accessor managers: Integer? + + attr_reader node_addr: String? + + def node_addr=: (String) -> String + + attr_reader node_id: String? + + def node_id=: (String) -> String + + attr_accessor nodes: Integer? + + attr_accessor remote_managers: ::Array[Docker::Models::SystemInfoResponse::Swarm::RemoteManager]? + + def initialize: ( + ?cluster: Docker::Models::SystemInfoResponse::Swarm::Cluster?, + ?control_available: bool, + ?error: String, + ?local_node_state: Docker::Models::SystemInfoResponse::Swarm::local_node_state, + ?managers: Integer?, + ?node_addr: String, + ?node_id: String, + ?nodes: Integer?, + ?remote_managers: ::Array[Docker::Models::SystemInfoResponse::Swarm::RemoteManager]? + ) -> void + + def to_hash: -> { + cluster: Docker::Models::SystemInfoResponse::Swarm::Cluster?, + control_available: bool, + error: String, + local_node_state: Docker::Models::SystemInfoResponse::Swarm::local_node_state, + managers: Integer?, + node_addr: String, + node_id: String, + nodes: Integer?, + remote_managers: ::Array[Docker::Models::SystemInfoResponse::Swarm::RemoteManager]? + } + + type cluster = + { + created_at: String, + data_path_port: Integer, + default_addr_pool: ::Array[String], + id: String, + root_rotation_in_progress: bool, + spec: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec, + subnet_size: Integer, + tls_info: Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo, + updated_at: String, + version: Docker::Models::SystemInfoResponse::Swarm::Cluster::Version + } + + class Cluster < Docker::Internal::Type::BaseModel + attr_reader created_at: String? + + def created_at=: (String) -> String + + attr_reader data_path_port: Integer? + + def data_path_port=: (Integer) -> Integer + + attr_reader default_addr_pool: ::Array[String]? + + def default_addr_pool=: (::Array[String]) -> ::Array[String] + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader root_rotation_in_progress: bool? + + def root_rotation_in_progress=: (bool) -> bool + + attr_reader spec: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec? + + def spec=: ( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec + ) -> Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec + + attr_reader subnet_size: Integer? + + def subnet_size=: (Integer) -> Integer + + attr_reader tls_info: Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo? + + def tls_info=: ( + Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo + ) -> Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo + + attr_reader updated_at: String? + + def updated_at=: (String) -> String + + attr_reader version: Docker::Models::SystemInfoResponse::Swarm::Cluster::Version? + + def version=: ( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Version + ) -> Docker::Models::SystemInfoResponse::Swarm::Cluster::Version + + def initialize: ( + ?created_at: String, + ?data_path_port: Integer, + ?default_addr_pool: ::Array[String], + ?id: String, + ?root_rotation_in_progress: bool, + ?spec: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec, + ?subnet_size: Integer, + ?tls_info: Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo, + ?updated_at: String, + ?version: Docker::Models::SystemInfoResponse::Swarm::Cluster::Version + ) -> void + + def to_hash: -> { + created_at: String, + data_path_port: Integer, + default_addr_pool: ::Array[String], + id: String, + root_rotation_in_progress: bool, + spec: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec, + subnet_size: Integer, + tls_info: Docker::Models::SystemInfoResponse::Swarm::Cluster::TlsInfo, + updated_at: String, + version: Docker::Models::SystemInfoResponse::Swarm::Cluster::Version + } + + type spec = + { + ca_config: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig?, + dispatcher: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher?, + encryption_config: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig, + labels: ::Hash[Symbol, String], + name: String, + orchestration: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration?, + raft: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft, + task_defaults: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults + } + + class Spec < Docker::Internal::Type::BaseModel + attr_accessor ca_config: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig? + + attr_accessor dispatcher: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher? + + attr_reader encryption_config: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig? + + def encryption_config=: ( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig + ) -> Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig + + attr_reader labels: ::Hash[Symbol, String]? + + def labels=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader name: String? + + def name=: (String) -> String + + attr_accessor orchestration: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration? + + attr_reader raft: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft? + + def raft=: ( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft + ) -> Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft + + attr_reader task_defaults: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults? + + def task_defaults=: ( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults + ) -> Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults + + def initialize: ( + ?ca_config: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig?, + ?dispatcher: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher?, + ?encryption_config: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig, + ?labels: ::Hash[Symbol, String], + ?name: String, + ?orchestration: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration?, + ?raft: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft, + ?task_defaults: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults + ) -> void + + def to_hash: -> { + ca_config: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig?, + dispatcher: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Dispatcher?, + encryption_config: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::EncryptionConfig, + labels: ::Hash[Symbol, String], + name: String, + orchestration: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Orchestration?, + raft: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::Raft, + task_defaults: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults + } + + type ca_config = + { + external_c_as: ::Array[Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA], + force_rotate: Integer, + node_cert_expiry: Integer, + signing_ca_cert: String, + signing_ca_key: String + } + + class CaConfig < Docker::Internal::Type::BaseModel + attr_reader external_c_as: ::Array[Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA]? + + def external_c_as=: ( + ::Array[Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA] + ) -> ::Array[Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA] + + attr_reader force_rotate: Integer? + + def force_rotate=: (Integer) -> Integer + + attr_reader node_cert_expiry: Integer? + + def node_cert_expiry=: (Integer) -> Integer + + attr_reader signing_ca_cert: String? + + def signing_ca_cert=: (String) -> String + + attr_reader signing_ca_key: String? + + def signing_ca_key=: (String) -> String + + def initialize: ( + ?external_c_as: ::Array[Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA], + ?force_rotate: Integer, + ?node_cert_expiry: Integer, + ?signing_ca_cert: String, + ?signing_ca_key: String + ) -> void + + def to_hash: -> { + external_c_as: ::Array[Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA], + force_rotate: Integer, + node_cert_expiry: Integer, + signing_ca_cert: String, + signing_ca_key: String + } + + type external_ca = + { + ca_cert: String, + options: ::Hash[Symbol, String], + protocol: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::protocol, + url: String + } + + class ExternalCA < Docker::Internal::Type::BaseModel + attr_reader ca_cert: String? + + def ca_cert=: (String) -> String + + attr_reader options: ::Hash[Symbol, String]? + + def options=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader protocol: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::protocol? + + def protocol=: ( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::protocol + ) -> Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::protocol + + attr_reader url: String? + + def url=: (String) -> String + + def initialize: ( + ?ca_cert: String, + ?options: ::Hash[Symbol, String], + ?protocol: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::protocol, + ?url: String + ) -> void + + def to_hash: -> { + ca_cert: String, + options: ::Hash[Symbol, String], + protocol: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::protocol, + url: String + } + + type protocol = :cfssl + + module Protocol + extend Docker::Internal::Type::Enum + + CFSSL: :cfssl + + def self?.values: -> ::Array[Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::CaConfig::ExternalCA::protocol] + end + end + end + + type dispatcher = { heartbeat_period: Integer } + + class Dispatcher < Docker::Internal::Type::BaseModel + attr_reader heartbeat_period: Integer? + + def heartbeat_period=: (Integer) -> Integer + + def initialize: (?heartbeat_period: Integer) -> void + + def to_hash: -> { heartbeat_period: Integer } + end + + type encryption_config = { auto_lock_managers: bool } + + class EncryptionConfig < Docker::Internal::Type::BaseModel + attr_reader auto_lock_managers: bool? + + def auto_lock_managers=: (bool) -> bool + + def initialize: (?auto_lock_managers: bool) -> void + + def to_hash: -> { auto_lock_managers: bool } + end + + type orchestration = { task_history_retention_limit: Integer } + + class Orchestration < Docker::Internal::Type::BaseModel + attr_reader task_history_retention_limit: Integer? + + def task_history_retention_limit=: (Integer) -> Integer + + def initialize: (?task_history_retention_limit: Integer) -> void + + def to_hash: -> { task_history_retention_limit: Integer } + end + + type raft = + { + election_tick: Integer, + heartbeat_tick: Integer, + keep_old_snapshots: Integer, + log_entries_for_slow_followers: Integer, + snapshot_interval: Integer + } + + class Raft < Docker::Internal::Type::BaseModel + attr_reader election_tick: Integer? + + def election_tick=: (Integer) -> Integer + + attr_reader heartbeat_tick: Integer? + + def heartbeat_tick=: (Integer) -> Integer + + attr_reader keep_old_snapshots: Integer? + + def keep_old_snapshots=: (Integer) -> Integer + + attr_reader log_entries_for_slow_followers: Integer? + + def log_entries_for_slow_followers=: (Integer) -> Integer + + attr_reader snapshot_interval: Integer? + + def snapshot_interval=: (Integer) -> Integer + + def initialize: ( + ?election_tick: Integer, + ?heartbeat_tick: Integer, + ?keep_old_snapshots: Integer, + ?log_entries_for_slow_followers: Integer, + ?snapshot_interval: Integer + ) -> void + + def to_hash: -> { + election_tick: Integer, + heartbeat_tick: Integer, + keep_old_snapshots: Integer, + log_entries_for_slow_followers: Integer, + snapshot_interval: Integer + } + end + + type task_defaults = + { + log_driver: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver + } + + class TaskDefaults < Docker::Internal::Type::BaseModel + attr_reader log_driver: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver? + + def log_driver=: ( + Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver + ) -> Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver + + def initialize: ( + ?log_driver: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver + ) -> void + + def to_hash: -> { + log_driver: Docker::Models::SystemInfoResponse::Swarm::Cluster::Spec::TaskDefaults::LogDriver + } + + type log_driver = + { name: String, options: ::Hash[Symbol, String] } + + class LogDriver < Docker::Internal::Type::BaseModel + attr_reader name: String? + + def name=: (String) -> String + + attr_reader options: ::Hash[Symbol, String]? + + def options=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + def initialize: ( + ?name: String, + ?options: ::Hash[Symbol, String] + ) -> void + + def to_hash: -> { + name: String, + options: ::Hash[Symbol, String] + } + end + end + end + + type tls_info = + { + cert_issuer_public_key: String, + cert_issuer_subject: String, + trust_root: String + } + + class TlsInfo < Docker::Internal::Type::BaseModel + attr_reader cert_issuer_public_key: String? + + def cert_issuer_public_key=: (String) -> String + + attr_reader cert_issuer_subject: String? + + def cert_issuer_subject=: (String) -> String + + attr_reader trust_root: String? + + def trust_root=: (String) -> String + + def initialize: ( + ?cert_issuer_public_key: String, + ?cert_issuer_subject: String, + ?trust_root: String + ) -> void + + def to_hash: -> { + cert_issuer_public_key: String, + cert_issuer_subject: String, + trust_root: String + } + end + + type version = { index: Integer } + + class Version < Docker::Internal::Type::BaseModel + attr_reader index: Integer? + + def index=: (Integer) -> Integer + + def initialize: (?index: Integer) -> void + + def to_hash: -> { index: Integer } + end + end + + type local_node_state = + :"" | :inactive | :pending | :active | :error | :locked + + module LocalNodeState + extend Docker::Internal::Type::Enum + + EMPTY: :"" + INACTIVE: :inactive + PENDING: :pending + ACTIVE: :active + ERROR: :error + LOCKED: :locked + + def self?.values: -> ::Array[Docker::Models::SystemInfoResponse::Swarm::local_node_state] + end + + type remote_manager = { addr: String, node_id: String } + + class RemoteManager < Docker::Internal::Type::BaseModel + attr_reader addr: String? + + def addr=: (String) -> String + + attr_reader node_id: String? + + def node_id=: (String) -> String + + def initialize: (?addr: String, ?node_id: String) -> void + + def to_hash: -> { addr: String, node_id: String } + end + end + end + end +end diff --git a/sig/docker/models/system_ping_params.rbs b/sig/docker/models/system_ping_params.rbs new file mode 100644 index 0000000..4b40a5c --- /dev/null +++ b/sig/docker/models/system_ping_params.rbs @@ -0,0 +1,14 @@ +module Docker + module Models + type system_ping_params = { } & Docker::Internal::Type::request_parameters + + class SystemPingParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + def initialize: (?request_options: Docker::request_opts) -> void + + def to_hash: -> { request_options: Docker::RequestOptions } + end + end +end diff --git a/sig/docker/models/system_ping_response.rbs b/sig/docker/models/system_ping_response.rbs new file mode 100644 index 0000000..27448d5 --- /dev/null +++ b/sig/docker/models/system_ping_response.rbs @@ -0,0 +1,5 @@ +module Docker + module Models + class SystemPingResponse = String + end +end diff --git a/sig/docker/models/system_version_params.rbs b/sig/docker/models/system_version_params.rbs new file mode 100644 index 0000000..0f12645 --- /dev/null +++ b/sig/docker/models/system_version_params.rbs @@ -0,0 +1,15 @@ +module Docker + module Models + type system_version_params = + { } & Docker::Internal::Type::request_parameters + + class SystemVersionParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + def initialize: (?request_options: Docker::request_opts) -> void + + def to_hash: -> { request_options: Docker::RequestOptions } + end + end +end diff --git a/sig/docker/models/system_version_response.rbs b/sig/docker/models/system_version_response.rbs new file mode 100644 index 0000000..8f960cb --- /dev/null +++ b/sig/docker/models/system_version_response.rbs @@ -0,0 +1,127 @@ +module Docker + module Models + type system_version_response = + { + api_version: String, + arch: String, + build_time: String, + components: ::Array[Docker::Models::SystemVersionResponse::Component], + experimental: bool, + git_commit: String, + go_version: String, + kernel_version: String, + min_api_version: String, + os: String, + platform: Docker::Models::SystemVersionResponse::Platform, + version: String + } + + class SystemVersionResponse < Docker::Internal::Type::BaseModel + attr_reader api_version: String? + + def api_version=: (String) -> String + + attr_reader arch: String? + + def arch=: (String) -> String + + attr_reader build_time: String? + + def build_time=: (String) -> String + + attr_reader components: ::Array[Docker::Models::SystemVersionResponse::Component]? + + def components=: ( + ::Array[Docker::Models::SystemVersionResponse::Component] + ) -> ::Array[Docker::Models::SystemVersionResponse::Component] + + attr_reader experimental: bool? + + def experimental=: (bool) -> bool + + attr_reader git_commit: String? + + def git_commit=: (String) -> String + + attr_reader go_version: String? + + def go_version=: (String) -> String + + attr_reader kernel_version: String? + + def kernel_version=: (String) -> String + + attr_reader min_api_version: String? + + def min_api_version=: (String) -> String + + attr_reader os: String? + + def os=: (String) -> String + + attr_reader platform: Docker::Models::SystemVersionResponse::Platform? + + def platform=: ( + Docker::Models::SystemVersionResponse::Platform + ) -> Docker::Models::SystemVersionResponse::Platform + + attr_reader version: String? + + def version=: (String) -> String + + def initialize: ( + ?api_version: String, + ?arch: String, + ?build_time: String, + ?components: ::Array[Docker::Models::SystemVersionResponse::Component], + ?experimental: bool, + ?git_commit: String, + ?go_version: String, + ?kernel_version: String, + ?min_api_version: String, + ?os: String, + ?platform: Docker::Models::SystemVersionResponse::Platform, + ?version: String + ) -> void + + def to_hash: -> { + api_version: String, + arch: String, + build_time: String, + components: ::Array[Docker::Models::SystemVersionResponse::Component], + experimental: bool, + git_commit: String, + go_version: String, + kernel_version: String, + min_api_version: String, + os: String, + platform: Docker::Models::SystemVersionResponse::Platform, + version: String + } + + type component = { name: String, version: String, details: top? } + + class Component < Docker::Internal::Type::BaseModel + attr_accessor name: String + + attr_accessor version: String + + attr_accessor details: top? + + def initialize: (name: String, version: String, ?details: top?) -> void + + def to_hash: -> { name: String, version: String, details: top? } + end + + type platform = { name: String } + + class Platform < Docker::Internal::Type::BaseModel + attr_accessor name: String + + def initialize: (name: String) -> void + + def to_hash: -> { name: String } + end + end + end +end diff --git a/sig/docker/models/volume.rbs b/sig/docker/models/volume.rbs new file mode 100644 index 0000000..2602471 --- /dev/null +++ b/sig/docker/models/volume.rbs @@ -0,0 +1,478 @@ +module Docker + module Models + type volume = + { + driver: String, + labels: ::Hash[Symbol, String], + mountpoint: String, + name: String, + options: ::Hash[Symbol, String], + scope: Docker::Models::Volume::scope, + cluster_volume: Docker::Volume::ClusterVolume, + created_at: String, + status: ::Hash[Symbol, top], + usage_data: Docker::Volume::UsageData? + } + + class Volume < Docker::Internal::Type::BaseModel + attr_accessor driver: String + + attr_accessor labels: ::Hash[Symbol, String] + + attr_accessor mountpoint: String + + attr_accessor name: String + + attr_accessor options: ::Hash[Symbol, String] + + attr_accessor scope: Docker::Models::Volume::scope + + attr_reader cluster_volume: Docker::Volume::ClusterVolume? + + def cluster_volume=: ( + Docker::Volume::ClusterVolume + ) -> Docker::Volume::ClusterVolume + + attr_reader created_at: String? + + def created_at=: (String) -> String + + attr_reader status: ::Hash[Symbol, top]? + + def status=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_accessor usage_data: Docker::Volume::UsageData? + + def initialize: ( + driver: String, + labels: ::Hash[Symbol, String], + mountpoint: String, + name: String, + options: ::Hash[Symbol, String], + scope: Docker::Models::Volume::scope, + ?cluster_volume: Docker::Volume::ClusterVolume, + ?created_at: String, + ?status: ::Hash[Symbol, top], + ?usage_data: Docker::Volume::UsageData? + ) -> void + + def to_hash: -> { + driver: String, + labels: ::Hash[Symbol, String], + mountpoint: String, + name: String, + options: ::Hash[Symbol, String], + scope: Docker::Models::Volume::scope, + cluster_volume: Docker::Volume::ClusterVolume, + created_at: String, + status: ::Hash[Symbol, top], + usage_data: Docker::Volume::UsageData? + } + + type scope = :local | :global + + module Scope + extend Docker::Internal::Type::Enum + + LOCAL: :local + GLOBAL: :global + + def self?.values: -> ::Array[Docker::Models::Volume::scope] + end + + type cluster_volume = + { + created_at: String, + id: String, + info: Docker::Volume::ClusterVolume::Info, + publish_status: ::Array[Docker::Volume::ClusterVolume::PublishStatus], + spec: Docker::Volume::ClusterVolume::Spec, + updated_at: String, + version: Docker::Volume::ClusterVolume::Version + } + + class ClusterVolume < Docker::Internal::Type::BaseModel + attr_reader created_at: String? + + def created_at=: (String) -> String + + attr_reader id: String? + + def id=: (String) -> String + + attr_reader info: Docker::Volume::ClusterVolume::Info? + + def info=: ( + Docker::Volume::ClusterVolume::Info + ) -> Docker::Volume::ClusterVolume::Info + + attr_reader publish_status: ::Array[Docker::Volume::ClusterVolume::PublishStatus]? + + def publish_status=: ( + ::Array[Docker::Volume::ClusterVolume::PublishStatus] + ) -> ::Array[Docker::Volume::ClusterVolume::PublishStatus] + + attr_reader spec: Docker::Volume::ClusterVolume::Spec? + + def spec=: ( + Docker::Volume::ClusterVolume::Spec + ) -> Docker::Volume::ClusterVolume::Spec + + attr_reader updated_at: String? + + def updated_at=: (String) -> String + + attr_reader version: Docker::Volume::ClusterVolume::Version? + + def version=: ( + Docker::Volume::ClusterVolume::Version + ) -> Docker::Volume::ClusterVolume::Version + + def initialize: ( + ?created_at: String, + ?id: String, + ?info: Docker::Volume::ClusterVolume::Info, + ?publish_status: ::Array[Docker::Volume::ClusterVolume::PublishStatus], + ?spec: Docker::Volume::ClusterVolume::Spec, + ?updated_at: String, + ?version: Docker::Volume::ClusterVolume::Version + ) -> void + + def to_hash: -> { + created_at: String, + id: String, + info: Docker::Volume::ClusterVolume::Info, + publish_status: ::Array[Docker::Volume::ClusterVolume::PublishStatus], + spec: Docker::Volume::ClusterVolume::Spec, + updated_at: String, + version: Docker::Volume::ClusterVolume::Version + } + + type info = + { + accessible_topology: ::Array[::Hash[Symbol, String]], + capacity_bytes: Integer, + volume_context: ::Hash[Symbol, String], + volume_id: String + } + + class Info < Docker::Internal::Type::BaseModel + attr_reader accessible_topology: ::Array[::Hash[Symbol, String]]? + + def accessible_topology=: ( + ::Array[::Hash[Symbol, String]] + ) -> ::Array[::Hash[Symbol, String]] + + attr_reader capacity_bytes: Integer? + + def capacity_bytes=: (Integer) -> Integer + + attr_reader volume_context: ::Hash[Symbol, String]? + + def volume_context=: ( + ::Hash[Symbol, String] + ) -> ::Hash[Symbol, String] + + attr_reader volume_id: String? + + def volume_id=: (String) -> String + + def initialize: ( + ?accessible_topology: ::Array[::Hash[Symbol, String]], + ?capacity_bytes: Integer, + ?volume_context: ::Hash[Symbol, String], + ?volume_id: String + ) -> void + + def to_hash: -> { + accessible_topology: ::Array[::Hash[Symbol, String]], + capacity_bytes: Integer, + volume_context: ::Hash[Symbol, String], + volume_id: String + } + end + + type publish_status = + { + node_id: String, + publish_context: ::Hash[Symbol, String], + state: Docker::Models::Volume::ClusterVolume::PublishStatus::state + } + + class PublishStatus < Docker::Internal::Type::BaseModel + attr_reader node_id: String? + + def node_id=: (String) -> String + + attr_reader publish_context: ::Hash[Symbol, String]? + + def publish_context=: ( + ::Hash[Symbol, String] + ) -> ::Hash[Symbol, String] + + attr_reader state: Docker::Models::Volume::ClusterVolume::PublishStatus::state? + + def state=: ( + Docker::Models::Volume::ClusterVolume::PublishStatus::state + ) -> Docker::Models::Volume::ClusterVolume::PublishStatus::state + + def initialize: ( + ?node_id: String, + ?publish_context: ::Hash[Symbol, String], + ?state: Docker::Models::Volume::ClusterVolume::PublishStatus::state + ) -> void + + def to_hash: -> { + node_id: String, + publish_context: ::Hash[Symbol, String], + state: Docker::Models::Volume::ClusterVolume::PublishStatus::state + } + + type state = + :"pending-publish" + | :published + | :"pending-node-unpublish" + | :"pending-controller-unpublish" + + module State + extend Docker::Internal::Type::Enum + + PENDING_PUBLISH: :"pending-publish" + PUBLISHED: :published + PENDING_NODE_UNPUBLISH: :"pending-node-unpublish" + PENDING_CONTROLLER_UNPUBLISH: :"pending-controller-unpublish" + + def self?.values: -> ::Array[Docker::Models::Volume::ClusterVolume::PublishStatus::state] + end + end + + type spec = + { + access_mode: Docker::Volume::ClusterVolume::Spec::AccessMode, + group: String + } + + class Spec < Docker::Internal::Type::BaseModel + attr_reader access_mode: Docker::Volume::ClusterVolume::Spec::AccessMode? + + def access_mode=: ( + Docker::Volume::ClusterVolume::Spec::AccessMode + ) -> Docker::Volume::ClusterVolume::Spec::AccessMode + + attr_reader group: String? + + def group=: (String) -> String + + def initialize: ( + ?access_mode: Docker::Volume::ClusterVolume::Spec::AccessMode, + ?group: String + ) -> void + + def to_hash: -> { + access_mode: Docker::Volume::ClusterVolume::Spec::AccessMode, + group: String + } + + type access_mode = + { + accessibility_requirements: Docker::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements, + availability: Docker::Models::Volume::ClusterVolume::Spec::AccessMode::availability, + capacity_range: Docker::Volume::ClusterVolume::Spec::AccessMode::CapacityRange, + mount_volume: top, + scope: Docker::Models::Volume::ClusterVolume::Spec::AccessMode::scope, + secrets: ::Array[Docker::Volume::ClusterVolume::Spec::AccessMode::Secret], + sharing: Docker::Models::Volume::ClusterVolume::Spec::AccessMode::sharing + } + + class AccessMode < Docker::Internal::Type::BaseModel + attr_reader accessibility_requirements: Docker::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements? + + def accessibility_requirements=: ( + Docker::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements + ) -> Docker::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements + + attr_reader availability: Docker::Models::Volume::ClusterVolume::Spec::AccessMode::availability? + + def availability=: ( + Docker::Models::Volume::ClusterVolume::Spec::AccessMode::availability + ) -> Docker::Models::Volume::ClusterVolume::Spec::AccessMode::availability + + attr_reader capacity_range: Docker::Volume::ClusterVolume::Spec::AccessMode::CapacityRange? + + def capacity_range=: ( + Docker::Volume::ClusterVolume::Spec::AccessMode::CapacityRange + ) -> Docker::Volume::ClusterVolume::Spec::AccessMode::CapacityRange + + attr_reader mount_volume: top? + + def mount_volume=: (top) -> top + + attr_reader scope: Docker::Models::Volume::ClusterVolume::Spec::AccessMode::scope? + + def scope=: ( + Docker::Models::Volume::ClusterVolume::Spec::AccessMode::scope + ) -> Docker::Models::Volume::ClusterVolume::Spec::AccessMode::scope + + attr_reader secrets: ::Array[Docker::Volume::ClusterVolume::Spec::AccessMode::Secret]? + + def secrets=: ( + ::Array[Docker::Volume::ClusterVolume::Spec::AccessMode::Secret] + ) -> ::Array[Docker::Volume::ClusterVolume::Spec::AccessMode::Secret] + + attr_reader sharing: Docker::Models::Volume::ClusterVolume::Spec::AccessMode::sharing? + + def sharing=: ( + Docker::Models::Volume::ClusterVolume::Spec::AccessMode::sharing + ) -> Docker::Models::Volume::ClusterVolume::Spec::AccessMode::sharing + + def initialize: ( + ?accessibility_requirements: Docker::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements, + ?availability: Docker::Models::Volume::ClusterVolume::Spec::AccessMode::availability, + ?capacity_range: Docker::Volume::ClusterVolume::Spec::AccessMode::CapacityRange, + ?mount_volume: top, + ?scope: Docker::Models::Volume::ClusterVolume::Spec::AccessMode::scope, + ?secrets: ::Array[Docker::Volume::ClusterVolume::Spec::AccessMode::Secret], + ?sharing: Docker::Models::Volume::ClusterVolume::Spec::AccessMode::sharing + ) -> void + + def to_hash: -> { + accessibility_requirements: Docker::Volume::ClusterVolume::Spec::AccessMode::AccessibilityRequirements, + availability: Docker::Models::Volume::ClusterVolume::Spec::AccessMode::availability, + capacity_range: Docker::Volume::ClusterVolume::Spec::AccessMode::CapacityRange, + mount_volume: top, + scope: Docker::Models::Volume::ClusterVolume::Spec::AccessMode::scope, + secrets: ::Array[Docker::Volume::ClusterVolume::Spec::AccessMode::Secret], + sharing: Docker::Models::Volume::ClusterVolume::Spec::AccessMode::sharing + } + + type accessibility_requirements = + { + preferred: ::Array[::Hash[Symbol, String]], + requisite: ::Array[::Hash[Symbol, String]] + } + + class AccessibilityRequirements < Docker::Internal::Type::BaseModel + attr_reader preferred: ::Array[::Hash[Symbol, String]]? + + def preferred=: ( + ::Array[::Hash[Symbol, String]] + ) -> ::Array[::Hash[Symbol, String]] + + attr_reader requisite: ::Array[::Hash[Symbol, String]]? + + def requisite=: ( + ::Array[::Hash[Symbol, String]] + ) -> ::Array[::Hash[Symbol, String]] + + def initialize: ( + ?preferred: ::Array[::Hash[Symbol, String]], + ?requisite: ::Array[::Hash[Symbol, String]] + ) -> void + + def to_hash: -> { + preferred: ::Array[::Hash[Symbol, String]], + requisite: ::Array[::Hash[Symbol, String]] + } + end + + type availability = :active | :pause | :drain + + module Availability + extend Docker::Internal::Type::Enum + + ACTIVE: :active + PAUSE: :pause + DRAIN: :drain + + def self?.values: -> ::Array[Docker::Models::Volume::ClusterVolume::Spec::AccessMode::availability] + end + + type capacity_range = + { limit_bytes: Integer, required_bytes: Integer } + + class CapacityRange < Docker::Internal::Type::BaseModel + attr_reader limit_bytes: Integer? + + def limit_bytes=: (Integer) -> Integer + + attr_reader required_bytes: Integer? + + def required_bytes=: (Integer) -> Integer + + def initialize: ( + ?limit_bytes: Integer, + ?required_bytes: Integer + ) -> void + + def to_hash: -> { limit_bytes: Integer, required_bytes: Integer } + end + + type scope = :single | :multi + + module Scope + extend Docker::Internal::Type::Enum + + SINGLE: :single + MULTI: :multi + + def self?.values: -> ::Array[Docker::Models::Volume::ClusterVolume::Spec::AccessMode::scope] + end + + type secret = { key: String, secret: String } + + class Secret < Docker::Internal::Type::BaseModel + attr_reader key: String? + + def key=: (String) -> String + + attr_reader secret: String? + + def secret=: (String) -> String + + def initialize: (?key: String, ?secret: String) -> void + + def to_hash: -> { key: String, secret: String } + end + + type sharing = :none | :readonly | :onewriter | :all + + module Sharing + extend Docker::Internal::Type::Enum + + NONE: :none + READONLY: :readonly + ONEWRITER: :onewriter + ALL: :all + + def self?.values: -> ::Array[Docker::Models::Volume::ClusterVolume::Spec::AccessMode::sharing] + end + end + end + + type version = { index: Integer } + + class Version < Docker::Internal::Type::BaseModel + attr_reader index: Integer? + + def index=: (Integer) -> Integer + + def initialize: (?index: Integer) -> void + + def to_hash: -> { index: Integer } + end + end + + type usage_data = { ref_count: Integer, size: Integer } + + class UsageData < Docker::Internal::Type::BaseModel + attr_accessor ref_count: Integer + + attr_accessor size: Integer + + def initialize: (ref_count: Integer, size: Integer) -> void + + def to_hash: -> { ref_count: Integer, size: Integer } + end + end + end +end diff --git a/sig/docker/models/volume_create_params.rbs b/sig/docker/models/volume_create_params.rbs new file mode 100644 index 0000000..2b79fb9 --- /dev/null +++ b/sig/docker/models/volume_create_params.rbs @@ -0,0 +1,15 @@ +module Docker + module Models + type volume_create_params = + { } & Docker::Internal::Type::request_parameters + + class VolumeCreateParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + def initialize: (?request_options: Docker::request_opts) -> void + + def to_hash: -> { request_options: Docker::RequestOptions } + end + end +end diff --git a/sig/docker/models/volume_delete_params.rbs b/sig/docker/models/volume_delete_params.rbs new file mode 100644 index 0000000..0714afc --- /dev/null +++ b/sig/docker/models/volume_delete_params.rbs @@ -0,0 +1,22 @@ +module Docker + module Models + type volume_delete_params = + { force: bool } & Docker::Internal::Type::request_parameters + + class VolumeDeleteParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader force: bool? + + def force=: (bool) -> bool + + def initialize: ( + ?force: bool, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { force: bool, request_options: Docker::RequestOptions } + end + end +end diff --git a/sig/docker/models/volume_inspect_params.rbs b/sig/docker/models/volume_inspect_params.rbs new file mode 100644 index 0000000..62bf373 --- /dev/null +++ b/sig/docker/models/volume_inspect_params.rbs @@ -0,0 +1,15 @@ +module Docker + module Models + type volume_inspect_params = + { } & Docker::Internal::Type::request_parameters + + class VolumeInspectParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + def initialize: (?request_options: Docker::request_opts) -> void + + def to_hash: -> { request_options: Docker::RequestOptions } + end + end +end diff --git a/sig/docker/models/volume_list_params.rbs b/sig/docker/models/volume_list_params.rbs new file mode 100644 index 0000000..5752ddc --- /dev/null +++ b/sig/docker/models/volume_list_params.rbs @@ -0,0 +1,25 @@ +module Docker + module Models + type volume_list_params = + { filters: String } & Docker::Internal::Type::request_parameters + + class VolumeListParams < Docker::Internal::Type::BaseModel + extend Docker::Internal::Type::RequestParameters::Converter + include Docker::Internal::Type::RequestParameters + + attr_reader filters: String? + + def filters=: (String) -> String + + def initialize: ( + ?filters: String, + ?request_options: Docker::request_opts + ) -> void + + def to_hash: -> { + filters: String, + request_options: Docker::RequestOptions + } + end + end +end diff --git a/sig/docker/models/volume_list_response.rbs b/sig/docker/models/volume_list_response.rbs new file mode 100644 index 0000000..aa28110 --- /dev/null +++ b/sig/docker/models/volume_list_response.rbs @@ -0,0 +1,26 @@ +module Docker + module Models + type volume_list_response = + { volumes: ::Array[Docker::Volume], warnings: ::Array[String] } + + class VolumeListResponse < Docker::Internal::Type::BaseModel + attr_reader volumes: ::Array[Docker::Volume]? + + def volumes=: (::Array[Docker::Volume]) -> ::Array[Docker::Volume] + + attr_reader warnings: ::Array[String]? + + def warnings=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?volumes: ::Array[Docker::Volume], + ?warnings: ::Array[String] + ) -> void + + def to_hash: -> { + volumes: ::Array[Docker::Volume], + warnings: ::Array[String] + } + end + end +end diff --git a/sig/docker/request_options.rbs b/sig/docker/request_options.rbs new file mode 100644 index 0000000..419020e --- /dev/null +++ b/sig/docker/request_options.rbs @@ -0,0 +1,34 @@ +module Docker + type request_opts = + Docker::RequestOptions | Docker::request_options | ::Hash[Symbol, top] + + type request_options = + { + idempotency_key: String?, + extra_query: ::Hash[String, (::Array[String] | String)?]?, + extra_headers: ::Hash[String, String?]?, + extra_body: top?, + max_retries: Integer?, + timeout: Float? + } + + class RequestOptions < Docker::Internal::Type::BaseModel + def self.validate!: (Docker::request_opts opts) -> void + + attr_accessor idempotency_key: String? + + attr_accessor extra_query: ::Hash[String, (::Array[String] | String)?]? + + attr_accessor extra_headers: ::Hash[String, String?]? + + attr_accessor extra_body: top? + + attr_accessor max_retries: Integer? + + attr_accessor timeout: Float? + + def initialize: ( + ?Docker::request_options | ::Hash[Symbol, top] values + ) -> void + end +end diff --git a/sig/docker/resources/auth.rbs b/sig/docker/resources/auth.rbs new file mode 100644 index 0000000..53bd191 --- /dev/null +++ b/sig/docker/resources/auth.rbs @@ -0,0 +1,14 @@ +module Docker + module Resources + class Auth + def login: ( + ?password: String, + ?serveraddress: String, + ?username: String, + ?request_options: Docker::request_opts + ) -> Docker::AuthResponse + + def initialize: (client: Docker::Client) -> void + end + end +end diff --git a/sig/docker/resources/containers.rbs b/sig/docker/resources/containers.rbs new file mode 100644 index 0000000..62a0cd1 --- /dev/null +++ b/sig/docker/resources/containers.rbs @@ -0,0 +1,67 @@ +module Docker + module Resources + class Containers + def create: ( + config: Docker::ContainerCreateParams::Config, + ?name: String, + ?platform: String, + ?request_options: Docker::request_opts + ) -> Docker::CreateResponse + + def list: ( + ?all: bool, + ?filters: String, + ?limit: Integer, + ?size: bool, + ?request_options: Docker::request_opts + ) -> Docker::Models::container_list_response + + def delete: ( + String id, + ?force: bool, + ?link: bool, + ?v: bool, + ?request_options: Docker::request_opts + ) -> nil + + def inspect_: ( + String id, + ?size: bool, + ?request_options: Docker::request_opts + ) -> Docker::Container + + def kill: ( + String id, + ?signal: String, + ?request_options: Docker::request_opts + ) -> nil + + def logs: ( + String id, + ?follow: bool, + ?since: Integer, + ?stderr: bool, + ?stdout: bool, + ?tail: String, + ?timestamps: bool, + ?until_: Integer, + ?request_options: Docker::request_opts + ) -> StringIO + + def start: ( + String id, + ?detach_keys: String, + ?request_options: Docker::request_opts + ) -> nil + + def stop: ( + String id, + ?signal: String, + ?t: Integer, + ?request_options: Docker::request_opts + ) -> nil + + def initialize: (client: Docker::Client) -> void + end + end +end diff --git a/sig/docker/resources/images.rbs b/sig/docker/resources/images.rbs new file mode 100644 index 0000000..d1fe674 --- /dev/null +++ b/sig/docker/resources/images.rbs @@ -0,0 +1,43 @@ +module Docker + module Resources + class Images + def list: ( + ?all: bool, + ?digests: bool, + ?filters: String, + ?manifests: bool, + ?shared_size: bool, + ?request_options: Docker::request_opts + ) -> Docker::Models::image_list_response + + def delete: ( + String name, + ?force: bool, + ?noprune: bool, + ?platforms: ::Array[String], + ?request_options: Docker::request_opts + ) -> Docker::Models::image_delete_response + + def inspect_: ( + String name, + ?manifests: bool, + ?request_options: Docker::request_opts + ) -> Docker::Image + + def pull: ( + ?changes: ::Array[String], + ?from_image: String, + ?from_src: String, + ?message: String, + ?platform: String, + ?repo: String, + ?tag: String, + ?body: String, + ?x_registry_auth: String, + ?request_options: Docker::request_opts + ) -> nil + + def initialize: (client: Docker::Client) -> void + end + end +end diff --git a/sig/docker/resources/networks.rbs b/sig/docker/resources/networks.rbs new file mode 100644 index 0000000..2b2d32c --- /dev/null +++ b/sig/docker/resources/networks.rbs @@ -0,0 +1,38 @@ +module Docker + module Resources + class Networks + def create: ( + name: String, + ?attachable: bool, + ?config_from: Docker::NetworkCreateParams::ConfigFrom, + ?config_only: bool, + ?driver: String, + ?enable_i_pv4: bool, + ?enable_i_pv6: bool, + ?ingress: bool, + ?internal: bool, + ?ipam: Docker::NetworkCreateParams::Ipam, + ?labels: ::Hash[Symbol, String], + ?options: ::Hash[Symbol, String], + ?scope: String, + ?request_options: Docker::request_opts + ) -> Docker::Models::NetworkCreateResponse + + def list: ( + ?filters: String, + ?request_options: Docker::request_opts + ) -> Docker::Models::network_list_response + + def delete: (String id, ?request_options: Docker::request_opts) -> nil + + def inspect_: ( + String id, + ?scope: String, + ?verbose: bool, + ?request_options: Docker::request_opts + ) -> Docker::Models::NetworkInspectResponse + + def initialize: (client: Docker::Client) -> void + end + end +end diff --git a/sig/docker/resources/services.rbs b/sig/docker/resources/services.rbs new file mode 100644 index 0000000..8ac57d1 --- /dev/null +++ b/sig/docker/resources/services.rbs @@ -0,0 +1,27 @@ +module Docker + module Resources + class Services + def create: ( + spec: Docker::ServiceCreateParams::Spec, + ?x_registry_auth: String, + ?request_options: Docker::request_opts + ) -> Docker::Models::ServiceCreateResponse + + def list: ( + ?filters: String, + ?status: bool, + ?request_options: Docker::request_opts + ) -> Docker::Models::service_list_response + + def delete: (String id, ?request_options: Docker::request_opts) -> nil + + def inspect_: ( + String id, + ?insert_defaults: bool, + ?request_options: Docker::request_opts + ) -> Docker::Service + + def initialize: (client: Docker::Client) -> void + end + end +end diff --git a/sig/docker/resources/system.rbs b/sig/docker/resources/system.rbs new file mode 100644 index 0000000..4f7c5e8 --- /dev/null +++ b/sig/docker/resources/system.rbs @@ -0,0 +1,17 @@ +module Docker + module Resources + class System + def info: ( + ?request_options: Docker::request_opts + ) -> Docker::Models::SystemInfoResponse + + def ping: (?request_options: Docker::request_opts) -> String + + def version: ( + ?request_options: Docker::request_opts + ) -> Docker::Models::SystemVersionResponse + + def initialize: (client: Docker::Client) -> void + end + end +end diff --git a/sig/docker/resources/volumes.rbs b/sig/docker/resources/volumes.rbs new file mode 100644 index 0000000..18afe49 --- /dev/null +++ b/sig/docker/resources/volumes.rbs @@ -0,0 +1,28 @@ +module Docker + module Resources + class Volumes + def create: ( + create_request: Docker::CreateRequest, + ?request_options: Docker::request_opts + ) -> Docker::Volume + + def list: ( + ?filters: String, + ?request_options: Docker::request_opts + ) -> Docker::Models::VolumeListResponse + + def delete: ( + String name, + ?force: bool, + ?request_options: Docker::request_opts + ) -> nil + + def inspect_: ( + String name, + ?request_options: Docker::request_opts + ) -> Docker::Volume + + def initialize: (client: Docker::Client) -> void + end + end +end diff --git a/sig/docker/version.rbs b/sig/docker/version.rbs new file mode 100644 index 0000000..caa7d12 --- /dev/null +++ b/sig/docker/version.rbs @@ -0,0 +1,3 @@ +module Docker + VERSION: String +end diff --git a/sorbet/config b/sorbet/config new file mode 100644 index 0000000..6fe84ed --- /dev/null +++ b/sorbet/config @@ -0,0 +1,2 @@ +--dir=rbi/ +--ignore=test/ diff --git a/sorbet/rbi/.gitignore b/sorbet/rbi/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/sorbet/rbi/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/test/docker/client_test.rb b/test/docker/client_test.rb new file mode 100644 index 0000000..40fc44d --- /dev/null +++ b/test/docker/client_test.rb @@ -0,0 +1,286 @@ +# frozen_string_literal: true + +require_relative "test_helper" + +class DockerTest < Minitest::Test + extend Minitest::Serial + include WebMock::API + + def before_all + super + WebMock.enable! + end + + def setup + super + Thread.current.thread_variable_set(:mock_sleep, []) + end + + def teardown + Thread.current.thread_variable_set(:mock_sleep, nil) + WebMock.reset! + super + end + + def after_all + WebMock.disable! + super + end + + def test_client_default_request_default_retry_attempts + stub_request(:get, "http://localhost/containers/json").to_return_json(status: 500, body: {}) + + docker = Docker::Client.new(base_url: "http://localhost") + + assert_raises(Docker::Errors::InternalServerError) do + docker.containers.list + end + + assert_requested(:any, /./, times: 3) + end + + def test_client_given_request_default_retry_attempts + stub_request(:get, "http://localhost/containers/json").to_return_json(status: 500, body: {}) + + docker = Docker::Client.new(base_url: "http://localhost", max_retries: 3) + + assert_raises(Docker::Errors::InternalServerError) do + docker.containers.list + end + + assert_requested(:any, /./, times: 4) + end + + def test_client_default_request_given_retry_attempts + stub_request(:get, "http://localhost/containers/json").to_return_json(status: 500, body: {}) + + docker = Docker::Client.new(base_url: "http://localhost") + + assert_raises(Docker::Errors::InternalServerError) do + docker.containers.list(request_options: {max_retries: 3}) + end + + assert_requested(:any, /./, times: 4) + end + + def test_client_given_request_given_retry_attempts + stub_request(:get, "http://localhost/containers/json").to_return_json(status: 500, body: {}) + + docker = Docker::Client.new(base_url: "http://localhost", max_retries: 3) + + assert_raises(Docker::Errors::InternalServerError) do + docker.containers.list(request_options: {max_retries: 4}) + end + + assert_requested(:any, /./, times: 5) + end + + def test_client_retry_after_seconds + stub_request(:get, "http://localhost/containers/json").to_return_json( + status: 500, + headers: {"retry-after" => "1.3"}, + body: {} + ) + + docker = Docker::Client.new(base_url: "http://localhost", max_retries: 1) + + assert_raises(Docker::Errors::InternalServerError) do + docker.containers.list + end + + assert_requested(:any, /./, times: 2) + assert_equal(1.3, Thread.current.thread_variable_get(:mock_sleep).last) + end + + def test_client_retry_after_date + stub_request(:get, "http://localhost/containers/json").to_return_json( + status: 500, + headers: {"retry-after" => (Time.now + 10).httpdate}, + body: {} + ) + + docker = Docker::Client.new(base_url: "http://localhost", max_retries: 1) + + assert_raises(Docker::Errors::InternalServerError) do + Thread.current.thread_variable_set(:time_now, Time.now) + docker.containers.list + Thread.current.thread_variable_set(:time_now, nil) + end + + assert_requested(:any, /./, times: 2) + assert_in_delta(10, Thread.current.thread_variable_get(:mock_sleep).last, 1.0) + end + + def test_client_retry_after_ms + stub_request(:get, "http://localhost/containers/json").to_return_json( + status: 500, + headers: {"retry-after-ms" => "1300"}, + body: {} + ) + + docker = Docker::Client.new(base_url: "http://localhost", max_retries: 1) + + assert_raises(Docker::Errors::InternalServerError) do + docker.containers.list + end + + assert_requested(:any, /./, times: 2) + assert_equal(1.3, Thread.current.thread_variable_get(:mock_sleep).last) + end + + def test_retry_count_header + stub_request(:get, "http://localhost/containers/json").to_return_json(status: 500, body: {}) + + docker = Docker::Client.new(base_url: "http://localhost") + + assert_raises(Docker::Errors::InternalServerError) do + docker.containers.list + end + + 3.times do + assert_requested(:any, /./, headers: {"x-stainless-retry-count" => _1}) + end + end + + def test_omit_retry_count_header + stub_request(:get, "http://localhost/containers/json").to_return_json(status: 500, body: {}) + + docker = Docker::Client.new(base_url: "http://localhost") + + assert_raises(Docker::Errors::InternalServerError) do + docker.containers.list(request_options: {extra_headers: {"x-stainless-retry-count" => nil}}) + end + + assert_requested(:any, /./, times: 3) do + refute_includes(_1.headers.keys.map(&:downcase), "x-stainless-retry-count") + end + end + + def test_overwrite_retry_count_header + stub_request(:get, "http://localhost/containers/json").to_return_json(status: 500, body: {}) + + docker = Docker::Client.new(base_url: "http://localhost") + + assert_raises(Docker::Errors::InternalServerError) do + docker.containers.list(request_options: {extra_headers: {"x-stainless-retry-count" => "42"}}) + end + + assert_requested(:any, /./, headers: {"x-stainless-retry-count" => "42"}, times: 3) + end + + def test_client_redirect_307 + stub_request(:get, "http://localhost/containers/json").to_return_json( + status: 307, + headers: {"location" => "/redirected"}, + body: {} + ) + stub_request(:any, "http://localhost/redirected").to_return( + status: 307, + headers: {"location" => "/redirected"} + ) + + docker = Docker::Client.new(base_url: "http://localhost") + + assert_raises(Docker::Errors::APIConnectionError) do + docker.containers.list(request_options: {extra_headers: {}}) + end + + recorded, = WebMock::RequestRegistry.instance.requested_signatures.hash.first + + assert_requested(:any, "http://localhost/redirected", times: Docker::Client::MAX_REDIRECTS) do + assert_equal(recorded.method, _1.method) + assert_equal(recorded.body, _1.body) + assert_equal( + recorded.headers.transform_keys(&:downcase).fetch("content-type"), + _1.headers.transform_keys(&:downcase).fetch("content-type") + ) + end + end + + def test_client_redirect_303 + stub_request(:get, "http://localhost/containers/json").to_return_json( + status: 303, + headers: {"location" => "/redirected"}, + body: {} + ) + stub_request(:get, "http://localhost/redirected").to_return( + status: 303, + headers: {"location" => "/redirected"} + ) + + docker = Docker::Client.new(base_url: "http://localhost") + + assert_raises(Docker::Errors::APIConnectionError) do + docker.containers.list(request_options: {extra_headers: {}}) + end + + assert_requested(:get, "http://localhost/redirected", times: Docker::Client::MAX_REDIRECTS) do + headers = _1.headers.keys.map(&:downcase) + refute_includes(headers, "content-type") + assert_nil(_1.body) + end + end + + def test_client_redirect_auth_keep_same_origin + stub_request(:get, "http://localhost/containers/json").to_return_json( + status: 307, + headers: {"location" => "/redirected"}, + body: {} + ) + stub_request(:any, "http://localhost/redirected").to_return( + status: 307, + headers: {"location" => "/redirected"} + ) + + docker = Docker::Client.new(base_url: "http://localhost") + + assert_raises(Docker::Errors::APIConnectionError) do + docker.containers.list(request_options: {extra_headers: {"authorization" => "Bearer xyz"}}) + end + + recorded, = WebMock::RequestRegistry.instance.requested_signatures.hash.first + auth_header = recorded.headers.transform_keys(&:downcase).fetch("authorization") + + assert_equal("Bearer xyz", auth_header) + assert_requested(:any, "http://localhost/redirected", times: Docker::Client::MAX_REDIRECTS) do + auth_header = _1.headers.transform_keys(&:downcase).fetch("authorization") + assert_equal("Bearer xyz", auth_header) + end + end + + def test_client_redirect_auth_strip_cross_origin + stub_request(:get, "http://localhost/containers/json").to_return_json( + status: 307, + headers: {"location" => "https://example.com/redirected"}, + body: {} + ) + stub_request(:any, "https://example.com/redirected").to_return( + status: 307, + headers: {"location" => "https://example.com/redirected"} + ) + + docker = Docker::Client.new(base_url: "http://localhost") + + assert_raises(Docker::Errors::APIConnectionError) do + docker.containers.list(request_options: {extra_headers: {"authorization" => "Bearer xyz"}}) + end + + assert_requested(:any, "https://example.com/redirected", times: Docker::Client::MAX_REDIRECTS) do + headers = _1.headers.keys.map(&:downcase) + refute_includes(headers, "authorization") + end + end + + def test_default_headers + stub_request(:get, "http://localhost/containers/json").to_return_json(status: 200, body: {}) + + docker = Docker::Client.new(base_url: "http://localhost") + + docker.containers.list + + assert_requested(:any, /./) do |req| + headers = req.headers.transform_keys(&:downcase).fetch_values("accept", "content-type") + headers.each { refute_empty(_1) } + end + end +end diff --git a/test/docker/file_part_test.rb b/test/docker/file_part_test.rb new file mode 100644 index 0000000..7e27a5e --- /dev/null +++ b/test/docker/file_part_test.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require_relative "test_helper" + +class Docker::Test::FilePartTest < Minitest::Test + def test_to_json + text = "gray" + filepart = Docker::FilePart.new(StringIO.new(text)) + + assert_equal(text.to_json, filepart.to_json) + assert_equal(text.to_yaml, filepart.to_yaml) + end +end diff --git a/test/docker/internal/sorbet_runtime_support_test.rb b/test/docker/internal/sorbet_runtime_support_test.rb new file mode 100644 index 0000000..c6626b0 --- /dev/null +++ b/test/docker/internal/sorbet_runtime_support_test.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Docker::Test::SorbetRuntimeSupportTest < Minitest::Test + extend Minitest::Serial + + i_suck_and_my_tests_are_order_dependent! + + module E + extend Docker::Internal::Type::Enum + + define_sorbet_constant!(:TaggedSymbol) { 1 } + end + + module U + extend Docker::Internal::Type::Union + + define_sorbet_constant!(:Variants) { 2 } + end + + class M < Docker::Internal::Type::BaseModel + define_sorbet_constant!(:OrHash) { 3 } + end + + def test_nil_aliases + err = Docker::Internal::Util::SorbetRuntimeSupport::MissingSorbetRuntimeError + + assert_raises(err) { Docker::Internal::AnyHash } + assert_raises(err) { Docker::Internal::FileInput } + assert_raises(err) { Docker::Internal::Type::Converter::Input } + assert_raises(err) { Docker::Internal::Type::Converter::CoerceState } + assert_raises(err) { Docker::Internal::Type::Converter::DumpState } + assert_raises(err) { Docker::Internal::Type::BaseModel::KnownField } + assert_raises(err) { Docker::Internal::Util::ParsedUri } + assert_raises(err) { Docker::Internal::Util::ServerSentEvent } + assert_raises(err) { Docker::Internal::Transport::BaseClient::RequestComponents } + assert_raises(err) { Docker::Internal::Transport::BaseClient::RequestInput } + assert_raises(err) { Docker::Internal::Transport::PooledNetRequester::Request } + assert_raises(err) { E::TaggedSymbol } + assert_raises(err) { U::Variants } + assert_raises(err) { M::OrHash } + end + + def test_stubbed_aliases + Kernel.instance_eval { const_set(:T, nil) } + + assert_equal(1, E::TaggedSymbol) + assert_equal(2, U::Variants) + assert_equal(3, M::OrHash) + end +end diff --git a/test/docker/internal/type/base_model_test.rb b/test/docker/internal/type/base_model_test.rb new file mode 100644 index 0000000..6282243 --- /dev/null +++ b/test/docker/internal/type/base_model_test.rb @@ -0,0 +1,727 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class Docker::Test::PrimitiveModelTest < Minitest::Test + A = Docker::Internal::Type::ArrayOf[-> { Integer }] + H = Docker::Internal::Type::HashOf[-> { Integer }, nil?: true] + + module E + extend Docker::Internal::Type::Enum + end + + module U + extend Docker::Internal::Type::Union + end + + class B < Docker::Internal::Type::BaseModel + optional :a, Integer + optional :b, B + end + + def test_typing + converters = [ + Docker::Internal::Type::Unknown, + Docker::Internal::Type::Boolean, + A, + H, + E, + U, + B + ] + + converters.each do |conv| + assert_pattern do + conv => Docker::Internal::Type::Converter + end + end + end + + def test_coerce + cases = { + [Docker::Internal::Type::Unknown, :a] => [{yes: 1}, :a], + [NilClass, :a] => [{maybe: 1}, nil], + [NilClass, nil] => [{yes: 1}, nil], + [Docker::Internal::Type::Boolean, true] => [{yes: 1}, true], + [Docker::Internal::Type::Boolean, "true"] => [{no: 1}, "true"], + [Integer, 1] => [{yes: 1}, 1], + [Integer, 1.0] => [{maybe: 1}, 1], + [Integer, "1"] => [{maybe: 1}, 1], + [Integer, "one"] => [{no: 1}, "one"], + [Float, 1] => [{yes: 1}, 1.0], + [Float, "1"] => [{maybe: 1}, 1.0], + [Float, :one] => [{no: 1}, :one], + [String, :str] => [{yes: 1}, "str"], + [String, "str"] => [{yes: 1}, "str"], + [String, 1] => [{maybe: 1}, "1"], + [:a, "a"] => [{yes: 1}, :a], + [Date, "1990-09-19"] => [{yes: 1}, Date.new(1990, 9, 19)], + [Date, Date.new(1990, 9, 19)] => [{yes: 1}, Date.new(1990, 9, 19)], + [Date, "one"] => [{no: 1}, "one"], + [Time, "1990-09-19"] => [{yes: 1}, Time.new(1990, 9, 19)], + [Time, Time.new(1990, 9, 19)] => [{yes: 1}, Time.new(1990, 9, 19)], + [Time, "one"] => [{no: 1}, "one"] + } + + cases.each do |lhs, rhs| + target, input = lhs + exactness, expect = rhs + state = Docker::Internal::Type::Converter.new_coerce_state + assert_pattern do + Docker::Internal::Type::Converter.coerce(target, input, state: state) => ^expect + state.fetch(:exactness).filter { _2.nonzero? }.to_h => ^exactness + end + end + end + + def test_dump + cases = { + [Docker::Internal::Type::Unknown, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [A, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [H, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [E, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [U, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [B, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [String, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [:b, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [nil, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [Docker::Internal::Type::Boolean, true] => true, + [Docker::Internal::Type::Boolean, "true"] => "true", + [Integer, "1"] => "1", + [Float, 1] => 1, + [String, "one"] => "one", + [String, :one] => :one, + [:a, :b] => :b, + [:a, "a"] => "a", + [String, StringIO.new("one")] => "one", + [String, Pathname(__FILE__)] => Docker::FilePart + } + + cases.each do + target, input = _1 + expect = _2 + assert_pattern do + Docker::Internal::Type::Converter.dump(target, input) => ^expect + end + end + end + + def test_coerce_errors + cases = { + [Integer, "one"] => ArgumentError, + [Float, "one"] => ArgumentError, + [String, Time] => TypeError, + [Date, "one"] => ArgumentError, + [Time, "one"] => ArgumentError + } + + cases.each do |testcase, expect| + target, input = testcase + state = Docker::Internal::Type::Converter.new_coerce_state + Docker::Internal::Type::Converter.coerce(target, input, state: state) + assert_pattern do + state => {error: ^expect} + end + end + end + + def test_dump_retry + types = [ + Docker::Internal::Type::Unknown, + Docker::Internal::Type::Boolean, + A, + H, + E, + U, + B + ] + Pathname(__FILE__).open do |fd| + cases = [ + fd, + [fd], + {a: fd}, + {a: {b: fd}} + ] + types.product(cases).each do |target, input| + state = {can_retry: true} + Docker::Internal::Type::Converter.dump(target, input, state: state) + + assert_pattern do + state => {can_retry: false} + end + end + end + end +end + +class Docker::Test::EnumModelTest < Minitest::Test + class E0 + include Docker::Internal::Type::Enum + + attr_reader :values + + def initialize(*values) = (@values = values) + end + + module E1 + extend Docker::Internal::Type::Enum + + TRUE = true + end + + module E2 + extend Docker::Internal::Type::Enum + + ONE = 1 + TWO = 2 + end + + module E3 + extend Docker::Internal::Type::Enum + + ONE = 1.0 + TWO = 2.0 + end + + module E4 + extend Docker::Internal::Type::Enum + + ONE = :one + TWO = :two + end + + def test_coerce + cases = { + [E0.new, "one"] => [{no: 1}, "one"], + [E0.new(:one), "one"] => [{yes: 1}, :one], + [E0.new(:two), "one"] => [{maybe: 1}, "one"], + + [E1, true] => [{yes: 1}, true], + [E1, false] => [{no: 1}, false], + [E1, :true] => [{no: 1}, :true], + + [E2, 1] => [{yes: 1}, 1], + [E2, 1.0] => [{yes: 1}, 1], + [E2, 1.2] => [{no: 1}, 1.2], + [E2, "1"] => [{no: 1}, "1"], + + [E3, 1.0] => [{yes: 1}, 1.0], + [E3, 1] => [{yes: 1}, 1.0], + [E3, "one"] => [{no: 1}, "one"], + + [E4, :one] => [{yes: 1}, :one], + [E4, "one"] => [{yes: 1}, :one], + [E4, "1"] => [{maybe: 1}, "1"], + [E4, :"1"] => [{maybe: 1}, :"1"], + [E4, 1] => [{no: 1}, 1] + } + + cases.each do |lhs, rhs| + target, input = lhs + exactness, expect = rhs + state = Docker::Internal::Type::Converter.new_coerce_state + assert_pattern do + Docker::Internal::Type::Converter.coerce(target, input, state: state) => ^expect + state.fetch(:exactness).filter { _2.nonzero? }.to_h => ^exactness + end + end + end + + def test_dump + cases = { + [E1, true] => true, + [E1, "true"] => "true", + + [E2, 1.0] => 1.0, + [E2, 3] => 3, + [E2, "1.0"] => "1.0", + + [E3, 1.0] => 1.0, + [E3, 3] => 3, + [E3, "1.0"] => "1.0", + + [E4, :one] => :one, + [E4, "one"] => "one", + [E4, "1.0"] => "1.0" + } + + cases.each do + target, input = _1 + expect = _2 + assert_pattern do + Docker::Internal::Type::Converter.dump(target, input) => ^expect + end + end + end +end + +class Docker::Test::CollectionModelTest < Minitest::Test + A1 = Docker::Internal::Type::ArrayOf[-> { Integer }] + H1 = Docker::Internal::Type::HashOf[Integer] + + A2 = Docker::Internal::Type::ArrayOf[H1] + H2 = Docker::Internal::Type::HashOf[-> { A1 }] + + A3 = Docker::Internal::Type::ArrayOf[Integer, nil?: true] + H3 = Docker::Internal::Type::HashOf[Integer, nil?: true] + + def test_coerce + cases = { + [A1, []] => [{yes: 1}, []], + [A1, {}] => [{no: 1}, {}], + [A1, [1, 2.0]] => [{yes: 2, maybe: 1}, [1, 2]], + [A1, ["1", 2.0]] => [{yes: 1, maybe: 2}, [1, 2]], + [H1, {}] => [{yes: 1}, {}], + [H1, []] => [{no: 1}, []], + [H1, {a: 1, b: 2}] => [{yes: 3}, {a: 1, b: 2}], + [H1, {"a" => 1, "b" => 2}] => [{yes: 3}, {a: 1, b: 2}], + [H1, {[] => 1}] => [{yes: 2, no: 1}, {[] => 1}], + [H1, {a: 1.5}] => [{yes: 1, maybe: 1}, {a: 1}], + + [A2, [{}, {"a" => 1}]] => [{yes: 4}, [{}, {a: 1}]], + [A2, [{"a" => "1"}]] => [{yes: 2, maybe: 1}, [{a: 1}]], + [H2, {a: [1, 2]}] => [{yes: 4}, {a: [1, 2]}], + [H2, {"a" => ["1", 2]}] => [{yes: 3, maybe: 1}, {a: [1, 2]}], + [H2, {"a" => ["one", 2]}] => [{yes: 3, no: 1}, {a: ["one", 2]}], + + [A3, [nil, 1]] => [{yes: 3}, [nil, 1]], + [A3, [nil, "1"]] => [{yes: 2, maybe: 1}, [nil, 1]], + [H3, {a: nil, b: "1"}] => [{yes: 2, maybe: 1}, {a: nil, b: 1}], + [H3, {a: nil}] => [{yes: 2}, {a: nil}] + } + + cases.each do |lhs, rhs| + target, input = lhs + exactness, expect = rhs + state = Docker::Internal::Type::Converter.new_coerce_state + assert_pattern do + Docker::Internal::Type::Converter.coerce(target, input, state: state) => ^expect + state.fetch(:exactness).filter { _2.nonzero? }.to_h => ^exactness + end + end + end +end + +class Docker::Test::BaseModelTest < Minitest::Test + class M1 < Docker::Internal::Type::BaseModel + required :a, Integer + end + + class M2 < M1 + required :a, Time + required :b, Integer, nil?: true + optional :c, String + end + + class M3 < Docker::Internal::Type::BaseModel + optional :c, const: :c + required :d, const: :d + end + + class M4 < M1 + request_only do + required :a, Integer + optional :b, String + end + + response_only do + required :c, Integer + optional :d, String + end + end + + class M5 < Docker::Internal::Type::BaseModel + request_only do + required :c, const: :c + end + + response_only do + required :d, const: :d + end + end + + class M6 < M1 + required :a, Docker::Internal::Type::ArrayOf[M6] + optional :b, M6 + end + + def test_coerce + cases = { + [M1, {}] => [{yes: 1, no: 1}, {}], + [M1, :m1] => [{no: 1}, :m1], + + [M2, {}] => [{yes: 2, no: 1, maybe: 1}, {}], + [M2, {a: "1990-09-19", b: nil}] => [{yes: 4}, {a: "1990-09-19", b: nil}], + [M2, {a: "1990-09-19", b: "1"}] => [{yes: 3, maybe: 1}, {a: "1990-09-19", b: "1"}], + [M2, {a: "1990-09-19"}] => [{yes: 3, maybe: 1}, {a: "1990-09-19"}], + [M2, {a: "1990-09-19", c: nil}] => [{yes: 2, maybe: 2}, {a: "1990-09-19", c: nil}], + + [M3, {c: "c", d: "d"}] => [{yes: 3}, {c: :c, d: :d}], + [M3, {c: "d", d: "c"}] => [{yes: 1, maybe: 2}, {c: "d", d: "c"}], + + [M4, {c: 2}] => [{yes: 5}, {c: 2}], + [M4, {a: "1", c: 2}] => [{yes: 4, maybe: 1}, {a: "1", c: 2}], + [M4, {b: nil, c: 2}] => [{yes: 4, maybe: 1}, {b: nil, c: 2}], + + [M5, {}] => [{yes: 3}, {}], + [M5, {c: "c"}] => [{yes: 3}, {c: :c}], + [M5, {d: "d"}] => [{yes: 3}, {d: :d}], + [M5, {d: nil}] => [{yes: 2, no: 1}, {d: nil}], + + [M6, {a: [{a: []}]}] => [{yes: 6}, -> { _1 in {a: [M6]} }], + [M6, {b: {a: []}}] => [{yes: 4, no: 1}, -> { _1 in {b: M6} }] + } + + cases.each do |lhs, rhs| + target, input = lhs + exactness, expect = rhs + state = Docker::Internal::Type::Converter.new_coerce_state + assert_pattern do + coerced = Docker::Internal::Type::Converter.coerce(target, input, state: state) + assert_equal(coerced, coerced) + if coerced.is_a?(Docker::Internal::Type::BaseModel) + coerced.to_h => ^expect + else + coerced => ^expect + end + state.fetch(:exactness).filter { _2.nonzero? }.to_h => ^exactness + end + end + end + + def test_dump + cases = { + [M3, M3.new] => {d: :d}, + [M3, {}] => {d: :d}, + [M3, {d: 1}] => {d: 1}, + + [M4, M4.new(a: 1, b: "b", c: 2, d: "d")] => {a: 1, b: "b"}, + [M4, {a: 1, b: "b", c: 2, d: "d"}] => {a: 1, b: "b"}, + + [M5, M5.new] => {c: :c}, + [M5, {}] => {c: :c}, + [M5, {c: 1}] => {c: 1} + } + + cases.each do + target, input = _1 + expect = _2 + assert_pattern do + Docker::Internal::Type::Converter.dump(target, input) => ^expect + end + end + end + + def test_accessors + cases = { + M2.new({a: "1990-09-19", b: "1"}) => [{a: "1990-09-19", b: "1"}, {a: Time.new(1990, 9, 19), b: 1}], + M2.new(a: "one", b: "one") => [{a: "one", b: "one"}, {a: ArgumentError, b: ArgumentError}], + M2.new(a: nil, b: 2.0) => [{a: nil, b: 2.0}, {a: TypeError}], + M2.new(a: nil, b: 2.2) => [{a: nil, b: 2.2}, {a: TypeError, b: 2}], + + M3.new => [{}, {d: :d}], + M3.new(d: 1) => [{d: 1}, {d: ArgumentError}], + + M5.new => [{}, {c: :c, d: :d}] + } + + cases.each do + target = _1 + data, attributes = _2 + + assert_pattern do + target.to_h => ^data + end + + attributes.each do |accessor, expect| + case expect + in Class if expect <= StandardError + tap do + target.public_send(accessor) + flunk + rescue Docker::Errors::ConversionError => e + assert_kind_of(expect, e.cause) + end + else + assert_pattern { target.public_send(accessor) => ^expect } + end + end + end + end + + def test_inplace_modification + m1 = M6.new(a: []) + m1.a << M6.new(a: []) + + m2 = M6.new(b: M6.new(a: [])) + m2.b.a << M6.new(a: []) + + m3 = M6.new(a: []) + m4 = M6.new(b: m3) + m3.a << M6.new(a: []) + + assert_pattern do + m1 => {a: [{a: []}]} + m2 => {b: {a: [{a: []}]}} + m4 => {b: {a: [{a: []}]}} + end + end +end + +class Docker::Test::UnionTest < Minitest::Test + class U0 + include Docker::Internal::Type::Union + + def initialize(*variants) = variants.each { variant(_1) } + end + + module U1 + extend Docker::Internal::Type::Union + + variant const: :a + variant const: 2 + end + + class M1 < Docker::Internal::Type::BaseModel + required :t, const: :a, api_name: :type + optional :c, String + end + + class M2 < Docker::Internal::Type::BaseModel + required :type, const: :b + optional :c, String + end + + module U2 + extend Docker::Internal::Type::Union + + discriminator :type + + variant :a, M1 + variant :b, M2 + end + + module U3 + extend Docker::Internal::Type::Union + + discriminator :type + + variant :a, M1 + variant String + end + + module U4 + extend Docker::Internal::Type::Union + + discriminator :type + + variant String + variant :a, M1 + end + + class M3 < Docker::Internal::Type::BaseModel + optional :recur, -> { U5 } + required :a, Integer + end + + class M4 < Docker::Internal::Type::BaseModel + optional :recur, -> { U5 } + required :a, Docker::Internal::Type::ArrayOf[-> { U5 }] + end + + class M5 < Docker::Internal::Type::BaseModel + optional :recur, -> { U5 } + required :b, Docker::Internal::Type::ArrayOf[-> { U5 }] + end + + module U5 + extend Docker::Internal::Type::Union + + variant -> { M3 } + variant -> { M4 } + end + + module U6 + extend Docker::Internal::Type::Union + + variant -> { M3 } + variant -> { M5 } + end + + def test_accessors + model = M3.new(recur: []) + tap do + model.recur + flunk + rescue Docker::Errors::ConversionError => e + assert_kind_of(ArgumentError, e.cause) + end + end + + def test_coerce + cases = { + [U0, :""] => [{no: 1}, 0, :""], + + [U0.new(Integer, Float), "one"] => [{no: 1}, 2, "one"], + [U0.new(Integer, Float), 1.0] => [{yes: 1}, 2, 1.0], + [U0.new({const: :a}), "a"] => [{yes: 1}, 1, :a], + [U0.new({const: :a}), "2"] => [{maybe: 1}, 1, "2"], + + [U1, "a"] => [{yes: 1}, 1, :a], + [U1, "2"] => [{maybe: 1}, 2, "2"], + [U1, :b] => [{maybe: 1}, 2, :b], + + [U2, {type: :a}] => [{yes: 3}, 0, {t: :a}], + [U2, {type: "b"}] => [{yes: 3}, 0, {type: :b}], + + [U3, "one"] => [{yes: 1}, 2, "one"], + [U4, "one"] => [{yes: 1}, 1, "one"], + + [U5, {a: []}] => [{yes: 3}, 2, {a: []}], + [U6, {b: []}] => [{yes: 3}, 2, {b: []}], + + [U5, {a: [{a: []}]}] => [{yes: 6}, 4, {a: [M4.new(a: [])]}], + [U5, {a: [{a: [{a: []}]}]}] => [{yes: 9}, 6, {a: [M4.new(a: [M4.new(a: [])])]}] + } + + cases.each do |lhs, rhs| + target, input = lhs + exactness, branched, expect = rhs + state = Docker::Internal::Type::Converter.new_coerce_state + assert_pattern do + coerced = Docker::Internal::Type::Converter.coerce(target, input, state: state) + assert_equal(coerced, coerced) + if coerced.is_a?(Docker::Internal::Type::BaseModel) + coerced.to_h => ^expect + else + coerced => ^expect + end + state.fetch(:exactness).filter { _2.nonzero? }.to_h => ^exactness + state => {branched: ^branched} + end + end + end +end + +class Docker::Test::BaseModelQoLTest < Minitest::Test + class E0 + include Docker::Internal::Type::Enum + + attr_reader :values + + def initialize(*values) = (@values = values) + end + + module E1 + extend Docker::Internal::Type::Enum + + A = 1 + end + + module E2 + extend Docker::Internal::Type::Enum + + A = 1 + end + + module E3 + extend Docker::Internal::Type::Enum + + A = 2 + B = 3 + end + + class U0 + include Docker::Internal::Type::Union + + def initialize(*variants) = variants.each { variant(_1) } + end + + module U1 + extend Docker::Internal::Type::Union + + variant String + variant Integer + end + + module U2 + extend Docker::Internal::Type::Union + + variant String + variant Integer + end + + class M1 < Docker::Internal::Type::BaseModel + required :a, Integer + end + + class M2 < Docker::Internal::Type::BaseModel + required :a, Integer, nil?: true + end + + class M3 < M2 + required :a, Integer + end + + def test_equality + cases = { + [Docker::Internal::Type::Unknown, Docker::Internal::Type::Unknown] => true, + [Docker::Internal::Type::Boolean, Docker::Internal::Type::Boolean] => true, + [Docker::Internal::Type::Unknown, Docker::Internal::Type::Boolean] => false, + [E0.new(:a, :b), E0.new(:a, :b)] => true, + [E0.new(:a, :b), E0.new(:b, :a)] => true, + [E0.new(:a, :b), E0.new(:b, :c)] => false, + [E1, E2] => true, + [E1, E3] => false, + [U0.new(String, Integer), U0.new(String, Integer)] => true, + [U0.new(String, Integer), U0.new(Integer, String)] => false, + [U0.new(String, Float), U0.new(String, Integer)] => false, + [U1, U2] => true, + [M1, M2] => false, + [M1, M3] => true, + [M1.new(a: 1), M1.new(a: 1)] => true + } + + cases.each do + if _2 + assert_equal(*_1) + assert_equal(*_1.map(&:hash)) + else + refute_equal(*_1) + refute_equal(*_1.map(&:hash)) + end + end + end +end + +class Docker::Test::MetaInfoTest < Minitest::Test + A1 = Docker::Internal::Type::ArrayOf[Integer, nil?: true, doc: "dog"] + H1 = Docker::Internal::Type::HashOf[-> { String }, nil?: true, doc: "dawg"] + + class M1 < Docker::Internal::Type::BaseModel + required :a, Integer, doc: "dog" + optional :b, -> { String }, nil?: true, doc: "dawg" + end + + module U1 + extend Docker::Internal::Type::Union + + variant -> { Integer }, const: 2, doc: "dog" + variant -> { String }, doc: "dawg" + end + + def test_meta_retrieval + m1 = A1.instance_variable_get(:@meta) + m2 = H1.instance_variable_get(:@meta) + assert_equal({doc: "dog"}, m1) + assert_equal({doc: "dawg"}, m2) + + ma, mb = M1.fields.fetch_values(:a, :b) + assert_equal({doc: "dog"}, ma.fetch(:meta)) + assert_equal({doc: "dawg"}, mb.fetch(:meta)) + + ua, ub = U1.send(:known_variants).map(&:last) + assert_equal({doc: "dog"}, ua) + assert_equal({doc: "dawg"}, ub) + end +end diff --git a/test/docker/internal/util_test.rb b/test/docker/internal/util_test.rb new file mode 100644 index 0000000..0a6dc89 --- /dev/null +++ b/test/docker/internal/util_test.rb @@ -0,0 +1,675 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Docker::Test::UtilDataHandlingTest < Minitest::Test + def test_left_map + assert_pattern do + Docker::Internal::Util.deep_merge({a: 1}, nil) => nil + end + end + + def test_right_map + assert_pattern do + Docker::Internal::Util.deep_merge(nil, {a: 1}) => {a: 1} + end + end + + def test_disjoint_maps + assert_pattern do + Docker::Internal::Util.deep_merge({b: 2}, {a: 1}) => {a: 1, b: 2} + end + end + + def test_overlapping_maps + assert_pattern do + Docker::Internal::Util.deep_merge({b: 2, c: 3}, {a: 1, c: 4}) => {a: 1, b: 2, c: 4} + end + end + + def test_nested + assert_pattern do + Docker::Internal::Util.deep_merge({b: {b2: 1}}, {b: {b2: 2}}) => {b: {b2: 2}} + end + end + + def test_nested_left_map + assert_pattern do + Docker::Internal::Util.deep_merge({b: {b2: 1}}, {b: 6}) => {b: 6} + end + end + + def test_omission + merged = Docker::Internal::Util.deep_merge( + {b: {b2: 1, b3: {c: 4, d: 5}}}, + {b: {b2: 1, b3: {c: Docker::Internal::OMIT, d: 5}}} + ) + + assert_pattern do + merged => {b: {b2: 1, b3: {d: 5}}} + end + end + + def test_concat + merged = Docker::Internal::Util.deep_merge( + {a: {b: [1, 2]}}, + {a: {b: [3, 4]}}, + concat: true + ) + + assert_pattern do + merged => {a: {b: [1, 2, 3, 4]}} + end + end + + def test_concat_false + merged = Docker::Internal::Util.deep_merge( + {a: {b: [1, 2]}}, + {a: {b: [3, 4]}}, + concat: false + ) + + assert_pattern do + merged => {a: {b: [3, 4]}} + end + end + + def test_dig + assert_pattern do + Docker::Internal::Util.dig(1, nil) => 1 + Docker::Internal::Util.dig({a: 1}, :b) => nil + Docker::Internal::Util.dig({a: 1}, :a) => 1 + Docker::Internal::Util.dig({a: {b: 1}}, [:a, :b]) => 1 + + Docker::Internal::Util.dig([], 1) => nil + Docker::Internal::Util.dig([nil, [nil, 1]], [1, 1]) => 1 + Docker::Internal::Util.dig({a: [nil, 1]}, [:a, 1]) => 1 + Docker::Internal::Util.dig([], 1.0) => nil + + Docker::Internal::Util.dig(Object, 1) => nil + Docker::Internal::Util.dig([], 1.0) { 2 } => 2 + Docker::Internal::Util.dig([], ->(_) { 2 }) => 2 + Docker::Internal::Util.dig([1], -> { _1 in [1] }) => true + end + end +end + +class Docker::Test::UtilUriHandlingTest < Minitest::Test + def test_parsing + %w[ + http://example.com + https://example.com/ + https://example.com:443/example?e1=e1&e2=e2&e= + ].each do |url| + parsed = Docker::Internal::Util.parse_uri(url) + unparsed = Docker::Internal::Util.unparse_uri(parsed).to_s + + assert_equal(url, unparsed) + assert_equal(parsed, Docker::Internal::Util.parse_uri(unparsed)) + end + end + + def test_joining + cases = [ + [ + "h://a.b/c?d=e", + "h://nope/ignored", + Docker::Internal::Util.parse_uri("h://a.b/c?d=e") + ], + [ + "h://a.b/c?d=e", + "h://nope", + { + host: "a.b", + path: "/c", + query: {"d" => ["e"]} + } + ], + [ + "h://a.b/c?d=e", + "h://nope", + { + path: "h://a.b/c", + query: {"d" => ["e"]} + } + ] + ] + + cases.each do |expect, lhs, rhs| + assert_equal( + URI.parse(expect), + Docker::Internal::Util.join_parsed_uri( + Docker::Internal::Util.parse_uri(lhs), + rhs + ) + ) + end + end + + def test_joining_queries + base_url = "h://a.b/c?d=e" + cases = { + "c2" => "h://a.b/c/c2", + "/c2?f=g" => "h://a.b/c2?f=g", + "/c?f=g" => "h://a.b/c?d=e&f=g" + } + + cases.each do |path, expected| + assert_equal( + URI.parse(expected), + Docker::Internal::Util.join_parsed_uri( + Docker::Internal::Util.parse_uri(base_url), + {path: path} + ) + ) + end + end +end + +class Docker::Test::RegexMatchTest < Minitest::Test + def test_json_content + cases = { + "application/json" => true, + "application/jsonl" => false, + "application/arbitrary+json" => true, + "application/ARBITRARY+json" => true, + "application/vnd.github.v3+json" => true, + "application/vnd.api+json" => true + } + cases.each do |header, verdict| + assert_pattern do + Docker::Internal::Util::JSON_CONTENT.match?(header) => ^verdict + end + end + end + + def test_jsonl_content + cases = { + "application/x-ndjson" => true, + "application/x-ldjson" => true, + "application/jsonl" => true, + "application/x-jsonl" => true, + "application/json" => false, + "application/vnd.api+json" => false + } + cases.each do |header, verdict| + assert_pattern do + Docker::Internal::Util::JSONL_CONTENT.match?(header) => ^verdict + end + end + end +end + +class Docker::Test::UtilFormDataEncodingTest < Minitest::Test + class FakeCGI < CGI + def initialize(headers, io) + encoded = io.to_a + @ctype = headers["content-type"] + # rubocop:disable Lint/EmptyBlock + @io = Docker::Internal::Util::ReadIOAdapter.new(encoded.to_enum) {} + # rubocop:enable Lint/EmptyBlock + @c_len = encoded.join.bytesize.to_s + super() + end + + def stdinput = @io + + def env_table + { + "REQUEST_METHOD" => "POST", + "CONTENT_TYPE" => @ctype, + "CONTENT_LENGTH" => @c_len + } + end + end + + def test_encoding_length + headers, = Docker::Internal::Util.encode_content( + {"content-type" => "multipart/form-data"}, + Pathname(__FILE__) + ) + assert_pattern do + headers.fetch("content-type") => /boundary=(.+)$/ + end + field, = Regexp.last_match.captures + assert(field.length < 70 - 6) + end + + def test_file_encode + file = Pathname(__FILE__) + fileinput = Docker::Internal::Type::Converter.dump(Docker::Internal::Type::FileInput, "abc") + headers = {"content-type" => "multipart/form-data"} + cases = { + "abc" => ["", "abc"], + StringIO.new("abc") => ["", "abc"], + fileinput => %w[upload abc], + Docker::FilePart.new(StringIO.new("abc")) => ["", "abc"], + file => [file.basename.to_path, /^class Docker/], + Docker::FilePart.new(file, filename: "d o g") => ["d%20o%20g", /^class Docker/] + } + cases.each do |body, testcase| + filename, val = testcase + encoded = Docker::Internal::Util.encode_content(headers, body) + cgi = FakeCGI.new(*encoded) + io = cgi[""] + assert_pattern do + io.original_filename => ^filename + io.read => ^val + end + end + end + + def test_hash_encode + headers = {"content-type" => "multipart/form-data"} + cases = { + {a: 2, b: 3} => {"a" => "2", "b" => "3"}, + {a: 2, b: nil} => {"a" => "2", "b" => "null"}, + {a: 2, b: [1, 2, 3]} => {"a" => "2", "b" => "1"}, + {strio: StringIO.new("a")} => {"strio" => "a"}, + {strio: Docker::FilePart.new("a")} => {"strio" => "a"}, + {pathname: Pathname(__FILE__)} => {"pathname" => -> { _1.read in /^class Docker/ }}, + {pathname: Docker::FilePart.new(Pathname(__FILE__))} => {"pathname" => -> { _1.read in /^class Docker/ }} + } + cases.each do |body, testcase| + encoded = Docker::Internal::Util.encode_content(headers, body) + cgi = FakeCGI.new(*encoded) + testcase.each do |key, val| + assert_pattern do + parsed = + case (p = cgi[key]) + in StringIO + p.read + else + p + end + parsed => ^val + end + end + end + end +end + +class Docker::Test::UtilIOAdapterTest < Minitest::Test + def test_copy_read + cases = { + StringIO.new("abc") => "abc", + Enumerator.new { _1 << "abc" } => "abc" + } + cases.each do |input, expected| + io = StringIO.new + # rubocop:disable Lint/EmptyBlock + adapter = Docker::Internal::Util::ReadIOAdapter.new(input) {} + # rubocop:enable Lint/EmptyBlock + IO.copy_stream(adapter, io) + assert_equal(expected, io.string) + end + end + + def test_copy_write + cases = { + StringIO.new => "", + StringIO.new("abc") => "abc" + } + cases.each do |input, expected| + enum = Docker::Internal::Util.writable_enum do |y| + IO.copy_stream(input, y) + end + assert_equal(expected, enum.to_a.join) + end + end +end + +class Docker::Test::UtilFusedEnumTest < Minitest::Test + def test_rewind_closing + touched = false + once = 0 + steps = 0 + enum = Enumerator.new do |y| + next if touched + + 10.times do + steps = _1 + y << _1 + end + ensure + once = once.succ + end + + fused = Docker::Internal::Util.fused_enum(enum, external: true) do + touched = true + loop { enum.next } + end + Docker::Internal::Util.close_fused!(fused) + + assert_equal(1, once) + assert_equal(0, steps) + end + + def test_thread_interrupts + once = 0 + que = Queue.new + enum = Enumerator.new do |y| + 10.times { y << _1 } + ensure + once = once.succ + end + + fused_1 = Docker::Internal::Util.fused_enum(enum, external: true) { loop { enum.next } } + fused_2 = Docker::Internal::Util.chain_fused(fused_1) { fused_1.each(&_1) } + fused_3 = Docker::Internal::Util.chain_fused(fused_2) { fused_2.each(&_1) } + + th = ::Thread.new do + que << "🐶" + fused_3.each { sleep(10) } + end + + assert_equal("🐶", que.pop) + th.kill.join + assert_equal(1, once) + end + + def test_closing + arr = [1, 2, 3] + once = 0 + fused = Docker::Internal::Util.fused_enum(arr.to_enum) do + once = once.succ + end + + enumerated_1 = fused.to_a + assert_equal(arr, enumerated_1) + assert_equal(1, once) + + enumerated_2 = fused.to_a + assert_equal([], enumerated_2) + assert_equal(1, once) + end + + def test_rewind_chain + once = 0 + fused = Docker::Internal::Util.fused_enum([1, 2, 3].to_enum) do + once = once.succ + end + .lazy + .map(&:succ) + .filter(&:odd?) + first = fused.next + + assert_equal(3, first) + assert_equal(0, once) + assert_raises(StopIteration) { fused.rewind.next } + assert_equal(1, once) + end + + def test_external_iteration + iter = [1, 2, 3].to_enum + first = iter.next + fused = Docker::Internal::Util.fused_enum(iter, external: true) + + assert_equal(1, first) + assert_equal([2, 3], fused.to_a) + end + + def test_close_fused + once = 0 + fused = Docker::Internal::Util.fused_enum([1, 2, 3].to_enum) do + once = once.succ + end + + Docker::Internal::Util.close_fused!(fused) + + assert_equal(1, once) + assert_equal([], fused.to_a) + assert_equal(1, once) + end + + def test_closed_fused_extern_iteration + taken = 0 + enum = [1, 2, 3].to_enum.lazy.map do + taken = taken.succ + _1 + end + fused = Docker::Internal::Util.fused_enum(enum) + first = fused.next + + assert_equal(1, first) + Docker::Internal::Util.close_fused!(fused) + assert_equal(1, taken) + end + + def test_closed_fused_taken_count + taken = 0 + enum = [1, 2, 3].to_enum.lazy.map do + taken = taken.succ + _1 + end + .map(&:succ) + .filter(&:odd?) + fused = Docker::Internal::Util.fused_enum(enum) + + assert_equal(0, taken) + Docker::Internal::Util.close_fused!(fused) + assert_equal(0, taken) + end + + def test_closed_fused_extern_iter_taken_count + taken = 0 + enum = [1, 2, 3].to_enum.lazy.map do + taken = taken.succ + _1 + end + .map(&:succ) + .filter(&:itself) + first = enum.next + assert_equal(2, first) + assert_equal(1, taken) + + fused = Docker::Internal::Util.fused_enum(enum) + Docker::Internal::Util.close_fused!(fused) + assert_equal(1, taken) + end + + def test_close_fused_sse_chain + taken = 0 + enum = [1, 2, 3].to_enum.lazy.map do + taken = taken.succ + _1 + end + .map(&:succ) + .filter(&:odd?) + .map(&:to_s) + + fused_1 = Docker::Internal::Util.fused_enum(enum) + fused_2 = Docker::Internal::Util.decode_lines(fused_1) + fused_3 = Docker::Internal::Util.decode_sse(fused_2) + + assert_equal(0, taken) + Docker::Internal::Util.close_fused!(fused_3) + assert_equal(0, taken) + end +end + +class Docker::Test::UtilContentDecodingTest < Minitest::Test + def test_charset + cases = { + "application/json" => Encoding::BINARY, + "application/json; charset=utf-8" => Encoding::UTF_8, + "charset=uTf-8 application/json; " => Encoding::UTF_8, + "charset=UTF-8; application/json; " => Encoding::UTF_8, + "charset=ISO-8859-1 ;application/json; " => Encoding::ISO_8859_1, + "charset=EUC-KR ;application/json; " => Encoding::EUC_KR + } + text = String.new.force_encoding(Encoding::BINARY) + cases.each do |content_type, encoding| + Docker::Internal::Util.force_charset!(content_type, text: text) + assert_equal(encoding, text.encoding) + end + end +end + +class Docker::Test::UtilSseTest < Minitest::Test + def test_decode_lines + cases = { + %w[] => %w[], + %W[\n\n] => %W[\n \n], + %W[\n \n] => %W[\n \n], + %w[a] => %w[a], + %W[a\nb] => %W[a\n b], + %W[a\nb\n] => %W[a\n b\n], + %W[\na b\n] => %W[\n ab\n], + %W[\na b\n\n] => %W[\n ab\n \n], + %W[\na b] => %W[\n ab], + %W[\u1F62E\u200D\u1F4A8] => %W[\u1F62E\u200D\u1F4A8], + %W[\u1F62E \u200D \u1F4A8] => %W[\u1F62E\u200D\u1F4A8], + ["\xf0\x9f".b, "\xa5\xba".b] => ["\xf0\x9f\xa5\xba".b], + ["\xf0".b, "\x9f".b, "\xa5".b, "\xba".b] => ["\xf0\x9f\xa5\xba".b] + } + eols = %W[\n \r \r\n] + cases.each do |enum, expected| + eols.each do |eol| + lines = Docker::Internal::Util.decode_lines(enum.map { _1.gsub("\n", eol) }) + assert_equal(expected.map { _1.gsub("\n", eol) }, lines.to_a, "eol=#{JSON.generate(eol)}") + end + end + end + + def test_mixed_decode_lines + cases = { + %w[] => %w[], + %W[\r\r] => %W[\r \r], + %W[\r \r] => %W[\r \r], + %W[\r\r\r] => %W[\r \r \r], + %W[\r\r \r] => %W[\r \r \r], + %W[\r \n] => %W[\r\n], + %W[\r\r\n] => %W[\r \r\n], + %W[\n\r] => %W[\n \r] + } + cases.each do |enum, expected| + lines = Docker::Internal::Util.decode_lines(enum) + assert_equal(expected, lines.to_a) + end + end + + def test_decode_sse + cases = { + "empty input" => { + [] => [] + }, + "single data event" => { + [ + "data: hello world\n", + "\n" + ] => [ + {data: "hello world\n"} + ] + }, + "multiple data lines" => { + [ + "data: line 1\n", + "data: line 2\n", + "\n" + ] => [ + {data: "line 1\nline 2\n"} + ] + }, + "complete event" => { + [ + "id: 123\n", + "event: update\n", + "data: hello world\n", + "retry: 5000\n", + "\n" + ] => [ + { + event: "update", + id: "123", + data: "hello world\n", + retry: 5000 + } + ] + }, + "multiple events" => { + [ + "event: update\n", + "data: first\n", + "\n", + "event: message\n", + "data: second\n", + "\n" + ] => [ + {event: "update", data: "first\n"}, + {event: "message", data: "second\n"} + ] + }, + "comments" => { + [ + ": this is a comment\n", + "data: actual data\n", + "\n" + ] => [ + {data: "actual data\n"} + ] + }, + "invalid retry" => { + [ + "retry: not a number\n", + "data: hello\n", + "\n" + ] => [ + {data: "hello\n"} + ] + }, + "invalid id with null" => { + [ + "id: bad\0id\n", + "data: hello\n", + "\n" + ] => [ + {data: "hello\n"} + ] + }, + "leading space in value" => { + [ + "data: hello world\n", + "data: leading space\n", + "\n" + ] => [ + {data: "hello world\n leading space\n"} + ] + }, + "no final newline" => { + [ + "data: hello\n", + "id: 1" + ] => [ + {data: "hello\n", id: "1"} + ] + }, + "multiple empty lines" => { + [ + "data: first\n", + "\n", + "\n", + "data: second\n", + "\n" + ] => [ + {data: "first\n"}, + {data: "second\n"} + ] + }, + "multibyte unicode" => { + [ + "data: \u1F62E\u200D\u1F4A8\n" + ] => [ + {data: "\u1F62E\u200D\u1F4A8\n"} + ] + } + } + + cases.each do |name, test_cases| + test_cases.each do |input, expected| + actual = Docker::Internal::Util.decode_sse(input).map(&:compact) + assert_equal(expected, actual, name) + end + end + end +end diff --git a/test/docker/resource_namespaces.rb b/test/docker/resource_namespaces.rb new file mode 100644 index 0000000..cd0cb0c --- /dev/null +++ b/test/docker/resource_namespaces.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Docker + module Test + module Resources + end + end +end diff --git a/test/docker/resources/auth_test.rb b/test/docker/resources/auth_test.rb new file mode 100644 index 0000000..d0407c9 --- /dev/null +++ b/test/docker/resources/auth_test.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Docker::Test::Resources::AuthTest < Docker::Test::ResourceTest + def test_login + skip("Prism tests are disabled") + + response = @docker.auth.login + + assert_pattern do + response => Docker::AuthResponse + end + + assert_pattern do + response => { + status: String, + identity_token: String | nil + } + end + end +end diff --git a/test/docker/resources/containers_test.rb b/test/docker/resources/containers_test.rb new file mode 100644 index 0000000..28f7024 --- /dev/null +++ b/test/docker/resources/containers_test.rb @@ -0,0 +1,124 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Docker::Test::Resources::ContainersTest < Docker::Test::ResourceTest + def test_create_required_params + skip("Prism tests are disabled") + + response = @docker.containers.create(config: {}) + + assert_pattern do + response => Docker::CreateResponse + end + + assert_pattern do + response => { + id: String, + warnings: ^(Docker::Internal::Type::ArrayOf[String]) + } + end + end + + def test_list + skip("Prism tests are disabled") + + response = @docker.containers.list + + assert_pattern do + response => ^(Docker::Internal::Type::ArrayOf[Docker::Summary]) + end + end + + def test_delete + skip("Prism tests are disabled") + + response = @docker.containers.delete("id") + + assert_pattern do + response => nil + end + end + + def test_inspect_ + skip("Prism tests are disabled") + + response = @docker.containers.inspect_("id") + + assert_pattern do + response => Docker::Container + end + + assert_pattern do + response => { + app_armor_profile: String | nil, + args: ^(Docker::Internal::Type::ArrayOf[String]) | nil, + config: Docker::Config | nil, + created: String | nil, + driver: String | nil, + exec_ids: ^(Docker::Internal::Type::ArrayOf[String]) | nil, + graph_driver: Docker::Container::GraphDriver | nil, + host_config: Docker::Container::HostConfig | nil, + hostname_path: String | nil, + hosts_path: String | nil, + id: String | nil, + image: String | nil, + image_manifest_descriptor: Docker::Container::ImageManifestDescriptor | nil, + log_path: String | nil, + mount_label: String | nil, + mounts: ^(Docker::Internal::Type::ArrayOf[Docker::Container::Mount]) | nil, + name: String | nil, + network_settings: Docker::Container::NetworkSettings | nil, + path: String | nil, + platform: String | nil, + process_label: String | nil, + resolv_conf_path: String | nil, + restart_count: Integer | nil, + size_root_fs: Integer | nil, + size_rw: Integer | nil, + state: Docker::Container::State | nil, + storage: Docker::Container::Storage | nil + } + end + end + + def test_kill + skip("Prism tests are disabled") + + response = @docker.containers.kill("id") + + assert_pattern do + response => nil + end + end + + def test_logs + skip("Prism tests are disabled") + + response = @docker.containers.logs("id") + + assert_pattern do + response => StringIO + end + end + + def test_start + skip("Prism tests are disabled") + + response = @docker.containers.start("id") + + assert_pattern do + response => nil + end + end + + def test_stop + skip("Prism tests are disabled") + + response = @docker.containers.stop("id") + + assert_pattern do + response => nil + end + end +end diff --git a/test/docker/resources/images_test.rb b/test/docker/resources/images_test.rb new file mode 100644 index 0000000..dcbd11d --- /dev/null +++ b/test/docker/resources/images_test.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Docker::Test::Resources::ImagesTest < Docker::Test::ResourceTest + def test_list + skip("Prism tests are disabled") + + response = @docker.images.list + + assert_pattern do + response => ^(Docker::Internal::Type::ArrayOf[Docker::Summary]) + end + end + + def test_delete + skip("Prism tests are disabled") + + response = @docker.images.delete("name") + + assert_pattern do + response => ^(Docker::Internal::Type::ArrayOf[Docker::Models::ImageDeleteResponseItem]) + end + end + + def test_inspect_ + skip("Prism tests are disabled") + + response = @docker.images.inspect_("name") + + assert_pattern do + response => Docker::Image + end + + assert_pattern do + response => { + architecture: String | nil, + author: String | nil, + comment: String | nil, + config: Docker::Image::Config | nil, + created: String | nil, + descriptor: Docker::Image::Descriptor | nil, + graph_driver: Docker::Image::GraphDriver | nil, + id: String | nil, + identity: Docker::Image::Identity | nil, + manifests: ^(Docker::Internal::Type::ArrayOf[Docker::Image::Manifest]) | nil, + metadata: Docker::Image::Metadata | nil, + os: String | nil, + os_version: String | nil, + repo_digests: ^(Docker::Internal::Type::ArrayOf[String]) | nil, + repo_tags: ^(Docker::Internal::Type::ArrayOf[String]) | nil, + root_fs: Docker::Image::RootFs | nil, + size: Integer | nil, + variant: String | nil + } + end + end + + def test_pull + skip("Prism tests are disabled") + + response = @docker.images.pull + + assert_pattern do + response => nil + end + end +end diff --git a/test/docker/resources/networks_test.rb b/test/docker/resources/networks_test.rb new file mode 100644 index 0000000..ea4a7cb --- /dev/null +++ b/test/docker/resources/networks_test.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Docker::Test::Resources::NetworksTest < Docker::Test::ResourceTest + def test_create_required_params + skip("Prism tests are disabled") + + response = @docker.networks.create(name: "my_network") + + assert_pattern do + response => Docker::Models::NetworkCreateResponse + end + + assert_pattern do + response => { + id: String, + warning: String + } + end + end + + def test_list + skip("Prism tests are disabled") + + response = @docker.networks.list + + assert_pattern do + response => ^(Docker::Internal::Type::ArrayOf[Docker::Summary]) + end + end + + def test_delete + skip("Prism tests are disabled") + + response = @docker.networks.delete("id") + + assert_pattern do + response => nil + end + end + + def test_inspect_ + skip("Prism tests are disabled") + + response = @docker.networks.inspect_("id") + + assert_pattern do + response => Docker::Models::NetworkInspectResponse + end + end +end diff --git a/test/docker/resources/services_test.rb b/test/docker/resources/services_test.rb new file mode 100644 index 0000000..ec15a0f --- /dev/null +++ b/test/docker/resources/services_test.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Docker::Test::Resources::ServicesTest < Docker::Test::ResourceTest + def test_create_required_params + skip("Prism tests are disabled") + + response = @docker.services.create(spec: {}) + + assert_pattern do + response => Docker::Models::ServiceCreateResponse + end + + assert_pattern do + response => { + id: String | nil, + warnings: ^(Docker::Internal::Type::ArrayOf[String]) | nil + } + end + end + + def test_list + skip("Prism tests are disabled") + + response = @docker.services.list + + assert_pattern do + response => ^(Docker::Internal::Type::ArrayOf[Docker::Service]) + end + end + + def test_delete + skip("Prism tests are disabled") + + response = @docker.services.delete("id") + + assert_pattern do + response => nil + end + end + + def test_inspect_ + skip("Prism tests are disabled") + + response = @docker.services.inspect_("id") + + assert_pattern do + response => Docker::Service + end + + assert_pattern do + response => { + created_at: String | nil, + endpoint: Docker::Service::Endpoint | nil, + id: String | nil, + job_status: Docker::Service::JobStatus | nil, + service_status: Docker::Service::ServiceStatus | nil, + spec: Docker::Spec | nil, + updated_at: String | nil, + update_status: Docker::Service::UpdateStatus | nil, + version: Docker::Service::Version | nil + } + end + end +end diff --git a/test/docker/resources/shared_test.rb b/test/docker/resources/shared_test.rb new file mode 100644 index 0000000..ab26924 --- /dev/null +++ b/test/docker/resources/shared_test.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Docker::Test::Resources::SharedTest < Docker::Test::ResourceTest +end diff --git a/test/docker/resources/system_test.rb b/test/docker/resources/system_test.rb new file mode 100644 index 0000000..2071fde --- /dev/null +++ b/test/docker/resources/system_test.rb @@ -0,0 +1,119 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Docker::Test::Resources::SystemTest < Docker::Test::ResourceTest + def test_info + skip("Prism tests are disabled") + + response = @docker.system_.info + + assert_pattern do + response => Docker::Models::SystemInfoResponse + end + + assert_pattern do + response => { + architecture: String | nil, + cdi_spec_dirs: ^(Docker::Internal::Type::ArrayOf[String]) | nil, + cgroup_driver: Docker::Models::SystemInfoResponse::CgroupDriver | nil, + cgroup_version: Docker::Models::SystemInfoResponse::CgroupVersion | nil, + containerd: Docker::Models::SystemInfoResponse::Containerd | nil, + containerd_commit: Docker::Models::SystemInfoResponse::ContainerdCommit | nil, + containers: Integer | nil, + containers_paused: Integer | nil, + containers_running: Integer | nil, + containers_stopped: Integer | nil, + cpu_cfs_period: Docker::Internal::Type::Boolean | nil, + cpu_cfs_quota: Docker::Internal::Type::Boolean | nil, + cpu_set: Docker::Internal::Type::Boolean | nil, + cpu_shares: Docker::Internal::Type::Boolean | nil, + debug: Docker::Internal::Type::Boolean | nil, + default_address_pools: ^(Docker::Internal::Type::ArrayOf[Docker::Models::SystemInfoResponse::DefaultAddressPool]) | nil, + default_runtime: String | nil, + discovered_devices: ^(Docker::Internal::Type::ArrayOf[Docker::Models::SystemInfoResponse::DiscoveredDevice]) | nil, + docker_root_dir: String | nil, + driver: String | nil, + driver_status: ^(Docker::Internal::Type::ArrayOf[Docker::Internal::Type::ArrayOf[String]]) | nil, + experimental_build: Docker::Internal::Type::Boolean | nil, + firewall_backend: Docker::Models::SystemInfoResponse::FirewallBackend | nil, + generic_resources: ^(Docker::Internal::Type::ArrayOf[Docker::Models::SystemInfoResponse::GenericResource]) | nil, + http_proxy: String | nil, + https_proxy: String | nil, + id: String | nil, + images: Integer | nil, + index_server_address: String | nil, + init_binary: String | nil, + init_commit: Docker::Models::SystemInfoResponse::InitCommit | nil, + i_pv4_forwarding: Docker::Internal::Type::Boolean | nil, + isolation: Docker::Models::SystemInfoResponse::Isolation | nil, + kernel_version: String | nil, + labels: ^(Docker::Internal::Type::ArrayOf[String]) | nil, + live_restore_enabled: Docker::Internal::Type::Boolean | nil, + logging_driver: String | nil, + memory_limit: Docker::Internal::Type::Boolean | nil, + mem_total: Integer | nil, + name: String | nil, + ncpu: Integer | nil, + n_events_listener: Integer | nil, + n_fd: Integer | nil, + n_goroutines: Integer | nil, + no_proxy: String | nil, + nri: Docker::Models::SystemInfoResponse::Nri | nil, + oom_kill_disable: Docker::Internal::Type::Boolean | nil, + operating_system: String | nil, + os_type: String | nil, + os_version: String | nil, + pids_limit: Docker::Internal::Type::Boolean | nil, + plugins: Docker::Models::SystemInfoResponse::Plugins | nil, + product_license: String | nil, + registry_config: Docker::Models::SystemInfoResponse::RegistryConfig | nil, + runc_commit: Docker::Models::SystemInfoResponse::RuncCommit | nil, + runtimes: ^(Docker::Internal::Type::HashOf[Docker::Models::SystemInfoResponse::Runtime]) | nil, + security_options: ^(Docker::Internal::Type::ArrayOf[String]) | nil, + server_version: String | nil, + swap_limit: Docker::Internal::Type::Boolean | nil, + swarm: Docker::Models::SystemInfoResponse::Swarm | nil, + system_time: String | nil, + warnings: ^(Docker::Internal::Type::ArrayOf[String]) | nil + } + end + end + + def test_ping + skip("Prism tests are disabled") + + response = @docker.system_.ping + + assert_pattern do + response => String + end + end + + def test_version + skip("Prism tests are disabled") + + response = @docker.system_.version + + assert_pattern do + response => Docker::Models::SystemVersionResponse + end + + assert_pattern do + response => { + api_version: String | nil, + arch: String | nil, + build_time: String | nil, + components: ^(Docker::Internal::Type::ArrayOf[Docker::Models::SystemVersionResponse::Component]) | nil, + experimental: Docker::Internal::Type::Boolean | nil, + git_commit: String | nil, + go_version: String | nil, + kernel_version: String | nil, + min_api_version: String | nil, + os: String | nil, + platform: Docker::Models::SystemVersionResponse::Platform | nil, + version: String | nil + } + end + end +end diff --git a/test/docker/resources/volumes_test.rb b/test/docker/resources/volumes_test.rb new file mode 100644 index 0000000..6e572a3 --- /dev/null +++ b/test/docker/resources/volumes_test.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Docker::Test::Resources::VolumesTest < Docker::Test::ResourceTest + def test_create_required_params + skip("Prism tests are disabled") + + response = @docker.volumes.create(create_request: {}) + + assert_pattern do + response => Docker::Volume + end + + assert_pattern do + response => { + driver: String, + labels: ^(Docker::Internal::Type::HashOf[String]), + mountpoint: String, + name: String, + options: ^(Docker::Internal::Type::HashOf[String]), + scope: Docker::Volume::Scope, + cluster_volume: Docker::Volume::ClusterVolume | nil, + created_at: String | nil, + status: ^(Docker::Internal::Type::HashOf[Docker::Internal::Type::Unknown]) | nil, + usage_data: Docker::Volume::UsageData | nil + } + end + end + + def test_list + skip("Prism tests are disabled") + + response = @docker.volumes.list + + assert_pattern do + response => Docker::Models::VolumeListResponse + end + + assert_pattern do + response => { + volumes: ^(Docker::Internal::Type::ArrayOf[Docker::Volume]) | nil, + warnings: ^(Docker::Internal::Type::ArrayOf[String]) | nil + } + end + end + + def test_delete + skip("Prism tests are disabled") + + response = @docker.volumes.delete("name") + + assert_pattern do + response => nil + end + end + + def test_inspect_ + skip("Prism tests are disabled") + + response = @docker.volumes.inspect_("name") + + assert_pattern do + response => Docker::Volume + end + + assert_pattern do + response => { + driver: String, + labels: ^(Docker::Internal::Type::HashOf[String]), + mountpoint: String, + name: String, + options: ^(Docker::Internal::Type::HashOf[String]), + scope: Docker::Volume::Scope, + cluster_volume: Docker::Volume::ClusterVolume | nil, + created_at: String | nil, + status: ^(Docker::Internal::Type::HashOf[Docker::Internal::Type::Unknown]) | nil, + usage_data: Docker::Volume::UsageData | nil + } + end + end +end diff --git a/test/docker/test_helper.rb b/test/docker/test_helper.rb new file mode 100644 index 0000000..be91880 --- /dev/null +++ b/test/docker/test_helper.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +# Requiring this file from each test file ensures we always do the following, even +# when running a single-file test: +# - Load the whole gem (as one would in production) +# - Define shared testing namespace so that we don't need to indent test files as much +# - Setting up testing dependencies + +require "digest" +require "singleton" + +require "async" +require "minitest/autorun" +require "minitest/focus" +require "minitest/hooks/test" +require "minitest/proveit" +require "minitest/rg" +require "webmock" + +require_relative "../../lib/docker" +require_relative "resource_namespaces" + +module Kernel + alias_method :_sleep, :sleep + + def sleep(secs) + case Thread.current.thread_variable_get(:mock_sleep) + in Array => counter + counter << secs + secs + else + _sleep(secs) + end + end +end + +class Time + class << self + alias_method :_now, :now + end + + def self.now = Thread.current.thread_variable_get(:time_now) || _now +end + +class Docker::Test::SingletonClient < Docker::Client + include Singleton + + TEST_API_BASE_URL = ENV.fetch("TEST_API_BASE_URL", "http://localhost:4010") + + def initialize + super(base_url: Docker::Test::SingletonClient::TEST_API_BASE_URL) + end +end + +module Minitest::Serial + def test_order = :random + + def run_one_method(...) = Minitest::Runnable.run_one_method(...) +end + +class Minitest::Test + include Minitest::Hooks + + make_my_diffs_pretty! + parallelize_me! + prove_it! +end + +class Docker::Test::ResourceTest < Minitest::Test + def async? + return @async unless @async.nil? + @async = Digest::SHA256.hexdigest(self.class.name).to_i(16).odd? + end + + def before_all + super + @docker = Docker::Test::SingletonClient.instance + end + + def around_all = async? ? Sync { super } : super + + def around = async? ? Async { super }.wait : super +end + +module WebMock + AssertionFailure.error_class = Minitest::Assertion +end From f4a07959997565c4b36a9fffec1c39de90c365d3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 23:57:03 +0000 Subject: [PATCH 2/2] release: 0.1.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ Gemfile.lock | 2 +- README.md | 2 +- lib/docker/version.rb | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1332969..3d2ac0b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.1" + ".": "0.1.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0ee6e49 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog + +## 0.1.0 (2026-02-09) + +Full Changelog: [v0.0.1...v0.1.0](https://github.com/Hexlet/docker-ruby/compare/v0.0.1...v0.1.0) + +### Features + +* **api:** api update ([cdbe545](https://github.com/Hexlet/docker-ruby/commit/cdbe5455ab0288a02e07a56408419bf5a76a9439)) diff --git a/Gemfile.lock b/Gemfile.lock index 5accc37..613f773 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - docker (0.0.1) + docker (0.1.0) cgi connection_pool diff --git a/README.md b/README.md index e8b5211..dadf332 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "docker", "~> 0.0.1" +gem "docker", "~> 0.1.0" ``` diff --git a/lib/docker/version.rb b/lib/docker/version.rb index 57da001..1c2d111 100644 --- a/lib/docker/version.rb +++ b/lib/docker/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Docker - VERSION = "0.0.1" + VERSION = "0.1.0" end