https://github.com/paskal/go-prisma
Tiny library for Prisma Cloud API access.
https://github.com/paskal/go-prisma
prisma prisma-cloud-api
Last synced: 3 months ago
JSON representation
Tiny library for Prisma Cloud API access.
- Host: GitHub
- URL: https://github.com/paskal/go-prisma
- Owner: paskal
- License: apache-2.0
- Archived: true
- Created: 2020-02-12T18:10:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-12-02T04:12:53.000Z (6 months ago)
- Last Synced: 2025-02-15T06:34:42.432Z (3 months ago)
- Topics: prisma, prisma-cloud-api
- Language: Go
- Homepage: https://api.docs.prismacloud.io/reference
- Size: 27.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Palo Alto Prisma Cloud library [](https://github.com/paskal/go-prisma/actions) [](https://goreportcard.com/report/github.com/paskal/go-prisma)[](https://coveralls.io/github/paskal/go-prisma?branch=master)[](https://pkg.go.dev/github.com/paskal/go-prisma?tab=doc)
Tiny library for [Prisma Cloud API](https://api.docs.prismacloud.io/reference) access.
It takes care of authorization and token renewal, and let you concentrate on issuing requests.
## How to install
```console
go get github.com/paskal/go-prisma
```## Usage example
```go
package mainimport (
"log"
"os""github.com/jessevdk/go-flags"
"github.com/paskal/go-prisma"
)func main() {
var opts struct {
PrismAPIUrl string `long:"prisma_api_url" default:"https://api.eu.prismacloud.io" description:"Prisma API URL"`
PrismAPIKey string `long:"prisma_api_key" required:"true" description:"Prisma API key"`
PrismAPIPassword string `long:"prisma_api_password" required:"true" description:"Prisma API password"`
}
if _, err := flags.Parse(&opts); err != nil {
os.Exit(1)
}log.SetFlags(log.Ldate | log.Ltime)
log.Printf("[INFO] Initialising Prisma connection with API key %s", opts.PrismAPIKey)p := prisma.NewClient(opts.PrismAPIKey, opts.PrismAPIPassword, opts.PrismAPIUrl)
healthCheckResult, err := p.Call("GET", "/check", nil)
if err != nil {
log.Printf("[ERROR] Can't check Prisma health, %s", err)
return
}
log.Printf("[INFO] Prisma /check endpoint answer: %s", healthCheckResult)
}
```