management

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssociatedSubnet

type AssociatedSubnet struct {
	// AZ.
	AZ string `json:"az" required:"true"`

	// Subnet CIDR block.
	SubnetSegment string `json:"subnet_segment" required:"true"`

	// Subnet name.
	SubnetName string `json:"subnet_name" required:"true"`
}

AssociatedSubnet represents a subnet associated with a router or firewall.

type ChangeEWProtectionStatusOpts

type ChangeEWProtectionStatusOpts struct {
	// Protected object ID, which is used to distinguish between Internet border protection and VPC border protection
	// after a cloud firewall is created. You can obtain the ID by calling the Get function in this package.
	// In the return value, find the ID in ProtectObjects[n].ObjectID.
	// If the value of type is 0, the protected object ID belongs to the Internet border.
	// If the value of type is 1, the protected object ID belongs to the VPC border.
	ObjectId string `json:"object_id" required:"true"`
	// Protection status: 0 (enable), 1 (disable).
	Status int `json:"status" required:"true"`
}

type ChangeEWProtectionStatusResponse

type ChangeEWProtectionStatusResponse struct {
	// Data returned for modifying east-west protection.
	Data ChangeEWProtectionStatusResponseData `json:"data"`
}

type ChangeEWProtectionStatusResponseData

type ChangeEWProtectionStatusResponseData struct {
	// East-west protected object ID.
	Id string `json:"id"`
}

func ChangeEWProtectionStatus

func ChangeEWProtectionStatus(client *golangsdk.ServiceClient, firewallId string, opts ChangeEWProtectionStatusOpts) (*ChangeEWProtectionStatusResponseData, error)

This function is used to enable or disable east-west protection.

type CreateEWFResponse

type CreateEWFResponse struct {
	// Return value for creating an east-west firewall.
	Data CreateEWFirewallResp `json:"data"`
}

type CreateEWFirewallInspectVpcResp

type CreateEWFirewallInspectVpcResp struct {
	// ID of an inspection VPC.
	VPCID string `json:"vpc_id"`
	// Subnet ID list of the created inspection VPC.
	SubnetIDs []string `json:"subnet_ids"`
}

type CreateEWFirewallOpts

type CreateEWFirewallOpts struct {
	// ID of the associated enterprise router in the outbound direction.
	ERID string `json:"er_id" required:"true"`
	// Inspection VPC ID.
	InspectionVPCID string `json:"inspection_vpc_id,omitempty"`
	// Subnet associated with an enterprise router.
	ERAssociatedSubnet *AssociatedSubnet `json:"er_associated_subnet,omitempty"`
	// List of subnets associated with a firewall.
	FirewallAssociatedSubnets []AssociatedSubnet `json:"firewall_associated_subnets,omitempty"`
}

type CreateEWFirewallResp

type CreateEWFirewallResp struct {
	// East-west protection ID, corresponding to the object_id field.
	ID string `json:"id"`
	// Enterprise router information.
	ER ER `json:"er"`
	// Information about the inspection VPC.
	InspVPC CreateEWFirewallInspectVpcResp `json:"inspection_vpc"`
}

func CreateEWFirewall

func CreateEWFirewall(client *golangsdk.ServiceClient, firewallId string, opts CreateEWFirewallOpts) (*CreateEWFirewallResp, error)

This function is used to create an east-west firewall

type ER

type ER struct {
	// Enterprise router ID, which is referenced when east-west protection is created.
	ERID string `json:"er_id"`
	// Connection ID of an enterprise router.
	ERAttachID string `json:"er_attach_id"`
}

type EWFirewallQueryParams

type EWFirewallQueryParams struct {
	// Enterprise project ID
	EnterpriseProjectId string `q:"enterprise_project_id,omitempty"`
	// Firewall ID
	FwInstanceId string `q:"fw_instance_id" required:"true"`
}

type ErInstance

