Class: Fog::Proxmox::Identity::Real

Inherits:
Object
  • Object
show all
Includes:
Core
Defined in:
lib/fog/identity/proxmox.rb,
lib/fog/identity/proxmox/requests/get_pool.rb,
lib/fog/identity/proxmox/requests/get_role.rb,
lib/fog/identity/proxmox/requests/get_user.rb,
lib/fog/identity/proxmox/requests/get_group.rb,
lib/fog/identity/proxmox/requests/get_domain.rb,
lib/fog/identity/proxmox/requests/list_pools.rb,
lib/fog/identity/proxmox/requests/list_roles.rb,
lib/fog/identity/proxmox/requests/list_users.rb,
lib/fog/identity/proxmox/requests/create_pool.rb,
lib/fog/identity/proxmox/requests/create_role.rb,
lib/fog/identity/proxmox/requests/create_user.rb,
lib/fog/identity/proxmox/requests/delete_pool.rb,
lib/fog/identity/proxmox/requests/delete_role.rb,
lib/fog/identity/proxmox/requests/delete_user.rb,
lib/fog/identity/proxmox/requests/list_groups.rb,
lib/fog/identity/proxmox/requests/update_pool.rb,
lib/fog/identity/proxmox/requests/update_role.rb,
lib/fog/identity/proxmox/requests/update_user.rb,
lib/fog/identity/proxmox/requests/create_group.rb,
lib/fog/identity/proxmox/requests/delete_group.rb,
lib/fog/identity/proxmox/requests/list_domains.rb,
lib/fog/identity/proxmox/requests/read_version.rb,
lib/fog/identity/proxmox/requests/update_group.rb,
lib/fog/identity/proxmox/requests/create_domain.rb,
lib/fog/identity/proxmox/requests/delete_domain.rb,
lib/fog/identity/proxmox/requests/update_domain.rb,
lib/fog/identity/proxmox/requests/change_password.rb,
lib/fog/identity/proxmox/requests/list_permissions.rb,
lib/fog/identity/proxmox/requests/check_permissions.rb,
lib/fog/identity/proxmox/requests/update_permissions.rb

Overview

class Real update_permissions request

Instance Attribute Summary

Attributes included from Core

#deadline, #principal, #pve_csrftoken, #pve_ticket, #pve_username

Instance Method Summary collapse

Methods included from Core

#credentials, #initialize_identity, not_found_class, #reload

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/fog/identity/proxmox.rb', line 105

def initialize(options = {})
  initialize_identity(options)
  @connection_options = options[:connection_options] || {}
  @path_prefix = URI.parse(options[:pve_url]).path
  authenticate
  @persistent = options[:persistent] || false
  url = "#{@scheme}://#{@host}:#{@port}"
  if ENV.has_key?('SSL_VERIFY_PEER')
    Excon.defaults[:ssl_verify_peer] = Fog::Proxmox::String.to_boolean(ENV['SSL_VERIFY_PEER'])
  end
  @connection = Fog::Core::Connection.new(url, @persistent, @connection_options.merge(path_prefix: @path_prefix))
end

Instance Method Details

#change_password(userid, password) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/fog/identity/proxmox/requests/change_password.rb', line 26

def change_password(userid, password)
  request(
    expects: [200],
    method: 'PUT',
    path: 'access/password',
    body: URI.encode_www_form(userid: userid, password: password)
  )
end

#check_permissions(principal) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/fog/identity/proxmox/requests/check_permissions.rb', line 26

def check_permissions(principal)
  request(
    expects: [200],
    method: 'POST',
    path: 'access/ticket',
    body: URI.encode_www_form(principal)
  )
end

#configObject



118
119
120
# File 'lib/fog/identity/proxmox.rb', line 118

def config
  self
end

#configure(source) ⇒ Object



122
123
124
125
126
# File 'lib/fog/identity/proxmox.rb', line 122

def configure(source)
  source.instance_variables.each do |v|
    instance_variable_set(v, source.instance_variable_get(v))
  end
end

#create_domain(domain) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/create_domain.rb', line 25

def create_domain(domain)
  request(
    expects: [200],
    method: 'POST',
    path: 'access/domains',
    body: URI.encode_www_form(domain)
  )
end

#create_group(group) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/create_group.rb', line 25

def create_group(group)
  request(
    expects: [200],
    method: 'POST',
    path: 'access/groups',
    body: URI.encode_www_form(group)
  )
end

#create_pool(pool) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/create_pool.rb', line 25

def create_pool(pool)
  request(
    expects: [200],
    method: 'POST',
    path: 'pools',
    body: URI.encode_www_form(pool)
  )
end

#create_role(role) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/create_role.rb', line 25

def create_role(role)
  request(
    expects: [200],
    method: 'POST',
    path: 'access/roles',
    body: URI.encode_www_form(role)
  )
end

#create_user(user) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/create_user.rb', line 25

def create_user(user)
  request(
    expects: [200],
    method: 'POST',
    path: 'access/users',
    body: URI.encode_www_form(user)
  )
end

