Skip to content

tmprender/prisma_cloud_utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prisma Cloud API Utils

Helper Methods and Example Code for getting started with Prisma Cloud APIs

Usage

  • Set the base URL for Prisma Cloud API (NOTE: both can be set):

    • CSPM_BASE_URL export CSPM_BASE_URL=https://api.prismacloud.io/

    and/or

    • CWP_BASE_URL export CWP_BASE_URL=https://us-west1.cloud.twistlock.com/us-1-2345678
  • Set the file path to Prisma Cloud API creds (.csv file downloaded from management cosole):

    • PRISMA_KEY_FILE export PRISMA_KEY_FILE=/full/path/to/cred_file.csv

    • Optionally set KEY_ID and SECRET_KEY directly instead of reading from key file

  • Use the helper methods to authenticate (login/renew) to Prisma Cloud and retreive an API Token

Example

  • Set token value to env_var in CLI to make subsequent API calls with another script/cURL:

export CWP_TOKEN=$(python login_cwp.py)

  • Auth and renew within python script by importing (clone and install with pip)
from primsa_utils import prisma_utils

TOKEN = prisma_utils.cspm_login()
# make some API calls ... iterate over results ... minutes go by ... 
response = requests.request("POST", BASE_URL+"/resource", headers=headers, json=payload)
...
...

TOKEN = prisma_utils.cspm_renew(TOKEN)

More

For a robust Python SDK: https://github.com/PaloAltoNetworks/prismacloud-api-python

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published