type ErInstance struct {
	// Enterprise router ID.
	ID string `json:"id"`
	// Enterprise router name.
	Name string `json:"name"`
	// Router status: pending, available, modifying, deleting, or failed.
	State string `json:"state"`
	// Enterprise project ID.
	EnterpriseProjectID string `json:"enterprise_project_id"`
	// Project ID.
	ProjectID string `json:"project_id"`
	// Whether IPv6 is enabled (true/false).
	EnableIPv6 bool `json:"enable_ipv6"`
	// Connection ID of the enterprise router.
	AttachmentID string `json:"attachment_id"`
}

ErInstance represents information about an enterprise router.

type EwProtectResourceInfo

type EwProtectResourceInfo struct {
	// Protected resource type: 0 (VPC), 1 (VGW), 2 (VPN), 3 (peering).
	ProtectedResourceType int `json:"protected_resource_type"`
	// Protected resource name.
	ProtectedResourceName string `json:"protected_resource_name"`
	// Protected resource ID.
	ProtectedResourceID string `json:"protected_resource_id"`
	// Name of the NAT gateway to be protected.
	ProtectedResourceNATName string `json:"protected_resource_nat_name"`
	// ID of the NAT gateway to be protected.
	ProtectedResourceNATID string `json:"protected_resource_nat_id"`
	// Tenant ID of a protected resource.
	ProtectedResourceProjectID string `json:"protected_resource_project_id"`
	// Protected resource mode. The value is "er".
	ProtectedResourceMode string `json:"protected_resource_mode"`
	// Protection status: 0 (associated), 1 (not associated).
	Status int `json:"status"`
}

EwProtectResourceInfo represents east-west protected resource information.

type FirewallInstanceListResponse

type FirewallInstanceListResponse struct {
	// Indicates if EPS user support is available
	UserSupportEps bool `json:"user_support_eps"`
	// Indicates if NDR (Network Detection and Response) is supported
	HasNdr bool `json:"has_ndr"`
	// Indicates if postpaid support is available
	IsSupportPostpaid bool `json:"is_support_postpaid"`
	// Indicates if the basic version is supported
	IsSupportBasicVersion bool `json:"is_support_basic_version"`
	// Indicates if buying a professional version is supported
	IsSupportBuyProfessional bool `json:"is_support_buy_professional"`
	// Contains the data returned for the firewall instance list
	Data HttpFirewallInstanceListResponseData `json:"data"`
}

FirewallInstanceListResponse represents the main structure containing support options and data returned for querying the firewall list.

type FirewallInstanceResource

type FirewallInstanceResource struct {
	// Resource ID. It can be the firewall ID, bandwidth ID, EIP ID, VPC ID, or the ID returned after CBC callback.
	ResourceID string `json:"resource_id"`
	// Service type, which is used by CBC. The value is otc.service.type.cfw.
	CloudServiceType string `json:"cloud_service_type"`
	// Resource type. Enumeration values:
	// - otc.resource.type.cfw (cloud firewall)
	// - otc.resource.type.cfw.exp.eip (EIP)
	// - otc.resource.type.cfw.exp.bandwidth (bandwidth)
	// - otc.resource.type.cfw.exp (VPC)
	ResourceType string `json:"resource_type"`
	// Inventory unit code:
	// - cfw.standard (firewall standard edition)
	// - cfw.professional (firewall professional edition)
	// - cfw.expack.eip.standard (EIP standard edition)
	// - cfw.expack.eip.professional (EIP professional edition)
	// - cfw.expack.bandwidth.standard (bandwidth basic edition)
	// - cfw.expack.bandwidth.professional (bandwidth professional edition)
	// - cfw.expack.vpc.professional (VPC professional edition)
	ResourceSpecCode string `json:"resource_spec_code"`
	// Resource quantity.
	ResourceSize int `json:"resource_size"`
	// Resource unit.
	ResourceSizeMeasureID int `json:"resource_size_measure_id"`
}

