Adding a Security Group to a Security Group List of a Port
Function
This API is used to add a security group to a security group list of a port.
URI
PUT /v3/{project_id}/ports/{port_id}/insert-security-groups
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
port_id |
Yes |
String |
Unique identifier of a port |
project_id |
Yes |
String |
Project ID |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
port |
Yes |
InsertSecurityGroupOption object |
Request body for adding a security group to a security group list of a port |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
security_groups |
Yes |
Array of strings |
Security group IDs, for example, "security_groups": ["a0608cbf-d047-4f54-8b28-cd7b59853fff"] |
index |
No |
Integer |
Position that a security group is added to. The value starts from 0. Example: 1. To add a security group to the first of the associated security group list, set index to 0. 2. To add a security group after the nth security group in the associated security group list, set index to n. By default, a security group is added to the end of the security group list associated with the port. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Request ID |
port |
port object |
Response body for adding a security group to a security group list of a port |
Parameter |
Type |
Description |
---|---|---|
admin_state_up |
Boolean |
|
binding:host_id |
String |
|
binding:profile |
Object |
|
binding:vif_details |
Object |
|
binding:vif_type |
String |
|
binding:vnic_type |
String |
|
created_at |
String |
|
updated_at |
String |
|
description |
String |
|
device_id |
String |
|
device_owner |
String |
|
ecs_flavor |
String |
|
id |
String |
|
instance_id |
String |
|
instance_type |
String |
|
mac_address |
String |
|
name |
String |
|
port_security_enabled |
Boolean |
|
private_ips |
Array of PrivateIpInfo objects |
|
project_id |
String |
|
security_groups |
Array of strings |
|
status |
String |
|
tenant_id |
String |
|
virsubnet_id |
String |
|
vpc_id |
String |
|
vpc_tenant_id |
String |
|
vtep_ip |
String |
|
enable_efi |
Boolean |
|
scope |
String |
|
zone_id |
String |
|
binding:migration_info |
Object |
|
extra_dhcp_opts |
Array of objects |
|
position_type |
String |
|
instance_info |
Object |
|
tags |
Array of strings |
|
allowed_address_pairs |
Array of AllowAddressPair objects |
|
Example Request
Add a security group after the first security group (567be4e3-d171-46ce-9e8a-c15e91cfe86a) to the security group list (["567be4e3-d171-46ce-9e8a-c15e91cfe86a", "4940b983-5992-4663-bed9-d1d1e15d1009"]) associated with the port (99fd0c77-56b4-4bf6-8365-df352e45d5fc). Set index to 1.
PUT https://{Endpoint}/v3/f5dab68cd75740e68c599e9af5fe0aed/ports/99fd0c77-56b4-4bf6-8365-df352e45d5fc/insert-security-groups { "port" : { "security_groups" : [ "8edd3747-ccd4-49a1-82b9-a165eec314b4", "6c2d4540-3b7d-4207-a319-a7231b439995" ], "index" : 1 } }
Example Response
Status code: 200
OK
{ "port" : { "name" : "", "id" : "99fd0c77-56b4-4bf6-8365-df352e45d5fc", "admin_state_up" : true, "status" : "DOWN", "project_id" : "f5dab68cd75740e68c599e9af5fe0aed", "device_id" : "", "mac_address" : "fa:16:3e:1f:17:df", "device_owner" : "", "description" : "", "vpc_id" : null, "zone_id" : "", "scope" : "center", "position_type" : "center", "vtep_ip" : null, "created_at" : "2023-05-10T01:35:02", "updated_at" : "2023-05-10T01:35:02", "port_security_enabled" : true, "tags" : [ ], "security_groups" : [ "567be4e3-d171-46ce-9e8a-c15e91cfe86a", "8edd3747-ccd4-49a1-82b9-a165eec314b4", "6c2d4540-3b7d-4207-a319-a7231b439995", "4940b983-5992-4663-bed9-d1d1e15d1009" ], "allowed_address_pairs" : [ ], "extra_dhcp_opts" : [ ], "instance_info" : null, "instance_id" : "", "instance_type" : "", "ecs_flavor" : "", "enable_efi" : false, "virsubnet_id" : "3847b263-2370-45c0-8236-38a1de568049", "private_ips" : [ { "subnet_cidr_id" : "ffe98087-6d4f-45cd-988b-1c87f75d2d53", "ip_address" : "192.168.158.228" } ], "vpc_tenant_id" : null, "binding:host_id" : "", "binding:vif_type" : "unbound", "binding:vnic_type" : "normal", "binding:vif_details" : { }, "binding:profile" : { }, "binding:migration_info" : { } }, "request_id" : "458691c0-7db2-43d8-9400-053800c5ff53" }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
409 |
Conflict |
500 |
Internal Server Error |
Error Codes
See Error Codes.
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.
For any further questions, feel free to contact us through the chatbot.
Chatbot