class Fog::Compute::ProfitBricks::Real

Public Class Methods

new(options={}) click to toggle source
# File lib/fog/profitbricks/compute.rb, line 130
def initialize(options={})
  @profitbricks_username = options[:profitbricks_username]
  @profitbricks_password = options[:profitbricks_password]
  @profitbricks_url      = options[:profitbricks_url] || "https://api.profitbricks.com"

  connection_options = options[:connection_options] || {}
  connection_options[:headers] ||= {}
  connection_options[:headers]["User-Agent"] = "#{Fog::Core::Connection.user_agents}"
  connection_options[:omit_default_port] = true
  connection_options[:path_prefix] = "/rest/#{API_VERSION}"

  @connection = Fog::Core::Connection.new(@profitbricks_url, false, connection_options)
end

Public Instance Methods

create_firewall_rule(datacenter_id, server_id, nic_id, options={}) click to toggle source

Adds a Firewall Rule to the NIC

Parameters

  • datacenter_id<~String> - Required, UUID of the virtual data center

  • server_id<~String> - Required, UUID of the server

  • nic_id<~String> - Required, UUID of the NIC

  • options<~Hash>:

    • name<~String> - The name of the Firewall Rule

    • protocol<~String> - The protocol for the rule: TCP, UDP, ICMP, ANY

    • sourceMac<~String> - Only traffic originating from the respective MAC address is allowed.

      Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address
    • sourceIp<~String> - Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs

    • targetIp<~String> - In case the target NIC has multiple IP addresses, only traffic directed to the respective

      IP address of the NIC is allowed. Value null allows all target IPs
      
    • portRangeStart<~String> - Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen.

      Leave portRangeStart and portRangeEnd value null to allow all ports
      
    • portRangeEnd<~String> - Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen.

      Leave portRangeStart and portRangeEnd null to allow all ports
      
    • icmpType<~String> - Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen. Value null allows all types

    • icmpCode<~String> - Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - The resource's unique identifier

        • type<~String> - The type of the created resource

        • href<~String> - URL to the object’s representation (absolute path)

        • metadata<~Hash> - Hash containing the Firewall Rule metadata

          • createdDate<~String> - The date the resource was created

          • createdBy<~String> - The user who created the resource

          • etag<~String> - The etag for the resource

          • lastModifiedDate<~String> - The last time the resource has been modified

          • lastModifiedBy<~String> - The user who last modified the resource

          • state<~String> - Firewall Rule state

        • properties<~Hash> - Hash containing the Firewall Rule properties

          • name<~String> - The name of the Firewall Rule

          • protocol<~String> - The protocol for the rule: TCP, UDP, ICMP, ANY

          • sourceMac<~String> - Only traffic originating from the respective MAC address is allowed.

            Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address
          • sourceIp<~String> - Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs

          • targetIp<~String> - In case the target NIC has multiple IP addresses, only traffic directed

            to the respective IP address of the NIC is allowed. Value null allows all target IPs
            
          • icmpCode<~String> - Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes

          • icmpType<~String> - Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen. Value null allows all types

          • portRangeStart<~String> - Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen.

            Leave portRangeStart and portRangeEnd value null to allow all ports
            
          • portRangeEnd<~String> - Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen.

            Leave portRangeStart and portRangeEnd null to allow all ports
            

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/create_firewall_rule.rb, line 55
def create_firewall_rule(datacenter_id, server_id, nic_id, options={})
  firewall_rule = {
      :properties => options
  }

  request(
      :expects  => [202],
      :method   => 'POST',
      :path     => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}/firewallrules",
      :body     => Fog::JSON.encode(firewall_rule)
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
create_flavor(flavor_name, cores, ram) click to toggle source

Not a real API method; will only return flavor object.

# File lib/fog/profitbricks/requests/compute/create_flavor.rb, line 6
def create_flavor(flavor_name, cores, ram)
    response        = Excon::Response.new
    response.status = 200
    response.body   = {
      'createFlavorResponse' => {
          'id'    => Fog::UUID.uuid,
          'name'  => flavor_name,
          'cores' => cores,
          'ram'   => ram,
      }
    }
    response
end
create_load_balancer(datacenter_id, properties={}, entities={}) click to toggle source

Creates a load balancer within the data center. Load balancers can be used for public or private IP traffic

Parameters

  • datacenter_id<~String> - Required, UUID of the virtual data center

  • properties<~Hash>:

    • name<~String> - Required - The name of the load balancer

    • ip<~String> - IPv4 address of the load balancer. All attached NICs will inherit this IP

    • dhcp<~Boolean> - Indicates if the load balancer will reserve an IP using DHCP

  • entities<~Hash>

    • balancednics<~Array> - List of NICs taking part in load-balancing. All balanced nics inherit the IP of the loadbalancer.

      See the NIC section for attribute definitions

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - The resource's unique identifier

      • type<~String> - The type of the created resource

      • href<~String> - URL to the object’s representation (absolute path)

      • metadata<~Hash> - Hash containing the Load Balancer metadata

        • createdDate<~String> - The date the resource was created

        • createdBy<~String> - The user who created the resource

        • etag<~String> - The etag for the resource

        • lastModifiedDate<~String> - The last time the resource has been modified

        • lastModifiedBy<~String> - The user who last modified the resource

        • state<~String> - Load Balancer state

      • properties<~Hash> - Hash containing the Load Balancer properties

        • name<~String> - The name of the Load Balancer

        • ip<~String> - Pv4 address of the Load Balancer. All attached NICs will inherit this IP

        • dhcp<~Boolean> - Indicates if the Load Balancer will reserve an IP using DHCP

      • entities<~Integer> - Hash containing the Load Balancer entities

        • balancednics<~Hash> - List of NICs taking part in load-balancing. All balanced nics inherit the IP of the loadbalancer.

          See the NIC section for attribute definitions

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/create_load_balancer.rb, line 39
def create_load_balancer(datacenter_id, properties={}, entities={})
  load_balancer = {
      :properties => properties,
      :entities   => entities
  }

  request(
      :expects  => [202],
      :method   => 'POST',
      :path     => "/datacenters/#{datacenter_id}/loadbalancers",
      :body     => Fog::JSON.encode(load_balancer)
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
create_nic(datacenter_id, server_id, options={}, entities={}) click to toggle source

Adds a NIC to the target server

Parameters

  • datacenter_id<~String> - Required, UUID of the virtual data center

  • server_id<~String> - Required, UUID of the server

  • options<~Hash>:

    • name<~String> - The name of the NIC.

    • ips<~Array> - IPs assigned to the NIC. This can be a collection (string)

    • dhcp<~Boolean> - Set to FALSE if you wish to disable DHCP on the NIC. Default: TRUE

    • lan<~Integer> - Required, The LAN ID the NIC will sit on. If the LAN ID does not exist it will be created.

    • firewallActive<~Boolean> - Once a firewall rule is added, this will reflect a TRUE value

    • firewallrules<~Hash> - A list of firewall rules associated to the NIC represented as a collection

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - The resource's unique identifier

      • type<~String> - The type of the created resource

      • href<~String> - URL to the object’s representation (absolute path)

      • metadata<~Hash> - Hash containing the NIC metadata

        • createdDate<~String> - The date the resource was created

        • createdBy<~String> - The user who created the resource

        • etag<~String> - The etag for the resource

        • lastModifiedDate<~String> - The last time the resource has been modified

        • lastModifiedBy<~String> - The user who last modified the resource

        • state<~String> - NIC state

      • properties<~Hash> - Hash containing the NIC properties

        • name<~String> - The name of the NIC

        • mac<~String> - The MAC address of the NIC

        • ips<~Array> - IPs assigned to the NIC represented as a collection

        • dhcp<~Boolean> - Boolean value that indicates if the NIC is using DHCP or not

        • lan<~Integer> - The LAN ID the NIC sits on

        • firewallActive<~Boolean> - Once a firewall rule is added, this will reflect a true value

      • entities<~Hash> - Hash containing the NIC entities

        • firewallrules<~Hash> - A list of firewall rules associated to the NIC represented as a collection

          • id<~String> - The resource's unique identifier

          • type<~String> - The type of the resource

          • href<~String> - URL to the object’s representation (absolute path)

          • items<~Array> - Collection of individual firewall rules objects

            • id<~String> - The resource's unique identifier

            • type<~String> - The type of the resource

            • href<~String> - URL to the object’s representation (absolute path)

            • metadata<~Hash> - Hash containing the Firewall Rule metadata

              • createdDate<~String> - The date the resource was created

              • createdBy<~String> - The user who created the resource

              • etag<~String> - The etag for the resource

              • lastModifiedDate<~String> - The last time the resource has been modified

              • lastModifiedBy<~String> - The user who last modified the resource

              • state<~String> - Firewall Rule state

            • properties<~Hash> - Hash containing the Firewall Rule properties

              • name<~String> - The name of the Firewall Rule

              • protocol<~String> - The protocol for the rule: TCP, UDP, ICMP, ANY

              • sourceMac<~Array> - Only traffic originating from the respective MAC address is allowed.

                Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address
              • sourceIp<~Boolean> - Only traffic originating from the respective IPv4 address is allowed.

                Value null allows all source IPs
                
              • targetIp<~Integer> - In case the target NIC has multiple IP addresses, only traffic directed

                to the respective IP address of the NIC is allowed. Value null allows all target IPs
                
              • icmpCode<~Boolean> - Defines the allowed code (from 0 to 254) if protocol ICMP is chosen.

                Value null allows all codes.
              • icmpType<~Boolean> - Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen.

                Value null allows all types
                
              • portRangeStart<~Boolean> - Defines the start range of the allowed port (from 1 to 65534)

                if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd
                value null to allow all ports
              • portRangeEnd<~Boolean> - Defines the end range of the allowed port (from 1 to 65534)

                if the protocol TCP or UDP is chosen. Leave portRangeStart and
                portRangeEnd value null to allow all ports

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/create_nic.rb, line 75
def create_nic(datacenter_id, server_id, options={}, entities={})
  nic = {
      :properties => options,
      :entities   => entities
  }

  request(
      :expects  => [202],
      :method   => 'POST',
      :path     => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics",
      :body     => Fog::JSON.encode(nic)
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
create_server(datacenter_id, properties={}, entities={}) click to toggle source

Creates a server within an existing data center. Additional properties such as specifying a boot volume and connecting the server to an existing LAN can be configured.

Parameters

  • datacenter_id<~String> - Required - UUID of virtual data center

  • properties<~Hash>: - A hash containing the server properties

    • name<~String> - Required - The hostname of the server

    • cores<~Integer> - Required - The total number of cores for the server

    • ram<~Integer> - Required - The amount of memory for the server in MB, e.g. 2048.

      Size must be specified in multiples of 256 MB with a minimum of 256 MB;
      however, if ramHotPlug is set to TRUE then a minimum of 1024 MB nust be used
    • availabilityZone<~String> - The availability zone for the server (AUTO, ZONE_1, ZONE_2)

    • bootCdrom<~Hash> - Reference to a CD-ROM used for booting. If not 'null' then bootVolume has to be 'null'

    • bootVolume<~Hash> - Reference to a Volume used for booting. If not 'null’ then bootCdrom has to be 'null’

    • cpuFamily<~String> - Type of CPU assigned (“AMD_OPTERON” or “INTEL_XEON”)

  • entities<~Hash>: - A hash containing the server entities

    • cdroms<~Hash> - A collection of cdroms attached to the server

    • volumes<~Hash> - A collection of volumes attached to the server

    • nics<~Hash> - A collection of NICs attached to the server

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - The resource's unique identifier

        • type<~String> - The type of the requested resource

        • href<~String> - URL to the object’s representation (absolute path)

        • metadata<~Hash> - A hash containing the server metadata

          • createdDate<~String> - The date the resource was created

          • createdBy<~String> - The user who created the resource

          • etag<~String> - The etag

          • lastModifiedDate<~String> - The last modified time for the resource

          • lastModifiedBy<~String> - The user who last modified the resource

          • state<~String> - Status of the virtual Machine

        • properties<~Hash> - A hash containing the server properties

          • name<~String> - The name of the server

          • cores<~Integer> - The number of cores for the server

          • ram<~Integer> - The amount of memory on the server (in megabytes)

          • availabilityZone<~String> - The availability zone for the server

          • vmState<~String> - The current state of the instance

          • bootCdrom<~Hash> - Reference to a CD-ROM used for booting. If not 'null' then bootVolume has to be 'null'.

          • bootVolume<~Hash> - Reference to a Volume used for booting. If not ‘null’ then bootCdrom has to be ‘null’

            • id<~String> - The resource's unique identifier

            • type<~String> - The type of the requested resource

            • href<~String> - URL to the object’s representation (absolute path)

            • metadata<~Hash> - Hash containing the volume metadata

              • createdDate<~String> - The date the resource was created

              • createdBy<~String> - The user who created the resource

              • etag<~String> - The etag for the resource

              • lastModifiedDate<~String> - The last time the resource has been modified

              • lastModifiedBy<~String> - The user who last modified the resource

              • state<~String> - Volume state

            • properties<~Hash> - Hash containing the volume properties

              • name<~String> - The name of the volume.

              • type<~String> - The volume type, HDD or SSD.

              • size<~Integer> - The size of the volume in GB.

              • image<~String> - The image or snapshot ID.

              • imagePassword<~String> - Indicates if a password is set on the image.

              • sshKeys<~String> - SSH keys

              • bus<~String> - The bus type of the volume (VIRTIO or IDE). Default: VIRTIO.

              • licenceType<~String> - Volume licence type. ( WINDOWS, LINUX, OTHER, UNKNOWN)

              • cpuHotPlug<~Boolean> - This volume is capable of CPU hot plug (no reboot required)

              • cpuHotUnplug<~Boolean> - This volume is capable of CPU hot unplug (no reboot required)

              • ramHotPlug<~Boolean> - This volume is capable of memory hot plug (no reboot required)

              • ramHotUnplug<~Boolean> - This volume is capable of memory hot unplug (no reboot required)

              • nicHotPlug<~Boolean> - This volume is capable of nic hot plug (no reboot required)

              • nicHotUnplug<~Boolean> - This volume is capable of nic hot unplug (no reboot required)

              • discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot plug (no reboot required)

              • discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot unplug (no reboot required)

              • discScsiHotPlug<~Boolean> - This volume is capable of Scsi drive hot plug (no reboot required)

              • discScsiHotUnplug<~Boolean> - This volume is capable of Scsi drive hot unplug (no reboot required)

              • deviceNumber<~Integer> - The LUN ID of the storage volume

          • cpuFamily<~String> - Type of CPU assigned

        • entities<~Hash> - A hash containing the server entities

          • cdroms<~Hash> - A collection of cdroms attached to the server

            • id<~String> - The resource's unique identifier

            • type<~String> - The type of the requested resource

            • href<~String> - URL to the object’s representation (absolute path)

            • items<~Array> - The array containing individual cd rom resources

          • volumes<~Hash> - A collection of volumes attached to the server

            • id<~String> - The resource's unique identifier

            • type<~String> - The type of the requested resource

            • href<~String> - URL to the object’s representation (absolute path)

            • items<~Array> - The array containing individual volume resources (see bootVolume for detailed structure)

          • nics<~Hash> - A collection of NICs attached to the server

            • id<~String> - The resource's unique identifier

            • type<~String> - The type of the requested resource

            • href<~String> - URL to the object’s representation (absolute path)

            • items<~Array> - An array containing individual NIC resources

              • id<~String> - The resource's unique identifier

              • type<~String> - The type of the requested resource

              • href<~String> - URL to the object’s representation (absolute path)

              • metadata<~Hash> - A hash containing the nic metadata

                • createdDate<~String> - The date the resource was created

                • createdBy<~String> - The user who created the resource

                • etag<~String> - The etag for the resource

                • lastModifiedDate<~String> - The last time the resource has been modified

                • lastModifiedBy<~String> - The user who last modified the resource

                • state<~String> - NIC state

              • properties<~Hash> - A hash containing the nic properties

                • name<~String> - The name of the NIC

                • mac<~String> - The MAC address of the NIC

                • ips<~Array> - IPs assigned to the NIC represented as a collection

                • dhcp<~Boolean> - Boolean value that indicates if the NIC is using DHCP or not

                • lan<~integer> - The LAN ID the NIC sits on

                • firewallActive<~Boolean> - Once you add a firewall rule this will reflect a true value

              • entities<~Hash> - A hash containing the nic entities

                • firewallrules<~hash> - A list of firewall rules associated to the NIC represented as a collection

                  • id<~String> - The resource's unique identifier

                  • type<~String> - The type of the requested resource

                  • href<~String> - URL to the object’s representation (absolute path)

                  • items<~Array> - An array of individual firewall rules associated to the NIC

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/create_server.rb, line 119
def create_server(datacenter_id, properties={}, entities={})
  server = {
      :properties => properties,
      :entities   => entities
  }

  request(
      :expects  => [202],
      :method   => 'POST',
      :path     => "/datacenters/#{datacenter_id}/servers",
      :body     => Fog::JSON.encode(server)
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
create_volume(datacenter_id, options={}) click to toggle source

Creates a volume within the data center. This will NOT attach the volume to a server.

Parameters

  • datacenter_id<~String> - Required, UUID of virtual data center

  • options<~Hash>:

    • name<~String> - The name of the volume

    • size<~Integer> - Required, the size of the volume in GB

    • bus<~String> - The bus type of the volume (VIRTIO or IDE). Default: VIRTIO.

    • image<~String> - Required**, the image or snapshot ID

    • type<~String> - The volume type, HDD or SSD

    • licenceType<~String> - Required**, the licence type of the volume. Options: LINUX, WINDOWS, UNKNOWN, OTHER

    • imagePassword<~String> - One-time password is set on the Image for the appropriate account.

      This field may only be set in creation requests. When reading, it always returns null.
      Password has to contain 8-50 characters.
      Only these characters are allowed: [abcdefghjkmnpqrstuvxABCDEFGHJKLMNPQRSTUVX23456789]
    • sshKeys<~String> - SSH keys to allow access to the volume via SSH

    ** Either the image or the licenceType parameters need to be provided.

    licenceType is required, but if image is supplied, it will already have a licenceType set.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - The resource's unique identifier

      • type<~String> - The type of the created resource

      • href<~String> - URL to the object's representation (absolute path)

      • metadata<~Hash> - Hash containing the volume metadata

        • createdDate<~String> - The date the resource was created

        • createdBy<~String> - The user who created the resource

        • etag<~String> - The etag for the resource

        • lastModifiedDate<~String> - The last time the resource has been modified

        • lastModifiedBy<~String> - The user who last modified the resource

        • state<~String> - Volume state

      • properties<~Hash> - Hash containing the volume properties

        • name<~String> - The name of the volume.

        • type<~String> - The volume type, HDD or SSD.

        • size<~Integer> - The size of the volume in GB.

        • image<~String> - The image or snapshot ID.

        • imagePassword<~String> - Indicates if a password is set on the image.

        • sshKeys<~String> - SSH keys

        • bus<~String> - The bus type of the volume (VIRTIO or IDE). Default: VIRTIO.

        • licenceType<~String> - Volume licence type. ( WINDOWS, LINUX, OTHER, UNKNOWN)

        • cpuHotPlug<~Boolean> - This volume is capable of CPU hot plug (no reboot required)

        • cpuHotUnplug<~Boolean> - This volume is capable of CPU hot unplug (no reboot required)

        • ramHotPlug<~Boolean> - This volume is capable of memory hot plug (no reboot required)

        • ramHotUnplug<~Boolean> - This volume is capable of memory hot unplug (no reboot required)

        • nicHotPlug<~Boolean> - This volume is capable of nic hot plug (no reboot required)

        • nicHotUnplug<~Boolean> - This volume is capable of nic hot unplug (no reboot required)

        • discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot plug (no reboot required)

        • discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot unplug (no reboot required)

        • discScsiHotPlug<~Boolean> - This volume is capable of Scsi drive hot plug (no reboot required)

        • discScsiHotUnplug<~Boolean> - This volume is capable of Scsi drive hot unplug (no reboot required)

        • deviceNumber<~Integer> - The LUN ID of the volume volume

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/create_volume.rb, line 60
def create_volume(datacenter_id, options={})
    volume = {
        :properties => options
    }

    request(
        :expects  => [202],
        :method   => 'POST',
        :path     => "/datacenters/#{datacenter_id}/volumes",
        :body     => Fog::JSON.encode(volume)
    )
rescue => error
    Fog::Errors::NotFound.new(error)
end
delete_datacenter(datacenter_id) click to toggle source

Delete virtual data center

Parameters

  • datacenter_id<~String> - The UUID of the data center

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/delete_datacenter.rb, line 15
def delete_datacenter(datacenter_id)
    request(
        :expects => [202],
        :method  => 'DELETE',
        :path    => "/datacenters/#{datacenter_id}"
    )
rescue => error
    Fog::Errors::NotFound.new(error)
end
delete_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id) click to toggle source

Deletes the specified firewall rule

Parameters

  • datacenter_id<~String> - UUID of the data center

  • server_id<~String> - UUID of the server

  • nic_id<~String> - UUID of the NIC

  • firewall_rule_id<~String> - UUID of the NIC

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/delete_firewall_rule.rb, line 18
def delete_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id)
  request(
      :expects => [202],
      :method  => 'DELETE',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}/firewallrules/#{firewall_rule_id}"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
delete_image(image_id) click to toggle source

Delete an existing image

Parameters

  • image_id<~String> - UUID of the image resource

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/delete_image.rb, line 15
def delete_image(image_id)
  request(
      :expects => [202],
      :method  => 'DELETE',
      :path    => "/images/#{image_id}"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
delete_ip_block(ip_block_id) click to toggle source

Deletes the specified IP Block

Parameters

  • ip_block_id<~String> - UUID of the IP Block

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/delete_ip_block.rb, line 15
def delete_ip_block(ip_block_id)
  request(
      :expects => [202],
      :method  => 'DELETE',
      :path    => "/ipblocks/#{ip_block_id}"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
delete_lan(datacenter_id, lan_id) click to toggle source

Delete the specified LAN

Parameters

  • datacenter_id<~String> - UUID of the data center

  • lan_id<~String> - UUID of the data center

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/delete_lan.rb, line 16
def delete_lan(datacenter_id, lan_id)
  request(
      :expects => [202],
      :method  => 'DELETE',
      :path    => "/datacenter/#{datacenter_id}/lans/#{lan_id}"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
delete_load_balancer(datacenter_id, load_balancer_id) click to toggle source

Deletes the specified load balancer

Parameters

  • datacenter_id<~String> - UUID of the data center

  • load_balancer_id<~String> - UUID of the load balancer

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/delete_load_balancer.rb, line 16
def delete_load_balancer(datacenter_id, load_balancer_id)
  request(
      :expects => [202],
      :method  => 'DELETE',
      :path    => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
delete_nic(datacenter_id, server_id, nic_id) click to toggle source

Deletes the specified NIC

Parameters

  • datacenter_id<~String> - UUID of the data center

  • server_id<~String> - UUID of the server

  • nic_id<~String> - UUID of the NIC

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/delete_nic.rb, line 17
def delete_nic(datacenter_id, server_id, nic_id)
  request(
      :expects => [202],
      :method  => 'DELETE',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
delete_server(datacenter_id, server_id) click to toggle source

This will remove a server from a data center. NOTE: This will not automatically remove the storage volume(s) attached to a server. A separate API call is required to perform that action.

Parameters

  • datacenter_id<~String> - UUID of the data center

  • server_id<~String> - UUID of the virtual server

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/delete_server.rb, line 18
def delete_server(datacenter_id, server_id)
  request(
    :expects => [202],
    :method  => 'DELETE',
    :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
delete_snapshot(snapshot_id) click to toggle source

Delete virtual data center

Parameters

  • snapshot_id<~String> - UUID of the snapshot

Returns

  • response<~Excon::Response>

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/delete_snapshot.rb, line 14
def delete_snapshot(snapshot_id)
  request(
      :expects => [202],
      :method  => 'DELETE',
      :path    => "/snapshots/#{snapshot_id}"
  )
rescue => error
  puts error
  Fog::Errors::NotFound.new(error)
end
delete_volume(datacenter_id, volume_id) click to toggle source

Deletes the specified volume

Parameters

  • datacenter_id<~String> - UUID of the data center

  • volume_id<~String> - UUID of the volume

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/delete_volume.rb, line 16
def delete_volume(datacenter_id, volume_id)
    request(
        :expects => [202],
        :method  => 'DELETE',
        :path    => "/datacenters/#{datacenter_id}/volumes/#{volume_id}"
    )
rescue => error
    Fog::Errors::NotFound.new(error)
end
detach_cdrom(datacenter_id, server_id, cdrom_id) click to toggle source

Detach a CD-ROM from the server

Parameters

  • datacenter_id<~String> - UUID of the data center

  • server_id<~String> - UUID of the virtual server

  • cdrom_id<~String> - UUID of the CD-ROM image

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/detach_cdrom.rb, line 17
def detach_cdrom(datacenter_id, server_id, cdrom_id)
  request(
      :expects => [202],
      :method  => 'DELETE',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/cdroms/#{cdrom_id}"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
detach_volume(datacenter_id, server_id, volume_id) click to toggle source

Detach the volume from the server. Depending on the volume “HotUnplug” settings, this may result in the server being rebooted.

Parameters

  • datacenter_id<~String> - UUID of the data center

  • server_id<~String> - UUID of the virtual server

  • volume_id<~String> - UUID of the virtual storage

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/detach_volume.rb, line 18
def detach_volume(datacenter_id, server_id, volume_id)
  request(
      :expects => [202],
      :method  => 'DELETE',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/volumes/#{volume_id}"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
get_all_flavors() click to toggle source
# File lib/fog/profitbricks/requests/compute/get_all_flavors.rb, line 5
def get_all_flavors()
    response        = Excon::Response.new
    response.status = 200
    response.body   = {
        'getAllFlavorsResponse' => [
            {
                'flavorId'   => '00db4c8f-5e83-49b0-a70b-ac4aad786163',
                'flavorName' => 'Micro',
                'ram'        => 1024,
                'cores'      => 1
            },
            {
                'flavorId'   => 'dc64957b-be9d-431e-91cd-9e217f94d3de',
                'flavorName' => 'Small',
                'ram'        => 2048,
                'cores'      => 1
            },
            {
                'flavorId'   => 'b37d000e-b347-4592-b572-df13ef8f68e1',
                'flavorName' => 'Medium',
                'ram'        => 4096,
                'cores'      => 2
            },
            {
                'flavorId'   => 'a5a4389f-54b6-4f47-b6e8-1c5c55976b94',
                'flavorName' => 'Large',
                'ram'        => 7168,
                'cores'      => 4
            },
            {
                'flavorId'   => '0052db40-f1dd-4ecf-a711-5980081b7059',
                'flavorName' => 'Extra Large',
                'ram'        => 14336,
                'cores'      => 8
            },
            {
                'flavorId'   => '8b2b835d-be09-48cf-aae2-7e35aafe92d6',
                'flavorName' => 'Memory Intensive Small',
                'ram'        => 16384,
                'cores'      => 2
            },
            {
                'flavorId'   => '45c28f8b-6a67-4f69-8c94-231d371da2b6',
                'flavorName' => 'Memory Intensive Medium',
                'ram'        => 28672,
                'cores'      => 4
            },
            {
                'flavorId'    => '1d22436d-d958-4151-b144-43a8e180c4c4',
                'flavorName'  => 'Memory Intensive Large',
                'ram'         => 57344,
                'cores'       => 8
            },
        ]
    }
    response
end
get_flavor(flavor_id) click to toggle source
# File lib/fog/profitbricks/requests/compute/get_flavor.rb, line 5
def get_flavor(flavor_id)
  response        = Excon::Response.new
  response.status = 200
  response.body   = {
    "getFlavorResponse" => [
      {
        "flavorId"   => "00db4c8f-5e83-49b0-a70b-ac4aad786163",
        "flavorName" => "Micro",
        "ram"        => 1024,
        "cores"      => 1
      },
      {
        "flavorId"   => "dc64957b-be9d-431e-91cd-9e217f94d3de",
        "flavorName" => "Small",
        "ram"        => 2048,
        "cores"      => 1
      },
      {
        "flavorId"   => "b37d000e-b347-4592-b572-df13ef8f68e1",
        "flavorName" => "Medium",
        "ram"        => 4096,
        "cores"      => 2
      },
      {
        "flavorId"   => "a5a4389f-54b6-4f47-b6e8-1c5c55976b94",
        "flavorName" => "Large",
        "ram"        => 7168,
        "cores"      => 4
      },
      {
        "flavorId"   => "0052db40-f1dd-4ecf-a711-5980081b7059",
        "flavorName" => "Extra Large",
        "ram"        => 14336,
        "cores"      => 8
      },
      {
        "flavorId"   => "8b2b835d-be09-48cf-aae2-7e35aafe92d6",
        "flavorName" => "Memory Intensive Small",
        "ram"        => 16384,
        "cores"      => 2
      },
      {
        "flavorId"   => "45c28f8b-6a67-4f69-8c94-231d371da2b6",
        "flavorName" => "Memory Intensive Medium",
        "ram"        => 28672,
        "cores"      => 4
      },
      {
        "flavorId"   => "1d22436d-d958-4151-b144-43a8e180c4c4",
        "flavorName" => "Memory Intensive Large",
        "ram"        => 57344,
        "cores"      => 8
      },
    ].find { |flavor| flavor["flavorId"] == flavor_id } || raise(Fog::Errors::NotFound)
  }
  response
end
reboot_server(datacenter_id, server_id) click to toggle source

This will force a hard reboot of the server. Do not use this method if you want to gracefully reboot the machine. This is the equivalent of powering off the machine and turning it back on

Parameters

  • datacenter_id<~String> - UUID of the data center

  • server_id<~String> - UUID of the virtual server

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/reboot_server.rb, line 18
def reboot_server(datacenter_id, server_id)
  request(
      :expects => [202],
      :method  => 'POST',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/reboot"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
remove_nic_association(datacenter_id, load_balancer_id, nic_id) click to toggle source

Associates a NIC to a Load Balancer, enabling the NIC to participate in load-balancing

Parameters

  • datacenter_id<~String> - UUID of the data center

  • load_balancer_id<~String> - UUID of the load balancer

  • nic_id<~String> - UUID of the NIC

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/remove_nic_association.rb, line 17
def remove_nic_association(datacenter_id, load_balancer_id, nic_id)
  request(
      :expects => [202],
      :method  => 'DELETE',
      :path    => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}/balancednics/#{nic_id}"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
request(params) click to toggle source
# File lib/fog/profitbricks/compute.rb, line 144
def request(params)
  params[:headers] ||= {}
  params[:headers].merge!("Authorization" => "Basic #{auth_header}")
  params[:path_style] = false

  begin
    response = @connection.request(params)
  rescue Excon::Errors::Unauthorized => error
    raise error, Fog::JSON.decode(error.response.body)['messages']
  rescue Excon::Errors::HTTPStatusError => error
    raise error, Fog::JSON.decode(error.response.body)['messages']
  rescue Excon::Errors::InternalServerError => error
    raise error, Fog::JSON.decode(error.response.body)['messages']
  rescue Fog::Errors::NotFound => error
    raise error, Fog::JSON.decode(error.response.body)['messages']
  end

  unless response.body.empty?
    response.body = Fog::JSON.decode(response.body)
    response.body['requestId'] = get_request_id(response.headers)
  end
  response
end
restore_volume_snapshot(datacenter_id, volume_id, options={}) click to toggle source

Restores a snapshot onto a volume. A snapshot is created as just another image that can be used to create new volumes or to restore an existing volume.

Parameters

  • datacenter_id<~String> - Required, UUID of virtual data center

  • volume_id<~String> - Required, UUID of the snapshot

  • options<~Hash>:

    • snapshotId<~String> - Required, The ID of the snapshot

Returns

  • response<~Excon::Response> - No response parameters

    • status<~Integer> - HTTP status for the request

    • headers<~Array> - The response headers

      • Location<~String> - URL of a request resource which should be used for operation's status polling

      • Date<~String>

      • Content-Length<~Integer>

      • Connection<~String>

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/restore_volume_snapshot.rb, line 24
def restore_volume_snapshot(datacenter_id, volume_id, options={})
  request(
      :expects  => [202],
      :method   => 'POST',
      :path     => "/datacenters/#{datacenter_id}/volumes/#{volume_id}/restore-snapshot",
      :headers => { "Content-Type" => "application/x-www-form-urlencoded" },
      :body => URI.encode_www_form("snapshotId" => options[:snapshot_id])
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
start_server(datacenter_id, server_id) click to toggle source

This will start a server. If the server's public IP was deallocated, then a new IP will be assigned

Parameters

  • datacenter_id<~String> - UUID of the data center

  • server_id<~String> - UUID of the virtual server

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/start_server.rb, line 17
def start_server(datacenter_id, server_id)
  request(
      :expects => [202],
      :method  => 'POST',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/start"
  )
rescue Excon::Errors::InternalServerError => error
  Fog::Errors::NotFound.new(error)
end
stop_server(datacenter_id, server_id) click to toggle source

This will stop a server. The machine will be forcefully powered off, billing will cease, and the public IP, if one is allocated, will be deallocated

Parameters

  • datacenter_id<~String> - UUID of the data center

  • server_id<~String> - UUID of the virtual server

Returns

  • response<~Excon::Response> - No response parameters (HTTP/1.1 202 Accepted)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/stop_server.rb, line 18
def stop_server(datacenter_id, server_id)
  request(
      :expects => [202],
      :method  => 'POST',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/stop"
  )
rescue Excon::Errors::InternalServerError => error
  Fog::Errors::NotFound.new(error)
end
update_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id, options = {}) click to toggle source

Update a Firewall Rule

Parameters

  • datacenter_id<~String> - Required - UUID of the NIC

  • server_id<~String> - Required - UUID of the server

  • nic_id<~String> - Required - UUID of the NIC

  • firewall_rule_id<~String> - Required - UUID of the NIC

  • options<~Hash>:

    • name<~String> - The name of the Firewall Rule

    • sourceMac<~String> - Only traffic originating from the respective MAC address is allowed.

      Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address
    • sourceIp<~String> - Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs

    • targetIp<~String> - In case the target NIC has multiple IP addresses, only traffic directed

      to the respective IP address of the NIC is allowed. Value null allows all target IPs
      
    • icmpCode<~String> - Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes

    • icmpType<~String> - Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen. Value null allows all types

    • portRangeStart<~String> - Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen.

      Leave portRangeStart and portRangeEnd value null to allow all ports
      
    • portRangeEnd<~String> - Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen.

      Leave portRangeStart and portRangeEnd null to allow all ports
      

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - The resource's unique identifier

        • type<~String> - The type of the created resource

        • href<~String> - URL to the object’s representation (absolute path)

        • metadata<~Hash> - Hash containing the Firewall Rule metadata

          • createdDate<~String> - The date the resource was created

          • createdBy<~String> - The user who created the resource

          • etag<~String> - The etag for the resource

          • lastModifiedDate<~String> - The last time the resource has been modified

          • lastModifiedBy<~String> - The user who last modified the resource

          • state<~String> - Firewall Rule state

        • properties<~Hash> - Hash containing the Firewall Rule properties

          • name<~String> - The name of the Firewall Rule

          • sourceMac<~String> - Only traffic originating from the respective MAC address is allowed.

            Valid format: aa:bb:cc:dd:ee:ff. Value null allows all source MAC address
          • sourceIp<~String> - Only traffic originating from the respective IPv4 address is allowed. Value null allows all source IPs

          • targetIp<~String> - In case the target NIC has multiple IP addresses, only traffic directed

            to the respective IP address of the NIC is allowed. Value null allows all target IPs
            
          • icmpCode<~String> - Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. Value null allows all codes

          • icmpType<~String> - Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen. Value null allows all types

          • portRangeStart<~String> - Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen.

            Leave portRangeStart and portRangeEnd value null to allow all ports
            
          • portRangeEnd<~String> - Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen.

            Leave portRangeStart and portRangeEnd null to allow all ports
            

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/update_firewall_rule.rb, line 54
def update_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id, options = {})
  request(
      :expects => [202],
      :method  => 'PATCH',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}/firewallrules/#{firewall_rule_id}",
      :body    => Fog::JSON.encode(options)
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
update_image(image_id, options={}) click to toggle source

Update an existing image

Parameters

  • image_id<~String> - UUID of the image resource

  • options<~Hash>:

    • name<~String> - The name of the image

    • description<~String> - The description of the image

    • licenceType<~String> - The image's licence type: LINUX, WINDOWS, or UNKNOWN

    • cpuHotPlug<~String> - This image is capable of CPU hot plug (no reboot required)

    • cpuHotUnplug<~String> - This image is capable of CPU hot unplug (no reboot required)

    • ramHotPlug<~String> - This image is capable of memory hot plug (no reboot required)

    • ramHotUnplug<~String> - This image is capable of memory hot unplug (no reboot required)

    • nicHotPlug<~String> - This image is capable of nic hot plug (no reboot required)

    • nicHotUnplug<~String> - This image is capable of nic hot unplug (no reboot required)

    • discVirtioHotPlug<~String> - This image is capable of Virt-IO drive hot plug (no reboot required)

    • discVirtioHotUnplug<~String> - This image is capable of Virt-IO drive hot unplug (no reboot required)

    • discScsiHotPlug<~String> - This image is capable of Scsi drive hot plug (no reboot required)

    • discScsiHotUnplug<~String> - This image is capable of Scsi drive hot unplug (no reboot required)

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - The resource's unique identifier

        • type<~String> - The type of the requested resource

        • href<~String> - URL to the object’s representation (absolute path)

        • metadata<~Hash> - Hash containing the image metadata

          • createdDate<~String> - The date the resource was created

          • createdBy<~String> - The user who created the resource

          • etag<~String> - The etag for the resource

          • lastModifiedDate<~String> - The last time the resource has been modified

          • lastModifiedBy<~String> - The user who last modified the resource

          • state<~String> - Volume state

        • properties<~Hash> - Hash containing the volume properties

          • name<~String> - The name of the image

          • description<~String> - The description of the image

          • location<~String> - The image's location

          • size<~Integer> - The size of the image in GB

          • cpuHotPlug<~Boolean> - This image is capable of CPU hot plug (no reboot required)

          • cpuHotUnplug<~Boolean> - This image is capable of CPU hot unplug (no reboot required)

          • ramHotPlug<~Boolean> - This image is capable of memory hot plug (no reboot required)

          • ramHotUnplug<~Boolean> - This image is capable of memory hot unplug (no reboot required)

          • nicHotPlug<~Boolean> - This image is capable of nic hot plug (no reboot required)

          • nicHotUnplug<~Boolean> - This image is capable of nic hot unplug (no reboot required)

          • discVirtioHotPlug<~Boolean> - This image is capable of Virt-IO drive hot plug (no reboot required)

          • discVirtioHotPlug<~Boolean> - This image is capable of Virt-IO drive hot unplug (no reboot required)

          • discScsiHotPlug<~Boolean> - This image is capable of Scsi drive hot plug (no reboot required)

          • discScsiHotUnplug<~Boolean> - This image is capable of Scsi drive hot unplug (no reboot required)

          • licenceType<~String> - The image's licence type: LINUX, WINDOWS, or UNKNOWN

          • imageType<~String> - The type of image: HDD, CDROM

          • public<~String> - Indicates if the image is part of the public repository or not

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/update_image.rb, line 57
def update_image(image_id, options={})
  request(
      :expects => [202],
      :method  => 'PATCH',
      :path    => "/images/#{image_id}",
      :body    => Fog::JSON.encode(options)
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
update_server(datacenter_id, server_id, properties={}) click to toggle source

Update the attributes of an existing virtual server

Parameters

  • datacenter_id<~String> - Required - UUID of the virtual data center

  • server_id<~String> - Required - UUID of the virtual server

  • properties<~Hash>: - A hash containing the server properties

    • name<~String> - Required - The hostname of the server

    • cores<~Integer> - Required - The total number of cores for the server

    • ram<~Integer> - Required - The amount of memory for the server in MB, e.g. 2048.

      Size must be specified in multiples of 256 MB with a minimum of 256 MB;
      however, if ramHotPlug is set to TRUE then a minimum of 1024 MB nust be used
    • availabilityZone<~String> - The availability zone for the server (AUTO, ZONE_1, ZONE_2)

    • bootCdrom<~Hash> - Reference to a CD-ROM used for booting. If not 'null' then bootVolume has to be 'null'

    • bootVolume<~Hash> - Reference to a Volume used for booting. If not 'null’ then bootCdrom has to be 'null’

    • cpuFamily<~String> - Type of CPU assigned (“AMD_OPTERON” or “INTEL_XEON”)

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - The resource's unique identifier

        • type<~String> - The type of the requested resource

        • href<~String> - URL to the object’s representation (absolute path)

        • metadata<~Hash> - A hash containing the server metadata

          • createdDate<~String> - The date the resource was created

          • createdBy<~String> - The user who created the resource

          • etag<~String> - The etag

          • lastModifiedDate<~String> - The last modified time for the resource

          • lastModifiedBy<~String> - The user who last modified the resource

          • state<~String> - Status of the virtual Machine

        • properties<~Hash> - A hash containing the server properties

          • name<~String> - The name of the server

          • cores<~Integer> - The number of cores for the server

          • ram<~Integer> - The amount of memory on the server (in megabytes)

          • availabilityZone<~String> - The availability zone for the server

          • vmState<~String> - The current state of the instance

          • bootCdrom<~Hash> - Reference to a CD-ROM used for booting. If not 'null' then bootVolume has to be 'null'.

          • bootVolume<~Hash> - Reference to a Volume used for booting. If not ‘null’ then bootCdrom has to be ‘null’

            • id<~String> - The resource's unique identifier

            • type<~String> - The type of the requested resource

            • href<~String> - URL to the object’s representation (absolute path)

            • metadata<~Hash> - Hash containing the volume metadata

              • createdDate<~String> - The date the resource was created

              • createdBy<~String> - The user who created the resource

              • etag<~String> - The etag for the resource

              • lastModifiedDate<~String> - The last time the resource has been modified

              • lastModifiedBy<~String> - The user who last modified the resource

              • state<~String> - Volume state

            • properties<~Hash> - Hash containing the volume properties

              • name<~String> - The name of the volume.

              • type<~String> - The volume type, HDD or SSD.

              • size<~Integer> - The size of the volume in GB.

              • image<~String> - The image or snapshot ID.

              • imagePassword<~String> - Indicates if a password is set on the image.

              • sshKeys<~String> - SSH keys

              • bus<~String> - The bus type of the volume (VIRTIO or IDE). Default: VIRTIO.

              • licenceType<~String> - Volume licence type. ( WINDOWS, LINUX, OTHER, UNKNOWN)

              • cpuHotPlug<~Boolean> - This volume is capable of CPU hot plug (no reboot required)

              • cpuHotUnplug<~Boolean> - This volume is capable of CPU hot unplug (no reboot required)

              • ramHotPlug<~Boolean> - This volume is capable of memory hot plug (no reboot required)

              • ramHotUnplug<~Boolean> - This volume is capable of memory hot unplug (no reboot required)

              • nicHotPlug<~Boolean> - This volume is capable of nic hot plug (no reboot required)

              • nicHotUnplug<~Boolean> - This volume is capable of nic hot unplug (no reboot required)

              • discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot plug (no reboot required)

              • discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot unplug (no reboot required)

              • discScsiHotPlug<~Boolean> - This volume is capable of Scsi drive hot plug (no reboot required)

              • discScsiHotUnplug<~Boolean> - This volume is capable of Scsi drive hot unplug (no reboot required)

              • deviceNumber<~Integer> - The LUN ID of the storage volume

          • cpuFamily<~String> - Type of CPU assigned

        • entities<~Hash> - A hash containing the server entities

          • cdroms<~Hash> - A collection of cdroms attached to the server

            • id<~String> - The resource's unique identifier

            • type<~String> - The type of the requested resource

            • href<~String> - URL to the object’s representation (absolute path)

            • items<~Array> - The array containing individual cd rom resources

          • volumes<~Hash> - A collection of volumes attached to the server

            • id<~String> - The resource's unique identifier

            • type<~String> - The type of the requested resource

            • href<~String> - URL to the object’s representation (absolute path)

            • items<~Array> - The array containing individual volume resources (see bootVolume for detailed structure)

          • nics<~Hash> - A collection of NICs attached to the server

            • id<~String> - The resource's unique identifier

            • type<~String> - The type of the requested resource

            • href<~String> - URL to the object’s representation (absolute path)

            • items<~Array> - An array containing individual NIC resources

              • id<~String> - The resource's unique identifier

              • type<~String> - The type of the requested resource

              • href<~String> - URL to the object’s representation (absolute path)

              • metadata<~Hash> - A hash containing the nic metadata

                • createdDate<~String> - The date the resource was created

                • createdBy<~String> - The user who created the resource

                • etag<~String> - The etag for the resource

                • lastModifiedDate<~String> - The last time the resource has been modified

                • lastModifiedBy<~String> - The user who last modified the resource

                • state<~String> - NIC state

              • properties<~Hash> - A hash containing the nic properties

                • name<~String> - The name of the NIC

                • mac<~String> - The MAC address of the NIC

                • ips<~Array> - IPs assigned to the NIC represented as a collection

                • dhcp<~Boolean> - Boolean value that indicates if the NIC is using DHCP or not

                • lan<~integer> - The LAN ID the NIC sits on

                • firewallActive<~Boolean> - Once you add a firewall rule this will reflect a true value

              • entities<~Hash> - A hash containing the nic entities

                • firewallrules<~hash> - A list of firewall rules associated to the NIC represented as a collection

                  • id<~String> - The resource's unique identifier

                  • type<~String> - The type of the requested resource

                  • href<~String> - URL to the object’s representation (absolute path)

                  • items<~Array> - An array of individual firewall rules associated to the NIC

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/update_server.rb, line 114
def update_server(datacenter_id, server_id, properties={})
  request(
      :expects => [202],
      :method  => 'PATCH',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}",
      :body    => Fog::JSON.encode(properties)
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
update_snapshot(snapshot_id, options={}) click to toggle source

Update an existing snapshot

Parameters

  • snapshot_id<~String> - Required, UUID of the snapshot

  • options<~Hash>:

    * name<~String>                 - The name of the snapshot
    * description<~String>          - The description of the snapshot
    * cpuHotPlug<~Boolean>          - This volume is capable of CPU hot plug (no reboot required)
    * cpuHotUnplug<~Boolean>        - This volume is capable of CPU hot unplug (no reboot required)
    * ramHotPlug<~Boolean>          - This volume is capable of memory hot plug (no reboot required)
    * ramHotUnplug<~Boolean>        - This volume is capable of memory hot unplug (no reboot required)
    * nicHotPlug<~Boolean>          - This volume is capable of NIC hot plug (no reboot required)
    * nicHotUnplug<~Boolean>        - This volume is capable of NIC hot unplug (no reboot required)
    * discVirtioHotPlug<~Boolean>   - This volume is capable of Virt-IO drive hot plug (no reboot required)
    * discVirtioHotUnplug<~Boolean> - This volume is capable of Virt-IO drive hot unplug (no reboot required)
    * discScsiHotPlug<~Boolean>     - This volume is capable of SCSI drive hot plug (no reboot required)
    * discScsiHotUnplug<~Boolean>   - This volume is capable of SCSI drive hot unplug (no reboot required)
    * licencetype<~String>          - The snapshot's licence type: LINUX, WINDOWS, or UNKNOWN.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - The resource's unique identifier

      • type<~String> - The type of the requested resource

      • href<~String> - URL to the object’s representation (absolute path)

      • metadata<~Hash> - A hash containing the resource's metadata

        • createdDate<~String> - The date the resource was created

        • createdBy<~String> - The user who created the resource

        • etag<~String> - The etag for the resource

        • lastModifiedDate<~String> - The last time the resource has been modified

        • lastModifiedBy<~String> - The user who last modified the resource

        • state<~String> - Snapshot state (AVAILABLE, BUSY, INACTIVE)

      • properties<~Hash> - A hash containing the resource's properties

        • name<~String> - The name of the snapshot

        • description<~String> - The description of the snapshot

        • location<~String> - The snapshot's location (“de/fkb”, “de/fra”, or “us/las”)

        • version<~Integer> - The version of the data center

        • size<~Integer> - The size of the snapshot in GB

        • cpuHotPlug<~Boolean> - This volume is capable of CPU hot plug (no reboot required)

        • cpuHotUnplug<~Boolean> - This volume is capable of CPU hot unplug (no reboot required)

        • ramHotPlug<~Boolean> - This volume is capable of memory hot plug (no reboot required)

        • ramHotUnplug<~Boolean> - This volume is capable of memory hot unplug (no reboot required)

        • nicHotPlug<~Boolean> - This volume is capable of nic hot plug (no reboot required)

        • nicHotUnplug<~Boolean> - This volume is capable of nic hot unplug (no reboot required)

        • discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot plug (no reboot required)

        • discVirtioHotPlug<~Boolean> - This volume is capable of Virt-IO drive hot unplug (no reboot required)

        • discScsiHotPlug<~Boolean> - This volume is capable of Scsi drive hot plug (no reboot required)

        • discScsiHotUnplug<~Boolean> - This volume is capable of Scsi drive hot unplug (no reboot required)

        • licencetype<~String> - The snapshot's licence type: LINUX, WINDOWS, or UNKNOWN.

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/update_snapshot.rb, line 56
def update_snapshot(snapshot_id, options={})
  request(
      :expects => [202],
      :method  => 'PATCH',
      :path    => "/snapshots/#{snapshot_id}",
      :body    => Fog::JSON.encode(options)
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end

Private Instance Methods

auth_header() click to toggle source
# File lib/fog/profitbricks/compute.rb, line 170
def auth_header
  return Base64.strict_encode64(
    "#{@profitbricks_username}:#{@profitbricks_password}"
  )
end
get_request_id(headers) click to toggle source
# File lib/fog/profitbricks/compute.rb, line 176
def get_request_id(headers)
  location = headers['Location']
  location.match(/requests\/([-a-f0-9]+)/i)[1] unless location.nil?
end