Resource represents a cloud resource with its ID, type, and specifications.

type FirewallInstanceVO

type FirewallInstanceVO struct {
	// Firewall instance ID, which is automatically generated by the system after a CFW instance is created.
	FwInstanceId string `json:"fw_instance_id"`
	// Resource ID, which is the same as the firewall instance ID.
	ResourceId string `json:"resource_id"`
	// Firewall creation timestamp.
	Name string `json:"name"`
	// Firewall name.
	FwInstanceName string `json:"fw_instance_name"`
	// Enterprise project ID, which is generated after the enterprise project is supported for a user.
	EnterpriseProjectId string `json:"enterprise_project_id"`
	// Cluster type: 0 (active/standby), 1 (cluster).
	// In active/standby mode, there are four nodes. Two active nodes form a cluster, and the other two are the standby of the active nodes.
	// In cluster mode, only two nodes are started to form a cluster.
	HaType int `json:"ha_type"`
	// Billing mode: 0 (yearly/monthly), 1 (pay-per-use).
	ChargeMode int `json:"charge_mode"`
	// Firewall protection type. Currently, its value can only be 0 (Internet protection).
	ServiceType int `json:"service_type"`
	// Engine type: 0 (self-developed engine), 1 (Hillstone engine), or 3 (TOPSEC engine).
	EngineType int `json:"engine_type"`
	// Firewall specifications.
	Flavor Flavor `json:"flavor"`
	// Firewall status: -1 (waiting for payment), 0 (creating), 1 (deleting), 2 (running), 3 (upgrading), 4 (deleted), 5 (frozen),
	// 6 (creation failed), 7 (deletion failed), 8 (freezing failed), 9 (being stored), 10 (storage failed), or 11 (upgrade failed).
	Status int `json:"status"`
	// Tag list, which is a JSON string converted from the tag key value map, for example, "{"key":"value"}".
	Tags string `json:"tags"`
}

FirewallInstanceVO represents the structure of an individual firewall instance.

func List

func List(client *golangsdk.ServiceClient, opts ListOpts) ([]FirewallInstanceVO, error)

This function function is used to retrieve list of firewalls.

type Flavor

type Flavor struct {
	// Firewall version. Its value can only be 1 (professional edition).
	Version int `json:"version"`
	// Number of EIPs.
	EipCount int `json:"eip_count"`
	// Number of VPCs.
	VpcCount int `json:"vpc_count"`
	// Bandwidth, in Mbit/s.
	Bandwidth int `json:"bandwidth"`
	// Log storage, in bytes.
	LogStorage int `json:"log_storage"`
	// Default firewall bandwidth, in Mbit/s.
	// The value is 10 for the standard edition, 50 for the professional edition,
	// and 200 for the pay-per-use professional edition.
	DefaultBandwidth int `json:"default_bandwidth"`
	// Default number of EIPs.
	// The value is 20 for the standard edition, 50 for the professional edition,
	// and 1,000 for the pay-per-use professional edition.
	DefaultEipCount int `json:"default_eip_count"`
	// Default log storage, in bytes. The default value is 0.
	DefaultLogStorage int `json:"default_log_storage"`
	// Default number of VPCs.
	// The value is 0 for the standard edition, 2 for the professional edition,
	// and 5 for the pay-per-use professional edition.
	DefaultVpcCount int `json:"default_vpc_count"`
}

type GetEWFirewallQueryParameters

type GetEWFirewallQueryParameters struct {
	// Offset, which specifies the start position of the record to be returned. The value must be a number no less than 0. The default value is 0.
	Offset string `q:"offset" required:"true"`
	// Number of records displayed on each page. The value ranges from 1 to 1024.
	Limit int `q:"limit" required:"true"`
	// Enterprise project ID
	EnterpriseProjectID string `q:"enterprise_project_id,omitempty"`
	// Firewall instance ID. This field is required.
	FwInstanceID string `q:"fw_instance_id" required:"true"`
}

