signs

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(c *golangsdk.ServiceClient, instanceId, signatureId string) error

Delete is a method to remove the specified signature using its ID and related dedicated instance ID.

func Unbind

func Unbind(c *golangsdk.ServiceClient, instanceId, bindId string) error

Unbind is an method used to unbind a specified API from the signature.

Types

type BindOpts

type BindOpts struct {
	// The instnace ID to which the signature belongs.
	InstanceId string `json:"-" required:"true"`
	// Signature ID.
	SignatureId string `json:"sign_id" required:"true"`
	// The IDs of the API publish record.
	PublishIds []string `json:"publish_ids" required:"true"`
}

BindOpts is the structure that used to bind a signature to the published APIs.

type BindPage

type BindPage struct {
	pagination.OffsetPageBase
}

BindPage is a single page maximum result representing a query by offset page.

func (BindPage) IsEmpty

func (b BindPage) IsEmpty() (bool, error)

IsEmpty checks whether a BindPage struct is empty.

type BindResp

type BindResp struct {
	// The published APIs of the binding relationship.
	Bindings []SignBindApiInfo `json:"bindings"`
}

BindResp is the structure that represents the API response of the signature binding.

type CreateOpts

type CreateOpts struct {
	// The instnace ID to which the signature belongs.
	InstanceId string `json:"-" required:"true"`
	// Signature key name. It can contain letters, digits, and underscores(_) and must start with a letter.
	Name string `json:"name" required:"true"`
	// Signature key type.
	// + hmac
	// + basic
	// + public_key
	// + aes
	SignType string `json:"sign_type,omitempty"`
	// Signature key.
	// + For 'hmac' type: The value contains 8 to 32 characters, including letters, digits, underscores (_), and
	//   hyphens (-). It must start with a letter or digit. If not specified, a key is automatically generated.
	// + For 'basic' type: The value contains 4 to 32 characters, including letters, digits, underscores (_), and
	//   hyphens (-). It must start with a letter. If not specified, a key is automatically generated.
	// + For 'public_key' type: The value contains 8 to 512 characters, including letters, digits, and special
	//   characters (_-+/=). It must start with a letter, digit, plus sign (+), or slash (/). If not specified, a key
	//   is automatically generated.
	// + For 'aes' type: The value contains 16 characters if the aes-128-cfb algorithm is used, or 32 characters if the
	//   aes-256-cfb algorithm is used. Letters, digits, and special characters (_-!@#$%+/=) are allowed. It must start
	//   with a letter, digit, plus sign (+), or slash (/). If not specified, a key is automatically generated.
	SignKey string `json:"sign_key,omitempty"`
	// Signature secret.
	// + For 'hmac' type: The value contains 16 to 64 characters. Letters, digits, and special characters (_-!@#$%) are
	//   allowed. It must start with a letter or digit. If not specified, a value is automatically generated.
	// + For 'basic' type: The value contains 8 to 64 characters. Letters, digits, and special characters (_-!@#$%) are
	//   allowed. It must start with a letter or digit. If not specified, a value is automatically generated.
	// + For 'public_key' type: The value contains 15 to 2048 characters, including letters, digits, and special
	//   characters (_-!@#$%+/=). It must start with a letter, digit, plus sign (+), or slash (/). If not specified, a
	//   value is automatically generated.
	// + For 'aes' type: The value contains 16 characters, including letters, digits, and special
	//   characters (_-!@#$%+/=). It must start with a letter, digit, plus sign (+), or slash (/). If not specified, a
	//   value is automatically generated.
	SignSecret string `json:"sign_secret,omitempty"`
	// Signature algorithm. Specify a signature algorithm only when using an AES signature key. By default, no algorithm
	// is used.
	// + aes-128-cfb
	// + aes-256-cfb
	SignAlgorithm string `json:"sign_algorithm,omitempty"`
}

CreateOpts is the structure used to create a new signature key.

type ListBindOpts

type ListBindOpts struct {
	// The instnace ID to which the API belongs.
	InstanceId string `json:"-" required:"true"`
	// Offset from which the query starts.
	// If the offset is less than 0, the value is automatically converted to 0. Default to 0.
	Offset int `q:"offset"`
	// Number of items displayed on each page. The valid values are range form 1 to 500, default to 20.
	Limit int `q:"limit"`
	// The signature ID.
	SignatureId string `q:"sign_id"`
	// The environment ID where the API is published.
	EnvId string `q:"env_id"`
	// The API ID.
	ApiId string `q:"api_id"`
	// The API name.
	ApiName string `q:"api_name"`
	// The group ID where the API is located.
	GroupId string `q:"group_id"`
}

