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

associate_nic_to_load_balancer(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>:

    • 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/associate_nic_to_load_balancer.rb, line 69
def associate_nic_to_load_balancer(datacenter_id, load_balancer_id, nic_id)
  nic = {
      :id => nic_id
  }

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

Attach a CD-ROM to an existing server.

Parameters

  • datacenter_id - Required - The unique ID of the data center

  • server_id<~String> - Required - The unique ID of the server

  • cdrom_image_id<~String> - Required - The unique ID of a CD-ROM image

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/attach_cdrom.rb, line 45
def attach_cdrom(datacenter_id, server_id, cdrom_image_id)
  volume = {
      :id => cdrom_image_id
  }

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

Attach a pre-existing storage volume to the server.

Parameters

  • datacenter_id - Required - The unique ID of the data center

  • server_id<~String> - Required - The unique ID of the server

  • storage_id<~String> - Required - The unique ID of a storage volume

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 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<~Boolean> - Indicates if a password is set on the image.

        • 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

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/attach_volume.rb, line 46
def attach_volume(datacenter_id, server_id, storage_id)
  volume = {
      :id => storage_id
  }

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

Create a new virtual data center

Parameters

  • options<~Hash>:

    * name<~String>         - The name of the data center
    * region<~String>       - The physical location where the data center will be created ("de/fkb", "de/fra", or "us/las")
    * description<~String>  - An optional description for the data center, e.g. staging, production.

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> - Data center state (AVAILABLE, BUSY, INACTIVE)

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

        • name<~String> - The name of the data center

        • description<~String> - The description of the data center

        • location<~String> - The location where the data center was provisioned (“de/fkb”, “de/fra”, or “us/las”)

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

        • features<~Array> - The features of the data center

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

        • servers<~Hash> - A collection that represents the servers in a data center

        • volumes<~Hash> - A collection that represents volumes in a data center

        • loadbalancers<~Hash> - A collection that represents the loadbalancers in a data center

        • lans<~Hash> - A collection that represents the LANs in a data center

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/create_datacenter.rb, line 39
def create_datacenter(options)
  datacenter = {
      :properties => options
  }

  request(
    :expects  => [202],
    :method   => 'POST',
    :path     => '/datacenters',
    :body     => Fog::JSON.encode(datacenter)
  )
end
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_ip_block(options = {}) click to toggle source

Creates a LAN within a data center

Parameters

  • properties<~Hash>:

    • location<~String> - Required - This must be one of the locations: us/las, de/fra, de/fkb

    • size<~Integer> - Required - The desired size of the IP block

    • name<~String> - A descriptive name for the IP block

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 IP Block 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> - IP Block state

      • properties<~Hash> - Hash containing the IP Block properties

        • ips<~Array> - A collection of IPs associated with the IP Block

        • location<~String> - Location the IP block resides in

        • size<~Integer> - Number of IP addresses in the block

        • name<~String> - A descriptive name given to the IP block

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/create_ip_block.rb, line 33
def create_ip_block(options = {})
  ip_block = {
      :properties => options
  }

  request(
      :expects  => [202],
      :method   => 'POST',
      :path     => "/ipblocks",
      :body     => Fog::JSON.encode(ip_block)
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
create_lan(datacenter_id, properties={}, entities={}) click to toggle source

Creates a LAN within a data center

Parameters

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

  • properties<~Hash>:

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

    • public<~Integer> - Boolean indicating if the LAN faces the public Internet or not

  • entities<~Hash>:

    • nics<~Array> - A collection of NICs associated with the LAN

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)

      • items<~Hash> - Collection of individual lan objects

        • 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 LAN 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> - LAN state

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

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

          • public<~Boolean> - Boolean indicating if the LAN faces the public Internet or not

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

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

            • 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)

            • items<~Hash> - Collection of individual nic objects

              • 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_lan.rb, line 95
def create_lan(datacenter_id, properties={}, entities={})
    lan = {
        :properties => properties,
        :entities   => entities
    }

    request(
        :expects  => [202],
        :method   => 'POST',
        :path     => "/datacenters/#{datacenter_id}/lans",
        :body     => Fog::JSON.encode(lan)
    )