GetQueryParameters represents the query parameters for the firewall instance list.

type GetEWFirewallResponse

type GetEWFirewallResponse struct {
	// Returned data for obtaining the east-west firewall list.
	Data GetEastWestFirewallResponseBody `json:"data"`
}

type GetEastWestFirewallResponseBody

type GetEastWestFirewallResponseBody struct {
	// Protected object ID.
	ObjectID string `json:"object_id"`
	// Project ID.
	ProjectID string `json:"project_id"`
	// Protection status: 0 (enabled), 1 (disabled).
	Status int `json:"status"`
	// Information about the subnet associated with a cloud firewall.
	FirewallAssociatedSubnets []SubnetInfo `json:"firewall_associated_subnets"`
	// Information about the associated enterprise router in the outbound direction.
	ER ErInstance `json:"er"`
	// Information about the inspection VPC.
	InspectionVPC VpcDetail `json:"inspection_vpc"`
	// East-west protected resource information.
	ProtectInfos []EwProtectResourceInfo `json:"protect_infos"`
	// Total number of protected VPCs.
	Total int `json:"total"`
	// Offset specifying the start position of the record to be returned.
	Offset int `json:"offset"`
	// Number of records displayed on each page (range: 1–1024).
	Limit int `json:"limit"`
	// Protection mode. The value is "er".
	Mode string `json:"mode"`
}

func GetEWFirewall

func GetEWFirewall(client *golangsdk.ServiceClient, firewallId string) (*GetEastWestFirewallResponseBody, error)

This function is used to obtain east-west firewall information.

type GetFirewallInstanceData

type GetFirewallInstanceData struct {
	// The maximum number of records to return.
	Limit int `json:"limit"`
	// The offset of the first record to return.
	Offset int `json:"offset"`
	// The total number of firewall instances.
	Total int `json:"total"`
	// The list of firewall instance records.
	Records []GetFirewallInstanceResponseRecord `json:"records"`
}

GetFirewallInstanceData represents the data for the firewall instance response.

type GetFirewallInstanceResponseRecord

type GetFirewallInstanceResponseRecord struct {
	// The unique identifier of the firewall instance
	FwInstanceID string `json:"fw_instance_id"`
	// The name of the firewall instance
	// Note for developers: This is not the same name provided earlier.
	// This field is autogenerated.
	Name string `json:"name"`
	// Cluster type: 0 (active/standby), 1 (cluster). In active/standby mode, there are four nodes.
	// Two active nodes form a cluster, and the other two are the standby of the active nodes.
	// In cluster mode, only two nodes are started to form a cluster.
	HAType int `json:"ha_type"`
	// Billing mode: 0 (yearly/monthly), 1 (pay-per-use).
	ChargeMode int `json:"charge_mode"`
	// Firewall protection type. Currently, its value can only be 0 (Internet protection).
	ServiceType int `json:"service_type"`
	// Engine type. Its value can only be 1 (Hillstone engine).
	EngineType int `json:"engine_type"`
	// Firewall specifications.
	Flavor Flavor `json:"flavor"`
	// Protected object list.
	ProtectObjects []ProtectObjectVO `json:"protect_objects"`
	// Firewall status: -1 (waiting for payment), 0 (creating),
	// 1 (deleting), 2 (running), 3 (upgrading), 4 (deleted),
	// 5 (frozen), 6 (creation failed), 7 (deletion failed),
	// 8 (freezing failed), or 9 (being stored), 10 (storage failed),
	// or 11 (upgrade failed).
	Status int `json:"status"`
	// Whether an engine old: true (yes), false (no).
	IsOldFirewallInstance bool `json:"is_old_firewall_instance"`
	// Whether OBS is supported: true (yes), false (no).
	IsAvailableObs bool `json:"is_available_obs"`
	// Whether threat intelligence tags are supported: true (yes), false (no).
	IsSupportThreatTags bool `json:"is_support_threat_tags"`
	// Whether IPv6 is supported: true (yes), false (no).
	SupportIpv6 bool `json:"support_ipv6"`
	// Whether a feature is enabled: true (yes), false (no).
	FeatureToggle map[string]bool `json:"feature_toggle"`
	// Firewall resource list.
	Resources []FirewallInstanceResource `json:"resources"`
	// Firewall name.
	// Note for developers: This is the same name that was used at time of creation
	FwInstanceName string `json:"fw_instance_name"`
	// The enterprise project ID of the firewall instance
	EnterpriseProjectID string `json:"enterprise_project_id"`
	// The resource ID of the firewall instance
	ResourceID string `json:"resource_id"`
	// Whether website filtering is supported: true (yes), false (no).
	SupportUrlFiltering bool `json:"support_url_filtering"`
	// The list of tags associated with the firewall instance
	Tags string `json:"tags"`
}

