Class: Fog::Compute::ProfitBricks::Real

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/profitbricks/compute.rb,
lib/fog/profitbricks/requests/compute/get_lan.rb,
lib/fog/profitbricks/requests/compute/get_nic.rb,
lib/fog/profitbricks/requests/compute/get_user.rb,
lib/fog/profitbricks/requests/compute/add_share.rb,
lib/fog/profitbricks/requests/compute/get_group.rb,
lib/fog/profitbricks/requests/compute/get_image.rb,
lib/fog/profitbricks/requests/compute/get_share.rb,
lib/fog/profitbricks/requests/compute/create_lan.rb,
lib/fog/profitbricks/requests/compute/create_nic.rb,
lib/fog/profitbricks/requests/compute/delete_lan.rb,
lib/fog/profitbricks/requests/compute/delete_nic.rb,
lib/fog/profitbricks/requests/compute/get_flavor.rb,
lib/fog/profitbricks/requests/compute/get_server.rb,
lib/fog/profitbricks/requests/compute/get_volume.rb,
lib/fog/profitbricks/requests/compute/update_lan.rb,
lib/fog/profitbricks/requests/compute/update_nic.rb,
lib/fog/profitbricks/requests/compute/create_user.rb,
lib/fog/profitbricks/requests/compute/delete_user.rb,
lib/fog/profitbricks/requests/compute/get_all_nic.rb,
lib/fog/profitbricks/requests/compute/get_request.rb,
lib/fog/profitbricks/requests/compute/stop_server.rb,
lib/fog/profitbricks/requests/compute/update_user.rb,
lib/fog/profitbricks/requests/compute/attach_cdrom.rb,
lib/fog/profitbricks/requests/compute/create_group.rb,
lib/fog/profitbricks/requests/compute/delete_group.rb,
lib/fog/profitbricks/requests/compute/delete_image.rb,
lib/fog/profitbricks/requests/compute/delete_share.rb,
lib/fog/profitbricks/requests/compute/detach_cdrom.rb,
lib/fog/profitbricks/requests/compute/get_all_lans.rb,
lib/fog/profitbricks/requests/compute/get_ip_block.rb,
lib/fog/profitbricks/requests/compute/get_location.rb,
lib/fog/profitbricks/requests/compute/get_snapshot.rb,
lib/fog/profitbricks/requests/compute/start_server.rb,
lib/fog/profitbricks/requests/compute/update_group.rb,
lib/fog/profitbricks/requests/compute/update_image.rb,
lib/fog/profitbricks/requests/compute/update_share.rb,
lib/fog/profitbricks/requests/compute/attach_volume.rb,
lib/fog/profitbricks/requests/compute/create_flavor.rb,
lib/fog/profitbricks/requests/compute/create_server.rb,
lib/fog/profitbricks/requests/compute/create_volume.rb,
lib/fog/profitbricks/requests/compute/delete_server.rb,
lib/fog/profitbricks/requests/compute/delete_volume.rb,
lib/fog/profitbricks/requests/compute/detach_volume.rb,
lib/fog/profitbricks/requests/compute/get_all_users.rb,
lib/fog/profitbricks/requests/compute/reboot_server.rb,
lib/fog/profitbricks/requests/compute/update_server.rb,
lib/fog/profitbricks/requests/compute/update_volume.rb,
lib/fog/profitbricks/requests/compute/get_all_groups.rb,
lib/fog/profitbricks/requests/compute/get_all_images.rb,
lib/fog/profitbricks/requests/compute/get_all_shares.rb,
lib/fog/profitbricks/requests/compute/get_datacenter.rb,
lib/fog/profitbricks/requests/compute/create_ip_block.rb,
lib/fog/profitbricks/requests/compute/delete_ip_block.rb,
lib/fog/profitbricks/requests/compute/delete_snapshot.rb,
lib/fog/profitbricks/requests/compute/get_all_flavors.rb,
lib/fog/profitbricks/requests/compute/get_all_servers.rb,
lib/fog/profitbricks/requests/compute/get_all_volumes.rb,
lib/fog/profitbricks/requests/compute/get_group_users.rb,
lib/fog/profitbricks/requests/compute/update_snapshot.rb,
lib/fog/profitbricks/requests/compute/get_all_requests.rb,
lib/fog/profitbricks/requests/compute/add_user_to_group.rb,
lib/fog/profitbricks/requests/compute/create_datacenter.rb,
lib/fog/profitbricks/requests/compute/delete_datacenter.rb,
lib/fog/profitbricks/requests/compute/get_all_ip_blocks.rb,
lib/fog/profitbricks/requests/compute/get_all_locations.rb,
lib/fog/profitbricks/requests/compute/get_all_resources.rb,
lib/fog/profitbricks/requests/compute/get_all_snapshots.rb,
lib/fog/profitbricks/requests/compute/get_firewall_rule.rb,
lib/fog/profitbricks/requests/compute/get_load_balancer.rb,
lib/fog/profitbricks/requests/compute/update_datacenter.rb,
lib/fog/profitbricks/requests/compute/get_attached_cdrom.rb,
lib/fog/profitbricks/requests/compute/get_request_status.rb,
lib/fog/profitbricks/requests/compute/get_all_datacenters.rb,
lib/fog/profitbricks/requests/compute/get_attached_volume.rb,
lib/fog/profitbricks/requests/compute/create_firewall_rule.rb,
lib/fog/profitbricks/requests/compute/create_load_balancer.rb,
lib/fog/profitbricks/requests/compute/delete_firewall_rule.rb,
lib/fog/profitbricks/requests/compute/delete_load_balancer.rb,
lib/fog/profitbricks/requests/compute/get_resource_by_type.rb,
lib/fog/profitbricks/requests/compute/list_attached_cdroms.rb,
lib/fog/profitbricks/requests/compute/update_firewall_rule.rb,
lib/fog/profitbricks/requests/compute/update_load_balancer.rb,
lib/fog/profitbricks/requests/compute/get_load_balanced_nic.rb,
lib/fog/profitbricks/requests/compute/get_resources_by_type.rb,
lib/fog/profitbricks/requests/compute/list_attached_volumes.rb,
lib/fog/profitbricks/requests/compute/create_volume_snapshot.rb,
lib/fog/profitbricks/requests/compute/get_all_firewall_rules.rb,
lib/fog/profitbricks/requests/compute/get_all_load_balancers.rb,
lib/fog/profitbricks/requests/compute/remove_nic_association.rb,
lib/fog/profitbricks/requests/compute/remove_user_from_group.rb,
lib/fog/profitbricks/requests/compute/restore_volume_snapshot.rb,
lib/fog/profitbricks/requests/compute/get_all_contract_resources.rb,
lib/fog/profitbricks/requests/compute/get_all_load_balanced_nics.rb,
lib/fog/profitbricks/requests/compute/associate_nic_to_load_balancer.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.


