Class: Conjur::Environment
- Inherits:
-
RestClient::Resource
- Object
- RestClient::Resource
- Conjur::Environment
- Includes:
- ActsAsAsset
- Defined in:
- lib/conjur/environment.rb
Instance Method Summary collapse
- #add_variable(name, variableid) ⇒ Object
- #remove_variable(name) ⇒ Object
- #variable(name) ⇒ Object
- #variables ⇒ Object
Instance Method Details
#add_variable(name, variableid) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/conjur/environment.rb', line 5 def add_variable(name, variableid) log do |logger| logger << "Adding variable #{name} = #{variableid} to environment #{id}" end invalidate do RestClient::Resource.new(self['variables'].url, ).post(name: name, variableid: variableid) end end |
#remove_variable(name) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/conjur/environment.rb', line 14 def remove_variable(name) log do |logger| logger << "Removing variable #{name} from enviroment #{id}" end invalidate do RestClient::Resource.new(self["variables/#{fully_escape name}"].url, self.).delete end end |
#variable(name) ⇒ Object
23 24 25 26 27 |
# File 'lib/conjur/environment.rb', line 23 def variable(name) variableid = attributes['variables'][name] raise ArgumentError, "No variable '#{name}' for environment '#{id}'" unless variableid Conjur::Variable.new(Conjur::Core::API.host, self.)["variables/#{fully_escape variableid}"] end |