constructor()

in ts/src/client.ts [56:113]


  constructor(config: $OpenApiUtil.Config) {
    if ($dara.isNull(config)) {
      throw new $_error.ClientError({
        code: "ParameterMissing",
        message: "'config' can not be unset",
      });
    }

    if ((!$dara.isNull(config.accessKeyId) && config.accessKeyId != "") && (!$dara.isNull(config.accessKeySecret) && config.accessKeySecret != "")) {
      if (!$dara.isNull(config.securityToken) && config.securityToken != "") {
        config.type = "sts";
      } else {
        config.type = "access_key";
      }

      let credentialConfig = new $Credential.Config({
        accessKeyId: config.accessKeyId,
        type: config.type,
        accessKeySecret: config.accessKeySecret,
      });
      credentialConfig.securityToken = config.securityToken;
      this._credential = new Credential(credentialConfig);
    } else if (!$dara.isNull(config.bearerToken) && config.bearerToken != "") {
      let cc = new $Credential.Config({
        type: "bearer",
        bearerToken: config.bearerToken,
      });
      this._credential = new Credential(cc);
    } else if (!$dara.isNull(config.credential)) {
      this._credential = config.credential;
    }

    this._endpoint = config.endpoint;
    this._endpointType = config.endpointType;
    this._network = config.network;
    this._suffix = config.suffix;
    this._protocol = config.protocol;
    this._method = config.method;
    this._regionId = config.regionId;
    this._userAgent = config.userAgent;
    this._readTimeout = config.readTimeout;
    this._connectTimeout = config.connectTimeout;
    this._httpProxy = config.httpProxy;
    this._httpsProxy = config.httpsProxy;
    this._noProxy = config.noProxy;
    this._socks5Proxy = config.socks5Proxy;
    this._socks5NetWork = config.socks5NetWork;
    this._maxIdleConns = config.maxIdleConns;
    this._signatureVersion = config.signatureVersion;
    this._signatureAlgorithm = config.signatureAlgorithm;
    this._globalParameters = config.globalParameters;
    this._key = config.key;
    this._cert = config.cert;
    this._ca = config.ca;
    this._disableHttp2 = config.disableHttp2;
    this._retryOptions = config.retryOptions;
    this._tlsMinVersion = config.tlsMinVersion;
  }