module Conjur::API::Router::V5
V5
translates method arguments to rest-ful API
request parameters. because of this, most of the methods suffer from :reek:LongParameterList: and :reek:UtilityFunction:
Public Instance Methods
authentication_providers(account, authenticator, credentials)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 67 def authentication_providers(account, authenticator, credentials) RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )[fully_escape authenticator][fully_escape account]['providers'] end
authenticator(account, authenticator, service_id, credentials)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 53 def authenticator account, authenticator, service_id, credentials RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )[fully_escape authenticator][fully_escape service_id][fully_escape account] end
authenticator_authenticate(account, service_id, authenticator, options)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 46 def authenticator_authenticate(account, service_id, authenticator, options) RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.rest_client_options )[fully_escape authenticator][fully_escape service_id][fully_escape account]['authenticate'][options_querystring options] end
authenticators()
click to toggle source
# File lib/conjur/api/router/v5.rb, line 60 def authenticators RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.rest_client_options )['authenticators'] end
authn_authenticate(account, username)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 39 def authn_authenticate account, username RestClient::Resource.new( Conjur.configuration.authn_url, Conjur.configuration.rest_client_options )[fully_escape account][fully_escape username]['authenticate'] end
authn_authenticate_local(username, account, expiration, cidr, &block)
click to toggle source
For v5, the authn-local message is a JSON string with account, sub, and optional fields.
# File lib/conjur/api/router/v5.rb, line 75 def authn_authenticate_local username, account, expiration, cidr, &block { account: account, sub: username }.tap do |params| params[:exp] = expiration if expiration params[:cidr] = cidr if cidr end.to_json end
authn_login(account, username, password)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 29 def authn_login account, username, password RestClient::Resource.new( Conjur.configuration.authn_url, Conjur.configuration.create_rest_client_options( user: username, password: password ) )[fully_escape account]['login'] end
authn_rotate_api_key(credentials, account, id)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 92 def authn_rotate_api_key credentials, account, id RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )['authn'][fully_escape account]["api_key?role=#{id}"] end
authn_rotate_own_api_key(account, username, password)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 99 def authn_rotate_own_api_key account, username, password RestClient::Resource.new( Conjur.configuration.authn_url, Conjur.configuration.create_rest_client_options( user: username, password: password ) )[fully_escape account]['api_key'] end
authn_update_password(account, username, password)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 82 def authn_update_password account, username, password RestClient::Resource.new( Conjur.configuration.authn_url, Conjur.configuration.create_rest_client_options( user: username, password: password ) )[fully_escape account]['password'] end
group_attributes(credentials, resource, id)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 212 def group_attributes credentials, resource, id resource_annotations resource end
host_factory_create_host(token)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 109 def host_factory_create_host token http_options = { headers: { authorization: %Q(Token token="#{token}") } } RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(http_options) )["host_factories"]["hosts"] end
host_factory_create_tokens(credentials, id)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 119 def host_factory_create_tokens credentials, id RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )['host_factory_tokens'] end
host_factory_revoke_token(credentials, token)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 126 def host_factory_revoke_token credentials, token RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )['host_factory_tokens'][token] end
ldap_sync_policy(credentials, config_name)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 246 def ldap_sync_policy(credentials, config_name) RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )['ldap-sync']["policy?config_name=#{fully_escape(config_name)}"] end
parse_group_gidnumber(attributes)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 224 def parse_group_gidnumber attributes HasAttributes.annotation_value attributes, 'conjur/gidnumber' end
parse_members(credentials, result)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 240 def parse_members credentials, result result.map do |json| RoleGrant.parse_from_json(json, credentials) end end
parse_user_uidnumber(attributes)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 228 def parse_user_uidnumber attributes HasAttributes.annotation_value attributes, 'conjur/uidnumber' end
parse_variable_kind(attributes)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 232 def parse_variable_kind attributes HasAttributes.annotation_value attributes, 'conjur/kind' end
parse_variable_mime_type(attributes)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 236 def parse_variable_mime_type attributes HasAttributes.annotation_value attributes, 'conjur/mime_type' end
policies_load_policy(credentials, account, id)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 133 def policies_load_policy credentials, account, id RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )['policies'][fully_escape account]['policy'][fully_escape id] end
public_keys_for_user(account, username)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 140 def public_keys_for_user account, username RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.rest_client_options )['public_keys'][fully_escape account]['user'][fully_escape username] end
resources(credentials, account, kind, options)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 147 def resources credentials, account, kind, options credentials ||= {} path = "/resources/#{fully_escape account}" path += "/#{fully_escape kind}" if kind RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )[path][options_querystring options] end
resources_check(credentials, id, privilege, role)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 173 def resources_check credentials, id, privilege, role options = {} options[:check] = true options[:privilege] = privilege options[:role] = query_escape(Id.new(role)) if role resources_resource(credentials, id)[options_querystring options].get end
resources_permitted_roles(credentials, id, privilege)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 166 def resources_permitted_roles credentials, id, privilege options = {} options[:permitted_roles] = true options[:privilege] = privilege resources_resource(credentials, id)[options_querystring options] end
resources_resource(credentials, id)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 159 def resources_resource credentials, id RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )['resources'][id.to_url_path] end
roles_role(credentials, id)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 181 def roles_role credentials, id RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )['roles'][id.to_url_path] end
secrets_add(credentials, id)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 188 def secrets_add credentials, id RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )['secrets'][id.to_url_path] end
secrets_value(credentials, id, options)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 195 def secrets_value credentials, id, options RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )['secrets'][id.to_url_path][options_querystring options] end
secrets_values(credentials, variable_ids)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 202 def secrets_values credentials, variable_ids options = { variable_ids: Array(variable_ids).join(',') } RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )['secrets'][options_querystring(options).gsub("%2C", ',')] end
user_attributes(credentials, resource, id)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 220 def user_attributes credentials, resource, id resource_annotations resource end
variable_attributes(credentials, resource, id)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 216 def variable_attributes credentials, resource, id resource_annotations resource end
whoami(credentials)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 253 def whoami(credentials) RestClient::Resource.new( Conjur.configuration.core_url, Conjur.configuration.create_rest_client_options(credentials) )['whoami'] end
Private Instance Methods
resource_annotations(resource)
click to toggle source
# File lib/conjur/api/router/v5.rb, line 262 def resource_annotations resource resource.attributes['annotations'] end