0.3.1 • Published 3 years ago

@de44/aiven-node v0.3.1

Weekly downloads
97
License
MIT
Repository
github
Last release
3 years ago

Aiven Node Utility

This is a personal project for interacting with Aiven services via NodeJS and the API.

Quick Start

npm install -S @de44/aiven-node
npm i @de44/aiven-node
const AivenApi = require('@de44/aiven-node');

const avn = new AivenApi({
  token: 'my-aiven-api-token',
  projectId: 'my-project-id',
});

API

General

PropertyTypeDescription
me()async functionReturns the currently logged in user
setProject(projectId)functionSets the active project.
cloudsasync functionFetches all public clouds and regions.

Projects

PropertyTypeDescription
projects.list()async functionReturns all the project for the logged in user.
projects.details(id)async functionReturns the details of the specified project.
projects.ca()async functionReturns project CA.

Services

PropertyTypeDescription
services.list()async functionReturns all the services for the current project.
services.details(id)async functionReturns the details of the specified project.
services.powerOn(id)async functionPowers on the specified project.
services.powerOff(id)async functionPowers off the specified project.
services.remove(id)async functionDeletes the specified service.

Kafka

avn.getKafkaCreds(serviceName: string): Promise<KafkaCredentials>

Uses the active project set in the client. Returns the following type

const kCreds = await avn.getKafkaCreds('my-service');
PropertyTypeDescription
kCreds.connObjectKafkaJS style configs.
kCreds.conn.brokersstring[]Broker list.
kCreds.conn.sslObjectObject containing encryption and authentication certificates.
kCreds.kafkaUristringKafka brokers URI.
kCreds.connectUristringKafka Connect URI.
kCreds.kafkaRestUristringKafka Rest Proxy URI.
kCreds.schemaRegistryUristringKafka Schema Registry URI.

Elasticsearch

avn.getElasticsearchCreds(serviceName: string): Promise<ElasticsearchCredentials>

Uses the active project set in the client. Returns the following type

const esCreds = await avn.getElasticsearchCreds('my-service');
PropertyTypeDescription
esCreds.baseReqObjectAxios style request object
esCreds.baseReq.urlstringThe request uri, including basic auth.
esCreds.usernamestringThe admin username.
esCreds.passwordstringThe admin password.
esCreds.esUristringThe cluster uri, including basic auth.
esCreds.kibanaUristringThe Kibana uri, including basic auth.