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
permalink #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.
12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 |
# File 'lib/models/porcelain.rb', line 12735 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
permalink #account_type ⇒ Object
Corresponds to the type of token, e.g. api or admin-token.
12717 12718 12719 |
# File 'lib/models/porcelain.rb', line 12717 def account_type @account_type end |
permalink #deadline ⇒ Object
The timestamp when the Token will expire.
12719 12720 12721 |
# File 'lib/models/porcelain.rb', line 12719 def deadline @deadline end |
permalink #duration ⇒ Object
Duration from token creation to expiration.
12721 12722 12723 |
# File 'lib/models/porcelain.rb', line 12721 def duration @duration end |
permalink #id ⇒ Object
Unique identifier of the Token.
12723 12724 12725 |
# File 'lib/models/porcelain.rb', line 12723 def id @id end |
permalink #name ⇒ Object
Unique human-readable name of the Token.
12725 12726 12727 |
# File 'lib/models/porcelain.rb', line 12725 def name @name end |
permalink #permissions ⇒ Object
Permissions assigned to the token, e.g. role:create.
12727 12728 12729 |
# File 'lib/models/porcelain.rb', line 12727 def @permissions end |
permalink #rekeyed ⇒ Object
The timestamp when the Token was last rekeyed.
12729 12730 12731 |
# File 'lib/models/porcelain.rb', line 12729 def rekeyed @rekeyed end |
permalink #suspended ⇒ Object
Reserved for future use. Always false for tokens.
12731 12732 12733 |
# File 'lib/models/porcelain.rb', line 12731 def suspended @suspended end |
permalink #tags ⇒ Object
Tags is a map of key, value pairs.
12733 12734 12735 |
# File 'lib/models/porcelain.rb', line 12733 def @tags end |
Instance Method Details
permalink #to_json(options = {}) ⇒ Object
[View source]
12757 12758 12759 12760 12761 12762 12763 |
# File 'lib/models/porcelain.rb', line 12757 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 |