diff --git a/lib/fog/linode.rb b/lib/fog/linode.rb index 3ee767803..a3439d812 100644 --- a/lib/fog/linode.rb +++ b/lib/fog/linode.rb @@ -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 diff --git a/lib/fog/linode/requests/avail_distributions.rb b/lib/fog/linode/requests/avail_distributions.rb index cc59d55c7..b2b29bd42 100644 --- a/lib/fog/linode/requests/avail_distributions.rb +++ b/lib/fog/linode/requests/avail_distributions.rb @@ -24,7 +24,7 @@ module Fog class Mock - def avail_distributions(distribution_id) + def avail_distributions(options={}) Fog::Mock.not_implemented end diff --git a/lib/fog/linode/requests/avail_kernels.rb b/lib/fog/linode/requests/avail_kernels.rb index 460cd9098..9f5417904 100644 --- a/lib/fog/linode/requests/avail_kernels.rb +++ b/lib/fog/linode/requests/avail_kernels.rb @@ -25,7 +25,7 @@ module Fog class Mock - def avail_kernels(distribution_id) + def avail_kernels(options={}) Fog::Mock.not_implemented end diff --git a/lib/fog/linode/requests/avail_stackscripts.rb b/lib/fog/linode/requests/avail_stackscripts.rb new file mode 100644 index 000000000..38c9eed9d --- /dev/null +++ b/lib/fog/linode/requests/avail_stackscripts.rb @@ -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 diff --git a/lib/fog/linode/requests/linode_create.rb b/lib/fog/linode/requests/linode_create.rb new file mode 100644 index 000000000..8bdc56c57 --- /dev/null +++ b/lib/fog/linode/requests/linode_create.rb @@ -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 diff --git a/lib/fog/linode/requests/linode_delete.rb b/lib/fog/linode/requests/linode_delete.rb new file mode 100644 index 000000000..ac6640795 --- /dev/null +++ b/lib/fog/linode/requests/linode_delete.rb @@ -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 diff --git a/lib/fog/linode/requests/linode_list.rb b/lib/fog/linode/requests/linode_list.rb new file mode 100644 index 000000000..0975d3e2b --- /dev/null +++ b/lib/fog/linode/requests/linode_list.rb @@ -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 diff --git a/lib/fog/linode/requests/linode_reboot.rb b/lib/fog/linode/requests/linode_reboot.rb new file mode 100644 index 000000000..d37f7f13a --- /dev/null +++ b/lib/fog/linode/requests/linode_reboot.rb @@ -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