https://github.com/manetu/api-tools
A set of tools helpful in interacting with the Manetu Control Plane
https://github.com/manetu/api-tools
Last synced: 10 months ago
JSON representation
A set of tools helpful in interacting with the Manetu Control Plane
- Host: GitHub
- URL: https://github.com/manetu/api-tools
- Owner: manetu
- License: mit
- Created: 2022-03-04T12:56:31.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-04T18:49:20.000Z (almost 3 years ago)
- Last Synced: 2025-02-02T00:11:18.445Z (11 months ago)
- Language: Clojure
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# api-tools
A set of tools helpful in interacting with the Manetu Control Plane
## Getting started
### Prerequisites
- Install [babashka](https://github.com/babashka/babashka#installation)
### Install api-tools into your path
``` bash
make install
```
### Set the following environment variables
- **MANETU_TOKEN**: A personal access token to the Manetu Platform
- **MANETU_GRAPHQL_URL**: A URL pointing to the Manetu Platform instance, e.g. https://test.manetu.io/graphql
## Usage
### manetu-graphql-cli
``` bash
$ manetu-graphql-cli -h
Usage: graphcli [options]
Options:
-h, --help
-m, --mutation
-l, --log-level LEVEL :info Select the output-types from [trace, debug, info, warn, error, fatal, report]
```
Generally speaking, the tool accepts graphql queries in [district0x](https://github.com/district0x/graphql-query) [EDN](https://github.com/edn-format/edn) format on stdin and outputs JSON results on stdout
#### Examples
##### Query
``` bash
$ echo '[:search {:term "Ellen"} [:name :email]]' | manetu-graphql-cli | jq .data.search
[
{
"name": "Ellen Cabane",
"email": "ecabanemx@51.la"
}
]
```
##### Mutation
Add the -m switch
``` bash
$ echo '[:create_iam_group {:name "test" :description "test" :mrn_roles ["mrn:iam:manetu.io:role:admin"]}] ' | manetu-graphql-cli -m | jq .data
{
"create_iam_group": "mrn:iam:piedpiper:group:ca3bbda6-9d97-46fb-94df-b9be1477dc4e"
}
```
### manetu-sparql-cli
``` bash
$ manetu-sparql-cli -h
Usage: manetu-sparql-cli [options]
Options:
-h, --help
--update VAULTLABEL
-s, --show Display the SPARQL query
-l, --log-level LEVEL :info Select the output-types from [trace, debug, info, warn, error, fatal, report]
-o, --output TYPE :json Select the output-types from [table, json]
```
#### Examples
``` bash
$ cat < PREFIX person:
>
> SELECT ?a ?v
>
> WHERE {
> ?p person:Email "krangeley0@comsenz.com" .
> ?p ?a ?v .
> }
> EOF
|--------------------------------------+----------------------------------------------|
| ?v | ?a |
|--------------------------------------+----------------------------------------------|
| | |
| krangeley0@comsenz.com | |
| Karel | |
| Rangeley | |
|--------------------------------------+----------------------------------------------|
```