rescue => error
  Fog::Errors::NotFound.new(error)
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
create_volume_snapshot(datacenter_id, volume_id, options={}) click to toggle source

Creates a snapshot of a volume within the data center. A snapshot can be used to create a new storage volume or to restore a storage volume.

Parameters

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

  • options<~Hash>:

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

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

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 snapshot 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        • discScsiHotUnplug<~Boolean> - This snapshot 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/create_volume_snapshot.rb, line 45
def create_volume_snapshot(datacenter_id, volume_id, options={})
  if options[:name]
    body = [["name", options[:name]]]
  end

  request(
      :expects  => [202],
      :method   => 'POST',
      :path     => "/datacenters/#{datacenter_id}/volumes/#{volume_id}/create-snapshot",
      :headers => { "Content-Type" => "application/x-www-form-urlencoded" },
      :body => URI.encode_www_form(body)
  )
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_datacenters() click to toggle source

Get all virtual data centers

Parameters

  • None

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)

      • items<~Array>

        • 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> - Data center state (AVAILABLE, BUSY, INACTIVE)

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

          • name<~String> - The name of the data center

          • description<~String> - The description of the data center

          • location<~String> - The location where the data center was provisioned (“de/fkb”, “de/fra”, or “us/las”)

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

          • features<~Array> - The features of the data center

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

          • servers<~Hash> - A collection that represents the servers in a data center

          • volumes<~Hash> - A collection that represents volumes in a data center

          • loadbalancers<~Hash> - A collection that represents the loadbalancers in a data center

          • lans<~Hash> - A collection that represents the LANs in a data center

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/get_all_datacenters.rb, line 40
def get_all_datacenters
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "/datacenters?depth=5"
  )
end
get_all_firewall_rules(datacenter_id, server_id, nic_id) click to toggle source

Retrieves a list of firewall rules associated with a particular NIC

Parameters

  • datacenter_id<~String> - UUID of the datacenter

  • server_id<~String> - UUID of the server

  • nic_id<~String> - UUID of the NIC

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)

      • items<~Hash> - Collection of individual Firewall Rule objects

        • 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/get_all_firewall_rules.rb, line 45
def get_all_firewall_rules(datacenter_id, server_id, nic_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}/firewallrules?depth=5"
  )
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_all_images() click to toggle source

Displays a list of all available images.

Parameters

  • N/A

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)

      • items<~Array>

        • 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/get_all_images.rb, line 47
def get_all_images()
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/images?depth=5"
  )
end
get_all_ip_blocks() click to toggle source

Retrieve a list of IP Blocks

Parameters

  • None

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)

      • items<~Hash> - Collection of individual IP Block objects

        • 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 IP Block 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> - IP Block state

        • properties<~Hash> - Hash containing the IP Block properties

          • ips<~Array> - A collection of IPs associated with the IP Block

          • location<~String> - Location the IP block resides in

          • size<~Integer> - Number of IP addresses in the block

          • name<~String> - A descriptive name given to the IP block

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/get_all_ip_blocks.rb, line 34
def get_all_ip_blocks
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/ipblocks?depth=5"
  )
end
get_all_lans(datacenter_id) click to toggle source

Retrieves a list of LANs

Parameters

  • datacenter_id<~String> - UUID of the datacenter

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)

      • items<~Hash> - Collection of individual lan objects

        • 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 LAN 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> - LAN state

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

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

          • public<~Boolean> - Boolean indicating if the LAN faces the public Internet or not

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

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

            • 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)

            • items<~Hash> - Collection of individual nic objects

              • 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/get_all_lans.rb, line 90
def get_all_lans(datacenter_id)
    request(
        :expects => [200],
        :method  => 'GET',
        :path    => "/datacenters/#{datacenter_id}/lans?depth=1"
    )
end
get_all_load_balanced_nics(datacenter_id, load_balancer_id) click to toggle source

Retrieves a list of NICs associated with the load balancer

Parameters

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

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

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)

      • items<~Hash> - Collection of individual NIC objects

        • 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/get_all_load_balanced_nics.rb, line 72
