appdynamics-analytics-events-api
Version:
AppDynamics Analytics Events API
53 lines (45 loc) • 1.44 kB
JavaScript
/*
* Copyright 2020 Severin Neumann <severin.neumann@appdynamics.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const { connectAnalyticsAPI } = require('./index.js')
const config = {
url: process.env.APPDYNAMICS_ANALYTICS_URL,
account: process.env.APPDYNAMICS_ANALYTICS_ACCOUNT,
key: process.env.APPDYNAMICS_ANALYTICS_APIKEY
}
const api = connectAnalyticsAPI(config.url, config.account, config.key);
api.with('my_test', {
"account": "integer",
"amount": "float",
"product": "string"
}).then(async (schema) => {
console.log(schema)
try {
var p = await schema.publish({
account: 13,
amount: 13.03,
product: "test"
})
var r = await schema.query('SELECT * from my_test')
console.log(r)
} catch (e) {
console.log(e)
}
schema.delete().then(() => {
console.log('DELETED')
}).catch(console.log)
}).catch(error => {
console.log(error)
})