Class: SDM::Token

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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.



12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
# File 'lib/models/porcelain.rb', line 12806

def initialize(
  account_type: nil,
  deadline: nil,
  duration: nil,
  id: nil,
  name: nil,
  permissions: nil,
  rekeyed: nil,
  suspended: nil,
  tags: nil
)
  @account_type =  == nil ? "" : 
  @deadline = deadline == nil ? nil : deadline
  @duration = duration == nil ? nil : duration
  @id = id == nil ? "" : id
  @name = name == nil ? "" : name
  @permissions = permissions == nil ? [] : permissions
  @rekeyed = rekeyed == nil ? nil : rekeyed
  @suspended = suspended == nil ? false : suspended
  @tags = tags == nil ? SDM::_porcelain_zero_value_tags() : tags
end

Instance Attribute Details

#account_typeObject

Corresponds to the type of token, e.g. api or admin-token.



12788
12789
12790
# File 'lib/models/porcelain.rb', line 12788

def 
  @account_type
end

#deadlineObject

The timestamp when the Token will expire.



12790
12791
12792
# File 'lib/models/porcelain.rb', line 12790

def deadline
  @deadline
end

#durationObject

Duration from token creation to expiration.



12792
12793
12794
# File 'lib/models/porcelain.rb', line 12792

def duration
  @duration
end

#idObject

Unique identifier of the Token.



12794
12795
12796
# File 'lib/models/porcelain.rb', line 12794

def id
  @id
end

#nameObject

Unique human-readable name of the Token.



12796
12797
12798
# File 'lib/models/porcelain.rb', line 12796

def name
  @name
end

#permissionsObject

Permissions assigned to the token, e.g. role:create.



12798
12799
12800
# File 'lib/models/porcelain.rb', line 12798

def permissions
  @permissions
end

#rekeyedObject

The timestamp when the Token was last rekeyed.



12800
12801
12802
# File 'lib/models/porcelain.rb', line 12800

def rekeyed
  @rekeyed
end

#suspendedObject

Reserved for future use. Always false for tokens.



12802
12803
12804
# File 'lib/models/porcelain.rb', line 12802

def suspended
  @suspended
end

#tagsObject

Tags is a map of key, value pairs.



12804
12805
12806
# File 'lib/models/porcelain.rb', line 12804

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



12828
12829
12830
12831
12832
12833
12834
# File 'lib/models/porcelain.rb', line 12828

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end