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.



16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
# File 'lib/models/porcelain.rb', line 16002

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.



15984
15985
15986
# File 'lib/models/porcelain.rb', line 15984

def 
  @account_type
end

#deadlineObject

The timestamp when the Token will expire.



15986
15987
15988
# File 'lib/models/porcelain.rb', line 15986

def deadline
  @deadline
end

#durationObject

Duration from token creation to expiration.



15988
15989
15990
# File 'lib/models/porcelain.rb', line 15988

def duration
  @duration
end

#idObject

Unique identifier of the Token.



15990
15991
15992
# File 'lib/models/porcelain.rb', line 15990

def id
  @id
end

#nameObject

Unique human-readable name of the Token.



15992
15993
15994
# File 'lib/models/porcelain.rb', line 15992

def name
  @name
end

#permissionsObject

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



15994
15995
15996
# File 'lib/models/porcelain.rb', line 15994

def permissions
  @permissions
end

#rekeyedObject

The timestamp when the Token was last rekeyed.



15996
15997
15998
# File 'lib/models/porcelain.rb', line 15996

def rekeyed
  @rekeyed
end

#suspendedObject

Reserved for future use. Always false for tokens.



15998
15999
16000
# File 'lib/models/porcelain.rb', line 15998

def suspended
  @suspended
end

#tagsObject

Tags is a map of key, value pairs.



16000
16001
16002
# File 'lib/models/porcelain.rb', line 16000

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



16024
16025
16026
16027
16028
16029
16030
# File 'lib/models/porcelain.rb', line 16024

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