ListBindOpts is the structure used to querying published API list that signature associated.

type ListOpts

type ListOpts struct {
	// The instnace ID to which the signature belongs.
	InstanceId string `json:"-" required:"true"`
	// Offset from which the query starts.
	// If the offset is less than 0, the value is automatically converted to 0. Default to 0.
	Offset int `q:"offset"`
	// Number of items displayed on each page. The valid values are range form 1 to 500, default to 20.
	Limit int `q:"limit"`
	// The signature ID.
	ID string `q:"id"`
	// The signature name.
	Name string `q:"name"`
	// Parameter name (only 'name' is supported) for exact matching.
	PreciseSearch string `q:"precise_search"`
}

ListOpts is the structure used to querying signature list.

type SignBindApiInfo

type SignBindApiInfo struct {
	// API publish record ID.
	PublishId string `json:"publish_id"`
	// The API ID.
	ID string `json:"api_id"`
	// Group name to which the API belongs.
	GroupName string `json:"group_name"`
	// The time when the API and the signature were bound.
	BoundAt string `json:"binding_time"`
	// The environment ID where the API is published.
	EnvId string `json:"env_id"`
	// The name of the environment published by the API.
	EnvName string `json:"env_name"`
	// The API type.
	Type int `json:"api_type"`
	// The API Name.
	Name string `json:"api_name"`
	// The binding ID.
	BindId string `json:"id"`
	// The API type.
	Description string `json:"api_remark"`
	// Signature ID.
	SignId string `json:"sign_id"`
	// Signature name.
	SignName string `json:"sign_name"`
	// Signature key.
	SignKey string `json:"sign_key"`
	// Signature secret.
	SignSecret string `json:"sign_secret"`
	// Signature type.
	SignType string `json:"sign_type"`
}

SignBindApiInfo is the structure that represents the binding details.

func Bind

func Bind(c *golangsdk.ServiceClient, opts BindOpts) ([]SignBindApiInfo, error)

Bind is a method to bind a signature to one or more APIs.

func ExtractBindInfos

func ExtractBindInfos(r pagination.Page) ([]SignBindApiInfo, error)

ExtractBindInfos is a method to extract the list of binding details for signature.

func ListBind

func ListBind(c *golangsdk.ServiceClient, opts ListBindOpts) ([]SignBindApiInfo, error)

ListBind is a method to obtain all API to which the signature bound.

type Signature

type Signature struct {
	// The signature ID.
	ID string `json:"id"`
	// Signature key name. It can contain letters, digits, and underscores(_) and must start with a letter.
	Name string `json:"name"`
	// Signature key type.
	// + hmac
	// + basic
	// + public_key
	// + aes
	SignType string `json:"sign_type"`
	// Signature key.
	// + For 'hmac' type: The value contains 8 to 32 characters, including letters, digits, underscores (_), and
	//   hyphens (-). It must start with a letter or digit. If not specified, a key is automatically generated.
	// + For 'basic' type: The value contains 4 to 32 characters, including letters, digits, underscores (_), and
	//   hyphens (-). It must start with a letter. If not specified, a key is automatically generated.
	// + For 'public_key' type: The value contains 8 to 512 characters, including letters, digits, and special
	//   characters (_-+/=). It must start with a letter, digit, plus sign (+), or slash (/). If not specified, a key
	//   is automatically generated.
	// + For 'aes' type: The value contains 16 characters if the aes-128-cfb algorithm is used, or 32 characters if the
	//   aes-256-cfb algorithm is used. Letters, digits, and special characters (_-!@#$%+/=) are allowed. It must start
	//   with a letter, digit, plus sign (+), or slash (/). If not specified, a key is automatically generated.
	SignKey string `json:"sign_key"`
	// Signature secret.
	// + For 'hmac' type: The value contains 16 to 64 characters. Letters, digits, and special characters (_-!@#$%) are
	//   allowed. It must start with a letter or digit. If not specified, a value is automatically generated.
	// + For 'basic' type: The value contains 8 to 64 characters. Letters, digits, and special characters (_-!@#$%) are
	//   allowed. It must start with a letter or digit. If not specified, a value is automatically generated.
	// + For 'public_key' type: The value contains 15 to 2048 characters, including letters, digits, and special
	//   characters (_-!@#$%+/=). It must start with a letter, digit, plus sign (+), or slash (/). If not specified, a
	//   value is automatically generated.
	// + For 'aes' type: The value contains 16 characters, including letters, digits, and special
	//   characters (_-!@#$%+/=). It must start with a letter, digit, plus sign (+), or slash (/). If not specified, a
	//   value is automatically generated.
	SignSecret string `json:"sign_secret"`
	// Signature algorithm. Specify a signature algorithm only when using an AES signature key. By default, no algorithm
	// is used.
	// + aes-128-cfb
	// + aes-256-cfb
	SignAlgorithm string `json:"sign_algorithm"`
	// The creation time.
	CreatedAt string `json:"created_at"`
	// The latest update time.
	UpdatedAt string `json:"updated_at"`
	// Number of bound APIs.
	BindNum int `json:"bind_num"`
	// Number of custom backends bound.
	LdapiBindNum int `json:"ldapi_bind_num"`
}