def get_all_load_balanced_nics(datacenter_id, load_balancer_id)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}/balancednics?depth=5"
  )
end
get_all_load_balancers(datacenter_id) click to toggle source

Retrieve a list of load balancers within the data center

Parameters

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

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)

      • items<~Hash> - Collection of individual Load Balancer objects

        • 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> - 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> - Hash containing the Load Balancer entities

          • balancednics<~Hash> - Hash containing the NICs associated to the Load Balancer, represented as a collection

            • 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)

            • items<~Hash> - Collection of individual NIC objects

              • 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/get_all_load_balancers.rb, line 91
def get_all_load_balancers(datacenter_id)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/datacenters/#{datacenter_id}/loadbalancers?depth=5"
  )
end
get_all_locations() click to toggle source

Get all locations

Parameters

  • None

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)

      • items<~Array>

        • id<~String> - The resource's unique identifier consisting of country/city

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

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

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

          • name<~String> - A descriptive name for the location

          • features<~Array> - Features available at this location

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/get_all_locations.rb, line 25
def get_all_locations
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "/locations?depth=5"
  )
end
get_all_nic(datacenter_id, server_id) click to toggle source

Retrieves a list of NICs

Parameters

  • datacenter_id<~String> - UUID of the datacenter

  • server_id<~String> - UUID of the server

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)

      • items<~Hash> - Collection of individual nic objects

        • 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/get_all_nic.rb, line 72
def get_all_nic(datacenter_id, server_id)
    request(
        :expects => [200],
        :method  => 'GET',
        :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics?depth=5"
    )
end
get_all_requests() click to toggle source

Retrieves a list of requests

Parameters

  • None

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • 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<~Hash> - Collection of individual request 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)

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/get_all_requests.rb, line 22
def get_all_requests
    request(
        :expects => [200],
        :method  => 'GET',
        :path    => "/requests"
    )
end
get_all_servers(datacenter_id) click to toggle source

Get all servers within a datacenter

Parameters

  • datacenter_id<~String> - UUID of the datacenter which contains the servers

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)

      • items<~Array>

        • 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 (NOSTATE, RUNNING, BLOCKED, PAUSED, SHUTDOWN, SHUTOFF, CRASHED)

          • 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/get_all_servers.rb, line 107
def get_all_servers(datacenter_id)

  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/datacenters/#{datacenter_id}/servers?depth=5"
  )
end
get_all_snapshots() click to toggle source

Retrieve a list of all snapshots

Parameters

  • None

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)

      • items<~Array>

        • 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/get_all_snapshots.rb, line 46
def get_all_snapshots
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/snapshots?depth=5"
  )
end
get_all_volumes(datacenter_id) click to toggle source

Retrieve a list of all volumes

Parameters

  • datacenter_id - UUID of the datacenter which contains the volumes

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - Id of the requested resource

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

      • href<~String> - url to the requested resource

      • items<~Array>

        • 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<~Boolean> - Indicates if a password is set on the image.

          • 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

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/get_all_volumes.rb, line 48
def get_all_volumes(datacenter_id)
    request(
        :expects => [200],
        :method  => 'GET',
        :path    => "/datacenters/#{datacenter_id}/volumes?depth=5"
    )
end
get_attached_cdrom(datacenter_id, server_id, cdrom_image_id) click to toggle source

Retrieve the properties of an attached volume

Parameters

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

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

  • cdrom_image_id<~String> - Required - UUID of the attached volume

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/get_attached_cdrom.rb, line 45
def get_attached_cdrom(datacenter_id, server_id, cdrom_image_id)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/cdroms/#{cdrom_image_id}?depth=1"
  )
end
get_attached_volume(datacenter_id, server_id, volume_id) click to toggle source

Retrieve the properties of an attached volume

Parameters

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

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

  • volume_id<~String> - Required - UUID of the attached volume

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 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<~Boolean> - Indicates if a password is set on the image.

        • 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

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/get_attached_volume.rb, line 46
def get_attached_volume(datacenter_id, server_id, volume_id)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/volumes/#{volume_id}?depth=1"
  )
end
get_datacenter(datacenter_id) click to toggle source

Get a virtual data center by id

Parameters

  • options<~Hash>:

    * datacenter_id<~String> - UUID of virtual data center

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> - Data center state (AVAILABLE, BUSY, INACTIVE)

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

        • name<~String> - The name of the data center

        • description<~String> - The description of the data center

        • location<~String> - The location where the data center was provisioned (“de/fkb”, “de/fra”, or “us/las”)

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

        • features<~Array> - The features of the data center

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

        • servers<~Hash> - A collection that represents the servers in a data center

        • volumes<~Hash> - A collection that represents volumes in a data center

        • loadbalancers<~Hash> - A collection that represents the loadbalancers in a data center

        • lans<~Hash> - A collection that represents the LANs in a data center

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/get_datacenter.rb, line 37
def get_datacenter(datacenter_id)
  request(
    :expects => [200],
    :method  => "GET",
    :path    => "/datacenters/#{datacenter_id}?depth=5"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
get_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id) click to toggle source

Retrieves the attributes of a given Firewall Rule

Parameters

  • datacenter_id<~String> - UUID of the datacenter

  • server_id<~String> - UUID of the server

  • nic_id<~String> - UUID of the NIC

  • firewall_rule_id<~String> - UUID of the firewall rule

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/get_firewall_rule.rb, line 42
def get_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id)
  request(
      :expects => [200],
      :method  => "GET",
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}/firewallrules/#{firewall_rule_id}?depth=5"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
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
get_image(image_id) click to toggle source

Retrieves the attributes of a specific image

Parameters

  • image_id<~String> - UUID of virtual data center

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/get_image.rb, line 43
def get_image(image_id)
  request(
      :expects => [200],
      :method  => "GET",
      :path    => "/images/#{image_id}?depth=5"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
get_ip_block(ip_block_id) click to toggle source

Retrieves the attributes of a specific IP Block

Parameters

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

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 IP Block 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> - IP Block state

      • properties<~Hash> - Hash containing the IP Block properties

        • ips<~Array> - A collection of IPs associated with the IP Block

        • location<~String> - Location the IP block resides in

        • size<~Integer> - Number of IP addresses in the block

        • name<~String> - A descriptive name given to the IP block

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/get_ip_block.rb, line 30
def get_ip_block(ip_block_id)
  request(
      :expects => [200],
      :method  => "GET",
      :path    => "/ipblocks/#{ip_block_id}?depth=5"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
get_lan(datacenter_id, lan_id) click to toggle source

Retrieves the attributes of a given LAN

Parameters

  • datacenter_id<~String> - UUID of the datacenter

  • lan_id<~String> - UUID of the LAN

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)

      • items<~Hash> - Collection of individual lan objects

        • 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 LAN 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> - LAN state

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

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

          • public<~Boolean> - Boolean indicating if the LAN faces the public Internet or not

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

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

            • 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)

            • items<~Hash> - Collection of individual nic objects

              • 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/get_lan.rb, line 91
def get_lan(datacenter_id, lan_id)
  request(
      :expects => [200],
      :method  => "GET",
      :path    => "/datacenters/#{datacenter_id}/lans/#{lan_id}?depth=5"
  )
rescue => error
  puts error
  Fog::Errors::NotFound.new(error)
end
get_load_balanced_nic(datacenter_id, load_balancer_id, nic_id) click to toggle source

Retrieves the attributes of a given loadbalanced NIC

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>:

    • 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/get_load_balanced_nic.rb, line 69
def get_load_balanced_nic(datacenter_id, load_balancer_id, nic_id)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}/balancednics/#{nic_id}?depth=5"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
get_load_balancer(datacenter_id, load_balancer_id) click to toggle source

Retrieves the attributes of a given load balancer

Parameters

  • datacenter_id<~String> - UUID of the datacenter

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

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> - 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> - Hash containing the Load Balancer entities

        • balancednics<~Hash> - Hash containing the NICs associated to the Load Balancer, represented as a collection

          • 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)

          • items<~Hash> - Collection of individual NIC objects

            • 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/get_load_balancer.rb, line 88
def get_load_balancer(datacenter_id, load_balancer_id)
  request(
      :expects => [200],
      :method  => "GET",
      :path    => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}?depth=5"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
get_location(location_id) click to toggle source

Get all locations

Parameters

  • location_id<~String> - UUID of the location

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - The resource's unique identifier consisting of country/city

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

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

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

        • name<~String> - A descriptive name for the location

        • features<~Array> - Features available at this location

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/get_location.rb, line 21
def get_location(location_id)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/locations/#{location_id}?depth=5"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
get_nic(datacenter_id, server_id, nic_id) click to toggle source

Retrieves the attributes of a given NIC

Parameters

  • datacenter_id<~String> - UUID of the datacenter

  • server_id<~String> - UUID of the server

  • nic_id<~String> - UUID of the NIC

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/get_nic.rb, line 69
def get_nic(datacenter_id, server_id, nic_id)
  request(
      :expects => [200],
      :method  => "GET",
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}?depth=5"
  )
rescue => error
  puts error
  Fog::Errors::NotFound.new(error)
end
get_request(request_id) click to toggle source

Retrieves the attributes of a specific request

Parameters

  • request_id<~String> - The requests's unique identifier

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • 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> - 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

        • requestStatus<~Hash> - A hash containing the request status data

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

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

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

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

        • method<~String> - The HTTP method used

        • headers<~Hash> - A hash containing the request headers

          • connection<~String>

          • host<~String>

          • x-forwarded-for<~String>

          • content-length<~String>

          • x-reseller<~String>

          • x-forwarded-host<~String>

          • user-agent<~String>

          • x-forwarded-server<~String>

        • body<~String> - The body of the request

        • url<~String> - The targeted URL of the request

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/get_request.rb, line 39
def get_request(request_id)
    request(
        :expects => [200],
        :method  => 'GET',
        :path    => "/requests/#{request_id}"
    )
rescue => error
  Fog::Errors::NotFound.new(error)
end
get_request_status(request_id) click to toggle source

Retrieves the status of the request

Parameters

  • request_id<~String> - The requests's unique identifier

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • 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> - A hash containing the resource's metadata

        • status<~String> - The status of the entire request, e.g. RUNNING

        • message<~String> - The request message

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

        • targets<~Array> - The request status targets represented as a collection

          • target<~Hash> - A hash containing individual target attributes

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

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

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

          • status<~String> - Status of individual items within the request, e.g. DONE

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/get_request_status.rb, line 28
def get_request_status(request_id)
    request(
        :expects => [200],
        :method  => 'GET',
        :path    => "/requests/#{request_id}/status"
    )
rescue => error
  Fog::Errors::NotFound.new(error)
end
get_server(datacenter_id, server_id) click to toggle source

Create new virtual server

Parameters

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

  • server_id<~String> - UUID of the virtual 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 (NOSTATE, RUNNING, BLOCKED, PAUSED, SHUTDOWN, SHUTOFF, CRASHED)

          • 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/get_server.rb, line 104
def get_server(datacenter_id, server_id)
  request(
      :expects => [200],
      :method  => "GET",
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}?depth=5"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
get_snapshot(snapshot_id) click to toggle source

Retrieves the attributes of a specific snapshot

Parameters

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

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/get_snapshot.rb, line 42
def get_snapshot(snapshot_id)
  request(
      :expects => [200],
      :method  => "GET",
      :path    => "/snapshots/#{snapshot_id}"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
get_volume(datacenter_id, volume_id) click to toggle source

Retrieves the attributes of a given volume

Parameters

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

  • volume_id<~String> - UUID of the volume

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 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<~Boolean>     - Indicates if a password is set on the image.
        * 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

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/get_volume.rb, line 45
def get_volume(datacenter_id, volume_id)
  request(
      :expects => [200],
      :method  => "GET",
      :path    => "/datacenters/#{datacenter_id}/volumes/#{volume_id}"
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
list_attached_cdroms(datacenter_id, server_id) click to toggle source

Get a list of CD-ROMs attached to the server

Parameters

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

  • server_id<~String> - Required - UUID of 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)

      • items<~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/list_attached_cdroms.rb, line 48
def list_attached_cdroms(datacenter_id, server_id)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/cdroms?depth=1"
  )
