Class: Fog::Compute::IBM::Real

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/ibm/compute.rb,
lib/fog/ibm/requests/compute/get_key.rb,
lib/fog/ibm/requests/compute/get_image.rb,
lib/fog/ibm/requests/compute/list_keys.rb,
lib/fog/ibm/requests/compute/create_key.rb,
lib/fog/ibm/requests/compute/delete_key.rb,
lib/fog/ibm/requests/compute/list_vlans.rb,
lib/fog/ibm/requests/compute/modify_key.rb,
lib/fog/ibm/requests/compute/clone_image.rb,
lib/fog/ibm/requests/compute/get_request.rb,
lib/fog/ibm/requests/compute/list_images.rb,
lib/fog/ibm/requests/compute/create_image.rb,
lib/fog/ibm/requests/compute/delete_image.rb,
lib/fog/ibm/requests/compute/get_instance.rb,
lib/fog/ibm/requests/compute/get_location.rb,
lib/fog/ibm/requests/compute/create_address.rb,
lib/fog/ibm/requests/compute/delete_address.rb,
lib/fog/ibm/requests/compute/list_addresses.rb,
lib/fog/ibm/requests/compute/list_instances.rb,
lib/fog/ibm/requests/compute/list_locations.rb,
lib/fog/ibm/requests/compute/create_instance.rb,
lib/fog/ibm/requests/compute/delete_instance.rb,
lib/fog/ibm/requests/compute/modify_instance.rb,
lib/fog/ibm/requests/compute/get_instance_logs.rb,
lib/fog/ibm/requests/compute/get_image_manifest.rb,
lib/fog/ibm/requests/compute/get_image_agreement.rb,
lib/fog/ibm/requests/compute/list_address_offerings.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



62
63
64
# File 'lib/fog/ibm/compute.rb', line 62

def initialize(options={})
  @connection = Fog::IBM::Connection.new(options[:ibm_username], options[:ibm_password])
end

Instance Method Details

#clone_image(image_id, name, description) ⇒ Object

Clones image specified by image_id

Parameters

  • image_id<~String> - id of image to be cloned

  • name<~String> - name of new image

  • description<~String> - description of new image

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘ImageID’<~String>: id of new image



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fog/ibm/requests/compute/clone_image.rb', line 16

def clone_image(image_id, name, description)
  request(
    :method   => 'POST',
    :expects  => 200,
    :path     => "/offerings/image/#{image_id}",
    :body     => {
      'name' => name,
      'description' => description
    }
  )
end

#create_address(location, offering_id, options = {}) ⇒ Object

Requests a new static IP address to be created

Parameters

  • location_id<~String> - id of location

  • offering_id<~String> - id for offering

  • vlan_id<~String> - id of vlan

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘location’<~String>: location of new address

      • ‘offeringId’<~String>: offering id of new address

      • ‘id’<~String>: id

      • ‘ip’<~String>: returns string of spaces (ip not yet allocated right after creation)

      • ‘state’<~Integer>: status of address (0 when new)



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fog/ibm/requests/compute/create_address.rb', line 20

def create_address(location, offering_id, options={})
  request(
    :method   => 'POST',
    :expects  => 200,
    :path     => '/addresses',
    :body     => {
      'offeringID' => offering_id,
      'location'   => location,
      'vlanID'     => options[:vlan_id]
    }
  )
end

#create_image(instance_id, name, description) ⇒ Object

Requests an image to be created from an Instance

Parameters

  • instance_id<~String> - id of instance to save

  • name<~String> - name of image to be created

  • description<~String> - description of image to be created

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘name’<~String>: name of new image

      • ‘createdTime’<~Integer>: epoch time at creation

      • ‘productCodes’<~Array>:

      • ‘id’<~String>: id of new image

      • ‘description’<~String>: description

      • ‘visibility’<~String>: visibility level (“PRIVATE”, etc)

      • ‘state’<~Integer>: status of image



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fog/ibm/requests/compute/create_image.rb', line 22

def create_image(instance_id, name, description)
  request(
    :method   => 'PUT',
    :expects  => 200,
    :path     => "/instances/#{instance_id}",
    :body     => {
      'state'       => 'save',
      'name'        => name,
      'description' => description
    }
  )
end

#create_instance(name, image_id, instance_type, location, options = {}) ⇒ Object

