Current section
8 Versions
Jump to
Current section
8 Versions
Compare versions
255
files changed
+8549
additions
-5223
deletions
| @@ -5,7 +5,7 @@ A elixir client for HashiCorp Nomad's API. | |
| 5 5 | ### Building |
| 6 6 | |
| 7 7 | To install the required dependencies and to build the elixir project, run: |
| 8 | - ``` |
| 8 | + ```shell |
| 9 9 | mix local.hex --force |
| 10 10 | mix do deps.get, compile |
| 11 11 | ``` |
| @@ -17,7 +17,7 @@ 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, "~> 0.12.1"}] |
| 20 | + [{:nomad_client, "~> 0.13.0"}] |
| 21 21 | end |
| 22 22 | ``` |
| 23 23 | |
| @@ -26,24 +26,24 @@ The Documentation can be found at [https://hexdocs.pm/nomad_client](https://hexd | |
| 26 26 | ## Usage |
| 27 27 | |
| 28 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") |
| 34 | - # Custom URL with ACL token |
| 35 | - conn = NomadClient.Connection.new("http://172.17.0.1:4646", "00000000-0000-0000-0000-000000000000") |
| 29 | + ```elixir |
| 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") |
| 34 | + # Custom URL with ACL token |
| 35 | + conn = NomadClient.Connection.new("http://172.17.0.1:4646", "00000000-0000-0000-0000-000000000000") |
| 36 36 | ``` |
| 37 37 | |
| 38 38 | After that, you can use your `conn` to make requests the api requests by using the API Modules. |
| 39 39 | |
| 40 40 | For example: |
| 41 | - ``` |
| 42 | - alias NomadClient.Connection |
| 43 | - alias NomadClient.Api.Jobs |
| 41 | + ```elixir |
| 42 | + alias NomadClient.Connection |
| 43 | + alias NomadClient.Api.Jobs |
| 44 44 | |
| 45 | - conn = Connection.new() |
| 46 | - {:ok, []} = Jobs.get_jobs(conn) |
| 45 | + conn = Connection.new() |
| 46 | + {:ok, []} = Jobs.get_jobs(conn) |
| 47 47 | ``` |
| 48 48 | |
| 49 49 | ### Configuration |
| @@ -52,7 +52,7 @@ You can chance the default http adapter or inject additional middleware into the | |
| 52 52 | Since the client does not provides his own application instruction, the configuration has to be made via the `:tesla` application |
| 53 53 | |
| 54 54 | For example: (config.exs) |
| 55 | - ``` |
| 55 | + ```elixir |
| 56 56 | config :tesla, NomadClient.Connection, |
| 57 57 | adapter: {Tesla.Adapter.Hackney, [recv_timeout: 150_000, connect_timeout: 150_000]}, |
| 58 58 | middleware: [Tesla.Middleware.Logger] |
| @@ -68,25 +68,22 @@ docker run \ | |
| 68 68 | --rm \ |
| 69 69 | --mount "type=bind,src=$(pwd),dst=/local" \ |
| 70 70 | --user "$UID:$GID" \ |
| 71 | - openapitools/openapi-generator-cli:v5.2.1 \ |
| 71 | + openapitools/openapi-generator-cli:v6.2.0 \ |
| 72 72 | generate \ |
| 73 73 | --invoker-package NomadClient \ |
| 74 74 | --generator-name elixir \ |
| 75 75 | --skip-validate-spec \ |
| 76 | - --input-spec /local/openapi.json \ |
| 76 | + --input-spec /local/openapi.yaml \ |
| 77 77 | --output /local/ |
| 78 78 | ``` |
| 79 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. |
| 80 | + This will spin up a docker container on your system and gernerates the whole elixir client based on the official `openapi.yaml` definition. |
| 83 81 | |
| 84 82 | ## Credits and Copyright |
| 85 83 | |
| 86 84 | 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 |
| 87 | - ### The OAS defintion |
| 88 | - - https://github.com/FuturistiCoder/Nomad.OAS |
| 89 | - - https://github.com/rivet-gg/Nomad.OAS |
| 85 | + ### The official OAS Spec from HashiCorp |
| 86 | + - https://raw.githubusercontent.com/hashicorp/nomad-openapi/main/v1/openapi.yaml |
| 90 87 | |
| 91 88 | ### The OAS Generator |
| @@ -1,24 +1,19 @@ | |
| 1 1 | {<<"app">>,<<"nomad_client">>}. |
| 2 2 | {<<"build_tools">>,[<<"mix">>]}. |
| 3 3 | {<<"description">>,<<"A elixir client for HashiCorp Nomad's API.">>}. |
| 4 | - {<<"elixir">>,<<"~> 1.6">>}. |
| 4 | + {<<"elixir">>,<<"~> 1.10">>}. |
| 5 5 | {<<"files">>, |
| 6 6 | [<<"lib">>,<<"lib/nomad_client">>,<<"lib/nomad_client/model">>, |
| 7 7 | <<"lib/nomad_client/model/acl_policy.ex">>, |
| 8 8 | <<"lib/nomad_client/model/acl_policy_list_stub.ex">>, |
| 9 9 | <<"lib/nomad_client/model/acl_token.ex">>, |
| 10 10 | <<"lib/nomad_client/model/acl_token_list_stub.ex">>, |
| 11 | + <<"lib/nomad_client/model/acl_token_role_link.ex">>, |
| 11 12 | <<"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 13 | <<"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 14 | <<"lib/nomad_client/model/alloc_stop_response.ex">>, |
| 21 15 | <<"lib/nomad_client/model/allocated_cpu_resources.ex">>, |
| 16 | + <<"lib/nomad_client/model/allocated_device_resource.ex">>, |
| 22 17 | <<"lib/nomad_client/model/allocated_memory_resources.ex">>, |
| 23 18 | <<"lib/nomad_client/model/allocated_resources.ex">>, |
| 24 19 | <<"lib/nomad_client/model/allocated_shared_resources.ex">>, |
| @@ -26,51 +21,74 @@ | |
| 26 21 | <<"lib/nomad_client/model/allocation.ex">>, |
| 27 22 | <<"lib/nomad_client/model/allocation_list_stub.ex">>, |
| 28 23 | <<"lib/nomad_client/model/allocation_metric.ex">>, |
| 29 | - <<"lib/nomad_client/model/allocation_restart_request.ex">>, |
| 30 24 | <<"lib/nomad_client/model/attribute.ex">>, |
| 31 25 | <<"lib/nomad_client/model/autopilot_configuration.ex">>, |
| 26 | + <<"lib/nomad_client/model/change_script.ex">>, |
| 32 27 | <<"lib/nomad_client/model/check_restart.ex">>, |
| 33 28 | <<"lib/nomad_client/model/constraint.ex">>, |
| 29 | + <<"lib/nomad_client/model/consul.ex">>, |
| 34 30 | <<"lib/nomad_client/model/consul_connect.ex">>, |
| 31 | + <<"lib/nomad_client/model/consul_expose_config.ex">>, |
| 32 | + <<"lib/nomad_client/model/consul_expose_path.ex">>, |
| 33 | + <<"lib/nomad_client/model/consul_gateway.ex">>, |
| 34 | + <<"lib/nomad_client/model/consul_gateway_bind_address.ex">>, |
| 35 | + <<"lib/nomad_client/model/consul_gateway_proxy.ex">>, |
| 36 | + <<"lib/nomad_client/model/consul_gateway_tls_config.ex">>, |
| 37 | + <<"lib/nomad_client/model/consul_ingress_config_entry.ex">>, |
| 38 | + <<"lib/nomad_client/model/consul_ingress_listener.ex">>, |
| 39 | + <<"lib/nomad_client/model/consul_ingress_service.ex">>, |
| 40 | + <<"lib/nomad_client/model/consul_linked_service.ex">>, |
| 41 | + <<"lib/nomad_client/model/consul_mesh_gateway.ex">>, |
| 35 42 | <<"lib/nomad_client/model/consul_proxy.ex">>, |
| 36 43 | <<"lib/nomad_client/model/consul_sidecar_service.ex">>, |
| 44 | + <<"lib/nomad_client/model/consul_terminating_config_entry.ex">>, |
| 37 45 | <<"lib/nomad_client/model/consul_upstream.ex">>, |
| 38 | - <<"lib/nomad_client/model/cpu_stats.ex">>, |
| 39 46 | <<"lib/nomad_client/model/csi_controller_info.ex">>, |
| 40 47 | <<"lib/nomad_client/model/csi_info.ex">>, |
| 41 48 | <<"lib/nomad_client/model/csi_mount_options.ex">>, |
| 42 49 | <<"lib/nomad_client/model/csi_node_info.ex">>, |
| 43 50 | <<"lib/nomad_client/model/csi_plugin.ex">>, |
| 44 51 | <<"lib/nomad_client/model/csi_plugin_list_stub.ex">>, |
| 52 | + <<"lib/nomad_client/model/csi_snapshot.ex">>, |
| 53 | + <<"lib/nomad_client/model/csi_snapshot_create_request.ex">>, |
| 54 | + <<"lib/nomad_client/model/csi_snapshot_create_response.ex">>, |
| 55 | + <<"lib/nomad_client/model/csi_snapshot_list_response.ex">>, |
| 45 56 | <<"lib/nomad_client/model/csi_topology.ex">>, |
| 57 | + <<"lib/nomad_client/model/csi_topology_request.ex">>, |
| 46 58 | <<"lib/nomad_client/model/csi_volume.ex">>, |
| 59 | + <<"lib/nomad_client/model/csi_volume_capability.ex">>, |
| 60 | + <<"lib/nomad_client/model/csi_volume_create_request.ex">>, |
| 61 | + <<"lib/nomad_client/model/csi_volume_external_stub.ex">>, |
| 62 | + <<"lib/nomad_client/model/csi_volume_list_external_response.ex">>, |
| 47 63 | <<"lib/nomad_client/model/csi_volume_list_stub.ex">>, |
| 48 64 | <<"lib/nomad_client/model/csi_volume_register_request.ex">>, |
| 49 65 | <<"lib/nomad_client/model/deployment.ex">>, |
| 50 66 | <<"lib/nomad_client/model/deployment_alloc_health_request.ex">>, |
| 51 | - <<"lib/nomad_client/model/deployment_fail_request.ex">>, |
| 52 67 | <<"lib/nomad_client/model/deployment_pause_request.ex">>, |
| 53 68 | <<"lib/nomad_client/model/deployment_promote_request.ex">>, |
| 54 69 | <<"lib/nomad_client/model/deployment_state.ex">>, |
| 70 | + <<"lib/nomad_client/model/deployment_unblock_request.ex">>, |
| 55 71 | <<"lib/nomad_client/model/deployment_update_response.ex">>, |
| 56 72 | <<"lib/nomad_client/model/desired_transition.ex">>, |
| 57 73 | <<"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 74 | <<"lib/nomad_client/model/dispatch_payload_config.ex">>, |
| 75 | + <<"lib/nomad_client/model/dns_config.ex">>, |
| 76 | + <<"lib/nomad_client/model/drain_metadata.ex">>, |
| 61 77 | <<"lib/nomad_client/model/drain_spec.ex">>, |
| 62 78 | <<"lib/nomad_client/model/drain_strategy.ex">>, |
| 63 79 | <<"lib/nomad_client/model/driver_info.ex">>, |
| 64 80 | <<"lib/nomad_client/model/ephemeral_disk.ex">>, |
| 65 81 | <<"lib/nomad_client/model/eval_options.ex">>, |
| 66 82 | <<"lib/nomad_client/model/evaluation.ex">>, |
| 83 | + <<"lib/nomad_client/model/evaluation_stub.ex">>, |
| 67 84 | <<"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">>, |
| 85 | + <<"lib/nomad_client/model/fuzzy_match.ex">>, |
| 86 | + <<"lib/nomad_client/model/fuzzy_search_request.ex">>, |
| 87 | + <<"lib/nomad_client/model/fuzzy_search_response.ex">>, |
| 88 | + <<"lib/nomad_client/model/gauge_value.ex">>, |
| 89 | + <<"lib/nomad_client/model/host_network_info.ex">>, |
| 72 90 | <<"lib/nomad_client/model/host_volume_info.ex">>, |
| 73 | - <<"lib/nomad_client/model/job.ex">>, |
| 91 | + <<"lib/nomad_client/model/job.ex">>,<<"lib/nomad_client/model/job_acl.ex">>, |
| 74 92 | <<"lib/nomad_client/model/job_children_summary.ex">>, |
| 75 93 | <<"lib/nomad_client/model/job_deregister_response.ex">>, |
| 76 94 | <<"lib/nomad_client/model/job_diff.ex">>, |
| @@ -80,6 +98,7 @@ | |
| 80 98 | <<"lib/nomad_client/model/job_list_stub.ex">>, |
| 81 99 | <<"lib/nomad_client/model/job_plan_request.ex">>, |
| 82 100 | <<"lib/nomad_client/model/job_plan_response.ex">>, |
| 101 | + <<"lib/nomad_client/model/job_register_request.ex">>, |
| 83 102 | <<"lib/nomad_client/model/job_register_response.ex">>, |
| 84 103 | <<"lib/nomad_client/model/job_revert_request.ex">>, |
| 85 104 | <<"lib/nomad_client/model/job_scale_status_response.ex">>, |
| @@ -90,15 +109,14 @@ | |
| 90 109 | <<"lib/nomad_client/model/job_validate_response.ex">>, |
| 91 110 | <<"lib/nomad_client/model/job_versions_response.ex">>, |
| 92 111 | <<"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 112 | <<"lib/nomad_client/model/log_config.ex">>, |
| 97 | - <<"lib/nomad_client/model/memory_stats.ex">>, |
| 113 | + <<"lib/nomad_client/model/metrics_summary.ex">>, |
| 98 114 | <<"lib/nomad_client/model/migrate_strategy.ex">>, |
| 99 | - <<"lib/nomad_client/model/monitor_message.ex">>, |
| 115 | + <<"lib/nomad_client/model/multiregion.ex">>, |
| 116 | + <<"lib/nomad_client/model/multiregion_region.ex">>, |
| 117 | + <<"lib/nomad_client/model/multiregion_strategy.ex">>, |
| 100 118 | <<"lib/nomad_client/model/namespace.ex">>, |
| 101 | - <<"lib/nomad_client/model/network_dns.ex">>, |
| 119 | + <<"lib/nomad_client/model/namespace_capabilities.ex">>, |
| 102 120 | <<"lib/nomad_client/model/network_resource.ex">>, |
| 103 121 | <<"lib/nomad_client/model/node.ex">>, |
| 104 122 | <<"lib/nomad_client/model/node_cpu_resources.ex">>, |
| @@ -108,10 +126,10 @@ | |
| 108 126 | <<"lib/nomad_client/model/node_disk_resources.ex">>, |
| 109 127 | <<"lib/nomad_client/model/node_drain_update_response.ex">>, |
| 110 128 | <<"lib/nomad_client/model/node_eligibility_update_response.ex">>, |
| 111 | - <<"lib/nomad_client/model/node_eval_response.ex">>, |
| 112 129 | <<"lib/nomad_client/model/node_event.ex">>, |
| 113 130 | <<"lib/nomad_client/model/node_list_stub.ex">>, |
| 114 131 | <<"lib/nomad_client/model/node_memory_resources.ex">>, |
| 132 | + <<"lib/nomad_client/model/node_purge_response.ex">>, |
| 115 133 | <<"lib/nomad_client/model/node_reserved_cpu_resources.ex">>, |
| 116 134 | <<"lib/nomad_client/model/node_reserved_disk_resources.ex">>, |
| 117 135 | <<"lib/nomad_client/model/node_reserved_memory_resources.ex">>, |
| @@ -122,27 +140,28 @@ | |
| 122 140 | <<"lib/nomad_client/model/node_update_drain_request.ex">>, |
| 123 141 | <<"lib/nomad_client/model/node_update_eligibility_request.ex">>, |
| 124 142 | <<"lib/nomad_client/model/object_diff.ex">>, |
| 143 | + <<"lib/nomad_client/model/one_time_token.ex">>, |
| 144 | + <<"lib/nomad_client/model/one_time_token_exchange_request.ex">>, |
| 125 145 | <<"lib/nomad_client/model/operator_health_reply.ex">>, |
| 126 146 | <<"lib/nomad_client/model/parameterized_job_config.ex">>, |
| 127 147 | <<"lib/nomad_client/model/periodic_config.ex">>, |
| 128 148 | <<"lib/nomad_client/model/periodic_force_response.ex">>, |
| 129 149 | <<"lib/nomad_client/model/plan_annotations.ex">>, |
| 150 | + <<"lib/nomad_client/model/point_value.ex">>, |
| 130 151 | <<"lib/nomad_client/model/port.ex">>, |
| 152 | + <<"lib/nomad_client/model/port_mapping.ex">>, |
| 131 153 | <<"lib/nomad_client/model/preemption_config.ex">>, |
| 132 | - <<"lib/nomad_client/model/query_options.ex">>, |
| 133 154 | <<"lib/nomad_client/model/quota_limit.ex">>, |
| 134 155 | <<"lib/nomad_client/model/quota_spec.ex">>, |
| 135 | - <<"lib/nomad_client/model/quota_usage.ex">>, |
| 136 156 | <<"lib/nomad_client/model/raft_configuration.ex">>, |
| 137 157 | <<"lib/nomad_client/model/raft_server.ex">>, |
| 138 | - <<"lib/nomad_client/model/register_job_request.ex">>, |
| 139 158 | <<"lib/nomad_client/model/requested_device.ex">>, |
| 140 159 | <<"lib/nomad_client/model/reschedule_event.ex">>, |
| 141 160 | <<"lib/nomad_client/model/reschedule_policy.ex">>, |
| 142 161 | <<"lib/nomad_client/model/reschedule_tracker.ex">>, |
| 143 | - <<"lib/nomad_client/model/resource_usage.ex">>, |
| 144 162 | <<"lib/nomad_client/model/resources.ex">>, |
| 145 163 | <<"lib/nomad_client/model/restart_policy.ex">>, |
| 164 | + <<"lib/nomad_client/model/sampled_value.ex">>, |
| 146 165 | <<"lib/nomad_client/model/scaling_event.ex">>, |
| 147 166 | <<"lib/nomad_client/model/scaling_policy.ex">>, |
| 148 167 | <<"lib/nomad_client/model/scaling_policy_list_stub.ex">>, |
| @@ -152,18 +171,13 @@ | |
| 152 171 | <<"lib/nomad_client/model/scheduler_set_configuration_response.ex">>, |
| 153 172 | <<"lib/nomad_client/model/search_request.ex">>, |
| 154 173 | <<"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 174 | <<"lib/nomad_client/model/server_health.ex">>, |
| 158 | - <<"lib/nomad_client/model/server_members.ex">>, |
| 159 175 | <<"lib/nomad_client/model/service.ex">>, |
| 160 176 | <<"lib/nomad_client/model/service_check.ex">>, |
| 177 | + <<"lib/nomad_client/model/service_registration.ex">>, |
| 161 178 | <<"lib/nomad_client/model/sidecar_task.ex">>, |
| 162 179 | <<"lib/nomad_client/model/spread.ex">>, |
| 163 180 | <<"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 181 | <<"lib/nomad_client/model/task.ex">>, |
| 168 182 | <<"lib/nomad_client/model/task_artifact.ex">>, |
| 169 183 | <<"lib/nomad_client/model/task_csi_plugin_config.ex">>, |
| @@ -173,23 +187,29 @@ | |
| 173 187 | <<"lib/nomad_client/model/task_group_diff.ex">>, |
| 174 188 | <<"lib/nomad_client/model/task_group_scale_status.ex">>, |
| 175 189 | <<"lib/nomad_client/model/task_group_summary.ex">>, |
| 190 | + <<"lib/nomad_client/model/task_handle.ex">>, |
| 176 191 | <<"lib/nomad_client/model/task_lifecycle.ex">>, |
| 177 | - <<"lib/nomad_client/model/task_resource_usage.ex">>, |
| 178 192 | <<"lib/nomad_client/model/task_state.ex">>, |
| 179 193 | <<"lib/nomad_client/model/template.ex">>, |
| 180 194 | <<"lib/nomad_client/model/update_strategy.ex">>, |
| 195 | + <<"lib/nomad_client/model/variable.ex">>, |
| 196 | + <<"lib/nomad_client/model/variable_metadata.ex">>, |
| 181 197 | <<"lib/nomad_client/model/vault.ex">>, |
| 182 198 | <<"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">>, |
| 199 | + <<"lib/nomad_client/model/volume_request.ex">>, |
| 200 | + <<"lib/nomad_client/model/wait_config.ex">>,<<"lib/nomad_client/api">>, |
| 201 | + <<"lib/nomad_client/api/acl.ex">>,<<"lib/nomad_client/api/allocations.ex">>, |
| 187 202 | <<"lib/nomad_client/api/deployments.ex">>, |
| 203 | + <<"lib/nomad_client/api/enterprise.ex">>, |
| 188 204 | <<"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">>, |
| 205 | + <<"lib/nomad_client/api/jobs.ex">>,<<"lib/nomad_client/api/metrics.ex">>, |
| 206 | + <<"lib/nomad_client/api/namespaces.ex">>, |
| 207 | + <<"lib/nomad_client/api/nodes.ex">>,<<"lib/nomad_client/api/operator.ex">>, |
| 208 | + <<"lib/nomad_client/api/plugins.ex">>,<<"lib/nomad_client/api/regions.ex">>, |
| 209 | + <<"lib/nomad_client/api/scaling.ex">>,<<"lib/nomad_client/api/search.ex">>, |
| 210 | + <<"lib/nomad_client/api/status.ex">>,<<"lib/nomad_client/api/system.ex">>, |
| 211 | + <<"lib/nomad_client/api/variables.ex">>, |
| 212 | + <<"lib/nomad_client/api/volumes.ex">>,<<"lib/nomad_client/connection.ex">>, |
| 193 213 | <<"lib/nomad_client/request_builder.ex">>, |
| 194 214 | <<"lib/nomad_client/deserializer.ex">>,<<"mix.exs">>,<<"README.md">>, |
| 195 215 | <<"LICENSE">>]}. |
| @@ -201,7 +221,7 @@ | |
| 201 221 | {<<"name">>,<<"tesla">>}, |
| 202 222 | {<<"optional">>,false}, |
| 203 223 | {<<"repository">>,<<"hexpm">>}, |
| 204 | - {<<"requirement">>,<<"~> 1.2">>}], |
| 224 | + {<<"requirement">>,<<"~> 1.4">>}], |
| 205 225 | [{<<"app">>,<<"poison">>}, |
| 206 226 | {<<"name">>,<<"poison">>}, |
| 207 227 | {<<"optional">>,false}, |
| @@ -212,4 +232,4 @@ | |
| 212 232 | {<<"optional">>,true}, |
| 213 233 | {<<"repository">>,<<"hexpm">>}, |
| 214 234 | {<<"requirement">>,<<"~> 1.0">>}]]}. |
| 215 | - {<<"version">>,<<"0.12.4">>}. |
| 235 | + {<<"version">>,<<"0.13.0">>}. |
| @@ -0,0 +1,614 @@ | |
| 1 | + # NOTE: This file is auto generated by OpenAPI Generator 6.2.0 (https://openapi-generator.tech). |
| 2 | + # Do not edit this file manually. |
| 3 | + |
| 4 | + defmodule NomadClient.Api.ACL do |
| 5 | + @moduledoc """ |
| 6 | + API calls for all endpoints tagged `ACL`. |
| 7 | + """ |
| 8 | + |
| 9 | + alias NomadClient.Connection |
| 10 | + import NomadClient.RequestBuilder |
| 11 | + |
| 12 | + @doc """ |
| 13 | + |
| 14 | + ### Parameters |
| 15 | + |
| 16 | + - `connection` (NomadClient.Connection): Connection to server |
| 17 | + - `policy_name` (String.t): The ACL policy name. |
| 18 | + - `opts` (keyword): Optional parameters |
| 19 | + - `:region` (String.t): Filters results based on the specified region. |
| 20 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 21 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 22 | + - `:idempotency_token` (String.t): Can be used to ensure operations are only run once. |
| 23 | + |
| 24 | + ### Returns |
| 25 | + |
| 26 | + - `{:ok, nil}` on success |
| 27 | + - `{:error, Tesla.Env.t}` on failure |
| 28 | + """ |
| 29 | + @spec delete_acl_policy(Tesla.Env.client(), String.t(), keyword()) :: |
| 30 | + {:ok, nil} | {:error, Tesla.Env.t()} |
| 31 | + def delete_acl_policy(connection, policy_name, opts \\ []) do |
| 32 | + optional_params = %{ |
| 33 | + :region => :query, |
| 34 | + :namespace => :query, |
| 35 | + :"X-Nomad-Token" => :headers, |
| 36 | + :idempotency_token => :query |
| 37 | + } |
| 38 | + |
| 39 | + request = |
| 40 | + %{} |
| 41 | + |> method(:delete) |
| 42 | + |> url("/acl/policy/#{policy_name}") |
| 43 | + |> add_optional_params(optional_params, opts) |
| 44 | + |> Enum.into([]) |
| 45 | + |
| 46 | + connection |
| 47 | + |> Connection.request(request) |
| 48 | + |> evaluate_response([ |
| 49 | + {200, false}, |
| 50 | + {400, false}, |
| 51 | + {403, false}, |
| 52 | + {405, false}, |
| 53 | + {500, false} |
| 54 | + ]) |
| 55 | + end |
| 56 | + |
| 57 | + @doc """ |
| 58 | + |
| 59 | + ### Parameters |
| 60 | + |
| 61 | + - `connection` (NomadClient.Connection): Connection to server |
| 62 | + - `token_accessor` (String.t): The token accessor ID. |
| 63 | + - `opts` (keyword): Optional parameters |
| 64 | + - `:region` (String.t): Filters results based on the specified region. |
| 65 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 66 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 67 | + - `:idempotency_token` (String.t): Can be used to ensure operations are only run once. |
| 68 | + |
| 69 | + ### Returns |
| 70 | + |
| 71 | + - `{:ok, nil}` on success |
| 72 | + - `{:error, Tesla.Env.t}` on failure |
| 73 | + """ |
| 74 | + @spec delete_acl_token(Tesla.Env.client(), String.t(), keyword()) :: |
| 75 | + {:ok, nil} | {:error, Tesla.Env.t()} |
| 76 | + def delete_acl_token(connection, token_accessor, opts \\ []) do |
| 77 | + optional_params = %{ |
| 78 | + :region => :query, |
| 79 | + :namespace => :query, |
| 80 | + :"X-Nomad-Token" => :headers, |
| 81 | + :idempotency_token => :query |
| 82 | + } |
| 83 | + |
| 84 | + request = |
| 85 | + %{} |
| 86 | + |> method(:delete) |
| 87 | + |> url("/acl/token/#{token_accessor}") |
| 88 | + |> add_optional_params(optional_params, opts) |
| 89 | + |> Enum.into([]) |
| 90 | + |
| 91 | + connection |
| 92 | + |> Connection.request(request) |
| 93 | + |> evaluate_response([ |
| 94 | + {200, false}, |
| 95 | + {400, false}, |
| 96 | + {403, false}, |
| 97 | + {405, false}, |
| 98 | + {500, false} |
| 99 | + ]) |
| 100 | + end |
| 101 | + |
| 102 | + @doc """ |
| 103 | + |
| 104 | + ### Parameters |
| 105 | + |
| 106 | + - `connection` (NomadClient.Connection): Connection to server |
| 107 | + - `opts` (keyword): Optional parameters |
| 108 | + - `:region` (String.t): Filters results based on the specified region. |
| 109 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 110 | + - `:index` (integer()): If set, wait until query exceeds given index. Must be provided with WaitParam. |
| 111 | + - `:wait` (String.t): Provided with IndexParam to wait for change. |
| 112 | + - `:stale` (String.t): If present, results will include stale reads. |
| 113 | + - `:prefix` (String.t): Constrains results to jobs that start with the defined prefix |
| 114 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 115 | + - `:per_page` (integer()): Maximum number of results to return. |
| 116 | + - `:next_token` (String.t): Indicates where to start paging for queries that support pagination. |
| 117 | + |
| 118 | + ### Returns |
| 119 | + |
| 120 | + - `{:ok, [%AclPolicyListStub{}, ...]}` on success |
| 121 | + - `{:error, Tesla.Env.t}` on failure |
| 122 | + """ |
| 123 | + @spec get_acl_policies(Tesla.Env.client(), keyword()) :: |
| 124 | + {:ok, list(NomadClient.Model.AclPolicyListStub.t())} |
| 125 | + | {:ok, nil} |
| 126 | + | {:error, Tesla.Env.t()} |
| 127 | + def get_acl_policies(connection, opts \\ []) do |
| 128 | + optional_params = %{ |
| 129 | + :region => :query, |
| 130 | + :namespace => :query, |
| 131 | + :index => :headers, |
| 132 | + :wait => :query, |
| 133 | + :stale => :query, |
| 134 | + :prefix => :query, |
| 135 | + :"X-Nomad-Token" => :headers, |
| 136 | + :per_page => :query, |
| 137 | + :next_token => :query |
| 138 | + } |
| 139 | + |
| 140 | + request = |
| 141 | + %{} |
| 142 | + |> method(:get) |
| 143 | + |> url("/acl/policies") |
| 144 | + |> add_optional_params(optional_params, opts) |
| 145 | + |> Enum.into([]) |
| 146 | + |
| 147 | + connection |
| 148 | + |> Connection.request(request) |
| 149 | + |> evaluate_response([ |
| 150 | + {200, [%NomadClient.Model.AclPolicyListStub{}]}, |
| 151 | + {400, false}, |
| 152 | + {403, false}, |
| 153 | + {405, false}, |
| 154 | + {500, false} |
| 155 | + ]) |
| 156 | + end |
| 157 | + |
| 158 | + @doc """ |
| 159 | + |
| 160 | + ### Parameters |
| 161 | + |
| 162 | + - `connection` (NomadClient.Connection): Connection to server |
| 163 | + - `policy_name` (String.t): The ACL policy name. |
| 164 | + - `opts` (keyword): Optional parameters |
| 165 | + - `:region` (String.t): Filters results based on the specified region. |
| 166 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 167 | + - `:index` (integer()): If set, wait until query exceeds given index. Must be provided with WaitParam. |
| 168 | + - `:wait` (String.t): Provided with IndexParam to wait for change. |
| 169 | + - `:stale` (String.t): If present, results will include stale reads. |
| 170 | + - `:prefix` (String.t): Constrains results to jobs that start with the defined prefix |
| 171 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 172 | + - `:per_page` (integer()): Maximum number of results to return. |
| 173 | + - `:next_token` (String.t): Indicates where to start paging for queries that support pagination. |
| 174 | + |
| 175 | + ### Returns |
| 176 | + |
| 177 | + - `{:ok, NomadClient.Model.AclPolicy.t}` on success |
| 178 | + - `{:error, Tesla.Env.t}` on failure |
| 179 | + """ |
| 180 | + @spec get_acl_policy(Tesla.Env.client(), String.t(), keyword()) :: |
| 181 | + {:ok, nil} | {:ok, NomadClient.Model.AclPolicy.t()} | {:error, Tesla.Env.t()} |
| 182 | + def get_acl_policy(connection, policy_name, opts \\ []) do |
| 183 | + optional_params = %{ |
| 184 | + :region => :query, |
| 185 | + :namespace => :query, |
| 186 | + :index => :headers, |
| 187 | + :wait => :query, |
| 188 | + :stale => :query, |
| 189 | + :prefix => :query, |
| 190 | + :"X-Nomad-Token" => :headers, |
| 191 | + :per_page => :query, |
| 192 | + :next_token => :query |
| 193 | + } |
| 194 | + |
| 195 | + request = |
| 196 | + %{} |
| 197 | + |> method(:get) |
| 198 | + |> url("/acl/policy/#{policy_name}") |
| 199 | + |> add_optional_params(optional_params, opts) |
| 200 | + |> Enum.into([]) |
| 201 | + |
| 202 | + connection |
| 203 | + |> Connection.request(request) |
| 204 | + |> evaluate_response([ |
| 205 | + {200, %NomadClient.Model.AclPolicy{}}, |
| 206 | + {400, false}, |
| 207 | + {403, false}, |
| 208 | + {405, false}, |
| 209 | + {500, false} |
| 210 | + ]) |
| 211 | + end |
| 212 | + |
| 213 | + @doc """ |
| 214 | + |
| 215 | + ### Parameters |
| 216 | + |
| 217 | + - `connection` (NomadClient.Connection): Connection to server |
| 218 | + - `token_accessor` (String.t): The token accessor ID. |
| 219 | + - `opts` (keyword): Optional parameters |
| 220 | + - `:region` (String.t): Filters results based on the specified region. |
| 221 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 222 | + - `:index` (integer()): If set, wait until query exceeds given index. Must be provided with WaitParam. |
| 223 | + - `:wait` (String.t): Provided with IndexParam to wait for change. |
| 224 | + - `:stale` (String.t): If present, results will include stale reads. |
| 225 | + - `:prefix` (String.t): Constrains results to jobs that start with the defined prefix |
| 226 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 227 | + - `:per_page` (integer()): Maximum number of results to return. |
| 228 | + - `:next_token` (String.t): Indicates where to start paging for queries that support pagination. |
| 229 | + |
| 230 | + ### Returns |
| 231 | + |
| 232 | + - `{:ok, NomadClient.Model.AclToken.t}` on success |
| 233 | + - `{:error, Tesla.Env.t}` on failure |
| 234 | + """ |
| 235 | + @spec get_acl_token(Tesla.Env.client(), String.t(), keyword()) :: |
| 236 | + {:ok, nil} | {:ok, NomadClient.Model.AclToken.t()} | {:error, Tesla.Env.t()} |
| 237 | + def get_acl_token(connection, token_accessor, opts \\ []) do |
| 238 | + optional_params = %{ |
| 239 | + :region => :query, |
| 240 | + :namespace => :query, |
| 241 | + :index => :headers, |
| 242 | + :wait => :query, |
| 243 | + :stale => :query, |
| 244 | + :prefix => :query, |
| 245 | + :"X-Nomad-Token" => :headers, |
| 246 | + :per_page => :query, |
| 247 | + :next_token => :query |
| 248 | + } |
| 249 | + |
| 250 | + request = |
| 251 | + %{} |
| 252 | + |> method(:get) |
| 253 | + |> url("/acl/token/#{token_accessor}") |
| 254 | + |> add_optional_params(optional_params, opts) |
| 255 | + |> Enum.into([]) |
| 256 | + |
| 257 | + connection |
| 258 | + |> Connection.request(request) |
| 259 | + |> evaluate_response([ |
| 260 | + {200, %NomadClient.Model.AclToken{}}, |
| 261 | + {400, false}, |
| 262 | + {403, false}, |
| 263 | + {405, false}, |
| 264 | + {500, false} |
| 265 | + ]) |
| 266 | + end |
| 267 | + |
| 268 | + @doc """ |
| 269 | + |
| 270 | + ### Parameters |
| 271 | + |
| 272 | + - `connection` (NomadClient.Connection): Connection to server |
| 273 | + - `opts` (keyword): Optional parameters |
| 274 | + - `:region` (String.t): Filters results based on the specified region. |
| 275 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 276 | + - `:index` (integer()): If set, wait until query exceeds given index. Must be provided with WaitParam. |
| 277 | + - `:wait` (String.t): Provided with IndexParam to wait for change. |
| 278 | + - `:stale` (String.t): If present, results will include stale reads. |
| 279 | + - `:prefix` (String.t): Constrains results to jobs that start with the defined prefix |
| 280 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 281 | + - `:per_page` (integer()): Maximum number of results to return. |
| 282 | + - `:next_token` (String.t): Indicates where to start paging for queries that support pagination. |
| 283 | + |
| 284 | + ### Returns |
| 285 | + |
| 286 | + - `{:ok, NomadClient.Model.AclToken.t}` on success |
| 287 | + - `{:error, Tesla.Env.t}` on failure |
| 288 | + """ |
| 289 | + @spec get_acl_token_self(Tesla.Env.client(), keyword()) :: |
| 290 | + {:ok, nil} | {:ok, NomadClient.Model.AclToken.t()} | {:error, Tesla.Env.t()} |
| 291 | + def get_acl_token_self(connection, opts \\ []) do |
| 292 | + optional_params = %{ |
| 293 | + :region => :query, |
| 294 | + :namespace => :query, |
| 295 | + :index => :headers, |
| 296 | + :wait => :query, |
| 297 | + :stale => :query, |
| 298 | + :prefix => :query, |
| 299 | + :"X-Nomad-Token" => :headers, |
| 300 | + :per_page => :query, |
| 301 | + :next_token => :query |
| 302 | + } |
| 303 | + |
| 304 | + request = |
| 305 | + %{} |
| 306 | + |> method(:get) |
| 307 | + |> url("/acl/token") |
| 308 | + |> add_optional_params(optional_params, opts) |
| 309 | + |> Enum.into([]) |
| 310 | + |
| 311 | + connection |
| 312 | + |> Connection.request(request) |
| 313 | + |> evaluate_response([ |
| 314 | + {200, %NomadClient.Model.AclToken{}}, |
| 315 | + {400, false}, |
| 316 | + {403, false}, |
| 317 | + {405, false}, |
| 318 | + {500, false} |
| 319 | + ]) |
| 320 | + end |
| 321 | + |
| 322 | + @doc """ |
| 323 | + |
| 324 | + ### Parameters |
| 325 | + |
| 326 | + - `connection` (NomadClient.Connection): Connection to server |
| 327 | + - `opts` (keyword): Optional parameters |
| 328 | + - `:region` (String.t): Filters results based on the specified region. |
| 329 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 330 | + - `:index` (integer()): If set, wait until query exceeds given index. Must be provided with WaitParam. |
| 331 | + - `:wait` (String.t): Provided with IndexParam to wait for change. |
| 332 | + - `:stale` (String.t): If present, results will include stale reads. |
| 333 | + - `:prefix` (String.t): Constrains results to jobs that start with the defined prefix |
| 334 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 335 | + - `:per_page` (integer()): Maximum number of results to return. |
| 336 | + - `:next_token` (String.t): Indicates where to start paging for queries that support pagination. |
| 337 | + |
| 338 | + ### Returns |
| 339 | + |
| 340 | + - `{:ok, [%AclTokenListStub{}, ...]}` on success |
| 341 | + - `{:error, Tesla.Env.t}` on failure |
| 342 | + """ |
| 343 | + @spec get_acl_tokens(Tesla.Env.client(), keyword()) :: |
| 344 | + {:ok, nil} |
| 345 | + | {:ok, list(NomadClient.Model.AclTokenListStub.t())} |
| 346 | + | {:error, Tesla.Env.t()} |
| 347 | + def get_acl_tokens(connection, opts \\ []) do |
| 348 | + optional_params = %{ |
| 349 | + :region => :query, |
| 350 | + :namespace => :query, |
| 351 | + :index => :headers, |
| 352 | + :wait => :query, |
| 353 | + :stale => :query, |
| 354 | + :prefix => :query, |
| 355 | + :"X-Nomad-Token" => :headers, |
| 356 | + :per_page => :query, |
| 357 | + :next_token => :query |
| 358 | + } |
| 359 | + |
| 360 | + request = |
| 361 | + %{} |
| 362 | + |> method(:get) |
| 363 | + |> url("/acl/tokens") |
| 364 | + |> add_optional_params(optional_params, opts) |
| 365 | + |> Enum.into([]) |
| 366 | + |
| 367 | + connection |
| 368 | + |> Connection.request(request) |
| 369 | + |> evaluate_response([ |
| 370 | + {200, [%NomadClient.Model.AclTokenListStub{}]}, |
| 371 | + {400, false}, |
| 372 | + {403, false}, |
| 373 | + {405, false}, |
| 374 | + {500, false} |
| 375 | + ]) |
| 376 | + end |
| 377 | + |
| 378 | + @doc """ |
| 379 | + |
| 380 | + ### Parameters |
| 381 | + |
| 382 | + - `connection` (NomadClient.Connection): Connection to server |
| 383 | + - `opts` (keyword): Optional parameters |
| 384 | + - `:region` (String.t): Filters results based on the specified region. |
| 385 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 386 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 387 | + - `:idempotency_token` (String.t): Can be used to ensure operations are only run once. |
| 388 | + |
| 389 | + ### Returns |
| 390 | + |
| 391 | + - `{:ok, NomadClient.Model.AclToken.t}` on success |
| 392 | + - `{:error, Tesla.Env.t}` on failure |
| 393 | + """ |
| 394 | + @spec post_acl_bootstrap(Tesla.Env.client(), keyword()) :: |
| 395 | + {:ok, nil} | {:ok, NomadClient.Model.AclToken.t()} | {:error, Tesla.Env.t()} |
| 396 | + def post_acl_bootstrap(connection, opts \\ []) do |
| 397 | + optional_params = %{ |
| 398 | + :region => :query, |
| 399 | + :namespace => :query, |
| 400 | + :"X-Nomad-Token" => :headers, |
| 401 | + :idempotency_token => :query |
| 402 | + } |
| 403 | + |
| 404 | + request = |
| 405 | + %{} |
| 406 | + |> method(:post) |
| 407 | + |> url("/acl/bootstrap") |
| 408 | + |> add_optional_params(optional_params, opts) |
| 409 | + |> ensure_body() |
| 410 | + |> Enum.into([]) |
| 411 | + |
| 412 | + connection |
| 413 | + |> Connection.request(request) |
| 414 | + |> evaluate_response([ |
| 415 | + {200, %NomadClient.Model.AclToken{}}, |
| 416 | + {400, false}, |
| 417 | + {403, false}, |
| 418 | + {405, false}, |
| 419 | + {500, false} |
| 420 | + ]) |
| 421 | + end |
| 422 | + |
| 423 | + @doc """ |
| 424 | + |
| 425 | + ### Parameters |
| 426 | + |
| 427 | + - `connection` (NomadClient.Connection): Connection to server |
| 428 | + - `policy_name` (String.t): The ACL policy name. |
| 429 | + - `acl_policy` (AclPolicy): |
| 430 | + - `opts` (keyword): Optional parameters |
| 431 | + - `:region` (String.t): Filters results based on the specified region. |
| 432 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 433 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 434 | + - `:idempotency_token` (String.t): Can be used to ensure operations are only run once. |
| 435 | + |
| 436 | + ### Returns |
| 437 | + |
| 438 | + - `{:ok, nil}` on success |
| 439 | + - `{:error, Tesla.Env.t}` on failure |
| 440 | + """ |
| 441 | + @spec post_acl_policy( |
| 442 | + Tesla.Env.client(), |
| 443 | + String.t(), |
| 444 | + NomadClient.Model.AclPolicy.t(), |
| 445 | + keyword() |
| 446 | + ) :: {:ok, nil} | {:error, Tesla.Env.t()} |
| 447 | + def post_acl_policy(connection, policy_name, acl_policy, opts \\ []) do |
| 448 | + optional_params = %{ |
| 449 | + :region => :query, |
| 450 | + :namespace => :query, |
| 451 | + :"X-Nomad-Token" => :headers, |
| 452 | + :idempotency_token => :query |
| 453 | + } |
| 454 | + |
| 455 | + request = |
| 456 | + %{} |
| 457 | + |> method(:post) |
| 458 | + |> url("/acl/policy/#{policy_name}") |
| 459 | + |> add_param(:body, :body, acl_policy) |
| 460 | + |> add_optional_params(optional_params, opts) |
| 461 | + |> Enum.into([]) |
| 462 | + |
| 463 | + connection |
| 464 | + |> Connection.request(request) |
| 465 | + |> evaluate_response([ |
| 466 | + {200, false}, |
| 467 | + {400, false}, |
| 468 | + {403, false}, |
| 469 | + {405, false}, |
| 470 | + {500, false} |
| 471 | + ]) |
| 472 | + end |
| 473 | + |
| 474 | + @doc """ |
| 475 | + |
| 476 | + ### Parameters |
| 477 | + |
| 478 | + - `connection` (NomadClient.Connection): Connection to server |
| 479 | + - `token_accessor` (String.t): The token accessor ID. |
| 480 | + - `acl_token` (AclToken): |
| 481 | + - `opts` (keyword): Optional parameters |
| 482 | + - `:region` (String.t): Filters results based on the specified region. |
| 483 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 484 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 485 | + - `:idempotency_token` (String.t): Can be used to ensure operations are only run once. |
| 486 | + |
| 487 | + ### Returns |
| 488 | + |
| 489 | + - `{:ok, NomadClient.Model.AclToken.t}` on success |
| 490 | + - `{:error, Tesla.Env.t}` on failure |
| 491 | + """ |
| 492 | + @spec post_acl_token(Tesla.Env.client(), String.t(), NomadClient.Model.AclToken.t(), keyword()) :: |
| 493 | + {:ok, nil} | {:ok, NomadClient.Model.AclToken.t()} | {:error, Tesla.Env.t()} |
| 494 | + def post_acl_token(connection, token_accessor, acl_token, opts \\ []) do |
| 495 | + optional_params = %{ |
| 496 | + :region => :query, |
| 497 | + :namespace => :query, |
| 498 | + :"X-Nomad-Token" => :headers, |
| 499 | + :idempotency_token => :query |
| 500 | + } |
| 501 | + |
| 502 | + request = |
| 503 | + %{} |
| 504 | + |> method(:post) |
| 505 | + |> url("/acl/token/#{token_accessor}") |
| 506 | + |> add_param(:body, :body, acl_token) |
| 507 | + |> add_optional_params(optional_params, opts) |
| 508 | + |> Enum.into([]) |
| 509 | + |
| 510 | + connection |
| 511 | + |> Connection.request(request) |
| 512 | + |> evaluate_response([ |
| 513 | + {200, %NomadClient.Model.AclToken{}}, |
| 514 | + {400, false}, |
| 515 | + {403, false}, |
| 516 | + {405, false}, |
| 517 | + {500, false} |
| 518 | + ]) |
| 519 | + end |
| 520 | + |
| 521 | + @doc """ |
| 522 | + |
| 523 | + ### Parameters |
| 524 | + |
| 525 | + - `connection` (NomadClient.Connection): Connection to server |
| 526 | + - `opts` (keyword): Optional parameters |
| 527 | + - `:region` (String.t): Filters results based on the specified region. |
| 528 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 529 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 530 | + - `:idempotency_token` (String.t): Can be used to ensure operations are only run once. |
| 531 | + |
| 532 | + ### Returns |
| 533 | + |
| 534 | + - `{:ok, NomadClient.Model.OneTimeToken.t}` on success |
| 535 | + - `{:error, Tesla.Env.t}` on failure |
| 536 | + """ |
| 537 | + @spec post_acl_token_onetime(Tesla.Env.client(), keyword()) :: |
| 538 | + {:ok, nil} | {:ok, NomadClient.Model.OneTimeToken.t()} | {:error, Tesla.Env.t()} |
| 539 | + def post_acl_token_onetime(connection, opts \\ []) do |
| 540 | + optional_params = %{ |
| 541 | + :region => :query, |
| 542 | + :namespace => :query, |
| 543 | + :"X-Nomad-Token" => :headers, |
| 544 | + :idempotency_token => :query |
| 545 | + } |
| 546 | + |
| 547 | + request = |
| 548 | + %{} |
| 549 | + |> method(:post) |
| 550 | + |> url("/acl/token/onetime") |
| 551 | + |> add_optional_params(optional_params, opts) |
| 552 | + |> ensure_body() |
| 553 | + |> Enum.into([]) |
| 554 | + |
| 555 | + connection |
| 556 | + |> Connection.request(request) |
| 557 | + |> evaluate_response([ |
| 558 | + {200, %NomadClient.Model.OneTimeToken{}}, |
| 559 | + {400, false}, |
| 560 | + {403, false}, |
| 561 | + {405, false}, |
| 562 | + {500, false} |
| 563 | + ]) |
| 564 | + end |
| 565 | + |
| 566 | + @doc """ |
| 567 | + |
| 568 | + ### Parameters |
| 569 | + |
| 570 | + - `connection` (NomadClient.Connection): Connection to server |
| 571 | + - `one_time_token_exchange_request` (OneTimeTokenExchangeRequest): |
| 572 | + - `opts` (keyword): Optional parameters |
| 573 | + - `:region` (String.t): Filters results based on the specified region. |
| 574 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 575 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 576 | + - `:idempotency_token` (String.t): Can be used to ensure operations are only run once. |
| 577 | + |
| 578 | + ### Returns |
| 579 | + |
| 580 | + - `{:ok, NomadClient.Model.AclToken.t}` on success |
| 581 | + - `{:error, Tesla.Env.t}` on failure |
| 582 | + """ |
| 583 | + @spec post_acl_token_onetime_exchange( |
| 584 | + Tesla.Env.client(), |
| 585 | + NomadClient.Model.OneTimeTokenExchangeRequest.t(), |
| 586 | + keyword() |
| 587 | + ) :: {:ok, nil} | {:ok, NomadClient.Model.AclToken.t()} | {:error, Tesla.Env.t()} |
| 588 | + def post_acl_token_onetime_exchange(connection, one_time_token_exchange_request, opts \\ []) do |
| 589 | + optional_params = %{ |
| 590 | + :region => :query, |
| 591 | + :namespace => :query, |
| 592 | + :"X-Nomad-Token" => :headers, |
| 593 | + :idempotency_token => :query |
| 594 | + } |
| 595 | + |
| 596 | + request = |
| 597 | + %{} |
| 598 | + |> method(:post) |
| 599 | + |> url("/acl/token/onetime/exchange") |
| 600 | + |> add_param(:body, :body, one_time_token_exchange_request) |
| 601 | + |> add_optional_params(optional_params, opts) |
| 602 | + |> Enum.into([]) |
| 603 | + |
| 604 | + connection |
| 605 | + |> Connection.request(request) |
| 606 | + |> evaluate_response([ |
| 607 | + {200, %NomadClient.Model.AclToken{}}, |
| 608 | + {400, false}, |
| 609 | + {403, false}, |
| 610 | + {405, false}, |
| 611 | + {500, false} |
| 612 | + ]) |
| 613 | + end |
| 614 | + end |
| @@ -1,315 +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 NomadClient.Api.Agent do |
| 6 | - @moduledoc """ |
| 7 | - API calls for all endpoints tagged `Agent`. |
| 8 | - """ |
| 9 | - |
| 10 | - alias NomadClient.Connection |
| 11 | - import NomadClient.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 (NomadClient.Connection): Connection to server |
| 19 | - - node (String.t): the name of the node |
| 20 | - - opts (KeywordList): [optional] Optional parameters |
| 21 | - - :namespace (String.t): |
| 22 | - - :region (String.t): Make a request across regions to the given region |
| 23 | - - :index (integer()): index used for blocking requests |
| 24 | - - :wait (String.t): wait time used for blocking requests |
| 25 | - ## Returns |
| 26 | - |
| 27 | - {:ok, nil} on success |
| 28 | - {:error, Tesla.Env.t} on failure |
| 29 | - """ |
| 30 | - @spec force_leave(Tesla.Env.client(), String.t(), keyword()) :: |
| 31 | - {:ok, nil} | {:error, Tesla.Env.t()} |
| 32 | - def force_leave(connection, node, opts \\ []) do |
| 33 | - optional_params = %{ |
| 34 | - :namespace => :query, |
| 35 | - :region => :query, |
| 36 | - :index => :query, |
| 37 | - :wait => :query |
| 38 | - } |
| 39 | - |
| 40 | - %{} |
| 41 | - |> method(:post) |
| 42 | - |> url("/agent/force-leave") |
| 43 | - |> add_param(:query, :node, node) |
| 44 | - |> add_optional_params(optional_params, opts) |
| 45 | - |> ensure_body() |
| 46 | - |> Enum.into([]) |
| 47 | - |> (&Connection.request(connection, &1)).() |
| 48 | - |> evaluate_response([ |
| 49 | - {200, false} |
| 50 | - ]) |
| 51 | - end |
| 52 | - |
| 53 | - @doc """ |
| 54 | - Performs a basic healthcheck |
| 55 | - |
| 56 | - ## Parameters |
| 57 | - |
| 58 | - - connection (NomadClient.Connection): Connection to server |
| 59 | - - opts (KeywordList): [optional] Optional parameters |
| 60 | - - :namespace (String.t): |
| 61 | - - :region (String.t): Make a request across regions to the given region |
| 62 | - - :index (integer()): index used for blocking requests |
| 63 | - - :wait (String.t): wait time used for blocking requests |
| 64 | - ## Returns |
| 65 | - |
| 66 | - {:ok, NomadClient.Model.AgentHealthResponse.t} on success |
| 67 | - {:error, Tesla.Env.t} on failure |
| 68 | - """ |
| 69 | - @spec get_health(Tesla.Env.client(), keyword()) :: |
| 70 | - {:ok, NomadClient.Model.AgentHealthResponse.t()} | {:error, Tesla.Env.t()} |
| 71 | - def get_health(connection, opts \\ []) do |
| 72 | - optional_params = %{ |
| 73 | - :namespace => :query, |
| 74 | - :region => :query, |
| 75 | - :index => :query, |
| 76 | - :wait => :query |
| 77 | - } |
| 78 | - |
| 79 | - %{} |
| 80 | - |> method(:get) |
| 81 | - |> url("/agent/health") |
| 82 | - |> add_optional_params(optional_params, opts) |
| 83 | - |> Enum.into([]) |
| 84 | - |> (&Connection.request(connection, &1)).() |
| 85 | - |> evaluate_response([ |
| 86 | - {200, %NomadClient.Model.AgentHealthResponse{}} |
| 87 | - ]) |
| 88 | - end |
| 89 | - |
| 90 | - @doc """ |
| 91 | - Queries for the known peers in the gossip pool |
| 92 | - |
| 93 | - ## Parameters |
| 94 | - |
| 95 | - - connection (NomadClient.Connection): Connection to server |
| 96 | - - opts (KeywordList): [optional] Optional parameters |
| 97 | - - :namespace (String.t): |
| 98 | - - :region (String.t): Make a request across regions to the given region |
| 99 | - - :index (integer()): index used for blocking requests |
| 100 | - - :wait (String.t): wait time used for blocking requests |
| 101 | - ## Returns |
| 102 | - |
| 103 | - {:ok, NomadClient.Model.ServerMembers.t} on success |
| 104 | - {:error, Tesla.Env.t} on failure |
| 105 | - """ |
| 106 | - @spec get_members(Tesla.Env.client(), keyword()) :: |
| 107 | - {:ok, NomadClient.Model.ServerMembers.t()} | {:error, Tesla.Env.t()} |
| 108 | - def get_members(connection, opts \\ []) do |
| 109 | - optional_params = %{ |
| 110 | - :namespace => :query, |
| 111 | - :region => :query, |
| 112 | - :index => :query, |
| 113 | - :wait => :query |
| 114 | - } |
| 115 | - |
| 116 | - %{} |
| 117 | - |> method(:get) |
| 118 | - |> url("/agent/members") |
| 119 | - |> add_optional_params(optional_params, opts) |
| 120 | - |> Enum.into([]) |
| 121 | - |> (&Connection.request(connection, &1)).() |
| 122 | - |> evaluate_response([ |
| 123 | - {200, %NomadClient.Model.ServerMembers{}} |
| 124 | - ]) |
| 125 | - end |
| 126 | - |
| 127 | - @doc """ |
| 128 | - Queries for information about the agent we are connected to |
| 129 | - |
| 130 | - ## Parameters |
| 131 | - |
| 132 | - - connection (NomadClient.Connection): Connection to server |
| 133 | - - opts (KeywordList): [optional] Optional parameters |
| 134 | - - :namespace (String.t): |
| 135 | - - :region (String.t): Make a request across regions to the given region |
| 136 | - - :index (integer()): index used for blocking requests |
| 137 | - - :wait (String.t): wait time used for blocking requests |
| 138 | - ## Returns |
| 139 | - |
| 140 | - {:ok, NomadClient.Model.AgentSelf.t} on success |
| 141 | - {:error, Tesla.Env.t} on failure |
| 142 | - """ |
| 143 | - @spec get_self(Tesla.Env.client(), keyword()) :: |
| 144 | - {:ok, NomadClient.Model.AgentSelf.t()} | {:error, Tesla.Env.t()} |
| 145 | - def get_self(connection, opts \\ []) do |
| 146 | - optional_params = %{ |
| 147 | - :namespace => :query, |
| 148 | - :region => :query, |
| 149 | - :index => :query, |
| 150 | - :wait => :query |
| 151 | - } |
| 152 | - |
| 153 | - %{} |
| 154 | - |> method(:get) |
| 155 | - |> url("/agent/self") |
| 156 | - |> add_optional_params(optional_params, opts) |
| 157 | - |> Enum.into([]) |
| 158 | - |> (&Connection.request(connection, &1)).() |
| 159 | - |> evaluate_response([ |
| 160 | - {200, %NomadClient.Model.AgentSelf{}} |
| 161 | - ]) |
| 162 | - end |
| 163 | - |
| 164 | - @doc """ |
| 165 | - Queries an agent in client mode for its list of known servers |
| 166 | - |
| 167 | - ## Parameters |
| 168 | - |
| 169 | - - connection (NomadClient.Connection): Connection to server |
| 170 | - - opts (KeywordList): [optional] Optional parameters |
| 171 | - ## Returns |
| 172 | - |
| 173 | - {:ok, [%String{}, ...]} on success |
| 174 | - {:error, Tesla.Env.t} on failure |
| 175 | - """ |
| 176 | - @spec get_servers(Tesla.Env.client(), keyword()) :: |
| 177 | - {:ok, list(String.t())} | {:error, Tesla.Env.t()} |
| 178 | - def get_servers(connection, _opts \\ []) do |
| 179 | - %{} |
| 180 | - |> method(:get) |
| 181 | - |> url("/agent/servers") |
| 182 | - |> Enum.into([]) |
| 183 | - |> (&Connection.request(connection, &1)).() |
| 184 | - |> evaluate_response([ |
| 185 | - {200, []} |
| 186 | - ]) |
| 187 | - end |
| 188 | - |
| 189 | - @doc """ |
| 190 | - Causes the agent to join a cluster by joining the gossip pool at one of the given addresses |
| 191 | - |
| 192 | - ## Parameters |
| 193 | - |
| 194 | - - connection (NomadClient.Connection): Connection to server |
| 195 | - - address ([String.t]): server address (ip:port) |
| 196 | - - opts (KeywordList): [optional] Optional parameters |
| 197 | - - :namespace (String.t): |
| 198 | - - :region (String.t): Make a request across regions to the given region |
| 199 | - - :index (integer()): index used for blocking requests |
| 200 | - - :wait (String.t): wait time used for blocking requests |
| 201 | - ## Returns |
| 202 | - |
| 203 | - {:ok, NomadClient.Model.JoinResponse.t} on success |
| 204 | - {:error, Tesla.Env.t} on failure |
| 205 | - """ |
| 206 | - @spec join(Tesla.Env.client(), list(String.t()), keyword()) :: |
| 207 | - {:ok, NomadClient.Model.JoinResponse.t()} | {:error, Tesla.Env.t()} |
| 208 | - def join(connection, address, opts \\ []) do |
| 209 | - optional_params = %{ |
| 210 | - :namespace => :query, |
| 211 | - :region => :query, |
| 212 | - :index => :query, |
| 213 | - :wait => :query |
| 214 | - } |
| 215 | - |
| 216 | - %{} |
| 217 | - |> method(:post) |
| 218 | - |> url("/agent/join") |
| 219 | - |> add_param(:query, :address, address) |
| 220 | - |> add_optional_params(optional_params, opts) |
| 221 | - |> ensure_body() |
| 222 | - |> Enum.into([]) |
| 223 | - |> (&Connection.request(connection, &1)).() |
| 224 | - |> evaluate_response([ |
| 225 | - {200, %NomadClient.Model.JoinResponse{}} |
| 226 | - ]) |
| 227 | - end |
| 228 | - |
| 229 | - @doc """ |
| 230 | - Streams logs from a specific Nomad server node |
| 231 | - |
| 232 | - ## Parameters |
| 233 | - |
| 234 | - - connection (NomadClient.Connection): Connection to server |
| 235 | - - opts (KeywordList): [optional] Optional parameters |
| 236 | - - :namespace (String.t): |
| 237 | - - :region (String.t): Make a request across regions to the given region |
| 238 | - - :index (integer()): index used for blocking requests |
| 239 | - - :wait (String.t): wait time used for blocking requests |
| 240 | - - :log_level (String.t): log level |
| 241 | - - :node_id (String.t): node id |
| 242 | - - :server_id (String.t): server id |
| 243 | - - :json (boolean()): is json format |
| 244 | - - :plain (boolean()): is plain text format |
| 245 | - ## Returns |
| 246 | - |
| 247 | - {:ok, NomadClient.Model.StreamFrame.t} on success |
| 248 | - {:error, Tesla.Env.t} on failure |
| 249 | - """ |
| 250 | - @spec stream_logs(Tesla.Env.client(), keyword()) :: |
| 251 | - {:ok, NomadClient.Model.StreamFrame.t()} | {:error, Tesla.Env.t()} |
| 252 | - def stream_logs(connection, opts \\ []) do |
| 253 | - optional_params = %{ |
| 254 | - :namespace => :query, |
| 255 | - :region => :query, |
| 256 | - :index => :query, |
| 257 | - :wait => :query, |
| 258 | - :log_level => :query, |
| 259 | - :node_id => :query, |
| 260 | - :server_id => :query, |
| 261 | - :json => :query, |
| 262 | - :plain => :query |
| 263 | - } |
| 264 | - |
| 265 | - %{} |
| 266 | - |> method(:get) |
| 267 | - |> url("/agent/monitor") |
| 268 | - |> add_optional_params(optional_params, opts) |
| 269 | - |> Enum.into([]) |
| 270 | - |> (&Connection.request(connection, &1)).() |
| 271 | - |> evaluate_response([ |
| 272 | - {200, %NomadClient.Model.StreamFrame{}} |
| 273 | - ]) |
| 274 | - end |
| 275 | - |
| 276 | - @doc """ |
| 277 | - Updates the list of known servers to the given addresses, replacing all previous addresses |
| 278 | - |
| 279 | - ## Parameters |
| 280 | - |
| 281 | - - connection (NomadClient.Connection): Connection to server |
| 282 | - - address ([String.t]): server address (ip:port) |
| 283 | - - opts (KeywordList): [optional] Optional parameters |
| 284 | - - :namespace (String.t): |
| 285 | - - :region (String.t): Make a request across regions to the given region |
| 286 | - - :index (integer()): index used for blocking requests |
| 287 | - - :wait (String.t): wait time used for blocking requests |
| 288 | - ## Returns |
| 289 | - |
| 290 | - {:ok, [%String{}, ...]} on success |
| 291 | - {:error, Tesla.Env.t} on failure |
| 292 | - """ |
| 293 | - @spec update_servers(Tesla.Env.client(), list(String.t()), keyword()) :: |
| 294 | - {:ok, list(String.t())} | {:error, Tesla.Env.t()} |
| 295 | - def update_servers(connection, address, opts \\ []) do |
| 296 | - optional_params = %{ |
| 297 | - :namespace => :query, |
| 298 | - :region => :query, |
| 299 | - :index => :query, |
| 300 | - :wait => :query |
| 301 | - } |
| 302 | - |
| 303 | - %{} |
| 304 | - |> method(:post) |
| 305 | - |> url("/agent/servers") |
| 306 | - |> add_param(:query, :address, address) |
| 307 | - |> add_optional_params(optional_params, opts) |
| 308 | - |> ensure_body() |
| 309 | - |> Enum.into([]) |
| 310 | - |> (&Connection.request(connection, &1)).() |
| 311 | - |> evaluate_response([ |
| 312 | - {200, []} |
| 313 | - ]) |
| 314 | - end |
| 315 | - end |
| @@ -1,6 +1,5 @@ | |
| 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. |
| 1 | + # NOTE: This file is auto generated by OpenAPI Generator 6.2.0 (https://openapi-generator.tech). |
| 2 | + # Do not edit this file manually. |
| 4 3 | |
| 5 4 | defmodule NomadClient.Api.Allocations do |
| 6 5 | @moduledoc """ |
| @@ -11,206 +10,232 @@ defmodule NomadClient.Api.Allocations do | |
| 11 10 | import NomadClient.RequestBuilder |
| 12 11 | |
| 13 12 | @doc """ |
| 14 | - reads information about a specific allocation |
| 15 13 | |
| 16 | - ## Parameters |
| 14 | + ### Parameters |
| 17 15 | |
| 18 | - - connection (NomadClient.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 | - - :namespace (String.t): |
| 22 | - - :region (String.t): Make a request across regions to the given region |
| 23 | - - :index (integer()): index used for blocking requests |
| 24 | - - :wait (String.t): wait time used for blocking requests |
| 25 | - ## Returns |
| 16 | + - `connection` (NomadClient.Connection): Connection to server |
| 17 | + - `alloc_id` (String.t): Allocation ID. |
| 18 | + - `opts` (keyword): Optional parameters |
| 19 | + - `:region` (String.t): Filters results based on the specified region. |
| 20 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 21 | + - `:index` (integer()): If set, wait until query exceeds given index. Must be provided with WaitParam. |
| 22 | + - `:wait` (String.t): Provided with IndexParam to wait for change. |
| 23 | + - `:stale` (String.t): If present, results will include stale reads. |
| 24 | + - `:prefix` (String.t): Constrains results to jobs that start with the defined prefix |
| 25 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 26 | + - `:per_page` (integer()): Maximum number of results to return. |
| 27 | + - `:next_token` (String.t): Indicates where to start paging for queries that support pagination. |
| 26 28 | |
| 27 | - {:ok, NomadClient.Model.Allocation.t} on success |
| 28 | - {:error, Tesla.Env.t} on failure |
| 29 | + ### Returns |
| 30 | + |
| 31 | + - `{:ok, NomadClient.Model.Allocation.t}` on success |
| 32 | + - `{:error, Tesla.Env.t}` on failure |
| 29 33 | """ |
| 30 34 | @spec get_allocation(Tesla.Env.client(), String.t(), keyword()) :: |
| 31 | - {:ok, NomadClient.Model.Allocation.t()} | {:error, Tesla.Env.t()} |
| 35 | + {:ok, nil} | {:ok, NomadClient.Model.Allocation.t()} | {:error, Tesla.Env.t()} |
| 32 36 | def get_allocation(connection, alloc_id, opts \\ []) do |
| 33 37 | optional_params = %{ |
| 34 | - :namespace => :query, |
| 35 38 | :region => :query, |
| 36 | - :index => :query, |
| 37 | - :wait => :query |
| 39 | + :namespace => :query, |
| 40 | + :index => :headers, |
| 41 | + :wait => :query, |
| 42 | + :stale => :query, |
| 43 | + :prefix => :query, |
| 44 | + :"X-Nomad-Token" => :headers, |
| 45 | + :per_page => :query, |
| 46 | + :next_token => :query |
| 38 47 | } |
| 39 48 | |
| 40 | - %{} |
| 41 | - |> method(:get) |
| 42 | - |> url("/allocation/#{alloc_id}") |
| 43 | - |> add_optional_params(optional_params, opts) |
| 44 | - |> Enum.into([]) |
| 45 | - |> (&Connection.request(connection, &1)).() |
| 49 | + request = |
| 50 | + %{} |
| 51 | + |> method(:get) |
| 52 | + |> url("/allocation/#{alloc_id}") |
| 53 | + |> add_optional_params(optional_params, opts) |
| 54 | + |> Enum.into([]) |
| 55 | + |
| 56 | + connection |
| 57 | + |> Connection.request(request) |
| 46 58 | |> evaluate_response([ |
| 47 | - {200, %NomadClient.Model.Allocation{}} |
| 59 | + {200, %NomadClient.Model.Allocation{}}, |
| 60 | + {400, false}, |
| 61 | + {403, false}, |
| 62 | + {405, false}, |
| 63 | + {500, false} |
| 48 64 | ]) |
| 49 65 | end |
| 50 66 | |
| 51 67 | @doc """ |
| 52 | - query for and interact with allocations |
| 53 68 | |
| 54 | - ## Parameters |
| 69 | + ### Parameters |
| 55 70 | |
| 56 | - - connection (NomadClient.Connection): Connection to server |
| 57 | - - opts (KeywordList): [optional] Optional parameters |
| 58 | - - :namespace (String.t): |
| 59 | - - :region (String.t): Make a request across regions to the given region |
| 60 | - - :index (integer()): index used for blocking requests |
| 61 | - - :wait (String.t): wait time used for blocking requests |
| 62 | - - :prefix (String.t): Specifies a string to filter jobs on based on an index prefix. This is specified as a query string parameter |
| 63 | - ## Returns |
| 71 | + - `connection` (NomadClient.Connection): Connection to server |
| 72 | + - `alloc_id` (String.t): Allocation ID. |
| 73 | + - `opts` (keyword): Optional parameters |
| 74 | + - `:region` (String.t): Filters results based on the specified region. |
| 75 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 76 | + - `:index` (integer()): If set, wait until query exceeds given index. Must be provided with WaitParam. |
| 77 | + - `:wait` (String.t): Provided with IndexParam to wait for change. |
| 78 | + - `:stale` (String.t): If present, results will include stale reads. |
| 79 | + - `:prefix` (String.t): Constrains results to jobs that start with the defined prefix |
| 80 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 81 | + - `:per_page` (integer()): Maximum number of results to return. |
| 82 | + - `:next_token` (String.t): Indicates where to start paging for queries that support pagination. |
| 64 83 | |
| 65 | - {:ok, [%AllocationListStub{}, ...]} on success |
| 66 | - {:error, Tesla.Env.t} on failure |
| 84 | + ### Returns |
| 85 | + |
| 86 | + - `{:ok, [%ServiceRegistration{}, ...]}` on success |
| 87 | + - `{:error, Tesla.Env.t}` on failure |
| 88 | + """ |
| 89 | + @spec get_allocation_services(Tesla.Env.client(), String.t(), keyword()) :: |
| 90 | + {:ok, nil} |
| 91 | + | {:ok, list(NomadClient.Model.ServiceRegistration.t())} |
| 92 | + | {:error, Tesla.Env.t()} |
| 93 | + def get_allocation_services(connection, alloc_id, opts \\ []) do |
| 94 | + optional_params = %{ |
| 95 | + :region => :query, |
| 96 | + :namespace => :query, |
| 97 | + :index => :headers, |
| 98 | + :wait => :query, |
| 99 | + :stale => :query, |
| 100 | + :prefix => :query, |
| 101 | + :"X-Nomad-Token" => :headers, |
| 102 | + :per_page => :query, |
| 103 | + :next_token => :query |
| 104 | + } |
| 105 | + |
| 106 | + request = |
| 107 | + %{} |
| 108 | + |> method(:get) |
| 109 | + |> url("/allocation/#{alloc_id}/services") |
| 110 | + |> add_optional_params(optional_params, opts) |
| 111 | + |> Enum.into([]) |
| 112 | + |
| 113 | + connection |
| 114 | + |> Connection.request(request) |
| 115 | + |> evaluate_response([ |
| 116 | + {200, [%NomadClient.Model.ServiceRegistration{}]}, |
| 117 | + {400, false}, |
| 118 | + {403, false}, |
| 119 | + {405, false}, |
| 120 | + {500, false} |
| 121 | + ]) |
| 122 | + end |
| 123 | + |
| 124 | + @doc """ |
| 125 | + |
| 126 | + ### Parameters |
| 127 | + |
| 128 | + - `connection` (NomadClient.Connection): Connection to server |
| 129 | + - `opts` (keyword): Optional parameters |
| 130 | + - `:region` (String.t): Filters results based on the specified region. |
| 131 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 132 | + - `:index` (integer()): If set, wait until query exceeds given index. Must be provided with WaitParam. |
| 133 | + - `:wait` (String.t): Provided with IndexParam to wait for change. |
| 134 | + - `:stale` (String.t): If present, results will include stale reads. |
| 135 | + - `:prefix` (String.t): Constrains results to jobs that start with the defined prefix |
| 136 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 137 | + - `:per_page` (integer()): Maximum number of results to return. |
| 138 | + - `:next_token` (String.t): Indicates where to start paging for queries that support pagination. |
| 139 | + - `:resources` (boolean()): Flag indicating whether to include resources in response. |
| 140 | + - `:task_states` (boolean()): Flag indicating whether to include task states in response. |
| 141 | + |
| 142 | + ### Returns |
| 143 | + |
| 144 | + - `{:ok, [%AllocationListStub{}, ...]}` on success |
| 145 | + - `{:error, Tesla.Env.t}` on failure |
| 67 146 | """ |
| 68 147 | @spec get_allocations(Tesla.Env.client(), keyword()) :: |
| 69 | - {:ok, list(NomadClient.Model.AllocationListStub.t())} | {:error, Tesla.Env.t()} |
| 148 | + {:ok, nil} |
| 149 | + | {:ok, list(NomadClient.Model.AllocationListStub.t())} |
| 150 | + | {:error, Tesla.Env.t()} |
| 70 151 | def get_allocations(connection, opts \\ []) do |
| 71 152 | optional_params = %{ |
| 72 | - :namespace => :query, |
| 73 153 | :region => :query, |
| 74 | - :index => :query, |
| 154 | + :namespace => :query, |
| 155 | + :index => :headers, |
| 75 156 | :wait => :query, |
| 76 | - :prefix => :query |
| 157 | + :stale => :query, |
| 158 | + :prefix => :query, |
| 159 | + :"X-Nomad-Token" => :headers, |
| 160 | + :per_page => :query, |
| 161 | + :next_token => :query, |
| 162 | + :resources => :query, |
| 163 | + :task_states => :query |
| 77 164 | } |
| 78 165 | |
| 79 | - %{} |
| 80 | - |> method(:get) |
| 81 | - |> url("/allocations") |
| 82 | - |> add_optional_params(optional_params, opts) |
| 83 | - |> Enum.into([]) |
| 84 | - |> (&Connection.request(connection, &1)).() |
| 166 | + request = |
| 167 | + %{} |
| 168 | + |> method(:get) |
| 169 | + |> url("/allocations") |
| 170 | + |> add_optional_params(optional_params, opts) |
| 171 | + |> Enum.into([]) |
| 172 | + |
| 173 | + connection |
| 174 | + |> Connection.request(request) |
| 85 175 | |> evaluate_response([ |
| 86 | - {200, [%NomadClient.Model.AllocationListStub{}]} |
| 176 | + {200, [%NomadClient.Model.AllocationListStub{}]}, |
| 177 | + {400, false}, |
| 178 | + {403, false}, |
| 179 | + {405, false}, |
| 180 | + {500, false} |
| 87 181 | ]) |
| 88 182 | end |
| 89 183 | |
| 90 184 | @doc """ |
| 91 | - restarts an allocation or task in-place |
| 92 185 | |
| 93 | - ## Parameters |
| 186 | + ### Parameters |
| 94 187 | |
| 95 | - - connection (NomadClient.Connection): Connection to server |
| 96 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 97 | - - allocation_restart_request (AllocationRestartRequest): |
| 98 | - - opts (KeywordList): [optional] Optional parameters |
| 99 | - - :namespace (String.t): |
| 100 | - - :region (String.t): Make a request across regions to the given region |
| 101 | - - :index (integer()): index used for blocking requests |
| 102 | - - :wait (String.t): wait time used for blocking requests |
| 103 | - ## Returns |
| 188 | + - `connection` (NomadClient.Connection): Connection to server |
| 189 | + - `alloc_id` (String.t): Allocation ID. |
| 190 | + - `opts` (keyword): Optional parameters |
| 191 | + - `:region` (String.t): Filters results based on the specified region. |
| 192 | + - `:namespace` (String.t): Filters results based on the specified namespace. |
| 193 | + - `:index` (integer()): If set, wait until query exceeds given index. Must be provided with WaitParam. |
| 194 | + - `:wait` (String.t): Provided with IndexParam to wait for change. |
| 195 | + - `:stale` (String.t): If present, results will include stale reads. |
| 196 | + - `:prefix` (String.t): Constrains results to jobs that start with the defined prefix |
| 197 | + - `:x_nomad_token` (String.t): A Nomad ACL token. |
| 198 | + - `:per_page` (integer()): Maximum number of results to return. |
| 199 | + - `:next_token` (String.t): Indicates where to start paging for queries that support pagination. |
| 200 | + - `:no_shutdown_delay` (boolean()): Flag indicating whether to delay shutdown when requesting an allocation stop. |
| 104 201 | |
| 105 | - {:ok, nil} on success |
| 106 | - {:error, Tesla.Env.t} on failure |
| 202 | + ### Returns |
| 203 | + |
| 204 | + - `{:ok, NomadClient.Model.AllocStopResponse.t}` on success |
| 205 | + - `{:error, Tesla.Env.t}` on failure |
| 107 206 | """ |
| 108 | - @spec restart_allocation( |
| 109 | - Tesla.Env.client(), |
| 110 | - String.t(), |
| 111 | - NomadClient.Model.AllocationRestartRequest.t(), |
| 112 | - keyword() |
| 113 | - ) :: {:ok, nil} | {:error, Tesla.Env.t()} |
| 114 | - def restart_allocation(connection, alloc_id, allocation_restart_request, opts \\ []) do |
| 207 | + @spec post_allocation_stop(Tesla.Env.client(), String.t(), keyword()) :: |
| 208 | + {:ok, nil} | {:ok, NomadClient.Model.AllocStopResponse.t()} | {:error, Tesla.Env.t()} |
| 209 | + def post_allocation_stop(connection, alloc_id, opts \\ []) do |
| 115 210 | optional_params = %{ |
| 116 | - :namespace => :query, |
| 117 211 | :region => :query, |
| 118 | - :index => :query, |
| 119 | - :wait => :query |
| 212 | + :namespace => :query, |
| 213 | + :index => :headers, |
| 214 | + :wait => :query, |
| 215 | + :stale => :query, |
| 216 | + :prefix => :query, |
| 217 | + :"X-Nomad-Token" => :headers, |
| 218 | + :per_page => :query, |
| 219 | + :next_token => :query, |
| 220 | + :no_shutdown_delay => :query |
| 120 221 | } |
| 121 222 | |
| 122 | - %{} |
| 123 | - |> method(:post) |
| 124 | - |> url("/allocation/#{alloc_id}/restart") |
| 125 | - |> add_param(:body, :body, allocation_restart_request) |
| 126 | - |> add_optional_params(optional_params, opts) |
| 127 | - |> Enum.into([]) |
| 128 | - |> (&Connection.request(connection, &1)).() |
| 223 | + request = |
| 224 | + %{} |
| 225 | + |> method(:post) |
| 226 | + |> url("/allocation/#{alloc_id}/stop") |
| 227 | + |> add_optional_params(optional_params, opts) |
| 228 | + |> ensure_body() |
| 229 | + |> Enum.into([]) |
| 230 | + |
| 231 | + connection |
| 232 | + |> Connection.request(request) |
| 129 233 | |> evaluate_response([ |
| 130 | - {200, false} |
| 131 | - ]) |
| 132 | - end |
| 133 | - |
| 134 | - @doc """ |
| 135 | - sends a signal to an allocation or task |
| 136 | - |
| 137 | - ## Parameters |
| 138 | - |
| 139 | - - connection (NomadClient.Connection): Connection to server |
| 140 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 141 | - - alloc_signal_request (AllocSignalRequest): |
| 142 | - - opts (KeywordList): [optional] Optional parameters |
| 143 | - - :namespace (String.t): |
| 144 | - - :region (String.t): Make a request across regions to the given region |
| 145 | - - :index (integer()): index used for blocking requests |
| 146 | - - :wait (String.t): wait time used for blocking requests |
| 147 | - ## Returns |
| 148 | - |
| 149 | - {:ok, nil} on success |
| 150 | - {:error, Tesla.Env.t} on failure |
| 151 | - """ |
| 152 | - @spec signal_allocation( |
| 153 | - Tesla.Env.client(), |
| 154 | - String.t(), |
| 155 | - NomadClient.Model.AllocSignalRequest.t(), |
| 156 | - keyword() |
| 157 | - ) :: {:ok, nil} | {:error, Tesla.Env.t()} |
| 158 | - def signal_allocation(connection, alloc_id, alloc_signal_request, opts \\ []) do |
| 159 | - optional_params = %{ |
| 160 | - :namespace => :query, |
| 161 | - :region => :query, |
| 162 | - :index => :query, |
| 163 | - :wait => :query |
| 164 | - } |
| 165 | - |
| 166 | - %{} |
| 167 | - |> method(:post) |
| 168 | - |> url("/allocation/#{alloc_id}/signal") |
| 169 | - |> add_param(:body, :body, alloc_signal_request) |
| 170 | - |> add_optional_params(optional_params, opts) |
| 171 | - |> Enum.into([]) |
| 172 | - |> (&Connection.request(connection, &1)).() |
| 173 | - |> evaluate_response([ |
| 174 | - {200, false} |
| 175 | - ]) |
| 176 | - end |
| 177 | - |
| 178 | - @doc """ |
| 179 | - stops and reschedules a specific allocation |
| 180 | - |
| 181 | - ## Parameters |
| 182 | - |
| 183 | - - connection (NomadClient.Connection): Connection to server |
| 184 | - - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one |
| 185 | - - opts (KeywordList): [optional] Optional parameters |
| 186 | - - :namespace (String.t): |
| 187 | - - :region (String.t): Make a request across regions to the given region |
| 188 | - - :index (integer()): index used for blocking requests |
| 189 | - - :wait (String.t): wait time used for blocking requests |
| 190 | - ## Returns |
| 191 | - |
| 192 | - {:ok, NomadClient.Model.AllocStopResponse.t} on success |
| 193 | - {:error, Tesla.Env.t} on failure |
| 194 | - """ |
| 195 | - @spec stop_allocation(Tesla.Env.client(), String.t(), keyword()) :: |
| 196 | - {:ok, NomadClient.Model.AllocStopResponse.t()} | {:error, Tesla.Env.t()} |
| 197 | - def stop_allocation(connection, alloc_id, opts \\ []) do |
| 198 | - optional_params = %{ |
| 199 | - :namespace => :query, |
| 200 | - :region => :query, |
| 201 | - :index => :query, |
| 202 | - :wait => :query |
| 203 | - } |
| 204 | - |
| 205 | - %{} |
| 206 | - |> method(:post) |
| 207 | - |> url("/allocation/#{alloc_id}/stop") |
| 208 | - |> add_optional_params(optional_params, opts) |
| 209 | - |> ensure_body() |
| 210 | - |> Enum.into([]) |
| 211 | - |> (&Connection.request(connection, &1)).() |
| 212 | - |> evaluate_response([ |
| 213 | - {200, %NomadClient.Model.AllocStopResponse{}} |
| 234 | + {200, %NomadClient.Model.AllocStopResponse{}}, |
| 235 | + {400, false}, |
| 236 | + {403, false}, |
| 237 | + {405, false}, |
| 238 | + {500, false} |
| 214 239 | ]) |
| 215 240 | end |
| 216 241 | end |
Loading more files…