CreatePackageFirewallPolicy
Creates the policy of a namespace.
POST
/
v1
/
namespaces
/
{tenant_meta.namespace}
/
package-firewall-policies
CreatePackageFirewallPolicy
curl --request POST \
--url https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies \
--header 'Content-Type: application/json' \
--data '
{
"meta": {
"name": "<string>",
"annotations": {},
"description": "<string>",
"index_data": {},
"parent_kind": "<string>",
"parent_uuid": "<string>",
"tags": [
"<string>"
]
},
"spec": {
"cvss_severity_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"cvss_severity_threshold": "CVSS_SEVERITY_LEVEL_UNSPECIFIED",
"ecosystem_package_manager_uuid": {},
"exceptions": [
{
"ecosystem": "ECOSYSTEM_UNSPECIFIED",
"package_name": "<string>",
"exact_versions": [
"<string>"
],
"version_ranges": [
{
"end": "<string>",
"start": "<string>"
}
]
}
],
"fail_closed": true,
"malware_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"min_age_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"min_age_hours": 123,
"notification_rules": [
{
"name": "<string>",
"notification_target_uuids": [
"<string>"
],
"on_actions": [
"PACKAGE_FIREWALL_ACTION_UNSPECIFIED"
],
"reasons": [
"PACKAGE_FIREWALL_REASON_UNSPECIFIED"
]
}
],
"restricted_license_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"restricted_licenses": [
"<string>"
]
},
"propagate": true,
"tenant_meta": {}
}
'import requests
url = "https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies"
payload = {
"meta": {
"name": "<string>",
"annotations": {},
"description": "<string>",
"index_data": {},
"parent_kind": "<string>",
"parent_uuid": "<string>",
"tags": ["<string>"]
},
"spec": {
"cvss_severity_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"cvss_severity_threshold": "CVSS_SEVERITY_LEVEL_UNSPECIFIED",
"ecosystem_package_manager_uuid": {},
"exceptions": [
{
"ecosystem": "ECOSYSTEM_UNSPECIFIED",
"package_name": "<string>",
"exact_versions": ["<string>"],
"version_ranges": [
{
"end": "<string>",
"start": "<string>"
}
]
}
],
"fail_closed": True,
"malware_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"min_age_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"min_age_hours": 123,
"notification_rules": [
{
"name": "<string>",
"notification_target_uuids": ["<string>"],
"on_actions": ["PACKAGE_FIREWALL_ACTION_UNSPECIFIED"],
"reasons": ["PACKAGE_FIREWALL_REASON_UNSPECIFIED"]
}
],
"restricted_license_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"restricted_licenses": ["<string>"]
},
"propagate": True,
"tenant_meta": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
meta: {
name: '<string>',
annotations: {},
description: '<string>',
index_data: {},
parent_kind: '<string>',
parent_uuid: '<string>',
tags: ['<string>']
},
spec: {
cvss_severity_action: 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
cvss_severity_threshold: 'CVSS_SEVERITY_LEVEL_UNSPECIFIED',
ecosystem_package_manager_uuid: {},
exceptions: [
{
ecosystem: 'ECOSYSTEM_UNSPECIFIED',
package_name: '<string>',
exact_versions: ['<string>'],
version_ranges: [{end: '<string>', start: '<string>'}]
}
],
fail_closed: true,
malware_action: 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
min_age_action: 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
min_age_hours: 123,
notification_rules: [
{
name: '<string>',
notification_target_uuids: ['<string>'],
on_actions: ['PACKAGE_FIREWALL_ACTION_UNSPECIFIED'],
reasons: ['PACKAGE_FIREWALL_REASON_UNSPECIFIED']
}
],
restricted_license_action: 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
restricted_licenses: ['<string>']
},
propagate: true,
tenant_meta: {}
})
};
fetch('https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'meta' => [
'name' => '<string>',
'annotations' => [
],
'description' => '<string>',
'index_data' => [
],
'parent_kind' => '<string>',
'parent_uuid' => '<string>',
'tags' => [
'<string>'
]
],
'spec' => [
'cvss_severity_action' => 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
'cvss_severity_threshold' => 'CVSS_SEVERITY_LEVEL_UNSPECIFIED',
'ecosystem_package_manager_uuid' => [
],
'exceptions' => [
[
'ecosystem' => 'ECOSYSTEM_UNSPECIFIED',
'package_name' => '<string>',
'exact_versions' => [
'<string>'
],
'version_ranges' => [
[
'end' => '<string>',
'start' => '<string>'
]
]
]
],
'fail_closed' => true,
'malware_action' => 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
'min_age_action' => 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
'min_age_hours' => 123,
'notification_rules' => [
[
'name' => '<string>',
'notification_target_uuids' => [
'<string>'
],
'on_actions' => [
'PACKAGE_FIREWALL_ACTION_UNSPECIFIED'
],
'reasons' => [
'PACKAGE_FIREWALL_REASON_UNSPECIFIED'
]
]
],
'restricted_license_action' => 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
'restricted_licenses' => [
'<string>'
]
],
'propagate' => true,
'tenant_meta' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies"
payload := strings.NewReader("{\n \"meta\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"description\": \"<string>\",\n \"index_data\": {},\n \"parent_kind\": \"<string>\",\n \"parent_uuid\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"spec\": {\n \"cvss_severity_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"cvss_severity_threshold\": \"CVSS_SEVERITY_LEVEL_UNSPECIFIED\",\n \"ecosystem_package_manager_uuid\": {},\n \"exceptions\": [\n {\n \"ecosystem\": \"ECOSYSTEM_UNSPECIFIED\",\n \"package_name\": \"<string>\",\n \"exact_versions\": [\n \"<string>\"\n ],\n \"version_ranges\": [\n {\n \"end\": \"<string>\",\n \"start\": \"<string>\"\n }\n ]\n }\n ],\n \"fail_closed\": true,\n \"malware_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"min_age_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"min_age_hours\": 123,\n \"notification_rules\": [\n {\n \"name\": \"<string>\",\n \"notification_target_uuids\": [\n \"<string>\"\n ],\n \"on_actions\": [\n \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\"\n ],\n \"reasons\": [\n \"PACKAGE_FIREWALL_REASON_UNSPECIFIED\"\n ]\n }\n ],\n \"restricted_license_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"restricted_licenses\": [\n \"<string>\"\n ]\n },\n \"propagate\": true,\n \"tenant_meta\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies")
.header("Content-Type", "application/json")
.body("{\n \"meta\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"description\": \"<string>\",\n \"index_data\": {},\n \"parent_kind\": \"<string>\",\n \"parent_uuid\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"spec\": {\n \"cvss_severity_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"cvss_severity_threshold\": \"CVSS_SEVERITY_LEVEL_UNSPECIFIED\",\n \"ecosystem_package_manager_uuid\": {},\n \"exceptions\": [\n {\n \"ecosystem\": \"ECOSYSTEM_UNSPECIFIED\",\n \"package_name\": \"<string>\",\n \"exact_versions\": [\n \"<string>\"\n ],\n \"version_ranges\": [\n {\n \"end\": \"<string>\",\n \"start\": \"<string>\"\n }\n ]\n }\n ],\n \"fail_closed\": true,\n \"malware_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"min_age_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"min_age_hours\": 123,\n \"notification_rules\": [\n {\n \"name\": \"<string>\",\n \"notification_target_uuids\": [\n \"<string>\"\n ],\n \"on_actions\": [\n \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\"\n ],\n \"reasons\": [\n \"PACKAGE_FIREWALL_REASON_UNSPECIFIED\"\n ]\n }\n ],\n \"restricted_license_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"restricted_licenses\": [\n \"<string>\"\n ]\n },\n \"propagate\": true,\n \"tenant_meta\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"meta\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"description\": \"<string>\",\n \"index_data\": {},\n \"parent_kind\": \"<string>\",\n \"parent_uuid\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"spec\": {\n \"cvss_severity_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"cvss_severity_threshold\": \"CVSS_SEVERITY_LEVEL_UNSPECIFIED\",\n \"ecosystem_package_manager_uuid\": {},\n \"exceptions\": [\n {\n \"ecosystem\": \"ECOSYSTEM_UNSPECIFIED\",\n \"package_name\": \"<string>\",\n \"exact_versions\": [\n \"<string>\"\n ],\n \"version_ranges\": [\n {\n \"end\": \"<string>\",\n \"start\": \"<string>\"\n }\n ]\n }\n ],\n \"fail_closed\": true,\n \"malware_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"min_age_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"min_age_hours\": 123,\n \"notification_rules\": [\n {\n \"name\": \"<string>\",\n \"notification_target_uuids\": [\n \"<string>\"\n ],\n \"on_actions\": [\n \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\"\n ],\n \"reasons\": [\n \"PACKAGE_FIREWALL_REASON_UNSPECIFIED\"\n ]\n }\n ],\n \"restricted_license_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"restricted_licenses\": [\n \"<string>\"\n ]\n },\n \"propagate\": true,\n \"tenant_meta\": {}\n}"
response = http.request(request)
puts response.read_body{
"meta": {
"name": "<string>",
"annotations": {},
"create_time": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"index_data": {
"data": [
"<string>"
],
"search_score": 123,
"tenant": "<string>",
"will_be_deleted_at": "2023-11-07T05:31:56Z"
},
"kind": "<string>",
"parent_kind": "<string>",
"parent_uuid": "<string>",
"references": {},
"tags": [
"<string>"
],
"update_time": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"upsert_time": "2023-11-07T05:31:56Z",
"version": "<string>"
},
"spec": {
"cvss_severity_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"cvss_severity_threshold": "CVSS_SEVERITY_LEVEL_UNSPECIFIED",
"ecosystem_package_manager_uuid": {},
"exceptions": [
{
"ecosystem": "ECOSYSTEM_UNSPECIFIED",
"package_name": "<string>",
"exact_versions": [
"<string>"
],
"version_ranges": [
{
"end": "<string>",
"start": "<string>"
}
]
}
],
"fail_closed": true,
"malware_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"min_age_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"min_age_hours": 123,
"notification_rules": [
{
"name": "<string>",
"notification_target_uuids": [
"<string>"
],
"on_actions": [
"PACKAGE_FIREWALL_ACTION_UNSPECIFIED"
],
"reasons": [
"PACKAGE_FIREWALL_REASON_UNSPECIFIED"
]
}
],
"restricted_license_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"restricted_licenses": [
"<string>"
]
},
"propagate": true,
"tenant_meta": {
"namespace": "<string>"
},
"uuid": "<string>"
}{
"code": 123,
"details": [
{
"@type": "<string>"
}
],
"message": "<string>"
}Path Parameters
Body
application/json
PackageFirewallPolicy is the Package Firewall policy of one namespace.
Response
A successful response.
PackageFirewallPolicy is the Package Firewall policy of one namespace.
Was this page helpful?
CreatePackageFirewallPolicy
curl --request POST \
--url https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies \
--header 'Content-Type: application/json' \
--data '
{
"meta": {
"name": "<string>",
"annotations": {},
"description": "<string>",
"index_data": {},
"parent_kind": "<string>",
"parent_uuid": "<string>",
"tags": [
"<string>"
]
},
"spec": {
"cvss_severity_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"cvss_severity_threshold": "CVSS_SEVERITY_LEVEL_UNSPECIFIED",
"ecosystem_package_manager_uuid": {},
"exceptions": [
{
"ecosystem": "ECOSYSTEM_UNSPECIFIED",
"package_name": "<string>",
"exact_versions": [
"<string>"
],
"version_ranges": [
{
"end": "<string>",
"start": "<string>"
}
]
}
],
"fail_closed": true,
"malware_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"min_age_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"min_age_hours": 123,
"notification_rules": [
{
"name": "<string>",
"notification_target_uuids": [
"<string>"
],
"on_actions": [
"PACKAGE_FIREWALL_ACTION_UNSPECIFIED"
],
"reasons": [
"PACKAGE_FIREWALL_REASON_UNSPECIFIED"
]
}
],
"restricted_license_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"restricted_licenses": [
"<string>"
]
},
"propagate": true,
"tenant_meta": {}
}
'import requests
url = "https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies"
payload = {
"meta": {
"name": "<string>",
"annotations": {},
"description": "<string>",
"index_data": {},
"parent_kind": "<string>",
"parent_uuid": "<string>",
"tags": ["<string>"]
},
"spec": {
"cvss_severity_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"cvss_severity_threshold": "CVSS_SEVERITY_LEVEL_UNSPECIFIED",
"ecosystem_package_manager_uuid": {},
"exceptions": [
{
"ecosystem": "ECOSYSTEM_UNSPECIFIED",
"package_name": "<string>",
"exact_versions": ["<string>"],
"version_ranges": [
{
"end": "<string>",
"start": "<string>"
}
]
}
],
"fail_closed": True,
"malware_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"min_age_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"min_age_hours": 123,
"notification_rules": [
{
"name": "<string>",
"notification_target_uuids": ["<string>"],
"on_actions": ["PACKAGE_FIREWALL_ACTION_UNSPECIFIED"],
"reasons": ["PACKAGE_FIREWALL_REASON_UNSPECIFIED"]
}
],
"restricted_license_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"restricted_licenses": ["<string>"]
},
"propagate": True,
"tenant_meta": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
meta: {
name: '<string>',
annotations: {},
description: '<string>',
index_data: {},
parent_kind: '<string>',
parent_uuid: '<string>',
tags: ['<string>']
},
spec: {
cvss_severity_action: 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
cvss_severity_threshold: 'CVSS_SEVERITY_LEVEL_UNSPECIFIED',
ecosystem_package_manager_uuid: {},
exceptions: [
{
ecosystem: 'ECOSYSTEM_UNSPECIFIED',
package_name: '<string>',
exact_versions: ['<string>'],
version_ranges: [{end: '<string>', start: '<string>'}]
}
],
fail_closed: true,
malware_action: 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
min_age_action: 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
min_age_hours: 123,
notification_rules: [
{
name: '<string>',
notification_target_uuids: ['<string>'],
on_actions: ['PACKAGE_FIREWALL_ACTION_UNSPECIFIED'],
reasons: ['PACKAGE_FIREWALL_REASON_UNSPECIFIED']
}
],
restricted_license_action: 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
restricted_licenses: ['<string>']
},
propagate: true,
tenant_meta: {}
})
};
fetch('https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'meta' => [
'name' => '<string>',
'annotations' => [
],
'description' => '<string>',
'index_data' => [
],
'parent_kind' => '<string>',
'parent_uuid' => '<string>',
'tags' => [
'<string>'
]
],
'spec' => [
'cvss_severity_action' => 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
'cvss_severity_threshold' => 'CVSS_SEVERITY_LEVEL_UNSPECIFIED',
'ecosystem_package_manager_uuid' => [
],
'exceptions' => [
[
'ecosystem' => 'ECOSYSTEM_UNSPECIFIED',
'package_name' => '<string>',
'exact_versions' => [
'<string>'
],
'version_ranges' => [
[
'end' => '<string>',
'start' => '<string>'
]
]
]
],
'fail_closed' => true,
'malware_action' => 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
'min_age_action' => 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
'min_age_hours' => 123,
'notification_rules' => [
[
'name' => '<string>',
'notification_target_uuids' => [
'<string>'
],
'on_actions' => [
'PACKAGE_FIREWALL_ACTION_UNSPECIFIED'
],
'reasons' => [
'PACKAGE_FIREWALL_REASON_UNSPECIFIED'
]
]
],
'restricted_license_action' => 'PACKAGE_FIREWALL_ACTION_UNSPECIFIED',
'restricted_licenses' => [
'<string>'
]
],
'propagate' => true,
'tenant_meta' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies"
payload := strings.NewReader("{\n \"meta\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"description\": \"<string>\",\n \"index_data\": {},\n \"parent_kind\": \"<string>\",\n \"parent_uuid\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"spec\": {\n \"cvss_severity_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"cvss_severity_threshold\": \"CVSS_SEVERITY_LEVEL_UNSPECIFIED\",\n \"ecosystem_package_manager_uuid\": {},\n \"exceptions\": [\n {\n \"ecosystem\": \"ECOSYSTEM_UNSPECIFIED\",\n \"package_name\": \"<string>\",\n \"exact_versions\": [\n \"<string>\"\n ],\n \"version_ranges\": [\n {\n \"end\": \"<string>\",\n \"start\": \"<string>\"\n }\n ]\n }\n ],\n \"fail_closed\": true,\n \"malware_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"min_age_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"min_age_hours\": 123,\n \"notification_rules\": [\n {\n \"name\": \"<string>\",\n \"notification_target_uuids\": [\n \"<string>\"\n ],\n \"on_actions\": [\n \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\"\n ],\n \"reasons\": [\n \"PACKAGE_FIREWALL_REASON_UNSPECIFIED\"\n ]\n }\n ],\n \"restricted_license_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"restricted_licenses\": [\n \"<string>\"\n ]\n },\n \"propagate\": true,\n \"tenant_meta\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies")
.header("Content-Type", "application/json")
.body("{\n \"meta\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"description\": \"<string>\",\n \"index_data\": {},\n \"parent_kind\": \"<string>\",\n \"parent_uuid\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"spec\": {\n \"cvss_severity_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"cvss_severity_threshold\": \"CVSS_SEVERITY_LEVEL_UNSPECIFIED\",\n \"ecosystem_package_manager_uuid\": {},\n \"exceptions\": [\n {\n \"ecosystem\": \"ECOSYSTEM_UNSPECIFIED\",\n \"package_name\": \"<string>\",\n \"exact_versions\": [\n \"<string>\"\n ],\n \"version_ranges\": [\n {\n \"end\": \"<string>\",\n \"start\": \"<string>\"\n }\n ]\n }\n ],\n \"fail_closed\": true,\n \"malware_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"min_age_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"min_age_hours\": 123,\n \"notification_rules\": [\n {\n \"name\": \"<string>\",\n \"notification_target_uuids\": [\n \"<string>\"\n ],\n \"on_actions\": [\n \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\"\n ],\n \"reasons\": [\n \"PACKAGE_FIREWALL_REASON_UNSPECIFIED\"\n ]\n }\n ],\n \"restricted_license_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"restricted_licenses\": [\n \"<string>\"\n ]\n },\n \"propagate\": true,\n \"tenant_meta\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.endorlabs.com/v1/namespaces/{tenant_meta.namespace}/package-firewall-policies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"meta\": {\n \"name\": \"<string>\",\n \"annotations\": {},\n \"description\": \"<string>\",\n \"index_data\": {},\n \"parent_kind\": \"<string>\",\n \"parent_uuid\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ]\n },\n \"spec\": {\n \"cvss_severity_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"cvss_severity_threshold\": \"CVSS_SEVERITY_LEVEL_UNSPECIFIED\",\n \"ecosystem_package_manager_uuid\": {},\n \"exceptions\": [\n {\n \"ecosystem\": \"ECOSYSTEM_UNSPECIFIED\",\n \"package_name\": \"<string>\",\n \"exact_versions\": [\n \"<string>\"\n ],\n \"version_ranges\": [\n {\n \"end\": \"<string>\",\n \"start\": \"<string>\"\n }\n ]\n }\n ],\n \"fail_closed\": true,\n \"malware_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"min_age_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"min_age_hours\": 123,\n \"notification_rules\": [\n {\n \"name\": \"<string>\",\n \"notification_target_uuids\": [\n \"<string>\"\n ],\n \"on_actions\": [\n \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\"\n ],\n \"reasons\": [\n \"PACKAGE_FIREWALL_REASON_UNSPECIFIED\"\n ]\n }\n ],\n \"restricted_license_action\": \"PACKAGE_FIREWALL_ACTION_UNSPECIFIED\",\n \"restricted_licenses\": [\n \"<string>\"\n ]\n },\n \"propagate\": true,\n \"tenant_meta\": {}\n}"
response = http.request(request)
puts response.read_body{
"meta": {
"name": "<string>",
"annotations": {},
"create_time": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"index_data": {
"data": [
"<string>"
],
"search_score": 123,
"tenant": "<string>",
"will_be_deleted_at": "2023-11-07T05:31:56Z"
},
"kind": "<string>",
"parent_kind": "<string>",
"parent_uuid": "<string>",
"references": {},
"tags": [
"<string>"
],
"update_time": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"upsert_time": "2023-11-07T05:31:56Z",
"version": "<string>"
},
"spec": {
"cvss_severity_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"cvss_severity_threshold": "CVSS_SEVERITY_LEVEL_UNSPECIFIED",
"ecosystem_package_manager_uuid": {},
"exceptions": [
{
"ecosystem": "ECOSYSTEM_UNSPECIFIED",
"package_name": "<string>",
"exact_versions": [
"<string>"
],
"version_ranges": [
{
"end": "<string>",
"start": "<string>"
}
]
}
],
"fail_closed": true,
"malware_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"min_age_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"min_age_hours": 123,
"notification_rules": [
{
"name": "<string>",
"notification_target_uuids": [
"<string>"
],
"on_actions": [
"PACKAGE_FIREWALL_ACTION_UNSPECIFIED"
],
"reasons": [
"PACKAGE_FIREWALL_REASON_UNSPECIFIED"
]
}
],
"restricted_license_action": "PACKAGE_FIREWALL_ACTION_UNSPECIFIED",
"restricted_licenses": [
"<string>"
]
},
"propagate": true,
"tenant_meta": {
"namespace": "<string>"
},
"uuid": "<string>"
}{
"code": 123,
"details": [
{
"@type": "<string>"
}
],
"message": "<string>"
}