Virtual Private Cloud API, REST: SecurityGroup.Update
Updates the specified security group.
Method starts an asynchronous operation that can be cancelled while it is in progress.
HTTP request
PATCH https://vpc.api.yandexcloud.kz/vpc/v1/securityGroups/{securityGroupId}
Path parameters
Field |
Description |
securityGroupId |
string Required field. ID of the security group to update. To get the security group ID make a SecurityGroupService.List request. |
Body parameters
{
"updateMask": "object",
"name": "string",
"description": "string",
"labels": "object",
"ruleSpecs": [
{
"description": "string",
"labels": "object",
"direction": "string",
"ports": {
"fromPort": "string",
"toPort": "string"
},
// Includes only one of the fields `protocolName`, `protocolNumber`
"protocolName": "string",
"protocolNumber": "string",
// end of the list of possible fields
// Includes only one of the fields `cidrBlocks`, `securityGroupId`, `predefinedTarget`
"cidrBlocks": {
"v4CidrBlocks": [
"string"
],
"v6CidrBlocks": [
"string"
]
},
"securityGroupId": "string",
"predefinedTarget": "string"
// end of the list of possible fields
}
]
}
Field |
Description |
updateMask |
object (field-mask) A comma-separated names off ALL fields to be updated. If |
name |
string New name for the security group. |
description |
string New description of the security group. |
labels |
object (map<string, string>) Security group labels as Existing set of labels is completely replaced by the provided set, so if you just want
|
ruleSpecs[] |
Updated rule list. All existing rules will be replaced with given list. |
SecurityGroupRuleSpec
Field |
Description |
description |
string Description of the security rule. |
labels |
object (map<string, string>) Rule labels as |
direction |
enum (Direction) Required field. The direction of network traffic allowed by this rule.
|
ports |
The range of ports that allow traffic to pass through. Null value means any port. |
protocolName |
string Protocol name. Includes only one of the fields Values from IANA protocol numbers |
protocolNumber |
string (int64) Protocol number from IANA protocol numbers Includes only one of the fields Values from IANA protocol numbers |
cidrBlocks |
CIDR blocks to allow to recieve or send traffic. Includes only one of the fields |
securityGroupId |
string ID of the security group to add rule to. Includes only one of the fields |
predefinedTarget |
string Predefined target. See security groups rules for more information. Includes only one of the fields |
PortRange
Field |
Description |
fromPort |
string (int64) The lowest port in the range. |
toPort |
string (int64) The highest port in the range. |
CidrBlocks
Field |
Description |
v4CidrBlocks[] |
string IPv4 CIDR blocks to allow traffic to. |
v6CidrBlocks[] |
string IPv6 CIDR blocks to allow traffic to. |
Response
HTTP Code: 200 - OK
{
"id": "string",
"description": "string",
"createdAt": "string",
"createdBy": "string",
"modifiedAt": "string",
"done": "boolean",
"metadata": {
"securityGroupId": "string",
"addedRuleIds": [
"string"
]
},
// Includes only one of the fields `error`, `response`
"error": {
"code": "integer",
"message": "string",
"details": [
"object"
]
},
"response": {
"id": "string",
"folderId": "string",
"createdAt": "string",
"name": "string",
"description": "string",
"labels": "object",
"networkId": "string",
"status": "string",
"rules": [
{
"id": "string",
"description": "string",
"labels": "object",
"direction": "string",
"ports": {
"fromPort": "string",
"toPort": "string"
},
"protocolName": "string",
"protocolNumber": "string",
// Includes only one of the fields `cidrBlocks`, `securityGroupId`, `predefinedTarget`
"cidrBlocks": {
"v4CidrBlocks": [
"string"
],
"v6CidrBlocks": [
"string"
]
},
"securityGroupId": "string",
"predefinedTarget": "string"
// end of the list of possible fields
}
],
"defaultForNetwork": "boolean"
}
// end of the list of possible fields
}
An Operation resource. For more information, see Operation.
Field |
Description |
id |
string ID of the operation. |
description |
string Description of the operation. 0-256 characters long. |
createdAt |
string (date-time) Creation timestamp. String in RFC3339 To work with values in this field, use the APIs described in the |
createdBy |
string ID of the user or service account who initiated the operation. |
modifiedAt |
string (date-time) The time when the Operation resource was last modified. String in RFC3339 To work with values in this field, use the APIs described in the |
done |
boolean If the value is |
metadata |
Service-specific metadata associated with the operation. |
error |
The error result of the operation in case of failure or cancellation. Includes only one of the fields The operation result. |
response |
The normal response of the operation in case of success. Includes only one of the fields The operation result. |
UpdateSecurityGroupMetadata
Field |
Description |
securityGroupId |
string ID of the SecurityGroup that is being updated. |
addedRuleIds[] |
string List of added security rules IDs. |
Status
The error result of the operation in case of failure or cancellation.
Field |
Description |
code |
integer (int32) Error code. An enum value of google.rpc.Code |
message |
string An error message. |
details[] |
object A list of messages that carry the error details. |
SecurityGroup
Field |
Description |
id |
string ID of the security group. |
folderId |
string ID of the folder that the security group belongs to. |
createdAt |
string (date-time) Creation timestamp in RFC3339 String in RFC3339 To work with values in this field, use the APIs described in the |
name |
string Name of the security group. |
description |
string Description of the security group. 0-256 characters long. |
labels |
object (map<string, string>) Resource labels as |
networkId |
string ID of the network that the security group belongs to. |
status |
enum (Status) Security group status.
|
rules[] |
List of the security group rules. |
defaultForNetwork |
boolean Flag that indicates that the security group is the default for the network. |
SecurityGroupRule
Field |
Description |
id |
string ID of the rule. |
description |
string Description of the rule. 0-256 characters long. |
labels |
object (map<string, string>) Resource labels as |
direction |
enum (Direction) Required field. The direction of network traffic allowed by this rule.
|
ports |
The range of ports that allow traffic to pass through. Null value means any. |
protocolName |
string Protocol name. Null value means any protocol. |
protocolNumber |
string (int64) Protocol number from IANA protocol numbers |
cidrBlocks |
CIDR blocks to allow to recieve or send traffic. Includes only one of the fields |
securityGroupId |
string ID of the security group to add rule to. Includes only one of the fields |
predefinedTarget |
string Predefined target. See security groups rules for more information. Includes only one of the fields |
PortRange
Field |
Description |
fromPort |
string (int64) The lowest port in the range. |
toPort |
string (int64) The highest port in the range. |
CidrBlocks
Field |
Description |
v4CidrBlocks[] |
string IPv4 CIDR blocks to allow traffic to. |
v6CidrBlocks[] |
string IPv6 CIDR blocks to allow traffic to. |