Requests a new Instance to be created.

Parameters

  • name<~String> - The alias to use to reference this instance

  • image_id<~String> - The id of the image to create this instance from

  • instance_type<~String> - The instance type to use for this instance

  • location<~String> - The id of the Location where this instance will be created

  • options<~Hash>:

    • :key_name<~String> - The public key to use for accessing the created instance

    • :ip<~String> - The ID of a static IP address to associate with this instance

    • :volume_id<~String> - The ID of a storage volume to associate with this instance

    • :vlan_id<~String> - The ID of a Vlan offering to associate with this instance.

    • :secondary_ip<~String> - Comma separated list of static IP IDs to associate with this instance.

    • :is_mini_ephermal<~Boolean> - Whether or not the instance should be provisioned with the root segment only

    • :configuration_data<~Hash> - Arbitrary name/value pairs defined by the image being created

    • :anti_collocation_instance<~String> - The ID of an existing anti-collocated instance.

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘name’<~String>: instance name

      • ‘location’<~String>: instance location id

      • ‘keyName’<~String>: instance assigned keypair

      • ‘primaryIP’<~Hash>: assigned ip address, type, and hostname

      • ‘productCodes’<~Array>: associated product codes

      • ‘requestId’<~String>:

      • ‘imageId’<~String>:

      • ‘launchTime’<~Integer>: epoch time in ms representing when the instance was launched



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
# File 'lib/fog/ibm/requests/compute/create_instance.rb', line 33

def create_instance(name, image_id, instance_type, location, options={})
  body_data     = {
    'name'                    => name,
    'imageID'                 => image_id,
    'instanceType'            => instance_type,
    'location'                => location,
    'publicKey'               => options[:key_name],
    'ip'                      => options[:ip],
    'volumeID'                => options[:volume_id],
    'vlanID'                  => options[:vlan_id],
    'isMiniEphemeral'        => options[:is_mini_ephemeral],
    'Configuration Data'      => options[:configuration_data],
    'antiCollocationInstance' => options[:anti_collocation_instance]
  }
  if options[:secondary_ip]
    options[:secondary_ip].split(',').map(&:strip).each_with_index do |n, idx|
      body_data.merge!({"secondary.ip.#{idx}" => n})
    end
  end
  request(
    :method   => 'POST',
    :expects  => 200,
    :path     => '/instances',
    :body     => body_data
  )
end

#create_key(name, public_key = nil) ⇒ Object

Requests a new keypair to be created

Parameters

  • name<~String> - name to give new key

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘keyName’<~String>: name of new key

      • ‘lastModifiedTime’<~Integer>: epoch time of last modification

      • ‘default’<~Bool>: is default?

      • ‘instanceIds’<~Array>: id’s of instances using key (should be empty upon creation)

      • ‘keyMaterial’<~String>: private key contents



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fog/ibm/requests/compute/create_key.rb', line 18

def create_key(name, public_key=nil)
  request(
    :method   => 'POST',
    :expects  => 200,
    :path     => '/keys',
    :body => {
      'name' => name,
      'publicKey' => public_key
    }
  )
end

#delete_address(address_id) ⇒ Object

Deletes the Address that the authenticated user manages with the specified :address_id

Parameters

  • address_id<~String> - Id of address

Returns

  • response<~Excon::Response>:

    • body<~Hash>: *‘success’<~Bool>: true or false for success



14
15
16
17
18
19
20
# File 'lib/fog/ibm/requests/compute/delete_address.rb', line 14

def delete_address(address_id)
  request(
    :method   => 'DELETE',
    :expects  => 200,
    :path     => "/addresses/#{address_id}"
  )
end

#delete_image(image_id) ⇒ Object

Deletes the image that the authenticated user manages with the specified :image_id

Parameters

  • image_id<~String> - Id of image

Returns

  • response<~Excon::Response>:

    • body<~Hash>: *‘success’<~Bool>: true or false for success



14
15
16
17
18
19
20
# File 'lib/fog/ibm/requests/compute/delete_image.rb', line 14

def delete_image(image_id)
  request(
    :method   => 'DELETE',
    :expects  => 200,
    :path     => "/offerings/image/#{image_id}"
  )
end

#delete_instance(instance_id) ⇒ Object

