Class: TencentCloud::Common::Credential

Inherits:
Object
  • Object
show all
Defined in:
lib/tencentcloud-sdk-common/credential.rb

Overview

common credential

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(secret_id, secret_key, token = nil) ⇒ Credential

Returns a new instance of Credential.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tencentcloud-sdk-common/credential.rb', line 9

def initialize(secret_id, secret_key, token = nil)
  if secret_id.nil? || secret_id.strip.empty?
    raise TencentCloudSDKException.new('InvalidCredential', 'secret id should not be none or empty')
  elsif secret_id.strip != secret_id
    raise TencentCloudSDKException.new('InvalidCredential', 'secret id should not contain spaces')
  end

  @secret_id = secret_id

  if secret_key.nil? || secret_key.strip.empty?
    raise TencentCloudSDKException.new('InvalidCredential', 'secret id should not be none or empty')
  elsif secret_key.strip != secret_key
    raise TencentCloudSDKException.new('InvalidCredential', 'secret id should not contain spaces')
  end

  @secret_key = secret_key
  @token = token
end

Instance Attribute Details

#secret_idObject

Returns the value of attribute secret_id.



7
8
9
# File 'lib/tencentcloud-sdk-common/credential.rb', line 7

def secret_id
  @secret_id
end

#secret_keyObject

Returns the value of attribute secret_key.



7
8
9
# File 'lib/tencentcloud-sdk-common/credential.rb', line 7

def secret_key
  @secret_key
end

#tokenObject

Returns the value of attribute token.



7
8
9
# File 'lib/tencentcloud-sdk-common/credential.rb', line 7

def token
  @token
end

Instance Method Details

#credentialObject



28
29
30
# File 'lib/tencentcloud-sdk-common/credential.rb', line 28

def credential
  [@secret_id, @secret_key, @token]
end