Palo Alto Networks Rules API
The Rules API from Palo Alto Networks — 4 operation(s) for rules.
The Rules API from Palo Alto Networks — 4 operation(s) for rules.
openapi: 3.2.0
info:
contact: {}
description: 'The Rules endpoints are listed below.
'
title: Prisma Cloud API Overview Rules API
version: Latest
servers:
- url: https://api.prismacloud.io
tags:
- name: Rules
paths:
/code/api/v1/enforcement-rules/account/{accountId}:
get:
description: Gets scheme for a specific account.
operationId: getSchemeForAccount
parameters:
- in: path
name: accountId
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/GetSchemeForAccountResponse'
description: Get enforcement rules for account
'422':
description: Request arguments validation error
security:
- CustomAuthorizer: []
summary: Get Scheme for Specific Account
tags:
- Rules
x-codeSamples:
- lang: Python + Requests
source: 'import requests
url = "https://api.prismacloud.io/code/api/v1/enforcement-rules/account/{accountId}"
headers = {"authorization": "REPLACE_KEY_VALUE"}
response = requests.request("GET", url, headers=headers)
print(response.text)'
- lang: Shell + Curl
source: "curl --request GET \\\n --url https://api.prismacloud.io/code/api/v1/enforcement-rules/account/{accountId} \\\n --header 'authorization: REPLACE_KEY_VALUE'"
/code/api/v1/enforcement-rules:
get:
description: 'This API is used to fetch an array of all your existing Enforcement rules.
The response includes details of the rule and the behavior threshold configured to each Code category Prisma Cloud Application Security scans (IaC, Secrets, Images, Open source)'
operationId: getSchemeForCustomer
parameters: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/GetSchemeForCustomerResponse'
description: Get list of enforcement rules for a specific customer
security:
- CustomAuthorizer: []
summary: Get All Enforcement Rules
tags:
- Rules
x-codeSamples:
- lang: Python + Requests
source: 'import requests
url = "https://api.prismacloud.io/code/api/v1/enforcement-rules"
headers = {"authorization": "REPLACE_KEY_VALUE"}
response = requests.request("GET", url, headers=headers)
print(response.text)'
- lang: Shell + Curl
source: "curl --request GET \\\n --url https://api.prismacloud.io/code/api/v1/enforcement-rules \\\n --header 'authorization: REPLACE_KEY_VALUE'"
post:
description: This API is used in order to add exception rule for a specific set of repositories
operationId: addRule
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AddRuleBody'
required: true
responses:
'200':
content:
application/json:
schema:
type: string
description: Add rule
'422':
description: Request arguments validation error
security:
- CustomAuthorizer: []
summary: Create New Exception for Enforcement Rule
tags:
- Rules
x-codeSamples:
- lang: Python + Requests
source: "import requests\n\nurl = \"https://api.prismacloud.io/code/api/v1/enforcement-rules\"\n\npayload = {\n \"codeCategories\": {\n \"IAC\": {\n \"commentsBotThreshold\": \"OFF\",\n \"hardFailThreshold\": \"OFF\",\n \"softFailThreshold\": \"OFF\"\n },\n \"IMAGES\": {\n \"commentsBotThreshold\": \"OFF\",\n \"hardFailThreshold\": \"OFF\",\n \"softFailThreshold\": \"OFF\"\n },\n \"OPEN_SOURCE\": {\n \"commentsBotThreshold\": \"OFF\",\n \"hardFailThreshold\": \"OFF\",\n \"softFailThreshold\": \"OFF\"\n },\n \"SECRETS\": {\n \"commentsBotThreshold\": \"OFF\",\n \"hardFailThreshold\": \"OFF\",\n \"softFailThreshold\": \"OFF\"\n },\n \"SUPPLY_CHAIN\": {\n \"commentsBotThreshold\": \"OFF\",\n \"hardFailThreshold\": \"OFF\",\n \"softFailThreshold\": \"OFF\"\n }\n },\n \"name\": \"string\",\n \"repositories\": [\n {\n \"accountId\": \"string\",\n \"accountName\": \"string\"\n }\n ]\n}\nheaders = {\n \"content-type\": \"application/json\",\n \"authorization\": \"REPLACE_KEY_VALUE\"\n}\n\nresponse = requests.request(\"POST\", url, json=payload, headers=headers)\n\nprint(response.text)"
- lang: Shell + Curl
source: "curl --request POST \\\n --url https://api.prismacloud.io/code/api/v1/enforcement-rules \\\n --header 'authorization: REPLACE_KEY_VALUE' \\\n --header 'content-type: application/json' \\\n --data '{\"codeCategories\":{\"IAC\":{\"commentsBotThreshold\":\"OFF\",\"hardFailThreshold\":\"OFF\",\"softFailThreshold\":\"OFF\"},\"IMAGES\":{\"commentsBotThreshold\":\"OFF\",\"hardFailThreshold\":\"OFF\",\"softFailThreshold\":\"OFF\"},\"OPEN_SOURCE\":{\"commentsBotThreshold\":\"OFF\",\"hardFailThreshold\":\"OFF\",\"softFailThreshold\":\"OFF\"},\"SECRETS\":{\"commentsBotThreshold\":\"OFF\",\"hardFailThreshold\":\"OFF\",\"softFailThreshold\":\"OFF\"},\"SUPPLY_CHAIN\":{\"commentsBotThreshold\":\"OFF\",\"hardFailThreshold\":\"OFF\",\"softFailThreshold\":\"OFF\"}},\"name\":\"string\",\"repositories\":[{\"accountId\":\"string\",\"accountName\":\"string\"}]}'"
put:
description: 'This API is used in order to Edit existing rules, main one, or exception.
The main rule threshold behavior can be updated, but users cant apply it on specific repositories, change its name, change status to exception or delete it.'
operationId: editRule
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EditRuleBody'
required: true
responses:
'200':
content:
application/json:
schema:
type: string
description: Edit rule
'422':
description: Request arguments validation error
security:
- CustomAuthorizer: []
summary: Update Enforcement Rule
tags:
- Rules
x-codeSamples:
- lang: Python + Requests
source: "import requests\n\nurl = \"https://api.prismacloud.io/code/api/v1/enforcement-rules\"\n\npayload = {\n \"codeCategories\": {\n \"IAC\": {\n \"commentsBotThreshold\": \"OFF\",\n \"hardFailThreshold\": \"OFF\",\n \"softFailThreshold\": \"OFF\"\n },\n \"IMAGES\": {\n \"commentsBotThreshold\": \"OFF\",\n \"hardFailThreshold\": \"OFF\",\n \"softFailThreshold\": \"OFF\"\n },\n \"OPEN_SOURCE\": {\n \"commentsBotThreshold\": \"OFF\",\n \"hardFailThreshold\": \"OFF\",\n \"softFailThreshold\": \"OFF\"\n },\n \"SECRETS\": {\n \"commentsBotThreshold\": \"OFF\",\n \"hardFailThreshold\": \"OFF\",\n \"softFailThreshold\": \"OFF\"\n },\n \"SUPPLY_CHAIN\": {\n \"commentsBotThreshold\": \"OFF\",\n \"hardFailThreshold\": \"OFF\",\n \"softFailThreshold\": \"OFF\"\n }\n },\n \"id\": \"string\",\n \"name\": \"string\",\n \"repositories\": [\n {\n \"accountId\": \"string\",\n \"accountName\": \"string\"\n }\n ]\n}\nheaders = {\n \"content-type\": \"application/json\",\n \"authorization\": \"REPLACE_KEY_VALUE\"\n}\n\nresponse = requests.request(\"PUT\", url, json=payload, headers=headers)\n\nprint(response.text)"
- lang: Shell + Curl
source: "curl --request PUT \\\n --url https://api.prismacloud.io/code/api/v1/enforcement-rules \\\n --header 'authorization: REPLACE_KEY_VALUE' \\\n --header 'content-type: application/json' \\\n --data '{\"codeCategories\":{\"IAC\":{\"commentsBotThreshold\":\"OFF\",\"hardFailThreshold\":\"OFF\",\"softFailThreshold\":\"OFF\"},\"IMAGES\":{\"commentsBotThreshold\":\"OFF\",\"hardFailThreshold\":\"OFF\",\"softFailThreshold\":\"OFF\"},\"OPEN_SOURCE\":{\"commentsBotThreshold\":\"OFF\",\"hardFailThreshold\":\"OFF\",\"softFailThreshold\":\"OFF\"},\"SECRETS\":{\"commentsBotThreshold\":\"OFF\",\"hardFailThreshold\":\"OFF\",\"softFailThreshold\":\"OFF\"},\"SUPPLY_CHAIN\":{\"commentsBotThreshold\":\"OFF\",\"hardFailThreshold\":\"OFF\",\"softFailThreshold\":\"OFF\"}},\"id\":\"string\",\"name\":\"string\",\"repositories\":[{\"accountId\":\"string\",\"accountName\":\"string\"}]}'"
/code/api/v1/enforcement-rules/{ruleId}:
delete:
description: 'This API is used in order to delete an Exception rule definition, main rules can’t be deleted.
The deleted rule will not be applied to new runs, but won''t change the results of runs affected previously by this rule.
In case of an error, it returns the following string: “Could not delete rule for customer”
If you get this error message, ask for access to the relevant repositories from your admin, or check if the rule is a main rule'
operationId: deleteRule
parameters:
- in: path
name: ruleId
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
type: string
description: Delete rule
'422':
description: Request arguments validation error
security:
- CustomAuthorizer: []
summary: Delete Exception
tags:
- Rules
x-codeSamples:
- lang: Python + Requests
source: 'import requests
url = "https://api.prismacloud.io/code/api/v1/enforcement-rules/{ruleId}"
headers = {"authorization": "REPLACE_KEY_VALUE"}
response = requests.request("DELETE", url, headers=headers)
print(response.text)'
- lang: Shell + Curl
source: "curl --request DELETE \\\n --url https://api.prismacloud.io/code/api/v1/enforcement-rules/{ruleId} \\\n --header 'authorization: REPLACE_KEY_VALUE'"
/code/api/v1/enforcement-rules/accounts:
get:
description: This API is used in order to get all buildtime accounts, with their name, id and source
operationId: getAccounts
parameters:
- in: query
name: pageSize
required: false
schema:
format: double
type: number
- in: query
name: page
required: false
schema:
format: double
type: number
- in: query
name: search
required: false
schema:
type: string
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/RepoData'
type: array
description: Get enforcement rules for account
'422':
description: Request arguments validation error
security:
- CustomAuthorizer: []
summary: Get All Repositories
tags:
- Rules
x-codeSamples:
- lang: Python + Requests
source: 'import requests
url = "https://api.prismacloud.io/code/api/v1/enforcement-rules/accounts"
querystring = {"pageSize":"SOME_NUMBER_VALUE","page":"SOME_NUMBER_VALUE","search":"SOME_STRING_VALUE"}
headers = {"authorization": "REPLACE_KEY_VALUE"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)'
- lang: Shell + Curl
source: "curl --request GET \\\n --url 'https://api.prismacloud.io/code/api/v1/enforcement-rules/accounts?pageSize=SOME_NUMBER_VALUE&page=SOME_NUMBER_VALUE&search=SOME_STRING_VALUE' \\\n --header 'authorization: REPLACE_KEY_VALUE'"
components:
schemas:
CodeCategories:
additionalProperties: false
properties:
IAC:
$ref: '#/components/schemas/CodeCategory'
IMAGES:
$ref: '#/components/schemas/CodeCategory'
OPEN_SOURCE:
$ref: '#/components/schemas/CodeCategory'
SECRETS:
$ref: '#/components/schemas/CodeCategory'
SUPPLY_CHAIN:
$ref: '#/components/schemas/CodeCategory'
required:
- OPEN_SOURCE
- IMAGES
- IAC
- SECRETS
- SUPPLY_CHAIN
type: object
CodeCategory:
additionalProperties: false
properties:
commentsBotThreshold:
$ref: '#/components/schemas/RuleThreshold'
hardFailThreshold:
$ref: '#/components/schemas/RuleThreshold'
softFailThreshold:
$ref: '#/components/schemas/RuleThreshold'
required:
- hardFailThreshold
- softFailThreshold
- commentsBotThreshold
type: object
RuleThreshold:
enum:
- 'OFF'
- INFO
- LOW
- MEDIUM
- HIGH
- CRITICAL
type: string
EnforcementRule:
additionalProperties: false
properties:
codeCategories:
$ref: '#/components/schemas/CodeCategories'
createdBy:
type: string
creationDate:
type: string
editable:
type: boolean
id:
type: string
mainRule:
type: boolean
name:
type: string
repositories:
items:
$ref: '#/components/schemas/RepoData'
type: array
required:
- name
- repositories
- codeCategories
- id
- mainRule
- creationDate
- createdBy
- editable
type: object
EditRuleBody:
additionalProperties: false
properties:
codeCategories:
$ref: '#/components/schemas/CodeCategories'
id:
type: string
name:
type: string
repositories:
items:
$ref: '#/components/schemas/RepoData'
type: array
required:
- name
- repositories
- codeCategories
- id
type: object
AddRuleBody:
additionalProperties: false
properties:
codeCategories:
$ref: '#/components/schemas/CodeCategories'
name:
type: string
repositories:
items:
$ref: '#/components/schemas/RepoData'
type: array
required:
- name
- repositories
- codeCategories
type: object
RepoData:
additionalProperties: false
properties:
accountId:
type: string
accountName:
type: string
required:
- accountId
- accountName
type: object
GetSchemeForCustomerResponse:
additionalProperties: false
properties:
accountsNotInMainRule:
items:
$ref: '#/components/schemas/RepoData'
type: array
rules:
items:
$ref: '#/components/schemas/EnforcementRule'
type: array
required:
- rules
- accountsNotInMainRule
type: object
GetSchemeForAccountResponse:
additionalProperties: false
properties:
accountId:
type: string
codeCategories:
$ref: '#/components/schemas/CodeCategories'
required:
- accountId
- codeCategories
type: object
securitySchemes:
CustomAuthorizer:
in: header
name: authorization
type: apiKey
x-amazon-apigateway-authorizer:
authorizerResultTtlInSeconds: 0
authorizerUri: arn:aws:apigateway:{Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:{Region}:{AccountId}:function:bc-authorization-authorizer-{UniqueTag}{Alias}/invocations
identitySource: method.request.header.authorization
type: request
x-amazon-apigateway-authtype: custom