http

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// bcsstorage/v1/k8s/dynamic/namespace_resources/clusters/{clusterId}/namespaces/{namespace}/{resourceType}/{resourceName}
	NamespaceScopeURLFmt = "%s/bcsstorage/v1/k8s/dynamic/namespace_resources/clusters/%s/namespaces/%s/%s/%s"

	// bcsstorage/v1/k8s/dynamic/namespace_resources/clusters/{clusterId}/namespaces/{namespace}/{resourceType}
	ListNamespaceScopeURLFmt = "%s/bcsstorage/v1/k8s/dynamic/namespace_resources/clusters/%s/namespaces/%s/%s"

	// bcsstorage/v1/k8s/dynamic/cluster_resources/clusters/{clusterId}/{resourceType}/{resourceName}
	ClusterScopeURLFmt = "%s/bcsstorage/v1/k8s/dynamic/cluster_resources/clusters/%s/%s/%s"

	// bcsstorage/v1/k8s/dynamic/cluster_resources/clusters/{clusterId}/{resourceType}
	ListClusterScopeURLFmt = "%s/bcsstorage/v1/k8s/dynamic/cluster_resources/clusters/%s/%s"

	// event url
	EventScopeURLFmt = "%s/bcsstorage/v1/events"

	// request timeout
	StorageRequestTimeoutSeconds = 2

	// bcsstorage/v1/k8s/watch/clusters/{clusterId}/namespaces/{namespace}/{resourceType}/{resourceName}
	NamespaceScopeWatchURLFmt = "%s/bcsstorage/v1/k8s/watch/clusters/%s/namespaces/%s/%s/%s"
)

Variables

View Source
var WatchKindSet = map[string]struct{}{
	"ExportService": {},
}

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetURL returns target url.
	GetURL()

	// GET is http restfull GET method.
	GET()

	// DELETE is http restfull DELETE method.
	DELETE()

	// PUT is http restfull PUT method.
	PUT()
}

Client is http client for inner services.

type StorageClient

type StorageClient struct {
	HTTPClientConfig *bcs.HTTPClientConfig
	ClusterID        string
	Namespace        string
	ResourceType     string
	ResourceName     string
}

func (*StorageClient) DELETE

func (client *StorageClient) DELETE() (storageResp StorageResponse, err error)

func (*StorageClient) GET

func (client *StorageClient) GET() (storageResp StorageResponse, err error)

func (*StorageClient) GetBody

func (client *StorageClient) GetBody(data interface{}) (interface{}, error)

func (*StorageClient) GetURL

func (client *StorageClient) GetURL() string

func (*StorageClient) ListClusterResource

func (client *StorageClient) ListClusterResource() (data []interface{}, err error)

func (*StorageClient) ListNamespaceResource

func (client *StorageClient) ListNamespaceResource() (data []interface{}, err error)

func (*StorageClient) NewRequest

func (client *StorageClient) NewRequest() (*gorequest.SuperAgent, error)

func (*StorageClient) PUT

func (client *StorageClient) PUT(data interface{}) (storageResp StorageResponse, err error)

type StorageRequestBody

type StorageRequestBody struct {
	Data interface{} `json:"data"`
}

type StorageResponse

type StorageResponse struct {
	Result  bool        `json:"result"`
	Code    int64       `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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