GetFirewallInstanceResponseRecord represents the structure of an individual firewall instance record.

func Get

func Get(client *golangsdk.ServiceClient, instanceID string, serviceType int) (*GetFirewallInstanceResponseRecord, error)

This function is used to query details about a Firewall instance.

type GetProtectedVPCsParameters

type GetProtectedVPCsParameters struct {
	// Protected object ID, which is used to distinguish between Internet border protection and VPC border protection
	// after a cloud firewall is created. You can obtain the ID by calling the Get function in this package.
	// In the return value, find the ID in ProtectObjects[n].ObjectID.
	// If the value of type is 0, the protected object ID belongs to the Internet border.
	// If the value of type is 1, the protected object ID belongs to the VPC border.
	ObjectID string `q:"object_id" required:"true"`
	// Enterprise project ID
	EnterpriseProjectID string `q:"enterprise_project_id,omitempty"`
	// Firewall instance ID. This field is required.
	FwInstanceID string `q:"fw_instance_id,omitempty"`
}

GetProtectedVPCsParameters represents the query parameters for the protected VPCs list.

type GetProtectedVPCsResponse

type GetProtectedVPCsResponse struct {
	// Return value for querying protected VPCs.
	Data VPCProtectsVo `json:"data"`
}

type GetQueryParameters

type GetQueryParameters struct {
	// Offset, which specifies the start position of the record to be returned. The value must be a number no less than 0. The default value is 0.
	Offset string `q:"offset" required:"true"`
	// Number of records displayed on each page. The value ranges from 1 to 1024.
	Limit int `q:"limit" required:"true"`
	// Service type. Currently, only 0 (Internet protection) is supported.
	ServiceType *int `q:"service_type" required:"true"`
	// Enterprise project ID
	EnterpriseProjectID string `q:"enterprise_project_id,omitempty"`
	// Firewall instance ID.
	FwInstanceID string `q:"fw_instance_id,omitempty"`
	// Firewall name.
	Name string `q:"name,omitempty"`
}

GetQueryParameters represents the query parameters for the firewall instance list.

type GetResponse

type GetResponse struct {
	// Contains the data for the firewall instance response.
	Data GetFirewallInstanceData `json:"data"`
}

type HttpFirewallInstanceListResponseData

type HttpFirewallInstanceListResponseData struct {
	// The maximum number of records to return
	Limit int `json:"limit"`
	// The offset of the first record to return
	Offset int `json:"offset"`
	// The project ID associated with the firewall instances
	ProjectID string `json:"project_id"`
	// The total number of firewall instances
	Total int `json:"total"`
	// The list of firewall instance records
	Records []FirewallInstanceVO `json:"records"`
}

HttpFirewallInstanceListResponseData represents the detailed response data for firewall instances, including pagination, project ID, total number of firewalls, and the firewall list records.

type ListOpts

