fog-azure 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fog-azure.gemspec +2 -1
- data/lib/fog/azure/compute.rb +9 -0
- data/lib/fog/azure/models/compute/database.rb +46 -0
- data/lib/fog/azure/models/compute/databases.rb +49 -0
- data/lib/fog/azure/models/compute/server.rb +0 -1
- data/lib/fog/azure/models/compute/storage_account.rb +0 -1
- data/lib/fog/azure/requests/compute/add_data_disk.rb +11 -0
- data/lib/fog/azure/requests/compute/create_database_server.rb +43 -0
- data/lib/fog/azure/requests/compute/delete_database.rb +37 -0
- data/lib/fog/azure/requests/compute/delete_storage_account.rb +0 -6
- data/lib/fog/azure/requests/compute/delete_virtual_machine.rb +0 -6
- data/lib/fog/azure/requests/compute/firewall_rules.rb +32 -0
- data/lib/fog/azure/requests/compute/get_virtual_machine.rb +35 -0
- data/lib/fog/azure/requests/compute/list_databases.rb +42 -0
- data/lib/fog/azure/requests/compute/reboot_server.rb +0 -6
- data/lib/fog/azure/requests/compute/shutdown_server.rb +0 -6
- data/lib/fog/azure/requests/compute/start_server.rb +0 -6
- data/lib/fog/azure/version.rb +2 -2
- data/tests/azure_test_helper.rb +0 -1
- data/tests/models/compute/database_tests.rb +59 -0
- data/tests/requests/compute/databases_tests.rb +43 -0
- metadata +26 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18c3f1425ad481dbe681177967b24c593fa14da0
|
4
|
+
data.tar.gz: cfe40d1d5917467abadbffb1a2a707cda2c56a22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc057d2b8667fab5516c74240925de6a183005da0bc2170fb6b066b1197b41ff88e4f8b3d0706c744f5aeba1c9bd02a251d8eae9a6d5b37ce4a4e9ed922646a9
|
7
|
+
data.tar.gz: d994afea73573653d75c4f9463bb0462060cd28e2db108466e852989c2e3fe3ffc9a4e3dde7114e01aabe35dd2cb20b4d4addcd18602ce67fff395763d4a5652
|
data/fog-azure.gemspec
CHANGED
@@ -43,9 +43,10 @@ Gem::Specification.new do |spec|
|
|
43
43
|
#spec.add_development_dependency 'bundler', '~> 1.6'
|
44
44
|
spec.add_development_dependency 'rake', '~> 10.0'
|
45
45
|
spec.add_development_dependency 'shindo', '~> 0.3'
|
46
|
-
spec.add_development_dependency('azure', '~>0.6')
|
46
|
+
# spec.add_development_dependency('azure', '~>0.6')
|
47
47
|
|
48
48
|
spec.add_dependency 'fog-core', '~> 1.27'
|
49
49
|
spec.add_dependency 'fog-json', '~> 1.0'
|
50
50
|
spec.add_dependency 'fog-xml', '~> 0.1'
|
51
|
+
spec.add_dependency 'azure', '~>0.6'
|
51
52
|
end
|
data/lib/fog/azure/compute.rb
CHANGED
@@ -41,6 +41,12 @@ module Fog
|
|
41
41
|
request :shutdown_server
|
42
42
|
request :start_server
|
43
43
|
request :list_images
|
44
|
+
request :list_databases
|
45
|
+
request :create_database_server
|
46
|
+
request :delete_database
|
47
|
+
request :firewall_rules
|
48
|
+
request :add_data_disk
|
49
|
+
request :get_virtual_machine
|
44
50
|
|
45
51
|
model_path "fog/azure/models/compute"
|
46
52
|
model :server
|
@@ -49,6 +55,8 @@ module Fog
|
|
49
55
|
collection :storage_accounts
|
50
56
|
model :image
|
51
57
|
collection :images
|
58
|
+
model :database
|
59
|
+
collection :databases
|
52
60
|
|
53
61
|
class Mock
|
54
62
|
def initialize(options={})
|
@@ -78,6 +86,7 @@ module Fog
|
|
78
86
|
@vm_svc = ::Azure::VirtualMachineManagementService.new
|
79
87
|
@stg_svc = ::Azure::StorageManagementService.new
|
80
88
|
@image_svc = ::Azure::VirtualMachineImageManagementService.new
|
89
|
+
@db_svc = ::Azure::SqlDatabaseManagementService.new
|
81
90
|
end
|
82
91
|
end
|
83
92
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
require "fog/core/model"
|
23
|
+
|
24
|
+
module Fog
|
25
|
+
module Compute
|
26
|
+
class Azure
|
27
|
+
class Database < Fog::Model
|
28
|
+
identity :name
|
29
|
+
attribute :feature_name
|
30
|
+
attribute :feature_value
|
31
|
+
attribute :location
|
32
|
+
attribute :administrator_login
|
33
|
+
|
34
|
+
def destroy
|
35
|
+
requires :name
|
36
|
+
service.delete_database(name)
|
37
|
+
end
|
38
|
+
|
39
|
+
def firewall_rules
|
40
|
+
requires :name
|
41
|
+
service.firewall_rules(name)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
require "fog/core/collection"
|
23
|
+
require "fog/azure/models/compute/database"
|
24
|
+
|
25
|
+
module Fog
|
26
|
+
module Compute
|
27
|
+
class Azure
|
28
|
+
class Databases < Fog::Collection
|
29
|
+
model Fog::Compute::Azure::Database
|
30
|
+
|
31
|
+
def all()
|
32
|
+
databases = []
|
33
|
+
service.list_databases.each do |account|
|
34
|
+
hash = {}
|
35
|
+
account.instance_variables.each do |var|
|
36
|
+
hash[var.to_s.delete("@")] = account.instance_variable_get(var)
|
37
|
+
end
|
38
|
+
databases << hash
|
39
|
+
end
|
40
|
+
load(databases)
|
41
|
+
end
|
42
|
+
|
43
|
+
def create(login, password, location)
|
44
|
+
service.create_database_server(login, password, location)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
module Fog
|
23
|
+
module Compute
|
24
|
+
class Azure
|
25
|
+
class Real
|
26
|
+
def create_database_server(login, password, location)
|
27
|
+
@db_svc.create_server(login, password, location)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Mock
|
32
|
+
def create_database_server(login, password, location)
|
33
|
+
db = ::Azure::SqlDatabaseManagement::SqlDatabase.new
|
34
|
+
db.name = 'Mock Database'
|
35
|
+
db.location = location
|
36
|
+
db.feature_name = 'Mock Database'
|
37
|
+
db.feature_value = 'value'
|
38
|
+
db
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
module Fog
|
23
|
+
module Compute
|
24
|
+
class Azure
|
25
|
+
class Real
|
26
|
+
def delete_database(name)
|
27
|
+
@db_svc.delete_server(name)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Mock
|
32
|
+
def delete_database(name)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
module Fog
|
23
|
+
module Compute
|
24
|
+
class Azure
|
25
|
+
class Real
|
26
|
+
def firewall_rules(name)
|
27
|
+
@db_svc.list_sql_server_firewall_rules(name)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Azure
|
4
|
+
class Real
|
5
|
+
def get_virtual_machine(name, cloud_service_name)
|
6
|
+
@vm_svc.get_virtual_machine(name, cloud_service_name)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Mock
|
11
|
+
def get_virtual_machine(name, cloud_service_name)
|
12
|
+
vm = ::Azure::VirtualMachineManagement::VirtualMachine.new
|
13
|
+
vm.cloud_service_name = cloud_service_name
|
14
|
+
vm.status = "ReadyRole"
|
15
|
+
vm.ipaddress = "123.45.67.89"
|
16
|
+
vm.vm_name = name
|
17
|
+
vm.udp_endpoints = []
|
18
|
+
vm.hostname = "cool-vm"
|
19
|
+
vm.deployment_name = "cool-vm"
|
20
|
+
vm.deployment_status = "Running"
|
21
|
+
vm.tcp_endpoints = [
|
22
|
+
{"Name"=>"http", "Vip"=>"123.45.67.89", "PublicPort"=>"80", "LocalPort"=>"80"},
|
23
|
+
{"Name"=>"SSH", "Vip"=>"123.45.67.89", "PublicPort"=>"22", "LocalPort"=>"22"}
|
24
|
+
]
|
25
|
+
vm.role_size = "Medium"
|
26
|
+
vm.os_type = "Linux"
|
27
|
+
vm.disk_name = "cool-vm-cool-vm-0-20130207005053"
|
28
|
+
vm.virtual_network_name = ""
|
29
|
+
vm.image = "ImageName"
|
30
|
+
vm
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
module Fog
|
23
|
+
module Compute
|
24
|
+
class Azure
|
25
|
+
class Real
|
26
|
+
def list_databases
|
27
|
+
@db_svc.list_servers
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Mock
|
32
|
+
def list_databases
|
33
|
+
db = ::Azure::SqlDatabaseManagement::SqlDatabase.new
|
34
|
+
db.name = 'Mock Database'
|
35
|
+
db.location = 'US East'
|
36
|
+
db.feature_name = 'feature name'
|
37
|
+
[db]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/fog/azure/version.rb
CHANGED
data/tests/azure_test_helper.rb
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
Shindo.tests("Fog::Compute[:azure] | database model", ["azure", "compute"]) do
|
23
|
+
|
24
|
+
service = Fog::Compute[:azure]
|
25
|
+
|
26
|
+
tests("The database model should") do
|
27
|
+
db = service.databases.all.first
|
28
|
+
tests("have the actions") do
|
29
|
+
test("destroy") { db.respond_to? "destroy" }
|
30
|
+
test("firewall_rules") { db.respond_to? "firewall_rules" }
|
31
|
+
end
|
32
|
+
|
33
|
+
tests("have attributes") do
|
34
|
+
attributes = [
|
35
|
+
:name,
|
36
|
+
:feature_name,
|
37
|
+
:feature_value,
|
38
|
+
:location,
|
39
|
+
:administrator_login
|
40
|
+
]
|
41
|
+
tests("The database model should respond to") do
|
42
|
+
attributes.each do |attribute|
|
43
|
+
test("#{attribute}") { db.respond_to? attribute }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
test("should delete a database") do
|
49
|
+
pending if Fog.mocking?
|
50
|
+
db = service.databases.all.first
|
51
|
+
# Gets a little tricky here because DB Server names are autogenerated
|
52
|
+
# Have to be careful while running tests
|
53
|
+
db_name = db.name
|
54
|
+
db.destroy
|
55
|
+
db = service.databases.select { |s| s.name == db_name }.first
|
56
|
+
db.nil?
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
2
|
+
#
|
3
|
+
# The MIT License (MIT)
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
Shindo.tests("Fog::Compute[:azure] | database request", ["azure", "compute"]) do
|
23
|
+
|
24
|
+
tests("#list_db_servers") do
|
25
|
+
databases = Fog::Compute[:azure].databases
|
26
|
+
|
27
|
+
test "returns an Array of Database objects" do
|
28
|
+
databases.is_a? Array
|
29
|
+
end
|
30
|
+
|
31
|
+
test "returns all databases as an array" do
|
32
|
+
databases.all.is_a? Array
|
33
|
+
end
|
34
|
+
|
35
|
+
test("should return valid database name") do
|
36
|
+
databases.all.first.name.is_a? String
|
37
|
+
end
|
38
|
+
|
39
|
+
test("should create a new database") do
|
40
|
+
databases.create('AdvancedAdminU', 'NotARegPW!', 'South Central US').kind_of? ::Azure::SqlDatabaseManagement::SqlDatabase
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-azure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Mendoza
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-04-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -40,61 +40,61 @@ dependencies:
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0.3'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: fog-core
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
49
|
-
type: :
|
48
|
+
version: '1.27'
|
49
|
+
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '1.27'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name: fog-
|
57
|
+
name: fog-json
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '1.
|
62
|
+
version: '1.0'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '1.
|
69
|
+
version: '1.0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
|
-
name: fog-
|
71
|
+
name: fog-xml
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '1
|
76
|
+
version: '0.1'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '1
|
83
|
+
version: '0.1'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
85
|
+
name: azure
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '0.
|
90
|
+
version: '0.6'
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '0.
|
97
|
+
version: '0.6'
|
98
98
|
description: |-
|
99
99
|
This library can be used as a module for `fog` or as standalone provider
|
100
100
|
to use the Azure cloud services in applications..
|
@@ -117,17 +117,25 @@ files:
|
|
117
117
|
- lib/fog/azure/compute.rb
|
118
118
|
- lib/fog/azure/core.rb
|
119
119
|
- lib/fog/azure/docs/getting_started.md
|
120
|
+
- lib/fog/azure/models/compute/database.rb
|
121
|
+
- lib/fog/azure/models/compute/databases.rb
|
120
122
|
- lib/fog/azure/models/compute/image.rb
|
121
123
|
- lib/fog/azure/models/compute/images.rb
|
122
124
|
- lib/fog/azure/models/compute/server.rb
|
123
125
|
- lib/fog/azure/models/compute/servers.rb
|
124
126
|
- lib/fog/azure/models/compute/storage_account.rb
|
125
127
|
- lib/fog/azure/models/compute/storage_accounts.rb
|
128
|
+
- lib/fog/azure/requests/compute/add_data_disk.rb
|
129
|
+
- lib/fog/azure/requests/compute/create_database_server.rb
|
126
130
|
- lib/fog/azure/requests/compute/create_storage_account.rb
|
127
131
|
- lib/fog/azure/requests/compute/create_virtual_machine.rb
|
132
|
+
- lib/fog/azure/requests/compute/delete_database.rb
|
128
133
|
- lib/fog/azure/requests/compute/delete_storage_account.rb
|
129
134
|
- lib/fog/azure/requests/compute/delete_virtual_machine.rb
|
135
|
+
- lib/fog/azure/requests/compute/firewall_rules.rb
|
130
136
|
- lib/fog/azure/requests/compute/get_storage_account.rb
|
137
|
+
- lib/fog/azure/requests/compute/get_virtual_machine.rb
|
138
|
+
- lib/fog/azure/requests/compute/list_databases.rb
|
131
139
|
- lib/fog/azure/requests/compute/list_images.rb
|
132
140
|
- lib/fog/azure/requests/compute/list_storage_accounts.rb
|
133
141
|
- lib/fog/azure/requests/compute/list_virtual_machines.rb
|
@@ -139,9 +147,11 @@ files:
|
|
139
147
|
- tests/azure_test_helper.rb
|
140
148
|
- tests/helper.rb
|
141
149
|
- tests/helpers/mock_helper.rb
|
150
|
+
- tests/models/compute/database_tests.rb
|
142
151
|
- tests/models/compute/image_tests.rb
|
143
152
|
- tests/models/compute/server_tests.rb
|
144
153
|
- tests/models/compute/storage_account_tests.rb
|
154
|
+
- tests/requests/compute/databases_tests.rb
|
145
155
|
- tests/requests/compute/images_tests.rb
|
146
156
|
- tests/requests/compute/servers_tests.rb
|
147
157
|
- tests/requests/compute/storage_accounts_tests.rb
|
@@ -165,9 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
175
|
version: '0'
|
166
176
|
requirements: []
|
167
177
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.
|
178
|
+
rubygems_version: 2.5.1
|
169
179
|
signing_key:
|
170
180
|
specification_version: 4
|
171
181
|
summary: Module for the 'fog' gem to support Azure cloud services.
|
172
182
|
test_files: []
|
173
|
-
has_rdoc:
|