client

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

README

kubepi go client

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	ClustersApi *ClustersApiService

	ReposApi *ReposApiService

	RolesApi *RolesApiService

	SessionsApi *SessionsApiService

	UsersApi *UsersApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the KubePi Restful API API vv1 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type ClustersApiService

type ClustersApiService service

func (*ClustersApiService) CreateCluster

ClustersApiService Create Cluster Create Cluster

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param request request

@return InternalV1Cluster

func (*ClustersApiService) CreateClusterMember

func (a *ClustersApiService) CreateClusterMember(ctx context.Context, cluster string, request model.ClusterMember) (model.ClusterMember, *http.Response, error)

ClustersApiService Create Cluster Member Create Cluster Member

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称
  • @param request request

@return ClusterMember

func (*ClustersApiService) CreateClusterRepos

ClustersApiService Create Cluster KubepiRepo Create Cluster KubepiRepo

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称
  • @param request request

@return CreateClusterRepoReq

func (*ClustersApiService) CreateClusterRole

func (a *ClustersApiService) CreateClusterRole(ctx context.Context, cluster string, request model.V1ClusterRole) (model.V1ClusterRole, *http.Response, error)

ClustersApiService Create Cluster KubepiRole Create Cluster KubepiRole

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称
  • @param request request

@return V1ClusterRole

func (*ClustersApiService) DeleteCluster

func (a *ClustersApiService) DeleteCluster(ctx context.Context, name string) (model.V1Cluster, *http.Response, error)

ClustersApiService Delete cluster by name Delete cluster by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name 集群名称

@return V1Cluster

func (*ClustersApiService) DeleteClusterMember

func (a *ClustersApiService) DeleteClusterMember(ctx context.Context, cluster string, member string) (float32, *http.Response, error)

ClustersApiService Delete clusterMember by name Delete clusterMember by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称
  • @param member 成员名称

@return float32

func (*ClustersApiService) DeleteClusterRepo

func (a *ClustersApiService) DeleteClusterRepo(ctx context.Context, cluster string, repo string) (float32, *http.Response, error)

ClustersApiService Delete clusterRepo by name Delete clusterRepo by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称
  • @param repo 镜像仓库名称

@return float32

func (*ClustersApiService) DeleteClusterRole

func (a *ClustersApiService) DeleteClusterRole(ctx context.Context, cluster string, clusterrole string) (float32, *http.Response, error)

ClustersApiService Delete clusterRole by name Delete clusterRole by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称
  • @param clusterrole 权限名称

@return float32

func (*ClustersApiService) GetCluster

func (a *ClustersApiService) GetCluster(ctx context.Context, name string) (model.V1Cluster, *http.Response, error)

ClustersApiService Get cluster by name Get cluster by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name 集群名称

@return V1Cluster

func (*ClustersApiService) GetClusterMember

func (a *ClustersApiService) GetClusterMember(ctx context.Context, cluster string, member string) (model.ClusterMember, *http.Response, error)

ClustersApiService Get Cluster Member By name Get Cluster Member By name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称
  • @param member 成员名称

@return ClusterMember

func (*ClustersApiService) GetClusterMembers

func (a *ClustersApiService) GetClusterMembers(ctx context.Context, cluster string) ([]model.ClusterMember, *http.Response, error)

ClustersApiService List all ClusterMembers List all ClusterMembers

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称

@return []ClusterMember

func (*ClustersApiService) GetClusterRepos

func (a *ClustersApiService) GetClusterRepos(ctx context.Context, cluster string) ([]model.KubepiRepo, *http.Response, error)

ClustersApiService Get ClusterRepo Detail Get ClusterRepo Detail

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称

@return []KubepiRepo

func (*ClustersApiService) GetClusterRoles

func (a *ClustersApiService) GetClusterRoles(ctx context.Context, cluster string) ([]model.V1ClusterRole, *http.Response, error)

ClustersApiService List all clusterRoles List all clusterRoles

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称

@return []V1ClusterRole

func (*ClustersApiService) GetClusters

func (a *ClustersApiService) GetClusters(ctx context.Context) ([]model.V1Cluster, *http.Response, error)

ClustersApiService List all clusters List all clusters

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []V1Cluster

func (*ClustersApiService) UpdateCluster

ClustersApiService Update cluster by name Update cluster by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param request request
  • @param name 集群名称

@return ClusterUpdateReq

func (*ClustersApiService) UpdateClusterMember

func (a *ClustersApiService) UpdateClusterMember(ctx context.Context, cluster string, member string, request model.ClusterMember) (model.ClusterMember, *http.Response, error)

ClustersApiService Update Cluster Member Update Cluster Member

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称
  • @param member 成员名称
  • @param request request

@return ClusterMember

func (*ClustersApiService) UpdateClusterRole

func (a *ClustersApiService) UpdateClusterRole(ctx context.Context, cluster string, clusterrole string, request model.V1ClusterRole) (model.V1ClusterRole, *http.Response, error)

ClustersApiService Update Cluster KubepiRole Update Cluster KubepiRole

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称
  • @param clusterrole 权限名称
  • @param request request

@return V1ClusterRole

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type GenericSwaggerError

type GenericSwaggerError struct {
	// contains filtered or unexported fields
}

