Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getCamClient(credentials, region) {
// create cam client
const secret_id = credentials.SecretId
const secret_key = credentials.SecretKey
const cred = new tencentcloud.common.Credential(secret_id, secret_key)
const httpProfile = new HttpProfile()
httpProfile.reqTimeout = 30
const clientProfile = new ClientProfile('HmacSHA256', httpProfile)
return new CamClient(cred, region, clientProfile)
}
async getAppid(credentials) {
const secret_id = credentials.SecretId
const secret_key = credentials.SecretKey
const cred = credentials.token
? new tencentcloud.common.Credential(secret_id, secret_key, credentials.token)
: new tencentcloud.common.Credential(secret_id, secret_key)
const httpProfile = new HttpProfile()
httpProfile.reqTimeout = 30
const clientProfile = new ClientProfile('HmacSHA256', httpProfile)
const cam = new AppidClient(cred, 'ap-guangzhou', clientProfile)
const req = new GetUserAppIdResponse()
const body = {}
req.from_json_string(JSON.stringify(body))
const handler = util.promisify(cam.GetUserAppId.bind(cam))
try {
return handler(req)
} catch (e) {
throw 'Get Appid failed! '
}
}
getAppid(credentials) {
const secret_id = credentials.SecretId
const secret_key = credentials.SecretKey
let cred;
if (credentials.Token)
cred = new tencentcloud.common.Credential(secret_id, secret_key, credentials.Token)
else
cred = new tencentcloud.common.Credential(secret_id, secret_key)
const httpProfile = new HttpProfile()
httpProfile.reqTimeout = 30
const clientProfile = new ClientProfile('HmacSHA256', httpProfile)
const cam = new AppidClient(cred, 'ap-guangzhou', clientProfile)
const req = new GetUserAppIdResponse()
const body = {}
req.from_json_string(JSON.stringify(body))
const handler = util.promisify(cam.GetUserAppId.bind(cam))
try {
return handler(req)
} catch (e) {
throw 'Get Appid failed! '
}
}
getAppid(credentials) {
const secret_id = credentials.SecretId
const secret_key = credentials.SecretKey
const cred = credentials.token
? new tencentcloud.common.Credential(secret_id, secret_key, credentials.token)
: new tencentcloud.common.Credential(secret_id, secret_key)
const httpProfile = new HttpProfile()
httpProfile.reqTimeout = 30
const clientProfile = new ClientProfile('HmacSHA256', httpProfile)
const cam = new AppidClient(cred, 'ap-guangzhou', clientProfile)
const req = new GetUserAppIdResponse()
const body = {}
req.from_json_string(JSON.stringify(body))
const handler = util.promisify(cam.GetUserAppId.bind(cam))
try {
return handler(req)
} catch (e) {
throw 'Get Appid failed! '
}
}
static getClientInfo(secret_id, secret_key, options) {
let cred;
if (options.token)
cred = new Credential(secret_id, secret_key, options.token);
else
cred = new Credential(secret_id, secret_key);
const httpProfile = new HttpProfile();
httpProfile.reqTimeout = 30;
const clientProfile = new ClientProfile('HmacSHA256', httpProfile);
assert(options.region, 'region should not is empty');
return {
"cred": cred,
"region": options.region,
"clientProfile": clientProfile
}
}
getAppid(credentials) {
const secret_id = credentials.SecretId
const secret_key = credentials.SecretKey
const cred = credentials.token
? new tencentcloud.common.Credential(secret_id, secret_key, credentials.token)
: new tencentcloud.common.Credential(secret_id, secret_key)
const httpProfile = new HttpProfile()
httpProfile.reqTimeout = 30
const clientProfile = new ClientProfile('HmacSHA256', httpProfile)
const cam = new AppidClient(cred, 'ap-guangzhou', clientProfile)
const req = new GetUserAppIdResponse()
const body = {}
req.from_json_string(JSON.stringify(body))
const handler = util.promisify(cam.GetUserAppId.bind(cam))
try {
return handler(req)
} catch (e) {
throw 'Get Appid failed! '
}
}