# NOTE: This file is auto generated by OpenAPI Generator 6.2.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule NomadClient.Api.Deployments do
@moduledoc """
API calls for all endpoints tagged `Deployments`.
"""
alias NomadClient.Connection
import NomadClient.RequestBuilder
@doc """
### Parameters
- `connection` (NomadClient.Connection): Connection to server
- `deployment_id` (String.t): Deployment ID.
- `opts` (keyword): Optional parameters
- `:region` (String.t): Filters results based on the specified region.
- `:namespace` (String.t): Filters results based on the specified namespace.
- `:index` (integer()): If set, wait until query exceeds given index. Must be provided with WaitParam.
- `:wait` (String.t): Provided with IndexParam to wait for change.
- `:stale` (String.t): If present, results will include stale reads.
- `:prefix` (String.t): Constrains results to jobs that start with the defined prefix
- `:x_nomad_token` (String.t): A Nomad ACL token.
- `:per_page` (integer()): Maximum number of results to return.
- `:next_token` (String.t): Indicates where to start paging for queries that support pagination.
### Returns
- `{:ok, NomadClient.Model.Deployment.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_deployment(Tesla.Env.client(), String.t(), keyword()) ::
{:ok, nil} | {:ok, NomadClient.Model.Deployment.t()} | {:error, Tesla.Env.t()}
def get_deployment(connection, deployment_id, opts \\ []) do
optional_params = %{
:region => :query,
:namespace => :query,
:index => :headers,
:wait => :query,
:stale => :query,
:prefix => :query,
:"X-Nomad-Token" => :headers,
:per_page => :query,
:next_token => :query
}
request =
%{}
|> method(:get)
|> url("/deployment/#{deployment_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %NomadClient.Model.Deployment{}},
{400, false},
{403, false},
{405, false},
{500, false}
])
end
@doc """
### Parameters
- `connection` (NomadClient.Connection): Connection to server
- `deployment_id` (String.t): Deployment ID.
- `opts` (keyword): Optional parameters
- `:region` (String.t): Filters results based on the specified region.
- `:namespace` (String.t): Filters results based on the specified namespace.
- `:index` (integer()): If set, wait until query exceeds given index. Must be provided with WaitParam.
- `:wait` (String.t): Provided with IndexParam to wait for change.
- `:stale` (String.t): If present, results will include stale reads.
- `:prefix` (String.t): Constrains results to jobs that start with the defined prefix
- `:x_nomad_token` (String.t): A Nomad ACL token.
- `:per_page` (integer()): Maximum number of results to return.
- `:next_token` (String.t): Indicates where to start paging for queries that support pagination.
### Returns
- `{:ok, [%AllocationListStub{}, ...]}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_deployment_allocations(Tesla.Env.client(), String.t(), keyword()) ::
{:ok, nil}
| {:ok, list(NomadClient.Model.AllocationListStub.t())}
| {:error, Tesla.Env.t()}
def get_deployment_allocations(connection, deployment_id, opts \\ []) do
optional_params = %{
:region => :query,
:namespace => :query,
:index => :headers,
:wait => :query,
:stale => :query,
:prefix => :query,
:"X-Nomad-Token" => :headers,
:per_page => :query,
:next_token => :query
}
request =
%{}
|> method(:get)
|> url("/deployment/allocations/#{deployment_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, [%NomadClient.Model.AllocationListStub{}]},
{400, false},
{403, false},
{405, false},
{500, false}
])
end
@doc """
### Parameters
- `connection` (NomadClient.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:region` (String.t): Filters results based on the specified region.
- `:namespace` (String.t): Filters results based on the specified namespace.
- `:index` (integer()): If set, wait until query exceeds given index. Must be provided with WaitParam.
- `:wait` (String.t): Provided with IndexParam to wait for change.
- `:stale` (String.t): If present, results will include stale reads.
- `:prefix` (String.t): Constrains results to jobs that start with the defined prefix
- `:x_nomad_token` (String.t): A Nomad ACL token.
- `:per_page` (integer()): Maximum number of results to return.
- `:next_token` (String.t): Indicates where to start paging for queries that support pagination.
### Returns
- `{:ok, [%Deployment{}, ...]}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_deployments(Tesla.Env.client(), keyword()) ::
{:ok, nil} | {:ok, list(NomadClient.Model.Deployment.t())} | {:error, Tesla.Env.t()}
def get_deployments(connection, opts \\ []) do
optional_params = %{
:region => :query,
:namespace => :query,
:index => :headers,
:wait => :query,
:stale => :query,
:prefix => :query,
:"X-Nomad-Token" => :headers,
:per_page => :query,
:next_token => :query
}
request =
%{}
|> method(:get)
|> url("/deployments")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, [%NomadClient.Model.Deployment{}]},
{400, false},
{403, false},
{405, false},
{500, false}
])
end
@doc """
### Parameters
- `connection` (NomadClient.Connection): Connection to server
- `deployment_id` (String.t): Deployment ID.
- `deployment_alloc_health_request` (DeploymentAllocHealthRequest):
- `opts` (keyword): Optional parameters
- `:region` (String.t): Filters results based on the specified region.
- `:namespace` (String.t): Filters results based on the specified namespace.
- `:x_nomad_token` (String.t): A Nomad ACL token.
- `:idempotency_token` (String.t): Can be used to ensure operations are only run once.
### Returns
- `{:ok, NomadClient.Model.DeploymentUpdateResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec post_deployment_allocation_health(
Tesla.Env.client(),
String.t(),
NomadClient.Model.DeploymentAllocHealthRequest.t(),
keyword()
) ::
{:ok, nil}
| {:ok, NomadClient.Model.DeploymentUpdateResponse.t()}
| {:error, Tesla.Env.t()}
def post_deployment_allocation_health(
connection,
deployment_id,
deployment_alloc_health_request,
opts \\ []
) do
optional_params = %{
:region => :query,
:namespace => :query,
:"X-Nomad-Token" => :headers,
:idempotency_token => :query
}
request =
%{}
|> method(:post)
|> url("/deployment/allocation-health/#{deployment_id}")
|> add_param(:body, :body, deployment_alloc_health_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %NomadClient.Model.DeploymentUpdateResponse{}},
{400, false},
{403, false},
{405, false},
{500, false}
])
end
@doc """
### Parameters
- `connection` (NomadClient.Connection): Connection to server
- `deployment_id` (String.t): Deployment ID.
- `opts` (keyword): Optional parameters
- `:region` (String.t): Filters results based on the specified region.
- `:namespace` (String.t): Filters results based on the specified namespace.
- `:x_nomad_token` (String.t): A Nomad ACL token.
- `:idempotency_token` (String.t): Can be used to ensure operations are only run once.
### Returns
- `{:ok, NomadClient.Model.DeploymentUpdateResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec post_deployment_fail(Tesla.Env.client(), String.t(), keyword()) ::
{:ok, nil}
| {:ok, NomadClient.Model.DeploymentUpdateResponse.t()}
| {:error, Tesla.Env.t()}
def post_deployment_fail(connection, deployment_id, opts \\ []) do
optional_params = %{
:region => :query,
:namespace => :query,
:"X-Nomad-Token" => :headers,
:idempotency_token => :query
}
request =
%{}
|> method(:post)
|> url("/deployment/fail/#{deployment_id}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %NomadClient.Model.DeploymentUpdateResponse{}},
{400, false},
{403, false},
{405, false},
{500, false}
])
end
@doc """
### Parameters
- `connection` (NomadClient.Connection): Connection to server
- `deployment_id` (String.t): Deployment ID.
- `deployment_pause_request` (DeploymentPauseRequest):
- `opts` (keyword): Optional parameters
- `:region` (String.t): Filters results based on the specified region.
- `:namespace` (String.t): Filters results based on the specified namespace.
- `:x_nomad_token` (String.t): A Nomad ACL token.
- `:idempotency_token` (String.t): Can be used to ensure operations are only run once.
### Returns
- `{:ok, NomadClient.Model.DeploymentUpdateResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec post_deployment_pause(
Tesla.Env.client(),
String.t(),
NomadClient.Model.DeploymentPauseRequest.t(),
keyword()
) ::
{:ok, nil}
| {:ok, NomadClient.Model.DeploymentUpdateResponse.t()}
| {:error, Tesla.Env.t()}
def post_deployment_pause(connection, deployment_id, deployment_pause_request, opts \\ []) do
optional_params = %{
:region => :query,
:namespace => :query,
:"X-Nomad-Token" => :headers,
:idempotency_token => :query
}
request =
%{}
|> method(:post)
|> url("/deployment/pause/#{deployment_id}")
|> add_param(:body, :body, deployment_pause_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %NomadClient.Model.DeploymentUpdateResponse{}},
{400, false},
{403, false},
{405, false},
{500, false}
])
end
@doc """
### Parameters
- `connection` (NomadClient.Connection): Connection to server
- `deployment_id` (String.t): Deployment ID.
- `deployment_promote_request` (DeploymentPromoteRequest):
- `opts` (keyword): Optional parameters
- `:region` (String.t): Filters results based on the specified region.
- `:namespace` (String.t): Filters results based on the specified namespace.
- `:x_nomad_token` (String.t): A Nomad ACL token.
- `:idempotency_token` (String.t): Can be used to ensure operations are only run once.
### Returns
- `{:ok, NomadClient.Model.DeploymentUpdateResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec post_deployment_promote(
Tesla.Env.client(),
String.t(),
NomadClient.Model.DeploymentPromoteRequest.t(),
keyword()
) ::
{:ok, nil}
| {:ok, NomadClient.Model.DeploymentUpdateResponse.t()}
| {:error, Tesla.Env.t()}
def post_deployment_promote(connection, deployment_id, deployment_promote_request, opts \\ []) do
optional_params = %{
:region => :query,
:namespace => :query,
:"X-Nomad-Token" => :headers,
:idempotency_token => :query
}
request =
%{}
|> method(:post)
|> url("/deployment/promote/#{deployment_id}")
|> add_param(:body, :body, deployment_promote_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %NomadClient.Model.DeploymentUpdateResponse{}},
{400, false},
{403, false},
{405, false},
{500, false}
])
end
@doc """
### Parameters
- `connection` (NomadClient.Connection): Connection to server
- `deployment_id` (String.t): Deployment ID.
- `deployment_unblock_request` (DeploymentUnblockRequest):
- `opts` (keyword): Optional parameters
- `:region` (String.t): Filters results based on the specified region.
- `:namespace` (String.t): Filters results based on the specified namespace.
- `:x_nomad_token` (String.t): A Nomad ACL token.
- `:idempotency_token` (String.t): Can be used to ensure operations are only run once.
### Returns
- `{:ok, NomadClient.Model.DeploymentUpdateResponse.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec post_deployment_unblock(
Tesla.Env.client(),
String.t(),
NomadClient.Model.DeploymentUnblockRequest.t(),
keyword()
) ::
{:ok, nil}
| {:ok, NomadClient.Model.DeploymentUpdateResponse.t()}
| {:error, Tesla.Env.t()}
def post_deployment_unblock(connection, deployment_id, deployment_unblock_request, opts \\ []) do
optional_params = %{
:region => :query,
:namespace => :query,
:"X-Nomad-Token" => :headers,
:idempotency_token => :query
}
request =
%{}
|> method(:post)
|> url("/deployment/unblock/#{deployment_id}")
|> add_param(:body, :body, deployment_unblock_request)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %NomadClient.Model.DeploymentUpdateResponse{}},
{400, false},
{403, false},
{405, false},
{500, false}
])
end
end