Class: SDM::Token
- Inherits:
-
Object
- Object
- SDM::Token
- Defined in:
- lib/models/porcelain.rb
Overview
A Token is an account providing tokenized access for automation or integration use. Tokens include admin tokens, API keys, and SCIM tokens.
Instance Attribute Summary collapse
-
#account_type ⇒ Object
Corresponds to the type of token, e.g.
-
#deadline ⇒ Object
The timestamp when the Token will expire.
-
#duration ⇒ Object
Duration from token creation to expiration.
-
#id ⇒ Object
Unique identifier of the Token.
-
#name ⇒ Object
Unique human-readable name of the Token.
-
#permissions ⇒ Object
Permissions assigned to the token, e.g.
-
#rekeyed ⇒ Object
The timestamp when the Token was last rekeyed.
-
#suspended ⇒ Object
Reserved for future use.
-
#tags ⇒ Object
Tags is a map of key, value pairs.
Instance Method Summary collapse
-
#initialize(account_type: nil, deadline: nil, duration: nil, id: nil, name: nil, permissions: nil, rekeyed: nil, suspended: nil, tags: nil) ⇒ Token
constructor
A new instance of Token.
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(account_type: nil, deadline: nil, duration: nil, id: nil, name: nil, permissions: nil, rekeyed: nil, suspended: nil, tags: nil) ⇒ Token
Returns a new instance of Token.
12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 |
# File 'lib/models/porcelain.rb', line 12669 def initialize( account_type: nil, deadline: nil, duration: nil, id: nil, name: nil, permissions: nil, rekeyed: nil, suspended: nil, tags: nil ) @account_type = account_type == nil ? "" : account_type @deadline = deadline == nil ? nil : deadline @duration = duration == nil ? nil : duration @id = id == nil ? "" : id @name = name == nil ? "" : name @permissions = == nil ? [] : @rekeyed = rekeyed == nil ? nil : rekeyed @suspended = suspended == nil ? false : suspended @tags = == nil ? SDM::() : end |
Instance Attribute Details
#account_type ⇒ Object
Corresponds to the type of token, e.g. api or admin-token.
12651 12652 12653 |
# File 'lib/models/porcelain.rb', line 12651 def account_type @account_type end |
#deadline ⇒ Object
The timestamp when the Token will expire.
12653 12654 12655 |
# File 'lib/models/porcelain.rb', line 12653 def deadline @deadline end |
#duration ⇒ Object
Duration from token creation to expiration.
12655 12656 12657 |
# File 'lib/models/porcelain.rb', line 12655 def duration @duration end |
#id ⇒ Object
Unique identifier of the Token.
12657 12658 12659 |
# File 'lib/models/porcelain.rb', line 12657 def id @id end |
#name ⇒ Object
Unique human-readable name of the Token.
12659 12660 12661 |
# File 'lib/models/porcelain.rb', line 12659 def name @name end |
#permissions ⇒ Object
Permissions assigned to the token, e.g. role:create.
12661 12662 12663 |
# File 'lib/models/porcelain.rb', line 12661 def @permissions end |
#rekeyed ⇒ Object
The timestamp when the Token was last rekeyed.
12663 12664 12665 |
# File 'lib/models/porcelain.rb', line 12663 def rekeyed @rekeyed end |
#suspended ⇒ Object
Reserved for future use. Always false for tokens.
12665 12666 12667 |
# File 'lib/models/porcelain.rb', line 12665 def suspended @suspended end |
#tags ⇒ Object
Tags is a map of key, value pairs.
12667 12668 12669 |
# File 'lib/models/porcelain.rb', line 12667 def @tags end |
Instance Method Details
#to_json(options = {}) ⇒ Object
12691 12692 12693 12694 12695 12696 12697 |
# File 'lib/models/porcelain.rb', line 12691 def to_json( = {}) hash = {} self.instance_variables.each do |var| hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var end hash.to_json end |