class Conjur::HostFactoryToken

Public Class Methods

new(data, credentials) click to toggle source
# File lib/conjur/host_factory_token.rb, line 23
def initialize data, credentials
  @data = data
  @credentials = credentials
end

Public Instance Methods

==(other) click to toggle source
# File lib/conjur/host_factory_token.rb, line 70
def ==(other)
  other.class == self.class &&
    other.token == self.token &&
    other.expiration == self.expiration &&
    other.cidr == self.cidr
end
cidr() click to toggle source

Gets the CIDR restriction.

@return [String]

# File lib/conjur/host_factory_token.rb, line 61
def cidr
  @data['cidr']
end
expiration() click to toggle source

Gets the expiration.

@return [DateTime]

# File lib/conjur/host_factory_token.rb, line 54
def expiration
  DateTime.iso8601(@data['expiration'])
end
revoke() click to toggle source

Revokes the token, after which it cannot be used any more.

# File lib/conjur/host_factory_token.rb, line 66
def revoke
  Conjur::API.revoke_host_factory_token @credentials, token
end
to_json(options = {}) click to toggle source

Convert the object to JSON.

Fields:

  • token

  • expiration

  • cidr

# File lib/conjur/host_factory_token.rb, line 35
def to_json(options = {})
  { token: token, expiration: expiration, cidr: cidr }
end
to_s() click to toggle source

Format the token as a string, using JSON format.

# File lib/conjur/host_factory_token.rb, line 40
def to_s
  to_json.to_s
end
token() click to toggle source

Gets the token string.

@return [String]

# File lib/conjur/host_factory_token.rb, line 47
def token
  @data['token']
end