Home
Version 3
Security Groups API

Security Groups API

Updating a Security Group

PUT /v2/security_groups/:guid

Fields

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)
  • [
      {
        "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"
      }
    ]
space_guids The list of associated spaces.

Parameters

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

Request

Headers

Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoidWFhLWlkLTE5NCIsImVtYWlsIjoiZW1haWwtMTY3QHNvbWVkb21haW4uY29tIiwic2NvcGUiOlsiY2xvdWRfY29udHJvbGxlci5hZG1pbiJdLCJhdWQiOlsiY2xvdWRfY29udHJvbGxlciJdLCJleHAiOjE0MTc0NjIzNjN9.xM35WUGbHFZmhfwWeNoTVB4Vc8PFOZKxg3rP8cUevvQ
Host: example.org
Content-Type: application/x-www-form-urlencoded
Cookie: 

Route

PUT /v2/security_groups/28d6f4c6-d9b9-4b12-b2b4-0c2cbb391f95

Body

{
  "name": "new_name",
  "rules": [

  ]
}

cURL

curl "https://api.[your-domain.com]/v2/security_groups/28d6f4c6-d9b9-4b12-b2b4-0c2cbb391f95" -d '{
  "name": "new_name",
  "rules": [

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

Response

Headers

Content-Type: application/json;charset=utf-8
X-VCAP-Request-ID: bb4bd73e-2ce3-476e-82ee-575eb1206940
Content-Length: 449
X-Content-Type-Options: nosniff

Status

201 Created

Body

{
  "metadata": {
    "guid": "28d6f4c6-d9b9-4b12-b2b4-0c2cbb391f95",
    "url": "/v2/security_groups/28d6f4c6-d9b9-4b12-b2b4-0c2cbb391f95",
    "created_at": "2014-11-24T19:32:34+00:00",
    "updated_at": "2014-11-24T19:32:43+00:00"
  },
  "entity": {
    "name": "new_name",
    "rules": [

    ],
    "running_default": false,
    "staging_default": false,
    "spaces_url": "/v2/security_groups/28d6f4c6-d9b9-4b12-b2b4-0c2cbb391f95/spaces"
  }
}