167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/fog/profitbricks/compute.rb', line 167

def initialize(options = {})
  @profitbricks_username = options[:profitbricks_username]
  @profitbricks_password = options[:profitbricks_password]
  @profitbricks_url      = options[:profitbricks_url] || "https://api.profitbricks.com"
  @user_agent            = options[:profitbricks_user_agent] || ""

  connection_options = options[:connection_options] || {}
  connection_options[:headers] ||= {}
  connection_options[:headers]["User-Agent"] = @user_agent != "" ?  @user_agent + " " + Fog::Core::Connection.user_agents.to_s : Fog::Core::Connection.user_agents.to_s
  connection_options[:omit_default_port] = true
  connection_options[:path_prefix] = "/cloudapi/#{API_VERSION}"

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

Instance Method Details

#add_share(group_id, resource_id, options = {}) ⇒ Object

Adds a specific resource share to a group and optionally allows the setting of permissions for that resource. As an example, you might use this to grant permissions to use an image or snapshot to a specific group.

Parameters

  • options<~Hash>:

    • group_id<~String> - Required, The ID of the specific group to add a resource to.

    • resource_id<~String> - Required, The ID of the specific resource to add.

    • editPrivilege<~Boolean> - The group has permission to edit privileges on this resource.

    • sharePrivilege<~Boolean> - The group has permission to share this resource.

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

      • properties<~Hash> - A collection of properties.

        • editPrivilege<~Boolean> - The group has permission to edit privileges on this resource.

        • sharePrivilege<~Boolean> - The group has permission to share this resource.

ProfitBricks API Documentation


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fog/profitbricks/requests/compute/add_share.rb', line 27

def add_share(group_id, resource_id, options = {})
  share = {
    :properties => options
  }

  request(
    :expects => [202],
    :method   => 'POST',
    :path     => "/um/groups/#{group_id}/shares/#{resource_id}",
    :body     => Fog::JSON.encode(share)
  )
end

#add_user_to_group(group_id, user_id) ⇒ Object

Add an existing user to a group.

Parameters

  • group_id<~String> - Required, The ID of the specific group you want to add a user to.

  • user_id<~String> - Required, The ID of the specific user to add to the group.

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 metadata for the user.

        • etag<~String> - ETag of the user.

        • creationDate<~String> - A time and date stamp indicating when the user was created.

        • lastLogin<~String> - A time and date stamp indicating when the user last logged in.

      • properties<~Hash> - Hash containing the user's properties.

        • firstname<~String> - The first name of the user.

        • lastname<~String> - The last name of the user.

        • email<~String> - The e-mail address of the user.

        • administrator<~Boolean> - Indicates if the user has administrative rights.

        • forceSecAuth<~Boolean> - Indicates if secure (two-factor) authentication was enabled for the user.

        • secAuthActive<~Boolean> - Indicates if secure (two-factor) authentication is enabled for the user.

      • entities<~Hash> - Hash containing resources the user owns, and groups the user is a member of.

        • owns<~Hash> - Hash containing resources the user owns.

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

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

        • groups<~Hash> - Hash containing groups the user is a member of.

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

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

ProfitBricks API Documentation


47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fog/profitbricks/requests/compute/add_user_to_group.rb', line 47

def add_user_to_group(group_id, user_id)
  usr = {
    :id => user_id
  }

  request(
    :expects => [202],
    :method   => 'POST',
    :path     => "/um/groups/#{group_id}/users",
    :body     => Fog::JSON.encode(usr)
  )
end

#associate_nic_to_load_balancer(datacenter_id, load_balancer_id, nic_id) ⇒ Object

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


69
70
71
72
73
74
75
76
77
78
79
80
# 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)
  )
end

#attach_cdrom(datacenter_id, server_id, cdrom_image_id) ⇒ Object

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


45
46
47
48
49
50
51
52
53
54
55
56
# 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)
  )
end

#attach_volume(datacenter_id, server_id, storage_id) ⇒ Object

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


46
47
48
49
50
51
52
53
54
55
56
57
# 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)
  )
end

#create_datacenter(options, entities = {}) ⇒ Object

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.
    * servers<~Hash>        - A collection of servers
    * volumes<~Hash>        - A collection of volumes
    * loadbalancers<~Hash>  - A collection of loadbalancers
    * lans<~Hash>           - A collection of LANs in a 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


43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fog/profitbricks/requests/compute/create_datacenter.rb', line 43

def create_datacenter(options, entities={})
  datacenter = {
    :properties => options,
    :entities => entities
  }

  request(
    :expects => [202],
    :method => 'POST',
    :path => '/datacenters',
    :body => Fog::JSON.encode(datacenter)
  )
end

#create_firewall_rule(datacenter_id, server_id, nic_id, options = {}) ⇒ Object

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


