From 1ad5898583383925e7ea1d85c9a9089f114ab1d8 Mon Sep 17 00:00:00 2001 From: Ajey K Date: Wed, 8 Sep 2021 08:51:16 +0530 Subject: [PATCH 1/3] added exclusions documentation. --- docs/docs/api/exclusions.md | 129 ++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 docs/docs/api/exclusions.md diff --git a/docs/docs/api/exclusions.md b/docs/docs/api/exclusions.md new file mode 100644 index 00000000..226d53cb --- /dev/null +++ b/docs/docs/api/exclusions.md @@ -0,0 +1,129 @@ +**Exclusion APIs** +=== + +- Prancer supports crawl and compliance execution for cloud and IAC resources. The process runs for all resources. Exclusions enables to exclude resources during the processes. Exclusions are applied at the collection level, not globally for all compliances across different types like azure, aws etc. Eg: for a given type of collection could be IAC, azure cloud etc, the resources, tests or a combination of test and resource can be excluded. + +# For a container (that exists) get the list of exclusions +# param ==> container = +curl -X GET https://portaldev.prancer.io/prancer-shahin/api/exclusions/resources/?container=Aws -H "authorization: Bearer $tk" -H 'content-type: application/json' + +** List of the exclusions for a container ** +--- +- API to get the list of exclusions for a container. + +**CURL Sample** +``` +curl -H "Authorization: Bearer " -H "Content-Type:application/json" -X GET "https://portal.prancer.io/prancer-liquware/api/exclusions/resources/?container=aws" +``` + +- **URL:** https://portal.prancer.io/api/exclusions/resources/ +- **Method:** GET +- **Header:** +``` + - content-type: application/json + - Authorization: Bearer +``` +- **Param:** +``` +- container: +``` + +**Response:** +``` +{ + "status" : 200, + "message" : "", + "error" : "", + "data" : { + "container" : "Aws", + "exclusions" : [ + { + "paths" : [ + "/crawler-test/service-definition.yaml" + ], + "exclusionType" : "resource" + }, + { + "masterTestID" : "TEST_POD_2", + "exclusionType" : "test" + }, + { + "masterTestID" : "TEST_POD_1", + "paths" : [ + "/crawler-test/pod-creation.yaml" + ], + "exclusionType" : "single" + } + ] + }, + "metadata" : {} +} +``` + +** API to Exclude Resource for all tests API.** +--- +- API to exclude a specific resource (either not ready or low-risk resource) for all tests in the compliance suite. + +**CURL Sample** +``` +curl -H "Authorization: Bearer " -H "Content-Type:application/json" -X POST https://portal.prancer.io/prancer-liquware/api/exclusions/resources/ -d'{"container": "Aws", "exclusions": [{"exclusionType": "resource", "paths": ["/crawler-test/service-definition.yaml"]}]}' + +``` + +- **URL:** https://portal.prancer.io/prancer-liquware/api/exclusions/resources/ +- **Method:** POST + +- **Header:** +``` + - content-type: application/json + - Authorization: Bearer +``` +- **Param:** +``` +- container: +- exclusions: [{"exclusionType": "resource", "paths": [""]}, {}] +``` + +**Response:** +``` +{ + "status" : 200, + "message" : "Added exclusion successfully.", + "error" : "", + "metadata" : {} +} +``` + +** API to delete an Excluded Resource for all tests API.** +--- +- API to delete an excluded resource for all tests in the compliance suite. + +**CURL Sample** +``` +curl -H "Authorization: Bearer " -H "Content-Type:application/json" -X DELETE https://portal.prancer.io/prancer-liquware/api/exclusions/resources/ -d'{"container": "Aws", "exclusions": [{"exclusionType": "resource", "paths": ["/crawler-test/service-definition.yaml"]}]}' + +``` + +- **URL:** https://portal.prancer.io/prancer-liquware/api/exclusions/resources/ +- **Method:** DELETE + +- **Header:** +``` + - content-type: application/json + - Authorization: Bearer +``` +- **Param:** +``` +- container: +- exclusions: [{"exclusionType": "resource", "paths": [""]}, {}] +``` + +**Response:** +``` +{ + "status" : 200, + "message" : "Deleted exclusion successfully.", + "error" : "", + "metadata" : {} +} +``` From c4c5befbff5b69c370229e05f39724131f9c6269 Mon Sep 17 00:00:00 2001 From: Ajey K Date: Wed, 8 Sep 2021 09:27:27 +0530 Subject: [PATCH 2/3] Corrected typo. --- docs/docs/api/exclusions.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/docs/api/exclusions.md b/docs/docs/api/exclusions.md index 226d53cb..beceada3 100644 --- a/docs/docs/api/exclusions.md +++ b/docs/docs/api/exclusions.md @@ -3,8 +3,6 @@ - Prancer supports crawl and compliance execution for cloud and IAC resources. The process runs for all resources. Exclusions enables to exclude resources during the processes. Exclusions are applied at the collection level, not globally for all compliances across different types like azure, aws etc. Eg: for a given type of collection could be IAC, azure cloud etc, the resources, tests or a combination of test and resource can be excluded. -# For a container (that exists) get the list of exclusions -# param ==> container = curl -X GET https://portaldev.prancer.io/prancer-shahin/api/exclusions/resources/?container=Aws -H "authorization: Bearer $tk" -H 'content-type: application/json' ** List of the exclusions for a container ** From 1f94ba03e4fae916984b17948a4f3eae2041d014 Mon Sep 17 00:00:00 2001 From: Ajey K Date: Thu, 16 Sep 2021 18:58:22 +0530 Subject: [PATCH 3/3] Updated the API for exclusionType --- docs/docs/api/exclusions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/docs/api/exclusions.md b/docs/docs/api/exclusions.md index beceada3..4577444e 100644 --- a/docs/docs/api/exclusions.md +++ b/docs/docs/api/exclusions.md @@ -24,6 +24,7 @@ curl -H "Authorization: Bearer " -H "Content-Type:application/ - **Param:** ``` - container: +- exclusionType: [test, resource, single], otherwise ignored and all are sent. ``` **Response:** @@ -80,6 +81,7 @@ curl -H "Authorization: Bearer " -H "Content-Type:application/ ``` - container: - exclusions: [{"exclusionType": "resource", "paths": [""]}, {}] + valid exclusionTypes are "resource", "test", "single" ``` **Response:**