Signature is the structure that represents the signature detail.

func Create

func Create(c *golangsdk.ServiceClient, opts CreateOpts) (*Signature, error)

Create is a method used to create a new signature key using given parameters.

func ExtractSignatures

func ExtractSignatures(r pagination.Page) ([]Signature, error)

ExtractSignatures is a method to extract the list of signatures.

func List

func List(c *golangsdk.ServiceClient, opts ListOpts) ([]Signature, error)

List is a method to obtain the signature list under a specified instance using given parameters.

func Update

func Update(c *golangsdk.ServiceClient, opts UpdateOpts) (*Signature, error)

Update is a method used to update a signature using given parameters.

type SignaturePage

type SignaturePage struct {
	pagination.OffsetPageBase
}

SignaturePage is a single page maximum result representing a query by offset page.

func (SignaturePage) IsEmpty

func (b SignaturePage) IsEmpty() (bool, error)

IsEmpty checks whether a SignaturePage struct is empty.

type UpdateOpts

type UpdateOpts struct {
	// The instnace ID to which the signature belongs.
	InstanceId string `json:"-" required:"true"`
	// The signature ID.
	SignatureId string `json:"-" required:"true"`
	// Signature key name. It can contain letters, digits, and underscores(_) and must start with a letter.
	Name string `json:"name" required:"true"`
	// Signature key type.
	// + hmac
	// + basic
	// + public_key
	// + aes
	SignType string `json:"sign_type,omitempty"`
	// Signature key.
	// + For 'hmac' type: The value contains 8 to 32 characters, including letters, digits, underscores (_), and
	//   hyphens (-). It must start with a letter or digit. If not specified, a key is automatically generated.
	// + For 'basic' type: The value contains 4 to 32 characters, including letters, digits, underscores (_), and
	//   hyphens (-). It must start with a letter. If not specified, a key is automatically generated.
	// + For 'public_key' type: The value contains 8 to 512 characters, including letters, digits, and special
	//   characters (_-+/=). It must start with a letter, digit, plus sign (+), or slash (/). If not specified, a key
	//   is automatically generated.
	// + For 'aes' type: The value contains 16 characters if the aes-128-cfb algorithm is used, or 32 characters if the
	//   aes-256-cfb algorithm is used. Letters, digits, and special characters (_-!@#$%+/=) are allowed. It must start
	//   with a letter, digit, plus sign (+), or slash (/). If not specified, a key is automatically generated.
	SignKey string `json:"sign_key,omitempty"`
	// Signature secret.
	// + For 'hmac' type: The value contains 16 to 64 characters. Letters, digits, and special characters (_-!@#$%) are
	//   allowed. It must start with a letter or digit. If not specified, a value is automatically generated.
	// + For 'basic' type: The value contains 8 to 64 characters. Letters, digits, and special characters (_-!@#$%) are
	//   allowed. It must start with a letter or digit. If not specified, a value is automatically generated.
	// + For 'public_key' type: The value contains 15 to 2048 characters, including letters, digits, and special
	//   characters (_-!@#$%+/=). It must start with a letter, digit, plus sign (+), or slash (/). If not specified, a
	//   value is automatically generated.
	// + For 'aes' type: The value contains 16 characters, including letters, digits, and special
	//   characters (_-!@#$%+/=). It must start with a letter, digit, plus sign (+), or slash (/). If not specified, a
	//   value is automatically generated.
	SignSecret string `json:"sign_secret,omitempty"`
	// Signature algorithm. Specify a signature algorithm only when using an AES signature key. By default, no algorithm
	// is used.
	// + aes-128-cfb
	// + aes-256-cfb
	SignAlgorithm string `json:"sign_algorithm,omitempty"`
}

UpdateOpts is the structure used to update the signature key.

Jump to

Keyboard shortcuts

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