mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[linode] avail_kernels, linode_create, linode_delete, linode_list, linode_reboot
This commit is contained in:
parent
56592d01d6
commit
50ed143b12
8 changed files with 182 additions and 2 deletions
|
@ -11,6 +11,11 @@ module Fog
|
|||
request 'avail_distributions'
|
||||
request 'avail_kernels'
|
||||
request 'avail_linodeplans'
|
||||
request 'avail_stackscripts'
|
||||
request 'linode_create'
|
||||
request 'linode_delete'
|
||||
request 'linode_list'
|
||||
request 'linode_reboot'
|
||||
|
||||
class Mock
|
||||
include Collections
|
||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
|||
|
||||
class Mock
|
||||
|
||||
def avail_distributions(distribution_id)
|
||||
def avail_distributions(options={})
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
|
||||
class Mock
|
||||
|
||||
def avail_kernels(distribution_id)
|
||||
def avail_kernels(options={})
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
|
|
35
lib/fog/linode/requests/avail_stackscripts.rb
Normal file
35
lib/fog/linode/requests/avail_stackscripts.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
module Fog
|
||||
module Linode
|
||||
class Real
|
||||
|
||||
# Get available stack scripts
|
||||
#
|
||||
# ==== Parameters
|
||||
# * options<~Hash>:
|
||||
# * distributionId<~Integer>: Limit the results to Stackscripts that can be applied to this distribution id
|
||||
# * distributionVendor<~String>: Debian, Ubuntu, Fedora, etc.
|
||||
# * keywords<~String>: Search terms
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# TODO: docs
|
||||
def avail_stackscripts(options={})
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:query => { :api_action => 'avail.stackscripts' }.merge!(options)
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def avail_stackscripts(options={})
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
39
lib/fog/linode/requests/linode_create.rb
Normal file
39
lib/fog/linode/requests/linode_create.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
module Fog
|
||||
module Linode
|
||||
class Real
|
||||
|
||||
# Creates a linode and assigns you full privileges
|
||||
#
|
||||
# ==== Parameters
|
||||
# * datacenter_id<~Integer>: id of datacenter to place new linode in
|
||||
# * payment_term<~Integer>: Subscription term in months, in [1, 12, 24]
|
||||
# * plan_id<~Integer>: id of plan to boot new linode with
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# TODO: docs
|
||||
def linode_create(datacenter_id, payment_term, plan_id)
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:query => {
|
||||
:api_action => 'linode.create',
|
||||
:datacenterId => datacenter_id,
|
||||
:paymentTerm => payment_term,
|
||||
:planId => plan_id
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def linode_create(datacenter_id, payment_term, plan_id)
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
34
lib/fog/linode/requests/linode_delete.rb
Normal file
34
lib/fog/linode/requests/linode_delete.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
module Fog
|
||||
module Linode
|
||||
class Real
|
||||
|
||||
# List all linodes user has access or delete to
|
||||
#
|
||||
# ==== Parameters
|
||||
# * linode_id<~Integer>: id of linode to delete
|
||||
# * options<~Hash>:
|
||||
# * skipChecks<~Boolean>: skips safety checks and always deletes
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# TODO: docs
|
||||
def linode_delete(linode_id, options={})
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:query => { :api_action => 'linode.delete', :linodeId => linode_id }.merge!(options)
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def linode_delete(linode_id, options={})
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
33
lib/fog/linode/requests/linode_list.rb
Normal file
33
lib/fog/linode/requests/linode_list.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
module Fog
|
||||
module Linode
|
||||
class Real
|
||||
|
||||
# List all linodes user has access or delete to
|
||||
#
|
||||
# ==== Parameters
|
||||
# * options<~Hash>:
|
||||
# * linodeId<~Integer>: Limit the list to the specified LinodeID
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# TODO: docs
|
||||
def linode_list(options={})
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:query => { :api_action => 'linode.list' }.merge!(options)
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def linode_list(options={})
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
34
lib/fog/linode/requests/linode_reboot.rb
Normal file
34
lib/fog/linode/requests/linode_reboot.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
module Fog
|
||||
module Linode
|
||||
class Real
|
||||
|
||||
# Issues a shutdown, and then a boot job for a given linode
|
||||
#
|
||||
# ==== Parameters
|
||||
# * linode_id<~Integer>: id of linode to reboot
|
||||
# * options<~Hash>:
|
||||
# * configId<~Boolean>: id of config to boot server with
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Array>:
|
||||
# TODO: docs
|
||||
def linode_reboot(linode_id, options={})
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:query => { :api_action => 'linode.reboot', :linodeId => linode_id }.merge!(options)
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def linode_reboot(linode_id, options={})
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue