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.
-
#created_at ⇒ Object
CreatedAt is the timestamp when the token was created.
-
#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, created_at: 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, created_at: nil, deadline: nil, duration: nil, id: nil, name: nil, permissions: nil, rekeyed: nil, suspended: nil, tags: nil) ⇒ Token
Returns a new instance of Token.
18134 18135 18136 18137 18138 18139 18140 18141 18142 18143 18144 18145 18146 18147 18148 18149 18150 18151 18152 18153 18154 18155 18156 |
# File 'lib/models/porcelain.rb', line 18134 def initialize( account_type: nil, created_at: nil, deadline: nil, duration: nil, id: nil, name: nil, permissions: nil, rekeyed: nil, suspended: nil, tags: nil ) @account_type = account_type == nil ? "" : account_type @created_at = created_at == nil ? nil : created_at @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.
18114 18115 18116 |
# File 'lib/models/porcelain.rb', line 18114 def account_type @account_type end |
#created_at ⇒ Object
CreatedAt is the timestamp when the token was created
18116 18117 18118 |
# File 'lib/models/porcelain.rb', line 18116 def created_at @created_at end |
#deadline ⇒ Object
The timestamp when the Token will expire.
18118 18119 18120 |
# File 'lib/models/porcelain.rb', line 18118 def deadline @deadline end |
#duration ⇒ Object
Duration from token creation to expiration.
18120 18121 18122 |
# File 'lib/models/porcelain.rb', line 18120 def duration @duration end |
#id ⇒ Object
Unique identifier of the Token.
18122 18123 18124 |
# File 'lib/models/porcelain.rb', line 18122 def id @id end |
#name ⇒ Object
Unique human-readable name of the Token.
18124 18125 18126 |
# File 'lib/models/porcelain.rb', line 18124 def name @name end |
#permissions ⇒ Object
Permissions assigned to the token, e.g. role:create.
18126 18127 18128 |
# File 'lib/models/porcelain.rb', line 18126 def @permissions end |
#rekeyed ⇒ Object
The timestamp when the Token was last rekeyed.
18128 18129 18130 |
# File 'lib/models/porcelain.rb', line 18128 def rekeyed @rekeyed end |
#suspended ⇒ Object
Reserved for future use. Always false for tokens.
18130 18131 18132 |
# File 'lib/models/porcelain.rb', line 18130 def suspended @suspended end |
#tags ⇒ Object
Tags is a map of key, value pairs.
18132 18133 18134 |
# File 'lib/models/porcelain.rb', line 18132 def @tags end |
Instance Method Details
#to_json(options = {}) ⇒ Object
18158 18159 18160 18161 18162 18163 18164 |
# File 'lib/models/porcelain.rb', line 18158 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 |