#delete_domain(realm) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/delete_domain.rb', line 26

def delete_domain(realm)
  request(
    expects: [200],
    method: 'DELETE',
    path: "access/domains/#{realm}"
  )
end

#delete_group(groupid) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/delete_group.rb', line 26

def delete_group(groupid)
  request(
    expects: [200],
    method: 'DELETE',
    path: "access/groups/#{groupid}"
  )
end

#delete_pool(poolid) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/fog/identity/proxmox/requests/delete_pool.rb', line 25

def delete_pool(poolid)
  request(
    expects: [200],
    method: 'DELETE',
    path: "pools/#{poolid}"
  )
end

#delete_role(roleid) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/delete_role.rb', line 26

def delete_role(roleid)
  request(
    expects: [200],
    method: 'DELETE',
    path: "access/roles/#{roleid}"
  )
end

#delete_user(userid) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/fog/identity/proxmox/requests/delete_user.rb', line 25

def delete_user(userid)
  request(
    expects: [200],
    method: 'DELETE',
    path: "access/users/#{userid}"
  )
end

#get_domain(realm) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/get_domain.rb', line 26

def get_domain(realm)
  request(
    expects: [200],
    method: 'GET',
    path: "access/domains/#{realm}"
  )
end

#get_group(groupid) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/get_group.rb', line 26

def get_group(groupid)
  request(
    expects: [200],
    method: 'GET',
    path: "access/groups/#{groupid}"
  )
end

#get_pool(poolid) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/get_pool.rb', line 26

def get_pool(poolid)
  request(
    expects: [200],
    method: 'GET',
    path: "pools/#{poolid}"
  )
end

#get_role(roleid) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/get_role.rb', line 26

def get_role(roleid)
  request(
    expects: [200],
    method: 'GET',
    path: "access/roles/#{roleid}"
  )
end

#get_user(userid) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/get_user.rb', line 26

def get_user(userid)
  request(
    expects: [200],
    method: 'GET',
    path: "access/users/#{userid}"
  )
end

#list_domainsObject



26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/list_domains.rb', line 26

def list_domains
  request(
    expects: [200],
    method: 'GET',
    path: 'access/domains'
  )
end

#list_groupsObject



26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/list_groups.rb', line 26

def list_groups
  request(
    expects: [200],
    method: 'GET',
    path: 'access/groups'
  )
end

#list_permissionsObject



26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/list_permissions.rb', line 26

def list_permissions
  request(
    expects: [200],
    method: 'GET',
    path: 'access/acl'
  )
end

#list_poolsObject



26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/list_pools.rb', line 26

def list_pools
  request(
    expects: [200],
    method: 'GET',
    path: 'pools'
  )
end

#list_rolesObject



25
26
27
28
29
30
31
# File 'lib/fog/identity/proxmox/requests/list_roles.rb', line 25

def list_roles
  request(
    expects: [200],
    method: 'GET',
    path: 'access/roles'
  )
end

#list_users(options = {}) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/fog/identity/proxmox/requests/list_users.rb', line 26

def list_users(options = {})
  request(
    expects: [200],
    method: 'GET',
    path: 'access/users',
    query: options
  )
end

#read_versionObject



25
26
27
28
29
30
31
# File 'lib/fog/identity/proxmox/requests/read_version.rb', line 25

def read_version
  request(
    expects: [200],
    method: 'GET',
    path: 'version'
  )
end

#update_domain(realm, attributes) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/fog/identity/proxmox/requests/update_domain.rb', line 26

def update_domain(realm, attributes)
  request(
    expects: [200],
    method: 'PUT',
    path: "access/domains/#{realm}",
    body: URI.encode_www_form(attributes)
  )
end

#update_group(groupid, options) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/fog/identity/proxmox/requests/update_group.rb', line 25

def update_group(groupid, options)
  request(
    expects: [200],
    method: 'PUT',
    path: "access/groups/#{groupid}",
    body: URI.encode_www_form(options)
  )
end

#update_permissions(body_params) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/fog/identity/proxmox/requests/update_permissions.rb', line 26

def update_permissions(body_params)
  request(
    expects: [200],
    method: 'PUT',
    path: 'access/acl',
    body: URI.encode_www_form(body_params)
  )
end

#update_pool(poolid, attributes) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/fog/identity/proxmox/requests/update_pool.rb', line 26

def update_pool(poolid, attributes)
  request(
    expects: [200],
    method: 'PUT',
    path: "pools/#{poolid}",
    body: URI.encode_www_form(attributes)
  )
end

#update_role(roleid, attributes) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/fog/identity/proxmox/requests/update_role.rb', line 26

def update_role(roleid, attributes)
  request(
    expects: [200],
    method: 'PUT',
    path: "access/roles/#{roleid}",
    body: URI.encode_www_form(attributes)
  )
end

#update_user(userid, attributes) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/fog/identity/proxmox/requests/update_user.rb', line 26

def update_user(userid, attributes)
  request(
    expects: [200],
    method: 'PUT',
    path: "access/users/#{userid}",
    body: URI.encode_www_form(attributes)
  )
end