fog-joyent 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +20 -0
- data/.rubocop_todo.yml +436 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +26 -0
- data/CONTRIBUTING.md +18 -0
- data/CONTRIBUTORS.md +17 -0
- data/Gemfile +4 -0
- data/LICENSE.md +10 -0
- data/README.md +29 -0
- data/Rakefile +12 -0
- data/fog-joyent.gemspec +29 -0
- data/lib/fog/bin/joyent.rb +33 -0
- data/lib/fog/joyent.rb +16 -0
- data/lib/fog/joyent/analytics.rb +310 -0
- data/lib/fog/joyent/compute.rb +272 -0
- data/lib/fog/joyent/core.rb +10 -0
- data/lib/fog/joyent/errors.rb +91 -0
- data/lib/fog/joyent/models/analytics/field.rb +13 -0
- data/lib/fog/joyent/models/analytics/fields.rb +24 -0
- data/lib/fog/joyent/models/analytics/instrumentation.rb +82 -0
- data/lib/fog/joyent/models/analytics/instrumentations.rb +23 -0
- data/lib/fog/joyent/models/analytics/joyent_module.rb +13 -0
- data/lib/fog/joyent/models/analytics/joyent_modules.rb +24 -0
- data/lib/fog/joyent/models/analytics/metric.rb +17 -0
- data/lib/fog/joyent/models/analytics/metrics.rb +16 -0
- data/lib/fog/joyent/models/analytics/transformation.rb +13 -0
- data/lib/fog/joyent/models/analytics/transformations.rb +24 -0
- data/lib/fog/joyent/models/analytics/type.rb +16 -0
- data/lib/fog/joyent/models/analytics/types.rb +24 -0
- data/lib/fog/joyent/models/analytics/value.rb +20 -0
- data/lib/fog/joyent/models/compute/datacenter.rb +11 -0
- data/lib/fog/joyent/models/compute/datacenters.rb +21 -0
- data/lib/fog/joyent/models/compute/flavor.rb +19 -0
- data/lib/fog/joyent/models/compute/flavors.rb +21 -0
- data/lib/fog/joyent/models/compute/image.rb +26 -0
- data/lib/fog/joyent/models/compute/images.rb +30 -0
- data/lib/fog/joyent/models/compute/key.rb +19 -0
- data/lib/fog/joyent/models/compute/keys.rb +32 -0
- data/lib/fog/joyent/models/compute/network.rb +12 -0
- data/lib/fog/joyent/models/compute/networks.rb +14 -0
- data/lib/fog/joyent/models/compute/server.rb +124 -0
- data/lib/fog/joyent/models/compute/servers.rb +35 -0
- data/lib/fog/joyent/models/compute/snapshot.rb +44 -0
- data/lib/fog/joyent/models/compute/snapshots.rb +35 -0
- data/lib/fog/joyent/requests/analytics/create_instrumentation.rb +25 -0
- data/lib/fog/joyent/requests/analytics/delete_instrumentation.rb +23 -0
- data/lib/fog/joyent/requests/analytics/describe_analytics.rb +26 -0
- data/lib/fog/joyent/requests/analytics/get_instrumentation.rb +26 -0
- data/lib/fog/joyent/requests/analytics/get_instrumentation_value.rb +30 -0
- data/lib/fog/joyent/requests/analytics/list_instrumentations.rb +25 -0
- data/lib/fog/joyent/requests/compute/add_machine_tags.rb +19 -0
- data/lib/fog/joyent/requests/compute/create_key.rb +54 -0
- data/lib/fog/joyent/requests/compute/create_machine.rb +16 -0
- data/lib/fog/joyent/requests/compute/create_machine_snapshot.rb +16 -0
- data/lib/fog/joyent/requests/compute/delete_all_machine_metadata.rb +16 -0
- data/lib/fog/joyent/requests/compute/delete_all_machine_tags.rb +15 -0
- data/lib/fog/joyent/requests/compute/delete_key.rb +27 -0
- data/lib/fog/joyent/requests/compute/delete_machine.rb +15 -0
- data/lib/fog/joyent/requests/compute/delete_machine_metadata.rb +16 -0
- data/lib/fog/joyent/requests/compute/delete_machine_snapshot.rb +18 -0
- data/lib/fog/joyent/requests/compute/delete_machine_tag.rb +15 -0
- data/lib/fog/joyent/requests/compute/get_dataset.rb +27 -0
- data/lib/fog/joyent/requests/compute/get_image.rb +28 -0
- data/lib/fog/joyent/requests/compute/get_key.rb +29 -0
- data/lib/fog/joyent/requests/compute/get_machine.rb +29 -0
- data/lib/fog/joyent/requests/compute/get_machine_metadata.rb +24 -0
- data/lib/fog/joyent/requests/compute/get_machine_snapshot.rb +15 -0
- data/lib/fog/joyent/requests/compute/get_machine_tag.rb +18 -0
- data/lib/fog/joyent/requests/compute/get_package.rb +32 -0
- data/lib/fog/joyent/requests/compute/list_datacenters.rb +16 -0
- data/lib/fog/joyent/requests/compute/list_datasets.rb +24 -0
- data/lib/fog/joyent/requests/compute/list_images.rb +25 -0
- data/lib/fog/joyent/requests/compute/list_keys.rb +25 -0
- data/lib/fog/joyent/requests/compute/list_machine_snapshots.rb +15 -0
- data/lib/fog/joyent/requests/compute/list_machine_tags.rb +20 -0
- data/lib/fog/joyent/requests/compute/list_machines.rb +26 -0
- data/lib/fog/joyent/requests/compute/list_networks.rb +26 -0
- data/lib/fog/joyent/requests/compute/list_packages.rb +34 -0
- data/lib/fog/joyent/requests/compute/reboot_machine.rb +15 -0
- data/lib/fog/joyent/requests/compute/resize_machine.rb +16 -0
- data/lib/fog/joyent/requests/compute/start_machine.rb +16 -0
- data/lib/fog/joyent/requests/compute/start_machine_from_snapshot.rb +15 -0
- data/lib/fog/joyent/requests/compute/stop_machine.rb +16 -0
- data/lib/fog/joyent/requests/compute/update_machine_metadata.rb +15 -0
- data/lib/fog/joyent/version.rb +5 -0
- data/tests/helper.rb +18 -0
- data/tests/helpers/mock_helper.rb +16 -0
- data/tests/helpers/succeeds_helper.rb +9 -0
- data/tests/joyent/models/analytics/field_tests.rb +10 -0
- data/tests/joyent/models/analytics/fields_tests.rb +13 -0
- data/tests/joyent/models/analytics/instrumentation_tests.rb +13 -0
- data/tests/joyent/models/analytics/instrumentations_tests.rb +3 -0
- data/tests/joyent/models/analytics/joyent_module_tests.rb +10 -0
- data/tests/joyent/models/analytics/joyent_modules_tests.rb +13 -0
- data/tests/joyent/models/analytics/metric_tests.rb +10 -0
- data/tests/joyent/models/analytics/metrics_tests.rb +20 -0
- data/tests/joyent/models/analytics/transformation_tests.rb +10 -0
- data/tests/joyent/models/analytics/transformations_tests.rb +13 -0
- data/tests/joyent/models/analytics/type_tests.rb +10 -0
- data/tests/joyent/models/analytics/types_tests.rb +13 -0
- data/tests/joyent/requests/analytics/instrumentation_tests.rb +44 -0
- data/tests/joyent/requests/compute/datasets_tests.rb +58 -0
- data/tests/joyent/requests/compute/keys_tests.rb +47 -0
- data/tests/joyent/requests/compute/machines_tests.rb +66 -0
- data/tests/joyent/requests/compute/networks_tests.rb +39 -0
- data/tests/joyent/requests/compute/packages_tests.rb +68 -0
- metadata +235 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Real
|
5
|
+
# https://us-west-1.api.joyentcloud.com/docs#DeleteAllMachineMetadata
|
6
|
+
def delete_machine_metadata(machine_id, key)
|
7
|
+
request(
|
8
|
+
:method => "DELETE",
|
9
|
+
:path => "/my/machines/#{machine_id}/metadata/#{key}",
|
10
|
+
:expects => [200, 204]
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Real
|
5
|
+
def delete_machine_snapshot(machine_id, snapshot)
|
6
|
+
request(
|
7
|
+
:method => "DELETE",
|
8
|
+
:path => "/my/machines/#{machine_id}/snapshots/#{snapshot}",
|
9
|
+
:expects => [200, 204]
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Mock
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Mock
|
5
|
+
def get_dataset(id)
|
6
|
+
if ds = self.data[:datasets][id]
|
7
|
+
res = Excon::Response.new
|
8
|
+
res.status = 200
|
9
|
+
res.body = ds
|
10
|
+
else
|
11
|
+
raise Excon::Errors::NotFound
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Real
|
17
|
+
def get_dataset
|
18
|
+
request(
|
19
|
+
:method => "GET",
|
20
|
+
:path => "/my/datasets",
|
21
|
+
:idempotent => true
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Mock
|
5
|
+
def get_image(id)
|
6
|
+
if ds = self.data[:datasets][id]
|
7
|
+
res = Excon::Response.new
|
8
|
+
res.status = 200
|
9
|
+
res.body = ds
|
10
|
+
else
|
11
|
+
raise Excon::Errors::NotFound
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Real
|
17
|
+
def get_image(id)
|
18
|
+
request(
|
19
|
+
:method => "GET",
|
20
|
+
:path => "/#{@joyent_username}/images/#{id}",
|
21
|
+
:expects => 200,
|
22
|
+
:idempotent => true
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Mock
|
5
|
+
def get_key(keyid)
|
6
|
+
if key = self.data[:keys][keyid]
|
7
|
+
response = Excon::Response.new
|
8
|
+
response.status = 200
|
9
|
+
response.body = key
|
10
|
+
response
|
11
|
+
else
|
12
|
+
raise Excon::Errors::NotFound
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Real
|
18
|
+
def get_key(keyid)
|
19
|
+
request(
|
20
|
+
:method => "GET",
|
21
|
+
:path => "/my/keys/#{keyid}",
|
22
|
+
:expects => 200,
|
23
|
+
:idempotent => true
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Mock
|
5
|
+
def get_machine(uuid)
|
6
|
+
if machine = self.data[:machines][uuid]
|
7
|
+
res = Excon::Response.new
|
8
|
+
res.status = 200
|
9
|
+
res.body = machine
|
10
|
+
res
|
11
|
+
else
|
12
|
+
raise Excon::Errors::NotFound, "Not Found"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Real
|
18
|
+
def get_machine(uuid)
|
19
|
+
request(
|
20
|
+
:method => "GET",
|
21
|
+
:path => "/my/machines/#{uuid}",
|
22
|
+
:expects => [200, 410],
|
23
|
+
:idempotent => true
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Real
|
5
|
+
def get_machine_metadata(machine_id, options = {})
|
6
|
+
query = {}
|
7
|
+
if options[:credentials]
|
8
|
+
if options[:credentials].is_a?(Boolean)
|
9
|
+
query[:credentials] = options[:credentials]
|
10
|
+
else
|
11
|
+
raise ArgumentError, "options[:credentials] must be a Boolean or nil"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
request(
|
16
|
+
:path => "/my/machines/#{machine_id}/metadata",
|
17
|
+
:query => query,
|
18
|
+
:idempotent => true
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Real
|
5
|
+
def get_machine_snapshot(machine_id, snapshot_name)
|
6
|
+
request(
|
7
|
+
:path => "/my/machines/#{machine_id}/snapshots/#{snapshot_name}",
|
8
|
+
:method => "GET",
|
9
|
+
:idempotent => true
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Real
|
5
|
+
# https://us-west-1.api.joyentcloud.com/docs#GetMachineTag
|
6
|
+
def get_machine_tag(machine_id, tagname)
|
7
|
+
request(
|
8
|
+
:path => "/my/machines/#{machine_id}/tags/#{tagname}",
|
9
|
+
:method => "GET",
|
10
|
+
:headers => {"Accept" => "text/plain"},
|
11
|
+
:expects => 200,
|
12
|
+
:idempotent => true
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Joyent
|
6
|
+
class Mock
|
7
|
+
def get_package(name)
|
8
|
+
if pkg = self.data[:packages][name]
|
9
|
+
response = Excon::Response.new
|
10
|
+
response.body = pkg
|
11
|
+
response.status = 200
|
12
|
+
response
|
13
|
+
else
|
14
|
+
raise Excon::Errors::NotFound
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Real
|
20
|
+
def get_package(name)
|
21
|
+
name = URI.escape(name)
|
22
|
+
request(
|
23
|
+
:method => "GET",
|
24
|
+
:path => "/my/packages/#{name}",
|
25
|
+
:expects => 200,
|
26
|
+
:idempotent => true
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Mock
|
5
|
+
def list_datasets
|
6
|
+
res = Excon::Response.new
|
7
|
+
res.status = 200
|
8
|
+
res.body = self.data[:datasets].values
|
9
|
+
res
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Real
|
14
|
+
def list_datasets
|
15
|
+
request(
|
16
|
+
:method => "GET",
|
17
|
+
:path => "/my/datasets",
|
18
|
+
:idempotent => true
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Mock
|
5
|
+
def list_images
|
6
|
+
res = Excon::Response.new
|
7
|
+
res.status = 200
|
8
|
+
res.body = self.data[:datasets].values
|
9
|
+
res
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Real
|
14
|
+
def list_images
|
15
|
+
request(
|
16
|
+
:method => "GET",
|
17
|
+
:path => "/#{@joyent_username}/images",
|
18
|
+
:expects => 200,
|
19
|
+
:idempotent => true
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Mock
|
5
|
+
def list_keys
|
6
|
+
response = Excon::Response.new
|
7
|
+
response.status = 200
|
8
|
+
response.body = self.data[:keys].values
|
9
|
+
response
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Real
|
14
|
+
def list_keys
|
15
|
+
request(
|
16
|
+
:expects => 200,
|
17
|
+
:method => :'GET',
|
18
|
+
:path => '/my/keys',
|
19
|
+
:idempotent => true
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end # Real
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Real
|
5
|
+
# https://us-west-1.api.joyentcloud.com/docs#ListMachineTags
|
6
|
+
def list_machine_tags(machine_id)
|
7
|
+
request(
|
8
|
+
:path => "/my/machines/#{machine_id}/tags",
|
9
|
+
:method => "GET",
|
10
|
+
:expects => 200,
|
11
|
+
:idempotent => true
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Mock
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Joyent
|
4
|
+
class Mock
|
5
|
+
def list_machines(options={})
|
6
|
+
res = Excon::Response.new
|
7
|
+
res.status = 200
|
8
|
+
res.body = self.data[:machines].values
|
9
|
+
res
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Real
|
14
|
+
def list_machines(options={})
|
15
|
+
request(
|
16
|
+
:path => "/my/machines",
|
17
|
+
:method => "GET",
|
18
|
+
:query => options,
|
19
|
+
:expects => 200,
|
20
|
+
:idempotent => true
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|