Documentation
¶
Index ¶
- func List(client *golangsdk.ServiceClient, instanceId string, opts ListOptsBuilder) pagination.Pager
- func ListSpecThrottles(client *golangsdk.ServiceClient, instanceId, policyId string, ...) pagination.Pager
- type CreateResult
- type CreateSpecThrottleResult
- type DeleteResult
- type GetResult
- type ListOpts
- type ListOptsBuilder
- type SpecThrottle
- type SpecThrottleCreateOpts
- type SpecThrottleCreateOptsBuilder
- type SpecThrottlePage
- type SpecThrottleResult
- type SpecThrottleUpdateOpts
- type SpecThrottleUpdateOptsBuilder
- type SpecThrottlesListOpts
- type SpecThrottlesListOptsBuilder
- type ThorttlePage
- type ThrottlingPolicy
- type ThrottlingPolicyOpts
- type ThrottlingPolicyOptsBuilder
- type UpdateResult
- type UpdateSpecThrottleResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *golangsdk.ServiceClient, instanceId string, opts ListOptsBuilder) pagination.Pager
List is a method to obtain an array of one or more throttling policies according to the query parameters.
func ListSpecThrottles ¶
func ListSpecThrottles(client *golangsdk.ServiceClient, instanceId, policyId string, opts SpecThrottlesListOptsBuilder) pagination.Pager
ListSpecThrottles is a method to obtain an array of one or more special throttling policies according to the query parameters.
Types ¶
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult represents a result of the Create method.
func Create ¶
func Create(client *golangsdk.ServiceClient, instanceId string, opts ThrottlingPolicyOptsBuilder) (r CreateResult)
Create is a method by which to create function that create a new throttling policy.
func (CreateResult) Extract ¶
func (r CreateResult) Extract() (*ThrottlingPolicy, error)
type CreateSpecThrottleResult ¶
type CreateSpecThrottleResult struct {
SpecThrottleResult
}
The CreateSpecThrottleResult represents the result of the CreateSpecThrottle method.
type DeleteResult ¶
func Delete ¶
func Delete(client *golangsdk.ServiceClient, instanceId, policyId string) (r DeleteResult)
Delete is a method to delete an existing throttling policy.
func DeleteSpecThrottle ¶
func DeleteSpecThrottle(client *golangsdk.ServiceClient, instanceId, policyId, strategyId string) (r DeleteResult)
DeleteSpecThrottle is a method to delete an existing special throttling policy.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult represents a result of the Get method.
func Get ¶
func Get(client *golangsdk.ServiceClient, instanceId, policyId string) (r GetResult)
Get is a method to obtain an existing APIG throttling policy by policy ID.
func (GetResult) Extract ¶
func (r GetResult) Extract() (*ThrottlingPolicy, error)
type ListOpts ¶
type ListOpts struct {
// Request throttling policy ID.
Id string `q:"id"`
// Request throttling policy name.
Name string `q:"name"`
// 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"`
// Parameter name (name) for exact matching.
PreciseSearch string `q:"precise_search"`
}
func (ListOpts) ToListQuery ¶
type ListOptsBuilder ¶
type SpecThrottle ¶
type SpecThrottle struct {
// Maximum number of times the excluded object can access an API within the throttling period.
CallLimits int `json:"call_limits"`
// Name of the app to which the excluded request throttling configuration applies.
AppName string `json:"app_name"`
// Name of an app or a tenant to which the excluded request throttling configuration applies.
ObjectName string `json:"object_name"`
// ID of an object specified in the excluded request throttling configuration.
ObjectId string `json:"object_id"`
// Request throttling policy ID.
ThrottleId string `json:"throttle_id"`
// Time when the excluded request throttling configuration is created.
ApplyTime string `json:"apply_time"`
// Excluded request throttling configuration ID.
ID string `json:"id"`
// ID of the app to which the excluded request throttling configuration applies.
AppId string `json:"app_id"`
// Excluded object type, which can be APP or USER.
ObjectType string `json:"object_type"`
}
SpecThrottle is a struct that represents the result of CreateSpecThrottle, UpdateSpecThrottle and ListSpecThrottles methods.
func ExtractSpecThrottles ¶
func ExtractSpecThrottles(r pagination.Page) ([]SpecThrottle, error)
ExtractSpecThrottles its Extract method to interpret it as a special throttling policy array.
type SpecThrottleCreateOpts ¶
type SpecThrottleCreateOpts struct {
// Maximum number of times the excluded object can access an API within the throttling period.
CallLimits int `json:"call_limits" required:"true"`
// Excluded app ID or excluded account ID.
ObjectId string `json:"object_id" required:"true"`
// Excluded object type, which supports APP and USER.
ObjectType string `json:"object_type" required:"true"`
}
SpecThrottleCreateOpts is a struct which will be used to create a new special throttling policy.
func (SpecThrottleCreateOpts) ToSpecThrottleCreateOptsMap ¶
func (opts SpecThrottleCreateOpts) ToSpecThrottleCreateOptsMap() (map[string]interface{}, error)
ToSpecThrottleCreateOptsMap is a method which to build a request body by the SpecThrottleCreateOpts.
type SpecThrottleCreateOptsBuilder ¶
type SpecThrottleCreateOptsBuilder interface {
ToSpecThrottleCreateOptsMap() (map[string]interface{}, error)
}
SpecThrottleCreateOptsBuilder is an interface which to support request body build of the special throttling policy creation.
type SpecThrottlePage ¶
type SpecThrottlePage struct {
pagination.SinglePageBase
}
The SpecThrottlePage represents the result of a List operation.
type SpecThrottleResult ¶
type SpecThrottleResult struct {
// contains filtered or unexported fields
}
The SpecThrottleResult represents the base result of the each special throttling polciy methods.
func CreateSpecThrottle ¶
func CreateSpecThrottle(client *golangsdk.ServiceClient, instanceId, policyId string, opts SpecThrottleCreateOptsBuilder) (r SpecThrottleResult)
CreateSpecThrottle is a method by which to create a new special throttling policy.
func UpdateSpecThrottle ¶
func UpdateSpecThrottle(client *golangsdk.ServiceClient, instanceId, policyId, strategyId string, opts SpecThrottleUpdateOptsBuilder) (r SpecThrottleResult)
UpdateSpecThrottle is a method by which to update an existing special throttle policy.
func (SpecThrottleResult) Extract ¶
func (r SpecThrottleResult) Extract() (*SpecThrottle, error)
Extract is a method which to extract the response to a special throttling policy.
type SpecThrottleUpdateOpts ¶
type SpecThrottleUpdateOpts struct {
// Maximum number of times the excluded object can access an API within the throttling period.
CallLimits int `json:"call_limits" required:"true"`
}
SpecThrottleUpdateOpts is a struct which will be used to update an existing special throttling policy.
func (SpecThrottleUpdateOpts) ToSpecThrottleUpdateOptsMap ¶
func (opts SpecThrottleUpdateOpts) ToSpecThrottleUpdateOptsMap() (map[string]interface{}, error)
ToSpecThrottleUpdateOptsMap is a method which to build a request body by the SpecThrottleUpdateOpts.
type SpecThrottleUpdateOptsBuilder ¶
type SpecThrottleUpdateOptsBuilder interface {
ToSpecThrottleUpdateOptsMap() (map[string]interface{}, error)
}
SpecThrottleUpdateOptsBuilder is an interface which to support request body build of the special throttling policy updation.
type SpecThrottlesListOpts ¶
type SpecThrottlesListOpts struct {
// Object type, which can be APP or USER.
ObjectType string `q:"object_type"`
// Name of an excluded app.
AppName string `q:"app_name"`
// 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"`
}
SpecThrottlesListOpts allows to filter list data using given parameters.
func (SpecThrottlesListOpts) ToSpecThrottlesListQuery ¶
func (opts SpecThrottlesListOpts) ToSpecThrottlesListQuery() (string, error)
ToSpecThrottlesListQuery is a method which to build a request query by the SpecThrottlesListOpts.
type SpecThrottlesListOptsBuilder ¶
SpecThrottlesListOptsBuilder is an interface which to support request query build of the special throttling policies search.
type ThorttlePage ¶
type ThorttlePage struct {
pagination.SinglePageBase
}
The ThorttlePage represents the result of a List operation.
type ThrottlingPolicy ¶
type ThrottlingPolicy struct {
// Number of APIs to which the request throttling policy has been bound.
BindNum int `json:"bind_num"`
// Indicates whether an excluded request throttling configuration has been created.
// 1: yes
// 2: no
IsIncludeSpecialThrottle int `json:"is_include_special_throttle"`
// Creation time.
CreateTime string `json:"create_time"`
// Description.
Description string `json:"remark"`
// Type of the request throttling policy.
// 1: exclusive, limiting the maximum number of times a single API bound to the policy can be called within
// the specified period.
// 2: shared, limiting the maximum number of times all APIs bound to the policy can be called within the
// specified period.
Type int `json:"type"`
// Period of time for limiting the number of API calls.
TimeInterval int `json:"time_interval"`
// Maximum number of times the API can be accessed by an IP address within the same period.
IpCallLimits int `json:"ip_call_limits"`
// Maximum number of times the API can be accessed by an app within the same period.
AppCallLimits int `json:"app_call_limits"`
// Request throttling policy name.
Name string `json:"name"`
// Time unit for limiting the number of API calls.
// The valid values are as following:
// SECOND
// MINUTE
// HOUR
// DAY
TimeUnit string `json:"time_unit"`
// Maximum number of times an API can be accessed within a specified period.
ApiCallLimits int `json:"api_call_limits"`
// Request throttling policy ID.
Id string `json:"id"`
// Maximum number of times the API can be accessed by a user within the same period.
UserCallLimits int `json:"user_call_limits"`
}
func ExtractPolicies ¶
func ExtractPolicies(r pagination.Page) ([]ThrottlingPolicy, error)
ExtractPolicies its Extract method to interpret it as a throttling policy array.
type ThrottlingPolicyOpts ¶
type ThrottlingPolicyOpts struct {
// Maximum number of times an API can be accessed within a specified period.
// The value of this parameter cannot exceed the default limit 200 TPS.
// This value must be a positive integer and cannot exceed 2,147,483,647.
ApiCallLimits int `json:"api_call_limits" required:"true"`
// Request throttling policy name, which can contain 3 to 64 characters, starting with a letter.
// Only letters, digits, and underscores (_) are allowed.
// Chinese characters must be in UTF-8 or Unicode format.
Name string `json:"name" required:"true"`
// Period of time for limiting the number of API calls.
// This parameter applies with each of the preceding three API call limits.
// This value must be a positive integer and cannot exceed 2,147,483,647.
TimeInterval int `json:"time_interval" required:"true"`
// Time unit for limiting the number of API calls.
// The valid values are as following:
// SECOND
// MINUTE
// HOUR
// DAY
TimeUnit string `json:"time_unit" required:"true"`
// Maximum number of times the API can be accessed by an app within the same period.
// The value of this parameter must be less than that of user_call_limits.
// This value must be a positive integer and cannot exceed 2,147,483,647.
AppCallLimits int `json:"app_call_limits,omitempty"`
// Description of the request throttling policy, which can contain a maximum of 255 characters.
// Chinese characters must be in UTF-8 or Unicode format.
Description string `json:"remark,omitempty"`
// Type of the request throttling policy.
// 1: exclusive, limiting the maximum number of times a single API bound to the policy can be called within
// the specified period.
// 2: shared, limiting the maximum number of times all APIs bound to the policy can be called within the
// specified period.
Type int `json:"type,omitempty"`
// Maximum number of times the API can be accessed by a user within the same period.
// The value of this parameter must be less than that of api_call_limits.
// This value must be a positive integer and cannot exceed 2,147,483,647.
UserCallLimits int `json:"user_call_limits,omitempty"`
// Maximum number of times the API can be accessed by an IP address within the same period.
// The value of this parameter must be less than that of api_call_limits.
// This value must be a positive integer and cannot exceed 2,147,483,647.
IpCallLimits int `json:"ip_call_limits,omitempty"`
}
func (ThrottlingPolicyOpts) ToThrottlingPolicyOptsMap ¶
func (opts ThrottlingPolicyOpts) ToThrottlingPolicyOptsMap() (map[string]interface{}, error)
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult represents a result of the Update method.
func Update ¶
func Update(client *golangsdk.ServiceClient, instanceId, policyId string, opts ThrottlingPolicyOptsBuilder) (r UpdateResult)
Update is a method by which to udpate an existing throttle policy.
func (UpdateResult) Extract ¶
func (r UpdateResult) Extract() (*ThrottlingPolicy, error)
type UpdateSpecThrottleResult ¶
type UpdateSpecThrottleResult struct {
SpecThrottleResult
}
The UpdateSpecThrottleResult represents the result of the UpdateSpecThrottle method.