azure_mgmt_sql 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +5 -0
- data/azure_mgmt_sql.gemspec +35 -0
- data/lib/azure_mgmt_sql/models/email_account_admins.rb +16 -0
- data/lib/azure_mgmt_sql/models/server_security_alert_policy.rb +93 -0
- data/lib/azure_mgmt_sql/models/server_security_alert_policy_create_or_update_parameters.rb +65 -0
- data/lib/azure_mgmt_sql/models/server_security_alert_policy_properties.rb +94 -0
- data/lib/azure_mgmt_sql/models/state.rb +17 -0
- data/lib/azure_mgmt_sql/module_definition.rb +8 -0
- data/lib/azure_mgmt_sql/security_alert_policy.rb +219 -0
- data/lib/azure_mgmt_sql/sql_management_client.rb +67 -0
- data/lib/azure_mgmt_sql/version.rb +8 -0
- data/lib/azure_mgmt_sql.rb +32 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1620b9128d0f447755882d13a5ffe0174d9405eb
|
4
|
+
data.tar.gz: 108380d2ddd577be85f8b37fae68cf9aed365364
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 06a58159c8076b1867e658c5f782b1cafb6cd124ddfed9f94d17f3adba5848cccd27774da81fdc38ecd2f7966e4a3f25f007e6ae72db0b28bbf95466a1b64185
|
7
|
+
data.tar.gz: c3248bda96d4c6644cbf0e47647f793f4d238c11af076bcf5cf352b2b85c9ab15cc37813d8670413855e5baf617dcfdbe788b90c931ba0df9b94ed8a95e4a56a
|
data/.rspec
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Microsoft Corporation
|
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.
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
lib = File.expand_path('../lib', __FILE__)
|
6
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
7
|
+
|
8
|
+
require 'azure_mgmt_sql/module_definition'
|
9
|
+
require 'azure_mgmt_sql/version'
|
10
|
+
|
11
|
+
Gem::Specification.new do |spec|
|
12
|
+
spec.name = 'azure_mgmt_sql'
|
13
|
+
spec.version = Azure::ARM::SQL::VERSION
|
14
|
+
spec.authors = 'Microsoft Corporation'
|
15
|
+
spec.email = 'azrubyteam@microsoft.com'
|
16
|
+
spec.description = 'Microsoft Azure SQL Management Client Library for Ruby'
|
17
|
+
spec.summary = 'Official Ruby client library to consume Microsoft Azure SQL Management services.'
|
18
|
+
spec.homepage = 'http://github.com/azure/azure-sdk-for-ruby'
|
19
|
+
spec.license = 'MIT'
|
20
|
+
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
spec.bindir = 'bin'
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ['lib']
|
25
|
+
|
26
|
+
spec.required_ruby_version = '>= 1.9.3'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.9'
|
29
|
+
spec.add_development_dependency 'rake', '~> 10'
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3'
|
31
|
+
spec.add_development_dependency 'dotenv', '~> 2'
|
32
|
+
spec.add_development_dependency 'azure_mgmt_resources', '~> 0.2'
|
33
|
+
|
34
|
+
spec.add_runtime_dependency 'ms_rest_azure', '~> 0.2.0'
|
35
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::SQL
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for EmailAccountAdmins
|
10
|
+
#
|
11
|
+
module EmailAccountAdmins
|
12
|
+
Enabled = "Enabled"
|
13
|
+
Disabled = "Disabled"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::SQL
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Represents an Azure SQL Server Security Alert Policy.
|
10
|
+
#
|
11
|
+
class ServerSecurityAlertPolicy < MsRestAzure::Resource
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [ServerSecurityAlertPolicyProperties] Represents the
|
16
|
+
# properties of the resource.
|
17
|
+
attr_accessor :properties
|
18
|
+
|
19
|
+
#
|
20
|
+
# Validate the object. Throws ValidationError if validation fails.
|
21
|
+
#
|
22
|
+
def validate
|
23
|
+
@properties.validate unless @properties.nil?
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Serializes given Model object into Ruby Hash.
|
28
|
+
# @param object Model object to serialize.
|
29
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
30
|
+
#
|
31
|
+
def self.serialize_object(object)
|
32
|
+
object.validate
|
33
|
+
output_object = {}
|
34
|
+
|
35
|
+
serialized_property = object.location
|
36
|
+
output_object['location'] = serialized_property unless serialized_property.nil?
|
37
|
+
|
38
|
+
serialized_property = object.id
|
39
|
+
output_object['id'] = serialized_property unless serialized_property.nil?
|
40
|
+
|
41
|
+
serialized_property = object.name
|
42
|
+
output_object['name'] = serialized_property unless serialized_property.nil?
|
43
|
+
|
44
|
+
serialized_property = object.type
|
45
|
+
output_object['type'] = serialized_property unless serialized_property.nil?
|
46
|
+
|
47
|
+
serialized_property = object.tags
|
48
|
+
output_object['tags'] = serialized_property unless serialized_property.nil?
|
49
|
+
|
50
|
+
serialized_property = object.properties
|
51
|
+
unless serialized_property.nil?
|
52
|
+
serialized_property = ServerSecurityAlertPolicyProperties.serialize_object(serialized_property)
|
53
|
+
end
|
54
|
+
output_object['properties'] = serialized_property unless serialized_property.nil?
|
55
|
+
|
56
|
+
output_object
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
60
|
+
# Deserializes given Ruby Hash into Model object.
|
61
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
62
|
+
# @return [ServerSecurityAlertPolicy] Deserialized object.
|
63
|
+
#
|
64
|
+
def self.deserialize_object(object)
|
65
|
+
return if object.nil?
|
66
|
+
output_object = ServerSecurityAlertPolicy.new
|
67
|
+
|
68
|
+
deserialized_property = object['location']
|
69
|
+
output_object.location = deserialized_property
|
70
|
+
|
71
|
+
deserialized_property = object['id']
|
72
|
+
output_object.id = deserialized_property
|
73
|
+
|
74
|
+
deserialized_property = object['name']
|
75
|
+
output_object.name = deserialized_property
|
76
|
+
|
77
|
+
deserialized_property = object['type']
|
78
|
+
output_object.type = deserialized_property
|
79
|
+
|
80
|
+
deserialized_property = object['tags']
|
81
|
+
output_object.tags = deserialized_property
|
82
|
+
|
83
|
+
deserialized_property = object['properties']
|
84
|
+
unless deserialized_property.nil?
|
85
|
+
deserialized_property = ServerSecurityAlertPolicyProperties.deserialize_object(deserialized_property)
|
86
|
+
end
|
87
|
+
output_object.properties = deserialized_property
|
88
|
+
|
89
|
+
output_object
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::SQL
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Create or update server security alert policy parameters.
|
10
|
+
#
|
11
|
+
class ServerSecurityAlertPolicyCreateOrUpdateParameters
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [ServerSecurityAlertPolicyProperties] Properties of the
|
16
|
+
# request.
|
17
|
+
attr_accessor :properties
|
18
|
+
|
19
|
+
#
|
20
|
+
# Validate the object. Throws ValidationError if validation fails.
|
21
|
+
#
|
22
|
+
def validate
|
23
|
+
fail MsRest::ValidationError, 'property properties is nil' if @properties.nil?
|
24
|
+
@properties.validate unless @properties.nil?
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# Serializes given Model object into Ruby Hash.
|
29
|
+
# @param object Model object to serialize.
|
30
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
31
|
+
#
|
32
|
+
def self.serialize_object(object)
|
33
|
+
object.validate
|
34
|
+
output_object = {}
|
35
|
+
|
36
|
+
serialized_property = object.properties
|
37
|
+
unless serialized_property.nil?
|
38
|
+
serialized_property = ServerSecurityAlertPolicyProperties.serialize_object(serialized_property)
|
39
|
+
end
|
40
|
+
output_object['properties'] = serialized_property unless serialized_property.nil?
|
41
|
+
|
42
|
+
output_object
|
43
|
+
end
|
44
|
+
|
45
|
+
#
|
46
|
+
# Deserializes given Ruby Hash into Model object.
|
47
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
48
|
+
# @return [ServerSecurityAlertPolicyCreateOrUpdateParameters]
|
49
|
+
# Deserialized object.
|
50
|
+
#
|
51
|
+
def self.deserialize_object(object)
|
52
|
+
return if object.nil?
|
53
|
+
output_object = ServerSecurityAlertPolicyCreateOrUpdateParameters.new
|
54
|
+
|
55
|
+
deserialized_property = object['properties']
|
56
|
+
unless deserialized_property.nil?
|
57
|
+
deserialized_property = ServerSecurityAlertPolicyProperties.deserialize_object(deserialized_property)
|
58
|
+
end
|
59
|
+
output_object.properties = deserialized_property
|
60
|
+
|
61
|
+
output_object
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::SQL
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Represents the properties of an Azure SQL Security alert policy.
|
10
|
+
#
|
11
|
+
class ServerSecurityAlertPolicyProperties
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [State] The state of the Azure SQL Security alert policy (New,
|
16
|
+
# Enabled or Disabled). Possible values include: 'Enabled', 'Disabled',
|
17
|
+
# 'New'
|
18
|
+
attr_accessor :state
|
19
|
+
|
20
|
+
# @return [String] The disable alerts of the Azure SQL Security alert
|
21
|
+
# policy.
|
22
|
+
attr_accessor :disabled_alerts
|
23
|
+
|
24
|
+
# @return [String] The list of email addresses to send the alert.
|
25
|
+
attr_accessor :email_addresses
|
26
|
+
|
27
|
+
# @return [EmailAccountAdmins] Value that indicated whether to email the
|
28
|
+
# azure account admins. Possible values include: 'Enabled', 'Disabled'
|
29
|
+
attr_accessor :email_account_admins
|
30
|
+
|
31
|
+
#
|
32
|
+
# Validate the object. Throws ValidationError if validation fails.
|
33
|
+
#
|
34
|
+
def validate
|
35
|
+
end
|
36
|
+
|
37
|
+
#
|
38
|
+
# Serializes given Model object into Ruby Hash.
|
39
|
+
# @param object Model object to serialize.
|
40
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
41
|
+
#
|
42
|
+
def self.serialize_object(object)
|
43
|
+
object.validate
|
44
|
+
output_object = {}
|
45
|
+
|
46
|
+
serialized_property = object.state
|
47
|
+
output_object['state'] = serialized_property unless serialized_property.nil?
|
48
|
+
|
49
|
+
serialized_property = object.disabled_alerts
|
50
|
+
output_object['disabledAlerts'] = serialized_property unless serialized_property.nil?
|
51
|
+
|
52
|
+
serialized_property = object.email_addresses
|
53
|
+
output_object['emailAddresses'] = serialized_property unless serialized_property.nil?
|
54
|
+
|
55
|
+
serialized_property = object.email_account_admins
|
56
|
+
output_object['emailAccountAdmins'] = serialized_property unless serialized_property.nil?
|
57
|
+
|
58
|
+
output_object
|
59
|
+
end
|
60
|
+
|
61
|
+
#
|
62
|
+
# Deserializes given Ruby Hash into Model object.
|
63
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
64
|
+
# @return [ServerSecurityAlertPolicyProperties] Deserialized object.
|
65
|
+
#
|
66
|
+
def self.deserialize_object(object)
|
67
|
+
return if object.nil?
|
68
|
+
output_object = ServerSecurityAlertPolicyProperties.new
|
69
|
+
|
70
|
+
deserialized_property = object['state']
|
71
|
+
if (!deserialized_property.nil? && !deserialized_property.empty?)
|
72
|
+
enum_is_valid = State.constants.any? { |e| State.const_get(e).to_s.downcase == deserialized_property.downcase }
|
73
|
+
warn 'Enum State does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid
|
74
|
+
end
|
75
|
+
output_object.state = deserialized_property
|
76
|
+
|
77
|
+
deserialized_property = object['disabledAlerts']
|
78
|
+
output_object.disabled_alerts = deserialized_property
|
79
|
+
|
80
|
+
deserialized_property = object['emailAddresses']
|
81
|
+
output_object.email_addresses = deserialized_property
|
82
|
+
|
83
|
+
deserialized_property = object['emailAccountAdmins']
|
84
|
+
if (!deserialized_property.nil? && !deserialized_property.empty?)
|
85
|
+
enum_is_valid = EmailAccountAdmins.constants.any? { |e| EmailAccountAdmins.const_get(e).to_s.downcase == deserialized_property.downcase }
|
86
|
+
warn 'Enum EmailAccountAdmins does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid
|
87
|
+
end
|
88
|
+
output_object.email_account_admins = deserialized_property
|
89
|
+
|
90
|
+
output_object
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::SQL
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for State
|
10
|
+
#
|
11
|
+
module State
|
12
|
+
Enabled = "Enabled"
|
13
|
+
Disabled = "Disabled"
|
14
|
+
New = "New"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,219 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::SQL
|
7
|
+
#
|
8
|
+
# The Azure SQL Database management API provides a RESTful set of web
|
9
|
+
# services that interact with Azure SQL Database services to manage your
|
10
|
+
# databases. The API enables users to create, retrieve, update, and delete
|
11
|
+
# Databases, Servers and related resources.
|
12
|
+
#
|
13
|
+
class SecurityAlertPolicy
|
14
|
+
include Azure::ARM::SQL::Models
|
15
|
+
include MsRestAzure
|
16
|
+
|
17
|
+
#
|
18
|
+
# Creates and initializes a new instance of the SecurityAlertPolicy class.
|
19
|
+
# @param client service class for accessing basic functionality.
|
20
|
+
#
|
21
|
+
def initialize(client)
|
22
|
+
@client = client
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return reference to the SqlManagementClient
|
26
|
+
attr_reader :client
|
27
|
+
|
28
|
+
#
|
29
|
+
# Creates or updates an Azure SQL Server security alert policy.
|
30
|
+
#
|
31
|
+
# @param parameters [ServerSecurityAlertPolicyCreateOrUpdateParameters] The
|
32
|
+
# required parameters for creating or updating a Azure SQL Server security
|
33
|
+
# alert policy.
|
34
|
+
# @param resource_group_name [String] The name of the Resource Group to which
|
35
|
+
# the server belongs.
|
36
|
+
# @param server_name [String] The name of the Azure SQL Server.
|
37
|
+
# @param @client.api_version [String] Client Api Version.
|
38
|
+
# @param @client.subscription_id [String] The subscription credentials which
|
39
|
+
# uniquely identify Microsoft Azure subscription.
|
40
|
+
# @param @client.accept_language [String] Gets or sets the preferred language
|
41
|
+
# for the response.
|
42
|
+
#
|
43
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
44
|
+
# response.
|
45
|
+
#
|
46
|
+
def create_or_update(parameters, resource_group_name, server_name, custom_headers = nil)
|
47
|
+
# Send request
|
48
|
+
promise = begin_create_or_update(parameters, resource_group_name, server_name, custom_headers)
|
49
|
+
|
50
|
+
promise = promise.then do |response|
|
51
|
+
# Defining deserialization method.
|
52
|
+
deserialize_method = lambda do |parsed_response|
|
53
|
+
unless parsed_response.nil?
|
54
|
+
parsed_response = ServerSecurityAlertPolicy.deserialize_object(parsed_response)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Waiting for response.
|
59
|
+
@client.get_put_operation_result(response, deserialize_method)
|
60
|
+
end
|
61
|
+
|
62
|
+
promise
|
63
|
+
end
|
64
|
+
|
65
|
+
#
|
66
|
+
# Creates or updates an Azure SQL Server security alert policy.
|
67
|
+
#
|
68
|
+
# @param parameters [ServerSecurityAlertPolicyCreateOrUpdateParameters] The
|
69
|
+
# required parameters for creating or updating a Azure SQL Server security
|
70
|
+
# alert policy.
|
71
|
+
# @param resource_group_name [String] The name of the Resource Group to which
|
72
|
+
# the server belongs.
|
73
|
+
# @param server_name [String] The name of the Azure SQL Server.
|
74
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
75
|
+
# applied to HTTP request.
|
76
|
+
#
|
77
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
78
|
+
# response.
|
79
|
+
#
|
80
|
+
def begin_create_or_update(parameters, resource_group_name, server_name, custom_headers = nil)
|
81
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
82
|
+
parameters.validate unless parameters.nil?
|
83
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
84
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
85
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
86
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
87
|
+
request_headers = {}
|
88
|
+
|
89
|
+
# Set Headers
|
90
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
91
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
92
|
+
|
93
|
+
# Serialize Request
|
94
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
95
|
+
unless parameters.nil?
|
96
|
+
parameters = ServerSecurityAlertPolicyCreateOrUpdateParameters.serialize_object(parameters)
|
97
|
+
end
|
98
|
+
request_content = JSON.generate(parameters, quirks_mode: true)
|
99
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/Default'
|
100
|
+
options = {
|
101
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
102
|
+
path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
|
103
|
+
query_params: {'api-version' => @client.api_version},
|
104
|
+
body: request_content,
|
105
|
+
headers: request_headers.merge(custom_headers || {})
|
106
|
+
}
|
107
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
|
108
|
+
promise = request.run_promise do |req|
|
109
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
110
|
+
end
|
111
|
+
|
112
|
+
promise = promise.then do |http_response|
|
113
|
+
status_code = http_response.status
|
114
|
+
response_content = http_response.body
|
115
|
+
unless status_code == 200 || status_code == 201
|
116
|
+
error_model = JSON.load(response_content)
|
117
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Create Result
|
121
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
122
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
123
|
+
# Deserialize Response
|
124
|
+
if status_code == 200
|
125
|
+
begin
|
126
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
127
|
+
unless parsed_response.nil?
|
128
|
+
parsed_response = ServerSecurityAlertPolicy.deserialize_object(parsed_response)
|
129
|
+
end
|
130
|
+
result.body = parsed_response
|
131
|
+
rescue Exception => e
|
132
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
# Deserialize Response
|
136
|
+
if status_code == 201
|
137
|
+
begin
|
138
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
139
|
+
unless parsed_response.nil?
|
140
|
+
parsed_response = ServerSecurityAlertPolicy.deserialize_object(parsed_response)
|
141
|
+
end
|
142
|
+
result.body = parsed_response
|
143
|
+
rescue Exception => e
|
144
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
result
|
149
|
+
end
|
150
|
+
|
151
|
+
promise.execute
|
152
|
+
end
|
153
|
+
|
154
|
+
#
|
155
|
+
# Returns an Azure SQL Server security alert policy.
|
156
|
+
#
|
157
|
+
# @param resource_group_name [String] The name of the Resource Group to which
|
158
|
+
# the server belongs.
|
159
|
+
# @param server_name [String] The name of the Azure SQL Server.
|
160
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
161
|
+
# applied to HTTP request.
|
162
|
+
#
|
163
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
164
|
+
# response.
|
165
|
+
#
|
166
|
+
def get(resource_group_name, server_name, custom_headers = nil)
|
167
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
168
|
+
fail ArgumentError, 'server_name is nil' if server_name.nil?
|
169
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
170
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
171
|
+
request_headers = {}
|
172
|
+
|
173
|
+
# Set Headers
|
174
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
175
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
176
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies/Default'
|
177
|
+
options = {
|
178
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
179
|
+
path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
|
180
|
+
query_params: {'api-version' => @client.api_version},
|
181
|
+
headers: request_headers.merge(custom_headers || {})
|
182
|
+
}
|
183
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
184
|
+
promise = request.run_promise do |req|
|
185
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
186
|
+
end
|
187
|
+
|
188
|
+
promise = promise.then do |http_response|
|
189
|
+
status_code = http_response.status
|
190
|
+
response_content = http_response.body
|
191
|
+
unless status_code == 200
|
192
|
+
error_model = JSON.load(response_content)
|
193
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
194
|
+
end
|
195
|
+
|
196
|
+
# Create Result
|
197
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
198
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
199
|
+
# Deserialize Response
|
200
|
+
if status_code == 200
|
201
|
+
begin
|
202
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
203
|
+
unless parsed_response.nil?
|
204
|
+
parsed_response = ServerSecurityAlertPolicy.deserialize_object(parsed_response)
|
205
|
+
end
|
206
|
+
result.body = parsed_response
|
207
|
+
rescue Exception => e
|
208
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
result
|
213
|
+
end
|
214
|
+
|
215
|
+
promise.execute
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::SQL
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class SqlManagementClient < MsRestAzure::AzureServiceClient
|
11
|
+
include Azure::ARM::SQL::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
# @return [String] the base URI of the service.
|
15
|
+
attr_accessor :base_url
|
16
|
+
|
17
|
+
# @return Gets Azure subscription credentials.
|
18
|
+
attr_reader :credentials
|
19
|
+
|
20
|
+
# @return [String] The subscription credentials which uniquely identify
|
21
|
+
# Microsoft Azure subscription.
|
22
|
+
attr_accessor :subscription_id
|
23
|
+
|
24
|
+
# @return [String] Client Api Version.
|
25
|
+
attr_reader :api_version
|
26
|
+
|
27
|
+
# @return [String] Gets or sets the preferred language for the response.
|
28
|
+
attr_accessor :accept_language
|
29
|
+
|
30
|
+
# @return [Integer] Gets or sets the retry timeout in seconds for Long
|
31
|
+
# Running Operations. Default value is 30.
|
32
|
+
attr_accessor :long_running_operation_retry_timeout
|
33
|
+
|
34
|
+
# @return [Boolean] When set to true a unique x-ms-client-request-id value
|
35
|
+
# is generated and included in each request. Default is true.
|
36
|
+
attr_accessor :generate_client_request_id
|
37
|
+
|
38
|
+
# @return Subscription credentials which uniquely identify client
|
39
|
+
# subscription.
|
40
|
+
attr_accessor :credentials
|
41
|
+
|
42
|
+
# @return security_alert_policy
|
43
|
+
attr_reader :security_alert_policy
|
44
|
+
|
45
|
+
#
|
46
|
+
# Creates initializes a new instance of the SqlManagementClient class.
|
47
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
48
|
+
# @param base_url [String] the base URI of the service.
|
49
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
50
|
+
#
|
51
|
+
def initialize(credentials, base_url = nil, options = nil)
|
52
|
+
super(credentials, options)
|
53
|
+
@base_url = base_url || 'https://management.azure.com'
|
54
|
+
|
55
|
+
fail ArgumentError, 'credentials is nil' if credentials.nil?
|
56
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
|
57
|
+
@credentials = credentials
|
58
|
+
|
59
|
+
@security_alert_policy = SecurityAlertPolicy.new(self)
|
60
|
+
@api_version = '2015-05-01-preview'
|
61
|
+
@accept_language = 'en-US'
|
62
|
+
@long_running_operation_retry_timeout = 30
|
63
|
+
@generate_client_request_id = true
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
require 'uri'
|
7
|
+
require 'cgi'
|
8
|
+
require 'date'
|
9
|
+
require 'json'
|
10
|
+
require 'base64'
|
11
|
+
require 'erb'
|
12
|
+
require 'securerandom'
|
13
|
+
require 'time'
|
14
|
+
require 'timeliness'
|
15
|
+
require 'faraday'
|
16
|
+
require 'faraday-cookie_jar'
|
17
|
+
require 'concurrent'
|
18
|
+
require 'ms_rest'
|
19
|
+
require 'ms_rest_azure'
|
20
|
+
|
21
|
+
module Azure::ARM::SQL
|
22
|
+
autoload :SecurityAlertPolicy, 'azure_mgmt_sql/security_alert_policy.rb'
|
23
|
+
autoload :SqlManagementClient, 'azure_mgmt_sql/sql_management_client.rb'
|
24
|
+
|
25
|
+
module Models
|
26
|
+
autoload :ServerSecurityAlertPolicyProperties, 'azure_mgmt_sql/models/server_security_alert_policy_properties.rb'
|
27
|
+
autoload :ServerSecurityAlertPolicyCreateOrUpdateParameters, 'azure_mgmt_sql/models/server_security_alert_policy_create_or_update_parameters.rb'
|
28
|
+
autoload :ServerSecurityAlertPolicy, 'azure_mgmt_sql/models/server_security_alert_policy.rb'
|
29
|
+
autoload :State, 'azure_mgmt_sql/models/state.rb'
|
30
|
+
autoload :EmailAccountAdmins, 'azure_mgmt_sql/models/email_account_admins.rb'
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: azure_mgmt_sql
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Microsoft Corporation
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: dotenv
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: azure_mgmt_resources
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.2'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: ms_rest_azure
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.2.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.2.0
|
97
|
+
description: Microsoft Azure SQL Management Client Library for Ruby
|
98
|
+
email: azrubyteam@microsoft.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- ".rspec"
|
104
|
+
- LICENSE.txt
|
105
|
+
- Rakefile
|
106
|
+
- azure_mgmt_sql.gemspec
|
107
|
+
- lib/azure_mgmt_sql.rb
|
108
|
+
- lib/azure_mgmt_sql/models/email_account_admins.rb
|
109
|
+
- lib/azure_mgmt_sql/models/server_security_alert_policy.rb
|
110
|
+
- lib/azure_mgmt_sql/models/server_security_alert_policy_create_or_update_parameters.rb
|
111
|
+
- lib/azure_mgmt_sql/models/server_security_alert_policy_properties.rb
|
112
|
+
- lib/azure_mgmt_sql/models/state.rb
|
113
|
+
- lib/azure_mgmt_sql/module_definition.rb
|
114
|
+
- lib/azure_mgmt_sql/security_alert_policy.rb
|
115
|
+
- lib/azure_mgmt_sql/sql_management_client.rb
|
116
|
+
- lib/azure_mgmt_sql/version.rb
|
117
|
+
homepage: http://github.com/azure/azure-sdk-for-ruby
|
118
|
+
licenses:
|
119
|
+
- MIT
|
120
|
+
metadata: {}
|
121
|
+
post_install_message:
|
122
|
+
rdoc_options: []
|
123
|
+
require_paths:
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: 1.9.3
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
requirements: []
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 2.4.6
|
138
|
+
signing_key:
|
139
|
+
specification_version: 4
|
140
|
+
summary: Official Ruby client library to consume Microsoft Azure SQL Management services.
|
141
|
+
test_files: []
|