A golang application that demonstrates how to use the ePortal API.
You can run the source script directly from go, for example:
go run main.go --servers
The included Makefile can build various binaries, subject to your go environment setup. The easiest invocation is:
make clean all
Alternatively you can compile and install your platform's binary (there are no dependencies) into $GOPATH/bin/
using:
go install github.com/sej7278/eportal-go@latest
Or simply download a binary from the releases page.
You should create a ~/.eportal.ini file with the following syntax:
username = api
password = Password123
url = https://eportal.example.com
You should give the file some level of protection using POSIX permissions, as the contents are not encrypted:
chmod 0600 ~/.eportal.ini
As of the current release, eportal-go supports the following queries (API endpoints):
- users
--users
- patchsets
--patchsets
- keys
--keys
- servers
--servers
- feeds
--feeds
They can be combined like so:
eportal-go --users --feeds
Which returns something like this in the default "pretty" mode:
FEEDS:
Name: main
Auto: false
Channel: default
DeployAfter: 0
Name: all
Auto: false
Channel: default
DeployAfter: 0
USERS:
1: admin
2: api
3: user, Readonly user (readonly)
If you want to return in JSON format, append the --json
flag and optionally pipe to jq
like so:
eportal-go --users --json | jq
Which returns something like this:
{
"result": [
{
"description": null,
"id": 1,
"readonly": false,
"username": "admin"
},
{
"description": "",
"id": 2,
"readonly": false,
"username": "api"
},
{
"description": "Readonly user",
"id": 3,
"readonly": true,
"username": "user"
}
]
}