55
56
57
58
59
60
61
62
63
64
65
66
# 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)
  )
end

#create_flavor(flavor_name, cores, ram) ⇒ Object

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


6
7
8
9
10
11
12
13
14
15
16
17
18
# 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_group(options = {}) ⇒ Object

Create a new group and set group privileges.

Parameters

  • options<~Hash>:

    • name<~String> - Required, The name of the group.

    • createDataCenter<~Boolean> - The group will be allowed to create virtual data centers.

    • createSnapshot<~Boolean> - The group will be allowed to create snapshots.

    • reserveIp<~Boolean> - The group will be allowed to reserve IP addresses.

    • accessActivityLog<~Boolean> - The group will be allowed to access the activity log.

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

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

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

        • createDataCenter<~Boolean> - The group will be allowed to create virtual data centers.

        • createSnapshot<~Boolean> - The group will be allowed to create snapshots.

        • reserveIp<~Boolean> - The group will be allowed to reserve IP addresses.

        • accessActivityLog<~Boolean> - The group will be allowed to access the activity log.

      • entities<~Hash> - A hash containing the group entities.

        • users<~Hash> - A collection of users that belong to this group.

          • 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 user resources.

        • resources<~Hash> - A collection of resources that are assigned to this group.

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

ProfitBricks API Documentation


43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fog/profitbricks/requests/compute/create_group.rb', line 43

def create_group(options = {})
  group = {
    :properties => options
  }

  request(
    :expects => [202],
    :method   => 'POST',
    :path     => "/um/groups",
    :body     => Fog::JSON.encode(group)
  )
end

#create_ip_block(options = {}) ⇒ Object

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


33
34
35
36
37
38
39
40
41
42
43
44
# 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)
  )
end

#create_lan(datacenter_id, properties = {}, entities = {}) ⇒ Object

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

          • ipFailover<~Array> - Attributes related to IP failover groups

        • 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


96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/fog/profitbricks/requests/compute/create_lan.rb', line 96

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

#create_load_balancer(datacenter_id, properties = {}, entities = {}) ⇒ Object

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


39
40
41
42
43
44
45
46
47
48
49
50
51
# 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)
  )
end

#create_nic(datacenter_id, server_id, options = {}, entities = {}) ⇒ Object

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


75
76
77
78
79
80
81
82
83
84
85
86
87
# 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)
  )
end

#create_server(datacenter_id, properties = {}, entities = {}) ⇒ Object

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


119
120
121
122
123
124
125
126
127
128
129
130
131
# 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)
  )
end

#create_user(options = {}) ⇒ Object

Create a new user under a particular contract.

Parameters

  • options<~Hash>:

    • firstname<~String> - Required, The name of the group.

    • lastname<~String> - Required, The group will be allowed to create virtual data centers.

    • email<~String> - Required, The group will be allowed to create snapshots.

    • password<~String> - Required, The group will be allowed to reserve IP addresses.

    • administrator<~Boolean> - The group will be allowed to access the activity log.

    • forceSecAuth<~Boolean> - The group will be allowed to access the activity log.

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 metadata for the user.

        • etag<~String> - ETag of the user.

        • creationDate<~String> - A time and date stamp indicating when the user was created.

        • lastLogin<~String> - A time and date stamp indicating when the user last logged in.

      • properties<~Hash> - Hash containing the user's properties.

        • firstname<~String> - The first name of the user.

        • lastname<~String> - The last name of the user.

        • email<~String> - The e-mail address of the user.

        • administrator<~Boolean> - Indicates if the user has administrative rights.

        • forceSecAuth<~Boolean> - Indicates if secure (two-factor) authentication was enabled for the user.

        • secAuthActive<~Boolean> - Indicates if secure (two-factor) authentication is enabled for the user.

ProfitBricks API Documentation


35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fog/profitbricks/requests/compute/create_user.rb', line 35

def create_user(options = {})
  user = {
    :properties => options
  }

  request(
    :expects => [202],
    :method   => 'POST',
    :path     => "/um/users",
    :body     => Fog::JSON.encode(user)
  )
end

#create_volume(datacenter_id, options = {}) ⇒ Object

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

    • imageAlias<~String> - Required**, an alias to a ProfitBricks public image. Use instead of “image”.

    • 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


61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/fog/profitbricks/requests/compute/create_volume.rb', line 61

def create_volume(datacenter_id, options = {})
  volume = {
    :properties => options
  }

  request(
    :expects => [202],
    :method   => 'POST',
    :path     => "/datacenters/#{datacenter_id}/volumes",
    :body     => Fog::JSON.encode(volume)
  )
end

#create_volume_snapshot(datacenter_id, volume_id, options = {}) ⇒ Object

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


45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fog/profitbricks/requests/compute/create_volume_snapshot.rb', line 45

def create_volume_snapshot(datacenter_id, volume_id, options = {})
  body = [["name", options[:name]]] if options[:name]

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

#delete_datacenter(datacenter_id) ⇒ Object

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


15
16
17
18
19
20
21
# 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}"
  )
end

#delete_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id) ⇒ Object

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


18
19
20
21
22
23
24
# 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}"
  )
end

#delete_group(group_id) ⇒ Object

Delete a single group. Resources that are assigned to the group are NOT deleted, but are no longer accessible to the group members unless the member is a Contract Owner, Admin, or Resource Owner.

Parameters

  • group_id<~String> - UUID of the group

Returns

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

ProfitBricks API Documentation


17
18
19
20
21
22
23
# File 'lib/fog/profitbricks/requests/compute/delete_group.rb', line 17

def delete_group(group_id)
  request(
    :expects => [202],
    :method  => 'DELETE',
    :path    => "/um/groups/#{group_id}"
  )
end

#delete_image(image_id) ⇒ Object

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


15
16
17
18
19
20
21
# 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}"
  )
end

