fog 1.27.0 → 1.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +71 -0
- data/Rakefile +2 -2
- data/bin/fog +2 -2
- data/fog.gemspec +4 -3
- data/lib/fog/bin/clodo.rb +1 -1
- data/lib/fog/bin/openstack.rb +5 -0
- data/lib/fog/digitalocean/examples/getting_started.md +46 -4
- data/lib/fog/digitalocean/models/compute/server.rb +1 -3
- data/lib/fog/digitalocean/models/compute/servers.rb +30 -0
- data/lib/fog/fogdocker/compute.rb +3 -2
- data/lib/fog/fogdocker/requests/compute/container_action.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_all.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_commit.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_create.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_delete.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_get.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_all.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_create.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_delete.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_get.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_search.rb +1 -1
- data/lib/fog/google/compute.rb +2 -1
- data/lib/fog/google/core.rb +42 -12
- data/lib/fog/google/dns.rb +2 -1
- data/lib/fog/google/monitoring.rb +1 -1
- data/lib/fog/google/sql.rb +1 -1
- data/lib/fog/hp/requests/storage/get_object.rb +5 -3
- data/lib/fog/joyent/compute.rb +2 -0
- data/lib/fog/openstack.rb +1 -0
- data/lib/fog/openstack/baremetal.rb +370 -0
- data/lib/fog/openstack/core.rb +1 -0
- data/lib/fog/openstack/docs/orchestration.md +318 -0
- data/lib/fog/openstack/docs/storage.md +1 -7
- data/lib/fog/openstack/models/baremetal/chassis.rb +60 -0
- data/lib/fog/openstack/models/baremetal/chassis_collection.rb +38 -0
- data/lib/fog/openstack/models/baremetal/driver.rb +30 -0
- data/lib/fog/openstack/models/baremetal/drivers.rb +21 -0
- data/lib/fog/openstack/models/baremetal/node.rb +85 -0
- data/lib/fog/openstack/models/baremetal/nodes.rb +38 -0
- data/lib/fog/openstack/models/baremetal/port.rb +61 -0
- data/lib/fog/openstack/models/baremetal/ports.rb +38 -0
- data/lib/fog/openstack/models/orchestration/event.rb +20 -0
- data/lib/fog/openstack/models/orchestration/events.rb +28 -0
- data/lib/fog/openstack/models/orchestration/resource.rb +32 -0
- data/lib/fog/openstack/models/orchestration/resource_schemas.rb +17 -0
- data/lib/fog/openstack/models/orchestration/resources.rb +35 -0
- data/lib/fog/openstack/models/orchestration/stack.rb +91 -24
- data/lib/fog/openstack/models/orchestration/stacks.rb +38 -4
- data/lib/fog/openstack/models/orchestration/template.rb +15 -0
- data/lib/fog/openstack/models/orchestration/templates.rb +44 -0
- data/lib/fog/openstack/orchestration.rb +48 -2
- data/lib/fog/openstack/requests/baremetal/create_chassis.rb +44 -0
- data/lib/fog/openstack/requests/baremetal/create_node.rb +54 -0
- data/lib/fog/openstack/requests/baremetal/create_port.rb +46 -0
- data/lib/fog/openstack/requests/baremetal/delete_chassis.rb +25 -0
- data/lib/fog/openstack/requests/baremetal/delete_node.rb +25 -0
- data/lib/fog/openstack/requests/baremetal/delete_port.rb +25 -0
- data/lib/fog/openstack/requests/baremetal/get_chassis.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/get_driver.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/get_driver_properties.rb +40 -0
- data/lib/fog/openstack/requests/baremetal/get_node.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/get_port.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/list_chassis.rb +48 -0
- data/lib/fog/openstack/requests/baremetal/list_chassis_detailed.rb +31 -0
- data/lib/fog/openstack/requests/baremetal/list_drivers.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/list_nodes.rb +40 -0
- data/lib/fog/openstack/requests/baremetal/list_nodes_detailed.rb +31 -0
- data/lib/fog/openstack/requests/baremetal/list_ports.rb +48 -0
- data/lib/fog/openstack/requests/baremetal/list_ports_detailed.rb +31 -0
- data/lib/fog/openstack/requests/baremetal/patch_chassis.rb +42 -0
- data/lib/fog/openstack/requests/baremetal/patch_node.rb +41 -0
- data/lib/fog/openstack/requests/baremetal/patch_port.rb +41 -0
- data/lib/fog/openstack/requests/compute/create_server.rb +1 -0
- data/lib/fog/openstack/requests/orchestration/abandon_stack.rb +15 -0
- data/lib/fog/openstack/requests/orchestration/build_info.rb +15 -0
- data/lib/fog/openstack/requests/orchestration/create_stack.rb +31 -12
- data/lib/fog/openstack/requests/orchestration/delete_stack.rb +28 -5
- data/lib/fog/openstack/requests/orchestration/get_stack_template.rb +20 -0
- data/lib/fog/openstack/requests/orchestration/list_resource_events.rb +23 -0
- data/lib/fog/openstack/requests/orchestration/list_resource_types.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/list_resources.rb +23 -0
- data/lib/fog/openstack/requests/orchestration/list_stack_data.rb +27 -0
- data/lib/fog/openstack/requests/orchestration/list_stack_events.rb +23 -0
- data/lib/fog/openstack/requests/orchestration/preview_stack.rb +16 -0
- data/lib/fog/openstack/requests/orchestration/show_event_details.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/show_resource_data.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/show_resource_metadata.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/show_resource_schema.rb +15 -0
- data/lib/fog/openstack/requests/orchestration/show_resource_template.rb +20 -0
- data/lib/fog/openstack/requests/orchestration/show_stack_details.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/update_stack.rb +34 -7
- data/lib/fog/openstack/requests/orchestration/validate_template.rb +16 -0
- data/lib/fog/openstack/volume.rb +0 -1
- data/lib/fog/ovirt/compute.rb +6 -0
- data/lib/fog/ovirt/models/compute/server.rb +10 -0
- data/lib/fog/ovirt/models/compute/template.rb +1 -0
- data/lib/fog/ovirt/models/compute/volumes.rb +1 -2
- data/lib/fog/ovirt/requests/compute/attach_volume.rb +22 -0
- data/lib/fog/ovirt/requests/compute/detach_volume.rb +22 -0
- data/lib/fog/ovirt/requests/compute/list_volumes.rb +19 -0
- data/lib/fog/ovirt/requests/compute/mock_files/disks.xml +58 -0
- data/lib/fog/vcloud_director/models/compute/task.rb +2 -2
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/compute.rb +3 -0
- data/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb +20 -11
- data/lib/fog/vsphere/requests/compute/get_compute_resource.rb +41 -0
- data/lib/fog/vsphere/requests/compute/get_network.rb +35 -6
- data/lib/fog/vsphere/requests/compute/get_resource_pool.rb +1 -1
- data/lib/fog/vsphere/requests/compute/get_virtual_machine.rb +19 -13
- data/lib/fog/vsphere/requests/compute/list_compute_resources.rb +92 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +16 -11
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +6 -5
- data/lib/fog/xenserver/requests/compute/create_sr.rb +3 -4
- data/lib/tasks/changelog_task.rb +1 -0
- data/tests/helper.rb +3 -3
- data/tests/helpers/mock_helper.rb +0 -4
- data/tests/openstack/requests/baremetal/chassis_tests.rb +48 -0
- data/tests/openstack/requests/baremetal/driver_tests.rb +40 -0
- data/tests/openstack/requests/baremetal/node_tests.rb +65 -0
- data/tests/openstack/requests/baremetal/port_tests.rb +56 -0
- data/tests/openstack/requests/compute/server_tests.rb +2 -0
- data/tests/openstack/requests/orchestration/stack_tests.rb +2 -2
- data/tests/vsphere/requests/compute/get_network_tests.rb +48 -0
- metadata +88 -23
- data/lib/fog/aws.rb +0 -23
- data/lib/fog/bin/riakcs.rb +0 -25
- data/lib/fog/openstack/requests/orchestration/list_stacks.rb +0 -47
- data/lib/fog/riakcs.rb +0 -2
- data/lib/fog/riakcs/core.rb +0 -121
- data/lib/fog/riakcs/provisioning.rb +0 -98
- data/lib/fog/riakcs/requests/provisioning/create_user.rb +0 -77
- data/lib/fog/riakcs/requests/provisioning/disable_user.rb +0 -23
- data/lib/fog/riakcs/requests/provisioning/enable_user.rb +0 -23
- data/lib/fog/riakcs/requests/provisioning/get_user.rb +0 -41
- data/lib/fog/riakcs/requests/provisioning/list_users.rb +0 -43
- data/lib/fog/riakcs/requests/provisioning/regrant_secret.rb +0 -23
- data/lib/fog/riakcs/requests/provisioning/update_user.rb +0 -23
- data/lib/fog/riakcs/requests/usage/get_usage.rb +0 -68
- data/lib/fog/riakcs/usage.rb +0 -62
- data/tests/riakcs/requests/provisioning/provisioning_tests.rb +0 -174
- data/tests/riakcs/requests/usage/usage_tests.rb +0 -29
@@ -1,41 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module RiakCS
|
3
|
-
class Provisioning
|
4
|
-
class Real
|
5
|
-
include Utils
|
6
|
-
include MultipartUtils
|
7
|
-
|
8
|
-
def get_user(key_id)
|
9
|
-
response = @s3_connection.get_object('riak-cs', "user/#{key_id}", { 'Accept' => 'application/json' })
|
10
|
-
response.body = Fog::JSON.decode(response.body)
|
11
|
-
response
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
class Mock
|
16
|
-
def get_user(key_id)
|
17
|
-
if user = data[key_id]
|
18
|
-
Excon::Response.new.tap do |response|
|
19
|
-
response.status = 200
|
20
|
-
response.headers['Content-Type'] = 'application/json'
|
21
|
-
response.body = {
|
22
|
-
"email" => user[:email],
|
23
|
-
"display_name" => user[:name],
|
24
|
-
"name" => "user123",
|
25
|
-
"key_id" => "XXXXXXXXXXXXXXXXXXXX",
|
26
|
-
"key_secret" => user[:key_secret],
|
27
|
-
"id" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
28
|
-
"status" => user[:status]
|
29
|
-
}
|
30
|
-
end
|
31
|
-
else
|
32
|
-
Excon::Response.new.tap do |response|
|
33
|
-
response.status = 404
|
34
|
-
response.headers['Content-Type'] = 'application/json'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module RiakCS
|
3
|
-
class Provisioning
|
4
|
-
class Real
|
5
|
-
include Utils
|
6
|
-
include MultipartUtils
|
7
|
-
|
8
|
-
def list_users(options = {})
|
9
|
-
response = @s3_connection.get_object('riak-cs', 'users', { 'Accept' => 'application/json', 'query' => options })
|
10
|
-
|
11
|
-
boundary = extract_boundary(response.headers['Content-Type'])
|
12
|
-
parts = parse(response.body, boundary)
|
13
|
-
decoded = parts.map { |part| Fog::JSON.decode(part[:body]) }
|
14
|
-
|
15
|
-
response.body = decoded.flatten
|
16
|
-
|
17
|
-
response
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class Mock
|
22
|
-
def list_users(options = {})
|
23
|
-
filtered_data = options[:status] ? data.select { |key, value| value[:status] == options[:status] } : data
|
24
|
-
|
25
|
-
Excon::Response.new.tap do |response|
|
26
|
-
response.status = 200
|
27
|
-
response.body = filtered_data.map do |key, value|
|
28
|
-
{
|
29
|
-
"email" => value[:email],
|
30
|
-
"display_name" => value[:name],
|
31
|
-
"name" => "user123",
|
32
|
-
"key_id" => key,
|
33
|
-
"key_secret" => value[:key_secret],
|
34
|
-
"id" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
35
|
-
"status" => value[:status]
|
36
|
-
}
|
37
|
-
end.compact
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module RiakCS
|
3
|
-
class Provisioning
|
4
|
-
class Real
|
5
|
-
include Utils
|
6
|
-
include UserUtils
|
7
|
-
include MultipartUtils
|
8
|
-
|
9
|
-
def regrant_secret(key_id)
|
10
|
-
update_riakcs_user(key_id, { :new_key_secret => true })
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class Mock
|
15
|
-
include UserUtils
|
16
|
-
|
17
|
-
def regrant_secret(key_id)
|
18
|
-
update_mock_user(key_id, { :new_key_secret => true })
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module RiakCS
|
3
|
-
class Provisioning
|
4
|
-
class Real
|
5
|
-
include Utils
|
6
|
-
include UserUtils
|
7
|
-
include MultipartUtils
|
8
|
-
|
9
|
-
def update_user(key_id, user)
|
10
|
-
update_riakcs_user(key_id, user)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class Mock
|
15
|
-
include UserUtils
|
16
|
-
|
17
|
-
def update_user(key_id, user)
|
18
|
-
update_mock_user(key_id, user)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module RiakCS
|
3
|
-
class Usage
|
4
|
-
module Utils
|
5
|
-
TYPES_TO_STRING = { :access => 'a', :storage => 'b' }
|
6
|
-
DEFAULT_TYPES = TYPES_TO_STRING.keys
|
7
|
-
DEFAULT_FORMAT = :json
|
8
|
-
|
9
|
-
def sanitize_and_convert_time(time)
|
10
|
-
time.utc.iso8601.gsub(/[:-]/, '')
|
11
|
-
end
|
12
|
-
|
13
|
-
def format_and_types_to_path(format, types)
|
14
|
-
format_character = format.to_s.split('').first
|
15
|
-
type_characters = types.map { |t| TYPES_TO_STRING[t] }.compact
|
16
|
-
|
17
|
-
[type_characters, format_character].flatten.compact.join
|
18
|
-
end
|
19
|
-
|
20
|
-
def request_uri(access_key_id, options)
|
21
|
-
format = DEFAULT_FORMAT
|
22
|
-
types = options[:types] || DEFAULT_TYPES
|
23
|
-
start_time = options[:start_time] || Time.now.utc - 86400
|
24
|
-
end_time = options[:end_time] || Time.now.utc
|
25
|
-
|
26
|
-
[access_key_id,
|
27
|
-
format_and_types_to_path(format, types),
|
28
|
-
sanitize_and_convert_time(start_time),
|
29
|
-
sanitize_and_convert_time(end_time)].join('.')
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class Real
|
34
|
-
include Utils
|
35
|
-
|
36
|
-
def get_usage(access_key_id, options = {})
|
37
|
-
response = @connection.get_object('riak-cs', ["usage", request_uri(access_key_id, options)].join("/"))
|
38
|
-
|
39
|
-
if !response.body.empty?
|
40
|
-
response.body = Fog::JSON.decode(response.body)
|
41
|
-
end
|
42
|
-
response
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class Mock
|
47
|
-
include Utils
|
48
|
-
|
49
|
-
def get_usage(access_key, options = {})
|
50
|
-
Excon::Response.new.tap do |response|
|
51
|
-
response.status = 200
|
52
|
-
response.headers['Content-Type'] = 'application/json'
|
53
|
-
response.body = {
|
54
|
-
'Access' => {
|
55
|
-
'Nodes' => [],
|
56
|
-
'Errors' => []
|
57
|
-
},
|
58
|
-
'Storage' => {
|
59
|
-
'Samples' => [],
|
60
|
-
'Errors' => []
|
61
|
-
}
|
62
|
-
}
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
data/lib/fog/riakcs/usage.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'fog/riakcs/core'
|
2
|
-
require 'time'
|
3
|
-
|
4
|
-
module Fog
|
5
|
-
module RiakCS
|
6
|
-
class Usage < Fog::Service
|
7
|
-
requires :riakcs_access_key_id, :riakcs_secret_access_key
|
8
|
-
recognizes :host, :path, :port, :scheme, :persistent
|
9
|
-
|
10
|
-
request_path 'fog/riakcs/requests/usage'
|
11
|
-
request :get_usage
|
12
|
-
|
13
|
-
class Mock
|
14
|
-
include Utils
|
15
|
-
|
16
|
-
def self.data
|
17
|
-
@data ||= Hash.new do |hash, key|
|
18
|
-
hash[key] = {}
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.reset
|
23
|
-
@data = nil
|
24
|
-
end
|
25
|
-
|
26
|
-
def initialize(options = {})
|
27
|
-
configure_uri_options(options)
|
28
|
-
end
|
29
|
-
|
30
|
-
def data
|
31
|
-
self.class.data[riakcs_uri]
|
32
|
-
end
|
33
|
-
|
34
|
-
def reset_data
|
35
|
-
self.class.data.delete(riakcs_uri)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
class Real
|
40
|
-
include Utils
|
41
|
-
|
42
|
-
def initialize(options = {})
|
43
|
-
configure_uri_options(options)
|
44
|
-
@riakcs_access_key_id = options[:riakcs_access_key_id]
|
45
|
-
@riakcs_secret_access_key = options[:riakcs_secret_access_key]
|
46
|
-
@connection_options = options[:connection_options] || {}
|
47
|
-
@persistent = options[:persistent] || false
|
48
|
-
|
49
|
-
@connection = Fog::Storage.new(
|
50
|
-
:provider => 'AWS',
|
51
|
-
:aws_access_key_id => @riakcs_access_key_id,
|
52
|
-
:aws_secret_access_key => @riakcs_secret_access_key,
|
53
|
-
:host => @host,
|
54
|
-
:port => @port,
|
55
|
-
:scheme => @scheme,
|
56
|
-
:connection_options => @connection_options
|
57
|
-
)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,174 +0,0 @@
|
|
1
|
-
Shindo.tests('RiakCS::Provisioning | provisioning requests', ['riakcs']) do
|
2
|
-
|
3
|
-
current_timestamp = Time.now.to_i
|
4
|
-
|
5
|
-
user_format = {
|
6
|
-
'email' => String,
|
7
|
-
'display_name' => String,
|
8
|
-
'name' => String,
|
9
|
-
'key_id' => String,
|
10
|
-
'key_secret' => String,
|
11
|
-
'id' => String,
|
12
|
-
'status' => String,
|
13
|
-
}
|
14
|
-
|
15
|
-
tests('User creation') do
|
16
|
-
|
17
|
-
tests('is successful').returns(String) do
|
18
|
-
|
19
|
-
# Create a user.
|
20
|
-
#
|
21
|
-
email, name = "successful_user_creation_test_#{current_timestamp}@example.com", "Fog User"
|
22
|
-
key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id']
|
23
|
-
key_id.class
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
tests('is successful anonymously').returns(String) do
|
28
|
-
|
29
|
-
# Create a user.
|
30
|
-
#
|
31
|
-
email, name = "successful_anonymous_user_creation_test_#{current_timestamp}@example.com", "Fog User"
|
32
|
-
key_id = Fog::RiakCS[:provisioning].create_user(email, name, :anonymous => true).body['key_id']
|
33
|
-
key_id.class
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
tests('fails if duplicate').raises(Fog::RiakCS::Provisioning::UserAlreadyExists) do
|
38
|
-
2.times do
|
39
|
-
email, name = "failed_duplicate_user_creation_test_#{current_timestamp}@example.com", "Fog User"
|
40
|
-
key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id']
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
tests('fails if invalid email').raises(Fog::RiakCS::Provisioning::ServiceUnavailable) do
|
45
|
-
email, name = "failed_duplicate_user_creation_test_#{current_timestamp}", "Fog User"
|
46
|
-
key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id']
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
tests('User disable') do
|
52
|
-
|
53
|
-
tests('is successful').returns(200) do
|
54
|
-
|
55
|
-
# Create a user.
|
56
|
-
#
|
57
|
-
email, name = "successful_user_disable_test_#{current_timestamp}@example.com", "Fog User"
|
58
|
-
key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id']
|
59
|
-
|
60
|
-
Fog::RiakCS[:provisioning].disable_user(key_id).status
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
tests('User enable') do
|
67
|
-
|
68
|
-
tests('is successful').returns(200) do
|
69
|
-
|
70
|
-
# Create a user.
|
71
|
-
#
|
72
|
-
email, name = "successful_user_disable_enable_test_#{current_timestamp}@example.com", "Fog User"
|
73
|
-
key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id']
|
74
|
-
|
75
|
-
Fog::RiakCS[:provisioning].disable_user(key_id).status
|
76
|
-
Fog::RiakCS[:provisioning].enable_user(key_id).status
|
77
|
-
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
tests('User granted new key secret') do
|
83
|
-
|
84
|
-
tests('is successful').returns(true) do
|
85
|
-
|
86
|
-
# Create a user.
|
87
|
-
#
|
88
|
-
email, name = "successful_user_regrant_test_#{current_timestamp}@example.com", "Fog User"
|
89
|
-
user = Fog::RiakCS[:provisioning].create_user(email, name).body
|
90
|
-
key_id, key_secret = user['key_id'], user['key_secret']
|
91
|
-
|
92
|
-
Fog::RiakCS[:provisioning].regrant_secret(key_id).status
|
93
|
-
|
94
|
-
# Verify new secret.
|
95
|
-
#
|
96
|
-
new_key_secret = Fog::RiakCS[:provisioning].get_user(key_id).body['key_secret']
|
97
|
-
new_key_secret != key_secret
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
end
|
102
|
-
|
103
|
-
tests('User retrieval') do
|
104
|
-
|
105
|
-
tests('is successful').formats(user_format) do
|
106
|
-
|
107
|
-
# Create a user.
|
108
|
-
#
|
109
|
-
email, name = "user_retrieval_test_#{current_timestamp}@example.com", "Fog User"
|
110
|
-
key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id']
|
111
|
-
|
112
|
-
# Get user details.
|
113
|
-
#
|
114
|
-
Fog::RiakCS[:provisioning].get_user(key_id).body
|
115
|
-
|
116
|
-
end
|
117
|
-
|
118
|
-
end
|
119
|
-
|
120
|
-
tests('User listing') do
|
121
|
-
|
122
|
-
tests('sucessfully lists users').formats(user_format) do
|
123
|
-
|
124
|
-
# Create a user.
|
125
|
-
#
|
126
|
-
email, name = "user_listing_test_#{current_timestamp}@example.com", "Fog User"
|
127
|
-
key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id']
|
128
|
-
|
129
|
-
# Ensure the list users response contains the user that we just
|
130
|
-
# created.
|
131
|
-
#
|
132
|
-
Fog::RiakCS[:provisioning].list_users.body.select { |x| x['email'] == email }.first
|
133
|
-
|
134
|
-
end
|
135
|
-
|
136
|
-
tests('successfully lists users containing no disabled users').returns(nil) do
|
137
|
-
|
138
|
-
# Create a user.
|
139
|
-
#
|
140
|
-
email, name = "user_listing_without_disabled_users_test_#{current_timestamp}@example.com", "Fog User"
|
141
|
-
key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id']
|
142
|
-
|
143
|
-
# Disable that user.
|
144
|
-
#
|
145
|
-
Fog::RiakCS[:provisioning].disable_user(key_id)
|
146
|
-
|
147
|
-
# Ensure the list users response does not contain the user that we
|
148
|
-
# just created and disabled.
|
149
|
-
#
|
150
|
-
Fog::RiakCS[:provisioning].list_users(:status => :enabled).body.select { |x| x['Email'] == email }.first
|
151
|
-
|
152
|
-
end
|
153
|
-
|
154
|
-
tests('successfully lists users containing disabled users').formats(user_format) do
|
155
|
-
|
156
|
-
# Create a user.
|
157
|
-
#
|
158
|
-
email, name = "user_listing_with_disabled_users_test_#{current_timestamp}@example.com", "Fog User"
|
159
|
-
key_id = Fog::RiakCS[:provisioning].create_user(email, name).body['key_id']
|
160
|
-
|
161
|
-
# Disable that user.
|
162
|
-
#
|
163
|
-
Fog::RiakCS[:provisioning].disable_user(key_id)
|
164
|
-
|
165
|
-
# Ensure the list users response contains the user that we just
|
166
|
-
# created and disabled.
|
167
|
-
#
|
168
|
-
Fog::RiakCS[:provisioning].list_users.body.select { |x| x['email'] == email }.first
|
169
|
-
|
170
|
-
end
|
171
|
-
|
172
|
-
end
|
173
|
-
|
174
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
Shindo.tests('RiakCS::Usage | usage requests', ['riakcs']) do
|
2
|
-
|
3
|
-
@blank_usage_format = {
|
4
|
-
'Access' => {
|
5
|
-
'Nodes' => [],
|
6
|
-
'Errors' => []
|
7
|
-
},
|
8
|
-
'Storage' => {
|
9
|
-
'Samples' => [],
|
10
|
-
'Errors' => []
|
11
|
-
}
|
12
|
-
}
|
13
|
-
|
14
|
-
tests('Statistics retrieval with no data returned') do
|
15
|
-
|
16
|
-
start_time = Time.now.utc + 86400
|
17
|
-
end_time = start_time + 86400
|
18
|
-
|
19
|
-
tests('via JSON').returns(@blank_usage_format) do
|
20
|
-
|
21
|
-
Fog::RiakCS[:usage].get_usage(Fog.credentials[:riakcs_access_key_id],
|
22
|
-
:types => [:access, :storage],
|
23
|
-
:start_time => start_time,
|
24
|
-
:end_time => end_time).body
|
25
|
-
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|