Rancher API Client

Client for interacting with the Rancher API

Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

com.github.kod4n
Идентификатор

Идентификатор

rancher-client
Последняя версия

Последняя версия

1.0.5
Дата

Дата

Тип

Тип

jar
Описание

Описание

Rancher API Client
Client for interacting with the Rancher API
Ссылка на сайт

Ссылка на сайт

https://github.com/kod4n/rancher-client
Система контроля версий

Система контроля версий

https://github.com/kod4n/rancher-client

Скачать rancher-client

Как подключить последнюю версию

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

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
org.codehaus.groovy : groovy-all jar 2.4.9
com.squareup.retrofit2 : retrofit jar 2.3.0
com.squareup.retrofit2 : converter-jackson jar 2.3.0
org.slf4j : slf4j-api jar 1.7.25
ch.qos.logback : logback-classic jar 1.2.3
org.antlr : ST4 jar 4.0.8

test (3)

Идентификатор библиотеки Тип Версия
org.hamcrest : hamcrest-all jar 1.3
org.testcontainers : spock jar 1.7.2
org.spockframework : spock-core jar 1.1-groovy-2.4

Модули Проекта

Данный проект не имеет модулей.

Rancher Groovy SDK

This project is an auto-generated Groovy client for Rancher

This project uses Golang templates and a Rancher API schema file to generate models and services. It was originally derived from the Go-Rancher library.

APIs for this project are accessed using Square's Retrofit2 library.

Client Configuration

The entrypoint for this library is the io.rancher.Rancher class. To configure this client, API secret and access keys need to be generated for your user in a Rancher installation.

The io.rancher.Rancher client is initialized with and io.rancher.Rancher.Config configuration object

def config = new Rancher.Config(
  new URL('https://rancher.mydomain.com'), 
  'MyAPIAccessKey', 
  'MyAPISecretKey'
)
def rancher = new Rancher(config)

From here, you can create an API service and perform operations on a resource.

import io.rancher.service.ServiceApi

def services = rancher.type ServiceApi
def projectServices = service.list('my-project-id').execute()

This library also offers a helper method (extractBody) for getting the body on a Call<T> instance. Here is an example of the usage:

def stacks = rancher.type StackApi
def myStack = extractBody stacks.findById('my-project', 'my-stack')

myStack.id // extractBody gives us direct access to the value returned form the API call

Updating the Rancher API

The API models and services for this projects are generated using the schema for a given Rancher version. To update the API for a rancher version, execute the below steps:

  1. cd generator
  2. Run a Rancher server container using docker run -d --name rancher-server -p 8080:8080 rancher/enterprise:<rancher-version> and wait for the API to become available.
  3. curl -o schemas.json http://localhost:8080/v2-beta/projecst/1a5/schemas
  4. make && ./generator

Версии библиотеки

Версия
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0