https://github.com/ftw-soft/rundeck-api-client
PHP client for Rundeck v. 21+ API
https://github.com/ftw-soft/rundeck-api-client
api-client library php5 php7 rundeck rundeck-cli
Last synced: 4 months ago
JSON representation
PHP client for Rundeck v. 21+ API
- Host: GitHub
- URL: https://github.com/ftw-soft/rundeck-api-client
- Owner: ftw-soft
- Archived: true
- Created: 2018-05-16T19:03:19.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-02-14T19:34:16.000Z (over 4 years ago)
- Last Synced: 2025-01-16T14:37:22.783Z (5 months ago)
- Topics: api-client, library, php5, php7, rundeck, rundeck-cli
- Language: PHP
- Homepage:
- Size: 40 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rundeck API client
A php client to access the Rundeck API, based on the [official documentation](https://docs.rundeck.com/api/rundeck-api.html).
Not all API functions are represented by default.## Requirements
* PHP 7.2+ with enabled json extension
* Rundeck 2.1+This client is based on [PSR-17](https://www.php-fig.org/psr/psr-17/) and [PSR-18](https://www.php-fig.org/psr/psr-18/)
and therefore you need a compatible HTTP client and request factories.We suggest [Guzzle 7+](https://github.com/guzzle/guzzle) and [`http-interop/http-factory-guzzle`](https://github.com/http-interop/http-factory-guzzle):
```bash
composer require guzzlehttp/guzzle:^7.0 http-interop/http-factory-guzzle:^1.0
```## Installation
```bash
composer require ftw-soft/rundeck-api-client
```## Basic client usage
```php
request('GET', 'projects');
var_dump($response->getBody()->getContents());
```## Supported default scenarios
This package includes common request scenarios which are called "resources".
The following resources are currently supported:
- Execution
- Job
- Project
- Projects
- System
- Token
- Tokens
- UserEach resource includes calls to the API and it's payload and/or response is represented by custom entity classes.
For example
```php
get();foreach ($tokens as $token) {
echo '====================================';
echo 'id: ', $token->getId(), PHP_EOL;
echo 'user:', $token->getUser(), PHP_EOL;
echo 'token: ', $token->getToken(), PHP_EOL;
echo 'creator: ', $token->getCreator(), PHP_EOL;
echo 'expire at: ', $token->getExpiration()->format(\DATE_ATOM), PHP_EOL;
echo 'roles: ', implode(', ', $token->getRoles()), PHP_EOL;
echo 'is expired: ', $token->isExpired() ? 'yes' : 'no', PHP_EOL;
}
```Feel free to add your own resources and entities to this package by creating a new [pull request](https://github.com/ftw-soft/rundeck-api-client/pulls).