UNPKG

tencentcloud-sdk-nodejs-intl-en

Version:
128 lines (104 loc) 5.32 kB
/* * Copyright (c) 2018 Tencent. All Rights Reserved. * * 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 models = require("./models"); const AbstractClient = require('../../common/abstract_client') const AssumeRoleWithSAMLResponse = models.AssumeRoleWithSAMLResponse; const GetCallerIdentityResponse = models.GetCallerIdentityResponse; const AssumeRoleWithWebIdentityRequest = models.AssumeRoleWithWebIdentityRequest; const AssumeRoleWithWebIdentityResponse = models.AssumeRoleWithWebIdentityResponse; const GetFederationTokenResponse = models.GetFederationTokenResponse; const AssumeRoleResponse = models.AssumeRoleResponse; const GetFederationTokenRequest = models.GetFederationTokenRequest; const Tag = models.Tag; const Credentials = models.Credentials; const AssumeRoleRequest = models.AssumeRoleRequest; const GetCallerIdentityRequest = models.GetCallerIdentityRequest; const AssumeRoleWithSAMLRequest = models.AssumeRoleWithSAMLRequest; /** * sts client * @class */ class StsClient extends AbstractClient { constructor(credential, region, profile) { super("sts.intl.tencentcloudapi.com", "2018-08-13", credential, region, profile); } /** * This API is used to provide instructions. This API is used to return a set of temporary access credentials. A typical application scenario is for proxy applications to centrally request temporary access credentials and distribute them to other distributed terminal applications within the enterprise network, such as terminal applications uploading files to COS. This API only supports calls with permanent keys. This API is used to implement best practices. 1. This API is used to recommend reusing temporary access credentials within their validity period to avoid rate limiting due to increased business request rates. 2. This API is used to recommend granting temporary access credentials with the principle of least privilege. 3. This API is used to recommend not using the root account for permanent keys calling the API. * @param {GetFederationTokenRequest} req * @param {function(string, GetFederationTokenResponse):void} cb * @public */ GetFederationToken(req, cb) { let resp = new GetFederationTokenResponse(); this.request("GetFederationToken", req, resp, cb); } /** * This API is used to request temporary access credentials for a role based on a SAML assertion. Note: When called with signature method v3, header `X-TC-Token` could be ignored, and `Authorization` should be SKIP. * @param {AssumeRoleWithSAMLRequest} req * @param {function(string, AssumeRoleWithSAMLResponse):void} cb * @public */ AssumeRoleWithSAML(req, cb) { let resp = new AssumeRoleWithSAMLResponse(); this.request("AssumeRoleWithSAML", req, resp, cb); } /** * This API is used to request temporary access credentials for assuming a role. This API is used to describe the composition of role policies. This API is used to specify the role trust policy, which defines who can assume the role. This API is used to specify the role permission policy, which defines what actions can be performed after assuming the role. This API is used to describe the conditions under which a role can be assumed. This API is used to bind a policy that allows a user to call AssumeRole. This API is used to add a user as a principal in the role trust policy. * @param {AssumeRoleRequest} req * @param {function(string, AssumeRoleResponse):void} cb * @public */ AssumeRole(req, cb) { let resp = new AssumeRoleResponse(); this.request("AssumeRole", req, resp, cb); } /** * This API is used to get the identity information of the current caller. This API is used to get the identity information using the persistent keys of the root account and sub-account as well as the temporary credentials generated by AssumeRole and GetFederationToken. * @param {GetCallerIdentityRequest} req * @param {function(string, GetCallerIdentityResponse):void} cb * @public */ GetCallerIdentity(req, cb) { let resp = new GetCallerIdentityResponse(); this.request("GetCallerIdentity", req, resp, cb); } /** * This API is used to apply for an OIDC role credential. Note: When called with signature method v3, header `X-TC-Token` could be ignored, and `Authorization` should be SKIP. * @param {AssumeRoleWithWebIdentityRequest} req * @param {function(string, AssumeRoleWithWebIdentityResponse):void} cb * @public */ AssumeRoleWithWebIdentity(req, cb) { let resp = new AssumeRoleWithWebIdentityResponse(); this.request("AssumeRoleWithWebIdentity", req, resp, cb); } } module.exports = StsClient;