mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-14 10:47:26 +01:00
1747 lines
53 KiB
Go
1747 lines
53 KiB
Go
|
/*
|
||
|
Slurm Rest API
|
||
|
|
||
|
API to access and control Slurm.
|
||
|
|
||
|
API version: 0.0.37
|
||
|
Contact: sales@schedmd.com
|
||
|
*/
|
||
|
|
||
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||
|
|
||
|
package openapi
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"context"
|
||
|
"io"
|
||
|
"net/http"
|
||
|
"net/url"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
|
||
|
// SlurmAPIService SlurmAPI service
|
||
|
type SlurmAPIService service
|
||
|
|
||
|
type ApiSlurmctldCancelJobRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
jobId string
|
||
|
signal *V0037Signal
|
||
|
}
|
||
|
|
||
|
// signal to send to job
|
||
|
func (r ApiSlurmctldCancelJobRequest) Signal(signal V0037Signal) ApiSlurmctldCancelJobRequest {
|
||
|
r.signal = &signal
|
||
|
return r
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldCancelJobRequest) Execute() (*http.Response, error) {
|
||
|
return r.ApiService.SlurmctldCancelJobExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldCancelJob cancel or signal job
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@param jobId Slurm Job ID
|
||
|
@return ApiSlurmctldCancelJobRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldCancelJob(ctx context.Context, jobId string) ApiSlurmctldCancelJobRequest {
|
||
|
return ApiSlurmctldCancelJobRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
jobId: jobId,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
func (a *SlurmAPIService) SlurmctldCancelJobExecute(r ApiSlurmctldCancelJobRequest) (*http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodDelete
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldCancelJob")
|
||
|
if err != nil {
|
||
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/job/{job_id}"
|
||
|
localVarPath = strings.Replace(localVarPath, "{"+"job_id"+"}", url.PathEscape(parameterValueToString(r.jobId, "jobId")), -1)
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
|
||
|
if r.signal != nil {
|
||
|
parameterAddToHeaderOrQuery(localVarQueryParams, "signal", r.signal, "")
|
||
|
}
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
type ApiSlurmctldDiagRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldDiagRequest) Execute() (*V0037Diag, *http.Response, error) {
|
||
|
return r.ApiService.SlurmctldDiagExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldDiag get diagnostics
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@return ApiSlurmctldDiagRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldDiag(ctx context.Context) ApiSlurmctldDiagRequest {
|
||
|
return ApiSlurmctldDiagRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
// @return V0037Diag
|
||
|
func (a *SlurmAPIService) SlurmctldDiagExecute(r ApiSlurmctldDiagRequest) (*V0037Diag, *http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodGet
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
localVarReturnValue *V0037Diag
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldDiag")
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/diag/"
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
type ApiSlurmctldGetJobRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
jobId string
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldGetJobRequest) Execute() (*V0037JobsResponse, *http.Response, error) {
|
||
|
return r.ApiService.SlurmctldGetJobExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldGetJob get job info
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@param jobId Slurm JobID
|
||
|
@return ApiSlurmctldGetJobRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldGetJob(ctx context.Context, jobId string) ApiSlurmctldGetJobRequest {
|
||
|
return ApiSlurmctldGetJobRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
jobId: jobId,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
// @return V0037JobsResponse
|
||
|
func (a *SlurmAPIService) SlurmctldGetJobExecute(r ApiSlurmctldGetJobRequest) (*V0037JobsResponse, *http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodGet
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
localVarReturnValue *V0037JobsResponse
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldGetJob")
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/job/{job_id}"
|
||
|
localVarPath = strings.Replace(localVarPath, "{"+"job_id"+"}", url.PathEscape(parameterValueToString(r.jobId, "jobId")), -1)
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
type ApiSlurmctldGetJobsRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
updateTime *int64
|
||
|
}
|
||
|
|
||
|
// Filter if changed since update_time. Use of this parameter can result in faster replies.
|
||
|
func (r ApiSlurmctldGetJobsRequest) UpdateTime(updateTime int64) ApiSlurmctldGetJobsRequest {
|
||
|
r.updateTime = &updateTime
|
||
|
return r
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldGetJobsRequest) Execute() (*V0037JobsResponse, *http.Response, error) {
|
||
|
return r.ApiService.SlurmctldGetJobsExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldGetJobs get list of jobs
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@return ApiSlurmctldGetJobsRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldGetJobs(ctx context.Context) ApiSlurmctldGetJobsRequest {
|
||
|
return ApiSlurmctldGetJobsRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
// @return V0037JobsResponse
|
||
|
func (a *SlurmAPIService) SlurmctldGetJobsExecute(r ApiSlurmctldGetJobsRequest) (*V0037JobsResponse, *http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodGet
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
localVarReturnValue *V0037JobsResponse
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldGetJobs")
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/jobs/"
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
|
||
|
if r.updateTime != nil {
|
||
|
parameterAddToHeaderOrQuery(localVarQueryParams, "update_time", r.updateTime, "")
|
||
|
}
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
type ApiSlurmctldGetNodeRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
nodeName string
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldGetNodeRequest) Execute() (*V0037NodesResponse, *http.Response, error) {
|
||
|
return r.ApiService.SlurmctldGetNodeExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldGetNode get node info
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@param nodeName Slurm Node Name
|
||
|
@return ApiSlurmctldGetNodeRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldGetNode(ctx context.Context, nodeName string) ApiSlurmctldGetNodeRequest {
|
||
|
return ApiSlurmctldGetNodeRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
nodeName: nodeName,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
// @return V0037NodesResponse
|
||
|
func (a *SlurmAPIService) SlurmctldGetNodeExecute(r ApiSlurmctldGetNodeRequest) (*V0037NodesResponse, *http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodGet
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
localVarReturnValue *V0037NodesResponse
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldGetNode")
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/node/{node_name}"
|
||
|
localVarPath = strings.Replace(localVarPath, "{"+"node_name"+"}", url.PathEscape(parameterValueToString(r.nodeName, "nodeName")), -1)
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
type ApiSlurmctldGetNodesRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
updateTime *int64
|
||
|
}
|
||
|
|
||
|
// Filter if changed since update_time. Use of this parameter can result in faster replies.
|
||
|
func (r ApiSlurmctldGetNodesRequest) UpdateTime(updateTime int64) ApiSlurmctldGetNodesRequest {
|
||
|
r.updateTime = &updateTime
|
||
|
return r
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldGetNodesRequest) Execute() (*V0037NodesResponse, *http.Response, error) {
|
||
|
return r.ApiService.SlurmctldGetNodesExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldGetNodes get all node info
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@return ApiSlurmctldGetNodesRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldGetNodes(ctx context.Context) ApiSlurmctldGetNodesRequest {
|
||
|
return ApiSlurmctldGetNodesRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
// @return V0037NodesResponse
|
||
|
func (a *SlurmAPIService) SlurmctldGetNodesExecute(r ApiSlurmctldGetNodesRequest) (*V0037NodesResponse, *http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodGet
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
localVarReturnValue *V0037NodesResponse
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldGetNodes")
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/nodes/"
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
|
||
|
if r.updateTime != nil {
|
||
|
parameterAddToHeaderOrQuery(localVarQueryParams, "update_time", r.updateTime, "")
|
||
|
}
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
type ApiSlurmctldGetPartitionRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
partitionName string
|
||
|
updateTime *int64
|
||
|
}
|
||
|
|
||
|
// Filter if there were no partition changes (not limited to partition in URL endpoint) since update_time.
|
||
|
func (r ApiSlurmctldGetPartitionRequest) UpdateTime(updateTime int64) ApiSlurmctldGetPartitionRequest {
|
||
|
r.updateTime = &updateTime
|
||
|
return r
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldGetPartitionRequest) Execute() (*V0037PartitionsResponse, *http.Response, error) {
|
||
|
return r.ApiService.SlurmctldGetPartitionExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldGetPartition get partition info
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@param partitionName Slurm Partition Name
|
||
|
@return ApiSlurmctldGetPartitionRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldGetPartition(ctx context.Context, partitionName string) ApiSlurmctldGetPartitionRequest {
|
||
|
return ApiSlurmctldGetPartitionRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
partitionName: partitionName,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
// @return V0037PartitionsResponse
|
||
|
func (a *SlurmAPIService) SlurmctldGetPartitionExecute(r ApiSlurmctldGetPartitionRequest) (*V0037PartitionsResponse, *http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodGet
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
localVarReturnValue *V0037PartitionsResponse
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldGetPartition")
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/partition/{partition_name}"
|
||
|
localVarPath = strings.Replace(localVarPath, "{"+"partition_name"+"}", url.PathEscape(parameterValueToString(r.partitionName, "partitionName")), -1)
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
|
||
|
if r.updateTime != nil {
|
||
|
parameterAddToHeaderOrQuery(localVarQueryParams, "update_time", r.updateTime, "")
|
||
|
}
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
type ApiSlurmctldGetPartitionsRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
updateTime *int64
|
||
|
}
|
||
|
|
||
|
// Filter if changed since update_time. Use of this parameter can result in faster replies.
|
||
|
func (r ApiSlurmctldGetPartitionsRequest) UpdateTime(updateTime int64) ApiSlurmctldGetPartitionsRequest {
|
||
|
r.updateTime = &updateTime
|
||
|
return r
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldGetPartitionsRequest) Execute() (*V0037PartitionsResponse, *http.Response, error) {
|
||
|
return r.ApiService.SlurmctldGetPartitionsExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldGetPartitions get all partition info
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@return ApiSlurmctldGetPartitionsRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldGetPartitions(ctx context.Context) ApiSlurmctldGetPartitionsRequest {
|
||
|
return ApiSlurmctldGetPartitionsRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
// @return V0037PartitionsResponse
|
||
|
func (a *SlurmAPIService) SlurmctldGetPartitionsExecute(r ApiSlurmctldGetPartitionsRequest) (*V0037PartitionsResponse, *http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodGet
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
localVarReturnValue *V0037PartitionsResponse
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldGetPartitions")
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/partitions/"
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
|
||
|
if r.updateTime != nil {
|
||
|
parameterAddToHeaderOrQuery(localVarQueryParams, "update_time", r.updateTime, "")
|
||
|
}
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
type ApiSlurmctldGetReservationRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
reservationName string
|
||
|
updateTime *int64
|
||
|
}
|
||
|
|
||
|
// Filter if no reservation (not limited to reservation in URL) changed since update_time.
|
||
|
func (r ApiSlurmctldGetReservationRequest) UpdateTime(updateTime int64) ApiSlurmctldGetReservationRequest {
|
||
|
r.updateTime = &updateTime
|
||
|
return r
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldGetReservationRequest) Execute() (*V0037ReservationsResponse, *http.Response, error) {
|
||
|
return r.ApiService.SlurmctldGetReservationExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldGetReservation get reservation info
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@param reservationName Slurm Reservation Name
|
||
|
@return ApiSlurmctldGetReservationRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldGetReservation(ctx context.Context, reservationName string) ApiSlurmctldGetReservationRequest {
|
||
|
return ApiSlurmctldGetReservationRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
reservationName: reservationName,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
// @return V0037ReservationsResponse
|
||
|
func (a *SlurmAPIService) SlurmctldGetReservationExecute(r ApiSlurmctldGetReservationRequest) (*V0037ReservationsResponse, *http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodGet
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
localVarReturnValue *V0037ReservationsResponse
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldGetReservation")
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/reservation/{reservation_name}"
|
||
|
localVarPath = strings.Replace(localVarPath, "{"+"reservation_name"+"}", url.PathEscape(parameterValueToString(r.reservationName, "reservationName")), -1)
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
|
||
|
if r.updateTime != nil {
|
||
|
parameterAddToHeaderOrQuery(localVarQueryParams, "update_time", r.updateTime, "")
|
||
|
}
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
type ApiSlurmctldGetReservationsRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
updateTime *int64
|
||
|
}
|
||
|
|
||
|
// Filter if changed since update_time. Use of this parameter can result in faster replies.
|
||
|
func (r ApiSlurmctldGetReservationsRequest) UpdateTime(updateTime int64) ApiSlurmctldGetReservationsRequest {
|
||
|
r.updateTime = &updateTime
|
||
|
return r
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldGetReservationsRequest) Execute() (*V0037ReservationsResponse, *http.Response, error) {
|
||
|
return r.ApiService.SlurmctldGetReservationsExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldGetReservations get all reservation info
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@return ApiSlurmctldGetReservationsRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldGetReservations(ctx context.Context) ApiSlurmctldGetReservationsRequest {
|
||
|
return ApiSlurmctldGetReservationsRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
// @return V0037ReservationsResponse
|
||
|
func (a *SlurmAPIService) SlurmctldGetReservationsExecute(r ApiSlurmctldGetReservationsRequest) (*V0037ReservationsResponse, *http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodGet
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
localVarReturnValue *V0037ReservationsResponse
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldGetReservations")
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/reservations/"
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
|
||
|
if r.updateTime != nil {
|
||
|
parameterAddToHeaderOrQuery(localVarQueryParams, "update_time", r.updateTime, "")
|
||
|
}
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
type ApiSlurmctldPingRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldPingRequest) Execute() (*V0037Pings, *http.Response, error) {
|
||
|
return r.ApiService.SlurmctldPingExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldPing ping test
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@return ApiSlurmctldPingRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldPing(ctx context.Context) ApiSlurmctldPingRequest {
|
||
|
return ApiSlurmctldPingRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
// @return V0037Pings
|
||
|
func (a *SlurmAPIService) SlurmctldPingExecute(r ApiSlurmctldPingRequest) (*V0037Pings, *http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodGet
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
localVarReturnValue *V0037Pings
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldPing")
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/ping/"
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
type ApiSlurmctldSubmitJobRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
v0037JobSubmission *V0037JobSubmission
|
||
|
}
|
||
|
|
||
|
// submit new job
|
||
|
func (r ApiSlurmctldSubmitJobRequest) V0037JobSubmission(v0037JobSubmission V0037JobSubmission) ApiSlurmctldSubmitJobRequest {
|
||
|
r.v0037JobSubmission = &v0037JobSubmission
|
||
|
return r
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldSubmitJobRequest) Execute() (*V0037JobSubmissionResponse, *http.Response, error) {
|
||
|
return r.ApiService.SlurmctldSubmitJobExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldSubmitJob submit new job
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@return ApiSlurmctldSubmitJobRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldSubmitJob(ctx context.Context) ApiSlurmctldSubmitJobRequest {
|
||
|
return ApiSlurmctldSubmitJobRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
// @return V0037JobSubmissionResponse
|
||
|
func (a *SlurmAPIService) SlurmctldSubmitJobExecute(r ApiSlurmctldSubmitJobRequest) (*V0037JobSubmissionResponse, *http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
localVarReturnValue *V0037JobSubmissionResponse
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldSubmitJob")
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/job/submit"
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
if r.v0037JobSubmission == nil {
|
||
|
return localVarReturnValue, nil, reportError("v0037JobSubmission is required and must be specified")
|
||
|
}
|
||
|
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
// body params
|
||
|
localVarPostBody = r.v0037JobSubmission
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarReturnValue, localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||
|
if err != nil {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: err.Error(),
|
||
|
}
|
||
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarReturnValue, localVarHTTPResponse, nil
|
||
|
}
|
||
|
|
||
|
type ApiSlurmctldUpdateJobRequest struct {
|
||
|
ctx context.Context
|
||
|
ApiService *SlurmAPIService
|
||
|
jobId string
|
||
|
v0037JobProperties *V0037JobProperties
|
||
|
}
|
||
|
|
||
|
// update job
|
||
|
func (r ApiSlurmctldUpdateJobRequest) V0037JobProperties(v0037JobProperties V0037JobProperties) ApiSlurmctldUpdateJobRequest {
|
||
|
r.v0037JobProperties = &v0037JobProperties
|
||
|
return r
|
||
|
}
|
||
|
|
||
|
func (r ApiSlurmctldUpdateJobRequest) Execute() (*http.Response, error) {
|
||
|
return r.ApiService.SlurmctldUpdateJobExecute(r)
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
SlurmctldUpdateJob update job
|
||
|
|
||
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||
|
@param jobId Slurm Job ID
|
||
|
@return ApiSlurmctldUpdateJobRequest
|
||
|
*/
|
||
|
func (a *SlurmAPIService) SlurmctldUpdateJob(ctx context.Context, jobId string) ApiSlurmctldUpdateJobRequest {
|
||
|
return ApiSlurmctldUpdateJobRequest{
|
||
|
ApiService: a,
|
||
|
ctx: ctx,
|
||
|
jobId: jobId,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Execute executes the request
|
||
|
func (a *SlurmAPIService) SlurmctldUpdateJobExecute(r ApiSlurmctldUpdateJobRequest) (*http.Response, error) {
|
||
|
var (
|
||
|
localVarHTTPMethod = http.MethodPost
|
||
|
localVarPostBody interface{}
|
||
|
formFiles []formFile
|
||
|
)
|
||
|
|
||
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlurmAPIService.SlurmctldUpdateJob")
|
||
|
if err != nil {
|
||
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
||
|
}
|
||
|
|
||
|
localVarPath := localBasePath + "/job/{job_id}"
|
||
|
localVarPath = strings.Replace(localVarPath, "{"+"job_id"+"}", url.PathEscape(parameterValueToString(r.jobId, "jobId")), -1)
|
||
|
|
||
|
localVarHeaderParams := make(map[string]string)
|
||
|
localVarQueryParams := url.Values{}
|
||
|
localVarFormParams := url.Values{}
|
||
|
if r.v0037JobProperties == nil {
|
||
|
return nil, reportError("v0037JobProperties is required and must be specified")
|
||
|
}
|
||
|
|
||
|
// to determine the Content-Type header
|
||
|
localVarHTTPContentTypes := []string{"application/json", "application/x-yaml"}
|
||
|
|
||
|
// set Content-Type header
|
||
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||
|
if localVarHTTPContentType != "" {
|
||
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||
|
}
|
||
|
|
||
|
// to determine the Accept header
|
||
|
localVarHTTPHeaderAccepts := []string{}
|
||
|
|
||
|
// set Accept header
|
||
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||
|
if localVarHTTPHeaderAccept != "" {
|
||
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||
|
}
|
||
|
// body params
|
||
|
localVarPostBody = r.v0037JobProperties
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["user"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-NAME"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if r.ctx != nil {
|
||
|
// API Key Authentication
|
||
|
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
|
||
|
if apiKey, ok := auth["token"]; ok {
|
||
|
var key string
|
||
|
if apiKey.Prefix != "" {
|
||
|
key = apiKey.Prefix + " " + apiKey.Key
|
||
|
} else {
|
||
|
key = apiKey.Key
|
||
|
}
|
||
|
localVarHeaderParams["X-SLURM-USER-TOKEN"] = key
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
||
|
if err != nil || localVarHTTPResponse == nil {
|
||
|
return localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||
|
localVarHTTPResponse.Body.Close()
|
||
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
||
|
if err != nil {
|
||
|
return localVarHTTPResponse, err
|
||
|
}
|
||
|
|
||
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||
|
newErr := &GenericOpenAPIError{
|
||
|
body: localVarBody,
|
||
|
error: localVarHTTPResponse.Status,
|
||
|
}
|
||
|
return localVarHTTPResponse, newErr
|
||
|
}
|
||
|
|
||
|
return localVarHTTPResponse, nil
|
||
|
}
|