Deletes the Instance that the authenticated user manages with the specified :instance_id

Parameters

  • instance_id<~String> - Id of instance

Returns

  • response<~Excon::Response>:

    • body<~Hash>: *‘success’<~Bool>: true or false for success



14
15
16
17
18
19
20
# File 'lib/fog/ibm/requests/compute/delete_instance.rb', line 14

def delete_instance(instance_id)
  request(
    :method   => 'DELETE',
    :expects  => 200,
    :path     => "/instances/#{instance_id}"
  )
end

#delete_key(key_name) ⇒ Object

Deletes the key specified with key_name

Parameters

  • key_name<~String> - name of key to be deleted

Returns

  • response<~Excon::Response>:

    • body<~Hash>: *‘success’<~Bool>: true or false for success



14
15
16
17
18
19
20
# File 'lib/fog/ibm/requests/compute/delete_key.rb', line 14

def delete_key(key_name)
  request(
    :method   => 'DELETE',
    :expects  => 200,
    :path     => "/keys/#{key_name}"
  )
end

#get_image(image_id) ⇒ Object

Returns details of image specified by id

Parameters

‘image_id’<~String>: id of desired image

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘name’<~String>: image name

      • ‘location’<~String>: instance location id

      • ‘createdTime’<~Integer>: time created in epoch time

      • ‘supportedInstanceTypes’<~Array>: list of prices per image

        • ‘pricePerQuantity’<~Integer>:

        • ‘effectiveDate’<~Fixnum>:

        • ‘rate’<~Float>: price per unit

        • ‘countryCode’<~String>:

        • ‘unitOfMeasure’<~String>: unit of measurement

        • ‘currencyCode’<~String>: currency billed in

      • ‘productCodes’<~Array>:

      • ‘id’<~String>:

      • ‘documentation’<~String>: link to documentation for image

      • ‘manifest’<~String>: link to xml manifest file

      • ‘description’<~String>: text description of image

      • ‘visibility’<~String>: status of visibilty of image. known values so far are “PUBLIC” and “PRIVATE”

      • ‘platform’<~String>: operating system

      • ‘architecture’<~String>: architecture supported by image

      • ‘documentation’<~String>: link to documentation for image

      • ‘owner’<~String>: owner of image

      • ‘state’<~Integer>: state of availability of image



34
35
36
37
38
39
40
# File 'lib/fog/ibm/requests/compute/get_image.rb', line 34

def get_image(image_id)
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => "/offerings/image/#{image_id}"
  )
end

#get_image_agreement(image_id) ⇒ Object

Returns license agreement of image specified by id

Parameters

‘image_id’<~String>: id of desired image

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘text’<~String>: text of license

      • ‘id’<~String>: id of image

      • ‘attachments’<~Array>: Additional agreements attached to image

        • ‘label’<~String>: description of attachment

        • ‘url’<~String>: url to retrieve attachment

        • ‘type’<~Integer>: type of attachment



19
20
21
22
23
24
25
# File 'lib/fog/ibm/requests/compute/get_image_agreement.rb', line 19

def get_image_agreement(image_id)
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => "/offerings/image/#{image_id}/agreement"
  )
end

#get_image_manifest(image_id) ⇒ Object

Returns manifest of image specified by id

Parameters

‘image_id’<~String>: id of desired image

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘manifest’<~String>: manifest of image in xml



14
15
16
17
18
19
20
# File 'lib/fog/ibm/requests/compute/get_image_manifest.rb', line 14

def get_image_manifest(image_id)
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => "/offerings/image/#{image_id}/manifest"
  )
end

#get_instance(instance_id) ⇒ Object

Returns the Instance that the authenticated user manages with the specified :instance_id

Parameters

  • instance_id<~String> - Id of instance

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘name’<~String>: instance name

      • ‘location’<~String>: instance location id

      • ‘keyName’<~String>: instance assigned keypair

      • ‘primaryIP’<~Hash>: assigned ip address, type, and hostname

      • ‘productCodes’<~Array>: associated product codes

      • ‘requestId’<~String>:

      • ‘imageId’<~String>:

      • ‘launchTime’<~Integer>: UNIX time integer representing when the instance was launched

      • ‘id’<~String>: instance id

      • ‘volumes’<~Array>:

      • ‘isMiniEphemeral’<~Boolean>: minimal local storage

      • ‘instanceType’<~String>: instance type

      • ‘diskSize’<~String>: instance disk size

      • ‘requestName’<~String>: instance request name

      • ‘secondaryIP’<~Array>: additional IP Addresses associated with this instance

      • ‘status’<~Integer>: instance status flag

      • ‘software’<~Array>: Software associated with this instance

        • ‘application’<~Hash>: Application name, type, and version (primarily OS information)

      • ‘expirationTime’<~Integer>: UNIX timestamp representing when the instance expires

      • ‘owner’<~String>: instance owner



