secloud

package
v0.1.5 Latest Latest
Warning

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

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

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 {

	// API Services
	AuthApi   *AuthApiService
	KmsApi    *KmsApiService
	KmsExtApi *KmsApiExtService
	CipherApi *CipherApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Secloud Open API API v1.2.0 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 {
	Message string      `json:"msg,omitempty"`
	Code    int         `json:"code,omitempty"`
	Data    interface{} `json:"data"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response, d interface{}) (*APIResponse, error)

type AuthApiService

type AuthApiService service

func (*AuthApiService) Token

func (a *AuthApiService) Token(ctx context.Context,
	localVarOptionals *AuthOpts) (*AuthRespData, error)

type AuthOpts

type AuthOpts struct {
	ClientId     optional.String
	ClientSecret optional.String
}

type AuthRespData

type AuthRespData struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

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 CipherApiService added in v0.1.3

type CipherApiService service

func (*CipherApiService) Decrypt added in v0.1.3

func (a *CipherApiService) Decrypt(ctx context.Context,
	localVarOptionals *DecryptOpts) (*DecryptRespData, error)

func (*CipherApiService) Encrypt added in v0.1.3

func (a *CipherApiService) Encrypt(ctx context.Context,
	localVarOptionals *EncryptOpts) (*EncryptRespData, error)

func (*CipherApiService) Random added in v0.1.5

func (a *CipherApiService) Random(ctx context.Context,
	localVarOptionals *RandomOpts) (*RandomRespData, error)

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(basePath string) *Configuration

func (*Configuration) AddDefaultHeader

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

type DecryptOpts added in v0.1.3

type DecryptOpts struct {
	EncData optional.String
}

type DecryptRespData added in v0.1.3

type DecryptRespData struct {
	Data string `json:"data"`
}

type EncryptOpts added in v0.1.3

type EncryptOpts struct {
	KeyId optional.String
	Data  optional.String
}

type EncryptRespData added in v0.1.3

type EncryptRespData struct {
	EncData string `json:"enc_data"`
}

type GenerateKeyPairOpts

type GenerateKeyPairOpts struct {
}

type GenerateKeyPairRespData

type GenerateKeyPairRespData struct {
	Index int `json:"index"`
}

type GenerateKeyPairWithKEKOpts added in v0.1.3

type GenerateKeyPairWithKEKOpts struct {
	KekIndex optional.Int
}

type GenerateKeyPairWithKEKRespData added in v0.1.3

type GenerateKeyPairWithKEKRespData struct {
	IpxIndex int    `json:"ipx_index"`
	SignPkey string `json:"sign_pkey"`
	SignSkey string `json:"sign_skey"`
	EncPkey  string `json:"enc_pkey"`
	EncSkey  string `json:"enc_skey"`
}

type GenerateWorkingKeyOpts

type GenerateWorkingKeyOpts struct {
}

type GenerateWorkingKeyRespData

type GenerateWorkingKeyRespData struct {
	EncKey string `json:"enc_key"`
	Code   string `json:"code"`
}

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 ImportKeyPairWithKEKOpts added in v0.1.3

type ImportKeyPairWithKEKOpts struct {
	KekIndex optional.Int
	IpxIndex optional.Int
	SignPkey optional.String
	SignSkey optional.String
	EncPkey  optional.String
	EncSkey  optional.String
}

type ImportKeyPairWithKEKRespData added in v0.1.3

type ImportKeyPairWithKEKRespData struct {
	Id int `json:"id"`
}

type KmsApiExtService added in v0.1.3

type KmsApiExtService service

func (*KmsApiExtService) GenerateKeyPairWithKEK added in v0.1.3

func (a *KmsApiExtService) GenerateKeyPairWithKEK(ctx context.Context,
	localVarOptionals *GenerateKeyPairWithKEKOpts) (*GenerateKeyPairWithKEKRespData, error)

func (*KmsApiExtService) ImportKeyPairWithKEK added in v0.1.3

func (a *KmsApiExtService) ImportKeyPairWithKEK(ctx context.Context,
	localVarOptionals *ImportKeyPairWithKEKOpts) (*ImportKeyPairWithKEKRespData, error)

type KmsApiService

type KmsApiService service

func (*KmsApiService) GenerateKeyPair

func (a *KmsApiService) GenerateKeyPair(ctx context.Context,
	localVarOptionals *GenerateKeyPairOpts) (*GenerateKeyPairRespData, error)

func (*KmsApiService) GenerateWorkingKey

func (a *KmsApiService) GenerateWorkingKey(ctx context.Context,
	localVarOptionals *GenerateWorkingKeyOpts) (*GenerateWorkingKeyRespData, error)

type RandomOpts added in v0.1.5

type RandomOpts struct {
	Len optional.Int
}

type RandomRespData added in v0.1.5

type RandomRespData struct {
	Data string `json:"data"`
}

Jump to

Keyboard shortcuts

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