acls

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

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

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

Types

type AclBindApiInfo

type AclBindApiInfo struct {
	// The API ID.
	ID string `json:"api_id"`
	// The API Name.
	Name string `json:"api_name"`
	// The API type.
	Type int `json:"api_type"`
	// The API type.
	Description string `json:"api_remark"`
	// 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 binding ID.
	BindId string `json:"bind_id"`
	// Group name to which the API belongs.
	GroupName string `json:"group_name"`
	// The time when the API and the policy were bound.
	BoundAt string `json:"bind_time"`
	// API publish record ID.
	PublishId string `json:"publish_id"`
}

AclBindApiInfo is the structure that represents the binding details.

func ExtractBindInfos

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

ExtractBinds is a method to extract the list of binding details for ACL policy.

func ListBind

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

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

type BatchUnbindOpts

type BatchUnbindOpts struct {
	// Instance ID.
	InstanceId string `json:"-" required:"true"`
	// List of API and ACL policy binding relationship IDs that need to be unbound.
	AclBindings []string `json:"acl_bindings,omitempty"`
}

BatchUnbindOpts is the structure that used to unbinding policy from the published APIs.

type BatchUnbindResp

type BatchUnbindResp struct {
	// Number of API and throttling policy bindings that have been successfully unbound.
	SuccessCount int `json:"success_count"`
	// Unbind failed error code
	Failures []Failure `json:"failure"`
}

BatchUnbindResp is the structure that represents the API response of the ACL policy unbinding.

func BatchUnbind

func BatchUnbind(c *golangsdk.ServiceClient, unbindOpt BatchUnbindOpts, action string) (*BatchUnbindResp, error)

BatchUnbind is an API to unbind all ACL policies associated with the list.

type BindOpts

type BindOpts struct {
	// Instnace ID to which the API belongs.
	InstanceId string `json:"-" required:"true"`
	// ACL policy ID.
	PolicyId string `json:"acl_id,omitempty"`
	// The IDs of the API publish record.
	PublishIds []string `json:"publish_ids,omitempty"`
}

BindOpts is the structure that used to bind a policy 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 ID of the binding relationship.
	ID string `json:"id"`
	// The API ID.
	ApiId string `json:"api_id"`
	// The environment ID where the API is published.
	EnvId string `json:"env_id"`
	// Throttling policy ID
	PolicyId string `json:"acl_id"`
	// The creation time.
	CreatedAt string `json:"create_time"`
}

BindResp is the structure that represents the API response of the ACL policy binding.

func Bind

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

Bind is a method to bind the policy to one or more APIs.

type CreateOpts

type CreateOpts struct {
	// The ACL name.
	Name string `json:"acl_name" required:"true"`
	// The ACL type. The valid values are as follows:
	// + PERMIT
	// + DENY
	Type string `json:"acl_type" required:"true"`
	// The value of the ACL policy.
	// One or more values are supported, separated by commas (,).
	Value string `json:"acl_value" required:"true"`
	// The entity type. The valid values are as follows:
	// + IP
	// + DOMAIN
	// + DOMAIN_ID
	EntityType string `json:"entity_type" required:"true"`
}

CreateOpts is the structure that used to create a new ACL policy.

type Failure

type Failure struct {
	// API and ACL policy binding relationship ID that failed to unbind.
	BindId string `json:"bind_id"`
	// Unbind failed error code.
	ErrorCode string `json:"error_code"`
	// Unbind failed error message.
	ErrorMsg string `json:"error_msg"`
	// ID of the API that failed to unbind.
	ApiId string `json:"api_id"`
	// The name of the API that failed to unbind.
	ApiName string `json:"api_name"`
}

Failure is the structure that represents the failure details.

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 ACL policy ID.
	PolicyId string `q:"acl_id"`
	// The API ID.
	ApiId string `q:"api_id"`
	// The API name.
	ApiName string `q:"api_name"`
	// The environment ID where the API is published.
	EnvId string `q:"env_id"`
	// The group ID where the API is located.
	GroupId string `q:"group_id"`
}

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

type ListOpts

type ListOpts 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 ACL policy ID.
	PolicyId string `q:"id"`
	// The ACL policy name.
	Name string `q:"name"`
	// The ACL type.
	Type string `q:"acl_type"`
	// The object type.
	EntityType string `q:"entity_type"`
	// Parameter name (name) for exact matching.
	PreciseSearch string `q:"precise_search"`
}

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

type Policy

type Policy struct {
	// The ACL name.
	Name string `json:"acl_name"`
	// The ACL type. The valid values are as follows:
	// + PERMIT
	// + DENY
	Type string `json:"acl_type"`
	// The value of the ACL policy.
	Value string `json:"acl_value"`
	// The entity type. The valid values are as follows:
	// + IP
	// + DOMAIN
	// + DOMAIN_ID
	EntityType string `json:"entity_type"`
	// The ID of the ACL policy.
	ID string `json:"id"`
	// The latest update time.
	UpdatedAt string `json:"update_time"`
}

Policy is the structure represents the ACL policy details.

func Create

func Create(c *golangsdk.ServiceClient, instanceId string, opts CreateOpts) (*Policy, error)

Create is a method used to create a private DNAT rule using given parameters.

func ExtractPolicies

func ExtractPolicies(r pagination.Page) ([]Policy, error)

ExtractPolicies is a method to extract the list of ACL policies.

func Get

func Get(c *golangsdk.ServiceClient, instanceId, policyId string) (*Policy, error)

Get is a method used to obtain the ACL policy detail by its ID.

func List

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

List is a method to obtain all ACL policies under a specified instance.

func Update

func Update(c *golangsdk.ServiceClient, instanceId, policyId string, opts UpdateOpts) (*Policy, error)

Update is a method used to modify the ACL policy configuration using given parameters.

type PolicyPage

type PolicyPage struct {
	pagination.OffsetPageBase
}

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

func (PolicyPage) IsEmpty

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

IsEmpty checks whether a PolicyPage struct is empty.

type UpdateOpts

type UpdateOpts struct {
	// The ACL name.
	Name string `json:"acl_name" required:"true"`
	// The ACL type. The valid values are as follows:
	// + PERMIT
	// + DENY
	Type string `json:"acl_type" required:"true"`
	// The value of the ACL policy.
	// One or more values are supported, separated by commas (,).
	Value string `json:"acl_value" required:"true"`
	// The entity type. The valid values are as follows:
	// + IP
	// + DOMAIN
	// + DOMAIN_ID
	// The entity type does not support update.
	EntityType string `json:"entity_type" required:"true"`
}

UpdateOpts is the structure that used to modify an existing ACL policy configuration.

Jump to

Keyboard shortcuts

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