How to use the tencentcloud-sdk-nodejs/tencentcloud/common/profile/client_profile.js function in tencentcloud-sdk-nodejs

To help you get started, we’ve selected a few tencentcloud-sdk-nodejs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github serverless-components / tencent-cam-policy / serverless.js View on Github external
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)
  }
github serverless-tencent / serverless-tencent-scf / shared / handler.js View on Github external
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
		}
	}
github serverless-tencent / serverless-tencent-scf / provider / tencentProvider.js View on Github external
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! '
		}
	}
github serverless-components / tencent-cos / serverless.js View on Github external
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! '
    }
  }
github serverless-components / tencent-scf / serverless.js View on Github external
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! '
    }
  }