Home
Version 3
Security Groups API

Security Groups API

Updating a Security Group

PUT /v2/security_groups/:guid

Request

Route

PUT /v2/security_groups/1452e164-0c3e-4a6c-b3c3-c40ad9fd0159

Parameters

Name Description Valid Values Example Values
guid The guid of the Security Group

Body

Name Description Default Valid Values Example Values
name The name of the security group.
  • my_super_sec_group
rules The egress rules for apps that belong to this security group. A rule consists of a protocol (tcp,icmp,udp,all), destination CIDR or destination range, port or port range (tcp,udp,all), type (control signal for icmp), code (control signal for icmp), log (enables logging for the egress rule), description (optional description of the rule). This field is limited to 16MB.
  • [
      {
        "protocol": "icmp",
        "destination": "0.0.0.0/0",
        "type": 0,
        "code": 1
      },
      {
        "protocol": "tcp",
        "destination": "0.0.0.0/0",
        "ports": "2048-3000",
        "log": true
      },
      {
        "protocol": "udp",
        "destination": "0.0.0.0/0",
        "ports": "53, 5353"
      },
      {
        "protocol": "all",
        "destination": "0.0.0.0/0",
        "description": "This rule allows access to all ips and protocols"
      }
    ]
space_guids The list of associated spaces.
{
  "name": "new_name",
  "rules": [

  ]
}

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTExIiwiZW1haWwiOiJlbWFpbC0xMUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDY2MDA4ODgxfQ._-hD6v10noyAKyUnYBI0BrsrOXbXqxob5Jau3cMkl5E
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

cURL

curl "https://api.[your-domain.com]/v2/security_groups/1452e164-0c3e-4a6c-b3c3-c40ad9fd0159" -d '{
  "name": "new_name",
  "rules": [

  ]
}' -X PUT \
	-H "Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTExIiwiZW1haWwiOiJlbWFpbC0xMUBzb21lZG9tYWluLmNvbSIsInNjb3BlIjpbImNsb3VkX2NvbnRyb2xsZXIuYWRtaW4iXSwiYXVkIjpbImNsb3VkX2NvbnRyb2xsZXIiXSwiZXhwIjoxNDY2MDA4ODgxfQ._-hD6v10noyAKyUnYBI0BrsrOXbXqxob5Jau3cMkl5E" \
	-H "Host: example.org" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-H "Cookie: "

Response

Status

201 Created

Body

{
  "metadata": {
    "guid": "1452e164-0c3e-4a6c-b3c3-c40ad9fd0159",
    "url": "/v2/security_groups/1452e164-0c3e-4a6c-b3c3-c40ad9fd0159",
    "created_at": "2016-06-08T16:41:21Z",
    "updated_at": "2016-06-08T16:41:21Z"
  },
  "entity": {
    "name": "new_name",
    "rules": [

    ],
    "running_default": false,
    "staging_default": false,
    "spaces_url": "/v2/security_groups/1452e164-0c3e-4a6c-b3c3-c40ad9fd0159/spaces"
  }
}

Headers

Content-Type: application/json;charset=utf-8
X-VCAP-Request-ID: 7b0e4992-81ed-4c22-b42e-0ef051f51971
Content-Length: 439
X-Content-Type-Options: nosniff