PNC Groovy Client

A client for the PNC REST API

License

License

Categories

Categories

Groovy Languages CLI User Interface
GroupId

GroupId

ca.szc.groovy.pnc
ArtifactId

ArtifactId

pnc-groovy-client
Last Version

Last Version

1.2.2
Release Date

Release Date

Type

Type

jar
Description

Description

PNC Groovy Client
A client for the PNC REST API

Download pnc-groovy-client

How to add to project

<!-- https://jarcasting.com/artifacts/ca.szc.groovy.pnc/pnc-groovy-client/ -->
<dependency>
    <groupId>ca.szc.groovy.pnc</groupId>
    <artifactId>pnc-groovy-client</artifactId>
    <version>1.2.2</version>
</dependency>
// https://jarcasting.com/artifacts/ca.szc.groovy.pnc/pnc-groovy-client/
implementation 'ca.szc.groovy.pnc:pnc-groovy-client:1.2.2'
// https://jarcasting.com/artifacts/ca.szc.groovy.pnc/pnc-groovy-client/
implementation ("ca.szc.groovy.pnc:pnc-groovy-client:1.2.2")
'ca.szc.groovy.pnc:pnc-groovy-client:jar:1.2.2'
<dependency org="ca.szc.groovy.pnc" name="pnc-groovy-client" rev="1.2.2">
  <artifact name="pnc-groovy-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='ca.szc.groovy.pnc', module='pnc-groovy-client', version='1.2.2')
)
libraryDependencies += "ca.szc.groovy.pnc" % "pnc-groovy-client" % "1.2.2"
[ca.szc.groovy.pnc/pnc-groovy-client "1.2.2"]

Dependencies

compile (4)

Group / Artifact Type Version
org.codehaus.groovy : groovy jar 2.5.2
org.codehaus.groovy : groovy-json jar 2.5.2
org.codehaus.groovy : groovy-xml jar 2.5.2
io.github.http-builder-ng : http-builder-ng-apache jar 1.0.3

test (2)

Group / Artifact Type Version
org.spockframework : spock-core jar 1.2-RC3-groovy-2.5
org.slf4j : slf4j-nop jar 1.7.25

Project Modules

There are no modules declared in this project.

PNC Groovy Client

A minimal Newcastle REST API Client written in Groovy.

Overview

Features

  • Always has the latest operations (swagger API data processed at runtime)
  • Read-only queries do not require authentication
  • Transparent pagination (pages are detected, fetched, and unpacked for you)
  • Authentication
  • Optional CLI
    • RPM available with pre-written config file
    • debugging
    • shell scripts
    • discovering new API operations
    • allows multiple PNC instances to be accessed from one config file (using --config-prefix)
    • generally conforms to POSIX CLI conventions

TODO

  • Body parameters (used for some non-idempotent operations)
    • Model mapping
    • Construction arguments
  • First release to maven central

Usage

CLI

alias pgc='java -jar cli/target/pnc-groovy-cli-1.0.0-SNAPSHOT-executable.jar'
echo 'pnc.url=http://orch.example.com/pnc-rest/rest/swagger.json' > $HOME/.config/pgc.properties
pgc -h
pgc list -h
pgc call -h
pnc_version="$(pgc call build-records get-specific -a id=7113 | jq -r '.executionRootVersion')"

API

def pnc = new PncClient('http://orch.example.com/pnc-rest/rest/swagger.json')
Map buildInfo = pnc.exec(
    'buildRecords', 'getSpecific',
    id: 7113,
)
String pncVersion = buildInfo['executionRootVersion']

Development

Compile

mvn clean package

Unit Tests

Unit tests are executed by default during compilation

Integration Tests

mvn clean package -Dintegration.pnc.host=pnc-orch-master-nightly.cloud.pnc.devel.example.com

Versions

Version
1.2.2
1.2.1
1.2.0
1.1.2
1.1.1
1.1.0
1.0.0