Skip to content

Commit 59cff51

Browse files
committed
Merge branch 'master' into beta
# Conflicts: # README.md # examples/ai-translate.ts # examples/compute-instance-create.ts # examples/functions.ts # examples/iot-data.ts # examples/kms.ts # examples/resourcemanager-cloud-list.ts # examples/storage.ts # examples/stream-stt/index.ts # package-lock.json # package.json # src/service-endpoints.ts
2 parents c1d7f7c + 42a0ce9 commit 59cff51

12 files changed

Lines changed: 16681 additions & 30783 deletions

README.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,10 @@ Need to automate your infrastructure or use services provided by Yandex.Cloud? W
1414
## Getting started
1515

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

22-
### OAuth Token
23-
24-
```typescript
25-
import { Session } from '@yandex-cloud/nodejs-sdk';
26-
import { cloudService } from '@yandex-cloud/nodejs-sdk/resourcemanager-v1';
27-
28-
// Initialize SDK with your token
29-
const session = new Session({ oauthToken: 'YOUR_TOKEN' });
30-
31-
// Create service client
32-
const cloudServiceClient = session.client(cloudService.CloudServiceClient);
33-
34-
// Issue request (returns Promise)
35-
const response = await cloudServiceClient.list(cloudService.ListCloudsRequest.fromPartial({
36-
pageSize: 100,
37-
}));
38-
```
3921

4022
### Metadata Service
4123

@@ -81,7 +63,7 @@ To run example scripts, you should execute the following commands:
8163
```bash
8264
cd examples
8365
npm i
84-
YC_OAUTH_TOKEN=... YC_FOLDER_ID=... npm run start path/to/example.ts
66+
YC_IAM_TOKEN=... YC_FOLDER_ID=... npm run start path/to/example.ts
8567
```
8668

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

examples/ai-translate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { log } from './utils/logger';
44
import { translationService } from '@yandex-cloud/nodejs-sdk/ai-translate-v2';
55

66
const TEXTS = ['NodeJS SDK examples', 'Powerful, but easy to use library'];
7-
const AUTH_TOKEN = getEnv('YC_OAUTH_TOKEN');
7+
const IAM_TOKEN = getEnv('YC_IAM_TOKEN');
88
const FOLDER_ID = getEnv('YC_FOLDER_ID');
99

1010
(async () => {
11-
const session = new Session({ oauthToken: AUTH_TOKEN });
11+
const session = new Session({ iamToken: IAM_TOKEN });
1212
const client = session.client(translationService.TranslationServiceClient);
1313

1414
const response = await client.translate(

examples/compute-instance-create.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import { Instance } from '@yandex-cloud/nodejs-sdk/compute-v1/instance';
88
import { getEnv } from './utils/get-env';
99
import { log } from './utils/logger';
1010

11-
const AUTH_TOKEN = getEnv('YC_OAUTH_TOKEN');
11+
const IAM_TOKEN = getEnv('YC_IAM_TOKEN');
1212
const FOLDER_ID = getEnv('YC_FOLDER_ID');
1313
const TARGET_ZONE_ID = 'ru-central1-a';
1414

1515
(async () => {
16-
const session = new Session({ oauthToken: AUTH_TOKEN });
16+
const session = new Session({ iamToken: IAM_TOKEN });
1717
const imageClient = session.client(imageService.ImageServiceClient);
1818
const instanceClient = session.client(instanceService.InstanceServiceClient);
1919
const networkClient = session.client(networkService.NetworkServiceClient);

examples/functions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { log } from './utils/logger';
44

55
import { functionService } from '@yandex-cloud/nodejs-sdk/serverless-functions-v1';
66

7-
const AUTH_TOKEN = getEnv('YC_OAUTH_TOKEN');
7+
const IAM_TOKEN = getEnv('YC_IAM_TOKEN');
88
const FOLDER_ID = getEnv('YC_FOLDER_ID');
99

1010
(async () => {
11-
const session = new Session({ oauthToken: AUTH_TOKEN });
11+
const session = new Session({ iamToken: IAM_TOKEN });
1212
const client = session.client(functionService.FunctionServiceClient);
1313

1414
const response = await client.list(

examples/iot-data.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { log } from './utils/logger';
44

55
import { registryDataService, registryService } from '@yandex-cloud/nodejs-sdk/iot-devices-v1';
66

7-
const AUTH_TOKEN = getEnv('YC_OAUTH_TOKEN');
7+
const IAM_TOKEN = getEnv('YC_IAM_TOKEN');
88
const FOLDER_ID = getEnv('YC_FOLDER_ID');
99

1010
(async () => {
11-
const session = new Session({ oauthToken: AUTH_TOKEN });
11+
const session = new Session({ iamToken: IAM_TOKEN });
1212
const registryClient = session.client(registryService.RegistryServiceClient);
1313
const dataClient = session.client(registryDataService.RegistryDataServiceClient);
1414

examples/kms.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import {
99
} from '@yandex-cloud/nodejs-sdk/kms-v1';
1010

1111
(async () => {
12-
const authToken = getEnv('YC_OAUTH_TOKEN');
12+
const iamToken = getEnv('YC_IAM_TOKEN');
1313
const folderId = getEnv('YC_FOLDER_ID');
14-
const session = new Session({ oauthToken: authToken });
14+
const session = new Session({ iamToken: iamToken });
1515
const keyClient = session.client(symmetricKeyService.SymmetricKeyServiceClient);
1616
const cryptoClient = session.client(symmetricCryptoService.SymmetricCryptoServiceClient);
1717

examples/resourcemanager-cloud-list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { getEnv } from './utils/get-env';
33
import { log } from './utils/logger';
44
import { cloudService } from '@yandex-cloud/nodejs-sdk/resourcemanager-v1';
55

6-
const AUTH_TOKEN = getEnv('YC_OAUTH_TOKEN');
6+
const IAM_TOKEN = getEnv('YC_IAM_TOKEN');
77

88
(async () => {
9-
const session = new Session({ oauthToken: AUTH_TOKEN });
9+
const session = new Session({ iamToken: IAM_TOKEN });
1010
const client = session.client(cloudService.CloudServiceClient);
1111

1212
const response = await client.list(

examples/storage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { getEnv } from './utils/get-env';
33
import { log } from './utils/logger';
44
import { bucketService } from '@yandex-cloud/nodejs-sdk/storage-v1';
55

6-
const AUTH_TOKEN = getEnv('YC_OAUTH_TOKEN');
6+
const IAM_TOKEN = getEnv('YC_IAM_TOKEN');
77
const FOLDER_ID = getEnv('YC_FOLDER_ID');
88

99
(async () => {
10-
const session = new Session({ oauthToken: AUTH_TOKEN });
10+
const session = new Session({ iamToken: IAM_TOKEN });
1111
const client = session.client(bucketService.BucketServiceClient);
1212

1313
const response = await client.list(

examples/stream-stt/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ file.pipe(reader);
3030
reader.pipe(data);
3131

3232
(async () => {
33-
const authToken = getEnv('YC_OAUTH_TOKEN');
33+
const iamToken = getEnv('YC_IAM_TOKEN');
3434
const folderId = getEnv('YC_FOLDER_ID');
35-
const session = new Session({ oauthToken: authToken });
35+
const session = new Session({ iamToken: iamToken });
3636
const client = session.client(sttService.SttServiceClient);
3737

3838
async function* createRequest(): AsyncIterable<StreamingRecognitionRequest> {

0 commit comments

Comments
 (0)