#delete_ip_block(ip_block_id) ⇒ Object

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


15
16
17
18
19
20
21
# 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}"
  )
end

#delete_lan(datacenter_id, lan_id) ⇒ Object

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


16
17
18
19
20
21
22
# File 'lib/fog/profitbricks/requests/compute/delete_lan.rb', line 16

def delete_lan(datacenter_id, lan_id)
  request(
    :expects => [202],
    :method  => 'DELETE',
    :path    => "/datacenters/#{datacenter_id}/lans/#{lan_id}"
  )
end

#delete_load_balancer(datacenter_id, load_balancer_id) ⇒ Object

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


16
17
18
19
20
21
22
# 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}"
  )
end

#delete_nic(datacenter_id, server_id, nic_id) ⇒ Object

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


17
18
19
20
21
22
23
# 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}"
  )
end

#delete_server(datacenter_id, server_id) ⇒ Object

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


18
19
20
21
22
23
24
# 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}"
  )
end

#delete_share(group_id, resource_id) ⇒ Object

Remove a resource share from a specified group.

Parameters

  • group_id<~String> - Required, The ID of the specific group containing the resource to delete.

  • resource_id<~String> - Required, The ID of the specific resource to delete.

Returns

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

ProfitBricks API Documentation


16
17
18
19
20
21
22
# File 'lib/fog/profitbricks/requests/compute/delete_share.rb', line 16

def delete_share(group_id, resource_id)
  request(
    :expects => [202],
    :method  => 'DELETE',
    :path    => "/um/groups/#{group_id}/shares/#{resource_id}"
  )
end

#delete_snapshot(snapshot_id) ⇒ Object

Delete virtual data center

Parameters

  • snapshot_id<~String> - UUID of the snapshot

Returns

  • response<~Excon::Response>

ProfitBricks API Documentation


14
15
16
17
18
19
20
# 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}"
  )
end

#delete_user(user_id) ⇒ Object

Blacklists the user, disabling them. The user is not completely purged, therefore if you anticipate needing to create a user with the same name in the future, we suggest renaming the user before you delete it.

Parameters

  • user_id<~String> - UUID of the user

Returns

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

ProfitBricks API Documentation


17
18
19
20
21
22
23
# File 'lib/fog/profitbricks/requests/compute/delete_user.rb', line 17

def delete_user(user_id)
  request(
    :expects => [202],
    :method  => 'DELETE',
    :path    => "/um/users/#{user_id}"
  )
end

#delete_volume(datacenter_id, volume_id) ⇒ Object

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


16
17
18
19
20
21
22
# 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}"
  )
end

#detach_cdrom(datacenter_id, server_id, cdrom_id) ⇒ Object

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


17
18
19
20
21
22
23
# 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}"
  )
end

#detach_volume(datacenter_id, server_id, volume_id) ⇒ Object

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


18
19
20
21
22
23
24
# 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}"
  )
end

#get_all_contract_resourcesObject

Get all contract resources

Parameters

  • None

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

      • properties<~Hash>

        • contractNumber<~Integer> - The contract number that the returned information is from

        • owner<~String> - The username of the Contract Owner

        • status<~String> - The status of the contract. [ BILLABLE…]

        • resourceLimits<~Hash> - An object containing the contract's resource limits

          • coresPerServer<~Integer> - Maximum number of CPU cores per server

          • coresPerContract<~Integer> - Maximum number of CPU cores per contract

          • coresProvisioned<~Integer> - The total number of CPU cores that have been provisioned

          • ramPerServer<~Integer> - The maximum amount of RAM (in MB) that may be provisioned for a particular server under this contract

          • ramPerContract<~Integer> - The maximum amount of RAM (in MB) that may be provisioned under this contract

          • ramProvisioned<~Integer> - The amount of RAM (in MB) that has been provisioned under this contract

          • hddLimitPerVolume<~Integer> - The maximum size (in MB) of an individual hard disk volume

          • hddLimitPerContract<~Integer> - The maximum amount of hard disk space (in MB) that may be provisioned under this contract

          • hddVolumeProvisioned<~Integer> - The amount of hard disk space (in MB) that is currently provisioned

          • ssdLimitPerVolume<~Integer> - The maximum size (in MB) of an individual solid state disk volume

          • ssdLimitPerContract<~Integer> - The maximum amount of solid state disk space (in MB) that may be provisioned under this contract

          • ssdVolumeProvisioned<~Integer> - The amount of solid state disk space (in MB) that is currently provisioned

          • reservableIps<~Integer> - The maximum number of static public IP addresses that may be reserved by this customer across all contracts

          • reservedIpsOnContract<~Integer> - The maximum number of static public IP addresses that can be reserved under this contract

          • reservedIpsInUse<~Integer> - The number of static public IP addresses that have been reserved

ProfitBricks API Documentation


36
37
38
39
40
41
42
# File 'lib/fog/profitbricks/requests/compute/get_all_contract_resources.rb', line 36

def get_all_contract_resources
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "/contracts"
  )
end

#get_all_datacentersObject

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


40
41
42
43
44
45
46
# 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) ⇒ Object

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


45
46
47
48
49
50
51
# 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_flavorsObject


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 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'        => 14_336,
        'cores'      => 8
      },
      {
        'flavorId'   => '8b2b835d-be09-48cf-aae2-7e35aafe92d6',
        'flavorName' => 'Memory Intensive Small',
        'ram'        => 16_384,
        'cores'      => 2
      },
      {
        'flavorId'   => '45c28f8b-6a67-4f69-8c94-231d371da2b6',
        'flavorName' => 'Memory Intensive Medium',
        'ram'        => 28_672,
        'cores'      => 4
      },
      {
        'flavorId' => '1d22436d-d958-4151-b144-43a8e180c4c4',
        'flavorName'  => 'Memory Intensive Large',
        'ram'         => 57_344,
        'cores'       => 8
      }
    ]
  }
  response
