Class: Conjur::WebService

Inherits:
RestClient::Resource
  • Object
show all
Includes:
ActsAsAsset
Defined in:
lib/conjur/web_service.rb

Instance Method Summary collapse

Instance Method Details

#add_client(member) ⇒ Object



11
12
13
# File 'lib/conjur/web_service.rb', line 11

def add_client(member)
  RestClient::Resource.new(self["clients"].url, self.options).post(id: member)
end

#clientsObject



5
6
7
8
9
# File 'lib/conjur/web_service.rb', line 5

def clients
  self.attributes['clients'].map do |roleid|
    Role.new(Conjur::Authz::API.host, self.options)[Conjur::API.parse_role_id(roleid).join('/')]
  end
end

#credential(version = nil) ⇒ Object



23
24
25
26
27
# File 'lib/conjur/web_service.rb', line 23

def credential(version=nil)
  url = 'credential'
  url << "?version=#{version}" if version
  self[url].get.body
end

#credential=(value) ⇒ Object



29
30
31
# File 'lib/conjur/web_service.rb', line 29

def credential=(value)
  self["credential"].put(value)
end

#credential_variableObject



19
20
21
# File 'lib/conjur/web_service.rb', line 19

def credential_variable
  Conjur::Variable.new(Conjur::Core::API.host, self.options)["variables/#{credentialid}"]
end

#credentialidObject



33
34
35
# File 'lib/conjur/web_service.rb', line 33

def credentialid
  attributes['credentialid']
end

#remove_client(member) ⇒ Object



15
16
17
# File 'lib/conjur/web_service.rb', line 15

def remove_client(member)
  RestClient::Resource.new(self["clients/#{fully_escape member}"].url, self.options).delete
end

#validate_url(url) ⇒ Object



37
38
39
# File 'lib/conjur/web_service.rb', line 37

def validate_url(url)
  self["validate_url?url=#{query_escape url}"].get
end