Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
* Rename `id` arguments to `id_` across of code base
* Rename `type` arguments to `type_` across of code base
### Other changes
* Add more missing parameters to allocations.get_allocations()
* Up `requests` lib version to 2.28.1
* Add migging parameters to allocations.get_allocations and jobs.get_jobs (#144). Thanks @Kamilcuk
* Add missing parameters to allocations.get_allocations and jobs.get_jobs (#144). Thanks @Kamilcuk
* Add option for custom user agent
## 1.5.0
* Add `namespace` agrument support for `get_allocations` and `get_deployments` endpoints (#133)
* Add `namespace` argument support for `get_allocations` and `get_deployments` endpoints (#133)
* Add Python 3.10 support (#133)
* Add support for pre-populated Sessions (#132)
* Add scaling policy endpoint (#136)
Expand Down
12 changes: 12 additions & 0 deletions nomad/api/allocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,45 @@ def __iter__(self):
def get_allocations( # pylint: disable=too-many-arguments
self,
prefix: Optional[str] = None,
next_token: Optional[str] = None,
per_page: Optional[int] = None,
filter_: Optional[str] = None,
namespace: Optional[str] = None,
resources: Optional[bool] = None,
task_states: Optional[bool] = None,
reverse: Optional[bool] = None,
):
"""Lists all the allocations.

https://www.nomadproject.io/docs/http/allocs.html
arguments:
- prefix :(str) optional, specifies a string to filter allocations on based on an prefix.
This is specified as a querystring parameter.
- next_token :(str) optional.
This endpoint supports paging. The next_token parameter accepts a string which identifies the next
expected allocation. This value can be obtained from the X-Nomad-NextToken header from the previous
response.
- per_page :(int) optional
- filter_ :(str) optional
Name has a trailing underscore not to conflict with builtin function.
- namespace :(str) optional, specifies the target namespace. Specifying * would return all jobs.
This is specified as a querystring parameter.
- resources :(bool) optional
- task_states :(bool) optional
- reverse :(bool) optional
returns: list
raises:
- nomad.api.exceptions.BaseNomadException
- nomad.api.exceptions.URLNotFoundNomadException
"""
params = {
"prefix": prefix,
"next_token": next_token,
"per_page": per_page,
"filter": filter_,
"namespace": namespace,
"resources": resources,
"task_states": task_states,
"reverse": reverse,
}
return self.request(method="get", params=params).json()