Current section

8 Versions

Jump to

Compare versions

7 files changed
+153 additions
-187 deletions
  @@ -212,4 +212,4 @@
212 212 {<<"optional">>,true},
213 213 {<<"repository">>,<<"hexpm">>},
214 214 {<<"requirement">>,<<"~> 1.0">>}]]}.
215 - {<<"version">>,<<"0.11.0">>}.
215 + {<<"version">>,<<"0.12.0">>}.
  @@ -74,25 +74,24 @@ defmodule NomadClient.Api.Allocations do
74 74
75 75 - connection (NomadClient.Connection): Connection to server
76 76 - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one
77 + - allocation_restart_request (AllocationRestartRequest):
77 78 - opts (KeywordList): [optional] Optional parameters
78 - - :body (AllocationRestartRequest):
79 79 ## Returns
80 80
81 81 {:ok, nil} on success
82 82 {:error, Tesla.Env.t} on failure
83 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 -
84 + @spec restart_allocation(
85 + Tesla.Env.client(),
86 + String.t(),
87 + NomadClient.Model.AllocationRestartRequest.t(),
88 + keyword()
89 + ) :: {:ok, nil} | {:error, Tesla.Env.t()}
90 + def restart_allocation(connection, alloc_id, allocation_restart_request, _opts \\ []) do
91 91 %{}
92 92 |> method(:post)
93 93 |> url("/allocation/#{alloc_id}/restart")
94 - |> add_optional_params(optional_params, opts)
95 - |> ensure_body()
94 + |> add_param(:body, :body, allocation_restart_request)
96 95 |> Enum.into([])
97 96 |> (&Connection.request(connection, &1)).()
98 97 |> evaluate_response([
  @@ -107,25 +106,24 @@ defmodule NomadClient.Api.Allocations do
107 106
108 107 - connection (NomadClient.Connection): Connection to server
109 108 - alloc_id (String.t): Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one
109 + - alloc_signal_request (AllocSignalRequest):
110 110 - opts (KeywordList): [optional] Optional parameters
111 - - :body (AllocSignalRequest):
112 111 ## Returns
113 112
114 113 {:ok, nil} on success
115 114 {:error, Tesla.Env.t} on failure
116 115 """
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 -
116 + @spec signal_allocation(
117 + Tesla.Env.client(),
118 + String.t(),
119 + NomadClient.Model.AllocSignalRequest.t(),
120 + keyword()
121 + ) :: {:ok, nil} | {:error, Tesla.Env.t()}
122 + def signal_allocation(connection, alloc_id, alloc_signal_request, _opts \\ []) do
124 123 %{}
125 124 |> method(:post)
126 125 |> url("/allocation/#{alloc_id}/signal")
127 - |> add_optional_params(optional_params, opts)
128 - |> ensure_body()
126 + |> add_param(:body, :body, alloc_signal_request)
129 127 |> Enum.into([])
130 128 |> (&Connection.request(connection, &1)).()
131 129 |> evaluate_response([
  @@ -127,25 +127,24 @@ defmodule NomadClient.Api.Deployments do
127 127
128 128 - connection (NomadClient.Connection): Connection to server
129 129 - deployment_id (String.t): Specifies the UUID of the deployment. This must be the full UUID, not the short 8-character one. This is specified as part of the path
130 + - deployment_pause_request (DeploymentPauseRequest):
130 131 - opts (KeywordList): [optional] Optional parameters
131 - - :body (DeploymentPauseRequest):
132 132 ## Returns
133 133
134 134 {:ok, NomadClient.Model.DeploymentUpdateResponse.t} on success
135 135 {:error, Tesla.Env.t} on failure
136 136 """
137 - @spec pause_deployment(Tesla.Env.client(), String.t(), keyword()) ::
138 - {:ok, NomadClient.Model.DeploymentUpdateResponse.t()} | {:error, Tesla.Env.t()}
139 - def pause_deployment(connection, deployment_id, opts \\ []) do
140 - optional_params = %{
141 - :body => :body
142 - }
143 -
137 + @spec pause_deployment(
138 + Tesla.Env.client(),
139 + String.t(),
140 + NomadClient.Model.DeploymentPauseRequest.t(),
141 + keyword()
142 + ) :: {:ok, NomadClient.Model.DeploymentUpdateResponse.t()} | {:error, Tesla.Env.t()}
143 + def pause_deployment(connection, deployment_id, deployment_pause_request, _opts \\ []) do
144 144 %{}
145 145 |> method(:post)
146 146 |> url("/deployment/pause/#{deployment_id}")
147 - |> add_optional_params(optional_params, opts)
148 - |> ensure_body()
147 + |> add_param(:body, :body, deployment_pause_request)
149 148 |> Enum.into([])
150 149 |> (&Connection.request(connection, &1)).()
151 150 |> evaluate_response([
  @@ -160,25 +159,24 @@ defmodule NomadClient.Api.Deployments do
160 159
161 160 - connection (NomadClient.Connection): Connection to server
162 161 - deployment_id (String.t): Specifies the UUID of the deployment. This must be the full UUID, not the short 8-character one. This is specified as part of the path
162 + - deployment_promote_request (DeploymentPromoteRequest):
163 163 - opts (KeywordList): [optional] Optional parameters
164 - - :body (DeploymentPromoteRequest):
165 164 ## Returns
166 165
167 166 {:ok, NomadClient.Model.DeploymentUpdateResponse.t} on success
168 167 {:error, Tesla.Env.t} on failure
169 168 """
170 - @spec promote_deployment(Tesla.Env.client(), String.t(), keyword()) ::
171 - {:ok, NomadClient.Model.DeploymentUpdateResponse.t()} | {:error, Tesla.Env.t()}
172 - def promote_deployment(connection, deployment_id, opts \\ []) do
173 - optional_params = %{
174 - :body => :body
175 - }
176 -
169 + @spec promote_deployment(
170 + Tesla.Env.client(),
171 + String.t(),
172 + NomadClient.Model.DeploymentPromoteRequest.t(),
173 + keyword()
174 + ) :: {:ok, NomadClient.Model.DeploymentUpdateResponse.t()} | {:error, Tesla.Env.t()}
175 + def promote_deployment(connection, deployment_id, deployment_promote_request, _opts \\ []) do
177 176 %{}
178 177 |> method(:post)
179 178 |> url("/deployment/promote/#{deployment_id}")
180 - |> add_optional_params(optional_params, opts)
181 - |> ensure_body()
179 + |> add_param(:body, :body, deployment_promote_request)
182 180 |> Enum.into([])
183 181 |> (&Connection.request(connection, &1)).()
184 182 |> evaluate_response([
  @@ -194,25 +192,29 @@ defmodule NomadClient.Api.Deployments do
194 192
195 193 - connection (NomadClient.Connection): Connection to server
196 194 - deployment_id (String.t): Specifies the UUID of the deployment. This must be the full UUID, not the short 8-character one. This is specified as part of the path
195 + - deployment_alloc_health_request (DeploymentAllocHealthRequest):
197 196 - opts (KeywordList): [optional] Optional parameters
198 - - :body (DeploymentAllocHealthRequest):
199 197 ## Returns
200 198
201 199 {:ok, NomadClient.Model.DeploymentUpdateResponse.t} on success
202 200 {:error, Tesla.Env.t} on failure
203 201 """
204 - @spec set_allocation_health_in_deployment(Tesla.Env.client(), String.t(), keyword()) ::
205 - {:ok, NomadClient.Model.DeploymentUpdateResponse.t()} | {:error, Tesla.Env.t()}
206 - def set_allocation_health_in_deployment(connection, deployment_id, opts \\ []) do
207 - optional_params = %{
208 - :body => :body
209 - }
210 -
202 + @spec set_allocation_health_in_deployment(
203 + Tesla.Env.client(),
204 + String.t(),
205 + NomadClient.Model.DeploymentAllocHealthRequest.t(),
206 + keyword()
207 + ) :: {:ok, NomadClient.Model.DeploymentUpdateResponse.t()} | {:error, Tesla.Env.t()}
208 + def set_allocation_health_in_deployment(
209 + connection,
210 + deployment_id,
211 + deployment_alloc_health_request,
212 + _opts \\ []
213 + ) do
211 214 %{}
212 215 |> method(:post)
213 216 |> url("/deployment/allocation-health/#{deployment_id}")
214 - |> add_optional_params(optional_params, opts)
215 - |> ensure_body()
217 + |> add_param(:body, :body, deployment_alloc_health_request)
216 218 |> Enum.into([])
217 219 |> (&Connection.request(connection, &1)).()
218 220 |> evaluate_response([
  @@ -17,25 +17,24 @@ defmodule NomadClient.Api.Jobs do
17 17
18 18 - connection (NomadClient.Connection): Connection to server
19 19 - job_id (String.t): job id
20 + - job_dispatch_request (JobDispatchRequest):
20 21 - opts (KeywordList): [optional] Optional parameters
21 - - :body (JobDispatchRequest):
22 22 ## Returns
23 23
24 24 {:ok, NomadClient.Model.JobDispatchResponse.t} on success
25 25 {:error, Tesla.Env.t} on failure
26 26 """
27 - @spec dispatch_job(Tesla.Env.client(), String.t(), keyword()) ::
28 - {:ok, NomadClient.Model.JobDispatchResponse.t()} | {:error, Tesla.Env.t()}
29 - def dispatch_job(connection, job_id, opts \\ []) do
30 - optional_params = %{
31 - :body => :body
32 - }
33 -
27 + @spec dispatch_job(
28 + Tesla.Env.client(),
29 + String.t(),
30 + NomadClient.Model.JobDispatchRequest.t(),
31 + keyword()
32 + ) :: {:ok, NomadClient.Model.JobDispatchResponse.t()} | {:error, Tesla.Env.t()}
33 + def dispatch_job(connection, job_id, job_dispatch_request, _opts \\ []) do
34 34 %{}
35 35 |> method(:post)
36 36 |> url("/job/#{job_id}/dispatch")
37 - |> add_optional_params(optional_params, opts)
38 - |> ensure_body()
37 + |> add_param(:body, :body, job_dispatch_request)
39 38 |> Enum.into([])
40 39 |> (&Connection.request(connection, &1)).()
41 40 |> evaluate_response([
  @@ -50,25 +49,24 @@ defmodule NomadClient.Api.Jobs do
50 49
51 50 - connection (NomadClient.Connection): Connection to server
52 51 - job_id (String.t): job id
52 + - job_evaluate_request (JobEvaluateRequest):
53 53 - opts (KeywordList): [optional] Optional parameters
54 - - :body (JobEvaluateRequest):
55 54 ## Returns
56 55
57 56 {:ok, NomadClient.Model.JobRegisterResponse.t} on success
58 57 {:error, Tesla.Env.t} on failure
59 58 """
60 - @spec evaluate_job(Tesla.Env.client(), String.t(), keyword()) ::
61 - {:ok, NomadClient.Model.JobRegisterResponse.t()} | {:error, Tesla.Env.t()}
62 - def evaluate_job(connection, job_id, opts \\ []) do
63 - optional_params = %{
64 - :body => :body
65 - }
66 -
59 + @spec evaluate_job(
60 + Tesla.Env.client(),
61 + String.t(),
62 + NomadClient.Model.JobEvaluateRequest.t(),
63 + keyword()
64 + ) :: {:ok, NomadClient.Model.JobRegisterResponse.t()} | {:error, Tesla.Env.t()}
65 + def evaluate_job(connection, job_id, job_evaluate_request, _opts \\ []) do
67 66 %{}
68 67 |> method(:post)
69 68 |> url("/job/#{job_id}/evaluate")
70 - |> add_optional_params(optional_params, opts)
71 - |> ensure_body()
69 + |> add_param(:body, :body, job_evaluate_request)
72 70 |> Enum.into([])
73 71 |> (&Connection.request(connection, &1)).()
74 72 |> evaluate_response([
  @@ -360,25 +358,20 @@ defmodule NomadClient.Api.Jobs do
360 358 ## Parameters
361 359
362 360 - connection (NomadClient.Connection): Connection to server
361 + - jobs_parse_request (JobsParseRequest):
363 362 - opts (KeywordList): [optional] Optional parameters
364 - - :body (JobsParseRequest):
365 363 ## Returns
366 364
367 365 {:ok, NomadClient.Model.Job.t} on success
368 366 {:error, Tesla.Env.t} on failure
369 367 """
370 - @spec parse_job_hcl(Tesla.Env.client(), keyword()) ::
368 + @spec parse_job_hcl(Tesla.Env.client(), NomadClient.Model.JobsParseRequest.t(), keyword()) ::
371 369 {:ok, NomadClient.Model.Job.t()} | {:error, Tesla.Env.t()}
372 - def parse_job_hcl(connection, opts \\ []) do
373 - optional_params = %{
374 - :body => :body
375 - }
376 -
370 + def parse_job_hcl(connection, jobs_parse_request, _opts \\ []) do
377 371 %{}
378 372 |> method(:post)
379 373 |> url("/jobs/parse")
380 - |> add_optional_params(optional_params, opts)
381 - |> ensure_body()
374 + |> add_param(:body, :body, jobs_parse_request)
382 375 |> Enum.into([])
383 376 |> (&Connection.request(connection, &1)).()
384 377 |> evaluate_response([
  @@ -393,25 +386,20 @@ defmodule NomadClient.Api.Jobs do
393 386
394 387 - connection (NomadClient.Connection): Connection to server
395 388 - job_id (String.t): job id
389 + - job_plan_request (JobPlanRequest):
396 390 - opts (KeywordList): [optional] Optional parameters
397 - - :body (JobPlanRequest):
398 391 ## Returns
399 392
400 393 {:ok, NomadClient.Model.JobPlanResponse.t} on success
401 394 {:error, Tesla.Env.t} on failure
402 395 """
403 - @spec plan_job(Tesla.Env.client(), String.t(), keyword()) ::
396 + @spec plan_job(Tesla.Env.client(), String.t(), NomadClient.Model.JobPlanRequest.t(), keyword()) ::
404 397 {:ok, NomadClient.Model.JobPlanResponse.t()} | {:error, Tesla.Env.t()}
405 - def plan_job(connection, job_id, opts \\ []) do
406 - optional_params = %{
407 - :body => :body
408 - }
409 -
398 + def plan_job(connection, job_id, job_plan_request, _opts \\ []) do
410 399 %{}
411 400 |> method(:post)
412 401 |> url("/job/#{job_id}/plan")
413 - |> add_optional_params(optional_params, opts)
414 - |> ensure_body()
402 + |> add_param(:body, :body, job_plan_request)
415 403 |> Enum.into([])
416 404 |> (&Connection.request(connection, &1)).()
417 405 |> evaluate_response([
  @@ -425,25 +413,20 @@ defmodule NomadClient.Api.Jobs do
425 413 ## Parameters
426 414
427 415 - connection (NomadClient.Connection): Connection to server
416 + - register_job_request (RegisterJobRequest):
428 417 - opts (KeywordList): [optional] Optional parameters
429 - - :body (RegisterJobRequest):
430 418 ## Returns
431 419
432 420 {:ok, NomadClient.Model.JobRegisterResponse.t} on success
433 421 {:error, Tesla.Env.t} on failure
434 422 """
435 - @spec register_job(Tesla.Env.client(), keyword()) ::
423 + @spec register_job(Tesla.Env.client(), NomadClient.Model.RegisterJobRequest.t(), keyword()) ::
436 424 {:ok, NomadClient.Model.JobRegisterResponse.t()} | {:error, Tesla.Env.t()}
437 - def register_job(connection, opts \\ []) do
438 - optional_params = %{
439 - :body => :body
440 - }
441 -
425 + def register_job(connection, register_job_request, _opts \\ []) do
442 426 %{}
443 427 |> method(:post)
444 428 |> url("/jobs")
445 - |> add_optional_params(optional_params, opts)
446 - |> ensure_body()
429 + |> add_param(:body, :body, register_job_request)
447 430 |> Enum.into([])
448 431 |> (&Connection.request(connection, &1)).()
449 432 |> evaluate_response([
  @@ -458,25 +441,24 @@ defmodule NomadClient.Api.Jobs do
458 441
459 442 - connection (NomadClient.Connection): Connection to server
460 443 - job_id (String.t): job id
444 + - job_revert_request (JobRevertRequest):
461 445 - opts (KeywordList): [optional] Optional parameters
462 - - :body (JobRevertRequest):
463 446 ## Returns
464 447
465 448 {:ok, NomadClient.Model.JobRegisterResponse.t} on success
466 449 {:error, Tesla.Env.t} on failure
467 450 """
468 - @spec revert_job(Tesla.Env.client(), String.t(), keyword()) ::
469 - {:ok, NomadClient.Model.JobRegisterResponse.t()} | {:error, Tesla.Env.t()}
470 - def revert_job(connection, job_id, opts \\ []) do
471 - optional_params = %{
472 - :body => :body
473 - }
474 -
451 + @spec revert_job(
452 + Tesla.Env.client(),
453 + String.t(),
454 + NomadClient.Model.JobRevertRequest.t(),
455 + keyword()
456 + ) :: {:ok, NomadClient.Model.JobRegisterResponse.t()} | {:error, Tesla.Env.t()}
457 + def revert_job(connection, job_id, job_revert_request, _opts \\ []) do
475 458 %{}
476 459 |> method(:post)
477 460 |> url("/job/#{job_id}/revert")
478 - |> add_optional_params(optional_params, opts)
479 - |> ensure_body()
461 + |> add_param(:body, :body, job_revert_request)
480 462 |> Enum.into([])
481 463 |> (&Connection.request(connection, &1)).()
482 464 |> evaluate_response([
  @@ -491,25 +473,24 @@ defmodule NomadClient.Api.Jobs do
491 473
492 474 - connection (NomadClient.Connection): Connection to server
493 475 - job_id (String.t): job id
476 + - scaling_request (ScalingRequest):
494 477 - opts (KeywordList): [optional] Optional parameters
495 - - :body (ScalingRequest):
496 478 ## Returns
497 479
498 480 {:ok, NomadClient.Model.JobRegisterResponse.t} on success
499 481 {:error, Tesla.Env.t} on failure
500 482 """
501 - @spec scale_task_group(Tesla.Env.client(), String.t(), keyword()) ::
502 - {:ok, NomadClient.Model.JobRegisterResponse.t()} | {:error, Tesla.Env.t()}
503 - def scale_task_group(connection, job_id, opts \\ []) do
504 - optional_params = %{
505 - :body => :body
506 - }
507 -
483 + @spec scale_task_group(
484 + Tesla.Env.client(),
485 + String.t(),
486 + NomadClient.Model.ScalingRequest.t(),
487 + keyword()
488 + ) :: {:ok, NomadClient.Model.JobRegisterResponse.t()} | {:error, Tesla.Env.t()}
489 + def scale_task_group(connection, job_id, scaling_request, _opts \\ []) do
508 490 %{}
509 491 |> method(:post)
510 492 |> url("/job/#{job_id}/scale")
511 - |> add_optional_params(optional_params, opts)
512 - |> ensure_body()
493 + |> add_param(:body, :body, scaling_request)
513 494 |> Enum.into([])
514 495 |> (&Connection.request(connection, &1)).()
515 496 |> evaluate_response([
  @@ -524,25 +505,24 @@ defmodule NomadClient.Api.Jobs do
524 505
525 506 - connection (NomadClient.Connection): Connection to server
526 507 - job_id (String.t): job id
508 + - job_stability_request (JobStabilityRequest):
527 509 - opts (KeywordList): [optional] Optional parameters
528 - - :body (JobStabilityRequest):
529 510 ## Returns
530 511
531 512 {:ok, NomadClient.Model.JobStabilityResponse.t} on success
532 513 {:error, Tesla.Env.t} on failure
533 514 """
534 - @spec set_job_stability(Tesla.Env.client(), String.t(), keyword()) ::
535 - {:ok, NomadClient.Model.JobStabilityResponse.t()} | {:error, Tesla.Env.t()}
536 - def set_job_stability(connection, job_id, opts \\ []) do
537 - optional_params = %{
538 - :body => :body
539 - }
540 -
515 + @spec set_job_stability(
516 + Tesla.Env.client(),
517 + String.t(),
518 + NomadClient.Model.JobStabilityRequest.t(),
519 + keyword()
520 + ) :: {:ok, NomadClient.Model.JobStabilityResponse.t()} | {:error, Tesla.Env.t()}
521 + def set_job_stability(connection, job_id, job_stability_request, _opts \\ []) do
541 522 %{}
542 523 |> method(:post)
543 524 |> url("/job/#{job_id}/stable")
544 - |> add_optional_params(optional_params, opts)
545 - |> ensure_body()
525 + |> add_param(:body, :body, job_stability_request)
546 526 |> Enum.into([])
547 527 |> (&Connection.request(connection, &1)).()
548 528 |> evaluate_response([
  @@ -589,25 +569,24 @@ defmodule NomadClient.Api.Jobs do
589 569
590 570 - connection (NomadClient.Connection): Connection to server
591 571 - job_id (String.t): job id
572 + - register_job_request (RegisterJobRequest):
592 573 - opts (KeywordList): [optional] Optional parameters
593 - - :body (RegisterJobRequest):
594 574 ## Returns
595 575
596 576 {:ok, NomadClient.Model.JobRegisterResponse.t} on success
597 577 {:error, Tesla.Env.t} on failure
598 578 """
599 - @spec update_job(Tesla.Env.client(), String.t(), keyword()) ::
600 - {:ok, NomadClient.Model.JobRegisterResponse.t()} | {:error, Tesla.Env.t()}
601 - def update_job(connection, job_id, opts \\ []) do
602 - optional_params = %{
603 - :body => :body
604 - }
605 -
579 + @spec update_job(
580 + Tesla.Env.client(),
581 + String.t(),
582 + NomadClient.Model.RegisterJobRequest.t(),
583 + keyword()
584 + ) :: {:ok, NomadClient.Model.JobRegisterResponse.t()} | {:error, Tesla.Env.t()}
585 + def update_job(connection, job_id, register_job_request, _opts \\ []) do
606 586 %{}
607 587 |> method(:post)
608 588 |> url("/job/#{job_id}")
609 - |> add_optional_params(optional_params, opts)
610 - |> ensure_body()
589 + |> add_param(:body, :body, register_job_request)
611 590 |> Enum.into([])
612 591 |> (&Connection.request(connection, &1)).()
613 592 |> evaluate_response([
  @@ -621,25 +600,20 @@ defmodule NomadClient.Api.Jobs do
621 600 ## Parameters
622 601
623 602 - connection (NomadClient.Connection): Connection to server
603 + - job_validate_request (JobValidateRequest):
624 604 - opts (KeywordList): [optional] Optional parameters
625 - - :body (JobValidateRequest):
626 605 ## Returns
627 606
628 607 {:ok, NomadClient.Model.JobValidateResponse.t} on success
629 608 {:error, Tesla.Env.t} on failure
630 609 """
631 - @spec validate_job(Tesla.Env.client(), keyword()) ::
610 + @spec validate_job(Tesla.Env.client(), NomadClient.Model.JobValidateRequest.t(), keyword()) ::
632 611 {:ok, NomadClient.Model.JobValidateResponse.t()} | {:error, Tesla.Env.t()}
633 - def validate_job(connection, opts \\ []) do
634 - optional_params = %{
635 - :body => :body
636 - }
637 -
612 + def validate_job(connection, job_validate_request, _opts \\ []) do
638 613 %{}
639 614 |> method(:post)
640 615 |> url("/validate/job")
641 - |> add_optional_params(optional_params, opts)
642 - |> ensure_body()
616 + |> add_param(:body, :body, job_validate_request)
643 617 |> Enum.into([])
644 618 |> (&Connection.request(connection, &1)).()
645 619 |> evaluate_response([
  @@ -128,25 +128,20 @@ defmodule NomadClient.Api.Nodes do
128 128 ## Parameters
129 129
130 130 - connection (NomadClient.Connection): Connection to server
131 + - search_request (SearchRequest):
131 132 - opts (KeywordList): [optional] Optional parameters
132 - - :body (SearchRequest):
133 133 ## Returns
134 134
135 135 {:ok, NomadClient.Model.SearchResponse.t} on success
136 136 {:error, Tesla.Env.t} on failure
137 137 """
138 - @spec search(Tesla.Env.client(), keyword()) ::
138 + @spec search(Tesla.Env.client(), NomadClient.Model.SearchRequest.t(), keyword()) ::
139 139 {:ok, NomadClient.Model.SearchResponse.t()} | {:error, Tesla.Env.t()}
140 - def search(connection, opts \\ []) do
141 - optional_params = %{
142 - :body => :body
143 - }
144 -
140 + def search(connection, search_request, _opts \\ []) do
145 141 %{}
146 142 |> method(:post)
147 143 |> url("/search")
148 - |> add_optional_params(optional_params, opts)
149 - |> ensure_body()
144 + |> add_param(:body, :body, search_request)
150 145 |> Enum.into([])
151 146 |> (&Connection.request(connection, &1)).()
152 147 |> evaluate_response([
  @@ -162,25 +157,24 @@ defmodule NomadClient.Api.Nodes do
162 157
163 158 - connection (NomadClient.Connection): Connection to server
164 159 - node_id (String.t): Specifies the ID of the node. This must be the full UUID, not the short 8-character one. This is specified as part of the path
160 + - node_update_drain_request (NodeUpdateDrainRequest):
165 161 - opts (KeywordList): [optional] Optional parameters
166 - - :body (NodeUpdateDrainRequest):
167 162 ## Returns
168 163
169 164 {:ok, NomadClient.Model.NodeDrainUpdateResponse.t} on success
170 165 {:error, Tesla.Env.t} on failure
171 166 """
172 - @spec update_drain_mode_for_node(Tesla.Env.client(), String.t(), keyword()) ::
173 - {:ok, NomadClient.Model.NodeDrainUpdateResponse.t()} | {:error, Tesla.Env.t()}
174 - def update_drain_mode_for_node(connection, node_id, opts \\ []) do
175 - optional_params = %{
176 - :body => :body
177 - }
178 -
167 + @spec update_drain_mode_for_node(
168 + Tesla.Env.client(),
169 + String.t(),
170 + NomadClient.Model.NodeUpdateDrainRequest.t(),
171 + keyword()
172 + ) :: {:ok, NomadClient.Model.NodeDrainUpdateResponse.t()} | {:error, Tesla.Env.t()}
173 + def update_drain_mode_for_node(connection, node_id, node_update_drain_request, _opts \\ []) do
179 174 %{}
180 175 |> method(:post)
181 176 |> url("/node/#{node_id}/drain")
182 - |> add_optional_params(optional_params, opts)
183 - |> ensure_body()
177 + |> add_param(:body, :body, node_update_drain_request)
184 178 |> Enum.into([])
185 179 |> (&Connection.request(connection, &1)).()
186 180 |> evaluate_response([
  @@ -195,25 +189,24 @@ defmodule NomadClient.Api.Nodes do
195 189
196 190 - connection (NomadClient.Connection): Connection to server
197 191 - node_id (String.t): Specifies the ID of the node. This must be the full UUID, not the short 8-character one. This is specified as part of the path
192 + - node_update_eligibility_request (NodeUpdateEligibilityRequest):
198 193 - opts (KeywordList): [optional] Optional parameters
199 - - :body (NodeUpdateEligibilityRequest):
200 194 ## Returns
201 195
202 196 {:ok, NomadClient.Model.NodeEligibilityUpdateResponse.t} on success
203 197 {:error, Tesla.Env.t} on failure
204 198 """
205 - @spec update_node_eligibility(Tesla.Env.client(), String.t(), keyword()) ::
206 - {:ok, NomadClient.Model.NodeEligibilityUpdateResponse.t()} | {:error, Tesla.Env.t()}
207 - def update_node_eligibility(connection, node_id, opts \\ []) do
208 - optional_params = %{
209 - :body => :body
210 - }
211 -
199 + @spec update_node_eligibility(
200 + Tesla.Env.client(),
201 + String.t(),
202 + NomadClient.Model.NodeUpdateEligibilityRequest.t(),
203 + keyword()
204 + ) :: {:ok, NomadClient.Model.NodeEligibilityUpdateResponse.t()} | {:error, Tesla.Env.t()}
205 + def update_node_eligibility(connection, node_id, node_update_eligibility_request, _opts \\ []) do
212 206 %{}
213 207 |> method(:post)
214 208 |> url("/node/#{node_id}/eligibility")
215 - |> add_optional_params(optional_params, opts)
216 - |> ensure_body()
209 + |> add_param(:body, :body, node_update_eligibility_request)
217 210 |> Enum.into([])
218 211 |> (&Connection.request(connection, &1)).()
219 212 |> evaluate_response([
Loading more files…