class Fog::Compute::OneAndOne::Real

Public Class Methods

new(options = {}) click to toggle source
# File lib/oneandone/compute.rb, line 253
def initialize(options = {})

  @oneandone_api_key = options[:oneandone_api_key]
  @base_url = 'https://cloudpanel-api.1and1.com'
  @version = '/v1'
  @header = {
    'X-TOKEN' => @oneandone_api_key,
    'Content-Type' => 'application/json'
  }
  @connection = Fog::Core::Connection.new(@base_url)

end

Public Instance Methods

access() click to toggle source

Returns the credentials for accessing the shared storages URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages_access_get]

# File lib/oneandone/requests/compute/access.rb, line 11
def access
  
  params = {
    'method' => :get,
    'endpoint' => '/shared_storages/access'
  }

  request(params)

end
add_block_storage_server(block_storage_id: nil, server_id: nil) click to toggle source

Attach a server to a block storage URL: [cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#block_storages__block_storage_id__server_post]

# File lib/oneandone/requests/compute/add_block_storage_server.rb, line 11
def add_block_storage_server(block_storage_id: nil, server_id: nil)

  # Build POST body
  add_server = {
    'server_id' => server_id
  }

  # Stringify the POST body
  string_body = Fog::JSON.encode(add_server)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/block_storages/#{block_storage_id}/server",
    'body' => string_body
  }

  request(params)

end
add_firewall(server_id: nil, ip_id: nil, firewall_id: nil) click to toggle source

Add a firewall policy to a server's IP URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_server_id_ips__ip_id__firewall_policy_put]

# File lib/oneandone/requests/compute/add_firewall.rb, line 11
def add_firewall(server_id: nil, ip_id: nil, firewall_id: nil)
  
  # Build PUT body
  firewall_specs = {
    'id' => firewall_id
  }

  # Stringify the PUT body
  string_body = Fog::JSON.encode(firewall_specs)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/servers/#{server_id}/ips/#{ip_id}/firewall_policy",
    'body' => string_body
  }

  request(params)

end
add_firewall_ips(firewall_id: nil, ips: nil) click to toggle source

Add IPs to a firewall policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies__firewall_id__server_ips_post]

# File lib/oneandone/requests/compute/add_firewall_ips.rb, line 11
def add_firewall_ips(firewall_id: nil, ips: nil)
  
  # Build POST body
  new_ips = {
    'server_ips' => ips
  }

  # Clean out null keys in POST body
  body = clean_hash(new_ips)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/firewall_policies/#{firewall_id}/server_ips",
    'body' => string_body
  }

  request(params)

end
add_firewall_rules(firewall_id: nil, rules: nil) click to toggle source

Add new rules to a firewall policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies__firewall_id__rules_post]

# File lib/oneandone/requests/compute/add_firewall_rules.rb, line 11
def add_firewall_rules(firewall_id: nil, rules: nil)
  
  # Build POST body
  new_rules = {
    'rules' => rules
  }

  # Clean out null keys in POST body
  body = clean_hash(new_rules)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/firewall_policies/#{firewall_id}/rules",
    'body' => string_body
  }

  request(params)

end
add_hdds(server_id: nil, hdds: nil) click to toggle source

Add new HDD's to a server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__hardware_hdds_post]

# File lib/oneandone/requests/compute/add_hdds.rb, line 11
def add_hdds(server_id: nil, hdds: nil)
  
  # Build POST body
  new_hdds = {
    'hdds' => hdds
  }

  # Stringify the POST body
  string_body = Fog::JSON.encode(new_hdds)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/servers/#{server_id}/hardware/hdds",
    'body' => string_body
  }

  request(params)

end
add_load_balancer(server_id: nil, ip_id: nil, load_balancer_id: nil) click to toggle source

Add a load balancer to a server's IP URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_server_id_ips__ip_id__load_balancers_post]

# File lib/oneandone/requests/compute/add_load_balancer.rb, line 11
def add_load_balancer(server_id: nil, ip_id: nil,
  load_balancer_id: nil)
  
  # Build POST body
  load_balancer_specs = {
    'load_balancer_id' => load_balancer_id
  }

  # Stringify the POST body
  string_body = Fog::JSON.encode(load_balancer_specs)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/servers/#{server_id}/ips/#{ip_id}/load_balancers",
    'body' => string_body
  }

  request(params)

end
add_load_balancer_ips(load_balancer_id: nil, ips: nil) click to toggle source

Add IPs to a load balancer URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers__load_balancer_id__server_ips_post]

# File lib/oneandone/requests/compute/add_load_balancer_ips.rb, line 11
def add_load_balancer_ips(load_balancer_id: nil, ips: nil)
  
  # Build POST body
  new_ips = {
    'server_ips' => ips
  }

  # Clean out null keys in POST body
  body = clean_hash(new_ips)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/load_balancers/#{load_balancer_id}/server_ips",
    'body' => string_body
  }

  request(params)

end
add_load_balancer_rules(load_balancer_id: nil, rules: nil) click to toggle source

Add rules to a load balancer URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers__load_balancer_id__rules_post]

# File lib/oneandone/requests/compute/add_load_balancer_rules.rb, line 11
def add_load_balancer_rules(load_balancer_id: nil, rules: nil)
  
  # Build POST body
  new_rules = {
    'rules' => rules
  }

  # Clean out null keys in POST body
  body = clean_hash(new_rules)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/load_balancers/#{load_balancer_id}/rules",
    'body' => string_body
  }

  request(params)

end
add_mp_servers(monitoring_policy_id: nil, servers: nil) click to toggle source

Add servers to a monitoring policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies__monitoring_policy_id__servers_post]

# File lib/oneandone/requests/compute/add_mp_servers.rb, line 11
def add_mp_servers(monitoring_policy_id: nil, servers: nil)
  
  # Build POST body
  new_servers = {
    'servers' => servers
  }

  # Stringify the POST body
  string_body = Fog::JSON.encode(new_servers)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/servers",
    'body' => string_body
  }

  request(params)

end
add_ports(monitoring_policy_id: nil, ports: nil) click to toggle source

Add new ports to a monitoring policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies__monitoring_policy_id__ports_post]

# File lib/oneandone/requests/compute/add_ports.rb, line 11
def add_ports(monitoring_policy_id: nil, ports: nil)

  # Build POST body
  new_ports = {
    'ports' => ports
  }

  # Stringify the POST body
  string_body = Fog::JSON.encode(new_ports)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/ports",
    'body' => string_body
  }

  request(params)

end
add_private_network(server_id: nil, private_network_id: nil) click to toggle source

Assigns a private network to the server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__private_networks_post]

# File lib/oneandone/requests/compute/add_private_network.rb, line 11
def add_private_network(server_id: nil, private_network_id: nil)
  
  # Build PUT body
  private_network_specs = {
    'id' => private_network_id
  }

  # Stringify the PUT body
  string_body = Fog::JSON.encode(private_network_specs)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/servers/#{server_id}/private_networks",
    'body' => string_body
  }

  request(params)

end
add_private_network_servers(private_network_id: nil, servers: nil) click to toggle source

Add servers to a private network URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#private_networks__private_network_id__servers_post]

# File lib/oneandone/requests/compute/add_private_network_servers.rb, line 11
def add_private_network_servers(private_network_id: nil, servers: nil)
  
  # Build POST body
  new_servers = {
    'servers' => servers
  }

  # Clean out null keys in POST body
  body = clean_hash(new_servers)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/private_networks/#{private_network_id}/servers",
    'body' => string_body
  }

  request(params)

end
add_processes(monitoring_policy_id: nil, processes: nil) click to toggle source

Add new processes to a monitoring policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies__monitoring_policy_id__processes_post]

# File lib/oneandone/requests/compute/add_processes.rb, line 11
def add_processes(monitoring_policy_id: nil, processes: nil)

  # Build POST body
  new_processes = {
    'processes' => processes
  }

  # Stringify the POST body
  string_body = Fog::JSON.encode(new_processes)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/processes",
    'body' => string_body
  }

  request(params)

end
add_server_ip(server_id: nil, type: nil) click to toggle source

Add a new IP to the server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__ips_post]

# File lib/oneandone/requests/compute/add_server_ip.rb, line 11
def add_server_ip(server_id: nil, type: nil)
  
  # Build POST body
  ip_specs = {
    'type' => type
  }

  # Clean out null keys in POST body
  body = clean_hash(ip_specs)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/servers/#{server_id}/ips",
    'body' => string_body
  }

  request(params)

end
add_shared_storage_servers(shared_storage_id: nil, servers: nil) click to toggle source

Add servers to a shared storage URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages__shared_storage_id__servers_post]

# File lib/oneandone/requests/compute/add_shared_storage_servers.rb, line 11
def add_shared_storage_servers(shared_storage_id: nil, servers: nil)

  # Build POST body
  add_servers = {
    'servers' => servers
  }

  # Stringify the POST body
  string_body = Fog::JSON.encode(add_servers)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/shared_storages/#{shared_storage_id}/servers",
    'body' => string_body
  }

  request(params)

end
change_password(password) click to toggle source

Returns the credentials for accessing the shared storages URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages_access_get]

# File lib/oneandone/requests/compute/change_password.rb, line 11
def change_password(password)
  
  # Create PUT body
  new_password = {
    'password' => password
  }

  # Stringify the PUT body
  string_body = Fog::JSON.encode(new_password)

  # Request
  params = {
    'method' => :put,
    'endpoint' => '/shared_storages/access',
    'body' => string_body
  }

  request(params)

end
change_status(server_id: nil, action: nil, method: nil) click to toggle source

Change a server's status URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__status_action_put]

# File lib/oneandone/requests/compute/change_status.rb, line 11
def change_status(server_id: nil, action: nil, method: nil)
  
  # Build PUT body
  status_specs = {
    'action' => action,
    'method' => method
  }

  # Stringify the PUT body
  string_body = Fog::JSON.encode(status_specs)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/servers/#{server_id}/status/action",
    'body' => string_body
  }

  request(params)

end
clean_hash(hash) click to toggle source
# File lib/oneandone/compute.rb, line 292
def clean_hash(hash)

  # Clear Out null Values
  hash.each do |key, value|
    if value == nil
      hash.delete(key)
    end
  end

end
clone_server(server_id: nil, name: nil, datacenter_id: nil) click to toggle source

Clone a server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__clone_post]

# File lib/oneandone/requests/compute/clone_server.rb, line 11
def clone_server(server_id: nil, name: nil, datacenter_id: nil)
  
  # Build PUT body
  clone_specs = {
    'name' => name,
    'datacenter_id' => datacenter_id
  }

  # Stringify the PUT body
  string_body = Fog::JSON.encode(clone_specs)

  # Request
  params = {
    'method' => :post,
    'endpoint' => "/servers/#{server_id}/clone",
    'body' => string_body
  }

  request(params)

end
create_block_storage(name: nil, description: nil, size: nil, datacenter_id: nil, server_id: nil) click to toggle source

Creates a new block storage URL: [cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#block_storages_post]

# File lib/oneandone/requests/compute/create_block_storage.rb, line 11
def create_block_storage(name: nil, description: nil,
  size: nil, datacenter_id: nil, server_id: nil)

  # Build POST body
  new_block_storage = {
    'name' => name,
    'description' => description,
    'size' => size,
    'datacenter_id' => datacenter_id,
    'server' => server_id
  }

  # Clean out null values from POST body
  body = clean_hash(new_block_storage)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => '/block_storages',
    'body' => string_body
  }

  request(params)

end
create_firewall(name: nil, description: nil, rules: nil) click to toggle source

Creates a new firewall policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies_post]

# File lib/oneandone/requests/compute/create_firewall.rb, line 11
def create_firewall(name: nil, description: nil, rules: nil)

  # Build POST body
  new_firewall = {
    'name' => name,
    'description' => description,
    'rules' => rules
  }

  # Clean out null values from POST body
  body = clean_hash(new_firewall)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => '/firewall_policies',
    'body' => string_body
  }

  request(params)

end
create_image(server_id: nil, name: nil, description: nil, frequency: nil, num_images: nil, source: nil, url: nil, os_id: nil, type: nil) click to toggle source

Creates a new image URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#images_post]

# File lib/oneandone/requests/compute/create_image.rb, line 11
def create_image(server_id: nil, name: nil, description: nil,
  frequency: nil, num_images: nil, source: nil, url: nil,
  os_id: nil, type: nil)

  # Build POST body
  new_image = {
    'server_id' => server_id,
    'name' => name,
    'description' => description,
    'frequency' => frequency,
    'num_images' => num_images,
    'source' => source,
    'url' => url,
    'os_id' => os_id,
    'type' => type
  }

  # Clean out null values from POST body
  body = clean_hash(new_image)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => '/images',
    'body' => string_body
  }

  request(params)

end
create_load_balancer(name: nil, description: nil, health_check_test: nil, health_check_interval: nil, persistence: nil, persistence_time: nil, method: nil, rules: nil, health_check_path: nil, health_check_parse: nil, datacenter_id: nil) click to toggle source

Create a new load balancer URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers_post]

# File lib/oneandone/requests/compute/create_load_balancer.rb, line 11
def create_load_balancer(name: nil, description: nil,
  health_check_test: nil, health_check_interval: nil, persistence: nil,
  persistence_time: nil, method: nil, rules: nil,
  health_check_path: nil, health_check_parse: nil, datacenter_id: nil)

  # Build POST body
  new_load_balancer = {
    'name' => name,
    'description' => description,
    'health_check_test' => health_check_test,
    'health_check_interval' => health_check_interval,
    'persistence' => persistence,
    'persistence_time' => persistence_time,
    'method' => method,
    'rules' => rules,
    'health_check_path' => health_check_path,
    'health_check_parse' => health_check_parse,
    'datacenter_id' => datacenter_id
  }

  # Clean out null keys in POST body
  body = clean_hash(new_load_balancer)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => '/load_balancers',
    'body' => string_body
  }

  request(params)

end
create_monitoring_policy(name: nil, description: nil, email: nil, agent: nil, thresholds: nil, ports: nil, processes: nil) click to toggle source

Creates a new monitoring policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies_post]

# File lib/oneandone/requests/compute/create_monitoring_policy.rb, line 11
def create_monitoring_policy(name: nil, description: nil, email: nil,
  agent: nil, thresholds: nil, ports: nil, processes: nil)

  # Build POST body
  new_monitoring_policy = {
    'name' => name,
    'description' => description,
    'email' => email,
    'agent' => agent,
    'thresholds' => thresholds,
    'ports' => ports,
    'processes' => processes
  }

  # Clean out null keys in POST body
  body = clean_hash(new_monitoring_policy)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => '/monitoring_policies',
    'body' => string_body
  }

  request(params)

end
create_private_network(name: nil, description: nil, network_address: nil, subnet_mask: nil, datacenter_id: nil) click to toggle source

Create a new private network URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#private_networks_post]

# File lib/oneandone/requests/compute/create_private_network.rb, line 11
def create_private_network(name: nil, description: nil,
  network_address: nil, subnet_mask: nil, datacenter_id: nil)
  
  # Build POST body
  new_private_network = {
    'name' => name,
    'description' => description,
    'network_address' => network_address,
    'subnet_mask' => subnet_mask,
    'datacenter_id' => datacenter_id
  }

  # Clean out null keys in POST body
  body = clean_hash(new_private_network)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => '/private_networks',
    'body' => string_body
  }

  request(params)

end
create_public_ip(reverse_dns: nil, type: nil, datacenter_id: nil) click to toggle source

Create a new public IP URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#public_ips_post]

# File lib/oneandone/requests/compute/create_public_ip.rb, line 11
def create_public_ip(reverse_dns: nil, type: nil, datacenter_id: nil)
  
  # Build POST body
  new_ip = {
    'reverse_dns' => reverse_dns,
    'type' => type,
    'datacenter_id' => datacenter_id
  }

  # Clean out null keys in POST body
  body = clean_hash(new_ip)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => '/public_ips',
    'body' => string_body
  }

  request(params)

end
create_server(name: nil, description: nil, rsa_key: nil, fixed_instance_id: nil, vcore: nil, cores_per_processor: nil, ram: nil, appliance_id: nil, datacenter_id: nil, hdds: nil, password: nil, power_on: nil, firewall_id: nil, ip_id: nil, load_balancer_id: nil, monitoring_policy_id: nil, public_key: nil, server_type: nil, baremetal_model_id: nil) click to toggle source

Creates a new server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_post]

# File lib/oneandone/requests/compute/create_server.rb, line 11
def create_server(name: nil, description: nil, rsa_key: nil,
  fixed_instance_id: nil, vcore: nil, cores_per_processor: nil,
  ram: nil, appliance_id: nil, datacenter_id: nil, hdds: nil,
  password: nil, power_on: nil, firewall_id: nil, ip_id: nil,
  load_balancer_id: nil, monitoring_policy_id: nil, public_key: nil,
  server_type: nil, baremetal_model_id: nil)

  # Build hardware hash
  hardware_params = {
    'fixed_instance_size_id' => fixed_instance_id,
    'vcore' => vcore,
    'cores_per_processor' => cores_per_processor,
    'ram' => ram,
    'hdds' => hdds
  }

  # Clean out null values from hardware hash
  hardware = clean_hash(hardware_params)

  # Build POST body
  new_server = {
    'name' => name,
    'description' => description,
    'rsa_key' => rsa_key,
    'hardware' => hardware,
    'appliance_id' => appliance_id,
    'datacenter_id' => datacenter_id,
    'password' => password,
    'power_on' => power_on,
    'firewall_policy_id' => firewall_id,
    'ip_id' => ip_id,
    'load_balancer_id' => load_balancer_id,
    'monitoring_policy_id' => monitoring_policy_id,
    'public_key' => public_key,
    'server_type' => server_type
  }

  new_server['baremetal_model_id'] = baremetal_model_id if baremetal_model_id

  # Clean out null values from POST body
  body = clean_hash(new_server)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => '/servers',
    'body' => string_body
  }

  request(params)

end
create_shared_storage(name: nil, description: nil, size: nil, datacenter_id: nil) click to toggle source

Creates a new shared storage URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages_post]

# File lib/oneandone/requests/compute/create_shared_storage.rb, line 11
def create_shared_storage(name: nil, description: nil,
  size: nil, datacenter_id: nil)

  # Build POST body
  new_shared_storage = {
    'name' => name,
    'description' => description,
    'size' => size,
    'datacenter_id' => datacenter_id
  }

  # Clean out null values from POST body
  body = clean_hash(new_shared_storage)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => '/shared_storages',
    'body' => string_body
  }

  request(params)

end
create_snapshot(server_id) click to toggle source

Create a server snapshot URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__snapshots_post]

# File lib/oneandone/requests/compute/create_snapshot.rb, line 11
def create_snapshot(server_id)
  
  params = {
    'method' => :post,
    'endpoint' => "/servers/#{server_id}/snapshots"
  }

  request(params)

end
create_ssh_key(name: nil, description: nil, public_key: nil) click to toggle source

Creates a new ssh key URL: [cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#ssh_keys_post]

# File lib/oneandone/requests/compute/create_ssh_key.rb, line 11
def create_ssh_key(name: nil, description: nil,
  public_key: nil)

  # Build POST body
  new_ssh_key = {
    'name' => name,
    'description' => description,
    'public_key' => public_key
  }

  # Clean out null values from POST body
  body = clean_hash(new_ssh_key)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => '/ssh_keys',
    'body' => string_body
  }

  request(params)

end
create_vpn(name: nil, description: nil, datacenter_id: nil) click to toggle source

Creates a new VPN URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#vpns_post]

# File lib/oneandone/requests/compute/create_vpn.rb, line 11
def create_vpn(name: nil, description: nil, datacenter_id: nil)

  # Build POST body
  new_vpn = {
    'name' => name,
    'description' => description,
    'datacenter_id' => datacenter_id
  }

  # Clean out null values from POST body
  body = clean_hash(new_vpn)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :post,
    'endpoint' => '/vpns',
    'body' => string_body
  }

  request(params)

end
delete_block_storage(block_storage_id) click to toggle source

Returns information about a block storage URL: cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#block_storages__block_storage_id__delete

# File lib/oneandone/requests/compute/delete_block_storage.rb, line 11
def delete_block_storage(block_storage_id)
  
  params = {
    'method' => :delete,
    'endpoint' => "/block_storages/#{block_storage_id}"
  }

  request(params)

end
delete_firewall(firewall_id) click to toggle source

Delete a firewall policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies__firewall_id__delete]

# File lib/oneandone/requests/compute/delete_firewall.rb, line 11
def delete_firewall(firewall_id)
  
  params = {
    'method' => :delete,
    'endpoint' => "/firewall_policies/#{firewall_id}"
  }

  request(params)

end
delete_firewall_rule(firewall_id: nil, rule_id: nil) click to toggle source

Delete a firewall policy's rule URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies_firewall_id_rules__rule_id__delete]

# File lib/oneandone/requests/compute/delete_firewall_rule.rb, line 11
def delete_firewall_rule(firewall_id: nil, rule_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/firewall_policies/#{firewall_id}/rules/#{rule_id}"
  }

  request(params)

end
delete_hdd(server_id: nil, hdd_id: nil) click to toggle source

Delete a server's HDD URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__hardware_hdds__hdd_id__delete]

# File lib/oneandone/requests/compute/delete_hdd.rb, line 11
def delete_hdd(server_id: nil, hdd_id: nil)

  # Request
  params = {
    'method' => :delete,
    'endpoint' => "/servers/#{server_id}/hardware/hdds/#{hdd_id}"
  }

  request(params)

end
delete_image(image_id) click to toggle source

Delete an image URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#images__image_id__delete]

# File lib/oneandone/requests/compute/delete_image.rb, line 11
def delete_image(image_id)
  
  params = {
    'method' => :delete,
    'endpoint' => "/images/#{image_id}"
  }

  request(params)

end
delete_load_balancer(load_balancer_id) click to toggle source

Deletes a load balancer URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers__load_balancer_id__delete]

# File lib/oneandone/requests/compute/delete_load_balancer.rb, line 11
def delete_load_balancer(load_balancer_id)
  
  params = {
    'method' => :delete,
    'endpoint' => "/load_balancers/#{load_balancer_id}"
  }

  request(params)

end
delete_load_balancer_rule(load_balancer_id: nil, rule_id: nil) click to toggle source

Delete a load balancer's rule URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers_load_balancer_id_rules__rule_id__delete]

# File lib/oneandone/requests/compute/delete_load_balancer_rule.rb, line 11
def delete_load_balancer_rule(load_balancer_id: nil, rule_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/load_balancers/#{load_balancer_id}/rules/#{rule_id}"
  }

  request(params)

end
delete_monitoring_policy(monitoring_policy_id) click to toggle source

Deletes a monitoring policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies__monitoring_policy_id__delete]

# File lib/oneandone/requests/compute/delete_monitoring_policy.rb, line 11
def delete_monitoring_policy(monitoring_policy_id)
  
  params = {
    'method' => :delete,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}"
  }

  request(params)

end
delete_port(monitoring_policy_id: nil, port_id: nil) click to toggle source

Remove a monitoring policy's port URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies_monitoring_policy_id_ports__port_id__delete]

# File lib/oneandone/requests/compute/delete_port.rb, line 11
def delete_port(monitoring_policy_id: nil, port_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/ports/#{port_id}"
  }

  request(params)

end
delete_private_network(private_network_id) click to toggle source

Deletes a private network URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#private_networks__private_network_id__delete]

# File lib/oneandone/requests/compute/delete_private_network.rb, line 11
def delete_private_network(private_network_id)
  
  params = {
    'method' => :delete,
    'endpoint' => "/private_networks/#{private_network_id}"
  }

  request(params)

end
delete_process(monitoring_policy_id: nil, process_id: nil) click to toggle source

Removes a monitoring policy's process URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies_monitoring_policy_id_processes__process_id__delete]

# File lib/oneandone/requests/compute/delete_process.rb, line 11
def delete_process(monitoring_policy_id: nil, process_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/processes/#{process_id}"
  }

  request(params)

end
delete_public_ip(ip_id) click to toggle source

Delete a public IP URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#public_ips__ip_id__delete]

# File lib/oneandone/requests/compute/delete_public_ip.rb, line 11
def delete_public_ip(ip_id)
  
  params = {
    'method' => :delete,
    'endpoint' => "/public_ips/#{ip_id}"
  }

  request(params)

end
delete_server(server_id) click to toggle source

Deletes a server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__delete]

# File lib/oneandone/requests/compute/delete_server.rb, line 11
def delete_server(server_id)
  
  params = {
    'method' => :delete,
    'endpoint' => "/servers/#{server_id}"
  }

  request(params)

end
delete_server_ip(server_id: nil, ip_id: nil) click to toggle source

Delete a server's IP URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_server_id_ips__ip_id__delete]

# File lib/oneandone/requests/compute/delete_server_ip.rb, line 11
def delete_server_ip(server_id: nil, ip_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/servers/#{server_id}/ips/#{ip_id}"
  }

  request(params)

end
delete_shared_storage(shared_storage_id) click to toggle source

Returns information about a shared storage URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages__shared_storage_id__get]

# File lib/oneandone/requests/compute/delete_shared_storage.rb, line 11
def delete_shared_storage(shared_storage_id)
  
  params = {
    'method' => :delete,
    'endpoint' => "/shared_storages/#{shared_storage_id}"
  }

  request(params)

end
delete_snapshot(server_id: nil, snapshot_id: nil) click to toggle source

Removes a snapshot URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_server_id_snapshots__snapshot_id__delete]

# File lib/oneandone/requests/compute/delete_snapshot.rb, line 11
def delete_snapshot(server_id: nil, snapshot_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/servers/#{server_id}/snapshots/#{snapshot_id}"
  }

  request(params)

end
delete_ssh_key(ssh_key_id) click to toggle source

Returns information about a ssh key URL: [cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#ssh_keys__ssh_key_id__delete]

# File lib/oneandone/requests/compute/delete_ssh_key.rb, line 11
def delete_ssh_key(ssh_key_id)
  
  params = {
    'method' => :delete,
    'endpoint' => "/ssh_keys/#{ssh_key_id}"
  }

  request(params)

end
delete_vpn(vpn_id) click to toggle source

Delete a VPN URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#vpns__vpn_id__delete]

# File lib/oneandone/requests/compute/delete_vpn.rb, line 11
def delete_vpn(vpn_id)
  
  params = {
    'method' => :delete,
    'endpoint' => "/vpns/#{vpn_id}"
  }

  request(params)

end
eject_dvd(server_id) click to toggle source

Ejects a DVD from the virtual DVD unit of a server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__dvd_delete]

# File lib/oneandone/requests/compute/eject_dvd.rb, line 11
def eject_dvd(server_id)
  
  params = {
    'method' => :delete,
    'endpoint' => "/servers/#{server_id}/dvd"
  }

  request(params)

end
get_baremetal_model(id) click to toggle source

Returns information about a baremetal model URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#]

# File lib/oneandone/requests/compute/get_baremetal_model.rb, line 9
def get_baremetal_model(id)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/baremetal_models/#{id}"
  }

  request(params)

end
get_block_storage(block_storage_id) click to toggle source

Returns information about a block storage URL: [cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#block_storages__block_storage_id__get]

# File lib/oneandone/requests/compute/get_block_storage.rb, line 11
def get_block_storage(block_storage_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/block_storages/#{block_storage_id}"
  }

  request(params)

end
get_block_storage_server(block_storage_id: nil) click to toggle source

Returns information about a server attached to a block storage URL: [cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#block_storages__block_storage_id__server_get]

# File lib/oneandone/requests/compute/get_block_storage_server.rb, line 11
def get_block_storage_server(block_storage_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/block_storages/#{block_storage_id}/server"
  }

  request(params)

end
get_datacenter(datacenter_id) click to toggle source

Returns information about a datacenter URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#datacenters__datacenter_id__get]

# File lib/oneandone/requests/compute/get_datacenter.rb, line 11
def get_datacenter(datacenter_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/datacenters/#{datacenter_id}"
  }

  request(params)

end
get_dvd(server_id) click to toggle source

Returns information about the DVD loaded into the virtual DVD unit of a server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__dvd_get]

# File lib/oneandone/requests/compute/get_dvd.rb, line 11
def get_dvd(server_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/dvd"
  }

  request(params)

end
get_dvd_iso(dvd_id) click to toggle source

Returns information about an ISO image URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#dvd_isos__id__get]

# File lib/oneandone/requests/compute/get_dvd_iso.rb, line 11
def get_dvd_iso(dvd_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/dvd_isos/#{dvd_id}"
  }

  request(params)

end
get_firewall(firewall_id) click to toggle source

Returns information about a firewall policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies__firewall_id__get]

# File lib/oneandone/requests/compute/get_firewall.rb, line 11
def get_firewall(firewall_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/firewall_policies/#{firewall_id}"
  }

  request(params)

end
get_firewall_ip(firewall_id: nil, ip_id: nil) click to toggle source

Returns information about an IP assigned to a firewall policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies__firewall_id__server_ips__server_ip__get]

# File lib/oneandone/requests/compute/get_firewall_ip.rb, line 11
def get_firewall_ip(firewall_id: nil, ip_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/firewall_policies/#{firewall_id}/server_ips/#{ip_id}"
  }

  request(params)

end
get_firewall_rule(firewall_id: nil, rule_id: nil) click to toggle source

Returns information about a firewall policy's rule URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies_firewall_id_rules__rule_id__get]

# File lib/oneandone/requests/compute/get_firewall_rule.rb, line 11
def get_firewall_rule(firewall_id: nil, rule_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/firewall_policies/#{firewall_id}/rules/#{rule_id}"
  }

  request(params)

end
get_fixed_server(fixed_instance_id) click to toggle source

Returns information about a fixed server option URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_fixed_instance_sizes__fixed_instance_size_id__get]

# File lib/oneandone/requests/compute/get_fixed_server.rb, line 11
def get_fixed_server(fixed_instance_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/fixed_instance_sizes/#{fixed_instance_id}"
  }

  request(params)

end
get_hardware(server_id) click to toggle source

Returns information about a server's current hardware configurations URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__hardware_get]

# File lib/oneandone/requests/compute/get_hardware.rb, line 11
def get_hardware(server_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/hardware"
  }

  request(params)

end
get_hdd(server_id: nil, hdd_id: nil) click to toggle source

Returns information about a server's HDD URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__hardware_hdds__hdd_id__get]

# File lib/oneandone/requests/compute/get_hdd.rb, line 11
def get_hdd(server_id: nil, hdd_id: nil)

  # Request
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/hardware/hdds/#{hdd_id}"
  }

  request(params)

end
get_hdds(server_id) click to toggle source

List a server's HDD's URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__hardware_hdds_get]

# File lib/oneandone/requests/compute/get_hdds.rb, line 11
def get_hdds(server_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/hardware/hdds"
  }

  request(params)

end
get_image(image_id) click to toggle source

Returns information about an image URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#images__image_id__get]

# File lib/oneandone/requests/compute/get_image.rb, line 11
def get_image(image_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/images/#{image_id}"
  }

  request(params)

end
get_load_balancer(load_balancer_id) click to toggle source

Returns information about a load balancer URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers__load_balancer_id__get]

# File lib/oneandone/requests/compute/get_load_balancer.rb, line 11
def get_load_balancer(load_balancer_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/load_balancers/#{load_balancer_id}"
  }

  request(params)

end
get_load_balancer_ip(load_balancer_id: nil, ip_id: nil) click to toggle source

Returns information about an IP assigned to a load balancer URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers__load_balancer_id__server_ips__server_ip__get]

# File lib/oneandone/requests/compute/get_load_balancer_ip.rb, line 11
def get_load_balancer_ip(load_balancer_id: nil, ip_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/load_balancers/#{load_balancer_id}/server_ips/#{ip_id}"
  }

  request(params)

end
get_load_balancer_rule(load_balancer_id: nil, rule_id: nil) click to toggle source

Returns information about a load balancer's rule URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers_load_balancer_id_rules__rule_id__get]

# File lib/oneandone/requests/compute/get_load_balancer_rule.rb, line 11
def get_load_balancer_rule(load_balancer_id: nil, rule_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/load_balancers/#{load_balancer_id}/rules/#{rule_id}"
  }

  request(params)

end
get_log(log_id) click to toggle source

Returns information about a log URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#logs__log_id__get]

# File lib/oneandone/requests/compute/get_log.rb, line 11
def get_log(log_id)

  # Request
  params = {
    'method' => :get,
    'endpoint' => "/logs/#{log_id}"
  }

  request(params)

end
get_monitored_server(server_id: nil, period: 'LAST_24H', start_date: nil, end_date: nil) click to toggle source

Returns information about a monitoring server for a specified time range URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_center__server_id__get]

# File lib/oneandone/requests/compute/get_monitored_server.rb, line 11
def get_monitored_server(server_id: nil, period: 'LAST_24H',
  start_date: nil, end_date: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :period => period,
    :start_date => start_date,
    :end_date => end_date
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => "/monitoring_center/#{server_id}",
    'params' => query
  }

  request(params)

end
get_monitoring_policy(monitoring_policy_id) click to toggle source

Returns information about a monitoring policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies__monitoring_policy_id__get]

# File lib/oneandone/requests/compute/get_monitoring_policy.rb, line 11
def get_monitoring_policy(monitoring_policy_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}"
  }

  request(params)

end
get_mp_server(monitoring_policy_id: nil, server_id: nil) click to toggle source

Returns information about a monitoring policy's server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies_monitoring_policy_id_servers__server_id__get]

# File lib/oneandone/requests/compute/get_mp_server.rb, line 11
def get_mp_server(monitoring_policy_id: nil, server_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/servers/#{server_id}"
  }

  request(params)

end
get_port(monitoring_policy_id: nil, port_id: nil) click to toggle source

Returns information about a monitoring policy's port URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies_monitoring_policy_id_ports__port_id__get]

# File lib/oneandone/requests/compute/get_port.rb, line 11
def get_port(monitoring_policy_id: nil, port_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/ports/#{port_id}"
  }

  request(params)

end
get_private_network(private_network_id) click to toggle source

Returns information about a private network URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#private_networks__private_network_id__get]

# File lib/oneandone/requests/compute/get_private_network.rb, line 11
def get_private_network(private_network_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/private_networks/#{private_network_id}"
  }

  request(params)

end
get_private_network_server(private_network_id: nil, server_id: nil) click to toggle source

Returns information about a private network's server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#private_networks_private_network_id_servers__server_id__get]

# File lib/oneandone/requests/compute/get_private_network_server.rb, line 11
def get_private_network_server(private_network_id: nil, server_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/private_networks/#{private_network_id}/servers/#{server_id}"
  }

  request(params)

end
get_process(monitoring_policy_id: nil, process_id: nil) click to toggle source

Returns information about a monitoring policy's process URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies_monitoring_policy_id_processes__process_id__get]

# File lib/oneandone/requests/compute/get_process.rb, line 11
def get_process(monitoring_policy_id: nil, process_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/processes/#{process_id}"
  }

  request(params)

end
get_public_ip(ip_id) click to toggle source

Returns information about a public IP URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#public_ips__ip_id__get]

# File lib/oneandone/requests/compute/get_public_ip.rb, line 11
def get_public_ip(ip_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/public_ips/#{ip_id}"
  }

  request(params)

end
get_recovery_appliance(appliance_id) click to toggle source

Returns information about a recovery appliance URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#]

# File lib/oneandone/requests/compute/get_recovery_appliance.rb, line 9
def get_recovery_appliance(appliance_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/recovery_appliances/#{appliance_id}"
  }

  request(params)
end
get_server(server_id) click to toggle source

Returns information about a server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__get]

# File lib/oneandone/requests/compute/get_server.rb, line 11
def get_server(server_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}"
  }

  request(params)

end
get_server_appliance(appliance_id) click to toggle source

Returns information about a server appliance URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#server_appliances__id__get]

# File lib/oneandone/requests/compute/get_server_appliance.rb, line 11
def get_server_appliance(appliance_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/server_appliances/#{appliance_id}"
  }

  request(params)

end
get_server_image(server_id) click to toggle source

Returns information about a server's image URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__image_get]

# File lib/oneandone/requests/compute/get_server_image.rb, line 11
def get_server_image(server_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/image"
  }

  request(params)

end
get_server_ip(server_id: nil, ip_id: nil) click to toggle source

Returns information about a server's IP URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_server_id_ips__ip_id__get]

# File lib/oneandone/requests/compute/get_server_ip.rb, line 11
def get_server_ip(server_id: nil, ip_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/ips/#{ip_id}"
  }

  request(params)

end
get_server_private_network(server_id: nil, private_network_id: nil) click to toggle source

Returns information about a server's private network URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__private_networks__private_network_id__get]

# File lib/oneandone/requests/compute/get_server_private_network.rb, line 11
def get_server_private_network(server_id: nil, private_network_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/private_networks/#{private_network_id}"
  }

  request(params)

end
get_shared_storage(shared_storage_id) click to toggle source

Returns information about a shared storage URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages__shared_storage_id__get]

# File lib/oneandone/requests/compute/get_shared_storage.rb, line 11
def get_shared_storage(shared_storage_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/shared_storages/#{shared_storage_id}"
  }

  request(params)

end
get_shared_storage_server(shared_storage_id: nil, server_id: nil) click to toggle source

Returns information about a server attached to a shared storage URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages_shared_storage_id_servers__server_id__get]

# File lib/oneandone/requests/compute/get_shared_storage_server.rb, line 11
def get_shared_storage_server(shared_storage_id: nil, server_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/shared_storages/#{shared_storage_id}/servers/#{server_id}"
  }

  request(params)

end
get_snapshot(server_id) click to toggle source

Returns information about a server's snapshot URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__snapshots_get]

# File lib/oneandone/requests/compute/get_snapshot.rb, line 11
def get_snapshot(server_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/snapshots"
  }

  request(params)

end
get_ssh_key(ssh_key_id) click to toggle source

Returns information about a ssh key URL: [cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#ssh_keys__ssh_key_id__get]

# File lib/oneandone/requests/compute/get_ssh_key.rb, line 11
def get_ssh_key(ssh_key_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/ssh_keys/#{ssh_key_id}"
  }

  request(params)

end
get_vpn(vpn_id) click to toggle source

Returns information about a VPN URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#vpns__vpn_id__get]

# File lib/oneandone/requests/compute/get_vpn.rb, line 11
def get_vpn(vpn_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/vpns/#{vpn_id}"
  }

  request(params)

end
install_server_image(server_id: nil, image_id: nil, password: nil, firewall_id: nil) click to toggle source

Install an image onto a server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__image_put]

# File lib/oneandone/requests/compute/install_server_image.rb, line 11
def install_server_image(server_id: nil, image_id: nil, password: nil,
  firewall_id: nil)
  
  # Build PUT body
  image_specs = {
    'id' => image_id,
    'password' => password,
    'firewall_policy' => {
      'id' => firewall_id
    }
  }

  # Clean out null keys in PUT body
  body = clean_hash(image_specs)

  # Stringify the PUT body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/servers/#{server_id}/image",
    'body' => string_body
  }

  request(params)

end
list_baremetal_models(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all baremetal models URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#]

# File lib/oneandone/requests/compute/list_baremetal_models.rb, line 9
def list_baremetal_models(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/servers/baremetal_models',
    'params' => query
  }

  request(params)
end
list_block_storages(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all block storages on your account URL: [cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#block_storages_get]

# File lib/oneandone/requests/compute/list_block_storages.rb, line 11
def list_block_storages(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/block_storages',
    'params' => query
  }

  request(params)

end
list_datacenters(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all available data centers. URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#datacenters_get]

# File lib/oneandone/requests/compute/list_datacenters.rb, line 11
def list_datacenters(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/datacenters',
    'params' => query
  }

  request(params)

end
list_dvds(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of operative systems and tools that you can load into your virtual DVD unit URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#dvd_isos_get]

# File lib/oneandone/requests/compute/list_dvds.rb, line 11
def list_dvds(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/dvd_isos',
    'params' => query
  }

  request(params)

end
list_firewall_ips(firewall_id) click to toggle source

Returns a list of IPs assigned to a firewall policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies__firewall_id__server_ips_get]

# File lib/oneandone/requests/compute/list_firewall_ips.rb, line 11
def list_firewall_ips(firewall_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/firewall_policies/#{firewall_id}/server_ips"
  }

  request(params)

end
list_firewall_rules(firewall_id) click to toggle source

Returns a list of a firewall policy's rules URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies__firewall_id__rules_get]

# File lib/oneandone/requests/compute/list_firewall_rules.rb, line 11
def list_firewall_rules(firewall_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/firewall_policies/#{firewall_id}/rules"
  }

  request(params)

end
list_firewalls(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all firewall policies on your account URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies_get]

# File lib/oneandone/requests/compute/list_firewalls.rb, line 11
def list_firewalls(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/firewall_policies',
    'params' => query
  }

  request(params)

end
list_fixed_servers() click to toggle source

Returns a list of fixed server options URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_fixed_instance_sizes_get]

# File lib/oneandone/requests/compute/list_fixed_servers.rb, line 11
def list_fixed_servers
  
  params = {
    'method' => :get,
    'endpoint' => '/servers/fixed_instance_sizes'
  }

  request(params)

end
list_images(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all images on your account URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#images_get]

# File lib/oneandone/requests/compute/list_images.rb, line 11
def list_images(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/images',
    'params' => query
  }

  request(params)

end
list_ip_firewalls(server_id: nil, ip_id: nil) click to toggle source

Returns a list of a server's IP's URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__ips_get]

# File lib/oneandone/requests/compute/list_ip_firewalls.rb, line 11
def list_ip_firewalls(server_id: nil, ip_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/ips/#{ip_id}/firewall_policy"
  }

  request(params)

end
list_ip_load_balancers(server_id: nil, ip_id: nil) click to toggle source

Returns a list of a server's IP's URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__ips_get]

# File lib/oneandone/requests/compute/list_ip_load_balancers.rb, line 11
def list_ip_load_balancers(server_id: nil, ip_id: nil)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/ips/#{ip_id}/load_balancers"
  }

  request(params)

end
list_load_balancer_ips(load_balancer_id) click to toggle source

Returns a list of IPs assigned to a load balancer URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers__load_balancer_id__server_ips_get]

# File lib/oneandone/requests/compute/list_load_balancer_ips.rb, line 11
def list_load_balancer_ips(load_balancer_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/load_balancers/#{load_balancer_id}/server_ips"
  }

  request(params)

end
list_load_balancer_rules(load_balancer_id) click to toggle source

Returns a list of a load balancer's rules URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers__load_balancer_id__rules_get]

# File lib/oneandone/requests/compute/list_load_balancer_rules.rb, line 11
def list_load_balancer_rules(load_balancer_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/load_balancers/#{load_balancer_id}/rules"
  }

  request(params)

end
list_load_balancers(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all load balancers on your account URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers_get]

# File lib/oneandone/requests/compute/list_load_balancers.rb, line 11
def list_load_balancers(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/load_balancers',
    'params' => query
  }

  request(params)

end
list_logs(page: nil, per_page: nil, sort: nil, q: nil, fields: nil, period: 'LAST_24H', start_date: nil, end_date: nil) click to toggle source

Returns a list with logs URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#logs_get]

# File lib/oneandone/requests/compute/list_logs.rb, line 11
def list_logs(page: nil, per_page: nil, sort: nil, q: nil, fields: nil,
  period: 'LAST_24H', start_date: nil, end_date: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields,
    :period => period,
    :start_date => start_date,
    :end_date => end_date
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/logs',
    'params' => query
  }

  request(params)

end
list_monitored_servers(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Lists usages and alerts of monitoring servers URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_center_get]

# File lib/oneandone/requests/compute/list_monitored_servers.rb, line 11
def list_monitored_servers(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/monitoring_center',
    'params' => query
  }

  request(params)

end
list_monitoring_policies(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all monitoring policies on your account URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies_get]

# File lib/oneandone/requests/compute/list_monitoring_policies.rb, line 11
def list_monitoring_policies(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/monitoring_policies',
    'params' => query
  }

  request(params)

end
list_mp_servers(monitoring_policy_id) click to toggle source

Returns a list of a monitoring policy's servers URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies__monitoring_policy_id__servers_get]

# File lib/oneandone/requests/compute/list_mp_servers.rb, line 11
def list_mp_servers(monitoring_policy_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/servers"
  }

  request(params)

end
list_ports(monitoring_policy_id) click to toggle source

Returns a list of a monitoring policy's ports URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies__monitoring_policy_id__ports_get]

# File lib/oneandone/requests/compute/list_ports.rb, line 11
def list_ports(monitoring_policy_id)

  # Request
  params = {
    'method' => :get,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/ports"
  }

  request(params)

end
list_private_network_servers(private_network_id) click to toggle source

Returns a list of a private network's servers URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#private_networks__private_network_id__servers_get]

# File lib/oneandone/requests/compute/list_private_network_servers.rb, line 11
def list_private_network_servers(private_network_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/private_networks/#{private_network_id}/servers"
  }

  request(params)

end
list_private_networks(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all private networks on your account URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#private_networks_get]

# File lib/oneandone/requests/compute/list_private_networks.rb, line 11
def list_private_networks(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/private_networks',
    'params' => query
  }

  request(params)

end
list_processes(monitoring_policy_id) click to toggle source

Returns a list of a monitoring policy's processes URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies__monitoring_policy_id__processes_get]

# File lib/oneandone/requests/compute/list_processes.rb, line 11
def list_processes(monitoring_policy_id)

  # Request
  params = {
    'method' => :get,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/processes"
  }

  request(params)

end
list_public_ips(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all public IPs on your account URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#public_ips_get]

# File lib/oneandone/requests/compute/list_public_ips.rb, line 11
def list_public_ips(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/public_ips',
    'params' => query
  }

  request(params)

end
list_recovery_appliances(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of images available for recovering purposes URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#]

# File lib/oneandone/requests/compute/list_recovery_appliances.rb, line 9
def list_recovery_appliances(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)

  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/recovery_appliances',
    'params' => query
  }

  request(params)
end
list_server_appliances(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of appliances that you can use to create a server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#server_appliances_get]

# File lib/oneandone/requests/compute/list_server_appliances.rb, line 11
def list_server_appliances(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/server_appliances',
    'params' => query
  }

  request(params)

end
list_server_ips(server_id) click to toggle source

Returns a list of a server's IP's URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__ips_get]

# File lib/oneandone/requests/compute/list_server_ips.rb, line 11
def list_server_ips(server_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/ips"
  }

  request(params)

end
list_server_private_networks(server_id) click to toggle source

Returns a list of the server's private networks URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__private_networks_get]

# File lib/oneandone/requests/compute/list_server_private_networks.rb, line 11
def list_server_private_networks(server_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/private_networks"
  }

  request(params)

end
list_servers(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all servers on your account URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_get]

# File lib/oneandone/requests/compute/list_servers.rb, line 11
def list_servers(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/servers',
    'params' => query
  }

  request(params)

end
list_shared_storage_servers(shared_storage_id) click to toggle source

Returns a list of the servers attached to a shared storage URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages__shared_storage_id__servers_get]

# File lib/oneandone/requests/compute/list_shared_storage_servers.rb, line 11
def list_shared_storage_servers(shared_storage_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/shared_storages/#{shared_storage_id}/servers"
  }

  request(params)

end
list_shared_storages(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all shared storages on your account URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages_get]

# File lib/oneandone/requests/compute/list_shared_storages.rb, line 11
def list_shared_storages(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/shared_storages',
    'params' => query
  }

  request(params)

end
list_ssh_keys(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all ssh keys on your account URL: [cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#ssh_keys_get]

# File lib/oneandone/requests/compute/list_ssh_keys.rb, line 11
def list_ssh_keys(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/ssh_keys',
    'params' => query
  }

  request(params)

end
list_usages(page: nil, per_page: nil, sort: nil, q: nil, fields: nil, period: 'LAST_24H', start_date: nil, end_date: nil) click to toggle source

Returns a list of your usages URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#usages_get]

# File lib/oneandone/requests/compute/list_usages.rb, line 11
def list_usages(page: nil, per_page: nil, sort: nil, q: nil, fields: nil,
  period: 'LAST_24H', start_date: nil, end_date: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields,
    :period => period,
    :start_date => start_date,
    :end_date => end_date
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/usages',
    'params' => query
  }

  request(params)

end
list_vpns(page: nil, per_page: nil, sort: nil, q: nil, fields: nil) click to toggle source

Returns a list of all VPN's on your account URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#vpns_get]

# File lib/oneandone/requests/compute/list_vpns.rb, line 11
def list_vpns(page: nil, per_page: nil, sort: nil, q: nil,
  fields: nil)
  
  # Build hash for query parameters
  keyword_args = {
    :page => page,
    :per_page => per_page,
    :sort => sort,
    :q => q,
    :fields => fields
  }

  # Clean out null query parameters
  query = clean_hash(keyword_args)

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/vpns',
    'params' => query
  }

  request(params)

end
load_dvd(server_id: nil, dvd_id: nil) click to toggle source

Loads a DVD into the virtual DVD unit of a server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__dvd_put]

# File lib/oneandone/requests/compute/load_dvd.rb, line 11
def load_dvd(server_id: nil, dvd_id: nil)
  
  # Build PUT body
  dvd_specs = {
    'id' => dvd_id
  }

  # Stringify the PUT body
  string_body = Fog::JSON.encode(dvd_specs)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/servers/#{server_id}/dvd",
    'body' => string_body
  }

  request(params)

end
ping() click to toggle source

Returns “PONG” if API is running. URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#ping_get]

# File lib/oneandone/requests/compute/ping.rb, line 11
def ping

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/ping'
  }

  request(params)

end
ping_auth() click to toggle source

Returns “PONG” if API is running and your token is valid. URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#ping_auth_get]

# File lib/oneandone/requests/compute/ping_auth.rb, line 11
def ping_auth

  # Request
  params = {
    'method' => :get,
    'endpoint' => '/ping_auth'
  }

  request(params)

end
remove_block_storage_server(block_storage_id: nil) click to toggle source

Removes a server from a block storage URL: [cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#]

# File lib/oneandone/requests/compute/remove_block_storage_server.rb, line 11
def remove_block_storage_server(block_storage_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/block_storages/#{block_storage_id}/server"
  }

  request(params)

end
remove_firewall(server_id: nil, ip_id: nil) click to toggle source

Remove a firewall policy from a server's IP URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_server_id_ips__ip_id__firewall_policy_delete]

# File lib/oneandone/requests/compute/remove_firewall.rb, line 11
def remove_firewall(server_id: nil, ip_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/servers/#{server_id}/ips/#{ip_id}/firewall_policy"
  }

  request(params)

end
remove_load_balancer(server_id: nil, ip_id: nil, load_balancer_id: nil) click to toggle source

Remove a load balancer from a server's IP URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_server_id_ips__ip_id__load_balancers__load_balancer_id__delete]

# File lib/oneandone/requests/compute/remove_load_balancer.rb, line 11
def remove_load_balancer(server_id: nil, ip_id: nil,
  load_balancer_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/servers/#{server_id}/ips/#{ip_id}/load_balancers/#{load_balancer_id}"
  }

  request(params)

end
remove_load_balancer_ip(load_balancer_id: nil, ip_id: nil) click to toggle source

Removes an IP from a load balancer URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers__load_balancer_id__server_ips__server_ip__delete]

# File lib/oneandone/requests/compute/remove_load_balancer_ip.rb, line 11
def remove_load_balancer_ip(load_balancer_id: nil, ip_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/load_balancers/#{load_balancer_id}/server_ips/#{ip_id}"
  }

  request(params)

end
remove_mp_server(monitoring_policy_id: nil, server_id: nil) click to toggle source

Removes a monitoring policy's server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies_monitoring_policy_id_servers__server_id__delete]

# File lib/oneandone/requests/compute/remove_mp_server.rb, line 11
def remove_mp_server(monitoring_policy_id: nil, server_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/servers/#{server_id}"
  }

  request(params)

end
remove_private_network(server_id: nil, private_network_id: nil) click to toggle source

Remove a server from a private network URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__private_networks__private_network_id__delete]

# File lib/oneandone/requests/compute/remove_private_network.rb, line 11
def remove_private_network(server_id: nil, private_network_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/servers/#{server_id}/private_networks/#{private_network_id}"
  }

  request(params)

end
remove_private_network_server(private_network_id: nil, server_id: nil) click to toggle source

Removes a private network's server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#private_networks_private_network_id_servers__server_id__delete]

# File lib/oneandone/requests/compute/remove_private_network_server.rb, line 11
def remove_private_network_server(private_network_id: nil, server_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/private_networks/#{private_network_id}/servers/#{server_id}"
  }

  request(params)

end
remove_shared_storage_server(shared_storage_id: nil, server_id: nil) click to toggle source

Removes a server from a shared storage URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages_shared_storage_id_servers__server_id__delete]

# File lib/oneandone/requests/compute/remove_shared_storage_server.rb, line 11
def remove_shared_storage_server(shared_storage_id: nil, server_id: nil)
  
  params = {
    'method' => :delete,
    'endpoint' => "/shared_storages/#{shared_storage_id}/servers/#{server_id}"
  }

  request(params)

end
request(params) click to toggle source
# File lib/oneandone/compute.rb, line 266
def request(params)

  # Perform Request
  response = @connection.request(:method => params['method'],
    :path => @version + params['endpoint'],
    :headers => @header,
    :body => params['body'],
    :query => params['params'])

  # Parse body
  response.body = Fog::JSON.decode(response.body)

  # Check for server error
  if response.status == 500
    raise "Internal Server Error.  Please try again."
  end

  # Raise exception if a bad status code is returned
  unless SUCCESS_CODES.include? response.status
    raise response.body
  end

  response

end
restore_snapshot(server_id: nil, snapshot_id: nil) click to toggle source

Restore a snapshot into the server URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers_server_id_snapshots__snapshot_id__put]

# File lib/oneandone/requests/compute/restore_snapshot.rb, line 11
def restore_snapshot(server_id: nil, snapshot_id: nil)
  
  params = {
    'method' => :put,
    'endpoint' => "/servers/#{server_id}/snapshots/#{snapshot_id}"
  }

  request(params)

end
status(server_id) click to toggle source

Returns information about a server's status URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__status_get]

# File lib/oneandone/requests/compute/status.rb, line 11
def status(server_id)
  
  params = {
    'method' => :get,
    'endpoint' => "/servers/#{server_id}/status"
  }

  request(params)

end
update_block_storage(block_storage_id: nil, name: nil, description: nil, size: nil) click to toggle source

Modify a block storage URL: [cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#block_storages__block_storage_id__put]

# File lib/oneandone/requests/compute/update_block_storage.rb, line 11
def update_block_storage(block_storage_id: nil, name: nil,
  description: nil, size: nil)

  # Build PUT body
  new_block_storage = {
    'name' => name,
    'description' => description,
    'size' => size
  }

  # Clean out null values from PUT body
  body = clean_hash(new_block_storage)

  # Stringify the PUT body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/block_storages/#{block_storage_id}",
    'body' => string_body
  }

  request(params)

end
update_firewall(firewall_id: nil, name: nil, description: nil) click to toggle source

Modify a firewall policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#firewall_policies__firewall_id__put]

# File lib/oneandone/requests/compute/update_firewall.rb, line 11
def update_firewall(firewall_id: nil, name: nil, description: nil)
  
  # Build POST body
  new_firewall = {
    'name' => name,
    'description' => description
  }

  # Clean out null keys in POST body
  body = clean_hash(new_firewall)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/firewall_policies/#{firewall_id}",
    'body' => string_body
  }

  request(params)

end
update_hardware(server_id: nil, fixed_instance_id: nil, vcore: nil, cores_per_processor: nil, ram: nil) click to toggle source

Returns information about a server's current hardware configurations URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__hardware_get]

# File lib/oneandone/requests/compute/update_hardware.rb, line 11
def update_hardware(server_id: nil, fixed_instance_id: nil, vcore: nil,
  cores_per_processor: nil, ram: nil)
  
  # Build PUT body
  hardware_specs = {
    'fixed_instance_size_id' => fixed_instance_id,
    'vcore' => vcore,
    'cores_per_processor' => cores_per_processor,
    'ram' => ram
  }

  # Clean out null keys in PUT body
  body = clean_hash(hardware_specs)

  # Stringify the PUT body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/servers/#{server_id}/hardware",
    'body' => string_body
  }

  request(params)

end
update_hdd(server_id: nil, hdd_id: nil, size: nil) click to toggle source

Resize a server's HDD URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__hardware_hdds__hdd_id__put]

# File lib/oneandone/requests/compute/update_hdd.rb, line 11
def update_hdd(server_id: nil, hdd_id: nil, size: nil)

  # Build PUT body
  hdd_specs = {
    'size' => size
  }

  # Stringify the PUT body
  string_body = Fog::JSON.encode(hdd_specs)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/servers/#{server_id}/hardware/hdds/#{hdd_id}",
    'body' => string_body
  }

  request(params)

end
update_image(image_id: nil, name: nil, description: nil, frequency: nil) click to toggle source

Modify an image URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#images__image_id__put]

# File lib/oneandone/requests/compute/update_image.rb, line 11
def update_image(image_id: nil, name: nil, description: nil,
  frequency: nil)

  # Build PUT body
  new_image = {
    'name' => name,
    'description' => description,
    'frequency' => frequency
  }

  # Clean out null values from PUT body
  body = clean_hash(new_image)

  # Stringify the PUT body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/images/#{image_id}",
    'body' => string_body
  }

  request(params)

end
update_load_balancer(load_balancer_id: nil, name: nil, description: nil, health_check_test: nil, health_check_interval: nil, persistence: nil, persistence_time: nil, method: nil, health_check_path: nil, health_check_parse: nil) click to toggle source

Modify a load balancer URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#load_balancers__load_balancer_id__put]

# File lib/oneandone/requests/compute/update_load_balancer.rb, line 11
def update_load_balancer(load_balancer_id: nil, name: nil,
  description: nil, health_check_test: nil, health_check_interval: nil,
  persistence: nil, persistence_time: nil, method: nil,
  health_check_path: nil, health_check_parse: nil)
  
  # Build PUT body
  new_load_balancer = {
    'name' => name,
    'description' => description,
    'health_check_test' => health_check_test,
    'health_check_interval' => health_check_interval,
    'persistence' => persistence,
    'persistence_time' => persistence_time,
    'method' => method,
    'health_check_path' => health_check_path,
    'health_check_parse' => health_check_parse
  }

  # Clean out null keys in PUT body
  body = clean_hash(new_load_balancer)

  # Stringify the POST body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/load_balancers/#{load_balancer_id}",
    'body' => string_body
  }

  request(params)

end
update_monitoring_policy(monitoring_policy_id: nil, name: nil, description: nil, email: nil, thresholds: nil) click to toggle source

Modify a monitoring policy URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies__monitoring_policy_id__put]

# File lib/oneandone/requests/compute/update_monitoring_policy.rb, line 11
def update_monitoring_policy(monitoring_policy_id: nil, name: nil,
  description: nil, email: nil, thresholds: nil)

  # Build PUT body
  modified_mp = {
    'name' => name,
    'description' => description,
    'email' => email,
    'thresholds' => thresholds
  }

  # Clean out null keys in PUT body
  body = clean_hash(modified_mp)

  # Stringify the PUT body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}",
    'body' => string_body
  }

  request(params)

end
update_port(monitoring_policy_id: nil, port_id: nil, new_port: nil) click to toggle source

Modify a monitoring policy's port URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies_monitoring_policy_id_ports__port_id__put]

# File lib/oneandone/requests/compute/update_port.rb, line 11
def update_port(monitoring_policy_id: nil, port_id: nil, new_port: nil)
  
  # Build PUT body
  modified_port = {
    'ports' => new_port
  }

  # Stringify the PUT body
  string_body = Fog::JSON.encode(modified_port)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/ports/#{port_id}",
    'body' => string_body
  }

  request(params)

end
update_private_network(private_network_id: nil, name: nil, description: nil, network_address: nil, subnet_mask: nil) click to toggle source

Modify a private network URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#private_networks__private_network_id__put]

# File lib/oneandone/requests/compute/update_private_network.rb, line 11
def update_private_network(private_network_id: nil, name: nil,
  description: nil, network_address: nil, subnet_mask: nil)
  
  # Build PUT body
  new_private_network = {
    'name' => name,
    'description' => description,
    'network_address' => network_address,
    'subnet_mask' => subnet_mask
  }

  # Clean out null keys in PUT body
  body = clean_hash(new_private_network)

  # Stringify the PUT body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/private_networks/#{private_network_id}",
    'body' => string_body
  }

  request(params)

end
update_process(monitoring_policy_id: nil, process_id: nil, new_process: nil) click to toggle source

Modify a monitoring policy's process URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#monitoring_policies_monitoring_policy_id_processes__process_id__put]

# File lib/oneandone/requests/compute/update_process.rb, line 11
def update_process(monitoring_policy_id: nil, process_id: nil,
  new_process: nil)
  
  # Build PUT body
  modified_process = {
    'processes' => new_process
  }

  # Stringify the PUT body
  string_body = Fog::JSON.encode(modified_process)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/monitoring_policies/#{monitoring_policy_id}/processes/#{process_id}",
    'body' => string_body
  }

  request(params)

end
update_public_ip(ip_id: nil, reverse_dns: nil) click to toggle source

Modify a public IP URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#public_ips__ip_id__put]

# File lib/oneandone/requests/compute/update_public_ip.rb, line 11
def update_public_ip(ip_id: nil, reverse_dns: nil)
  
  # Build PUT body
  update_ip = {
    'reverse_dns' => reverse_dns
  }

  # Stringify the PUT body
  string_body = Fog::JSON.encode(update_ip)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/public_ips/#{ip_id}",
    'body' => string_body
  }

  request(params)

end
update_server(server_id: nil, name: nil, description: nil) click to toggle source

Update a server's specs URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#servers__server_id__put]

# File lib/oneandone/requests/compute/update_server.rb, line 11
def update_server(server_id: nil, name: nil, description: nil)
  
  # Build PUT body
  server_specs = {
    'name' => name,
    'description' => description
  }

  # Clean out null keys in PUT body
  body = clean_hash(server_specs)

  # Stringify the PUT body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/servers/#{server_id}",
    'body' => string_body
  }

  request(params)

end
update_shared_storage(shared_storage_id: nil, name: nil, description: nil, size: nil) click to toggle source

Modify a shared storage URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#shared_storages__shared_storage_id__put]

# File lib/oneandone/requests/compute/update_shared_storage.rb, line 11
def update_shared_storage(shared_storage_id: nil, name: nil,
  description: nil, size: nil)

  # Build PUT body
  new_shared_storage = {
    'name' => name,
    'description' => description,
    'size' => size
  }

  # Clean out null values from PUT body
  body = clean_hash(new_shared_storage)

  # Stringify the PUT body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/shared_storages/#{shared_storage_id}",
    'body' => string_body
  }

  request(params)

end
update_ssh_key(ssh_key_id: nil, name: nil, description: nil) click to toggle source

Modify a ssh key URL: [cloudpanel-api.1and1.com/documentation/v1/en/api/documentation.html#ssh_keys__ssh_key_id__put]

# File lib/oneandone/requests/compute/update_ssh_key.rb, line 11
def update_ssh_key(ssh_key_id: nil, name: nil,
  description: nil)

  # Build PUT body
  new_ssh_key = {
    'name' => name,
    'description' => description
  }

  # Clean out null values from PUT body
  body = clean_hash(new_ssh_key)

  # Stringify the PUT body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/ssh_keys/#{ssh_key_id}",
    'body' => string_body
  }

  request(params)

end
update_vpn(vpn_id: nil, name: nil, description: nil) click to toggle source

Modify a VPN URL: [cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#vpns__vpn_id__put]

# File lib/oneandone/requests/compute/update_vpn.rb, line 11
def update_vpn(vpn_id: nil, name: nil, description: nil)

  # Build PUT body
  new_vpn = {
    'name' => name,
    'description' => description
  }

  # Clean out null values from PUT body
  body = clean_hash(new_vpn)

  # Stringify the PUT body
  string_body = Fog::JSON.encode(body)

  # Request
  params = {
    'method' => :put,
    'endpoint' => "/vpns/#{vpn_id}",
    'body' => string_body
  }

  request(params)

end