Categorygithub.com/zhuqw12/slurmrestapi
repositorypackage
0.0.39-20230530
Repository: https://github.com/zhuqw12/slurmrestapi.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

Go API client for slurmrestapi

API to access and control Slurm.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: v0.0.39
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://www.schedmd.com/

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import slurmrestapi "github.com/zhuqw12/slurmrestapi"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), slurmrestapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), slurmrestapi.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), slurmrestapi.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), slurmrestapi.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost

ClassMethodHTTP requestDescription
OpenapiAPIOpenapiGetGet /openapiRetrieve OpenAPI Specification
OpenapiAPIOpenapiJsonGetGet /openapi.jsonRetrieve OpenAPI Specification
OpenapiAPIOpenapiV3GetGet /openapi/v3Retrieve OpenAPI Specification
OpenapiAPIOpenapiYamlGetGet /openapi.yamlRetrieve OpenAPI Specification
SlurmAPISlurmV0039CancelJobDelete /slurm/v0.0.39/job/{job_id}cancel or signal job
SlurmAPISlurmV0039DeleteNodeDelete /slurm/v0.0.39/node/{node_name}delete node
SlurmAPISlurmV0039DiagGet /slurm/v0.0.39/diagget diagnostics
SlurmAPISlurmV0039GetJobGet /slurm/v0.0.39/job/{job_id}get job info
SlurmAPISlurmV0039GetJobsGet /slurm/v0.0.39/jobsget list of jobs
SlurmAPISlurmV0039GetNodeGet /slurm/v0.0.39/node/{node_name}get node info
SlurmAPISlurmV0039GetNodesGet /slurm/v0.0.39/nodesget all node info
SlurmAPISlurmV0039GetPartitionGet /slurm/v0.0.39/partition/{partition_name}get partition info
SlurmAPISlurmV0039GetPartitionsGet /slurm/v0.0.39/partitionsget all partition info
SlurmAPISlurmV0039GetReservationGet /slurm/v0.0.39/reservation/{reservation_name}get reservation info
SlurmAPISlurmV0039GetReservationsGet /slurm/v0.0.39/reservationsget all reservation info
SlurmAPISlurmV0039PingGet /slurm/v0.0.39/pingping test
SlurmAPISlurmV0039SlurmctldGetLicensesGet /slurm/v0.0.39/licensesget all Slurm tracked license info
SlurmAPISlurmV0039SubmitJobPost /slurm/v0.0.39/job/submitsubmit new job
SlurmAPISlurmV0039UpdateJobPost /slurm/v0.0.39/job/{job_id}update job
SlurmAPISlurmV0039UpdateNodePost /slurm/v0.0.39/node/{node_name}update node properties
SlurmAPISlurmdbV0039AddClustersPost /slurmdb/v0.0.39/clustersAdd clusters
SlurmAPISlurmdbV0039AddWckeysPost /slurmdb/v0.0.39/wckeysAdd wckeys
SlurmAPISlurmdbV0039DeleteAccountDelete /slurmdb/v0.0.39/account/{account_name}Delete account
SlurmAPISlurmdbV0039DeleteAssociationDelete /slurmdb/v0.0.39/associationDelete association
SlurmAPISlurmdbV0039DeleteAssociationsDelete /slurmdb/v0.0.39/associationsDelete associations
SlurmAPISlurmdbV0039DeleteClusterDelete /slurmdb/v0.0.39/cluster/{cluster_name}Delete cluster
SlurmAPISlurmdbV0039DeleteQosDelete /slurmdb/v0.0.39/qos/{qos_name}Delete QOS
SlurmAPISlurmdbV0039DeleteUserDelete /slurmdb/v0.0.39/user/{user_name}Delete user
SlurmAPISlurmdbV0039DeleteWckeyDelete /slurmdb/v0.0.39/wckey/{wckey}Delete wckey
SlurmAPISlurmdbV0039DiagGet /slurmdb/v0.0.39/diagGet slurmdb diagnostics
SlurmAPISlurmdbV0039GetAccountGet /slurmdb/v0.0.39/account/{account_name}Get account info
SlurmAPISlurmdbV0039GetAccountsGet /slurmdb/v0.0.39/accountsGet account list
SlurmAPISlurmdbV0039GetAssociationGet /slurmdb/v0.0.39/associationGet association info
SlurmAPISlurmdbV0039GetAssociationsGet /slurmdb/v0.0.39/associationsGet association list
SlurmAPISlurmdbV0039GetClusterGet /slurmdb/v0.0.39/cluster/{cluster_name}Get cluster info
SlurmAPISlurmdbV0039GetClustersGet /slurmdb/v0.0.39/clustersGet cluster list
SlurmAPISlurmdbV0039GetConfigGet /slurmdb/v0.0.39/configDump all configuration information
SlurmAPISlurmdbV0039GetJobGet /slurmdb/v0.0.39/job/{job_id}Get job info
SlurmAPISlurmdbV0039GetJobsGet /slurmdb/v0.0.39/jobsGet job list
SlurmAPISlurmdbV0039GetQosGet /slurmdb/v0.0.39/qosGet QOS list
SlurmAPISlurmdbV0039GetSingleQosGet /slurmdb/v0.0.39/qos/{qos_name}Get QOS info
SlurmAPISlurmdbV0039GetTresGet /slurmdb/v0.0.39/tresGet TRES info
SlurmAPISlurmdbV0039GetUserGet /slurmdb/v0.0.39/user/{user_name}Get user info
SlurmAPISlurmdbV0039GetUsersGet /slurmdb/v0.0.39/usersGet user list
SlurmAPISlurmdbV0039GetWckeyGet /slurmdb/v0.0.39/wckey/{wckey}Get wckey info
SlurmAPISlurmdbV0039GetWckeysGet /slurmdb/v0.0.39/wckeysGet wckey list
SlurmAPISlurmdbV0039SetConfigPost /slurmdb/v0.0.39/configLoad all configuration information
SlurmAPISlurmdbV0039UpdateAccountsPost /slurmdb/v0.0.39/accountsUpdate accounts
SlurmAPISlurmdbV0039UpdateAssociationsPost /slurmdb/v0.0.39/associationsSet associations info
SlurmAPISlurmdbV0039UpdateQosPost /slurmdb/v0.0.39/qosSet QOS info
SlurmAPISlurmdbV0039UpdateTresPost /slurmdb/v0.0.39/tresSet TRES info
SlurmAPISlurmdbV0039UpdateUsersPost /slurmdb/v0.0.39/usersUpdate user

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

user

  • Type: API key
  • API key parameter name: X-SLURM-USER-NAME
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: X-SLURM-USER-NAME and passed in as the auth context for each request.

token

  • Type: API key
  • API key parameter name: X-SLURM-USER-TOKEN
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: X-SLURM-USER-TOKEN and passed in as the auth context for each request.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]