Skip to content

Commit

Permalink
Merge pull request #49 from yandex-cloud/CLOUD-86841
Browse files Browse the repository at this point in the history
V2.0-alpha
  • Loading branch information
DavyJohnes authored Dec 27, 2021
2 parents 9846795 + a8c7c00 commit ce2d49f
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
pull_request:
branches:
- master
- alpha
- beta
jobs:
install:
runs-on: ubuntu-20.04
Expand Down
108 changes: 75 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,125 @@
# Yandex.Cloud SDK (node.js)
# Yandex.Cloud SDK (nodejs)

[![npm](https://img.shields.io/npm/v/yandex-cloud.svg)](https://www.npmjs.com/package/yandex-cloud)
[![CircleCI](https://img.shields.io/circleci/build/gh/yandex-cloud/nodejs-sdk/master)](https://circleci.com/gh/yandex-cloud/nodejs-sdk/tree/master)
[![License](https://img.shields.io/github/license/yandex-cloud/nodejs-sdk.svg)](https://github.com/yandex-cloud/nodejs-sdk/blob/master/LICENSE)

Need to automate your infrastructure or use services provided by Yandex.Cloud? We've got you covered.

Installation:
## Requirements
- nodejs >= 10

npm install yandex-cloud

Library requires at least node.js 10 and provides TypeScript declarations.
## Installation
`npm install yandex-cloud`

## Getting started

There are two options for authorization your requests - OAuth Token
and Metadata Service (if you're executing code inside VMs or Functions
There are three options for authorization your requests:
- [OAuth Token](https://cloud.yandex.com/en-ru/docs/iam/concepts/authorization/oauth-token)
- [IAM token](https://cloud.yandex.com/en-ru/docs/iam/operations/iam-token/create)
- [Metadata Service](https://cloud.yandex.com/en-ru/docs/compute/concepts/vm-metadata) (if you're executing code inside VMs or Functions
running in Yandex.Cloud)

### OAuth Token

```javascript
const {Session} = require('yandex-cloud');
const {CloudService} = require('yandex-cloud/api/resourcemanager/v1');
```typescript
import { Session, cloudApi, serviceClients } from 'yandex-cloud';

const { resourcemanager: { cloud_service: { ListCloudsRequest } } } = cloudApi;

// Initialize SDK with your token
const session = new Session({ oauthToken: 'YOUR_TOKEN' });

// Create service client
const cloudService = new CloudService(session);
const cloudService = session.client(serviceClients.CloudServiceClient);

// Issue request (returns Promise)
let response = await cloudService.list({});
const response = await cloudService.list(ListCloudsRequest.fromPartial({
pageSize: 100,
}));
```

### Metadata Service

Don't forget to assign Service Account for your Instance or Function.

```javascript
const {CloudService} = require('yandex-cloud/api/resourcemanager/v1');
```typescript
import { Session, cloudApi, serviceClients } from 'yandex-cloud';

// Create service client (auth token will be fetched from metadata service
const cloudService = new CloudService();
const { resourcemanager: { cloud_service: { ListCloudsRequest } } } = cloudApi;

// Initialize SDK with your token
const session = new Session();

// Create service client
const cloudService = session.client(serviceClients.CloudServiceClient);

// Issue request (returns Promise)
let response = await cloudService.list({});
const response = await cloudService.list(ListCloudsRequest.fromPartial({
pageSize: 100,
}));
```

### IAM Token

```javascript
const {Session} = require('yandex-cloud');
const {CloudService} = require('yandex-cloud/api/resourcemanager/v1');
```typescript
import { Session, cloudApi, serviceClients } from 'yandex-cloud';

const { resourcemanager: { cloud_service: { ListCloudsRequest } } } = cloudApi;

// Initialize SDK with your token
const session = new Session({ iamToken: 'YOUR_TOKEN' });

// Create service client
const cloudService = new CloudService(session);
const cloudService = session.client(serviceClients.CloudServiceClient);

// Issue request (returns Promise)
let response = await cloudService.list({});
const response = await cloudService.list(ListCloudsRequest.fromPartial({
pageSize: 100,
}));
```

Check `examples` directory for more examples.
Check [examples](./examples) directory for more examples.

## Services

* Resource Manager;
* Identity and Access Management (IAM);
* Compute Cloud;
* Container Registry;
* Managed Services for Kubernetes;
* Key Management Service (KMS);
* Load Balancer;
* Cloud Functions;
* Virtual Private Cloud (VPC);
* AI Translate;
* AI Vision.
* Application Load Balancer
* Billing
* Cloud CDN
* Certificate Manager
* Compute Cloud
* Container Registry
* Data Proc
* DataSphere
* Data Transfer
* DNS
* Identity and Access Management (IAM)
* IoT Core
* Managed Service for Kubernetes
* Key Management Service (KMS)
* Load Balancer
* Lockbox
* Logging
* Managed DataBase
* ClickHouse
* ElasticSearch
* Greenplum
* Kafka
* MongoDB
* MySQL
* PostgreSQL
* Redis
* MS SQL Server
* Organization Manager
* Resource Manager
* Serverless
* Functions
* API Gateway
* Containers
* Triggers
* MDB Proxy
* Virtual Private Cloud (VPC)
* Yandex Database (YDB)

If you need generated client for other Yandex.Cloud services, just open an issue.

0 comments on commit ce2d49f

Please sign in to comment.