33
34
35
36
37
38
39
# File 'lib/fog/ibm/requests/compute/get_instance.rb', line 33

def get_instance(instance_id)
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => "/instances/#{instance_id}"
  )
end

#get_instance_logs(instance_id, start_index = nil) ⇒ Object

Get an instance’s logs

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • logs<~Array>:

TODO: docs



12
13
14
15
16
17
18
19
# File 'lib/fog/ibm/requests/compute/get_instance_logs.rb', line 12

def get_instance_logs(instance_id, start_index=nil)
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => "/instances/#{instance_id}/logs" +
                 (start_index ? "?startIndex=#{start_index}" : '')
  )
end

#get_key(key_name) ⇒ Object

Returns details of key by name specified

Parameters

‘key_name’<~String>: name of key to request

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘keyName’<~String>: Name of key

      • ‘lastModifiedTime’<~Integer>: epoch time of last modification

      • ‘default’<~Bool>: bool if key is default for user

      • ‘instanceIds’<~Array>: list of instances associated with key

      • ‘keyMaterial’<~String>: public key



18
19
20
21
22
23
24
# File 'lib/fog/ibm/requests/compute/get_key.rb', line 18

def get_key(key_name)
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => "/keys/#{key_name}"
  )
end

#get_location(location_id) ⇒ Object

Get a location

Parameters

  • location_id<~String> - Id of location

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘name’<~String>: location name

      • ‘location’<~String>:

      • ‘capabilities’<~Array>:

        • ‘oss.storage.format’<~Hash>:

          • ‘entries’<~Array>: list of supported volume formats

          • ‘oss.instance.spec.i386’<~Array>: unsure.. returns empty array

          • ‘oss.instance.spec.x86_64’<~Array>: unsure.. returns empty array

          • ‘oss.storage.availabilityarea’<~Array>: availability area unsupported

      • ‘id’<~String>: id of location

      • ‘description’<~String>: description including geographic location

      • ‘state’<~String>: state of datacenter



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

def get_location(location_id)
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => "/locations/#{location_id}"
  )
end

#get_request(request_id) ⇒ Object

Returns list of instances created with request specified by request_id

Parameters

  • request_id<~String> - Id of request

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

    • instances<~Array>: array of instances created with request

      • ‘name’<~String>: instance name

      • ‘location’<~String>: instance location id

      • ‘keyName’<~String>: instance assigned keypair

      • ‘primaryIP’<~Hash>: assigned ip address, type, and hostname

      • ‘productCodes’<~Array>: associated product codes

      • ‘requestId’<~String>:

      • ‘imageId’<~String>:

      • ‘launchTime’<~Integer>: UNIX time integer representing when the instance was launched

      • ‘id’<~String>: instance id

      • ‘volumes’<~Array>:

      • ‘isMiniEphemeral’<~Boolean>: minimal local storage

      • ‘instanceType’<~String>: instance type

      • ‘diskSize’<~String>: instance disk size

      • ‘requestName’<~String>: instance request name

      • ‘secondaryIP’<~Array>: additional IP Addresses associated with this instance

      • ‘status’<~Integer>: instance status flag

      • ‘software’<~Array>: Software associated with this instance

        • ‘application’<~Hash>: Application name, type, and version (primarily OS information)

      • ‘expirationTime’<~Integer>: UNIX timestamp representing when the instance expires

      • ‘owner’<~String>: instance owner



34
35
36
37
38
39
40
# File 'lib/fog/ibm/requests/compute/get_request.rb', line 34

def get_request(request_id)
  request(
    :expects  => 200,
    :method   => 'GET',
    :path     => "computecloud/enterprise/api/rest/20100331/requests/#{request_id}"
  )
end

#list_address_offeringsObject

Returns the offerings of static address types/pricing for the authenticated user

Parameters

No parameters

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘addresses’<~Array>: list of address offerings

        • ‘price’<~Hash>: pricing info for specific address offering

        • ‘price’<~Hash>: hash containing pricing information

          • ‘pricePerQuantity’<~Integer>:

          • ‘effectiveDate’<~Integer>: starting date price is effective

          • ‘rate’<~Float>: rate per unit

          • ‘countryCode’<~String>:

          • ‘unitOfMeasure’<~String>:

          • ‘currencyCode’<~String>: currency used

        • ‘location’<~String>: datacenter location string

        • ‘ipType’<~Integer>: type of ip address

        • ‘id’<~String>: id of offering



25
26
27
28
29
30
31
# File 'lib/fog/ibm/requests/compute/list_address_offerings.rb', line 25

def list_address_offerings
  request(
    :expects  => 200,
    :method   => 'GET',
    :path     => '/offerings/address'
  )
end

#list_addressesObject

Returns the list of static IP addresses for current user

Parameters

No parameters

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘addresses’<~Array>: list of addresses

        • ‘location’<~String>: location of address

        • ‘mode’<~Integer>:

        • ‘offeringId’<~String>: offering ID

        • ‘id’<~String>: id

        • ‘type’<~Integer>: TODO unsure

        • ‘ip’<~String>: IP address.. with space at the end

        • ‘hostname’<~String>: seems to be same as ip

        • ‘state’<~Integer>: state of address



22
23
24
25
26
27
28
# File 'lib/fog/ibm/requests/compute/list_addresses.rb', line 22

def list_addresses
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => '/addresses'
  )
end

#list_imagesObject

Returns the list of Images available to be provisioned on the IBM DeveloperCloud.

Parameters

No parameters

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘images’<~Array>: list of images

        • ‘name’<~String>: image name

        • ‘location’<~String>: instance location id

        • ‘createdTime’<~Integer>: time created in epoch time

        • ‘supportedInstanceTypes’<~Array>: list of prices per image

          • ‘pricePerQuantity’<~Integer>:

          • ‘effectiveDate’<~Fixnum>:

          • ‘rate’<~Float>: price per unit

          • ‘countryCode’<~String>:

          • ‘unitOfMeasure’<~String>: unit of measurement

          • ‘currencyCode’<~String>: currency billed in

        • ‘productCodes’<~Array>:

        • ‘id’<~String>:

        • ‘documentation’<~String>: link to documentation for image

        • ‘manifest’<~String>: link to xml manifest file

        • ‘description’<~String>: text description of image

        • ‘visibility’<~String>: status of visibilty of image. known values so far are “PUBLIC” and “PRIVATE”

        • ‘platform’<~String>: operating system

        • ‘architecture’<~String>: architecture supported by image

        • ‘documentation’<~String>: link to documentation for image

        • ‘owner’<~String>: owner of image

        • ‘state’<~Integer>: state of availability of image



35
36
37
38
39
40
41
# File 'lib/fog/ibm/requests/compute/list_images.rb', line 35

def list_images
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => '/offerings/image'
  )
end

#list_instancesObject

Returns list of instances that the authenticated user manages.

Parameters

No parameters

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘instances’<~Array>: list of instances

        • ‘name’<~String>: instance name

        • ‘location’<~String>: instance location id

        • ‘keyName’<~String>: instance assigned keypair

        • ‘primaryIP’<~Hash>: assigned ip address, type, and hostname

        • ‘productCodes’<~Array>: associated product codes

        • ‘requestId’<~String>:

        • ‘imageId’<~String>:

        • ‘launchTime’<~Integer>: UNIX time integer representing when the instance was launched

        • ‘id’<~String>: instance id

        • ‘volumes’<~Array>:

        • ‘isMiniEphemeral’<~Boolean>: minimal local storage

        • ‘instanceType’<~String>: instance type

        • ‘diskSize’<~String>: instance disk size

        • ‘requestName’<~String>: instance request name

        • ‘secondaryIP’<~Array>: additional IP Addresses associated with this instance

        • ‘status’<~Integer>: instance status flag

        • ‘software’<~Array>: Software associated with this instance

          • ‘application’<~Hash>: Application name, type, and version (primarily OS information)

        • ‘expirationTime’<~Integer>: UNIX timestamp representing when the instance expires

        • ‘owner’<~String>: instance owner



