Class: ConsulToken

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/provider/consul_token/default.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(accessor_id, secret_id, description, policies) ⇒ ConsulToken

Returns a new instance of ConsulToken.



98
99
100
101
102
103
# File 'lib/puppet/provider/consul_token/default.rb', line 98

def initialize(accessor_id, secret_id, description, policies)
  @accessor_id = accessor_id
  @secret_id = secret_id
  @description = description
  @policies = policies
end

Instance Attribute Details

#accessor_idObject (readonly)

Returns the value of attribute accessor_id.



96
97
98
# File 'lib/puppet/provider/consul_token/default.rb', line 96

def accessor_id
  @accessor_id
end

#descriptionObject

Returns the value of attribute description.



95
96
97
# File 'lib/puppet/provider/consul_token/default.rb', line 95

def description
  @description
end

#policiesObject

Returns the value of attribute policies.



95
96
97
# File 'lib/puppet/provider/consul_token/default.rb', line 95

def policies
  @policies
end

#secret_idObject (readonly)

Returns the value of attribute secret_id.



96
97
98
# File 'lib/puppet/provider/consul_token/default.rb', line 96

def secret_id
  @secret_id
end

Instance Method Details

#is_policy_list_equal(policies_by_id, policies_by_name) ⇒ Object



105
106
107
108
109
110
111
112
113
# File 'lib/puppet/provider/consul_token/default.rb', line 105

def is_policy_list_equal(policies_by_id, policies_by_name)
  total_length = (policies_by_id.length + policies_by_name.length)
  return false if @policies.length != total_length

  actual_policies_by_id = @policies.map(&:policy_id)
  actual_policies_by_name = @policies.map(&:policy_name)

  (policies_by_id - actual_policies_by_id).empty? && (policies_by_name - actual_policies_by_name).empty?
end