{"id":24029915,"url":"https://github.com/pcolladosoto/goslurm","last_synced_at":"2026-05-17T03:31:42.961Z","repository":{"id":249698434,"uuid":"832222132","full_name":"pcolladosoto/goslurm","owner":"pcolladosoto","description":"A Go client for SLURM's REST API","archived":false,"fork":false,"pushed_at":"2024-08-02T09:56:15.000Z","size":337,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T17:09:36.561Z","etag":null,"topics":["openapi","openapi-generator","slurm"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pcolladosoto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-22T15:06:46.000Z","updated_at":"2024-08-07T15:28:42.000Z","dependencies_parsed_at":"2024-08-02T11:16:08.480Z","dependency_job_id":"e56aa074-307b-4fc8-9179-59cd1fe76c71","html_url":"https://github.com/pcolladosoto/goslurm","commit_stats":null,"previous_names":["pcolladosoto/goslurm"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcolladosoto%2Fgoslurm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcolladosoto%2Fgoslurm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcolladosoto%2Fgoslurm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pcolladosoto%2Fgoslurm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pcolladosoto","download_url":"https://codeload.github.com/pcolladosoto/goslurm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240784397,"owners_count":19857014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["openapi","openapi-generator","slurm"],"created_at":"2025-01-08T17:04:53.960Z","updated_at":"2026-05-17T03:31:37.941Z","avatar_url":"https://github.com/pcolladosoto.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SLURM REST API Client in Go\nThis repository contains the a set of type definitions (i.e. models) and endpoint calls implementing SLURM's REST API.\n\nPlease note the following discussion applies to SLURM version **22.05.9** whose documentation you can find [here][SLURM doc]. However,\nit should be noted that what matters in this particular scenario is the version of the OpenAPI plugin this client targets which, for\nus, is version 0.0.38. This plugin version is still shipped with SLURM **24.05** which as of the time of writing is the latest SLURM release.\n\nIn other words, this client should be usable 'as-is' with the latest SLURM version provided the `openapi/v0.0.38` plugin is configured\nwhen starting `slurmrestd`.\n\nGenerating all these resources has been greatly simplified by the fact that SLURM implements the [OpenAPI v3.0.2 spec][OpenAPI v3.0.2 spec].\nThis means we can leverage the [OpenAPI Generator][OpenAPI Generator] tool to simply create the client as needed. We just need to provide the\nOpenAPI spec file which we can get from a SLURM instance by simply querying the `/openapi` endpoint. This repository includes two OpenAPI\ndefinitions:\n\n1. **`api.yaml`**: This is the definition 'as-is' with a few minor tweaks needed to iron out some failing tests. These tweaks basically boil\n                   down to making some types larger (i.e. `int -\u003e int64`) so that some counters could later be unmarshalled.\n\n1. **`api_ro.yaml`**: For this definition we have just removed all the `POST` and `DELETE` methods so that a 'read-only' client ws derived.\n                      This client's main purpose was handling some of the complexity in terms of API interaction so that the SLURM [Telegraf][Telegraf]\n                      plugin was smaller and easier to maintain. This is the definition this client's been derived from! The previous API definition\n                      is simply provided as a convenience.\n\n## Examples and usage\nWe provide a small example of how this client can be leveraged under the `cmd` directory. The idea is it should be you who imports this client in your\nown Go project so that you can interact with a SLURM cluster. Importing the client can be accomplished with the regular `import` statement:\n\n    import \"github.com/pcolladosoto/go-slurm/v0.0.38\"\n\n## Authenticating with SLURM\nThe authentication of requests against the API leverages so called [JWT Tokens][JWT Tokens]. The basic idea is this token needs to be specified\nwhen making the request through the `X-SLURM-USER-TOKEN` HTTP header together with the user the token belongs to through the `X-SLURM-USER-NAME`\nHTTP header. However, the client exposes these in such a way that you needn't be concerned with meddling with the headers yourself. These authentication\nparameters are passed through a [`context`][Go Context] as seen on the example under the `cmd` directory. Be sure to take a look at that.\n\nConfiguring the token-based authentication and generating the tokens themselves is covered on [SLURM's documentation][SLURM JWT Doc].\n\n### Authentication for running the tests\nIn order to avoid including the authentication information in the repository, the tests read both the token and username from the `SLURM_USER` and\n`SLURM_JWT` environment variables respectively. If any of them isn't defined the tests will fail with an informative message. As always, you\ncan either define them for the entire shell session with `export SLURM_USER=foo` or you can just define them when invoking `go test` with:\n\n    $ SLURM_USER=foo SLURM_JWT=topSecret go test\n\nRemember the `go test` command should be invoked from the `v0038/test` directory!\n\n## Generating the Client\nAs we said before generating the client is a matter of invoking OpenAPI generator. You'd need to install it first, which is very well explained on their\nrepository's [README.md][OpenAPI Generator]. Once that's done, you should be able to run the following from this directory (i.e. the one this `README.md`\nis on):\n\n    $ openapi-generator generate -g go -o oapigen -i api.yaml                          \\\n        --git-host github.com --git-user-id pcolladosoto --git-repo-id goslurm/oapigen \\\n        -c cfg.json\n\nThe `cfg.json` file contains the settings for the Go generator we invoke through the `-g go` flag. As always, please refer to the official documentation\non [general usage][OpenAPI Generator Usage], the [Go generator][Go Generator] and its [configuration][Go Generator Configuration].\n\nGiven we tend to forget these rather long commands we have condensed some of them in a `Makefile` you can invoke through `make(1)` if that's your jam.\n\n## Further reading\nIt's worth taking a look at [SLURM's REST API documentation][SLURM REST Doc] as well as the [API reference][SLURM REST Reference] to have a clearer\noverview of how everything works. Also, OpenAPI Generator defines a ton of markdown (i.e. `*.md`) files together with the client itself which you can\nquery at your leisure.\n\n## Something missing?\nIf you find something is missing please do let us know or, even better, open a PR to add it! We're more than glad to accept contributions.\n\n\u003c!-- Get the links out of the text body to make things more readable! --\u003e\n[OpenAPI v3.0.2 spec]: https://spec.openapis.org/oas/v3.0.2\n[SLURM doc]: https://slurm.schedmd.com/archive/slurm-22.05.9/documentation.html\n[OpenAPI Generator]: https://github.com/OpenAPITools/openapi-generator\n[Telegraf]: https://github.com/influxdata/telegraf\n[OpenAPI Generator Usage]: https://openapi-generator.tech/docs/usage/\n[Go Generator]: https://openapi-generator.tech/docs/generators/go/\n[Go Generator Configuration]: https://openapi-generator.tech/docs/configuration/\n[JWT Tokens]: https://en.wikipedia.org/wiki/JSON_Web_Token\n[Go Context]: https://pkg.go.dev/context\n[SLURM JWT Doc]: https://slurm.schedmd.com/archive/slurm-22.05.9/jwt.html\n[SLURM Rest Doc]: https://slurm.schedmd.com/archive/slurm-22.05.9/rest.html\n[SLURM Rest Reference]: https://slurm.schedmd.com/archive/slurm-22.05.9/rest_api.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcolladosoto%2Fgoslurm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpcolladosoto%2Fgoslurm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpcolladosoto%2Fgoslurm/lists"}