type ListOpts struct {
	// Enterprise project ID, which is the ID of a project planned based on organizations.
	// If the enterprise project function is not enabled, the value is 0.
	EnterpriseProjectID string `json:"enterprise_project_id,omitempty"`

	// Query keyword, which can be a firewall ID or part of a firewall name.
	KeyWord string `json:"key_word,omitempty"`

	// Tag list, which can be obtained by calling the API for querying tags.
	Tags []ListTags `json:"tags,omitempty"`

	// Number of records displayed on each page. The value ranges from 1 to 1024.
	Limit int `json:"limit" required:"true"`

	// Offset, which specifies the start position of the record to be returned.
	// The value must be a number no less than 0. The default value is 0.
	Offset int `json:"offset"`
}

type ListTags

type ListTags struct {
	// Resource tag key.
	Key string `json:"key,omitempty"`

	// Resource tag value.
	Values []string `json:"values,omitempty"`
}

type ProtectObjectVO

type ProtectObjectVO struct {
	// Protected object ID. It is used to distinguish Internet border protection from VPC border protection after a CFW instance is created.
	ObjectID string `json:"object_id"`
	// Protected object name.
	ObjectName string `json:"object_name"`
	// Project type: 0 (north-south), 1 (east-west).
	Type int `json:"type"`
}

type SubnetInfo

type SubnetInfo struct {
	// ID of the AZ where a subnet is located.
	AvailabilityZone string `json:"availability_zone"`
	// Available IP address ranges for subnets in a VPC.
	CIDR string `json:"cidr"`
	// Subnet name.
	Name string `json:"name"`
	// Subnet ID.
	ID string `json:"id"`
	// Subnet gateway IP.
	GatewayIP string `json:"gateway_ip"`
	// UUID generated when a VPC is created.
	VPCID string `json:"vpc_id"`
	// Whether IPv6 is supported (true/false).
	IPv6Enable bool `json:"ipv6_enable"`
}

SubnetInfo represents information about a subnet associated with a cloud firewall.

type VPCProtectsVo

type VPCProtectsVo struct {
	// Total number of protected VPCs.
	Total int `json:"total"`
	// The firewall can protect VPCs across accounts.
	// self_total indicates the total number of protected VPCs in the current project.
	SelfTotal int `json:"self_total"`
	// The east-west firewall protection can protect VPCs across accounts.
	// other_total indicates the number of protected VPCs in other projects.
	OtherTotal int `json:"other_total"`
	// The east-west firewall protection can protect VPCs across accounts.
	// protect_vpcs indicates the list of all protected VPCs.
	ProtectVPCs []VpcAttachmentDetail `json:"protect_vpcs"`
	// The east-west firewall protection can protect VPCs across accounts.
	// self_protect_vpcs indicates the list of protected VPCs in the current project.
	SelfProtectVPCs []VpcAttachmentDetail `json:"self_protect_vpcs"`
	// The east-west firewall protection can protect VPCs across accounts.
	// other_protect_vpcs indicates the list of protected VPCs of other projects.
	OtherProtectVPCs []VpcAttachmentDetail `json:"other_protect_vpcs"`
	// Total number of VPC assets of a tenant.
	TotalAssets int `json:"total_assets"`
}

func GetProtectedVPCs

func GetProtectedVPCs(client *golangsdk.ServiceClient, objectId string) (*VPCProtectsVo, error)

This function is used to query information about protected VPCs.

type VpcAttachmentDetail

type VpcAttachmentDetail struct {
	// ID of a protected VPC added for east-west protection.
	VPCID string `json:"vpc_id"`
}

type VpcDetail

type VpcDetail struct {
	// Random UUID generated when an inspection VPC is created.
	ID string `json:"id"`
	// Inspection VPC name.
	Name string `json:"name"`
	// Available subnet ranges in a VPC.
	CIDR string `json:"cidr"`
}

VpcDetail represents information about an inspection VPC.

Jump to

Keyboard shortcuts

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