Cloud Firewall
Cloud Firewall
- What's New
- Function Overview
- Service Overview
- Billing
- Getting Started
-
User Guide
- Creating a User Group and Granting Permissions
- Checking the Dashboard
- Purchasing and Changing the Specifications of CFW
- Enabling Internet Border Traffic Protection
- Enabling VPC Border Traffic Protection
- Enabling NAT Gateway Traffic Protection
-
Configuring Access Control Policies to Control Traffic
- Access Control Policy Overview
- Configuring Protection Rules to Block or Allow Traffic
- Adding Blacklist or Whitelist Items to Block or Allow Traffic
- Viewing Protection Information Using the Policy Assistant
- Managing Access Control Policies
- Managing IP Address Groups
- Domain Name Management
- Service Group Management
- Attack Defense
- Viewing Traffic Statistics
- Viewing CFW Protection Logs
- System Management
- Permissions Management
- Using Cloud Eye to Monitor CFW
- CTS Auditing
-
Best Practices
- CFW Best Practice Summary
- Purchasing and Querying CFW via API
- Migrating Security Policies to CFW in Batches
- Configuration Suggestions for Using CFW with WAF, Advanced Anti-DDoS, and CDN
- Allowing Internet Traffic Only to a Specified Port
- Allowing Outbound Traffic from Cloud Resources Only to a Specified Domain Name
- Using CFW to Defend Against Network Attacks
- Configuring a Protection Rule to Protect Traffic Between Two VPCs
- Configuring a Protection Rule to Protect SNAT Traffic
- Using CFW to Protect Enterprise Resources
- Using CFW to Protect EIPs Across Accounts
- Using CFW to Protect VPCs Across Accounts
-
API Reference
- Before You Start
- API Overview
- API Calling
-
API
-
Firewall Management
- Creating a Firewall
- Obtaining the Status of a CFW Task
- Deleting a Firewall
- Querying the Firewall List
- Changing the East-West Firewall Protection Status
- Querying Firewall Details
- Obtaining East-West Firewall Information
- Creating an East-West Firewall
- Querying the Number of Protected VPCs
- Creating a Tag
- Deleting a Tag
- EIP Management
-
ACL Rule Management
- Creating an ACL Rule
- Deleting an ACL Rule
- Deleting ACL Rules in Batches
- Deleting the Number of Rule Hits
- Updating an ACL Rule
- Updating Rule Actions in Batches
- Setting the Priority of an ACL Protection Rule
- Querying a Protection Rule
- Querying Rule Tags
- Obtaining the Number of Rule Hits
- Viewing the Region List
- Checking the ACL Import Status
- Blacklist/Whitelist Management
- Address Group Management
- Service Group Management
-
Domain Name Resolution and Domain Name Group Management
- Adding a Domain Name Group
- Deleting a Domain Name Group
- Updating a Domain Name Group
- Updating the DNS Server List
- Querying the Domain Name Group List
- Querying the DNS Server List
- Querying an IP Address for Domain Name Resolution
- Obtain the list of domain names in a domain name group
- Adding a Domain Name List
- Deleting a Domain Name List
- Viewing Domain Group Details
- Obtaining the DNS Resolution Result of a Domain Name
- Deleting Domain Groups in Batches
- IPS management
- Log Management
- Packet Capture Management
- Antivirus Management
- Alarm Configuration Management
- Tag Management
- IPS Management
-
Firewall Management
- Appendix
- SDK Reference
-
FAQs
-
About the Product
- Does CFW Support Off-Cloud Servers?
- What Are the QPS, New Connections, and Concurrent Connections Supported by CFW?
- Can CFW Be Shared Across Accounts?
- What Are the Differences Between CFW and WAF?
- What Are the Differences Between CFW, Security Groups, and Network ACLs?
- How Does CFW Control Access?
- What Are the Priorities of the Protection Settings in CFW?
- Can WAF, Advanced Anti-DDoS, and CFW Be Deployed Together?
- Can CFW Protect Resources Across Enterprise Projects?
- How Long Are CFW Logs Stored by Default?
- Regions and AZs
-
Troubleshooting
- What Do I Do If Service Traffic is Abnormal?
- Why Are Traffic and Attack Logs Incomplete?
- Why Does a Protection Rule Not Take Effect?
- What Do I Do If IPS Blocks Normal Services?
- Why Is No Data Displayed on the Access Control Logs Page?
- Why Is the IP Address Translated Using NAT64 Blocked?
- Why Some Permissions Become Invalid After a System Policy Is Granted to an Enterprise Project?
- What Do I Do If a Message Indicating Insufficient Permissions Is Displayed When I Configure LTS Logs?
-
Network Traffic
- How Do I Calculate the Number of Protected VPCs and the Peak Protection Traffic at the VPC Border?
- How Does CFW Collect Traffic Statistics?
- What Is the Protection Bandwidth Provided by CFW?
- What Do I Do If My Service Traffic Exceeds the Protection Bandwidth?
- What Are the Differences Between the Data Displayed in Traffic Trend Module and the Traffic Analysis Page?
- How Do I Verify the Validity of an Outbound HTTP/HTTPS Domain Protection Rule?
- How Do I Obtain the Real IP Address of an Attacker?
- What Do I Do If a High Traffic Warning Is Received?
-
About the Product
- Videos
-
More Documents
-
User Guide (Ankara Region)
- Product Overview
- Checking the Dashboard
- Creating Cloud Firewall
- Enabling Internet Border Traffic Protection
- Enabling VPC Border Traffic Protection
-
Configuring Access Control Policies to Control Traffic
- Access Control Policy Overview
- Configuring Protection Rules to Block or Allow Traffic
- Adding Blacklist or Whitelist Items to Block or Allow Traffic
- Viewing Protection Information Using the Policy Assistant
- Managing Access Control Policies
- Managing IP Address Groups
- Domain Name Management
- Service Group Management
- Attack Defense
- Viewing Traffic Statistics
- Viewing CFW Protection Logs
- System Management
-
FAQs
-
About the Product
- Does CFW Support Off-Cloud Servers?
- What Are the QPS, New Connections, and Concurrent Connections Supported by CFW?
- Can CFW Be Shared Across Accounts?
- What Are the Differences Between CFW and WAF?
- What Are the Differences Between CFW, Security Groups, and Network ACLs?
- How Does CFW Control Access?
- What Are the Priorities of the Protection Settings in CFW?
- Can WAF and CFW Be Deployed Together?
- Troubleshooting
- Network Traffic
-
About the Product
- Change History
- API Reference (Ankara Region)
-
User Guide (Ankara Region)
- General Reference
On this page
Copied.
Purchasing and Querying CFW via API
Application Scenarios
For professionals, using APIs is more efficient than using the console. CFW provides APIs for diverse functions. For details, see APIs.
You can use APIs to quickly purchase and query standard edition firewall instances.
Prerequisites
The current account has the BSS Administrator and CFW FullAccess permissions.
Purchasing and Querying a Standard Edition Firewall
- Log in to the management console.
- Choose Tools > API Explorer in the upper right corner.
- In the navigation pane on the left, click All Products and choose Security & Compliance > Cloud Firewall.
- Buy a standard firewall. Select the Create Firewall API, set the key parameters as follows, and set other parameters as required.
- Region: Select the region where the cloud asset is located.
- project_id: project ID, which is automatically obtained.
- flavor: Enter flavor information.
- version: firewall edition. In this example, select Standard. For details about the differences between editions, see Editions.
- charge_info: Enter the billing mode.
- charge_mode: Enter the billing mode information. In this example, the billing mode is yearly/monthly. Set this parameter to prePaid.
- is_auto_renew: Whether to automatically renew the subscription. In this example, the subscription period is one month. Select false.
- is_auto_pay: Whether automatic payment is enabled. In this example, select true.
- Query a purchased firewall. Select ListFirewallList API, set the key parameters as follows, and set other parameters as required.
- Region: Select the region where the firewall is located.
- project_id: project ID, which is automatically obtained.
- key_word: Enter a keyword, for example, a firewall name.
- limit: Set the number of records displayed on each page. In this example, set it to 1.
- offset: Set the start position of the returned record. Set it to 0.
Code Example
Prepare basic authentication information.
- ak: Access key of the Huawei account. For details, see How Do I Obtain an Access Key (AK/SK)?
- sk: Secret access key of the Huawei account. For details, see How Do I Obtain an Access Key (AK/SK)?
- Region: region ID, for example, cn-east-3. For details about how to obtain the value, see Regions and Endpoints.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
import com.huaweicloud.sdk.cfw.v1.CfwClient; import com.huaweicloud.sdk.cfw.v1.model.*; import com.huaweicloud.sdk.cfw.v1.region.CfwRegion; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import java.util.ArrayList; import java.util.List; public class CreateFirewallSolution { public static void main(String[] args) { String ak = "xxxx"; String sk = "xxxx"; BasicCredentials auth = new BasicCredentials().withAk(ak).withSk(sk); CfwClient client = CfwClient.newBuilder() .withCredential(auth) .withRegion(CfwRegion.valueOf("xxxx")) .build(); //Request body for creating a firewall. CreateFirewallRequest request = new CreateFirewallRequest(); CreateFirewallReq body = new CreateFirewallReq(); body.setName("cfwtest"); body.setEnterpriseProjectId("0"); CreateFirewallReqTags createFirewallReqTags = new CreateFirewallReqTags(); createFirewallReqTags.setKey("TagKey"); createFirewallReqTags.setValue("TagValue"); List<CreateFirewallReqTags> createFirewallReqTagsList = new ArrayList<>(); createFirewallReqTagsList.add(createFirewallReqTags); body.setTags(createFirewallReqTagsList); CreateFirewallReqFlavor flavor = new CreateFirewallReqFlavor(); flavor.setVersion(CreateFirewallReqFlavor.VersionEnum.STANDARD); body.setFlavor(flavor); CreateFirewallReqChargeInfo createFirewallReqChargeInfo = new CreateFirewallReqChargeInfo(); createFirewallReqChargeInfo.setChargeMode("prePaid"); createFirewallReqChargeInfo.setPeriodType("month"); createFirewallReqChargeInfo.setPeriodNum(1); createFirewallReqChargeInfo.setIsAutoPay(true); createFirewallReqChargeInfo.setIsAutoRenew(true); body.setChargeInfo(createFirewallReqChargeInfo); request.setBody(body); //Request body for querying a firewall. ListFirewallListRequest listFirewallListRequest = new ListFirewallListRequest(); QueryFireWallInstanceDto queryFireWallInstanceDto = new QueryFireWallInstanceDto(); queryFireWallInstanceDto.setOffset(0); queryFireWallInstanceDto.setLimit(1); queryFireWallInstanceDto.setKeyWord("cfwtest"); listFirewallListRequest.setBody(queryFireWallInstanceDto); try { //Create a firewall. CreateFirewallResponse createFirewallResponse = client.createFirewall(request); System.out.println(createFirewallResponse.toString()); ////Query the firewall list. ListFirewallListResponse listFirewallListResponse = client.listFirewallList(listFirewallListRequest); System.out.println(listFirewallListResponse.toString()); } catch (ConnectionException e) { System.out.println(e.getMessage()); } catch (RequestTimeoutException e) { System.out.println(e.getMessage()); } catch (ServiceResponseException e) { System.out.println(e.getHttpStatusCode()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot