class Fog::Compute::Gridscale::Real

Public Class Methods

new(options={}) click to toggle source
# File lib/fog/compute/gridscale.rb, line 273
def initialize(options={})
  api_token = options[:api_token]
  user_uuid = options[:user_uuid]
  host = options[:host]

  persistent         = false

  options            = {
      headers: {
          'X-Auth-UserId' => "#{user_uuid}",
          'X-Auth-Token' => "#{api_token}",
      }
  }
  if host
    @connection = Fog::Core::Connection.new host, persistent, options
  else
    @connection = Fog::Core::Connection.new 'https://api.gridscale.io', persistent, options
  end

end

Public Instance Methods

access_key_create() click to toggle source
# File lib/fog/compute/gridscale/requests/access_key_create.rb, line 6
def access_key_create()
  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => "/objects/objectstorages/access_keys",
      )
end
access_key_delete(access_key) click to toggle source
# File lib/fog/compute/gridscale/requests/access_key_delete.rb, line 6
def access_key_delete(access_key)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "objects/objectstorages/access_keys/#{access_key}",
      )
end
access_key_get(access_key) click to toggle source
# File lib/fog/compute/gridscale/requests/access_key_get.rb, line 6
def access_key_get(access_key)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "objects/objectstorages/access_keys/#{access_key}"
  )
end
access_keys_get(filters = {}) click to toggle source
# File lib/fog/compute/gridscale/requests/access_keys_get.rb, line 6
def access_keys_get(filters = {})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "objects/objectstorages/access_keys",
      :query   => filters

  )
end
bucket_get(name) click to toggle source
# File lib/fog/compute/gridscale/requests/bucket_get.rb, line 6
def bucket_get(name)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "objects/objectstorages/buckets/#{name}"
  )
end
buckets_get(filter={}) click to toggle source
# File lib/fog/compute/gridscale/requests/buckets_get.rb, line 6
def buckets_get(filter={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "objects/objectstorages/buckets",
      :query   => filter
  )
end
deleted_ips_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/deleted_ips_get.rb, line 6
def deleted_ips_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "objects/deleted/ips",
      :query   => filters
  )
end
deleted_isoimages_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/deleted_isoimages_get.rb, line 6
def deleted_isoimages_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "objects/deleted/isoimages",
      :query   => filters
  )
end
deleted_networks_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/deleted_networks_get.rb, line 6
def deleted_networks_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "objects/deleted/networks",
      :query   => filters
  )
end
deleted_servers_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/deleted_servers_get.rb, line 6
def deleted_servers_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "objects/deleted/servers",
      :query   => filters
  )
end
deleted_snapshots_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/deleted_snapshots_get.rb, line 6
def deleted_snapshots_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "objects/deleted/snapshots",
      :query   => filters
  )
end
deleted_storages_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/deleted_storages_get.rb, line 6
def deleted_storages_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "objects/deleted/storages",
      :query   => filters
  )
end
deleted_templates_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/deleted_templates_get.rb, line 6
def deleted_templates_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "objects/deleted/templates",
      :query   => filters
  )
end
firewall_create(name, rules, options ={}) click to toggle source
# File lib/fog/compute/gridscale/requests/firewall_create.rb, line 6
def firewall_create(name, rules, options ={})

  create_options ={
      :name => name,
      :rules => rules
  }

  create_options[:labels] = options[:labels] || []

  encoded_body = Fog::JSON.encode(create_options)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => '/objects/firewalls',
      :body    => encoded_body,
      )
end
firewall_delete(firewall_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/firewall_delete.rb, line 6
def firewall_delete(firewall_uuid)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/firewalls/#{firewall_uuid}",
      )
end
firewall_events_get(firewall_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/firewall_events_get.rb, line 6
def firewall_events_get(firewall_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/firewalls/#{firewall_uuid}/events"
  )
end
firewall_get(firewall_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/firewall_get.rb, line 6
def firewall_get(firewall_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/firewalls/#{firewall_uuid}"
  )
end
firewall_update(firewall_uuid, payload) click to toggle source
# File lib/fog/compute/gridscale/requests/firewall_update.rb, line 6
def firewall_update(firewall_uuid, payload)

  encoded_body = Fog::JSON.encode(payload)

  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/firewalls/#{firewall_uuid}",
      :body    => encoded_body,
      )
end
firewalls_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/firewalls_get.rb, line 6
def firewalls_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/firewalls",
      :query   => filters
  )
end
ip_create(family, options ={}) click to toggle source
# File lib/fog/compute/gridscale/requests/ip_create.rb, line 6
def ip_create(family, options ={})

  create_options = {
      :family   => family,
  }
  create_options[:labels] = options[:labels] || []

  if options[:name]
    create_options[:name] = options[:name]
  end

  if options[:failover]
    create_options[:failover] = options[:failover]
  end

  if options[:reverse_dns]
    create_options[:reverse_dns] = options[:reverse_dns]
  end

  if options[:location_uuid]
    create_options[:location_uuid] = options[:location_uuid]
  else
    create_options[:location_uuid] = '45ed677b-3702-4b36-be2a-a2eab9827950'
  end
  encoded_body = Fog::JSON.encode(create_options)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => '/objects/ips',
      :body    => encoded_body,
      )
end
ip_delete(ip_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/ip_delete.rb, line 6
def ip_delete(ip_uuid)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/ips/#{ip_uuid}",
      )
end
ip_events_get(ip_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/ip_events_get.rb, line 6
def ip_events_get(ip_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/ips/#{ip_uuid}/events"
  )
end
ip_get(ip_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/ip_get.rb, line 6
def ip_get(ip_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/ips/#{ip_uuid}"
  )
end
ip_update(ip_uuid, payload) click to toggle source
# File lib/fog/compute/gridscale/requests/ip_update.rb, line 6
def ip_update(ip_uuid, payload)

  encoded_body = Fog::JSON.encode(payload)

  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/ips/#{ip_uuid}",
      :body    => encoded_body,
      )
end
ips_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/ips_get.rb, line 6
def ips_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/ips",
      :query   => filters

  )
end
isoimage_create(name, source_url, options) click to toggle source
# File lib/fog/compute/gridscale/requests/isoimage_create.rb, line 6
def isoimage_create(name, source_url, options)

  create_options = {
      :name   => name,
      :source_url => source_url
  }

  create_options[:labels] = options[:labels] || []
  if options[:location_uuid]
    create_options[:location_uuid] = options[:location_uuid]
  else
    create_options[:location_uuid] = '45ed677b-3702-4b36-be2a-a2eab9827950'
  end

  encoded_body = Fog::JSON.encode(create_options)


  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => '/objects/isoimages',
      :body    => encoded_body,
      )
end
isoimage_delete(isoimage_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/isoimage_delete.rb, line 6
def isoimage_delete(isoimage_uuid)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/isoimages/#{isoimage_uuid}",
      )
end
isoimage_events_get(isoimage_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/isoimage_events_get.rb, line 6
def isoimage_events_get(isoimage_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/isoimages/#{isoimage_uuid}/events"
  )
end
isoimage_get(isoimage_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/isoimage_get.rb, line 6
def isoimage_get(isoimage_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/isoimages/#{isoimage_uuid}"
  )
end
isoimage_update(isoimage_uuid, payload) click to toggle source
# File lib/fog/compute/gridscale/requests/isoimage_update.rb, line 6
def isoimage_update(isoimage_uuid, payload)

  encoded_body = Fog::JSON.encode(payload)

  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/isoimages/#{isoimage_uuid}",
      :body    => encoded_body,
      )
end
isoimages_get(filters = {}) click to toggle source
# File lib/fog/compute/gridscale/requests/isoimages_get.rb, line 6
def isoimages_get(filters = {})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/isoimages",
      :query   => filters
  )
end
load_balancer_create(name, algorithm, listen_ipv4_uuid, listen_ipv6_uuid, backend_servers, forwarding_rules, redirect_http_to_https, labels, options={}) click to toggle source
# File lib/fog/compute/gridscale/requests/load_balancer_create.rb, line 6
def load_balancer_create(name, algorithm, listen_ipv4_uuid, listen_ipv6_uuid, backend_servers, forwarding_rules, redirect_http_to_https, labels, options={})
  create_options = {
      :name   => name,
      :algorithm => algorithm,
      :listen_ipv4_uuid => listen_ipv4_uuid,
      :listen_ipv6_uuid => listen_ipv6_uuid,
      :backend_servers => backend_servers,
      :forwarding_rules => forwarding_rules,
      :redirect_http_to_https=>redirect_http_to_https,
      :labels => labels

  }

  if options[:location_uuid]
    create_options[:location_uuid] = options[:location_uuid]
  else
    create_options[:location_uuid] = '45ed677b-3702-4b36-be2a-a2eab9827950'
  end
  encoded_body = Fog::JSON.encode(create_options)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => '/objects/loadbalancers',
      :body    => encoded_body,
      )
end
load_balancer_delete(load_balancer_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/load_balancer_delete.rb, line 6
def load_balancer_delete(load_balancer_uuid)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/loadbalancers/#{load_balancer_uuid}",
      )
end
load_balancer_events_get(load_balancer_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/load_balancer_events_get.rb, line 6
def load_balancer_events_get(load_balancer_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/loadbalancers/#{load_balancer_uuid}/events"
  )
end
load_balancer_get(load_balancer_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/load_balancer_get.rb, line 6
def load_balancer_get(load_balancer_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/loadbalancers/#{load_balancer_uuid}"
  )
end
load_balancer_update(load_balancer_uuid, payload) click to toggle source
# File lib/fog/compute/gridscale/requests/load_balancer_update.rb, line 6
def load_balancer_update(load_balancer_uuid, payload)

  encoded_body = Fog::JSON.encode(payload)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/loadbalancers/#{load_balancer_uuid}",
      :body    => encoded_body,
      )
end
load_balancers_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/load_balancers_get.rb, line 6
def load_balancers_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/loadbalancers",
      :query   => filters
  )
end
location_get(location_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/location_get.rb, line 6
def location_get(location_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/locations/#{location_uuid}"
  )
end
locations_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/locations_get.rb, line 6
def locations_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/locations",
      :query   => filters
  )
end
marketplace_template_create(options={}) click to toggle source
# File lib/fog/compute/gridscale/requests/marketplace_template_create.rb, line 6
def marketplace_template_create(options={})
  create_options = {
  }

  create_options[:labels] = options[:labels] || []

  if options[:name]
    create_options[:name] = options[:name]
  end

  if options[:capacity]
    create_options[:capacity] = options[:capacity]
  end

  if options[:object_storage_path]
    create_options[:object_storage_path] = options[:object_storage_path]
  end

  if options[:object_storage_path]
    create_options[:object_storage_path] = options[:object_storage_path]
  end

  if options[:unique_hash]
    create_options[:unique_hash] = options[:unique_hash]
  end
  encoded_body = Fog::JSON.encode(create_options)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => '/objects/marketplace/templates',
      :body    => encoded_body,
      )
end
marketplace_template_delete(marketplace_template_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/marketplace_template_delete.rb, line 6
def marketplace_template_delete(marketplace_template_uuid)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/marketplace/templates/#{marketplace_template_uuid}",
      )
end
marketplace_template_events_get(marketplace_template_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/marketplace_template_events_get.rb, line 6
def marketplace_template_events_get(marketplace_template_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/marketplace/templates/#{marketplace_template_uuid}/events"
  )
end
marketplace_template_get(marketplace_template_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/marketplace_template_get.rb, line 6
def marketplace_template_get(marketplace_template_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/marketplace/templates/#{marketplace_template_uuid}"
  )
end
marketplace_template_update(marketplace_template_uuid, payload) click to toggle source
# File lib/fog/compute/gridscale/requests/marketplace_template_update.rb, line 6
def marketplace_template_update(marketplace_template_uuid, payload)

  encoded_body = Fog::JSON.encode(payload)

  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/marketplace/templates/#{marketplace_template_uuid}",
      :body    => encoded_body,
      )
end
marketplace_templates_get() click to toggle source
# File lib/fog/compute/gridscale/requests/marketplace_templates_get.rb, line 6
def marketplace_templates_get()
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/marketplace/templates"
  )
end
network_create(name, options={}) click to toggle source
# File lib/fog/compute/gridscale/requests/network_create.rb, line 6
def network_create(name, options={})

  create_options = {
      :name   => name,
  }

  create_options[:labels] = options[:labels] || []

  if options[:l2security]
    create_options[:l2security] = options[:l2security]
  end

  if options[:location_uuid]
    create_options[:location_uuid] = options[:location_uuid]
  else
    create_options[:location_uuid] = '45ed677b-3702-4b36-be2a-a2eab9827950'
  end


  encoded_body = Fog::JSON.encode(create_options)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => '/objects/networks',
      :body    => encoded_body,
      )
end
network_delete(network_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/network_delete.rb, line 6
def network_delete(network_uuid)

  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/networks/#{network_uuid}",
      )
end
network_events_get(network_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/network_events_get.rb, line 6
def network_events_get(network_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/networks/#{network_uuid}/events"
  )
end
network_get(network_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/network_get.rb, line 6
def network_get(network_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/networks/#{network_uuid}"
  )
end
network_update(network_uuid, payload) click to toggle source
# File lib/fog/compute/gridscale/requests/network_update.rb, line 6
def network_update(network_uuid, payload)

  encoded_body = Fog::JSON.encode(payload)

  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/networks/#{network_uuid}",
      :body    => encoded_body,
      )
end
networks_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/networks_get.rb, line 6
def networks_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/networks",
      :query   => filters
  )
end
paas_security_zone_create(name, options = {}) click to toggle source
# File lib/fog/compute/gridscale/requests/paas_security_zone_create.rb, line 6
def paas_security_zone_create(name, options = {})
  create_options = {
      :name   => name,
  }

  create_options[:labels] = options[:labels] || []


  if options[:location_uuid]
    create_options[:location_uuid] = options[:location_uuid]
  else
    create_options[:location_uuid] = '45ed677b-3702-4b36-be2a-a2eab9827950'
  end

  encoded_body = Fog::JSON.encode(create_options)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => '/objects/paas/security_zones',
      :body    => encoded_body,
      )
end
paas_security_zone_delete(paas_security_zone_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/paas_security_zone_delete.rb, line 6
def paas_security_zone_delete(paas_security_zone_uuid)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/paas/security_zones/#{paas_security_zone_uuid}",
      )
end
paas_security_zone_get(paas_security_zone_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/paas_security_zone_get.rb, line 6
def paas_security_zone_get(paas_security_zone_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/paas/security_zones/#{paas_security_zone_uuid}"
  )
end
paas_security_zone_update(paas_security_zone_uuid, payload={}) click to toggle source
# File lib/fog/compute/gridscale/requests/paas_security_zone_update.rb, line 6
def paas_security_zone_update(paas_security_zone_uuid, payload={})

  encoded_body = Fog::JSON.encode(payload)


  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/paas/security_zones/#{paas_security_zone_uuid}",
      :body    => encoded_body,
      )
end
paas_security_zones_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/paas_security_zones_get.rb, line 6
def paas_security_zones_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/paas/security_zones",
      :query   => filters
  )
end
paas_service_create(name, paas_service_template_uuid, options = {}) click to toggle source
# File lib/fog/compute/gridscale/requests/paas_service_create.rb, line 6
def paas_service_create(name, paas_service_template_uuid, options = {})
  create_options = {
      :name   => name,
      :paas_service_template_uuid => paas_service_template_uuid,
  }

  create_options[:labels] = options[:labels] || []

  encoded_body = Fog::JSON.encode(create_options)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => '/objects/paas/services',
      :body    => encoded_body,
      )
end
paas_service_delete(paas_service_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/paas_service_delete.rb, line 6
def paas_service_delete(paas_service_uuid)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/paas/services/#{paas_service_uuid}",
      )
end
paas_service_get(paas_service_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/paas_service_get.rb, line 6
def paas_service_get(paas_service_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/paas/services/#{paas_service_uuid}"
  )
end
paas_service_update(paas_service_uuid, payload={}) click to toggle source
# File lib/fog/compute/gridscale/requests/paas_service_update.rb, line 6
def paas_service_update(paas_service_uuid, payload={})

  encoded_body = Fog::JSON.encode(payload)


  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/paas/services/#{paas_service_uuid}",
      :body    => encoded_body,
      )
end
paas_services_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/paas_services_get.rb, line 6
def paas_services_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/paas/services",
      :query   => filters
  )
end
request(params) click to toggle source
# File lib/fog/compute/gridscale.rb, line 294
def request(params)
  params[:headers] ||= {}
  begin
    response = @connection.request(params)
  rescue Excon::Errors::HTTPStatusError => error
    raise case error.response.body
          when Excon::Errors::NotFound
            NotFound.slurp(error.response.body)
          else
            error.response.body
          end
  end
  unless response.body.empty?
    response.body = Fog::JSON.decode(response.body)
  end
  response
end
request_get(object_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/request_get.rb, line 6
def request_get(object_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/requests/#{object_uuid}"
  )
end
server_create(name, cores, memory, options = {}) click to toggle source
# File lib/fog/compute/gridscale/requests/server_create.rb, line 6
def server_create(name, cores, memory, options = {})

  interfaces_attributes = options[:interfaces_attributes]
  storage = options[:storage]
  template_uuid = options[:template_uuid]
  sshkey_uuid = options[:sshkey_uuid]
  isoimage_uuid = options[:isoimage_uuid]
  if options[:location_uuid]
    location_uuid = options[:location_uuid]
  else
    location_uuid= '45ed677b-3702-4b36-be2a-a2eab9827950'
  end


  relations = {}

  networks = []
  storages = []
  ipaddrs = []
  isoimages = []
  bootable_set = false
  if interfaces_attributes != nil
    interfaces_attributes.each do |key, value|
      if value["network_uuid"] !=nil && value["network_uuid"] != ""
        if bootable_set == false && value["bootable"] == "1"
          networks << {"network_uuid"=>value["network_uuid"], "bootdevice"=>true}
          bootable_set = true
        else
          networks << {"network_uuid"=>value["network_uuid"]}
        end
      end

      if value["ipv4_uuid"] !=nil && value["ipv4_uuid"] != ""
          ipaddrs << {"ipaddr_uuid"=>value["ipv4_uuid"]}
      end

      if value["ipv6_uuid"] !=nil && value["ipv6_uuid"] != ""
        ipaddrs << {"ipaddr_uuid"=>value["ipv6_uuid"]}
      end

    end
  end
  if sshkey_uuid == ""
    sshkey_uuid = nil
  end
  if storage != nil && storage > 0
    if template_uuid !=nil
      storages << {"create"=>{"name"=>"#{name} Storage", "capacity"=>storage, "location_uuid"=>location_uuid,"storage_type"=>"storage","template"=>{"template_uuid"=> template_uuid }} , "relation"=>{"bootdevice"=>true}}

      if sshkey_uuid != nil
        storages = []
        storages << {"create"=>{"name"=>"#{name} Storage", "capacity"=>storage, "location_uuid"=>location_uuid,"storage_type"=>"storage","template"=>{"template_uuid"=> template_uuid, "sshkeys" => [sshkey_uuid] }} , "relation"=>{"bootdevice"=>true}}
      else
        storages = []
        storages << {"create"=>{"name"=>"#{name} Storage", "capacity"=>storage, "location_uuid"=>location_uuid,"storage_type"=>"storage","template"=>{"template_uuid"=> template_uuid}} , "relation"=>{"bootdevice"=>true}}
      end
    else
      storages << {"create"=>{"name"=>"#{name} Storage", "capacity"=>storage, "location_uuid"=>location_uuid,"storage_type"=>"storage"}, "relation"=>{"bootdevice"=>true}}
    end
  end
  if isoimage_uuid != nil && isoimage_uuid != ""
    isoimages = []
    isoimages << {"isoimage_uuid" => isoimage_uuid}
  end
  relations[:networks] = networks
  relations[:storages] = storages
  relations[:public_ips] = ipaddrs
  relations[:isoimages] = isoimages

  create_options = {
      :name   => name,
      :location_uuid => location_uuid,
      :cores   => cores,
      :memory   => memory,
      :relations => relations,
  }

  if options[:labels]
    create_options[:labels] = options[:labels]
  end

  if options[:auto_recovery]
    create_options[:auto_recovery] = options[:auto_recovery]
  end

  if options[:availability_zone]
    create_options[:availability_zone] = options[:availability_zone]
  end

  if options[:hardware_profile]
    create_options[:hardware_profile] = options[:hardware_profile]
  end
  # print create_options
  encoded_body = Fog::JSON.encode(create_options)
  x = request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => '/objects/servers',
      :body    => encoded_body,
      )
  server_uuid = x.body['server_uuid']
  request(
      :expects => [200],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'GET',
      :path    => "/objects/servers/#{server_uuid}",
      )

end
server_delete(server_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_delete.rb, line 6
def server_delete(server_uuid)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/servers/#{server_uuid}",
      )
end
server_events_get(server_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_events_get.rb, line 6
def server_events_get(server_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/servers/#{server_uuid}/events"
  )
end
server_get(server_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_get.rb, line 6
def server_get(server_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/servers/#{server_uuid}"
  )
end
server_power_get(server_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_power_get.rb, line 6
def server_power_get(server_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/servers/#{server_uuid}/power"
  )
end
server_power_off(server_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_power_off.rb, line 6
def server_power_off(server_uuid)
  body = { :power => false }

  encoded_body = Fog::JSON.encode(body)

  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/servers/#{server_uuid}/power",
      :body    => encoded_body,
      )
end
server_power_on(server_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_power_on.rb, line 6
def server_power_on(server_uuid)
  body = { :power => true }

  encoded_body = Fog::JSON.encode(body)

  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/servers/#{server_uuid}/power",
      :body    => encoded_body,
      )
end
server_relation_ip_create(server_uuid, ip_uuid, options = {}) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_ip_create.rb, line 6
def server_relation_ip_create(server_uuid, ip_uuid, options = {})

  create_options = {
      :object_uuid   => ip_uuid,

  }

  if options[:bootdevice]
    create_options[:bootdevice] = options[:bootdevice]
  end

  encoded_body = Fog::JSON.encode(create_options)
  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => "/objects/servers/#{server_uuid}/ips",
      :body    => encoded_body,
      )
end
server_relation_ip_delete(object_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_ip_delete.rb, line 6
def server_relation_ip_delete(object_uuid)
  server_uuid = object_uuid[:server_uuid]
  ip_uuid = object_uuid[:ip_uuid]
  request(
      :expects         => [202],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/servers/#{server_uuid}/ips/#{ip_uuid}",
      )
end
server_relation_ip_get(payload) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_ip_get.rb, line 6
def server_relation_ip_get(payload)
  server_uuid = payload[:server_uuid]
  ip_uuid = payload[:ip_uuid]
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/servers/#{server_uuid}/ips/#{ip_uuid}"
  )
end
server_relation_ips_get(server_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_ips_get.rb, line 6
def server_relation_ips_get(server_uuid)
  server_uuid = server_uuid[:server_uuid]

  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/servers/#{server_uuid}/ips"
  )
end
server_relation_isoimage_create(server_uuid, isoimage_uuid, options = {}) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_isoimage_create.rb, line 6
def server_relation_isoimage_create(server_uuid, isoimage_uuid, options = {})

  create_options = {
      :object_uuid   => isoimage_uuid,

  }
  if options[:bootdevice]
    create_options[:bootdevice] = options[:bootdevice]
  end
  encoded_body = Fog::JSON.encode(create_options)
  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => "/objects/servers/#{server_uuid}/isoimages",
      :body    => encoded_body,
      )
end
server_relation_isoimage_delete(object_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_isoimage_delete.rb, line 6
def server_relation_isoimage_delete(object_uuid)
  server_uuid = object_uuid[:server_uuid]
  isoimage_uuid = object_uuid[:isoimage_uuid]
  request(
      :expects         => [202],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/servers/#{server_uuid}/isoimages/#{isoimage_uuid}",
      )
end
server_relation_isoimage_get(payload) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_isoimage_get.rb, line 6
def server_relation_isoimage_get(payload)
  server_uuid = payload[:server_uuid]
  isoimage_uuid = payload[:isoimage_uuid]
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/servers/#{server_uuid}/isoimages/#{isoimage_uuid}"
  )
end
server_relation_isoimage_update(server_uuid, isoimage_uuid, payload) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_isoimage_update.rb, line 6
def server_relation_isoimage_update(server_uuid, isoimage_uuid, payload)

  encoded_body = Fog::JSON.encode(payload)
  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/servers/#{server_uuid}/isoimages/#{isoimage_uuid}",
      :body    => encoded_body,
      )
end
server_relation_isoimages_get(server_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_isoimages_get.rb, line 6
def server_relation_isoimages_get(server_uuid)
  server_uuid = server_uuid[:server_uuid]

  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/servers/#{server_uuid}/isoimages"
  )
end
server_relation_network_create(server_uuid, network_uuid, options = {}) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_network_create.rb, line 6
def server_relation_network_create(server_uuid, network_uuid, options = {})

  create_options = {
      :object_uuid   => network_uuid,

  }
  if options[:bootdevice]
    create_options[:bootdevice] = options[:bootdevice]
  end

  encoded_body = Fog::JSON.encode(create_options)
  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => "/objects/servers/#{server_uuid}/networks",
      :body    => encoded_body,
      )
end
server_relation_network_delete(object_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_network_delete.rb, line 6
def server_relation_network_delete(object_uuid)

  server_uuid = object_uuid[:server_uuid]
  network_uuid = object_uuid[:network_uuid]

  request(
      :expects         => [202],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/servers/#{server_uuid}/networks/#{network_uuid}",
      )
end
server_relation_network_get(server_uuid, network_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_network_get.rb, line 6
def server_relation_network_get(server_uuid, network_uuid)

  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/servers/#{server_uuid}/networks/#{network_uuid}"
  )
end
server_relation_network_update(server_uuid, network_uuid, payload) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_network_update.rb, line 6
def server_relation_network_update(server_uuid, network_uuid, payload)

  encoded_body = Fog::JSON.encode(payload)
  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/servers/#{server_uuid}/networks/#{network_uuid}",
      :body    => encoded_body,
      )
end
server_relation_networks_get(server_uuid, filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_networks_get.rb, line 6
def server_relation_networks_get(server_uuid, filters={})

  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/servers/#{server_uuid}/networks",
      :query => filters
  )

end
server_relation_storage_create(server_uuid, storage_uuid, options = {}) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_storage_create.rb, line 6
def server_relation_storage_create(server_uuid, storage_uuid, options = {})

  create_options = {
      :object_uuid   => storage_uuid,

  }
  if options[:bootdevice]
    create_options[:bootdevice] = options[:bootdevice]
  end

  encoded_body = Fog::JSON.encode(create_options)
  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => "/objects/servers/#{server_uuid}/storages",
      :body    => encoded_body,
      )
end
server_relation_storage_delete(object_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_storage_delete.rb, line 6
def server_relation_storage_delete(object_uuid)

  server_uuid = object_uuid[:server_uuid]
  storage_uuid = object_uuid[:storage_uuid]

  request(
      :expects         => [202],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/servers/#{server_uuid}/storages/#{storage_uuid}",
      )
end
server_relation_storage_get(payload) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_storage_get.rb, line 6
def server_relation_storage_get(payload)

  server_uuid = payload[:server_uuid]
  storage_uuid = payload[:object_uuid]

  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/servers/#{server_uuid}/storages/#{storage_uuid}"
  )
end
server_relation_storage_update(server_uuid, storage_uuid, options) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_storage_update.rb, line 6
def server_relation_storage_update(server_uuid, storage_uuid, options)

  encoded_body = Fog::JSON.encode(options)
  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/servers/#{server_uuid}/storages/#{storage_uuid}",
      :body    => encoded_body,
      )
end
server_relation_storages_get(server_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_relation_storages_get.rb, line 6
def server_relation_storages_get(server_uuid)

  server_uuid = server_uuid[:server_uuid]

  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/servers/#{server_uuid}/storages"
  )
end
server_shutdown(server_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/server_shutdown.rb, line 6
def server_shutdown(server_uuid)
  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/servers/#{server_uuid}/shutdown",
      )
end
server_update(server_uuid, payload) click to toggle source
# File lib/fog/compute/gridscale/requests/server_update.rb, line 6
def server_update(server_uuid, payload)

  encoded_body = Fog::JSON.encode(payload)

  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/servers/#{server_uuid}",
      :body    => encoded_body,
      )
end
servers_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/servers_get.rb, line 6
def servers_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/servers",
      :query   => filters
  )
end
snapshot_create(storage_uuid, name, options ={}) click to toggle source
# File lib/fog/compute/gridscale/requests/snapshot_create.rb, line 6
def snapshot_create(storage_uuid, name, options ={})
  create_options = {
      :name => name
  }

  create_options[:labels] = options[:labels] || []

  encoded_body = Fog::JSON.encode(create_options)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => "/objects/storages/#{storage_uuid}/snapshots",
      :body    => encoded_body,
      )
end
snapshot_delete(object_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/snapshot_delete.rb, line 6
def snapshot_delete(object_uuid)

  storage_uuid = object_uuid[:storage_uuid]
  snapshot_uuid = object_uuid[:snapshot_uuid]

  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "objects/storages/#{storage_uuid}/snapshots/#{snapshot_uuid}",
      )
end
snapshot_get(payload) click to toggle source
# File lib/fog/compute/gridscale/requests/snapshot_get.rb, line 6
def snapshot_get(payload)
  storage_uuid = payload[:storage_uuid]
  snapshot_uuid = payload[:snapshot_uuid]
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/storages/#{storage_uuid}/snapshots/#{snapshot_uuid}"
  )
end
snapshot_schedule_create(storage_uuid, name, run_interval, keep_snapshots, options = {}) click to toggle source
# File lib/fog/compute/gridscale/requests/snapshot_schedule_create.rb, line 6
def snapshot_schedule_create(storage_uuid, name, run_interval, keep_snapshots, options = {})
  create_options = {
      :name => name,
      :run_interval => run_interval,
      :keep_snapshots => keep_snapshots
  }
  create_options[:labels] = options[:labels] || []

  encoded_body = Fog::JSON.encode(create_options)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => "/objects/storages/#{storage_uuid}/snapshot_schedules",
      :body    => encoded_body,
      )
end
snapshot_schedule_delete(object_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/snapshot_schedule_delete.rb, line 6
def snapshot_schedule_delete(object_uuid)

  storage_uuid = object_uuid[:storage_uuid]
  snapshot_schedule_uuid = object_uuid[:snapshot_schedule_uuid]

  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "objects/storages/#{storage_uuid}/snapshot_schedules/#{snapshot_schedule_uuid}",
      )
end
snapshot_schedule_get(payload) click to toggle source
# File lib/fog/compute/gridscale/requests/snapshot_schedule_get.rb, line 6
def snapshot_schedule_get(payload)
  storage_uuid = payload[:storage_uuid]
  snapshot_schedule_uuid = payload[:snapshot_schedule_uuid]
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/storages/#{storage_uuid}/snapshot_schedules/#{snapshot_schedule_uuid}"
  )
end
snapshot_schedule_update(storage_uuid, snapshot_schedule_uuid, payload) click to toggle source
# File lib/fog/compute/gridscale/requests/snapshot_schedule_update.rb, line 6
def snapshot_schedule_update(storage_uuid, snapshot_schedule_uuid, payload)

  encoded_body = Fog::JSON.encode(payload)

  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/storages/#{storage_uuid}/snapshot_schedules/#{snapshot_schedule_uuid}",
      :body    => encoded_body,
      )
end
snapshot_schedules_get(storage_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/snapshot_schedules_get.rb, line 6
def snapshot_schedules_get(storage_uuid)
  storage_uuid = storage_uuid[:storage_uuid]

  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/storages/#{storage_uuid}/snapshot_schedules/"
  )
end
snapshot_update(storage_uuid, snapshot_uuid, payload) click to toggle source
# File lib/fog/compute/gridscale/requests/snapshot_update.rb, line 6
def snapshot_update(storage_uuid, snapshot_uuid, payload)

  encoded_body = Fog::JSON.encode(payload)

  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/storages/#{storage_uuid}/snapshots/#{snapshot_uuid}",
      :body    => encoded_body,
      )
end
snapshots_get(storage_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/snapshots_get.rb, line 6
def snapshots_get(storage_uuid)
  storage_uuid = storage_uuid[:storage_uuid]
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/storages/#{storage_uuid}/snapshots/"
  )