end
list_attached_volumes(datacenter_id, server_id) click to toggle source

Get a list of volumes attached to the server

Parameters

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

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

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - Id of the requested resource

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

      • href<~String> - url to the requested resource

      • items<~Array>

        • 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<~Boolean> - Indicates if a password is set on the image.

          • 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

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/list_attached_volumes.rb, line 49
def list_attached_volumes(datacenter_id, server_id)
  request(
      :expects => [200],
      :method  => 'GET',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/volumes?depth=1"
  )
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_datacenter(datacenter_id, options={}) click to toggle source

Update an existing virtual data center

Parameters

  • options<~Hash>:

    * name<~String>         - The new name of the data center
    * description<~String>  - The optional description of the data center

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> - Data center state (AVAILABLE, BUSY, INACTIVE)

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

        • name<~String> - The name of the data center

        • description<~String> - The description of the data center

        • location<~String> - The location where the data center was provisioned (“de/fkb”, “de/fra”, or “us/las”)

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

        • features<~Array> - The features of the data center

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

        • servers<~Hash> - A collection that represents the servers in a data center

        • volumes<~Hash> - A collection that represents volumes in a data center

        • loadbalancers<~Hash> - A collection that represents the loadbalancers in a data center

        • lans<~Hash> - A collection that represents the LANs in a data center

ProfitBricks API Documentation

# File lib/fog/profitbricks/requests/compute/update_datacenter.rb, line 38
def update_datacenter(datacenter_id, options={})
    request(
        :expects => [202],
        :method  => 'PATCH',
        :path    => "/datacenters/#{datacenter_id}",
        :body    => Fog::JSON.encode(options)
    )
rescue => 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_lan(datacenter_id, lan_id, options={}) click to toggle source

Update LAN properties

Parameters

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

  • lan_id<~String> - Required - UUID of the LAN

  • properties<~Hash>:

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

    • public<~Integer> - Boolean indicating if the LAN faces the public Internet or not

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)

      • items<~Hash> - Collection of individual lan objects

        • 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 LAN 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> - LAN state

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

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

          • public<~Boolean> - Boolean indicating if the LAN faces the public Internet or not

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

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

            • 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)

            • items<~Hash> - Collection of individual nic objects

              • 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/update_lan.rb, line 94
def update_lan(datacenter_id, lan_id, options={})
  request(
    :expects  => [202],
    :method   => 'PATCH',
    :path     => "/datacenters/#{datacenter_id}/lans/#{lan_id}",
    :body     => Fog::JSON.encode(options)
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
update_load_balancer(datacenter_id, load_balancer_id, options={}) click to toggle source

Update a load balancer

Parameters

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

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

  • options<~Hash>:

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

    • ip<~String> - The IP of the Load Balancer

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

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/update_load_balancer.rb, line 37
def update_load_balancer(datacenter_id, load_balancer_id, options={})
  request(
      :expects => [202],
      :method  => 'PATCH',
      :path    => "/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}",
      :body    => Fog::JSON.encode(options)
  )
rescue => error
  Fog::Errors::NotFound.new(error)
end
update_nic(datacenter_id, server_id, nic_id, options={}) click to toggle source

Update a virtual NIC

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

  • options<~Hash>:

    • name<~String> - The name 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

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/update_nic.rb, line 74
def update_nic(datacenter_id, server_id, nic_id, options={})
  request(
      :expects => [202],
      :method  => 'PATCH',
      :path    => "/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_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
update_volume(datacenter_id, volume_id, options={}) click to toggle source

Update a virtual storage

Parameters

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

  • volume_id<~String> - Required, UUID of volume

  • options<~Hash>:

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

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

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 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/update_volume.rb, line 49
def update_volume(datacenter_id, volume_id, options={})
  request(
      :expects => [202],
      :method  => 'PATCH',
      :path    => "/datacenters/#{datacenter_id}/volumes/#{volume_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