开发者社区> 镜像站> NPM> @adobe/aio-lib-tvm
@adobe/aio-lib-tvm

A JS client to access the Adobe I/O token vending machine

This package has moved to @adobe/aio-lib-core-tvm and is no longer maintained. Please update the package name to get the latest changes.
Last updated a year ago by moritzraho .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @adobe/aio-lib-tvm 
SYNC missed versions from official npm registry.

Version Downloads/week Build Status License CodecovCoverage

Adobe I/O Lib Token Vending Machine

A JS client to access the token vending machine.

For more details on the server side, goto adobe/aio-tvm

Install

npm install @adobe/aio-lib-tvm

Use

const TvmClient = require('@adobe/aio-lib-tvm')
// init
const tvm = await TvmClient.init({ ow: { auth: '<myauth>', namespace: '<mynamespace>' } })

// aws s3
const awsS3Credentials = await tvm.getAwsS3Credentials()
const aws = require('aws-sdk')
const s3 = new aws.S3(awsS3Credentials)
// ...operations on s3 object

// azure blob
const azureBlobCredentials = await tvm.getAzureBlobCredentials()
const azure = require('@azure/storage-blob')
const azureCreds = new azure.AnonymousCredential()
const pipeline = azure.StorageURL.newPipeline(azureCreds)
const containerURLPrivate = new azure.ContainerURL(azureBlobCredentials.sasURLPrivate, pipeline)
const containerURLPublic = new azure.ContainerURL(azureBlobCredentials.sasURLPublic, pipeline)
// ...operations on containerURLPrivate and containerURLPublic

// azure cosmos
const azureCosmosCredentials = await tvm.getAzureCosmosCredentials()
const cosmos = require('@azure/cosmos')
const container = new cosmos.CosmosClient({ endpoint: azureCosmosCredentials.endpoint, tokenProvider: async () => azureCosmosCredentials.resourceToken })
                            .database(azureCosmosCredentials.databaseId)
                            .container(azureCosmosCredentials.containerId)
const data = await container.item('<itemKey>', azureCosmosCredentials.partitionKey).read()
// ...operations on items within azureCosmosCredentials.partitionKey

Explore

goto API

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

Current Tags

  • 0.6.0                                ...           latest (a year ago)

3 Versions

  • 0.6.0 [deprecated]           ...           a year ago
  • 0.5.0 [deprecated]           ...           a year ago
  • 0.4.0 [deprecated]           ...           a year ago