GenericSwaggerError Provides access to the body, error and model on returned errors.

func (GenericSwaggerError) Body

func (e GenericSwaggerError) Body() []byte

Body returns the raw bytes of the response

func (GenericSwaggerError) Error

func (e GenericSwaggerError) Error() string

Error returns non-empty string if there was an error.

func (GenericSwaggerError) Model

func (e GenericSwaggerError) Model() interface{}

Model returns the unpacked model of the error

type ReposApiService

type ReposApiService service

func (*ReposApiService) ImagereposClusterClusterGet

func (a *ReposApiService) ImagereposClusterClusterGet(ctx context.Context, cluster string) ([]ImagerepoImageRepo, *http.Response, error)

ReposApiService List repo for cluster Get repo for cluster

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称

@return []ImagerepoImageRepo

func (*ReposApiService) ImagereposClusterRepoPut

func (a *ReposApiService) ImagereposClusterRepoPut(ctx context.Context, cluster string, repo string) ([]string, *http.Response, error)

ReposApiService List images for cluster Get images for cluster

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param cluster 集群名称
  • @param repo 镜像仓库名称

@return []string

func (*ReposApiService) ImagereposNameDelete

func (a *ReposApiService) ImagereposNameDelete(ctx context.Context, name string) (ImagerepoImageRepo, *http.Response, error)

ReposApiService Delete repo by name Delete repo by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name 镜像仓库名称

@return ImagerepoImageRepo

func (*ReposApiService) ImagereposNameGet

func (a *ReposApiService) ImagereposNameGet(ctx context.Context, name string) (ImagerepoImageRepo, *http.Response, error)

ReposApiService Get repo by name Get repo by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name 镜像仓库名称

@return ImagerepoImageRepo

func (*ReposApiService) ImagereposNamePut

func (a *ReposApiService) ImagereposNamePut(ctx context.Context, request ImagerepoRepoConfig, name string) (ImagerepoImageRepo, *http.Response, error)

ReposApiService Update repo by name Update repo by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param request request
  • @param name 镜像仓库名称

@return ImagerepoImageRepo

func (*ReposApiService) ImagereposPost

func (a *ReposApiService) ImagereposPost(ctx context.Context, request ImagerepoRepoConfig) (ImagerepoRepoConfig, *http.Response, error)

ReposApiService Create repo Create repo

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param request request

@return ImagerepoRepoConfig

func (*ReposApiService) ImagereposRepoSearchGet

func (a *ReposApiService) ImagereposRepoSearchGet(ctx context.Context, repo string) (ImagerepoRepoResponse, *http.Response, error)

ReposApiService List images by repo Get images by repo

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param repo 镜像仓库名称

@return ImagerepoRepoResponse

func (*ReposApiService) ImagereposRepositoriesSearchPost

func (a *ReposApiService) ImagereposRepositoriesSearchPost(ctx context.Context, request ImagerepoRepoConfig) ([]string, *http.Response, error)

ReposApiService List Internal repos List Internal repos

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param request request

@return []string

type RolesApiService

type RolesApiService service

func (*RolesApiService) CreateRole

func (a *RolesApiService) CreateRole(ctx context.Context, request model.KubepiRole) (model.KubepiRole, *http.Response, error)

RolesApiService Create role Create role

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param request request

@return KubepiRole

func (*RolesApiService) DeleteRole

func (a *RolesApiService) DeleteRole(ctx context.Context, name string) (model.KubepiRole, *http.Response, error)

RolesApiService Delete role by name Delete role by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name 角色名称

@return KubepiRole

func (*RolesApiService) GetRole

RolesApiService Get role by name Get role by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name 权限名称

@return KubepiRole

func (*RolesApiService) GetRoles

RolesApiService List all roles List all roles

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []KubepiRole

func (*RolesApiService) UpdateRole

func (a *RolesApiService) UpdateRole(ctx context.Context, name string) (model.KubepiRole, *http.Response, error)

RolesApiService Update role by name Update role by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name 角色名称

@return KubepiRole

type SessionsApiService

type SessionsApiService service

func (*SessionsApiService) Login

SessionsApiService KubepiUser Login KubepiUser Login

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param request request

type UsersApiService

type UsersApiService service

func (*UsersApiService) CreateUser

UsersApiService Create user Create user

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param request request

@return KubepiUser

func (*UsersApiService) DeleteUser

func (a *UsersApiService) DeleteUser(ctx context.Context, name string) (model.KubepiUser, *http.Response, error)

UsersApiService Delete user by name Delete user by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name 用户名称

@return KubepiUser

func (*UsersApiService) GetUser

UsersApiService Get user by name Get user by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name 用户名称

@return KubepiUser

func (*UsersApiService) GetUsers

UsersApiService List all users List all users

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []User

func (*UsersApiService) SearchUsers

func (a *UsersApiService) SearchUsers(ctx context.Context) (model.ApiPage, *http.Response, error)

UsersApiService Search users Search users by Condition

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return ApiPage

func (*UsersApiService) UpdateUser

func (a *UsersApiService) UpdateUser(ctx context.Context, name string) (model.KubepiUser, *http.Response, error)

UsersApiService Update user by name Update user by name

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param name 用户名称

@return KubepiUser

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL