connector

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package connector: Used to connect to different types of cloud

TODO: More flexible use of rate limit control by APIs instead of by connectors

Index

Constants

View Source
const (
	ALIYUN_ACCESS_KEY_ID     = "ALIBABA_CLOUD_ACCESS_KEY_ID"
	ALIYUN_ACCESS_KEY_SECRET = "ALIBABA_CLOUD_ACCESS_KEY_SECRET"
	ALIYUN_REGION            = "ALIBABA_CLOUD_REGION"
)
View Source
const (
	AZURE_CLIENT_ID       = "AZURE_CLIENT_ID"
	AZURE_TENANT_ID       = "AZURE_TENANT_ID"
	AZURE_CLIENT_SECRET   = "AZURE_CLIENT_SECRET"
	AZURE_SUBSCRIPTION_ID = "AZURE_SUBSCRIPTION_ID"
)
View Source
const (
	TENCENTCLOUD_SECRET_ID  = "TENCENTCLOUD_SECRET_ID"
	TENCENTCLOUD_SECRET_KEY = "TENCENTCLOUD_SECRET_KEY"
	TENCENTCLOUD_REGION     = "TENCENTCLOUD_REGION"
)
View Source
const ALIYUN_OSS_MARKER_KEY = "marker"

Variables

This section is empty.

Functions

func CallAliyunCloud

func CallAliyunCloud(authProvider auth.IAuthProvider, endpoint string, bEpWithRegion bool, version string, action string, extraParam map[string]any) (
	*json.RawMessage, error)

CallAliyunCloud: Send a request to Aliyun and parse response

TODO: Deal with more types of extraParam for tea @param: authProvider: IAuthProvider to provide profile of auth @param: endpoint: Parameter for Aliyun common request @param: bEpWithRegion: Indicate if region should be added to endpoint @param: version: Parameter for Aliyun common request @param: action: Parameter for Aliyun common request @param: extraParam: Extra parameters provided to Aliyun @return: Response data from Aliyun @return: Error

func CallAliyunOSS

func CallAliyunOSS(authProvider auth.IAuthProvider, bucketName string, action string, extraParam map[string]any) (
	*json.RawMessage, error)

CallAliyunOSS: Send a request to Aliyun OSS and parse response

TODO: Deal with more extra parameters for different reflect call @param: authProvider: IAuthProvider to provide profile of auth @param: bucketName: Name of the bucket. List all buckets if empty string given @param: action: Parameter for the reflection of Aliyun OSS API @param: extraParam: Currently only used to transfer marker when listing buckets @return: Response data from Aliyun OSS @return: Error

func CallAzureList

func CallAzureList(authProvider auth.IAuthProvider, provider string, version string, rsType string, nextLink string) (
	*json.RawMessage, error)

CallAzureList: Send a request to Azure to list resources

TODO: Deal with extra parameters for Azure request @param: authProvider: IAuthProvider to provide profile of auth @param: provider: Parameter for Azure common request @param: version: Parameter for Azure common request @param: rsType: Parameter for Azure common request @param: nextLink: Returned from the previous call for pagination @return: Response data from Azure @return: Error

func CallAzureWithEndpoint

func CallAzureWithEndpoint(authProvider auth.IAuthProvider, version string, endpoint string, action string) (
	*json.RawMessage, error)

CallAzureList: Send a request to Azure with an endpoint provided

The endpoint may be returned from the previous call as nextLink or resource id. Other functions like CallAzureList also concats endpoint string from their own parameters.

TODO: Deal with extra parameters for Azure request @param: authProvider: IAuthProvider to provide profile of auth @param: version: Parameter for Azure common request @param: endpoint: Parameter for Azure common request @param: action: Parameter for Azure common request @return: Response data from Azure @return: Error

func CallK8sList

func CallK8sList(authProvider auth.IAuthProvider, namespace string, group string, version string, resource string, listOpts map[string]any) (
	*json.RawMessage, error)

CallK8sList: Send a request to a k8s server to list resources. If group and version are both empty, RESTMapper is used to search for mapped gvr

NOTE: It's not necessary to define a function to get data of single resource, since all the data will be returned in the result of listing in the current usages @param: authProvider: IAuthProvider to provide pathname of kubeconfig @param: namespace: Parameter for k8s request @param: group: Parameter for k8s request @param: version: Parameter for k8s request @param: resource: Parameter for k8s request @param: extraParam: Parameters of ListOptions @return: Response data from k8s server @return: Error

func CallTencentCOS

func CallTencentCOS(authProvider auth.IAuthProvider, bucketName string, service string, action string) (
	*json.RawMessage, error)

CallTencentCOS: Send a request to Tencent COS and parse response

TODO: Deal with extra parameters for different reflect call @param: authProvider: IAuthProvider to provide profile of auth @param: bucketName: Name of bucket. List all buckets if empty string given @param: service: Parameter for the reflection of Tencent COS API @param: action: Parameter for the reflection of Tencent COS API @return: Response data from Tencent COS @return: Error

func CallTencentCloud

func CallTencentCloud(authProvider auth.IAuthProvider, service string, version string, action string, extraParam map[string]any) (
	*json.RawMessage, error)

CallTencentCloud: Send a request to Tencent cloud and parse response @param: authProvider: IAuthProvider to provide profile of auth @param: service: Parameter for Tencent cloud common request @param: version: Parameter for Tencent cloud common request @param: action: Parameter for Tencent cloud common request @param: extraParam: Extra Parameter provided to Tencent cloud @return: Response data from Tencent cloud @return: Error

func GetK8sVersion added in v0.2.1

func GetK8sVersion(authProvider auth.IAuthProvider) (string, error)

GetK8sVersion: Get version of a k8s server

@param: authProvider: IAuthProvider to provide pathname of kubeconfig @return: Version of k8s server @return: Error

Types

This section is empty.

Jump to

Keyboard shortcuts

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