end

#get_all_groupsObject

Retrieve a full list of all groups.

Parameters

  • None

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)

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

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

          • createDataCenter<~Boolean> - The group will be allowed to create virtual data centers.

          • createSnapshot<~Boolean> - The group will be allowed to create snapshots.

          • reserveIp<~Boolean> - The group will be allowed to reserve IP addresses.

          • accessActivityLog<~Boolean> - The group will be allowed to access the activity log.

        • entities<~Hash> - A hash containing the group entities.

          • users<~Hash> - A collection of users that belong to this group.

            • 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 user resources.

          • resources<~Hash> - A collection of resources that are assigned to this group.

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

ProfitBricks API Documentation


42
43
44
45
46
47
48
# File 'lib/fog/profitbricks/requests/compute/get_all_groups.rb', line 42

def get_all_groups
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "/um/groups?depth=1"
  )
end

#get_all_imagesObject

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


47
48
49
50
51
52
53
# 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_blocksObject

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


34
35
36
37
38
39
40
# 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) ⇒ Object

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

          • ipFailover<~Array> - Attributes related to IP failover groups

        • 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


91
92
93
94
95
96
97
# File 'lib/fog/profitbricks/requests/compute/get_all_lans.rb', line 91

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) ⇒ Object

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


72
73
74
75
76
77
78
# 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) ⇒ Object

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


91
92
93
94
95
96
97
# 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_locationsObject

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


25
26
27
28
29
30
31
# 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) ⇒ Object

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


72
73
74
75
76
77
78
# 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_requestsObject

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


22
23
24
25
26
27
28
# 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_resourcesObject

Retrieves a list of all resources and optionally their group associations. Please note that this API call can take a significant amount of time to return when there are a large number of provisioned resources.

Parameters

  • None

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 metadata for the specific resource.

          • createdDate<~String> - A time and date stamp indicating when the resource was created.

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

          • etag<~String> - Resource's ETag.

          • lastModifiedDate<~String> - A time and date stamp indicating when the resource was last modified.

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

          • state<~String> - The current state of the resource. [ AVAILABLE, BUSY, INACTIVE ]

        • entities<~Hash> - A hash containing groups the resource is associated with.

          • groups<~Hash> - A collection of groups associated with the resource.

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

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

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

                • createDataCenter<~Boolean> - The group will be allowed to create virtual data centers.

                • createSnapshot<~Boolean> - The group will be allowed to create snapshots.

                • reserveIp<~Boolean> - The group will be allowed to reserve IP addresses.

                • accessActivityLog<~Boolean> - The group will be allowed to access the activity log.

ProfitBricks API Documentation


46
47
48
49
50
51
52
# File 'lib/fog/profitbricks/requests/compute/get_all_resources.rb', line 46

def get_all_resources
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "/um/resources?depth=2"
  )
end

#get_all_servers(datacenter_id) ⇒ Object

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


107
108
109
110
111
112
113
# 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_shares(group_id) ⇒ Object

Retrieve a full list of all the resources that are shared through this group and lists the permissions granted to the group members for each shared resource.

Parameters

  • group_id<~String> - Required, The ID of a specific group.

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)

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

          • editPrivilege<~Boolean> - The group has permission to edit privileges on this resource.

          • sharePrivilege<~Boolean> - The group has permission to share this resource.

ProfitBricks API Documentation


26
27
28
29
30
31
32
# File 'lib/fog/profitbricks/requests/compute/get_all_shares.rb', line 26

def get_all_shares(group_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "/um/groups/#{group_id}/shares?depth=1"
  )
end

#get_all_snapshotsObject

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


46
47
48
49
50
51
52
# 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_usersObject

Retrieve a list of all the users that have been created under a contract.

Parameters

  • None

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 created resource.

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

        • metadata<~Hash> - Hash containing metadata for the user.

          • etag<~String> - ETag of the user.

          • creationDate<~String> - A time and date stamp indicating when the user was created.

          • lastLogin<~String> - A time and date stamp indicating when the user last logged in.

        • properties<~Hash> - Hash containing the user's properties.

          • firstname<~String> - The first name of the user.

          • lastname<~String> - The last name of the user.

          • email<~String> - The e-mail address of the user.

          • administrator<~Boolean> - Indicates if the user has administrative rights.

          • forceSecAuth<~Boolean> - Indicates if secure (two-factor) authentication was enabled for the user.

          • secAuthActive<~Boolean> - Indicates if secure (two-factor) authentication is enabled for the user.

        • entities<~Hash> - Hash containing resources the user owns, and groups the user is a member of.

          • owns<~Hash> - Hash containing resources the user owns.

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

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

          • groups<~Hash> - Hash containing groups the user is a member of.

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

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

ProfitBricks API Documentation


50
51
52
53
54
55
56
# File 'lib/fog/profitbricks/requests/compute/get_all_users.rb', line 50

def get_all_users
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "/um/users?depth=1"
  )
end

#get_all_volumes(datacenter_id) ⇒ Object

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


48
49
50
51
52
53
54
# 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) ⇒ Object

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


45
46
47
48
49
50
51
# 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) ⇒ Object

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


46
47
48
49
50
51
52
# 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) ⇒ Object

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


37
38
39
40
41
42
43
# 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"
  )
end

#get_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id) ⇒ Object

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


42
43
44
45
46
47
48
# 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"
  )
end

#get_flavor(flavor_id) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 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"        => 14_336,
        "cores"      => 8
      },
      {
        "flavorId"   => "8b2b835d-be09-48cf-aae2-7e35aafe92d6",
        "flavorName" => "Memory Intensive Small",
        "ram"        => 16_384,
        "cores"      => 2
      },
      {
        "flavorId"   => "45c28f8b-6a67-4f69-8c94-231d371da2b6",
        "flavorName" => "Memory Intensive Medium",
        "ram"        => 28_672,
        "cores"      => 4
      },
      {
        "flavorId"   => "1d22436d-d958-4151-b144-43a8e180c4c4",
        "flavorName" => "Memory Intensive Large",
        "ram"        => 57_344,
        "cores"      => 8
      }
    ].find { |flavor| flavor["flavorId"] == flavor_id } || raise(Fog::Errors::NotFound)
  }
  response
end

#get_group(group_id) ⇒ Object

Retrieves the attributes of a given volume

Parameters

  • group_id<~String> - Required, UUID of the group

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)

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

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

        • createDataCenter<~Boolean> - The group will be allowed to create virtual data centers.

        • createSnapshot<~Boolean> - The group will be allowed to create snapshots.

        • reserveIp<~Boolean> - The group will be allowed to reserve IP addresses.

        • accessActivityLog<~Boolean> - The group will be allowed to access the activity log.

      • entities<~Hash> - A hash containing the group entities.

        • users<~Hash> - A collection of users that belong to this group.

          • 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 user resources.

        • resources<~Hash> - A collection of resources that are assigned to this group.

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

ProfitBricks API Documentation


38
39
40
41
42
43
44
# File 'lib/fog/profitbricks/requests/compute/get_group.rb', line 38

def get_group(group_id)
  request(
    :expects => [200],
    :method  => "GET",
    :path    => "/um/groups/#{group_id}"
  )
end

#get_group_users(group_id) ⇒ Object

Retrieves a full list of all the users that are members of a particular group.

Parameters

  • None

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 created resource.

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

        • metadata<~Hash> - Hash containing metadata for the user.

          • etag<~String> - ETag of the user.

          • creationDate<~String> - A time and date stamp indicating when the user was created.

          • lastLogin<~String> - A time and date stamp indicating when the user last logged in.

        • properties<~Hash> - Hash containing the user's properties.

          • firstname<~String> - The first name of the user.

          • lastname<~String> - The last name of the user.

          • email<~String> - The e-mail address of the user.

          • administrator<~Boolean> - Indicates if the user has administrative rights.

          • forceSecAuth<~Boolean> - Indicates if secure (two-factor) authentication was enabled for the user.

          • secAuthActive<~Boolean> - Indicates if secure (two-factor) authentication is enabled for the user.

        • entities<~Hash> - Hash containing resources the user owns, and groups the user is a member of.

          • owns<~Hash> - Hash containing resources the user owns.

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

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

          • groups<~Hash> - Hash containing groups the user is a member of.

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

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

ProfitBricks API Documentation


50
51
52
53
54
55
56
# File 'lib/fog/profitbricks/requests/compute/get_group_users.rb', line 50

def get_group_users(group_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "/um/groups/#{group_id}/users?depth=2"
  )
end

#get_image(image_id) ⇒ Object

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


43
44
45
46
47
48
49
# 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"
  )
end

#get_ip_block(ip_block_id) ⇒ Object

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


30
31
32
33
34
35
36
# 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"
  )
end

#get_lan(datacenter_id, lan_id) ⇒ Object

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

          • ipFailover<~Array> - Attributes related to IP failover groups

        • 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


92
93
94
95
96
97
98
# File 'lib/fog/profitbricks/requests/compute/get_lan.rb', line 92

def get_lan(datacenter_id, lan_id)
  request(
    :expects => [200],
    :method  => "GET",
    :path    => "/datacenters/#{datacenter_id}/lans/#{lan_id}?depth=5"
  )
end

#get_load_balanced_nic(datacenter_id, load_balancer_id, nic_id) ⇒ Object

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


69
70
71
72
73
74
75
# 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"
  )
end

#get_load_balancer(datacenter_id, load_balancer_id) ⇒ Object

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


88
89
90
91
92
93
94
# 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"
  )
end

#get_location(location_id) ⇒ Object

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


21
22
23
24
25
26
27
# 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"
  )
end

#get_nic(datacenter_id, server_id, nic_id) ⇒ Object

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


69
70
71
72
73
74
75
# 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"
  )
end

#get_request(request_id) ⇒ Object

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


39
40
41
42
43
44
45
# 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}"
  )
end

#get_request_status(request_id) ⇒ Object

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


28
29
30
31
32
33
34
# 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"
  )
end

#get_resource_by_type(resource_type, resource_id) ⇒ Object

Parameters

  • resource_type<~String> - Required, Type of resource. [datacenter, image, snapshot, ipblock]

  • resource_id<~String> - Required, The ID of the specific resource to retrieve information about.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

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

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

      • href<~String> - A URI for accessing the resource object.

      • metadata<~Hash> - Hash containing metadata for the specific resource.

        • createdDate<~String> - A time and date stamp indicating when the resource was created.

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

        • etag<~String> - Resource's ETag.

        • lastModifiedDate<~String> - A time and date stamp indicating when the resource was last modified.

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

        • state<~String> - The current state of the resource. [ AVAILABLE, BUSY, INACTIVE ]

      • entities<~Hash> - Hash containing groups the resource is associated with.

        • groups<~Hash> - Hash containing groups associated with the resource.

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

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

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

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

              • createDataCenter<~Boolean> - The group will be allowed to create virtual data centers.

              • createSnapshot<~Boolean> - The group will be allowed to create snapshots.

              • reserveIp<~Boolean> - The group will be allowed to reserve IP addresses.

              • accessActivityLog<~Boolean> - The group will be allowed to access the activity log.

            • entities<~Hash> - A hash containing the group entities.

              • users<~Hash> - A collection of users that belong to this group.

                • 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 user resources.

              • resources<~Hash> - A collection of resources that are assigned to this group.

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

ProfitBricks API Documentation


53
54
55
56
57
58
59
# File 'lib/fog/profitbricks/requests/compute/get_resource_by_type.rb', line 53

def get_resource_by_type(resource_type, resource_id)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "/um/resources/#{resource_type}/#{resource_id}?depth=2"
  )
end

#get_resources_by_type(resource_type) ⇒ Object

List all shareable resources of a specific type. Optionally include their association with groups, permissions that a group has for the resource, and users that are members of the group.

Parameters

  • resource_type<~String> - Required, Type of resource. [datacenter, image, snapshot, ipblock]

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • id<~String> - “resources”

      • type<~String> - The type of response, in this case it will be “collection”.

      • href<~String> - A URI for accessing the object. “baseurl/um/resources”

      • items<~Array> - A collection containing the available resources.

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

        • type<~String> - The type of object.

        • href<~String> - A URI for accessing the object.

ProfitBricks API Documentation


24
25
26
27
28
29
30
# File 'lib/fog/profitbricks/requests/compute/get_resources_by_type.rb', line 24

def get_resources_by_type(resource_type)
  request(
    :expects => [200],
    :method  => 'GET',
    :path    => "/um/resources/#{resource_type}?depth=2"
  )
end

#get_server(datacenter_id, server_id) ⇒ Object

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


104
105
106
107
108
109
110
# 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"
  )
end

#get_share(group_id, resource_id) ⇒ Object

Retrieves the attributes of a given volume

Parameters

  • group_id<~String> - Required, The ID of the specific group to retrieve.

  • resource_id<~String> - Required, The ID of the specific resource to retrieve.

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)

        • properties<~Hash> - Hash containing the share properties.

          • editPrivilege<~Boolean> - The group has permission to edit privileges on this resource.

          • sharePrivilege<~Boolean> - The group has permission to share this resource.

ProfitBricks API Documentation


26
27
28
29
30
31
32
# File 'lib/fog/profitbricks/requests/compute/get_share.rb', line 26

def get_share(group_id, resource_id)
  request(
    :expects => [200],
    :method  => "GET",
    :path    => "/um/groups/#{group_id}/shares/#{resource_id}"
  )
end

#get_snapshot(snapshot_id) ⇒ Object

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


42
43
44
45
46
47
48
# 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}"
  )
end

#get_user(user_id) ⇒ Object

Retrieve details about a specific user including what groups and resources the user is associated with.

Parameters

  • user_id<~String> - Required, UUID of the user

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> - Hash containing metadata for the user.

        • etag<~String> - ETag of the user.

        • creationDate<~String> - A time and date stamp indicating when the user was created.

        • lastLogin<~String> - A time and date stamp indicating when the user last logged in.

      • properties<~Hash> - Hash containing the user's properties.

        • firstname<~String> - The first name of the user.

        • lastname<~String> - The last name of the user.

        • email<~String> - The e-mail address of the user.

        • administrator<~Boolean> - Indicates if the user has administrative rights.

        • forceSecAuth<~Boolean> - Indicates if secure (two-factor) authentication was enabled for the user.

        • secAuthActive<~Boolean> - Indicates if secure (two-factor) authentication is enabled for the user.

      • entities<~Hash> - Hash containing resources the user owns, and groups the user is a member of.

        • owns<~Hash> - Hash containing resources the user owns.

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

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

        • groups<~Hash> - Hash containing groups the user is a member of.

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

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

ProfitBricks API Documentation


46
47
48
49
50
51
52
# File 'lib/fog/profitbricks/requests/compute/get_user.rb', line 46

def get_user(user_id)
  request(
    :expects => [200],
    :method  => "GET",
    :path    => "/um/users/#{user_id}?depth=1"
  )
end

#get_volume(datacenter_id, volume_id) ⇒ Object

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


45
46
47
48
49
50
51
# 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}"
  )
end

#list_attached_cdroms(datacenter_id, server_id) ⇒ Object

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


48
49
50
51
52
53
54
# 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) ⇒ Object

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


49
50
51
52
53
54
55
# 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) ⇒ Object

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


18
19
20
21
22
23
24
# 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"
  )
end

#remove_nic_association(datacenter_id, load_balancer_id, nic_id) ⇒ Object

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


17
18
19
20
21
22
23
# 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}"
  )
end

#remove_user_from_group(group_id, user_id) ⇒ Object

Remove a user from a group.

Parameters

  • group_id<~String> - Required, The ID of the specific group you want to remove a user from.

  • user_id<~String> - Required, The ID of the specific user to remove from the group.

Returns

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

ProfitBricks API Documentation


16
17
18
19
20
21
22
# File 'lib/fog/profitbricks/requests/compute/remove_user_from_group.rb', line 16

def remove_user_from_group(group_id, user_id)
  request(
    :expects => [202],
    :method   => 'DELETE',
    :path     => "/um/groups/#{group_id}/users/#{user_id}"
  )
end

#request(params) ⇒ Object


182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/fog/profitbricks/compute.rb', line 182

def request(params)
  params[:headers] ||= {}
  params[:headers]["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

  if response && response.body && !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 = {}) ⇒ Object

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


24
25
26
27
28
29
30
31
32
# 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])
  )
end

#start_server(datacenter_id, server_id) ⇒ Object

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


17
18
19
20
21
22
23
# 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"
  )
end

#stop_server(datacenter_id, server_id) ⇒ Object

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


18
19
20
21
22
23
24
# 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"
  )
end

#update_datacenter(datacenter_id, options = {}) ⇒ Object

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


38
39
40
41
42
43
44
45
# 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)
  )
end

#update_firewall_rule(datacenter_id, server_id, nic_id, firewall_rule_id, options = {}) ⇒ Object

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


54
55
56
57
58
59
60
61
# 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)
  )
end

#update_group(group_id, options = {}) ⇒ Object

Update a group. Normally a PUT request would require that you pass all the attributes and values. In this implementation, you must supply the name, even if it isn't being changed. As a convenience, the other four attributes will default to false. You should explicitly set them to true if you want to have them enabled.

Parameters

  • group_id<~String> - Required, The ID of the specific group to update.

  • options<~Hash>:

    • name<~String> - Required, The name of the group.

    • createDataCenter<~Integer> - The group will be allowed to create virtual data centers.

    • createSnapshot<~Integer> - The group will be allowed to create snapshots.

    • reserveIp<~Integer> - The group will be allowed to reserve IP addresses.

    • accessActivityLog<~Integer> - The group will be allowed to access the activity log.

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)

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

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

        • createDataCenter<~Boolean> - The group will be allowed to create virtual data centers.

        • createSnapshot<~Boolean> - The group will be allowed to create snapshots.

        • reserveIp<~Boolean> - The group will be allowed to reserve IP addresses.

        • accessActivityLog<~Boolean> - The group will be allowed to access the activity log.

      • entities<~Hash> - A hash containing the group entities.

        • users<~Hash> - A collection of users that belong to this group.

          • 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 user resources.

        • resources<~Hash> - A collection of resources that are assigned to this group.

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

ProfitBricks API Documentation


48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fog/profitbricks/requests/compute/update_group.rb', line 48

def update_group(group_id, options = {})
  group = {
      :properties => options
  }

  request(
    :expects => [202],
    :method  => 'PUT',
    :path    => "/um/groups/#{group_id}",
    :body    => Fog::JSON.encode(group)
  )
end

#update_image(image_id, options = {}) ⇒ Object

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


57
58
59
60
61
62
63
64
# 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)
  )
end

#update_lan(datacenter_id, lan_id, options = {}) ⇒ Object

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

          • ipFailover<~Array> - Attributes related to IP failover groups

        • 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


95
96
97
98
99
100
101
102
# File 'lib/fog/profitbricks/requests/compute/update_lan.rb', line 95

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

#update_load_balancer(datacenter_id, load_balancer_id, options = {}) ⇒ Object

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


37
38
39
40
41
42
43
44
# 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)
  )
end

#update_nic(datacenter_id, server_id, nic_id, options = {}) ⇒ Object

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


74
75
76
77
78
79
80
81
# 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)
  )
end

#update_server(datacenter_id, server_id, properties = {}) ⇒ Object

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


114
115
116
117
118
119
120
121
# 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)
  )
end

#update_share(group_id, resource_id, options = {}) ⇒ Object

Update a group. Normally a PUT request would require that you pass all the attributes and values. In this implementation, you must supply the name, even if it isn't being changed. As a convenience, the other four attributes will default to false. You should explicitly set them to true if you want to have them enabled.

Parameters

  • group_id<~String> - Required, The ID of the specific group to update.

  • resource_id<~String> - Required, The ID of the specific resource to update.

  • properties<~Hash>: - A collection of properties.

    • editPrivilege<~Boolean> - The group has permission to edit privileges on this resource.

    • sharePrivilege<~Boolean> - The group has permission to share this resource.

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)

        • properties<~Hash> - Hash containing the share properties.

          • editPrivilege<~Boolean> - The group has permission to edit privileges on this resource.

          • sharePrivilege<~Boolean> - The group has permission to share this resource.

ProfitBricks API Documentation


33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/profitbricks/requests/compute/update_share.rb', line 33

def update_share(group_id, resource_id, options = {})
  share = {
      :properties => options
  }

  request(
    :expects => [202],
    :method  => 'PUT',
    :path    => "/um/groups/#{group_id}/shares/#{resource_id}",
    :body    => Fog::JSON.encode(share)
  )
end

#update_snapshot(snapshot_id, options = {}) ⇒ Object

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


56
57
58
59
60
61
62
63
# 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)
  )
end

#update_user(user_id, options = {}) ⇒ Object

Update details about a specific user including their privileges. With this PUT operation, you need to supply values for all the attributes, even if you are only updating some of them.

The password attribute is immutable. It is not allowed in update requests. It is recommended that a new user log into the DCD and change their password.

Parameters

  • user_id<~String> - Required, The ID of the specific user to update.

  • options<~Hash>:

    • firstname<~String> - Required, The name of the group.

    • lastname<~String> - Required, The group will be allowed to create virtual data centers.

    • email<~String> - Required, The group will be allowed to create snapshots.

    • administrator<~Boolean> - Required, The group will be allowed to access the activity log.

    • forceSecAuth<~Boolean> - Required, The group will be allowed to access the activity log.

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 metadata for the user.

        • etag<~String> - ETag of the user.

        • creationDate<~String> - A time and date stamp indicating when the user was created.

        • lastLogin<~String> - A time and date stamp indicating when the user last logged in.

      • properties<~Hash> - Hash containing the user's properties.

        • firstname<~String> - The first name of the user.

        • lastname<~String> - The last name of the user.

        • email<~String> - The e-mail address of the user.

        • administrator<~Boolean> - Indicates if the user has administrative rights.

        • forceSecAuth<~Boolean> - Indicates if secure (two-factor) authentication was enabled for the user.

        • secAuthActive<~Boolean> - Indicates if secure (two-factor) authentication is enabled for the user.

      • entities<~Hash> - Hash containing resources the user owns, and groups the user is a member of.

        • owns<~Hash> - Hash containing resources the user owns.

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

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

        • groups<~Hash> - Hash containing groups the user is a member of.

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

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

ProfitBricks API Documentation


57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fog/profitbricks/requests/compute/update_user.rb', line 57

def update_user(user_id, options = {})
  user = {
      :properties => options
  }

  request(
    :expects => [202],
    :method  => 'PUT',
    :path    => "/um/users/#{user_id}",
    :body    => Fog::JSON.encode(user)
  )
end

#update_volume(datacenter_id, volume_id, options = {}) ⇒ Object

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


49
50
51
52
53
54
55
56
# 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)
  )
end