34
35
36
37
38
39
40
# File 'lib/fog/ibm/requests/compute/list_instances.rb', line 34

def list_instances
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => '/instances'
  )
end

#list_keysObject

Returns list of instances that the authenticated user manages.

Parameters

No parameters

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘instances’<~Array>: list of instances

        • ‘name’<~String>: instance name

        • ‘location’<~String>: instance location id

        • ‘keyName’<~String>: instance assigned keypair

        • ‘primaryIP’<~Hash>: assigned ip address, type, and hostname

        • ‘productCodes’<~Array>: associated product codes

        • ‘requestId’<~String>:

        • ‘imageId’<~String>:

        • ‘launchTime’<~Integer>: UNIX time integer representing when the instance was launched

        • ‘id’<~String>: instance id

        • ‘volumes’<~Array>:

        • ‘isMiniEphemeral’<~Boolean>: minimal local storage

        • ‘instanceType’<~String>: instance type

        • ‘diskSize’<~String>: instance disk size

        • ‘requestName’<~String>: instance request name

        • ‘secondaryIP’<~Array>: additional IP Addresses associated with this instance

        • ‘status’<~Integer>: instance status flag

        • ‘software’<~Array>: Software associated with this instance

          • ‘application’<~Hash>: Application name, type, and version (primarily OS information)

        • ‘expirationTime’<~Integer>: UNIX timestamp representing when the instance expires

        • ‘owner’<~String>: instance owner



34
35
36
37
38
39
40
# File 'lib/fog/ibm/requests/compute/list_keys.rb', line 34

def list_keys
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => '/keys'
  )
end

#list_locationsObject

Returns the list of Images available to be provisioned on the IBM DeveloperCloud.

Parameters

No parameters

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘locations’<~Array>: list of locations



14
15
16
17
18
19
20
# File 'lib/fog/ibm/requests/compute/list_locations.rb', line 14

def list_locations
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => "/locations"
  )
end

#list_vlansObject

Returns the vlan offerings for user

Parameters

No parameters

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘addresses’<~Array>: list of addresses

        • ‘location’<~String>: location of address

        • ‘mode’<~Integer>:

        • ‘offeringId’<~String>: offering ID

        • ‘id’<~String>: id

        • ‘type’<~Integer>: TODO unsure

        • ‘ip’<~String>: IP address.. with space at the end

        • ‘hostname’<~String>: seems to be same as ip

        • ‘state’<~Integer>: state of address



22
23
24
25
26
27
28
# File 'lib/fog/ibm/requests/compute/list_vlans.rb', line 22

def list_vlans
  request(
    :method   => 'GET',
    :expects  => 200,
    :path     => '/offerings/vlan'
  )
end

#modify_instance(instance_id, options = {}) ⇒ Object

Modify an instance

Parameters

  • instance_id<~String> - id of instance to rename

  • params<~Hash> - depends on type of request

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘success’<~Bool>:

OR

  • response<~Excon::Response>:

    • body<~Hash>: ????

      • ‘expirationTime’<~Integer>: new expiration time of instance (epoch)

Note: The feature of dynamically attaching or detaching storage is only
supported by data centers where the KVM host version is RHEL 6.1. If the
feature is not supported by the data center, you will get an exception like
"Unsupported exception. Dynamic features are not supported on the KVM
Host".


26
27
28
29
30
31
32
33
# File 'lib/fog/ibm/requests/compute/modify_instance.rb', line 26

def modify_instance(instance_id, options={})
  request(
    :method   => 'PUT',
    :expects  => 200,
    :path     => "/instances/#{instance_id}",
    :body     => options
  )
end

#modify_key(key_name, params = {}) ⇒ Object

Modify a key

Parameters

  • key_name<~String> - name of key to be modified

  • params<~Hash> - depends on type of request

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘success’<~Bool>: success status of update request



15
16
17
18
19
20
21
22
# File 'lib/fog/ibm/requests/compute/modify_key.rb', line 15

def modify_key(key_name, params={})
  request(
    :method   => 'PUT',
    :expects  => 200,
    :path     => "/keys/#{key_name}",
    :body     => params
  )
end