azure 0.6.4 → 0.7.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env_sample +11 -0
- data/.gitignore +4 -1
- data/.travis.yml +3 -1
- data/ChangeLog.txt +17 -1
- data/LICENSE.txt +202 -0
- data/README.md +58 -20
- data/Rakefile +27 -35
- data/azure.gemspec +17 -13
- data/bin/pfxer +35 -0
- data/lib/azure.rb +8 -0
- data/lib/azure/base_management/base_management_service.rb +24 -26
- data/lib/azure/base_management/management_http_request.rb +17 -14
- data/lib/azure/base_management/serialization.rb +1 -0
- data/lib/azure/blob/auth/shared_access_signature.rb +141 -0
- data/lib/azure/blob/blob_service.rb +221 -217
- data/lib/azure/cloud_service_management/cloud_service_management_service.rb +27 -30
- data/lib/azure/cloud_service_management/serialization.rb +1 -0
- data/lib/azure/core.rb +17 -15
- data/lib/azure/core/configuration.rb +7 -0
- data/lib/azure/core/http/http_error.rb +1 -1
- data/lib/azure/core/http/http_request.rb +4 -1
- data/lib/azure/core/utility.rb +16 -1
- data/lib/azure/queue/queue_service.rb +13 -13
- data/lib/azure/service/cors.rb +11 -0
- data/lib/azure/service/cors_rule.rb +15 -0
- data/lib/azure/service/serialization.rb +69 -10
- data/lib/azure/service/storage_service.rb +10 -6
- data/lib/azure/service/storage_service_properties.rb +8 -3
- data/lib/azure/service_bus/brokered_message.rb +1 -1
- data/lib/azure/service_bus/relay.rb +88 -0
- data/lib/azure/service_bus/serialization.rb +1 -0
- data/lib/azure/service_bus/service_bus_service.rb +70 -4
- data/lib/azure/sql_database_management/serialization.rb +1 -0
- data/lib/azure/sql_database_management/sql_database_management_service.rb +22 -22
- data/lib/azure/storage_management/serialization.rb +34 -14
- data/lib/azure/storage_management/storage_account.rb +9 -1
- data/lib/azure/storage_management/storage_management_service.rb +74 -32
- data/lib/azure/table/batch.rb +6 -6
- data/lib/azure/table/table_service.rb +13 -13
- data/lib/azure/version.rb +3 -3
- data/lib/azure/virtual_machine_image_management/serialization.rb +19 -0
- data/lib/azure/virtual_machine_image_management/virtual_machine_image.rb +1 -1
- data/lib/azure/virtual_machine_image_management/virtual_machine_image_management_service.rb +30 -7
- data/lib/azure/virtual_machine_management/serialization.rb +32 -12
- data/lib/azure/virtual_machine_management/virtual_machine.rb +1 -0
- data/lib/azure/virtual_machine_management/virtual_machine_management_service.rb +92 -81
- data/lib/azure/virtual_network_management/serialization.rb +12 -5
- data/lib/azure/virtual_network_management/virtual_network.rb +1 -0
- data/lib/azure/virtual_network_management/virtual_network_management_service.rb +11 -11
- data/test/fixtures/get_storage_account_properties.xml +6 -4
- data/test/fixtures/{list_images.xml → list_os_images.xml} +1 -1
- data/test/fixtures/list_storage_accounts.xml +2 -0
- data/test/fixtures/list_vm_images.xml +21 -0
- data/test/fixtures/metrics.xml +2 -2
- data/test/fixtures/sb_default_create_relay_response.xml +15 -0
- data/test/fixtures/storage_service_keys.xml +8 -0
- data/test/fixtures/storage_service_properties.xml +35 -3
- data/test/fixtures/updated_storage_accounts.xml +2 -0
- data/test/fixtures/virtual_machine.xml +3 -1
- data/test/integration/affinity_group/Affinity_test.rb +1 -1
- data/test/integration/affinity_group/Create_Affinity_test.rb +8 -7
- data/test/integration/affinity_group/Delete_Affinity_test.rb +3 -3
- data/test/integration/affinity_group/List_Affinity_test.rb +1 -1
- data/test/integration/affinity_group/Update_Affinity_test.rb +9 -8
- data/test/integration/cloud_service/Cloud_Create_test.rb +3 -2
- data/test/integration/cloud_service/Cloud_Delete_test.rb +5 -4
- data/test/integration/database/create_sql_server_firewall_test.rb +1 -1
- data/test/integration/database/create_sql_server_test.rb +1 -1
- data/test/integration/database/delete_sql_server_firewall_test.rb +1 -1
- data/test/integration/database/delete_sql_server_test.rb +1 -1
- data/test/integration/database/list_sql_server_firewall_test.rb +1 -1
- data/test/integration/database/list_sql_servers_test.rb +1 -1
- data/test/integration/database/reset_password_sql_server_test.rb +1 -1
- data/test/integration/service_bus/queues_test.rb +22 -22
- data/test/integration/service_bus/relay_test.rb +132 -0
- data/test/integration/storage_management/storage_management_test.rb +58 -33
- data/test/integration/test_helper.rb +11 -15
- data/test/integration/vm/VM_Create_test.rb +17 -18
- data/test/integration/vm/VM_Delete_test.rb +2 -4
- data/test/integration/vm/VM_Operations_test.rb +1 -2
- data/test/integration/vnet/Virtual_Network_Create_test.rb +9 -15
- data/test/integration/vnet/Virtual_Network_list_test.rb +4 -9
- data/test/support/name_generator.rb +8 -0
- data/test/support/virtual_network_helper.rb +2 -2
- data/test/test_helper.rb +13 -24
- data/test/unit/affinity_group/affinity_group_test.rb +10 -13
- data/test/unit/affinity_group/serialization_test.rb +7 -8
- data/test/unit/base_management/location_test.rb +1 -2
- data/test/unit/blob/auth/shared_access_signature_test.rb +71 -0
- data/test/unit/blob/blob_service_test.rb +393 -371
- data/test/unit/cloud_service_management/cloud_service_management_service_test.rb +16 -16
- data/test/unit/core/auth/shared_key_lite_test.rb +4 -4
- data/test/unit/core/auth/shared_key_test.rb +2 -2
- data/test/unit/core/http/http_error_test.rb +10 -5
- data/test/unit/core/http/http_request_test.rb +72 -25
- data/test/unit/database/serialization_test.rb +7 -7
- data/test/unit/database/sql_database_server_service_test.rb +43 -47
- data/test/unit/service/serialization_test.rb +40 -9
- data/test/unit/service/storage_service_test.rb +13 -11
- data/test/unit/storage_management/serialization_test.rb +26 -14
- data/test/unit/storage_management/storage_management_service_test.rb +48 -62
- data/test/unit/virtual_machine_image_management/serialization_test.rb +20 -5
- data/test/unit/virtual_machine_image_management/virtual_machine_image_management_service_test.rb +78 -29
- data/test/unit/virtual_machine_management/serialization_test.rb +112 -43
- data/test/unit/virtual_machine_management/virtual_machine_management_service_test.rb +123 -100
- data/test/unit/vnet/serialization_test.rb +7 -7
- data/test/unit/vnet/virtual_network_management_service_test.rb +1 -1
- metadata +70 -16
- data/test/fixtures/certificate.pem +0 -21
@@ -29,13 +29,13 @@ module Azure
|
|
29
29
|
|
30
30
|
# Public: Get Storage Service properties
|
31
31
|
#
|
32
|
-
# See http://msdn.microsoft.com/en-us/library/
|
33
|
-
# See http://msdn.microsoft.com/en-us/library/
|
32
|
+
# See http://msdn.microsoft.com/en-us/library/azure/hh452239
|
33
|
+
# See http://msdn.microsoft.com/en-us/library/azure/hh452243
|
34
34
|
#
|
35
35
|
# Returns a Hash with the service properties or nil if the operation failed
|
36
36
|
def get_service_properties
|
37
37
|
uri = service_properties_uri
|
38
|
-
response = call(:get, uri)
|
38
|
+
response = call(:get, uri, nil, service_properties_headers)
|
39
39
|
Serialization.service_properties_from_xml response.body
|
40
40
|
end
|
41
41
|
|
@@ -43,15 +43,15 @@ module Azure
|
|
43
43
|
#
|
44
44
|
# service_properties - An instance of Azure::Entity::Service::StorageServiceProperties
|
45
45
|
#
|
46
|
-
# See http://msdn.microsoft.com/en-us/library/
|
47
|
-
# See http://msdn.microsoft.com/en-us/library/
|
46
|
+
# See http://msdn.microsoft.com/en-us/library/azure/hh452235
|
47
|
+
# See http://msdn.microsoft.com/en-us/library/azure/hh452232
|
48
48
|
#
|
49
49
|
# Returns boolean indicating success.
|
50
50
|
def set_service_properties(service_properties)
|
51
51
|
body = Serialization.service_properties_to_xml service_properties
|
52
52
|
|
53
53
|
uri = service_properties_uri
|
54
|
-
call(:put, uri, body)
|
54
|
+
call(:put, uri, body, service_properties_headers)
|
55
55
|
nil
|
56
56
|
end
|
57
57
|
|
@@ -74,6 +74,10 @@ module Azure
|
|
74
74
|
headers["x-ms-meta-#{key}"] = value
|
75
75
|
end
|
76
76
|
end
|
77
|
+
|
78
|
+
def service_properties_headers
|
79
|
+
{"x-ms-version" => "2013-08-15"}
|
80
|
+
end
|
77
81
|
end
|
78
82
|
end
|
79
83
|
end
|
@@ -14,19 +14,24 @@
|
|
14
14
|
#--------------------------------------------------------------------------
|
15
15
|
require 'azure/service/logging'
|
16
16
|
require 'azure/service/metrics'
|
17
|
+
require 'azure/service/cors'
|
17
18
|
|
18
19
|
module Azure
|
19
20
|
module Service
|
20
21
|
class StorageServiceProperties
|
21
22
|
def initialize
|
22
23
|
@logging = Logging.new
|
23
|
-
@
|
24
|
+
@hour_metrics = Metrics.new
|
25
|
+
@minute_metrics = Metrics.new
|
26
|
+
@cors = Cors.new
|
24
27
|
yield self if block_given?
|
25
28
|
end
|
26
29
|
|
27
30
|
attr_accessor :logging
|
28
|
-
attr_accessor :
|
31
|
+
attr_accessor :hour_metrics
|
32
|
+
attr_accessor :minute_metrics
|
33
|
+
attr_accessor :cors
|
29
34
|
attr_accessor :default_service_version
|
30
35
|
end
|
31
36
|
end
|
32
|
-
end
|
37
|
+
end
|
@@ -16,7 +16,7 @@ module Azure
|
|
16
16
|
module ServiceBus
|
17
17
|
class BrokeredMessage
|
18
18
|
|
19
|
-
# Please read http://msdn.microsoft.com/en-us/library/
|
19
|
+
# Please read http://msdn.microsoft.com/en-us/library/azure/hh780742
|
20
20
|
# for more information on brokered message properties
|
21
21
|
|
22
22
|
# Public: Get/Set the ContentType of the message
|
@@ -0,0 +1,88 @@
|
|
1
|
+
#-------------------------------------------------------------------------
|
2
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
#--------------------------------------------------------------------------
|
15
|
+
require 'azure/service_bus/resource'
|
16
|
+
|
17
|
+
module Azure
|
18
|
+
module ServiceBus
|
19
|
+
class Relay < Resource
|
20
|
+
# Public: Initialize the relay endpoint.
|
21
|
+
#
|
22
|
+
# ==== Attributes
|
23
|
+
#
|
24
|
+
# * +name+ - A String with the name of the relay endpoint.
|
25
|
+
# * +options+ - The resource options Hash
|
26
|
+
#
|
27
|
+
# ==== Options
|
28
|
+
#
|
29
|
+
# Accepted key/value pairs in options parameter are:
|
30
|
+
# * +:relay_type+ - String. Determines the type of the relay endpoint. This is required.
|
31
|
+
# * +:requires_client_authorization+ - Boolean. Determines whether or not clients need to authenticate when making calls.
|
32
|
+
# * +:requires_transport_security+ - Boolean. Determines whether or not the endpoint uses transport security.
|
33
|
+
#
|
34
|
+
def initialize(name, options = {})
|
35
|
+
normalized_options = {}
|
36
|
+
normalized_options["RelayType"] = options[:relay_type].to_s
|
37
|
+
normalized_options["RequiresClientAuthorization"] = options[:requires_client_authorization].to_s if options.has_key?(:requires_client_authorization)
|
38
|
+
normalized_options["RequiresTransportSecurity"] = options[:requires_transport_security].to_s if options.has_key?(:requires_transport_security)
|
39
|
+
super(name, normalized_options)
|
40
|
+
end
|
41
|
+
|
42
|
+
# RelayType: String
|
43
|
+
#
|
44
|
+
# Displays the relay type of the endpoint.
|
45
|
+
def relay_type
|
46
|
+
description['RelayType']
|
47
|
+
end
|
48
|
+
|
49
|
+
def relay_type=(val)
|
50
|
+
_set 'RelayType', val
|
51
|
+
end
|
52
|
+
|
53
|
+
# RequiresClientAuthorization: Boolean
|
54
|
+
#
|
55
|
+
# Determines whether or not clients need to authenticate when making calls.
|
56
|
+
#
|
57
|
+
# Default: true
|
58
|
+
def requires_client_authorization
|
59
|
+
to_bool description['RequiresClientAuthorization']
|
60
|
+
end
|
61
|
+
|
62
|
+
def requires_client_authorization=(val)
|
63
|
+
_set 'RequiresClientAuthorization', val
|
64
|
+
end
|
65
|
+
|
66
|
+
# RequiresTransportSecurity: Boolean
|
67
|
+
#
|
68
|
+
# Determines whether or not the endpoint uses transport security.
|
69
|
+
#
|
70
|
+
# Default: true
|
71
|
+
def requires_transport_security
|
72
|
+
to_bool description['RequiresTransportSecurity']
|
73
|
+
end
|
74
|
+
|
75
|
+
def requires_transport_security=(val)
|
76
|
+
_set 'RequiresTransportSecurity', val
|
77
|
+
end
|
78
|
+
|
79
|
+
def ordered_props
|
80
|
+
[
|
81
|
+
'RelayType',
|
82
|
+
'RequiresClientAuthorization',
|
83
|
+
'RequiresTransportSecurity'
|
84
|
+
]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -34,10 +34,67 @@ module Azure
|
|
34
34
|
req.headers.delete "x-ms-version"
|
35
35
|
req.headers.delete "DataServiceVersion"
|
36
36
|
req.headers.delete "MaxDataServiceVersion"
|
37
|
+
req.headers["X-Process-At"] = "servicebus"
|
37
38
|
res.call
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
42
|
+
# Creates a new relay endpoint. Once created, this relay endpoint resource manifest is immutable.
|
43
|
+
#
|
44
|
+
# ==== Attributes
|
45
|
+
#
|
46
|
+
# * +relay+ - Azure::ServiceBus::Relay instance to create on server, or a string of the relay endpoint name
|
47
|
+
# * +options+ - Hash. The relay endpoint properties.
|
48
|
+
#
|
49
|
+
# ==== Options
|
50
|
+
#
|
51
|
+
# Accepted key/value pairs in options parameter are:
|
52
|
+
# * +:relay_type+ - String. Determines the type of the relay endpoint.
|
53
|
+
# * +:requires_client_authorization+ - Boolean. Determines whether or not clients need to authenticate when making calls.
|
54
|
+
# * +:requires_transport_security+ - Boolean. Determines whether or not the endpoint uses transport security.
|
55
|
+
#
|
56
|
+
def create_relay(relay, options={})
|
57
|
+
relay = _new_or_existing(Azure::ServiceBus::Relay, relay, options ? options : {})
|
58
|
+
create_resource_entry(:relay, relay, relay.name)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Deletes an existing relay endpoint.
|
62
|
+
#
|
63
|
+
# ==== Attributes
|
64
|
+
#
|
65
|
+
# * +relay+ - Azure::ServiceBus::Relay instance to delete or a string of the relay endpoint name
|
66
|
+
def delete_relay(relay)
|
67
|
+
delete_resource_entry(:relay, _name_for(relay))
|
68
|
+
end
|
69
|
+
|
70
|
+
# Retrieves the description for the specified relay endpoint.
|
71
|
+
#
|
72
|
+
# ==== Attributes
|
73
|
+
#
|
74
|
+
# * +relay+ - Azure::ServiceBus::Relay instance to retrieve or a string of the relay endpoint name
|
75
|
+
def get_relay(relay)
|
76
|
+
resource_entry(:relay, _name_for(relay))
|
77
|
+
end
|
78
|
+
|
79
|
+
# Enumerates the relay endpoints in the service namespace.
|
80
|
+
#
|
81
|
+
# ==== Attributes
|
82
|
+
#
|
83
|
+
# * +options+ - Hash. Optional parameters.
|
84
|
+
#
|
85
|
+
# ==== Options
|
86
|
+
#
|
87
|
+
# Accepted key/value pairs in options parameter are:
|
88
|
+
# * +:skip+ - Integer. Number of queues to skip.
|
89
|
+
# * +:top+ - Integer. Number of queues to list.
|
90
|
+
def list_relays(options={})
|
91
|
+
query = {}
|
92
|
+
query["$skip"] = options[:skip].to_i.to_s if options[:skip]
|
93
|
+
query["$top"] = options[:top].to_i.to_s if options[:top]
|
94
|
+
|
95
|
+
resource_list(:relay, query)
|
96
|
+
end
|
97
|
+
|
41
98
|
# Creates a new queue. Once created, this queue's resource manifest is immutable.
|
42
99
|
#
|
43
100
|
# ==== Attributes
|
@@ -510,8 +567,7 @@ module Azure
|
|
510
567
|
# * +:timeout+ - Integer. Timeout for the REST call.
|
511
568
|
#
|
512
569
|
def receive_queue_message(queue, options={})
|
513
|
-
peek_lock = true
|
514
|
-
peek_lock = options[:peek_lock] if options[:peek_lock]
|
570
|
+
peek_lock = options.fetch(:peek_lock, true)
|
515
571
|
|
516
572
|
options[:timeout] = options[:timeout] ? options[:timeout] : DEFAULT_TIMEOUT
|
517
573
|
if peek_lock
|
@@ -535,8 +591,7 @@ module Azure
|
|
535
591
|
# * +:timeout+ - Integer. Timeout for the REST call.
|
536
592
|
#
|
537
593
|
def receive_subscription_message(topic, subscription, options={})
|
538
|
-
peek_lock = true
|
539
|
-
peek_lock = options[:peek_lock] if options[:peek_lock]
|
594
|
+
peek_lock = options.fetch(:peek_lock, true)
|
540
595
|
|
541
596
|
options[:timeout] = options[:timeout] ? options[:timeout] : DEFAULT_TIMEOUT
|
542
597
|
if peek_lock
|
@@ -782,6 +837,12 @@ module Azure
|
|
782
837
|
generate_uri(subscriptions_path(topic, subscription), query)
|
783
838
|
end
|
784
839
|
|
840
|
+
protected
|
841
|
+
def relay_uri(relay, query={})
|
842
|
+
query["api-version"] = "2013-10"
|
843
|
+
generate_uri(relay, query)
|
844
|
+
end
|
845
|
+
|
785
846
|
protected
|
786
847
|
def queue_uri(topic, query={})
|
787
848
|
generate_uri(topic, query)
|
@@ -804,6 +865,11 @@ module Azure
|
|
804
865
|
resource_list_uri(:subscription, query, topic)
|
805
866
|
end
|
806
867
|
|
868
|
+
protected
|
869
|
+
def relay_list_uri(query={})
|
870
|
+
resource_list_uri(:relay, query)
|
871
|
+
end
|
872
|
+
|
807
873
|
protected
|
808
874
|
def queue_list_uri(query={})
|
809
875
|
resource_list_uri(:queue, query)
|
@@ -17,6 +17,7 @@ require 'azure/sql_database_management/sql_database'
|
|
17
17
|
module Azure
|
18
18
|
module SqlDatabaseManagement
|
19
19
|
module Serialization
|
20
|
+
extend Azure::Core::Utility
|
20
21
|
|
21
22
|
def self.database_to_xml(login, password, location)
|
22
23
|
builder = Nokogiri::XML::Builder.new do |xml|
|
@@ -16,7 +16,7 @@ require 'azure/sql_database_management/serialization'
|
|
16
16
|
|
17
17
|
module Azure
|
18
18
|
module SqlDatabaseManagement
|
19
|
-
class SqlDatabaseManagementService < BaseManagementService
|
19
|
+
class SqlDatabaseManagementService < BaseManagement::BaseManagementService
|
20
20
|
|
21
21
|
def initialize
|
22
22
|
super()
|
@@ -25,17 +25,17 @@ module Azure
|
|
25
25
|
# Public: Gets a list of database servers available under the
|
26
26
|
# current subscription.
|
27
27
|
#
|
28
|
-
# See http://msdn.microsoft.com/en-us/library/
|
28
|
+
# See http://msdn.microsoft.com/en-us/library/azure/gg715269.aspx
|
29
29
|
#
|
30
30
|
# Returns an array of Azure::SqlDatabaseManagement::SqlDatabase objects
|
31
31
|
def list_servers
|
32
32
|
request_path = '/servers'
|
33
|
-
request = SqlManagementHttpRequest.new(:get, request_path, nil)
|
33
|
+
request = BaseManagement::SqlManagementHttpRequest.new(:get, request_path, nil)
|
34
34
|
response = request.call
|
35
35
|
Serialization.databases_from_xml(response)
|
36
36
|
end
|
37
37
|
|
38
|
-
# Public: Create a new database server in
|
38
|
+
# Public: Create a new database server in Microsoft Azure.
|
39
39
|
#
|
40
40
|
# ==== Attributes
|
41
41
|
#
|
@@ -43,35 +43,35 @@ module Azure
|
|
43
43
|
# * +password+ - String. The administrator login password.
|
44
44
|
# * +:location+ - String. The location where the database server will be created.
|
45
45
|
#
|
46
|
-
# See http://msdn.microsoft.com/en-us/library/
|
46
|
+
# See http://msdn.microsoft.com/en-us/library/azure/gg715274.aspx
|
47
47
|
#
|
48
48
|
# Returns Azure::SqlDatabaseManagement::SqlDatabase object
|
49
49
|
def create_server(login, password, location)
|
50
50
|
body = Serialization.database_to_xml(login, password, location)
|
51
51
|
request_path = '/servers'
|
52
|
-
request = SqlManagementHttpRequest.new(:post, request_path, body)
|
52
|
+
request = BaseManagement::SqlManagementHttpRequest.new(:post, request_path, body)
|
53
53
|
response = request.call
|
54
54
|
sql_server = Serialization.server_name_from_xml(response, login, location)
|
55
|
-
Loggerx.info "SQL database server #{sql_server.name} is created." if sql_server
|
55
|
+
Azure::Loggerx.info "SQL database server #{sql_server.name} is created." if sql_server
|
56
56
|
sql_server
|
57
57
|
end
|
58
58
|
|
59
59
|
# Public: Deletes the specified database server of given
|
60
|
-
# subscription id from
|
60
|
+
# subscription id from Microsoft Azure.
|
61
61
|
#
|
62
62
|
# ==== Attributes
|
63
63
|
#
|
64
64
|
# * +name+ - String. Database server name.
|
65
65
|
#
|
66
|
-
# See http://msdn.microsoft.com/en-us/library/
|
66
|
+
# See http://msdn.microsoft.com/en-us/library/azure/gg715285.aspx
|
67
67
|
#
|
68
68
|
# Returns: None
|
69
69
|
def delete_server(name)
|
70
70
|
if get_sql_server(name)
|
71
71
|
request_path = "/servers/#{name}"
|
72
|
-
request = SqlManagementHttpRequest.new(:delete, request_path)
|
72
|
+
request = BaseManagement::SqlManagementHttpRequest.new(:delete, request_path)
|
73
73
|
request.call
|
74
|
-
Loggerx.info "Deleted database server #{name}."
|
74
|
+
Azure::Loggerx.info "Deleted database server #{name}."
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -83,16 +83,16 @@ module Azure
|
|
83
83
|
# * +name+ - String. Database server name.
|
84
84
|
# * +password+ - String. Database server new password.
|
85
85
|
#
|
86
|
-
# See http://msdn.microsoft.com/en-us/library/
|
86
|
+
# See http://msdn.microsoft.com/en-us/library/azure/gg715272.aspx
|
87
87
|
#
|
88
88
|
# Returns: None
|
89
89
|
def reset_password(name, password)
|
90
90
|
if get_sql_server(name)
|
91
91
|
body = Serialization.reset_password_to_xml(password)
|
92
92
|
request_path = "/servers/#{name}?op=ResetPassword"
|
93
|
-
request = SqlManagementHttpRequest.new(:post, request_path, body)
|
93
|
+
request = BaseManagement::SqlManagementHttpRequest.new(:post, request_path, body)
|
94
94
|
request.call
|
95
|
-
Loggerx.info "Password for server #{name} changed successfully."
|
95
|
+
Azure::Loggerx.info "Password for server #{name} changed successfully."
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -111,7 +111,7 @@ module Azure
|
|
111
111
|
# * +:start_ip_address+ - String. Start of the IP Range
|
112
112
|
# * +:end_ip_address+ - String. End of the IP Range
|
113
113
|
#
|
114
|
-
# See http://msdn.microsoft.com/en-us/library/
|
114
|
+
# See http://msdn.microsoft.com/en-us/library/azure/gg715280.aspx
|
115
115
|
#
|
116
116
|
# Returns: None
|
117
117
|
def set_sql_server_firewall_rule(server_name, rule_name, options = {})
|
@@ -127,14 +127,14 @@ module Azure
|
|
127
127
|
request_path = "/servers/#{server_name}/firewallrules/#{rule_name}?op=AutoDetectClientIP"
|
128
128
|
method = :post
|
129
129
|
end
|
130
|
-
request = SqlManagementHttpRequest.new(method, request_path, body)
|
130
|
+
request = BaseManagement::SqlManagementHttpRequest.new(method, request_path, body)
|
131
131
|
request.headers['x-ms-version'] = '1.0'
|
132
132
|
request.uri = URI.parse(Azure.config.sql_database_management_endpoint + Azure.config.subscription_id + request_path)
|
133
133
|
# Management certificate authentication Endpoint throws errors for this operation. Need to re-visit
|
134
134
|
# this once the Azure API is working.
|
135
135
|
|
136
136
|
request.call
|
137
|
-
Loggerx.info "Added server-level firewall rule #{rule_name}."
|
137
|
+
Azure::Loggerx.info "Added server-level firewall rule #{rule_name}."
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
@@ -145,13 +145,13 @@ module Azure
|
|
145
145
|
#
|
146
146
|
# * +server_name+ - String. Database server name.
|
147
147
|
#
|
148
|
-
# See http://msdn.microsoft.com/en-us/library/
|
148
|
+
# See http://msdn.microsoft.com/en-us/library/azure/gg715278.aspx
|
149
149
|
#
|
150
150
|
# Returns an array of firewall
|
151
151
|
def list_sql_server_firewall_rules(server_name)
|
152
152
|
if get_sql_server(server_name)
|
153
153
|
request_path = "/servers/#{server_name}/firewallrules"
|
154
|
-
request = SqlManagementHttpRequest.new(:get, request_path)
|
154
|
+
request = BaseManagement::SqlManagementHttpRequest.new(:get, request_path)
|
155
155
|
response = request.call
|
156
156
|
Serialization.database_firewall_from_xml(response)
|
157
157
|
end
|
@@ -164,7 +164,7 @@ module Azure
|
|
164
164
|
# * +name+ - String. SQL database server name.
|
165
165
|
# * +rule_name+ - String. SQL database server firewall rule name.
|
166
166
|
#
|
167
|
-
# See http://msdn.microsoft.com/en-us/library/
|
167
|
+
# See http://msdn.microsoft.com/en-us/library/azure/gg715277.aspx
|
168
168
|
#
|
169
169
|
# Returns: None
|
170
170
|
def delete_sql_server_firewall_rule(server_name, rule_name)
|
@@ -173,9 +173,9 @@ module Azure
|
|
173
173
|
raise error
|
174
174
|
elsif get_sql_server(server_name)
|
175
175
|
request_path = "/servers/#{server_name}/firewallrules/#{rule_name}"
|
176
|
-
request = SqlManagementHttpRequest.new(:delete, request_path)
|
176
|
+
request = BaseManagement::SqlManagementHttpRequest.new(:delete, request_path)
|
177
177
|
request.call
|
178
|
-
Loggerx.info "Deleted server-level firewall rule #{rule_name}."
|
178
|
+
Azure::Loggerx.info "Deleted server-level firewall rule #{rule_name}."
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|