Documentation ¶
Overview ¶
* Copyright 2022 Baidu, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License.
* Copyright 2022 Baidu, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License.
Index ¶
- Constants
- func BindCfw(cli *Client, cfwId string, body *BindCfwRequest) error
- func CreateCfwRule(cli *Client, cfwId string, body *CreateCfwRuleRequest) error
- func DeleteCfw(cli *Client, cfwId string) error
- func DeleteCfwRule(cli *Client, cfwId string, body *DeleteCfwRuleRequest) error
- func DisableCfw(cli *Client, cfwId string, body *DisableCfwRequest) error
- func EnableCfw(cli *Client, cfwId string, body *EnableCfwRequest) error
- func UnbindCfw(cli *Client, cfwId string, body *UnbindCfwRequest) error
- func UpdateCfw(cli *Client, cfwId string, body *UpdateCfwRequest) error
- func UpdateCfwRule(cli *Client, cfwId string, cfwRuleId string, body *UpdateCfwRuleRequest) error
- type BindCfwRequest
- type BindCfwRequestInstances
- type Cfw
- type CfwBind
- type CfwRule
- type Client
- func (c *Client) BindCfw(cfwId string, body *BindCfwRequest) error
- func (c *Client) CreateCfw(body *CreateCfwRequest) (*CreateCfwResponse, error)
- func (c *Client) CreateCfwRule(cfwId string, body *CreateCfwRuleRequest) error
- func (c *Client) DeleteCfw(cfwId string) error
- func (c *Client) DeleteCfwRule(cfwId string, body *DeleteCfwRuleRequest) error
- func (c *Client) DisableCfw(cfwId string, body *DisableCfwRequest) error
- func (c *Client) EnableCfw(cfwId string, body *EnableCfwRequest) error
- func (c *Client) GetCfw(cfwId string) (*GetCfwResponse, error)
- func (c *Client) ListCfw(listCfwArgs *ListCfwArgs) (*ListCfwResponse, error)
- func (c *Client) ListInstance(body *ListInstanceRequest) (*ListInstanceResponse, error)
- func (c *Client) UnbindCfw(cfwId string, body *UnbindCfwRequest) error
- func (c *Client) UpdateCfw(cfwId string, body *UpdateCfwRequest) error
- func (c *Client) UpdateCfwRule(cfwId string, cfwRuleId string, body *UpdateCfwRuleRequest) error
- type CreateCfwRequest
- type CreateCfwRequestCfwRules
- type CreateCfwResponse
- type CreateCfwRuleRequest
- type CreateCfwRuleRequestCfwRules
- type CreateRule
- type DeleteCfwRuleRequest
- type DeleteCfwRuleRequestCfwRuleIds
- type DisableCfwRequest
- type EnableCfwRequest
- type GetCfwResponse
- type GetCfwResponseCfwRules
- type Instance
- type ListCfwArgs
- type ListCfwResponse
- type ListCfwResponseCfws
- type ListInstanceRequest
- type ListInstanceRequestCfwRuleIds
- type ListInstanceResponse
- type ListInstanceResponseInstances
- type UnbindCfwRequest
- type UnbindCfwRequestInstances
- type UpdateCfwRequest
- type UpdateCfwRuleRequest
Constants ¶
const ( DEFAULT_SERVICE_DOMAIN = "http://cfw.baidubce.com" DEFAULT_MAX_PARALLEL = 10 MULTIPART_ALIGN = 1 << 20 // 1MB MIN_MULTIPART_SIZE = 1 << 20 // 1MB DEFAULT_MULTIPART_SIZE = 12 * (1 << 20) // 12MB MAX_PART_NUMBER = 10000 )
Variables ¶
This section is empty.
Functions ¶
func BindCfw ¶
func BindCfw(cli *Client, cfwId string, body *BindCfwRequest) error
BindCfw - 批量实例绑定CFW策略。 - 没有规则的CFW不能绑定到实例
PARAMS:
- cli: the client agent which can perform sending request
- cfwId: CFW的id
- body:
RETURNS:
- error: the return error if any occurs
func CreateCfwRule ¶
func CreateCfwRule(cli *Client, cfwId string, body *CreateCfwRuleRequest) error
CreateCfwRule - 批量创建CFW中防护规则。 - 五元组(protocol/sourceAddress/destAddress/sourcePort/destPort) + 方向(direction)不能全部相同。 - 一次最多创建100条规则。
PARAMS:
- cli: the client agent which can perform sending request
- cfwId: CFW的id
- body:
RETURNS:
- error: the return error if any occurs
func DeleteCfw ¶
DeleteCfw - 删除指定CFW策略。 - CFW存在绑定关系时不允许删除
PARAMS:
- cli: the client agent which can perform sending request
- cfwId: CFW的id
RETURNS:
- error: the return error if any occurs
func DeleteCfwRule ¶
func DeleteCfwRule(cli *Client, cfwId string, body *DeleteCfwRuleRequest) error
DeleteCfwRule - 批量删除指定CFW中某些规则。 - CFW已绑定到实例时,至少保留一条规则。
PARAMS:
- cli: the client agent which can perform sending request
- cfwId: CFW的id
- body:
RETURNS:
- error: the return error if any occurs
func DisableCfw ¶
func DisableCfw(cli *Client, cfwId string, body *DisableCfwRequest) error
DisableCfw - 已绑定CFW的实例,使用该接口临时关闭CFW的防护功能。
PARAMS:
- cli: the client agent which can perform sending request
- cfwId: CFW的id
- body:
RETURNS:
- error: the return error if any occurs
func EnableCfw ¶
func EnableCfw(cli *Client, cfwId string, body *EnableCfwRequest) error
EnableCfw - 已绑定CFW并且临时关闭了防护功能的实例,使用该接口恢复CFW的防护功能。
PARAMS:
- cli: the client agent which can perform sending request
- cfwId: CFW的id
- body:
RETURNS:
- error: the return error if any occurs
func UnbindCfw ¶
func UnbindCfw(cli *Client, cfwId string, body *UnbindCfwRequest) error
UnbindCfw - 实例批量解绑CFW。
PARAMS:
- cli: the client agent which can perform sending request
- cfwId: CFW的id
- body:
RETURNS:
- error: the return error if any occurs
func UpdateCfw ¶
func UpdateCfw(cli *Client, cfwId string, body *UpdateCfwRequest) error
UpdateCfw - 更新CFW策略的基本信息。
PARAMS:
- cli: the client agent which can perform sending request
- cfwId: CFW的id
- body:
RETURNS:
- error: the return error if any occurs
func UpdateCfwRule ¶
func UpdateCfwRule(cli *Client, cfwId string, cfwRuleId string, body *UpdateCfwRuleRequest) error
UpdateCfwRule - 修改指定CFW规则。 - 五元组(protocol/sourceAddress/destAddress/sourcePort/destPort) + 方向(direction)不能全部相同。
PARAMS:
- cli: the client agent which can perform sending request
- cfwId: CFW策略的id
- cfwRuleId: CFW规则的id
- body:
RETURNS:
- error: the return error if any occurs
Types ¶
type BindCfwRequest ¶
type BindCfwRequestInstances ¶
type BindCfwRequestInstances struct { }
type CfwRule ¶
type CfwRule struct { IpVersion int32 `json:"ipVersion"` Priority int32 `json:"priority"` Protocol string `json:"protocol"` Direction string `json:"direction"` SourceAddress string `json:"sourceAddress"` DestAddress string `json:"destAddress"` SourcePort string `json:"sourcePort"` DestPort string `json:"destPort"` Action string `json:"action"` Description string `json:"description"` CfwId string `json:"cfwId"` CfwRuleId string `json:"cfwRuleId"` }
type Client ¶
type Client struct { *bce.BceClient // Fileds that used in parallel operation for BOS service MaxParallel int64 MultipartSize int64 }
Client of bcd service is a kind of BceClient, so derived from BceClient
func NewClient ¶
NewClient make the bcd service client with default configuration. Use `cli.Config.xxx` to access the config or change it to non-default value.
func (*Client) BindCfw ¶
func (c *Client) BindCfw(cfwId string, body *BindCfwRequest) error
BindCfw - 批量实例绑定CFW策略。 - 没有规则的CFW不能绑定到实例
PARAMS:
- cfwId: CFW的id
- body: body参数
RETURNS:
- error: the return error if any occurs
func (*Client) CreateCfw ¶
func (c *Client) CreateCfw(body *CreateCfwRequest) ( *CreateCfwResponse, error)
CreateCfw - 创建CFW策略。
PARAMS:
- body: body参数
RETURNS:
- *CreateCfwResponse:
- error: the return error if any occurs
func (*Client) CreateCfwRule ¶
func (c *Client) CreateCfwRule(cfwId string, body *CreateCfwRuleRequest) error
CreateCfwRule - 批量创建CFW中防护规则。 - 五元组(protocol/sourceAddress/destAddress/sourcePort/destPort) + 方向(direction)不能全部相同。 - 一次最多创建100条规则。
PARAMS:
- cfwId: CFW的id
- body: body参数
RETURNS:
- error: the return error if any occurs
func (*Client) DeleteCfw ¶
DeleteCfw - 删除指定CFW策略。 - CFW存在绑定关系时不允许删除
PARAMS:
- cfwId: CFW的id
RETURNS:
- error: the return error if any occurs
func (*Client) DeleteCfwRule ¶
func (c *Client) DeleteCfwRule(cfwId string, body *DeleteCfwRuleRequest) error
DeleteCfwRule - 批量删除指定CFW中某些规则。 - CFW已绑定到实例时,至少保留一条规则。
PARAMS:
- cfwId: CFW的id
- body: body参数
RETURNS:
- error: the return error if any occurs
func (*Client) DisableCfw ¶
func (c *Client) DisableCfw(cfwId string, body *DisableCfwRequest) error
DisableCfw - 已绑定CFW的实例,使用该接口临时关闭CFW的防护功能。
PARAMS:
- cfwId: CFW的id
- body: body参数
RETURNS:
- error: the return error if any occurs
func (*Client) EnableCfw ¶
func (c *Client) EnableCfw(cfwId string, body *EnableCfwRequest) error
EnableCfw - 已绑定CFW并且临时关闭了防护功能的实例,使用该接口恢复CFW的防护功能。
PARAMS:
- cfwId: CFW的id
- body: body参数
RETURNS:
- error: the return error if any occurs
func (*Client) GetCfw ¶
func (c *Client) GetCfw(cfwId string) (*GetCfwResponse, error)
GetCfw - 查询指定CFW策略的详情信息。
PARAMS:
- cfwId: CFW的id
RETURNS:
- *GetCfwResponse:
- error: the return error if any occurs
func (*Client) ListCfw ¶
func (c *Client) ListCfw(listCfwArgs *ListCfwArgs) ( *ListCfwResponse, error)
ListCfw - 查询CFW策略列表信息。
PARAMS:
- marker: 批量获取列表查询的起始位置,是一个由系统生成的字符串
- maxKeys: 每页包含的最大数量,最大数量通常不超过1000,缺省值为1000
RETURNS:
- *ListCfwResponse:
- error: the return error if any occurs
func (*Client) ListInstance ¶
func (c *Client) ListInstance(body *ListInstanceRequest) (*ListInstanceResponse, error)
ListInstance - 查询防护边界实例的列表。
PARAMS:
- instanceType: 实例类型,取值[ eip | nat | etGateway | peerconn | csn | ipv6Gateway ]
- marker: 批量获取列表的查询的起始位置,是一个由系统生成的字符串
- maxKeys: 每页包含的最大数量,最大数量通常不超过1000,缺省值为1000
- status: 防护状态,取值 [ unbound | protected | unprotected ]
- region: 地域信息,取值 [ bj | gz | su | fsh | hkg | bd | fwh | sin ]
- body: body参数
RETURNS:
- *ListInstanceResponse:
- error: the return error if any occurs
func (*Client) UnbindCfw ¶
func (c *Client) UnbindCfw(cfwId string, body *UnbindCfwRequest) error
UnbindCfw - 实例批量解绑CFW。
PARAMS:
- cfwId: CFW的id
- body: body参数
RETURNS:
- error: the return error if any occurs
func (*Client) UpdateCfw ¶
func (c *Client) UpdateCfw(cfwId string, body *UpdateCfwRequest) error
UpdateCfw - 更新CFW策略的基本信息。
PARAMS:
- cfwId: CFW的id
- body: body参数
RETURNS:
- error: the return error if any occurs
func (*Client) UpdateCfwRule ¶
func (c *Client) UpdateCfwRule(cfwId string, cfwRuleId string, body *UpdateCfwRuleRequest) error
UpdateCfwRule - 修改指定CFW规则。 - 五元组(protocol/sourceAddress/destAddress/sourcePort/destPort) + 方向(direction)不能全部相同。
PARAMS:
- cfwId: CFW策略的id
- cfwRuleId: CFW规则的id
- body: body参数
RETURNS:
- error: the return error if any occurs
type CreateCfwRequest ¶
type CreateCfwRequest struct { Name string `json:"name"` Description string `json:"description"` CfwRules []CreateRule `json:"cfwRules"` }
type CreateCfwRequestCfwRules ¶
type CreateCfwRequestCfwRules struct { }
type CreateCfwResponse ¶
type CreateCfwResponse struct {
CfwId string `json:"cfwId"`
}
func CreateCfw ¶
func CreateCfw(cli *Client, body *CreateCfwRequest) (*CreateCfwResponse, error)
CreateCfw - 创建CFW策略。
PARAMS:
- cli: the client agent which can perform sending request
- body:
RETURNS:
- *api.CreateCfwResponse:
- error: the return error if any occurs
type CreateCfwRuleRequest ¶
type CreateCfwRuleRequest struct {
CfwRules []CreateRule `json:"cfwRules"`
}
type CreateCfwRuleRequestCfwRules ¶
type CreateCfwRuleRequestCfwRules struct { }
type CreateRule ¶
type CreateRule struct { IpVersion int32 `json:"ipVersion"` Priority int32 `json:"priority"` Protocol string `json:"protocol"` Direction string `json:"direction"` SourceAddress string `json:"sourceAddress"` DestAddress string `json:"destAddress"` SourcePort string `json:"sourcePort"` DestPort string `json:"destPort"` Action string `json:"action"` Description string `json:"description"` }
type DeleteCfwRuleRequest ¶
type DeleteCfwRuleRequest struct {
CfwRuleIds []string `json:"cfwRuleIds"`
}
type DeleteCfwRuleRequestCfwRuleIds ¶
type DeleteCfwRuleRequestCfwRuleIds struct { }
type DisableCfwRequest ¶
type EnableCfwRequest ¶
type GetCfwResponse ¶
type GetCfwResponseCfwRules ¶
type GetCfwResponseCfwRules struct { }
type Instance ¶
type Instance struct { InstanceId string `json:"instanceId"` InstanceName string `json:"instanceName"` Status string `json:"status"` Region string `json:"region"` CfwId string `json:"cfwId"` CfwName string `json:"cfwName"` VpcId string `json:"vpcId"` VpcName string `json:"vpcName"` PublicIp string `json:"publicIp"` Role string `json:"role"` LocalIfId string `json:"localIfId"` LocalIfName string `json:"localIfName"` PeerRegion string `json:"peerRegion"` PeerVpcId string `json:"peerVpcId"` PeerVpcName string `json:"peerVpcName"` MemberId string `json:"memberId"` MemberName string `json:"memberName"` MemberAccountId string `json:"memberAccountId"` }
type ListCfwArgs ¶
type ListCfwResponse ¶
type ListCfwResponse struct { Marker string `json:"marker"` IsTruncated bool `json:"isTruncated"` NextMarker string `json:"nextMarker"` MaxKeys int32 `json:"maxKeys"` Cfws []Cfw `json:"cfws"` }
func ListCfw ¶
func ListCfw(cli *Client, listCfwArgs *ListCfwArgs) ( *ListCfwResponse, error)
ListCfw - 查询CFW策略列表信息。
PARAMS:
- cli: the client agent which can perform sending request
- listCfwArgs:
RETURNS:
- *api.ListCfwResponse:
- error: the return error if any occurs
type ListCfwResponseCfws ¶
type ListCfwResponseCfws struct { }
type ListInstanceRequest ¶
type ListInstanceRequestCfwRuleIds ¶
type ListInstanceRequestCfwRuleIds struct { }
type ListInstanceResponse ¶
type ListInstanceResponse struct { Marker string `json:"marker"` IsTruncated bool `json:"isTruncated"` NextMarker string `json:"nextMarker"` MaxKeys int `json:"maxKeys"` Instances []Instance `json:"instances"` }
func ListInstance ¶
func ListInstance(cli *Client, listInstanceRequest *ListInstanceRequest) (*ListInstanceResponse, error)
ListInstance - 查询防护边界实例的列表。
PARAMS:
- cli: the client agent which can perform sending request
- listInstanceRequest:
RETURNS:
- *api.ListInstanceResponse:
- error: the return error if any occurs
type ListInstanceResponseInstances ¶
type ListInstanceResponseInstances struct { }
type UnbindCfwRequest ¶
type UnbindCfwRequestInstances ¶
type UnbindCfwRequestInstances struct { }
type UpdateCfwRequest ¶
type UpdateCfwRuleRequest ¶
type UpdateCfwRuleRequest struct { IpVersion int32 `json:"ipVersion"` Priority int32 `json:"priority"` Protocol string `json:"protocol"` Direction string `json:"direction"` SourceAddress string `json:"sourceAddress"` DestAddress string `json:"destAddress"` SourcePort string `json:"sourcePort"` DestPort string `json:"destPort"` Action string `json:"action"` Description string `json:"description"` }