Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Querying Security Group Rules

Function

This API is used to query security group rules using search criteria and to display the security group rules in a list.

URI

GET /v1/{project_id}/security-group-rules

Example:
GET https://{Endpoint}/v1/{project_id}/security-group-rules?security_group_id=a7734e61-b545-452da3cd-0189cbd9747a&limit=10&marker=4779ab1c-7c1a-44b1-a02e-93dfc361b32d
Table 1 describes the parameters.
Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

marker

No

String

Specifies a resource ID for pagination query, indicating that the query starts from the next record of the specified resource ID.

This parameter can work together with the parameter limit.

  • If parameters marker and limit are not passed, resource records on the first page will be returned.
  • If the parameter marker is not passed and the value of parameter limit is set to 10, the first 10 resource records will be returned.
  • If the value of the parameter marker is set to the resource ID of the 10th record and the value of parameter limit is set to 10, the 11th to 20th resource records will be returned.
  • If the value of the parameter marker is set to the resource ID of the 10th record and the parameter limit is not passed, 11th to 2,000th resource records will be returned. The default value of limit is 2000.

limit

No

Integer

Specifies the number of records that will be returned on each page. The value is from 0 to intmax (2^31-1). The default value is 2000.

limit can be used together with marker. For details, see the parameter description of marker.

security_group_id

No

String

Specifies the security group ID.

remote_ip_prefix

No

String

Specifies the remote IP address.

The value must be in CIDR format.

Request Parameters

None

Example Request

GET https://{Endpoint}/v1/{project_id}/security-group-rules

Response Parameters

Parameter

Type

Description

security_group_rules

Array of security_group_rule objects

Specifies the security group rule objects. For details, see Table 2.

Table 2 security_group_rule objects

Parameter

Type

Description

id

String

Specifies the security group rule ID, which uniquely identifies the security group rule.

description

String

  • Provides supplementary information about the security group rule.
  • The value can contain no more than 255 characters, including letters and digits.

security_group_id

String

Specifies the security group rule ID, which uniquely identifies the security group rule.

direction

String

  • Specifies the direction of access control.
  • Possible values are as follows:
    • egress
    • ingress

ethertype

String

  • Specifies the IP protocol version.
  • The value can be IPv4 or IPv6.

protocol

String

  • Specifies the protocol type.
  • The value can be icmp, tcp, udp, icmpv6, or an IP protocol number (0 to 255, for example, 47 for GRE)
  • If the parameter is left blank, all protocols are supported.

port_range_min

Integer

  • Specifies the start port number.
  • The value ranges from 1 to 65535.
  • The value cannot be greater than the port_range_max value. An empty value indicates all ports. If the protocol is icmp, the value range is shown in ICMP-Port Range Relationship Table.

port_range_max

Integer

  • Specifies the end port number.
  • The value ranges from 1 to 65535.
  • If the protocol is not icmp, the value cannot be smaller than the port_range_min value. An empty value indicates all ports. If the protocol is icmp, the value range is shown in ICMP-Port Range Relationship Table.

remote_ip_prefix

String

  • Specifies the remote IP address. If the access control direction is set to egress, the parameter specifies the source IP address. If the access control direction is set to ingress, the parameter specifies the destination IP address.
  • The value can be in the CIDR format or IP addresses.
  • The parameter value is mutually exclusive with parameters remote_group_id and remote_address_group_id.

remote_group_id

String

  • Specifies the ID of the peer security group.
  • The parameter value is mutually exclusive with parameters remote_ip_prefix and remote_address_group_id.

remote_address_group_id

String

  • Specifies the remote IP address group ID.
  • The parameter value is mutually exclusive with parameters remote_ip_prefix and remote_group_id.

tenant_id

String

  • Specifies the ID of the project to which the security group rule belongs.

Example Response

{
    "security_group_rules": [
        {
            "direction": "egress", 
            "ethertype": "IPv6", 
            "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff", 
            "description": "",
            "port_range_max": null, 
            "port_range_min": null, 
            "protocol": null, 
            "remote_group_id": null, 
            "remote_ip_prefix": null, 
            "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", 
            "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "remote_address_group_id": null
        }, 
        {
            "direction": "egress", 
            "ethertype": "IPv4", 
            "id": "93aa42e5-80db-4581-9391-3a608bd0e448",
            "description": "", 
            "port_range_max": null, 
            "port_range_min": null, 
            "protocol": null, 
            "remote_group_id": null, 
            "remote_ip_prefix": null, 
            "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", 
            "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "remote_address_group_id": null
        }, 
        {
            "direction": "ingress", 
            "ethertype": "IPv6", 
            "id": "c0b09f00-1d49-4e64-a0a7-8a186d928138", 
            "description": "",
            "port_range_max": null, 
            "port_range_min": null, 
            "protocol": null, 
            "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", 
            "remote_ip_prefix": null, 
            "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", 
            "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "remote_address_group_id": null
        }, 
        {
            "direction": "ingress", 
            "ethertype": "IPv4", 
            "id": "f7d45c89-008e-4bab-88ad-d6811724c51c", 
            "description": "",
            "port_range_max": null, 
            "port_range_min": null, 
            "protocol": null, 
            "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", 
            "remote_ip_prefix": null, 
            "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", 
            "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
            "remote_address_group_id": null
        }
    ]
}

Status Code

See Status Codes.

Error Code

See Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback