Skip to content

bharath-krishna/hpc-go-client

Repository files navigation

Go API client for hpc

An interface for working with HPC clusters.

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: 0.0.1
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

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 hpc "github.com/bharath-krishna/hpc-go-client"

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(), hpc.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(), hpc.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(), hpc.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), hpc.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost:8088

Class Method HTTP request Description
AdminAPI AddKcUserRole Put /api/admin/users/{username}/rolemaps/{role_name} Add Kc User Role
AdminAPI AddKcUserToGroup Put /api/admin/users/{username}/groups/{group_name} Add user to group
AdminAPI CheckUserRoles Get /api/admin/users/{username}/roles/{role_name} Check if users role exists
AdminAPI CreateKcGroup Post /api/admin/groups Create Group
AdminAPI CreateUsersRbac Post /api/admin/namespace/{namespace}/rbac Create roles and rolebindings of namespace
AdminAPI ListUsers Get /api/admin/users List Users
AdminAPI ListUsers_0 Get /api/admin/users List Users
AdminAPI OnboardUser Post /api/admin/users Onboard user
K8sAPI CreateNamespace Post /api/k8s/namespaces Create Namespace
K8sAPI CreateNamespacedJob Post /api/k8s/clusters/{cluster}/namespaces/{namespace}/jobs Create K8s Job
K8sAPI CreateNamespacedJobTemplate Post /api/k8s/cluster/{cluster}/namespace/{namespace}/jobs/template Create K8s Job Template
K8sAPI GetJobDetails Get /api/k8s/clusters/{cluster}/namespaces/{namespace}/jobsdetails Get job details
K8sAPI GetLogs Get /api/k8s/clusters/{cluster}/namespaces/{namespace}/jobs/{job_name}/logs Get static logs
K8sAPI GetLogshell Get /api/k8s/clusters/{cluster}/namespaces/{namespace}/jobs/{job_name}/logshell Launch a Cloud shell
K8sAPI GetNamespacedPvcs Get /api/k8s/cluster/{cluster}/namespace/{namespace}/pvcs Get PVCs
K8sAPI GetUsersNamespaces Get /api/k8s/clusters/{cluster}/users/{username}/namespaces Get users namespaces
K8sAPI LaunchLogshell Post /api/k8s/clusters/{cluster}/namespaces/{namespace}/jobs/{job_name}/logshell Launch a Cloud shell
K8sAPI ListAllJobDetails Get /api/k8s/jobsdetails Get all job's details in a cluster
K8sAPI ListAllJobs Get /api/k8s/cluster/{cluster}/jobs Get K8s Job
K8sAPI ListClusters Get /api/k8s/clusters List Clusters
K8sAPI ListClusters_0 Get /api/k8s/clusters List Clusters
K8sAPI ListNamespacedJobs Get /api/k8s/clusters/{cluster}/namespaces/{namespace}/jobs List all jobs in a namespace
ProfileAPI GetProfile Get /api/profile Get Profile

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

HTTPBearer

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages