plugins

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, pluginId string) error

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

func Unbind

func Unbind(c *golangsdk.ServiceClient, opts UnbindOpts) error

Unbind is an method used to unbind one or more APIs from the plugin.

Types

type BindApiInfo

type BindApiInfo struct {
	// API ID.
	ApiId string `json:"api_id"`
	// API name.
	ApiName string `json:"api_name"`
	// API type.
	Type int `json:"type"`
	// The request protocol of the API.
	RequestProtocol string `json:"req_protocol"`
	// The request method of the API.
	RequestMethod string `json:"req_method"`
	// The request URI of the API.
	RequestUri string `json:"request_uri"`
	// The authorization type of the API.
	AuthType string `json:"auth_type"`
	// The match mode of the API.
	MatchMode string `json:"match_mode"`
	// The description of the API.
	Remark string `json:"remark"`
	// The ID of API group to which the API belongs.
	GroupId string `json:"group_id"`
	// The name of API group to which the API belongs.
	GroupName string `json:"group_name"`
	// Home integration application code, which is compatible with the field of the Roma instance.
	// Generally, the value is null.
	RomaAppId string `json:"roma_app_id"`
	// The ID of environment where the API was published.
	EnvId string `json:"env_id"`
	// The name of environment where the API was published.
	EnvName string `json:"env_name"`
	// The API publish ID.
	PublishId string `json:"publish_id"`
	// The ID of plugin policy binding.
	BindId string `json:"plugin_attach_id"`
	// The bound time.
	BoundAt string `json:"attached_time"`
}

BindApiInfo is an object that represents the bind detail.

func ExtractBindInfos

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

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

func ListBind

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

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

type BindOpts

type BindOpts struct {
	// The instnace ID to which the plugin belongs.
	InstanceId string `json:"-" required:"true"`
	// The plugin ID.
	PluginId string `json:"-" required:"true"`
	// The environment ID where the API is published.
	EnvId string `json:"env_id" required:"true"`
	// The IDs of the API publish record.
	ApiIds []string `json:"api_ids" required:"true"`
}

BindOpts is the structure that used to bind a plugin 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 []PluginBindDetail `json:"bindings"`
}

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

type CreateOpts

type CreateOpts struct {
	// The ID of the dedicated instance to which the plugin belongs.
	InstanceId string `json:"-" required:"true"`
	// Plugin name.
	// The valid length is limited from `3` to `255`, only Chinese characters, English letters, digits, hyphens (-) and
	// underscores (_) are allowed. The name must start with an English letter or Chinese character.
	Name string `json:"plugin_name" required:"true"`
	// Plugin type.
	// The valid values are as follows:
	// + 'cors': CORS, specify preflight request headers and response headers and automatically create preflight
	//   request APIs for cross-origin API access.
	// + 'set_resp_headers': HTTP Response Header Management, customize HTTP headers that will be contained in an API
	//   response.
	// + 'rate_limit': Request Throttling 2.0, limits the number of times an API can be called within a specific time
	//   period. It supports parameter-based, basic, and excluded throttling.
	// + 'kafka_log': Kafka Log Push, Push detailed API calling logs to kafka for you to easily obtain logs.
	// + 'breaker': Circuit Breaker, circuit breaker protect the system when performance issues occur on backend
	//   service.
	Type string `json:"plugin_type" required:"true"`
	// The available scope for plugin, the valid value is 'global'.
	Scope string `json:"plugin_scope" required:"true"`
	// The configuration details for plugin.
	Content string `json:"plugin_content" required:"true"`
	// The plugin description.
	// The valid length is limited from `3` to `255` characters.
	Description string `json:"remark,omitempty"`
}

CreateOpts is the structure used to create a new plugin.

type ListBindOpts

type ListBindOpts struct {
	// The instnace ID to which the plugin belongs.
	InstanceId string `json:"-" required:"true"`
	// The plugin ID.
	PluginId 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 environment ID where the API is published.
	EnvId string `q:"env_id"`
	// The API name.
	ApiName string `q:"api_name"`
	// The API ID.
	ApiId string `q:"api_id"`
	// The group ID where the API is located.
	GroupId string `q:"group_id"`
	// The request method.
	RequestMethod string `q:"req_method"`
	// The request URI.
	RequestUri string `q:"req_uri"`
}

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

type Plugin

type Plugin struct {
	// The plugin ID.
	ID string `json:"plugin_id"`
	// Plugin name.
	// The valid length is limited from `3` to `255`, only Chinese characters, English letters, digits, hyphens (-) and
	// underscores (_) are allowed. The name must start with an English letter or Chinese character.
	Name string `json:"plugin_name"`
	// Plugin type.
	// The valid values are as follows:
	// + 'cors': CORS, specify preflight request headers and response headers and automatically create preflight
	//   request APIs for cross-origin API access.
	// + 'set_resp_headers': HTTP Response Header Management, customize HTTP headers that will be contained in an API
	//   response.
	// + 'rate_limit': Request Throttling 2.0, limits the number of times an API can be called within a specific time
	//   period. It supports parameter-based, basic, and excluded throttling.
	// + 'kafka_log': Kafka Log Push, Push detailed API calling logs to kafka for you to easily obtain logs.
	// + 'breaker': Circuit Breaker, circuit breaker protect the system when performance issues occur on backend
	//   service.
	Type string `json:"plugin_type"`
	// The available scope for plugin, the valid value is 'global'.
	Scope string `json:"plugin_scope"`
	// The configuration details for plugin.
	Content string `json:"plugin_content"`
	// The plugin description.
	// The valid length is limited from `3` to `255` characters.
	Description string `json:"remark"`
	// The creation time.
	CreatedAt string `json:"created_at"`
	// The latest update time.
	UpdatedAt string `json:"updated_at"`
}

Plugin is the structure that represents the plugin detail.

func Create

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

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

func Get

func Get(client *golangsdk.ServiceClient, instanceId, pluginId string) (*Plugin, error)

Get is a method to obtain an existing plugin detail by its ID and related instance ID.

func Update

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

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

type PluginBindDetail

type PluginBindDetail struct {
	// The binding ID.
	BindId string `json:"plugin_attach_id"`
	// The plugin ID.
	PluginId string `json:"plugin_id"`
	// The plugin name.
	PluginName string `json:"plugin_name"`
	// Plugin type.
	// The valid values are as follows:
	// + 'cors': CORS, specify preflight request headers and response headers and automatically create preflight
	//   request APIs for cross-origin API access.
	// + 'set_resp_headers': HTTP Response Header Management, customize HTTP headers that will be contained in an API
	//   response.
	// + 'rate_limit': Request Throttling 2.0, limits the number of times an API can be called within a specific time
	//   period. It supports parameter-based, basic, and excluded throttling.
	// + 'kafka_log': Kafka Log Push, Push detailed API calling logs to kafka for you to easily obtain logs.
	// + 'breaker': Circuit Breaker, circuit breaker protect the system when performance issues occur on backend
	//   service.
	PluginType string `json:"plugin_type"`
	// The available scope for plugin, the valid value is 'global'.
	PluginScope string `json:"plugin_scope"`
	// 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 ID.
	ApiId string `json:"api_id"`
	// The API name.
	ApiName string `json:"apig_name"`
	// The time when the API and the plugin were bound.
	BoundAt string `json:"attached_time"`
}

PluginBindDetail is the structure that represents the binding details.

func Bind

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

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

type UnbindOpts

type UnbindOpts struct {
	// The instnace ID to which the plugin belongs.
	InstanceId string `json:"-" required:"true"`
	// The plugin ID.
	PluginId string `json:"-" required:"true"`
	// The environment ID where the API is published.
	EnvId string `json:"env_id" required:"true"`
	// The IDs of the API publish record.
	ApiIds []string `json:"api_ids" required:"true"`
}

UnbindOpts is the structure that used to unbind the published APIs from the plugin.

type UpdateOpts

type UpdateOpts struct {
	// The instnace ID to which the plugin belongs.
	InstanceId string `json:"-" required:"true"`
	// The plugin ID.
	ID string `json:"-" required:"true"`
	// Plugin name.
	// The valid length is limited from `3` to `255`, only Chinese characters, English letters, digits, hyphens (-) and
	// underscores (_) are allowed. The name must start with an English letter or Chinese character.
	Name string `json:"plugin_name" required:"true"`
	// Plugin type.
	// The valid values are as follows:
	// + 'cors': CORS, specify preflight request headers and response headers and automatically create preflight
	//   request APIs for cross-origin API access.
	// + 'set_resp_headers': HTTP Response Header Management, customize HTTP headers that will be contained in an API
	//   response.
	// + 'rate_limit': Request Throttling 2.0, limits the number of times an API can be called within a specific time
	//   period. It supports parameter-based, basic, and excluded throttling.
	// + 'kafka_log': Kafka Log Push, Push detailed API calling logs to kafka for you to easily obtain logs.
	// + 'breaker': Circuit Breaker, circuit breaker protect the system when performance issues occur on backend
	//   service.
	Type string `json:"plugin_type" required:"true"`
	// The available scope for plugin, the valid value is 'global'.
	Scope string `json:"plugin_scope" required:"true"`
	// The configuration details for plugin.
	Content string `json:"plugin_content" required:"true"`
	// The plugin description.
	// The valid length is limited from `3` to `255` characters.
	Description *string `json:"remark,omitempty"`
}

UpdateOpts is the structure used to update the plugin configuration.

Jump to

Keyboard shortcuts

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