end
sshkey_create(name, sshkey, options = {}) click to toggle source
# File lib/fog/compute/gridscale/requests/sshkey_create.rb, line 6
def sshkey_create(name, sshkey, options = {})

  create_options = {
      :name   => name,
      :sshkey => sshkey,
  }
  # create_options[:labels] = options[:labels] || []
  if options[:labels]
    create_options[:labels] = options[:labels]
  end

  encoded_body = Fog::JSON.encode(create_options)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => '/objects/sshkeys',
      :body    => encoded_body,
      )
end
sshkey_delete(sshkey_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/sshkey_delete.rb, line 6
def sshkey_delete(sshkey_uuid)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/sshkeys/#{sshkey_uuid}",
      )
end
sshkey_get(sshkey_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/sshkey_get.rb, line 6
def sshkey_get(sshkey_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/sshkeys/#{sshkey_uuid}"
  )
end
sshkey_update(sshkey_uuid, payload) click to toggle source
# File lib/fog/compute/gridscale/requests/sshkey_update.rb, line 6
def sshkey_update(sshkey_uuid, payload)
  encoded_body = Fog::JSON.encode(payload)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'PATCH',
      :path            => "/objects/sshkeys/#{sshkey_uuid}",
      :body            => encoded_body,

      )
end
sshkeys_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/sshkeys_get.rb, line 6
def sshkeys_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/sshkeys",
      :query  => filters

  )
end
storage_create(name, capacity, options = {}) click to toggle source
# File lib/fog/compute/gridscale/requests/storage_create.rb, line 6
def storage_create(name, capacity, options = {})
  create_options = {
      :name   => name,
      :capacity   => capacity,
  }

  create_options[:labels] = options[:labels] || []

  if options[:storage_type]
    create_options[:storage_type] = options[:storage_type]
  end

  if options[:template]
    create_options[:template] = options[:template]
  end

  if options[:location_uuid]
    create_options[:location_uuid] = options[:location_uuid]
  else
    create_options[:location_uuid] = '45ed677b-3702-4b36-be2a-a2eab9827950'
  end

  encoded_body = Fog::JSON.encode(create_options)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => '/objects/storages',
      :body    => encoded_body,
      )
end
storage_delete(storage_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/storage_delete.rb, line 6
def storage_delete(storage_uuid)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/storages/#{storage_uuid}",
      )
end
storage_events_get(storage_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/storage_events_get.rb, line 6
def storage_events_get(storage_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/storages/#{storage_uuid}/events"
  )
end
storage_get(storage_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/storage_get.rb, line 6
def storage_get(storage_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/storages/#{storage_uuid}"
  )
end
storage_update(storage_uuid, payload={}) click to toggle source
# File lib/fog/compute/gridscale/requests/storage_update.rb, line 6
def storage_update(storage_uuid, payload={})

  encoded_body = Fog::JSON.encode(payload)

  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/storages/#{storage_uuid}",
      :body    => encoded_body,
      )
end
storages_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/storages_get.rb, line 6
def storages_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/storages",
      :query   => filters
  )
end
template_create(name, snapshot_uuid, options={}) click to toggle source
# File lib/fog/compute/gridscale/requests/template_create.rb, line 6
def template_create(name, snapshot_uuid, options={})

  create_options = {
      :name   => name,
      :snapshot_uuid => snapshot_uuid,
  }

  create_options[:labels] = options[:labels] || []

  encoded_body = Fog::JSON.encode(create_options)

  request(
      :expects => [202],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'POST',
      :path    => "/objects/templates",
      :body    => encoded_body,
      )
end
template_delete(template_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/template_delete.rb, line 6
def template_delete(template_uuid)
  request(
      :expects         => [204],
      :headers         => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method          => 'DELETE',
      :path            => "/objects/templates/#{template_uuid}",
      )
end
template_events_get(template_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/template_events_get.rb, line 6
def template_events_get(template_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/templates/#{template_uuid}/events"
  )
end
template_get(template_uuid) click to toggle source
# File lib/fog/compute/gridscale/requests/template_get.rb, line 6
def template_get(template_uuid)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/templates/#{template_uuid}"
  )
end
template_update(template_uuid, payload={}) click to toggle source
# File lib/fog/compute/gridscale/requests/template_update.rb, line 6
def template_update(template_uuid, payload={})

  encoded_body = Fog::JSON.encode(payload)

  request(
      :expects => [204],
      :headers => {
          'Content-Type' => "application/json; charset=UTF-8",
      },
      :method  => 'PATCH',
      :path    => "/objects/templates/#{template_uuid}",
      :body    => encoded_body,
      )
end
templates_get(filters={}) click to toggle source
# File lib/fog/compute/gridscale/requests/templates_get.rb, line 6
def templates_get(filters={})
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/objects/templates",
      :query   => filters

  )
end