Current section
8 Versions
Jump to
Current section
8 Versions
Compare versions
385
files changed
+8915
additions
-8785
deletions
| @@ -17,12 +17,70 @@ by adding `nomad_client` to your list of dependencies in `mix.exs`: | |
| 17 17 | |
| 18 18 | ```elixir |
| 19 19 | def deps do |
| 20 | - [{:nomad_client, "~> 1.0.0"}] |
| 20 | + [{:nomad_client, "~> 0.11.0"}] |
| 21 21 | end |
| 22 22 | ``` |
| 23 23 | |
| 24 24 | The Documentation can be found at [https://hexdocs.pm/nomad_client](https://hexdocs.pm/nomad_client). |
| 25 25 | |
| 26 | + ## Usage |
| 27 | + |
| 28 | + First, you have to initiate the `Tesla.Env.Conn`. |
| 29 | + ``` |
| 30 | + # Use Application defaults |
| 31 | + conn = NomadClient.Connection.new() |
| 32 | + # Differente URL, no ACL token |
| 33 | + conn = NomadClient.Connection.new("http://172.17.0.1:4646/v1") |
| 34 | + # Custom URL with ACL token |
| 35 | + conn = NomadClient.Connection.new("http://172.17.0.1:4646/v1", "00000000-0000-0000-0000-000000000000") |
| 36 | + ``` |
| 37 | + |
| 38 | + After that, you can use your `conn` to make requests the api requests by using the API Modules. |
| 39 | + |
| 40 | + For example: |
| 41 | + ``` |
| 42 | + alias NomadClient.Connection |
| 43 | + alias NomadClient.Api.Jobs |
| 44 | + |
| 45 | + conn = Connection.new() |
| 46 | + {:ok, []} = Jobs.get_jobs(conn) |
| 47 | + ``` |
| 48 | + |
| 49 | + ### Configuration |
| 50 | + |
| 51 | + You can chance the default http adapter or inject additional middleware into the client. |
| 52 | + Since the client does not provides his own application instruction, the configuration has to be made via the `:tesla` application |
| 53 | + |
| 54 | + For example: (config.exs) |
| 55 | + ``` |
| 56 | + config :tesla, NomadClient.Connection, |
| 57 | + adapter: {Tesla.Adapter.Hackney, [recv_timeout: 150_000, connect_timeout: 150_000]}, |
| 58 | + middleware: [Tesla.Middleware.Logger] |
| 59 | + ``` |
| 60 | + |
| 61 | + ## Development |
| 62 | + |
| 63 | + ### Regenerationg the client |
| 64 | + |
| 65 | + You can basicly regenerate this client without the custom modifications by running the following command: |
| 66 | + ```shell |
| 67 | + docker run \ |
| 68 | + --rm \ |
| 69 | + --mount "type=bind,src=$(pwd),dst=/local" \ |
| 70 | + --user "$UID:$GID" \ |
| 71 | + openapitools/openapi-generator-cli:v5.2.1 \ |
| 72 | + generate \ |
| 73 | + --invoker-package NomadClient \ |
| 74 | + --generator-name elixir \ |
| 75 | + --skip-validate-spec \ |
| 76 | + --input-spec /local/openapi.json \ |
| 77 | + --output /local/ |
| 78 | + ``` |
| 79 | + |
| 80 | + This will spin up a docker container on your system and gernerates the whole elixir client based on the `openapi.json` definition. |
| 81 | + Please note, the `openapi.json` file is also just e generated part of the https://github.com/mrmstn/Nomad.OAS Project. |
| 82 | + I've just added this file to this repo for simplicity and documentation. |
| 83 | + |
| 26 84 | ## Credits and Copyright |
| 27 85 | |
| 28 86 | This client is based on a loooot of generated code which would not have been possible without the OAS definition of the nomad-api and the OAS client generator |
| @@ -3,165 +3,196 @@ | |
| 3 3 | {<<"description">>,<<"A elixir client for HashiCorp Nomad's API.">>}. |
| 4 4 | {<<"elixir">>,<<"~> 1.6">>}. |
| 5 5 | {<<"files">>, |
| 6 | - [<<"lib">>,<<"lib/nomad">>,<<"lib/nomad/api">>,<<"lib/nomad/api/agent.ex">>, |
| 7 | - <<"lib/nomad/api/allocations.ex">>,<<"lib/nomad/api/client.ex">>, |
| 8 | - <<"lib/nomad/api/deployments.ex">>,<<"lib/nomad/api/evaluations.ex">>, |
| 9 | - <<"lib/nomad/api/jobs.ex">>,<<"lib/nomad/api/nodes.ex">>, |
| 10 | - <<"lib/nomad/api/regions.ex">>,<<"lib/nomad/api/status.ex">>, |
| 11 | - <<"lib/nomad/api/system.ex">>,<<"lib/nomad/api/volumes.ex">>, |
| 12 | - <<"lib/nomad/connection.ex">>,<<"lib/nomad/deserializer.ex">>, |
| 13 | - <<"lib/nomad/model">>,<<"lib/nomad/model/acl_policy.ex">>, |
| 14 | - <<"lib/nomad/model/acl_policy_list_stub.ex">>, |
| 15 | - <<"lib/nomad/model/acl_token.ex">>, |
| 16 | - <<"lib/nomad/model/acl_token_list_stub.ex">>, |
| 17 | - <<"lib/nomad/model/affinity.ex">>,<<"lib/nomad/model/agent_health.ex">>, |
| 18 | - <<"lib/nomad/model/agent_health_response.ex">>, |
| 19 | - <<"lib/nomad/model/agent_member.ex">>,<<"lib/nomad/model/agent_self.ex">>, |
| 20 | - <<"lib/nomad/model/alloc_deployment_status.ex">>, |
| 21 | - <<"lib/nomad/model/alloc_file_info.ex">>, |
| 22 | - <<"lib/nomad/model/alloc_resource_usage.ex">>, |
| 23 | - <<"lib/nomad/model/alloc_signal_request.ex">>, |
| 24 | - <<"lib/nomad/model/alloc_stop_response.ex">>, |
| 25 | - <<"lib/nomad/model/allocated_cpu_resources.ex">>, |
| 26 | - <<"lib/nomad/model/allocated_memory_resources.ex">>, |
| 27 | - <<"lib/nomad/model/allocated_resources.ex">>, |
| 28 | - <<"lib/nomad/model/allocated_shared_resources.ex">>, |
| 29 | - <<"lib/nomad/model/allocated_task_resources.ex">>, |
| 30 | - <<"lib/nomad/model/allocation.ex">>, |
| 31 | - <<"lib/nomad/model/allocation_list_stub.ex">>, |
| 32 | - <<"lib/nomad/model/allocation_metric.ex">>, |
| 33 | - <<"lib/nomad/model/allocation_restart_request.ex">>, |
| 34 | - <<"lib/nomad/model/attribute.ex">>, |
| 35 | - <<"lib/nomad/model/autopilot_configuration.ex">>, |
| 36 | - <<"lib/nomad/model/check_restart.ex">>,<<"lib/nomad/model/constraint.ex">>, |
| 37 | - <<"lib/nomad/model/consul_connect.ex">>, |
| 38 | - <<"lib/nomad/model/consul_proxy.ex">>, |
| 39 | - <<"lib/nomad/model/consul_sidecar_service.ex">>, |
| 40 | - <<"lib/nomad/model/consul_upstream.ex">>,<<"lib/nomad/model/cpu_stats.ex">>, |
| 41 | - <<"lib/nomad/model/csi_controller_info.ex">>, |
| 42 | - <<"lib/nomad/model/csi_info.ex">>, |
| 43 | - <<"lib/nomad/model/csi_mount_options.ex">>, |
| 44 | - <<"lib/nomad/model/csi_node_info.ex">>,<<"lib/nomad/model/csi_plugin.ex">>, |
| 45 | - <<"lib/nomad/model/csi_plugin_list_stub.ex">>, |
| 46 | - <<"lib/nomad/model/csi_topology.ex">>,<<"lib/nomad/model/csi_volume.ex">>, |
| 47 | - <<"lib/nomad/model/csi_volume_list_stub.ex">>, |
| 48 | - <<"lib/nomad/model/csi_volume_register_request.ex">>, |
| 49 | - <<"lib/nomad/model/deployment.ex">>, |
| 50 | - <<"lib/nomad/model/deployment_alloc_health_request.ex">>, |
| 51 | - <<"lib/nomad/model/deployment_fail_request.ex">>, |
| 52 | - <<"lib/nomad/model/deployment_pause_request.ex">>, |
| 53 | - <<"lib/nomad/model/deployment_promote_request.ex">>, |
| 54 | - <<"lib/nomad/model/deployment_state.ex">>, |
| 55 | - <<"lib/nomad/model/deployment_update_response.ex">>, |
| 56 | - <<"lib/nomad/model/desired_transition.ex">>, |
| 57 | - <<"lib/nomad/model/desired_updates.ex">>, |
| 58 | - <<"lib/nomad/model/device_group_stats.ex">>, |
| 59 | - <<"lib/nomad/model/device_stats.ex">>, |
| 60 | - <<"lib/nomad/model/dispatch_payload_config.ex">>, |
| 61 | - <<"lib/nomad/model/drain_spec.ex">>,<<"lib/nomad/model/drain_strategy.ex">>, |
| 62 | - <<"lib/nomad/model/driver_info.ex">>, |
| 63 | - <<"lib/nomad/model/ephemeral_disk.ex">>, |
| 64 | - <<"lib/nomad/model/eval_options.ex">>,<<"lib/nomad/model/evaluation.ex">>, |
| 65 | - <<"lib/nomad/model/field_diff.ex">>,<<"lib/nomad/model/host_cpu_stats.ex">>, |
| 66 | - <<"lib/nomad/model/host_disk_stats.ex">>, |
| 67 | - <<"lib/nomad/model/host_memory_stats.ex">>, |
| 68 | - <<"lib/nomad/model/host_stats.ex">>, |
| 69 | - <<"lib/nomad/model/host_volume_info.ex">>,<<"lib/nomad/model/job.ex">>, |
| 70 | - <<"lib/nomad/model/job_children_summary.ex">>, |
| 71 | - <<"lib/nomad/model/job_deregister_response.ex">>, |
| 72 | - <<"lib/nomad/model/job_diff.ex">>, |
| 73 | - <<"lib/nomad/model/job_dispatch_request.ex">>, |
| 74 | - <<"lib/nomad/model/job_dispatch_response.ex">>, |
| 75 | - <<"lib/nomad/model/job_evaluate_request.ex">>, |
| 76 | - <<"lib/nomad/model/job_list_stub.ex">>, |
| 77 | - <<"lib/nomad/model/job_plan_request.ex">>, |
| 78 | - <<"lib/nomad/model/job_plan_response.ex">>, |
| 79 | - <<"lib/nomad/model/job_register_response.ex">>, |
| 80 | - <<"lib/nomad/model/job_revert_request.ex">>, |
| 81 | - <<"lib/nomad/model/job_scale_status_response.ex">>, |
| 82 | - <<"lib/nomad/model/job_stability_request.ex">>, |
| 83 | - <<"lib/nomad/model/job_stability_response.ex">>, |
| 84 | - <<"lib/nomad/model/job_summary.ex">>, |
| 85 | - <<"lib/nomad/model/job_validate_request.ex">>, |
| 86 | - <<"lib/nomad/model/job_validate_response.ex">>, |
| 87 | - <<"lib/nomad/model/job_versions_response.ex">>, |
| 88 | - <<"lib/nomad/model/jobs_parse_request.ex">>, |
| 89 | - <<"lib/nomad/model/join_response.ex">>, |
| 90 | - <<"lib/nomad/model/keyring_request.ex">>, |
| 91 | - <<"lib/nomad/model/keyring_response.ex">>, |
| 92 | - <<"lib/nomad/model/log_config.ex">>,<<"lib/nomad/model/memory_stats.ex">>, |
| 93 | - <<"lib/nomad/model/migrate_strategy.ex">>, |
| 94 | - <<"lib/nomad/model/monitor_message.ex">>,<<"lib/nomad/model/namespace.ex">>, |
| 95 | - <<"lib/nomad/model/network_dns.ex">>, |
| 96 | - <<"lib/nomad/model/network_resource.ex">>,<<"lib/nomad/model/node.ex">>, |
| 97 | - <<"lib/nomad/model/node_cpu_resources.ex">>, |
| 98 | - <<"lib/nomad/model/node_device.ex">>, |
| 99 | - <<"lib/nomad/model/node_device_locality.ex">>, |
| 100 | - <<"lib/nomad/model/node_device_resource.ex">>, |
| 101 | - <<"lib/nomad/model/node_disk_resources.ex">>, |
| 102 | - <<"lib/nomad/model/node_drain_update_response.ex">>, |
| 103 | - <<"lib/nomad/model/node_eligibility_update_response.ex">>, |
| 104 | - <<"lib/nomad/model/node_eval_response.ex">>, |
| 105 | - <<"lib/nomad/model/node_event.ex">>,<<"lib/nomad/model/node_list_stub.ex">>, |
| 106 | - <<"lib/nomad/model/node_memory_resources.ex">>, |
| 107 | - <<"lib/nomad/model/node_reserved_cpu_resources.ex">>, |
| 108 | - <<"lib/nomad/model/node_reserved_disk_resources.ex">>, |
| 109 | - <<"lib/nomad/model/node_reserved_memory_resources.ex">>, |
| 110 | - <<"lib/nomad/model/node_reserved_network_resources.ex">>, |
| 111 | - <<"lib/nomad/model/node_reserved_resources.ex">>, |
| 112 | - <<"lib/nomad/model/node_resources.ex">>, |
| 113 | - <<"lib/nomad/model/node_score_meta.ex">>, |
| 114 | - <<"lib/nomad/model/node_update_drain_request.ex">>, |
| 115 | - <<"lib/nomad/model/node_update_eligibility_request.ex">>, |
| 116 | - <<"lib/nomad/model/object_diff.ex">>, |
| 117 | - <<"lib/nomad/model/operator_health_reply.ex">>, |
| 118 | - <<"lib/nomad/model/parameterized_job_config.ex">>, |
| 119 | - <<"lib/nomad/model/periodic_config.ex">>, |
| 120 | - <<"lib/nomad/model/periodic_force_response.ex">>, |
| 121 | - <<"lib/nomad/model/plan_annotations.ex">>,<<"lib/nomad/model/port.ex">>, |
| 122 | - <<"lib/nomad/model/preemption_config.ex">>, |
| 123 | - <<"lib/nomad/model/query_options.ex">>,<<"lib/nomad/model/quota_limit.ex">>, |
| 124 | - <<"lib/nomad/model/quota_spec.ex">>,<<"lib/nomad/model/quota_usage.ex">>, |
| 125 | - <<"lib/nomad/model/raft_configuration.ex">>, |
| 126 | - <<"lib/nomad/model/raft_server.ex">>, |
| 127 | - <<"lib/nomad/model/register_job_request.ex">>, |
| 128 | - <<"lib/nomad/model/requested_device.ex">>, |
| 129 | - <<"lib/nomad/model/reschedule_event.ex">>, |
| 130 | - <<"lib/nomad/model/reschedule_policy.ex">>, |
| 131 | - <<"lib/nomad/model/reschedule_tracker.ex">>, |
| 132 | - <<"lib/nomad/model/resource_usage.ex">>,<<"lib/nomad/model/resources.ex">>, |
| 133 | - <<"lib/nomad/model/restart_policy.ex">>, |
| 134 | - <<"lib/nomad/model/scaling_event.ex">>, |
| 135 | - <<"lib/nomad/model/scaling_policy.ex">>, |
| 136 | - <<"lib/nomad/model/scaling_policy_list_stub.ex">>, |
| 137 | - <<"lib/nomad/model/scaling_request.ex">>, |
| 138 | - <<"lib/nomad/model/scheduler_configuration.ex">>, |
| 139 | - <<"lib/nomad/model/scheduler_configuration_response.ex">>, |
| 140 | - <<"lib/nomad/model/scheduler_set_configuration_response.ex">>, |
| 141 | - <<"lib/nomad/model/search_request.ex">>, |
| 142 | - <<"lib/nomad/model/search_response.ex">>, |
| 143 | - <<"lib/nomad/model/sentinel_policy.ex">>, |
| 144 | - <<"lib/nomad/model/sentinel_policy_list_stub.ex">>, |
| 145 | - <<"lib/nomad/model/server_health.ex">>, |
| 146 | - <<"lib/nomad/model/server_members.ex">>,<<"lib/nomad/model/service.ex">>, |
| 147 | - <<"lib/nomad/model/service_check.ex">>, |
| 148 | - <<"lib/nomad/model/sidecar_task.ex">>,<<"lib/nomad/model/spread.ex">>, |
| 149 | - <<"lib/nomad/model/spread_target.ex">>,<<"lib/nomad/model/stat_object.ex">>, |
| 150 | - <<"lib/nomad/model/stat_value.ex">>,<<"lib/nomad/model/stream_frame.ex">>, |
| 151 | - <<"lib/nomad/model/task.ex">>,<<"lib/nomad/model/task_artifact.ex">>, |
| 152 | - <<"lib/nomad/model/task_csi_plugin_config.ex">>, |
| 153 | - <<"lib/nomad/model/task_diff.ex">>,<<"lib/nomad/model/task_event.ex">>, |
| 154 | - <<"lib/nomad/model/task_group.ex">>, |
| 155 | - <<"lib/nomad/model/task_group_diff.ex">>, |
| 156 | - <<"lib/nomad/model/task_group_scale_status.ex">>, |
| 157 | - <<"lib/nomad/model/task_group_summary.ex">>, |
| 158 | - <<"lib/nomad/model/task_lifecycle.ex">>, |
| 159 | - <<"lib/nomad/model/task_resource_usage.ex">>, |
| 160 | - <<"lib/nomad/model/task_state.ex">>,<<"lib/nomad/model/template.ex">>, |
| 161 | - <<"lib/nomad/model/update_strategy.ex">>,<<"lib/nomad/model/vault.ex">>, |
| 162 | - <<"lib/nomad/model/volume_mount.ex">>, |
| 163 | - <<"lib/nomad/model/volume_request.ex">>,<<"lib/nomad/request_builder.ex">>, |
| 164 | - <<"mix.exs">>,<<"README.md">>,<<"LICENSE">>]}. |
| 6 | + [<<"lib">>,<<"lib/nomad_client">>,<<"lib/nomad_client/model">>, |
| 7 | + <<"lib/nomad_client/model/acl_policy.ex">>, |
| 8 | + <<"lib/nomad_client/model/acl_policy_list_stub.ex">>, |
| 9 | + <<"lib/nomad_client/model/acl_token.ex">>, |
| 10 | + <<"lib/nomad_client/model/acl_token_list_stub.ex">>, |
| 11 | + <<"lib/nomad_client/model/affinity.ex">>, |
| 12 | + <<"lib/nomad_client/model/agent_health.ex">>, |
| 13 | + <<"lib/nomad_client/model/agent_health_response.ex">>, |
| 14 | + <<"lib/nomad_client/model/agent_member.ex">>, |
| 15 | + <<"lib/nomad_client/model/agent_self.ex">>, |
| 16 | + <<"lib/nomad_client/model/alloc_deployment_status.ex">>, |
| 17 | + <<"lib/nomad_client/model/alloc_file_info.ex">>, |
| 18 | + <<"lib/nomad_client/model/alloc_resource_usage.ex">>, |
| 19 | + <<"lib/nomad_client/model/alloc_signal_request.ex">>, |
| 20 | + <<"lib/nomad_client/model/alloc_stop_response.ex">>, |
| 21 | + <<"lib/nomad_client/model/allocated_cpu_resources.ex">>, |
| 22 | + <<"lib/nomad_client/model/allocated_memory_resources.ex">>, |
| 23 | + <<"lib/nomad_client/model/allocated_resources.ex">>, |
| 24 | + <<"lib/nomad_client/model/allocated_shared_resources.ex">>, |
| 25 | + <<"lib/nomad_client/model/allocated_task_resources.ex">>, |
| 26 | + <<"lib/nomad_client/model/allocation.ex">>, |
| 27 | + <<"lib/nomad_client/model/allocation_list_stub.ex">>, |
| 28 | + <<"lib/nomad_client/model/allocation_metric.ex">>, |
| 29 | + <<"lib/nomad_client/model/allocation_restart_request.ex">>, |
| 30 | + <<"lib/nomad_client/model/attribute.ex">>, |
| 31 | + <<"lib/nomad_client/model/autopilot_configuration.ex">>, |
| 32 | + <<"lib/nomad_client/model/check_restart.ex">>, |
| 33 | + <<"lib/nomad_client/model/constraint.ex">>, |
| 34 | + <<"lib/nomad_client/model/consul_connect.ex">>, |
| 35 | + <<"lib/nomad_client/model/consul_proxy.ex">>, |
| 36 | + <<"lib/nomad_client/model/consul_sidecar_service.ex">>, |
| 37 | + <<"lib/nomad_client/model/consul_upstream.ex">>, |
| 38 | + <<"lib/nomad_client/model/cpu_stats.ex">>, |
| 39 | + <<"lib/nomad_client/model/csi_controller_info.ex">>, |
| 40 | + <<"lib/nomad_client/model/csi_info.ex">>, |
| 41 | + <<"lib/nomad_client/model/csi_mount_options.ex">>, |
| 42 | + <<"lib/nomad_client/model/csi_node_info.ex">>, |
| 43 | + <<"lib/nomad_client/model/csi_plugin.ex">>, |
| 44 | + <<"lib/nomad_client/model/csi_plugin_list_stub.ex">>, |
| 45 | + <<"lib/nomad_client/model/csi_topology.ex">>, |
| 46 | + <<"lib/nomad_client/model/csi_volume.ex">>, |
| 47 | + <<"lib/nomad_client/model/csi_volume_list_stub.ex">>, |
| 48 | + <<"lib/nomad_client/model/csi_volume_register_request.ex">>, |
| 49 | + <<"lib/nomad_client/model/deployment.ex">>, |
| 50 | + <<"lib/nomad_client/model/deployment_alloc_health_request.ex">>, |
| 51 | + <<"lib/nomad_client/model/deployment_fail_request.ex">>, |
| 52 | + <<"lib/nomad_client/model/deployment_pause_request.ex">>, |
| 53 | + <<"lib/nomad_client/model/deployment_promote_request.ex">>, |
| 54 | + <<"lib/nomad_client/model/deployment_state.ex">>, |
| 55 | + <<"lib/nomad_client/model/deployment_update_response.ex">>, |
| 56 | + <<"lib/nomad_client/model/desired_transition.ex">>, |
| 57 | + <<"lib/nomad_client/model/desired_updates.ex">>, |
| 58 | + <<"lib/nomad_client/model/device_group_stats.ex">>, |
| 59 | + <<"lib/nomad_client/model/device_stats.ex">>, |
| 60 | + <<"lib/nomad_client/model/dispatch_payload_config.ex">>, |
| 61 | + <<"lib/nomad_client/model/drain_spec.ex">>, |
| 62 | + <<"lib/nomad_client/model/drain_strategy.ex">>, |
| 63 | + <<"lib/nomad_client/model/driver_info.ex">>, |
| 64 | + <<"lib/nomad_client/model/ephemeral_disk.ex">>, |
| 65 | + <<"lib/nomad_client/model/eval_options.ex">>, |
| 66 | + <<"lib/nomad_client/model/evaluation.ex">>, |
| 67 | + <<"lib/nomad_client/model/field_diff.ex">>, |
| 68 | + <<"lib/nomad_client/model/host_cpu_stats.ex">>, |
| 69 | + <<"lib/nomad_client/model/host_disk_stats.ex">>, |
| 70 | + <<"lib/nomad_client/model/host_memory_stats.ex">>, |
| 71 | + <<"lib/nomad_client/model/host_stats.ex">>, |
| 72 | + <<"lib/nomad_client/model/host_volume_info.ex">>, |
| 73 | + <<"lib/nomad_client/model/job.ex">>, |
| 74 | + <<"lib/nomad_client/model/job_children_summary.ex">>, |
| 75 | + <<"lib/nomad_client/model/job_deregister_response.ex">>, |
| 76 | + <<"lib/nomad_client/model/job_diff.ex">>, |
| 77 | + <<"lib/nomad_client/model/job_dispatch_request.ex">>, |
| 78 | + <<"lib/nomad_client/model/job_dispatch_response.ex">>, |
| 79 | + <<"lib/nomad_client/model/job_evaluate_request.ex">>, |
| 80 | + <<"lib/nomad_client/model/job_list_stub.ex">>, |
| 81 | + <<"lib/nomad_client/model/job_plan_request.ex">>, |
| 82 | + <<"lib/nomad_client/model/job_plan_response.ex">>, |
| 83 | + <<"lib/nomad_client/model/job_register_response.ex">>, |
| 84 | + <<"lib/nomad_client/model/job_revert_request.ex">>, |
| 85 | + <<"lib/nomad_client/model/job_scale_status_response.ex">>, |
| 86 | + <<"lib/nomad_client/model/job_stability_request.ex">>, |
| 87 | + <<"lib/nomad_client/model/job_stability_response.ex">>, |
| 88 | + <<"lib/nomad_client/model/job_summary.ex">>, |
| 89 | + <<"lib/nomad_client/model/job_validate_request.ex">>, |
| 90 | + <<"lib/nomad_client/model/job_validate_response.ex">>, |
| 91 | + <<"lib/nomad_client/model/job_versions_response.ex">>, |
| 92 | + <<"lib/nomad_client/model/jobs_parse_request.ex">>, |
| 93 | + <<"lib/nomad_client/model/join_response.ex">>, |
| 94 | + <<"lib/nomad_client/model/keyring_request.ex">>, |
| 95 | + <<"lib/nomad_client/model/keyring_response.ex">>, |
| 96 | + <<"lib/nomad_client/model/log_config.ex">>, |
| 97 | + <<"lib/nomad_client/model/memory_stats.ex">>, |
| 98 | + <<"lib/nomad_client/model/migrate_strategy.ex">>, |
| 99 | + <<"lib/nomad_client/model/monitor_message.ex">>, |
| 100 | + <<"lib/nomad_client/model/namespace.ex">>, |
| 101 | + <<"lib/nomad_client/model/network_dns.ex">>, |
| 102 | + <<"lib/nomad_client/model/network_resource.ex">>, |
| 103 | + <<"lib/nomad_client/model/node.ex">>, |
| 104 | + <<"lib/nomad_client/model/node_cpu_resources.ex">>, |
| 105 | + <<"lib/nomad_client/model/node_device.ex">>, |
| 106 | + <<"lib/nomad_client/model/node_device_locality.ex">>, |
| 107 | + <<"lib/nomad_client/model/node_device_resource.ex">>, |
| 108 | + <<"lib/nomad_client/model/node_disk_resources.ex">>, |
| 109 | + <<"lib/nomad_client/model/node_drain_update_response.ex">>, |
| 110 | + <<"lib/nomad_client/model/node_eligibility_update_response.ex">>, |
| 111 | + <<"lib/nomad_client/model/node_eval_response.ex">>, |
| 112 | + <<"lib/nomad_client/model/node_event.ex">>, |
| 113 | + <<"lib/nomad_client/model/node_list_stub.ex">>, |
| 114 | + <<"lib/nomad_client/model/node_memory_resources.ex">>, |
| 115 | + <<"lib/nomad_client/model/node_reserved_cpu_resources.ex">>, |
| 116 | + <<"lib/nomad_client/model/node_reserved_disk_resources.ex">>, |
| 117 | + <<"lib/nomad_client/model/node_reserved_memory_resources.ex">>, |
| 118 | + <<"lib/nomad_client/model/node_reserved_network_resources.ex">>, |
| 119 | + <<"lib/nomad_client/model/node_reserved_resources.ex">>, |
| 120 | + <<"lib/nomad_client/model/node_resources.ex">>, |
| 121 | + <<"lib/nomad_client/model/node_score_meta.ex">>, |
| 122 | + <<"lib/nomad_client/model/node_update_drain_request.ex">>, |
| 123 | + <<"lib/nomad_client/model/node_update_eligibility_request.ex">>, |
| 124 | + <<"lib/nomad_client/model/object_diff.ex">>, |
| 125 | + <<"lib/nomad_client/model/operator_health_reply.ex">>, |
| 126 | + <<"lib/nomad_client/model/parameterized_job_config.ex">>, |
| 127 | + <<"lib/nomad_client/model/periodic_config.ex">>, |
| 128 | + <<"lib/nomad_client/model/periodic_force_response.ex">>, |
| 129 | + <<"lib/nomad_client/model/plan_annotations.ex">>, |
| 130 | + <<"lib/nomad_client/model/port.ex">>, |
| 131 | + <<"lib/nomad_client/model/preemption_config.ex">>, |
| 132 | + <<"lib/nomad_client/model/query_options.ex">>, |
| 133 | + <<"lib/nomad_client/model/quota_limit.ex">>, |
| 134 | + <<"lib/nomad_client/model/quota_spec.ex">>, |
| 135 | + <<"lib/nomad_client/model/quota_usage.ex">>, |
| 136 | + <<"lib/nomad_client/model/raft_configuration.ex">>, |
| 137 | + <<"lib/nomad_client/model/raft_server.ex">>, |
| 138 | + <<"lib/nomad_client/model/register_job_request.ex">>, |
| 139 | + <<"lib/nomad_client/model/requested_device.ex">>, |
| 140 | + <<"lib/nomad_client/model/reschedule_event.ex">>, |
| 141 | + <<"lib/nomad_client/model/reschedule_policy.ex">>, |
| 142 | + <<"lib/nomad_client/model/reschedule_tracker.ex">>, |
| 143 | + <<"lib/nomad_client/model/resource_usage.ex">>, |
| 144 | + <<"lib/nomad_client/model/resources.ex">>, |
| 145 | + <<"lib/nomad_client/model/restart_policy.ex">>, |
| 146 | + <<"lib/nomad_client/model/scaling_event.ex">>, |
| 147 | + <<"lib/nomad_client/model/scaling_policy.ex">>, |
| 148 | + <<"lib/nomad_client/model/scaling_policy_list_stub.ex">>, |
| 149 | + <<"lib/nomad_client/model/scaling_request.ex">>, |
| 150 | + <<"lib/nomad_client/model/scheduler_configuration.ex">>, |
| 151 | + <<"lib/nomad_client/model/scheduler_configuration_response.ex">>, |
| 152 | + <<"lib/nomad_client/model/scheduler_set_configuration_response.ex">>, |
| 153 | + <<"lib/nomad_client/model/search_request.ex">>, |
| 154 | + <<"lib/nomad_client/model/search_response.ex">>, |
| 155 | + <<"lib/nomad_client/model/sentinel_policy.ex">>, |
| 156 | + <<"lib/nomad_client/model/sentinel_policy_list_stub.ex">>, |
| 157 | + <<"lib/nomad_client/model/server_health.ex">>, |
| 158 | + <<"lib/nomad_client/model/server_members.ex">>, |
| 159 | + <<"lib/nomad_client/model/service.ex">>, |
| 160 | + <<"lib/nomad_client/model/service_check.ex">>, |
| 161 | + <<"lib/nomad_client/model/sidecar_task.ex">>, |
| 162 | + <<"lib/nomad_client/model/spread.ex">>, |
| 163 | + <<"lib/nomad_client/model/spread_target.ex">>, |
| 164 | + <<"lib/nomad_client/model/stat_object.ex">>, |
| 165 | + <<"lib/nomad_client/model/stat_value.ex">>, |
| 166 | + <<"lib/nomad_client/model/stream_frame.ex">>, |
| 167 | + <<"lib/nomad_client/model/task.ex">>, |
| 168 | + <<"lib/nomad_client/model/task_artifact.ex">>, |
| 169 | + <<"lib/nomad_client/model/task_csi_plugin_config.ex">>, |
| 170 | + <<"lib/nomad_client/model/task_diff.ex">>, |
| 171 | + <<"lib/nomad_client/model/task_event.ex">>, |
| 172 | + <<"lib/nomad_client/model/task_group.ex">>, |
| 173 | + <<"lib/nomad_client/model/task_group_diff.ex">>, |
| 174 | + <<"lib/nomad_client/model/task_group_scale_status.ex">>, |
| 175 | + <<"lib/nomad_client/model/task_group_summary.ex">>, |
| 176 | + <<"lib/nomad_client/model/task_lifecycle.ex">>, |
| 177 | + <<"lib/nomad_client/model/task_resource_usage.ex">>, |
| 178 | + <<"lib/nomad_client/model/task_state.ex">>, |
| 179 | + <<"lib/nomad_client/model/template.ex">>, |
| 180 | + <<"lib/nomad_client/model/update_strategy.ex">>, |
| 181 | + <<"lib/nomad_client/model/vault.ex">>, |
| 182 | + <<"lib/nomad_client/model/volume_mount.ex">>, |
| 183 | + <<"lib/nomad_client/model/volume_request.ex">>,<<"lib/nomad_client/api">>, |
| 184 | + <<"lib/nomad_client/api/agent.ex">>, |
| 185 | + <<"lib/nomad_client/api/allocations.ex">>, |
| 186 | + <<"lib/nomad_client/api/client.ex">>, |
| 187 | + <<"lib/nomad_client/api/deployments.ex">>, |
| 188 | + <<"lib/nomad_client/api/evaluations.ex">>, |
| 189 | + <<"lib/nomad_client/api/jobs.ex">>,<<"lib/nomad_client/api/nodes.ex">>, |
| 190 | + <<"lib/nomad_client/api/regions.ex">>,<<"lib/nomad_client/api/status.ex">>, |
| 191 | + <<"lib/nomad_client/api/system.ex">>,<<"lib/nomad_client/api/volumes.ex">>, |
| 192 | + <<"lib/nomad_client/connection.ex">>, |
| 193 | + <<"lib/nomad_client/request_builder.ex">>, |
| 194 | + <<"lib/nomad_client/deserializer.ex">>,<<"mix.exs">>,<<"README.md">>, |
| 195 | + <<"LICENSE">>]}. |
| 165 196 | {<<"licenses">>,[<<"Apache-2.0">>]}. |
| 166 197 | {<<"links">>,[{<<"GitHub">>,<<"https://github.com/mrmstn/nomad_client">>}]}. |
| 167 198 | {<<"name">>,<<"nomad_client">>}. |
| @@ -175,5 +206,10 @@ | |
| 175 206 | {<<"name">>,<<"poison">>}, |
| 176 207 | {<<"optional">>,false}, |
| 177 208 | {<<"repository">>,<<"hexpm">>}, |
| 178 | - {<<"requirement">>,<<"~> 3.0">>}]]}. |
| 179 | - {<<"version">>,<<"0.10.0">>}. |
| 209 | + {<<"requirement">>,<<"~> 3.0">>}], |
| 210 | + [{<<"app">>,<<"hackney">>}, |
| 211 | + {<<"name">>,<<"hackney">>}, |
| 212 | + {<<"optional">>,true}, |
| 213 | + {<<"repository">>,<<"hexpm">>}, |
| 214 | + {<<"requirement">>,<<"~> 1.0">>}]]}. |
| 215 | + {<<"version">>,<<"0.11.0">>}. |
| @@ -1,235 +0,0 @@ | |
| 1 | - # NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 2 | - # https://openapi-generator.tech |
| 3 | - # Do not edit the class manually. |
| 4 | - |
| 5 | - defmodule Nomad.Api.Agent do |
| 6 | - @moduledoc """ |
| 7 | - API calls for all endpoints tagged `Agent`. |
| 8 | - """ |
| 9 | - |
| 10 | - alias Nomad.Connection |
| 11 | - import Nomad.RequestBuilder |
| 12 | - |
| 13 | - @doc """ |
| 14 | - Forces a member of the gossip pool from the \"failed\" state into the \"left\" state. |
| 15 | - |
| 16 | - ## Parameters |
| 17 | - |
| 18 | - - connection (Nomad.Connection): Connection to server |
| 19 | - - node (String.t): the name of the node |
| 20 | - - opts (KeywordList): [optional] Optional parameters |
| 21 | - ## Returns |
| 22 | - |
| 23 | - {:ok, nil} on success |
| 24 | - {:error, Tesla.Env.t} on failure |
| 25 | - """ |
| 26 | - @spec force_leave(Tesla.Env.client(), String.t(), keyword()) :: |
| 27 | - {:ok, nil} | {:error, Tesla.Env.t()} |
| 28 | - def force_leave(connection, node, _opts \\ []) do |
| 29 | - %{} |
| 30 | - |> method(:post) |
| 31 | - |> url("/agent/force-leave") |
| 32 | - |> add_param(:query, :node, node) |
| 33 | - |> ensure_body() |
| 34 | - |> Enum.into([]) |
| 35 | - |> (&Connection.request(connection, &1)).() |
| 36 | - |> evaluate_response([ |
| 37 | - {200, false} |
| 38 | - ]) |
| 39 | - end |
| 40 | - |
| 41 | - @doc """ |
| 42 | - Performs a basic healthcheck |
| 43 | - |
| 44 | - ## Parameters |
| 45 | - |
| 46 | - - connection (Nomad.Connection): Connection to server |
| 47 | - - opts (KeywordList): [optional] Optional parameters |
| 48 | - ## Returns |
| 49 | - |
| 50 | - {:ok, Nomad.Model.AgentHealthResponse.t} on success |
| 51 | - {:error, Tesla.Env.t} on failure |
| 52 | - """ |
| 53 | - @spec get_health(Tesla.Env.client(), keyword()) :: |
| 54 | - {:ok, Nomad.Model.AgentHealthResponse.t()} | {:error, Tesla.Env.t()} |
| 55 | - def get_health(connection, _opts \\ []) do |
| 56 | - %{} |
| 57 | - |> method(:get) |
| 58 | - |> url("/agent/health") |
| 59 | - |> Enum.into([]) |
| 60 | - |> (&Connection.request(connection, &1)).() |
| 61 | - |> evaluate_response([ |
| 62 | - {200, %Nomad.Model.AgentHealthResponse{}} |
| 63 | - ]) |
| 64 | - end |
| 65 | - |
| 66 | - @doc """ |
| 67 | - Queries for the known peers in the gossip pool |
| 68 | - |
| 69 | - ## Parameters |
| 70 | - |
| 71 | - - connection (Nomad.Connection): Connection to server |
| 72 | - - opts (KeywordList): [optional] Optional parameters |
| 73 | - ## Returns |
| 74 | - |
| 75 | - {:ok, Nomad.Model.ServerMembers.t} on success |
| 76 | - {:error, Tesla.Env.t} on failure |
| 77 | - """ |
| 78 | - @spec get_members(Tesla.Env.client(), keyword()) :: |
| 79 | - {:ok, Nomad.Model.ServerMembers.t()} | {:error, Tesla.Env.t()} |
| 80 | - def get_members(connection, _opts \\ []) do |
| 81 | - %{} |
| 82 | - |> method(:get) |
| 83 | - |> url("/agent/members") |
| 84 | - |> Enum.into([]) |
| 85 | - |> (&Connection.request(connection, &1)).() |
| 86 | - |> evaluate_response([ |
| 87 | - {200, %Nomad.Model.ServerMembers{}} |
| 88 | - ]) |
| 89 | - end |
| 90 | - |
| 91 | - @doc """ |
| 92 | - Queries for information about the agent we are connected to |
| 93 | - |
| 94 | - ## Parameters |
| 95 | - |
| 96 | - - connection (Nomad.Connection): Connection to server |
| 97 | - - opts (KeywordList): [optional] Optional parameters |
| 98 | - ## Returns |
| 99 | - |
| 100 | - {:ok, Nomad.Model.AgentSelf.t} on success |
| 101 | - {:error, Tesla.Env.t} on failure |
| 102 | - """ |
| 103 | - @spec get_self(Tesla.Env.client(), keyword()) :: |
| 104 | - {:ok, Nomad.Model.AgentSelf.t()} | {:error, Tesla.Env.t()} |
| 105 | - def get_self(connection, _opts \\ []) do |
| 106 | - %{} |
| 107 | - |> method(:get) |
| 108 | - |> url("/agent/self") |
| 109 | - |> Enum.into([]) |
| 110 | - |> (&Connection.request(connection, &1)).() |
| 111 | - |> evaluate_response([ |
| 112 | - {200, %Nomad.Model.AgentSelf{}} |
| 113 | - ]) |
| 114 | - end |
| 115 | - |
| 116 | - @doc """ |
| 117 | - Queries an agent in client mode for its list of known servers |
| 118 | - |
| 119 | - ## Parameters |
| 120 | - |
| 121 | - - connection (Nomad.Connection): Connection to server |
| 122 | - - opts (KeywordList): [optional] Optional parameters |
| 123 | - ## Returns |
| 124 | - |
| 125 | - {:ok, [%String{}, ...]} on success |
| 126 | - {:error, Tesla.Env.t} on failure |
| 127 | - """ |
| 128 | - @spec get_servers(Tesla.Env.client(), keyword()) :: |
| 129 | - {:ok, list(String.t())} | {:error, Tesla.Env.t()} |
| 130 | - def get_servers(connection, _opts \\ []) do |
| 131 | - %{} |
| 132 | - |> method(:get) |
| 133 | - |> url("/agent/servers") |
| 134 | - |> Enum.into([]) |
| 135 | - |> (&Connection.request(connection, &1)).() |
| 136 | - |> evaluate_response([ |
| 137 | - {200, []} |
| 138 | - ]) |
| 139 | - end |
| 140 | - |
| 141 | - @doc """ |
| 142 | - Causes the agent to join a cluster by joining the gossip pool at one of the given addresses |
| 143 | - |
| 144 | - ## Parameters |
| 145 | - |
| 146 | - - connection (Nomad.Connection): Connection to server |
| 147 | - - address ([String.t]): server address (ip:port) |
| 148 | - - opts (KeywordList): [optional] Optional parameters |
| 149 | - ## Returns |
| 150 | - |
| 151 | - {:ok, Nomad.Model.JoinResponse.t} on success |
| 152 | - {:error, Tesla.Env.t} on failure |
| 153 | - """ |
| 154 | - @spec join(Tesla.Env.client(), list(String.t()), keyword()) :: |
| 155 | - {:ok, Nomad.Model.JoinResponse.t()} | {:error, Tesla.Env.t()} |
| 156 | - def join(connection, address, _opts \\ []) do |
| 157 | - %{} |
| 158 | - |> method(:post) |
| 159 | - |> url("/agent/join") |
| 160 | - |> add_param(:query, :address, address) |
| 161 | - |> ensure_body() |
| 162 | - |> Enum.into([]) |
| 163 | - |> (&Connection.request(connection, &1)).() |
| 164 | - |> evaluate_response([ |
| 165 | - {200, %Nomad.Model.JoinResponse{}} |
| 166 | - ]) |
| 167 | - end |
| 168 | - |
| 169 | - @doc """ |
| 170 | - Streams logs from a specific Nomad server node |
| 171 | - |
| 172 | - ## Parameters |
| 173 | - |
| 174 | - - connection (Nomad.Connection): Connection to server |
| 175 | - - opts (KeywordList): [optional] Optional parameters |
| 176 | - - :log_level (String.t): log level |
| 177 | - - :node_id (String.t): node id |
| 178 | - - :server_id (String.t): server id |
| 179 | - - :json (boolean()): is json format |
| 180 | - - :plain (boolean()): is plain text format |
| 181 | - ## Returns |
| 182 | - |
| 183 | - {:ok, Nomad.Model.StreamFrame.t} on success |
| 184 | - {:error, Tesla.Env.t} on failure |
| 185 | - """ |
| 186 | - @spec stream_logs(Tesla.Env.client(), keyword()) :: |
| 187 | - {:ok, Nomad.Model.StreamFrame.t()} | {:error, Tesla.Env.t()} |
| 188 | - def stream_logs(connection, opts \\ []) do |
| 189 | - optional_params = %{ |
| 190 | - :log_level => :query, |
| 191 | - :node_id => :query, |
| 192 | - :server_id => :query, |
| 193 | - :json => :query, |
| 194 | - :plain => :query |
| 195 | - } |
| 196 | - |
| 197 | - %{} |
| 198 | - |> method(:get) |
| 199 | - |> url("/agent/monitor") |
| 200 | - |> add_optional_params(optional_params, opts) |
| 201 | - |> Enum.into([]) |
| 202 | - |> (&Connection.request(connection, &1)).() |
| 203 | - |> evaluate_response([ |
| 204 | - {200, %Nomad.Model.StreamFrame{}} |
| 205 | - ]) |
| 206 | - end |
| 207 | - |
| 208 | - @doc """ |
| 209 | - Updates the list of known servers to the given addresses, replacing all previous addresses |
| 210 | - |
| 211 | - ## Parameters |
| 212 | - |
| 213 | - - connection (Nomad.Connection): Connection to server |
| 214 | - - address ([String.t]): server address (ip:port) |
| 215 | - - opts (KeywordList): [optional] Optional parameters |
| 216 | - ## Returns |
| 217 | - |
| 218 | - {:ok, [%String{}, ...]} on success |
| 219 | - {:error, Tesla.Env.t} on failure |
| 220 | - """ |
| 221 | - @spec update_servers(Tesla.Env.client(), list(String.t()), keyword()) :: |
| 222 | - {:ok, list(String.t())} | {:error, Tesla.Env.t()} |
| 223 | - def update_servers(connection, address, _opts \\ []) do |
| 224 | - %{} |
| 225 | - |> method(:post) |
| 226 | - |> url("/agent/servers") |
| 227 | - |> add_param(:query, :address, address) |
| 228 | - |> ensure_body() |
| 229 | - |> Enum.into([]) |
| 230 | - |> (&Connection.request(connection, &1)).() |
| 231 | - |> evaluate_response([ |
| 232 | - {200, []} |
| 233 | - ]) |
| 234 | - end |
| 235 | - end |
| @@ -1,162 +0,0 @@ | |
| 1 | - # NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 2 | - # https://openapi-generator.tech |
| 3 | - # Do not edit the class manually. |
| 4 | - |
| 5 | - defmodule Nomad.Api.Allocations do |
| 6 | - @moduledoc """ |
| 7 | - API calls for all endpoints tagged `Allocations`. |
| 8 | - """ |
| 9 | - |
| 10 | - alias Nomad.Connection |
| 11 | - import Nomad.RequestBuilder |
| 12 | - |
| 13 | - @doc """ |
| 14 | - reads information about a specific allocation |
| 15 | - |
| 16 | - ## Parameters |
| 17 | - |
| 18 | - - connection (Nomad.Connection): Connection to server |
| 19 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 20 | - - opts (KeywordList): [optional] Optional parameters |
| 21 | - ## Returns |
| 22 | - |
| 23 | - {:ok, Nomad.Model.Allocation.t} on success |
| 24 | - {:error, Tesla.Env.t} on failure |
| 25 | - """ |
| 26 | - @spec get_allocation(Tesla.Env.client(), String.t(), keyword()) :: |
| 27 | - {:ok, Nomad.Model.Allocation.t()} | {:error, Tesla.Env.t()} |
| 28 | - def get_allocation(connection, alloc_id, _opts \\ []) do |
| 29 | - %{} |
| 30 | - |> method(:get) |
| 31 | - |> url("/allocation/#{alloc_id}") |
| 32 | - |> Enum.into([]) |
| 33 | - |> (&Connection.request(connection, &1)).() |
| 34 | - |> evaluate_response([ |
| 35 | - {200, %Nomad.Model.Allocation{}} |
| 36 | - ]) |
| 37 | - end |
| 38 | - |
| 39 | - @doc """ |
| 40 | - query for and interact with allocations |
| 41 | - |
| 42 | - ## Parameters |
| 43 | - |
| 44 | - - connection (Nomad.Connection): Connection to server |
| 45 | - - opts (KeywordList): [optional] Optional parameters |
| 46 | - - :prefix (String.t): Specifies a string to filter jobs on based on an index prefix. This is specified as a query string parameter |
| 47 | - ## Returns |
| 48 | - |
| 49 | - {:ok, [%AllocationListStub{}, ...]} on success |
| 50 | - {:error, Tesla.Env.t} on failure |
| 51 | - """ |
| 52 | - @spec get_allocations(Tesla.Env.client(), keyword()) :: |
| 53 | - {:ok, list(Nomad.Model.AllocationListStub.t())} | {:error, Tesla.Env.t()} |
| 54 | - def get_allocations(connection, opts \\ []) do |
| 55 | - optional_params = %{ |
| 56 | - :prefix => :query |
| 57 | - } |
| 58 | - |
| 59 | - %{} |
| 60 | - |> method(:get) |
| 61 | - |> url("/allocations") |
| 62 | - |> add_optional_params(optional_params, opts) |
| 63 | - |> Enum.into([]) |
| 64 | - |> (&Connection.request(connection, &1)).() |
| 65 | - |> evaluate_response([ |
| 66 | - {200, [%Nomad.Model.AllocationListStub{}]} |
| 67 | - ]) |
| 68 | - end |
| 69 | - |
| 70 | - @doc """ |
| 71 | - restarts an allocation or task in-place |
| 72 | - |
| 73 | - ## Parameters |
| 74 | - |
| 75 | - - connection (Nomad.Connection): Connection to server |
| 76 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 77 | - - opts (KeywordList): [optional] Optional parameters |
| 78 | - - :body (AllocationRestartRequest): |
| 79 | - ## Returns |
| 80 | - |
| 81 | - {:ok, nil} on success |
| 82 | - {:error, Tesla.Env.t} on failure |
| 83 | - """ |
| 84 | - @spec restart_allocation(Tesla.Env.client(), String.t(), keyword()) :: |
| 85 | - {:ok, nil} | {:error, Tesla.Env.t()} |
| 86 | - def restart_allocation(connection, alloc_id, opts \\ []) do |
| 87 | - optional_params = %{ |
| 88 | - :body => :body |
| 89 | - } |
| 90 | - |
| 91 | - %{} |
| 92 | - |> method(:post) |
| 93 | - |> url("/allocation/#{alloc_id}/restart") |
| 94 | - |> add_optional_params(optional_params, opts) |
| 95 | - |> ensure_body() |
| 96 | - |> Enum.into([]) |
| 97 | - |> (&Connection.request(connection, &1)).() |
| 98 | - |> evaluate_response([ |
| 99 | - {200, false} |
| 100 | - ]) |
| 101 | - end |
| 102 | - |
| 103 | - @doc """ |
| 104 | - sends a signal to an allocation or task |
| 105 | - |
| 106 | - ## Parameters |
| 107 | - |
| 108 | - - connection (Nomad.Connection): Connection to server |
| 109 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 110 | - - opts (KeywordList): [optional] Optional parameters |
| 111 | - - :body (AllocSignalRequest): |
| 112 | - ## Returns |
| 113 | - |
| 114 | - {:ok, nil} on success |
| 115 | - {:error, Tesla.Env.t} on failure |
| 116 | - """ |
| 117 | - @spec signal_allocation(Tesla.Env.client(), String.t(), keyword()) :: |
| 118 | - {:ok, nil} | {:error, Tesla.Env.t()} |
| 119 | - def signal_allocation(connection, alloc_id, opts \\ []) do |
| 120 | - optional_params = %{ |
| 121 | - :body => :body |
| 122 | - } |
| 123 | - |
| 124 | - %{} |
| 125 | - |> method(:post) |
| 126 | - |> url("/allocation/#{alloc_id}/signal") |
| 127 | - |> add_optional_params(optional_params, opts) |
| 128 | - |> ensure_body() |
| 129 | - |> Enum.into([]) |
| 130 | - |> (&Connection.request(connection, &1)).() |
| 131 | - |> evaluate_response([ |
| 132 | - {200, false} |
| 133 | - ]) |
| 134 | - end |
| 135 | - |
| 136 | - @doc """ |
| 137 | - stops and reschedules a specific allocation |
| 138 | - |
| 139 | - ## Parameters |
| 140 | - |
| 141 | - - connection (Nomad.Connection): Connection to server |
| 142 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 143 | - - opts (KeywordList): [optional] Optional parameters |
| 144 | - ## Returns |
| 145 | - |
| 146 | - {:ok, Nomad.Model.AllocStopResponse.t} on success |
| 147 | - {:error, Tesla.Env.t} on failure |
| 148 | - """ |
| 149 | - @spec stop_allocation(Tesla.Env.client(), String.t(), keyword()) :: |
| 150 | - {:ok, Nomad.Model.AllocStopResponse.t()} | {:error, Tesla.Env.t()} |
| 151 | - def stop_allocation(connection, alloc_id, _opts \\ []) do |
| 152 | - %{} |
| 153 | - |> method(:post) |
| 154 | - |> url("/allocation/#{alloc_id}/stop") |
| 155 | - |> ensure_body() |
| 156 | - |> Enum.into([]) |
| 157 | - |> (&Connection.request(connection, &1)).() |
| 158 | - |> evaluate_response([ |
| 159 | - {200, %Nomad.Model.AllocStopResponse{}} |
| 160 | - ]) |
| 161 | - end |
| 162 | - end |
| @@ -1,338 +0,0 @@ | |
| 1 | - # NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 2 | - # https://openapi-generator.tech |
| 3 | - # Do not edit the class manually. |
| 4 | - |
| 5 | - defmodule Nomad.Api.Client do |
| 6 | - @moduledoc """ |
| 7 | - API calls for all endpoints tagged `Client`. |
| 8 | - """ |
| 9 | - |
| 10 | - alias Nomad.Connection |
| 11 | - import Nomad.RequestBuilder |
| 12 | - |
| 13 | - @doc """ |
| 14 | - forces a garbage collection of a particular, stopped allocation on a node |
| 15 | - |
| 16 | - ## Parameters |
| 17 | - |
| 18 | - - connection (Nomad.Connection): Connection to server |
| 19 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 20 | - - opts (KeywordList): [optional] Optional parameters |
| 21 | - ## Returns |
| 22 | - |
| 23 | - {:ok, nil} on success |
| 24 | - {:error, Tesla.Env.t} on failure |
| 25 | - """ |
| 26 | - @spec garbage_collect_allocation(Tesla.Env.client(), String.t(), keyword()) :: |
| 27 | - {:ok, nil} | {:error, Tesla.Env.t()} |
| 28 | - def garbage_collect_allocation(connection, alloc_id, _opts \\ []) do |
| 29 | - %{} |
| 30 | - |> method(:get) |
| 31 | - |> url("/client/allocation/#{alloc_id}/gc") |
| 32 | - |> Enum.into([]) |
| 33 | - |> (&Connection.request(connection, &1)).() |
| 34 | - |> evaluate_response([ |
| 35 | - {200, false} |
| 36 | - ]) |
| 37 | - end |
| 38 | - |
| 39 | - @doc """ |
| 40 | - forces a garbage collection of all stopped allocations on a node |
| 41 | - |
| 42 | - ## Parameters |
| 43 | - |
| 44 | - - connection (Nomad.Connection): Connection to server |
| 45 | - - opts (KeywordList): [optional] Optional parameters |
| 46 | - - :node_id (String.t): node id |
| 47 | - ## Returns |
| 48 | - |
| 49 | - {:ok, nil} on success |
| 50 | - {:error, Tesla.Env.t} on failure |
| 51 | - """ |
| 52 | - @spec garbage_collect_allocation_0(Tesla.Env.client(), keyword()) :: |
| 53 | - {:ok, nil} | {:error, Tesla.Env.t()} |
| 54 | - def garbage_collect_allocation_0(connection, opts \\ []) do |
| 55 | - optional_params = %{ |
| 56 | - :node_id => :query |
| 57 | - } |
| 58 | - |
| 59 | - %{} |
| 60 | - |> method(:get) |
| 61 | - |> url("/client/gc") |
| 62 | - |> add_optional_params(optional_params, opts) |
| 63 | - |> Enum.into([]) |
| 64 | - |> (&Connection.request(connection, &1)).() |
| 65 | - |> evaluate_response([ |
| 66 | - {200, false} |
| 67 | - ]) |
| 68 | - end |
| 69 | - |
| 70 | - @doc """ |
| 71 | - query the actual resources consumed by an allocation |
| 72 | - |
| 73 | - ## Parameters |
| 74 | - |
| 75 | - - connection (Nomad.Connection): Connection to server |
| 76 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 77 | - - opts (KeywordList): [optional] Optional parameters |
| 78 | - ## Returns |
| 79 | - |
| 80 | - {:ok, Nomad.Model.AllocResourceUsage.t} on success |
| 81 | - {:error, Tesla.Env.t} on failure |
| 82 | - """ |
| 83 | - @spec get_client_allocation_stats(Tesla.Env.client(), String.t(), keyword()) :: |
| 84 | - {:ok, Nomad.Model.AllocResourceUsage.t()} | {:error, Tesla.Env.t()} |
| 85 | - def get_client_allocation_stats(connection, alloc_id, _opts \\ []) do |
| 86 | - %{} |
| 87 | - |> method(:get) |
| 88 | - |> url("/client/allocation/#{alloc_id}/stats") |
| 89 | - |> Enum.into([]) |
| 90 | - |> (&Connection.request(connection, &1)).() |
| 91 | - |> evaluate_response([ |
| 92 | - {200, %Nomad.Model.AllocResourceUsage{}} |
| 93 | - ]) |
| 94 | - end |
| 95 | - |
| 96 | - @doc """ |
| 97 | - reads the contents of a file in an allocation directory |
| 98 | - |
| 99 | - ## Parameters |
| 100 | - |
| 101 | - - connection (Nomad.Connection): Connection to server |
| 102 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 103 | - - opts (KeywordList): [optional] Optional parameters |
| 104 | - - :path (String.t): Specifies the path of the file to read, relative to the root of the allocation directory |
| 105 | - ## Returns |
| 106 | - |
| 107 | - {:ok, String.t} on success |
| 108 | - {:error, Tesla.Env.t} on failure |
| 109 | - """ |
| 110 | - @spec get_client_file(Tesla.Env.client(), String.t(), keyword()) :: |
| 111 | - {:ok, String.t()} | {:error, Tesla.Env.t()} |
| 112 | - def get_client_file(connection, alloc_id, opts \\ []) do |
| 113 | - optional_params = %{ |
| 114 | - :path => :query |
| 115 | - } |
| 116 | - |
| 117 | - %{} |
| 118 | - |> method(:get) |
| 119 | - |> url("/client/fs/cat/#{alloc_id}") |
| 120 | - |> add_optional_params(optional_params, opts) |
| 121 | - |> Enum.into([]) |
| 122 | - |> (&Connection.request(connection, &1)).() |
| 123 | - |> evaluate_response([ |
| 124 | - {200, false} |
| 125 | - ]) |
| 126 | - end |
| 127 | - |
| 128 | - @doc """ |
| 129 | - reads the contents of a file in an allocation directory at a particular offset and limit |
| 130 | - |
| 131 | - ## Parameters |
| 132 | - |
| 133 | - - connection (Nomad.Connection): Connection to server |
| 134 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 135 | - - offset (integer()): Specifies the byte offset from where content will be read |
| 136 | - - limit (integer()): Specifies the number of bytes to read from the offset |
| 137 | - - opts (KeywordList): [optional] Optional parameters |
| 138 | - - :path (String.t): Specifies the path of the file to read, relative to the root of the allocation directory |
| 139 | - ## Returns |
| 140 | - |
| 141 | - {:ok, String.t} on success |
| 142 | - {:error, Tesla.Env.t} on failure |
| 143 | - """ |
| 144 | - @spec get_client_file_at_offest(Tesla.Env.client(), String.t(), integer(), integer(), keyword()) :: |
| 145 | - {:ok, String.t()} | {:error, Tesla.Env.t()} |
| 146 | - def get_client_file_at_offest(connection, alloc_id, offset, limit, opts \\ []) do |
| 147 | - optional_params = %{ |
| 148 | - :path => :query |
| 149 | - } |
| 150 | - |
| 151 | - %{} |
| 152 | - |> method(:get) |
| 153 | - |> url("/client/fs/readat/#{alloc_id}") |
| 154 | - |> add_param(:query, :offset, offset) |
| 155 | - |> add_param(:query, :limit, limit) |
| 156 | - |> add_optional_params(optional_params, opts) |
| 157 | - |> Enum.into([]) |
| 158 | - |> (&Connection.request(connection, &1)).() |
| 159 | - |> evaluate_response([ |
| 160 | - {200, false} |
| 161 | - ]) |
| 162 | - end |
| 163 | - |
| 164 | - @doc """ |
| 165 | - queries the actual resources consumed on a node. The API endpoint is hosted by the Nomad client and requests have to be made to the nomad client whose resource usage metrics are of interest |
| 166 | - |
| 167 | - ## Parameters |
| 168 | - |
| 169 | - - connection (Nomad.Connection): Connection to server |
| 170 | - - opts (KeywordList): [optional] Optional parameters |
| 171 | - - :node_id (String.t): node id |
| 172 | - ## Returns |
| 173 | - |
| 174 | - {:ok, [%HostStats{}, ...]} on success |
| 175 | - {:error, Tesla.Env.t} on failure |
| 176 | - """ |
| 177 | - @spec get_client_stats(Tesla.Env.client(), keyword()) :: |
| 178 | - {:ok, list(Nomad.Model.HostStats.t())} | {:error, Tesla.Env.t()} |
| 179 | - def get_client_stats(connection, opts \\ []) do |
| 180 | - optional_params = %{ |
| 181 | - :node_id => :query |
| 182 | - } |
| 183 | - |
| 184 | - %{} |
| 185 | - |> method(:get) |
| 186 | - |> url("/client/stats") |
| 187 | - |> add_optional_params(optional_params, opts) |
| 188 | - |> Enum.into([]) |
| 189 | - |> (&Connection.request(connection, &1)).() |
| 190 | - |> evaluate_response([ |
| 191 | - {200, [%Nomad.Model.HostStats{}]} |
| 192 | - ]) |
| 193 | - end |
| 194 | - |
| 195 | - @doc """ |
| 196 | - lists files in an allocation directory |
| 197 | - |
| 198 | - ## Parameters |
| 199 | - |
| 200 | - - connection (Nomad.Connection): Connection to server |
| 201 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 202 | - - opts (KeywordList): [optional] Optional parameters |
| 203 | - - :path (String.t): Specifies the path of the file to read, relative to the root of the allocation directory |
| 204 | - ## Returns |
| 205 | - |
| 206 | - {:ok, [%AllocFileInfo{}, ...]} on success |
| 207 | - {:error, Tesla.Env.t} on failure |
| 208 | - """ |
| 209 | - @spec list_client_files(Tesla.Env.client(), String.t(), keyword()) :: |
| 210 | - {:ok, list(Nomad.Model.AllocFileInfo.t())} | {:error, Tesla.Env.t()} |
| 211 | - def list_client_files(connection, alloc_id, opts \\ []) do |
| 212 | - optional_params = %{ |
| 213 | - :path => :query |
| 214 | - } |
| 215 | - |
| 216 | - %{} |
| 217 | - |> method(:get) |
| 218 | - |> url("/client/fs/ls/#{alloc_id}") |
| 219 | - |> add_optional_params(optional_params, opts) |
| 220 | - |> Enum.into([]) |
| 221 | - |> (&Connection.request(connection, &1)).() |
| 222 | - |> evaluate_response([ |
| 223 | - {200, [%Nomad.Model.AllocFileInfo{}]} |
| 224 | - ]) |
| 225 | - end |
| 226 | - |
| 227 | - @doc """ |
| 228 | - stats a file in an allocation |
| 229 | - |
| 230 | - ## Parameters |
| 231 | - |
| 232 | - - connection (Nomad.Connection): Connection to server |
| 233 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 234 | - - opts (KeywordList): [optional] Optional parameters |
| 235 | - - :path (String.t): Specifies the path of the file to read, relative to the root of the allocation directory |
| 236 | - ## Returns |
| 237 | - |
| 238 | - {:ok, Nomad.Model.AllocFileInfo.t} on success |
| 239 | - {:error, Tesla.Env.t} on failure |
| 240 | - """ |
| 241 | - @spec stat_client_file(Tesla.Env.client(), String.t(), keyword()) :: |
| 242 | - {:ok, Nomad.Model.AllocFileInfo.t()} | {:error, Tesla.Env.t()} |
| 243 | - def stat_client_file(connection, alloc_id, opts \\ []) do |
| 244 | - optional_params = %{ |
| 245 | - :path => :query |
| 246 | - } |
| 247 | - |
| 248 | - %{} |
| 249 | - |> method(:get) |
| 250 | - |> url("/client/fs/stat/#{alloc_id}") |
| 251 | - |> add_optional_params(optional_params, opts) |
| 252 | - |> Enum.into([]) |
| 253 | - |> (&Connection.request(connection, &1)).() |
| 254 | - |> evaluate_response([ |
| 255 | - {200, %Nomad.Model.AllocFileInfo{}} |
| 256 | - ]) |
| 257 | - end |
| 258 | - |
| 259 | - @doc """ |
| 260 | - streams the contents of a file in an allocation directory |
| 261 | - |
| 262 | - ## Parameters |
| 263 | - |
| 264 | - - connection (Nomad.Connection): Connection to server |
| 265 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 266 | - - offset (integer()): Specifies the byte offset from where content will be read |
| 267 | - - opts (KeywordList): [optional] Optional parameters |
| 268 | - - :path (String.t): Specifies the path of the file to read, relative to the root of the allocation directory |
| 269 | - - :follow (boolean()): Specifies whether to tail the file |
| 270 | - - :origin (String.t): Applies the relative offset to either the start or end of the file |
| 271 | - ## Returns |
| 272 | - |
| 273 | - {:ok, String.t} on success |
| 274 | - {:error, Tesla.Env.t} on failure |
| 275 | - """ |
| 276 | - @spec stream_client_file(Tesla.Env.client(), String.t(), integer(), keyword()) :: |
| 277 | - {:ok, String.t()} | {:error, Tesla.Env.t()} |
| 278 | - def stream_client_file(connection, alloc_id, offset, opts \\ []) do |
| 279 | - optional_params = %{ |
| 280 | - :path => :query, |
| 281 | - :follow => :query, |
| 282 | - :origin => :query |
| 283 | - } |
| 284 | - |
| 285 | - %{} |
| 286 | - |> method(:get) |
| 287 | - |> url("/client/fs/stream/#{alloc_id}") |
| 288 | - |> add_param(:query, :offset, offset) |
| 289 | - |> add_optional_params(optional_params, opts) |
| 290 | - |> Enum.into([]) |
| 291 | - |> (&Connection.request(connection, &1)).() |
| 292 | - |> evaluate_response([ |
| 293 | - {200, false} |
| 294 | - ]) |
| 295 | - end |
| 296 | - |
| 297 | - @doc """ |
| 298 | - streams a task's stderr/stdout logs |
| 299 | - |
| 300 | - ## Parameters |
| 301 | - |
| 302 | - - connection (Nomad.Connection): Connection to server |
| 303 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 304 | - - task (String.t): Specifies the name of the task inside the allocation to stream logs from |
| 305 | - - offset (integer()): Specifies the byte offset from where content will be read |
| 306 | - - opts (KeywordList): [optional] Optional parameters |
| 307 | - - :follow (boolean()): Specifies whether to tail the file |
| 308 | - - :type (String.t): Specifies the stream to stream |
| 309 | - - :origin (String.t): Applies the relative offset to either the start or end of the file |
| 310 | - - :plain (boolean()): is plain text format |
| 311 | - ## Returns |
| 312 | - |
| 313 | - {:ok, String.t} on success |
| 314 | - {:error, Tesla.Env.t} on failure |
| 315 | - """ |
| 316 | - @spec stream_client_logs(Tesla.Env.client(), String.t(), String.t(), integer(), keyword()) :: |
| 317 | - {:ok, String.t()} | {:error, Tesla.Env.t()} |
| 318 | - def stream_client_logs(connection, alloc_id, task, offset, opts \\ []) do |
| 319 | - optional_params = %{ |
| 320 | - :follow => :query, |
| 321 | - :type => :query, |
| 322 | - :origin => :query, |
| 323 | - :plain => :query |
| 324 | - } |
| 325 | - |
| 326 | - %{} |
| 327 | - |> method(:get) |
| 328 | - |> url("/client/fs/logs/#{alloc_id}") |
| 329 | - |> add_param(:query, :task, task) |
| 330 | - |> add_param(:query, :offset, offset) |
| 331 | - |> add_optional_params(optional_params, opts) |
| 332 | - |> Enum.into([]) |
| 333 | - |> (&Connection.request(connection, &1)).() |
| 334 | - |> evaluate_response([ |
| 335 | - {200, false} |
| 336 | - ]) |
| 337 | - end |
| 338 | - end |
Loading more files…