Security Groups

Create an API Key and access token:-

For create a API Key and Access Token to refer this link :-

https://www.e2enetworks.com/help/knowledge-base/how-to-create-an-api-access-token/

List of Security Groups-

To find a list of Security Groups to send a GET request

https://api.e2enetworks.com/myaccount/api/v1/security_group/?apikey={{API_KEY}}&contact_person_id=null&location=Delhi&project_id={{project_id}}
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": [
        {
            "id": 41181,
            "name": "security_group_rule",
            "description": "",
            "rules": [
                {
                    "id": 86990,
                    "deleted": false,
                    "created_at": "2023-07-10T06:07:17.858489Z",
                    "updated_at": "2023-07-10T06:07:17.858597Z",
                    "rule_type": "Inbound",
                    "protocol_name": "Custom_TCP",
                    "port_range": "21,22",
                    "network": "any",
                    "network_cidr": "--",
                    "network_size": 1,
                    "is_active": true,
                    "security_group": 41181
                },
                {
                    "id": 86991,
                    "deleted": false,
                    "created_at": "2023-07-10T06:07:17.870153Z",
                    "updated_at": "2023-07-10T06:07:17.870251Z",
                    "rule_type": "Inbound",
                    "protocol_name": "All_UDP",
                    "port_range": "All",
                    "network": "any",
                    "network_cidr": "--",
                    "network_size": 1,
                    "is_active": true,
                    "security_group": 41181
                },
                {
                    "id": 86992,
                    "deleted": false,
                    "created_at": "2023-07-10T06:07:17.877844Z",
                    "updated_at": "2023-07-10T06:07:17.877934Z",
                    "rule_type": "Outbound",
                    "protocol_name": "All",
                    "port_range": "All",
                    "network": "any",
                    "network_cidr": "--",
                    "network_size": 1,
                    "is_active": true,
                    "security_group": 41181
                }
            ],
            "is_default": false,
            "is_all_traffic_rule": false
        },
        {
            "id": 3482,
            "name": "spottt",
            "description": "",
            "rules": [
                {
                    "id": 5854,
                    "deleted": false,
                    "created_at": "2022-12-22T12:57:12.913702Z",
                    "updated_at": "2022-12-22T12:57:12.913760Z",
                    "rule_type": "Inbound",
                    "protocol_name": "All",
                    "port_range": "",
                    "network": "any",
                    "network_cidr": "--",
                    "network_size": 1,
                    "is_active": true,
                    "security_group": 3482
                },
                {
                    "id": 5855,
                    "deleted": false,
                    "created_at": "2022-12-22T12:57:12.917883Z",
                    "updated_at": "2022-12-22T12:57:12.917931Z",
                    "rule_type": "Outbound",
                    "protocol_name": "All",
                    "port_range": "",
                    "network": "any",
                    "network_cidr": "--",
                    "network_size": 1,
                    "is_active": true,
                    "security_group": 3482
                }
            ],
            "is_default": false,
            "is_all_traffic_rule": false
        },

    ],
    "errors": {},
    "message": "Success"
}

Create a new Security Groups

To create a Security Groups , send a Post request :-

https://api.e2enetworks.com/myaccount/api/v1/security_group/?apikey={{API_KEY}}&contact_person_id=null&location=Delhi&project_id={{project_id}}
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
 "name": "security_group_rule",
 "description": "",
 "rules":[
   {
      "network": "any",
      "rule_type": "Inbound",
      "protocol_name": "Custom_TCP",
      "port_range": "21,22"
    },
   {
   "network": "any",
   "rule_type": "Inbound",
   "protocol_name": "All_UDP",
   "port_range":  "All"
    },
   {
   "network" : "any",
   "rule_type" : "Outbound",
   "protocol_name" : "All",
   "port_range" : "All"
   }
   ],
"default": false
}

Delete Security Groups

To delete a Security Groups , send a DELETE request to Security Groups endpoint :-

https://api.e2enetworks.com/myaccount/api/v1/security_group/{{ID}}/?apikey={{api_key}}&contact_person_id=null&location=Delhi&project_id={{project_id}}
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
"code": 200,
"data": "",
"errors": {},
"message": "Security Group deleted successfully."
}

make default Security Groups-

To Make a default Security Groups to send a Post request:-

https://api.e2enetworks.com/myaccount/api/v1/security_group/{{ID}}/mark-default/?apikey={{api_key}}&contact_person_id=null&project_id={{project_id}}
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
    {
    "code": 200,
    "data": "",
    "errors": {},
    "message": "Security Group mark default successfully."
}

Update Security Groups

To Update a Security Groups , send a Put request :-

https://api.e2enetworks.com/myaccount/api/v1/security_group/{{ID}}/?apikey={{api_key}}&contact_person_id=null&project_id={{project_id}}
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
"name": "security_group_rule",
"description": "",
"rules": [
    {
        "id": 87287,
        "deleted": false,
        "created_at": "2023-07-10T11:41:42.630777Z",
        "updated_at": "2023-07-10T11:41:42.630832Z",
        "rule_type": "Outbound",
        "protocol_name": "All",
        "port_range": "All",
        "network": "any",
        "network_cidr": "--",
        "network_size": 1,
        "is_active": true,
        "security_group": 41181
    },
    {
        "network": "any",
        "rule_type": "Inbound",
        "protocol_name": "Custom_TCP",
        "port_range": "10,11,11,12"
    },
    {
        "network": "any",
        "rule_type": "Inbound",
        "protocol_name": "All_UDP",
        "port_range": "All"
    }
]
}