azure_mgmt_sql 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_sql.rb +95 -46
  3. data/lib/generated/azure_mgmt_sql/backup_long_term_retention_policies.rb +310 -0
  4. data/lib/generated/azure_mgmt_sql/backup_long_term_retention_vaults.rb +300 -0
  5. data/lib/generated/azure_mgmt_sql/data_masking_policies.rb +248 -0
  6. data/lib/generated/azure_mgmt_sql/data_masking_rules.rb +262 -0
  7. data/lib/generated/azure_mgmt_sql/database_blob_auditing_policies.rb +264 -0
  8. data/lib/generated/azure_mgmt_sql/database_threat_detection_policies.rb +264 -0
  9. data/lib/generated/azure_mgmt_sql/database_usages.rb +129 -0
  10. data/lib/generated/azure_mgmt_sql/databases.rb +357 -2825
  11. data/lib/generated/azure_mgmt_sql/elastic_pool_activities.rb +132 -0
  12. data/lib/generated/azure_mgmt_sql/elastic_pool_database_activities.rb +129 -0
  13. data/lib/generated/azure_mgmt_sql/elastic_pools.rb +0 -417
  14. data/lib/generated/azure_mgmt_sql/encryption_protectors.rb +498 -0
  15. data/lib/generated/azure_mgmt_sql/failover_groups.rb +6 -6
  16. data/lib/generated/azure_mgmt_sql/geo_backup_policies.rb +359 -0
  17. data/lib/generated/azure_mgmt_sql/models/database_usage.rb +4 -9
  18. data/lib/generated/azure_mgmt_sql/models/encryption_protector.rb +3 -4
  19. data/lib/generated/azure_mgmt_sql/models/failover_group.rb +2 -2
  20. data/lib/generated/azure_mgmt_sql/models/failover_group_read_write_endpoint.rb +6 -4
  21. data/lib/generated/azure_mgmt_sql/models/failover_group_update.rb +93 -0
  22. data/lib/generated/azure_mgmt_sql/models/firewall_rule.rb +11 -14
  23. data/lib/generated/azure_mgmt_sql/models/metric_value.rb +1 -17
  24. data/lib/generated/azure_mgmt_sql/models/operation.rb +36 -3
  25. data/lib/generated/azure_mgmt_sql/models/operation_display.rb +20 -5
  26. data/lib/generated/azure_mgmt_sql/models/operation_list_result.rb +36 -6
  27. data/lib/generated/azure_mgmt_sql/models/operation_origin.rb +16 -0
  28. data/lib/generated/azure_mgmt_sql/models/partner_info.rb +1 -1
  29. data/lib/generated/azure_mgmt_sql/models/replication_link.rb +9 -12
  30. data/lib/generated/azure_mgmt_sql/models/server_azure_adadministrator.rb +11 -3
  31. data/lib/generated/azure_mgmt_sql/models/server_key.rb +3 -4
  32. data/lib/generated/azure_mgmt_sql/models/service_objective.rb +11 -3
  33. data/lib/generated/azure_mgmt_sql/models/service_tier_advisor.rb +11 -3
  34. data/lib/generated/azure_mgmt_sql/models/sync_agent.rb +137 -0
  35. data/lib/generated/azure_mgmt_sql/models/{sql_sub_resource.rb → sync_agent_key_properties.rb} +9 -20
  36. data/lib/generated/azure_mgmt_sql/models/sync_agent_linked_database.rb +126 -0
  37. data/lib/generated/azure_mgmt_sql/models/sync_agent_linked_database_list_result.rb +96 -0
  38. data/lib/generated/azure_mgmt_sql/models/sync_agent_list_result.rb +96 -0
  39. data/lib/generated/azure_mgmt_sql/models/sync_agent_state.rb +17 -0
  40. data/lib/generated/azure_mgmt_sql/models/sync_conflict_resolution_policy.rb +16 -0
  41. data/lib/generated/azure_mgmt_sql/models/sync_database_id_list_result.rb +96 -0
  42. data/lib/generated/azure_mgmt_sql/models/{sub_resource.rb → sync_database_id_properties.rb} +7 -15
  43. data/lib/generated/azure_mgmt_sql/models/sync_direction.rb +17 -0
  44. data/lib/generated/azure_mgmt_sql/models/sync_full_schema_properties.rb +66 -0
  45. data/lib/generated/azure_mgmt_sql/models/sync_full_schema_properties_list_result.rb +96 -0
  46. data/lib/generated/azure_mgmt_sql/models/sync_full_schema_table.rb +99 -0
  47. data/lib/generated/azure_mgmt_sql/models/sync_full_schema_table_column.rb +112 -0
  48. data/lib/generated/azure_mgmt_sql/models/sync_group.rb +145 -0
  49. data/lib/generated/azure_mgmt_sql/models/sync_group_list_result.rb +96 -0
  50. data/lib/generated/azure_mgmt_sql/models/sync_group_log_list_result.rb +96 -0
  51. data/lib/generated/azure_mgmt_sql/models/sync_group_log_properties.rb +102 -0
  52. data/lib/generated/azure_mgmt_sql/models/sync_group_log_type.rb +18 -0
  53. data/lib/generated/azure_mgmt_sql/models/sync_group_schema.rb +64 -0
  54. data/lib/generated/azure_mgmt_sql/models/sync_group_schema_table.rb +64 -0
  55. data/lib/generated/azure_mgmt_sql/models/sync_group_schema_table_column.rb +65 -0
  56. data/lib/generated/azure_mgmt_sql/models/sync_group_state.rb +19 -0
  57. data/lib/generated/azure_mgmt_sql/models/sync_member.rb +160 -0
  58. data/lib/generated/azure_mgmt_sql/models/sync_member_db_type.rb +16 -0
  59. data/lib/generated/azure_mgmt_sql/models/sync_member_list_result.rb +96 -0
  60. data/lib/generated/azure_mgmt_sql/models/sync_member_state.rb +32 -0
  61. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption.rb +22 -3
  62. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity.rb +22 -3
  63. data/lib/generated/azure_mgmt_sql/models/virtual_network_rule.rb +2 -2
  64. data/lib/generated/azure_mgmt_sql/operations.rb +111 -4
  65. data/lib/generated/azure_mgmt_sql/recommended_elastic_pools.rb +3 -215
  66. data/lib/generated/azure_mgmt_sql/replication_links.rb +629 -0
  67. data/lib/generated/azure_mgmt_sql/restore_points.rb +132 -0
  68. data/lib/generated/azure_mgmt_sql/server_azure_adadministrators.rb +5 -5
  69. data/lib/generated/azure_mgmt_sql/server_connection_policies.rb +250 -0
  70. data/lib/generated/azure_mgmt_sql/server_keys.rb +10 -10
  71. data/lib/generated/azure_mgmt_sql/server_usages.rb +125 -0
  72. data/lib/generated/azure_mgmt_sql/servers.rb +161 -1423
  73. data/lib/generated/azure_mgmt_sql/service_objectives.rb +229 -0
  74. data/lib/generated/azure_mgmt_sql/service_tier_advisors.rb +234 -0
  75. data/lib/generated/azure_mgmt_sql/sql_management_client.rb +100 -9
  76. data/lib/generated/azure_mgmt_sql/sync_agents.rb +983 -0
  77. data/lib/generated/azure_mgmt_sql/sync_groups.rb +1863 -0
  78. data/lib/generated/azure_mgmt_sql/sync_members.rb +1290 -0
  79. data/lib/generated/azure_mgmt_sql/transparent_data_encryption_activities.rb +133 -0
  80. data/lib/generated/azure_mgmt_sql/transparent_data_encryptions.rb +264 -0
  81. data/lib/generated/azure_mgmt_sql/version.rb +1 -1
  82. metadata +55 -6
@@ -0,0 +1,262 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.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 you to create, retrieve, update, and delete
11
+ # databases.
12
+ #
13
+ class DataMaskingRules
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the DataMaskingRules class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [SqlManagementClient] reference to the SqlManagementClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Creates or updates a database data masking rule.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group that
31
+ # contains the resource. You can obtain this value from the Azure Resource
32
+ # Manager API or the portal.
33
+ # @param server_name [String] The name of the server.
34
+ # @param database_name [String] The name of the database.
35
+ # @param data_masking_rule_name [String] The name of the data masking rule.
36
+ # @param parameters [DataMaskingRule] The required parameters for creating or
37
+ # updating a data masking rule.
38
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
39
+ # will be added to the HTTP request.
40
+ #
41
+ # @return [DataMaskingRule] operation results.
42
+ #
43
+ def create_or_update(resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers = nil)
44
+ response = create_or_update_async(resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers).value!
45
+ response.body unless response.nil?
46
+ end
47
+
48
+ #
49
+ # Creates or updates a database data masking rule.
50
+ #
51
+ # @param resource_group_name [String] The name of the resource group that
52
+ # contains the resource. You can obtain this value from the Azure Resource
53
+ # Manager API or the portal.
54
+ # @param server_name [String] The name of the server.
55
+ # @param database_name [String] The name of the database.
56
+ # @param data_masking_rule_name [String] The name of the data masking rule.
57
+ # @param parameters [DataMaskingRule] The required parameters for creating or
58
+ # updating a data masking rule.
59
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
60
+ # will be added to the HTTP request.
61
+ #
62
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
63
+ #
64
+ def create_or_update_with_http_info(resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers = nil)
65
+ create_or_update_async(resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers).value!
66
+ end
67
+
68
+ #
69
+ # Creates or updates a database data masking rule.
70
+ #
71
+ # @param resource_group_name [String] The name of the resource group that
72
+ # contains the resource. You can obtain this value from the Azure Resource
73
+ # Manager API or the portal.
74
+ # @param server_name [String] The name of the server.
75
+ # @param database_name [String] The name of the database.
76
+ # @param data_masking_rule_name [String] The name of the data masking rule.
77
+ # @param parameters [DataMaskingRule] The required parameters for creating or
78
+ # updating a data masking rule.
79
+ # @param [Hash{String => String}] A hash of custom headers that will be added
80
+ # to the HTTP request.
81
+ #
82
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
83
+ #
84
+ def create_or_update_async(resource_group_name, server_name, database_name, data_masking_rule_name, parameters, custom_headers = nil)
85
+ api_version = '2014-04-01'
86
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
87
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
88
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
89
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
90
+ data_masking_policy_name = 'Default'
91
+ fail ArgumentError, 'data_masking_rule_name is nil' if data_masking_rule_name.nil?
92
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
93
+
94
+
95
+ request_headers = {}
96
+
97
+ # Set Headers
98
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
99
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
100
+
101
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
102
+
103
+ # Serialize Request
104
+ request_mapper = Azure::ARM::SQL::Models::DataMaskingRule.mapper()
105
+ request_content = @client.serialize(request_mapper, parameters)
106
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
107
+
108
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}'
109
+
110
+ request_url = @base_url || @client.base_url
111
+
112
+ options = {
113
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
114
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'dataMaskingPolicyName' => data_masking_policy_name,'dataMaskingRuleName' => data_masking_rule_name},
115
+ query_params: {'api-version' => api_version},
116
+ body: request_content,
117
+ headers: request_headers.merge(custom_headers || {}),
118
+ base_url: request_url
119
+ }
120
+ promise = @client.make_request_async(:put, path_template, options)
121
+
122
+ promise = promise.then do |result|
123
+ http_response = result.response
124
+ status_code = http_response.status
125
+ response_content = http_response.body
126
+ unless status_code == 200 || status_code == 201
127
+ error_model = JSON.load(response_content)
128
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
129
+ end
130
+
131
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
132
+ # Deserialize Response
133
+ if status_code == 200
134
+ begin
135
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
136
+ result_mapper = Azure::ARM::SQL::Models::DataMaskingRule.mapper()
137
+ result.body = @client.deserialize(result_mapper, parsed_response)
138
+ rescue Exception => e
139
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
140
+ end
141
+ end
142
+ # Deserialize Response
143
+ if status_code == 201
144
+ begin
145
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
146
+ result_mapper = Azure::ARM::SQL::Models::DataMaskingRule.mapper()
147
+ result.body = @client.deserialize(result_mapper, parsed_response)
148
+ rescue Exception => e
149
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
150
+ end
151
+ end
152
+
153
+ result
154
+ end
155
+
156
+ promise.execute
157
+ end
158
+
159
+ #
160
+ # Gets a list of database data masking rules.
161
+ #
162
+ # @param resource_group_name [String] The name of the resource group that
163
+ # contains the resource. You can obtain this value from the Azure Resource
164
+ # Manager API or the portal.
165
+ # @param server_name [String] The name of the server.
166
+ # @param database_name [String] The name of the database.
167
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
168
+ # will be added to the HTTP request.
169
+ #
170
+ # @return [DataMaskingRuleListResult] operation results.
171
+ #
172
+ def list_by_database(resource_group_name, server_name, database_name, custom_headers = nil)
173
+ response = list_by_database_async(resource_group_name, server_name, database_name, custom_headers).value!
174
+ response.body unless response.nil?
175
+ end
176
+
177
+ #
178
+ # Gets a list of database data masking rules.
179
+ #
180
+ # @param resource_group_name [String] The name of the resource group that
181
+ # contains the resource. You can obtain this value from the Azure Resource
182
+ # Manager API or the portal.
183
+ # @param server_name [String] The name of the server.
184
+ # @param database_name [String] The name of the database.
185
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
186
+ # will be added to the HTTP request.
187
+ #
188
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
189
+ #
190
+ def list_by_database_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
191
+ list_by_database_async(resource_group_name, server_name, database_name, custom_headers).value!
192
+ end
193
+
194
+ #
195
+ # Gets a list of database data masking rules.
196
+ #
197
+ # @param resource_group_name [String] The name of the resource group that
198
+ # contains the resource. You can obtain this value from the Azure Resource
199
+ # Manager API or the portal.
200
+ # @param server_name [String] The name of the server.
201
+ # @param database_name [String] The name of the database.
202
+ # @param [Hash{String => String}] A hash of custom headers that will be added
203
+ # to the HTTP request.
204
+ #
205
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
206
+ #
207
+ def list_by_database_async(resource_group_name, server_name, database_name, custom_headers = nil)
208
+ api_version = '2014-04-01'
209
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
210
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
211
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
212
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
213
+ data_masking_policy_name = 'Default'
214
+
215
+
216
+ request_headers = {}
217
+
218
+ # Set Headers
219
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
220
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
221
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules'
222
+
223
+ request_url = @base_url || @client.base_url
224
+
225
+ options = {
226
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
227
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'dataMaskingPolicyName' => data_masking_policy_name},
228
+ query_params: {'api-version' => api_version},
229
+ headers: request_headers.merge(custom_headers || {}),
230
+ base_url: request_url
231
+ }
232
+ promise = @client.make_request_async(:get, path_template, options)
233
+
234
+ promise = promise.then do |result|
235
+ http_response = result.response
236
+ status_code = http_response.status
237
+ response_content = http_response.body
238
+ unless status_code == 200
239
+ error_model = JSON.load(response_content)
240
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
241
+ end
242
+
243
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
244
+ # Deserialize Response
245
+ if status_code == 200
246
+ begin
247
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
248
+ result_mapper = Azure::ARM::SQL::Models::DataMaskingRuleListResult.mapper()
249
+ result.body = @client.deserialize(result_mapper, parsed_response)
250
+ rescue Exception => e
251
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
252
+ end
253
+ end
254
+
255
+ result
256
+ end
257
+
258
+ promise.execute
259
+ end
260
+
261
+ end
262
+ end
@@ -0,0 +1,264 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.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 you to create, retrieve, update, and delete
11
+ # databases.
12
+ #
13
+ class DatabaseBlobAuditingPolicies
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the DatabaseBlobAuditingPolicies class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [SqlManagementClient] reference to the SqlManagementClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Gets a database's blob auditing policy.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group that
31
+ # contains the resource. You can obtain this value from the Azure Resource
32
+ # Manager API or the portal.
33
+ # @param server_name [String] The name of the server.
34
+ # @param database_name [String] The name of the database for which the blob
35
+ # audit policy is defined.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [DatabaseBlobAuditingPolicy] operation results.
40
+ #
41
+ def get(resource_group_name, server_name, database_name, custom_headers = nil)
42
+ response = get_async(resource_group_name, server_name, database_name, custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # Gets a database's blob auditing policy.
48
+ #
49
+ # @param resource_group_name [String] The name of the resource group that
50
+ # contains the resource. You can obtain this value from the Azure Resource
51
+ # Manager API or the portal.
52
+ # @param server_name [String] The name of the server.
53
+ # @param database_name [String] The name of the database for which the blob
54
+ # audit policy is defined.
55
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
56
+ # will be added to the HTTP request.
57
+ #
58
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
59
+ #
60
+ def get_with_http_info(resource_group_name, server_name, database_name, custom_headers = nil)
61
+ get_async(resource_group_name, server_name, database_name, custom_headers).value!
62
+ end
63
+
64
+ #
65
+ # Gets a database's blob auditing policy.
66
+ #
67
+ # @param resource_group_name [String] The name of the resource group that
68
+ # contains the resource. You can obtain this value from the Azure Resource
69
+ # Manager API or the portal.
70
+ # @param server_name [String] The name of the server.
71
+ # @param database_name [String] The name of the database for which the blob
72
+ # audit policy is defined.
73
+ # @param [Hash{String => String}] A hash of custom headers that will be added
74
+ # to the HTTP request.
75
+ #
76
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
77
+ #
78
+ def get_async(resource_group_name, server_name, database_name, custom_headers = nil)
79
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
80
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
81
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
82
+ blob_auditing_policy_name = 'default'
83
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
84
+ api_version = '2015-05-01-preview'
85
+
86
+
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
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}'
93
+
94
+ request_url = @base_url || @client.base_url
95
+
96
+ options = {
97
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
98
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'blobAuditingPolicyName' => blob_auditing_policy_name,'subscriptionId' => @client.subscription_id},
99
+ query_params: {'api-version' => api_version},
100
+ headers: request_headers.merge(custom_headers || {}),
101
+ base_url: request_url
102
+ }
103
+ promise = @client.make_request_async(:get, path_template, options)
104
+
105
+ promise = promise.then do |result|
106
+ http_response = result.response
107
+ status_code = http_response.status
108
+ response_content = http_response.body
109
+ unless status_code == 200
110
+ error_model = JSON.load(response_content)
111
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
112
+ end
113
+
114
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
115
+ # Deserialize Response
116
+ if status_code == 200
117
+ begin
118
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
119
+ result_mapper = Azure::ARM::SQL::Models::DatabaseBlobAuditingPolicy.mapper()
120
+ result.body = @client.deserialize(result_mapper, parsed_response)
121
+ rescue Exception => e
122
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
123
+ end
124
+ end
125
+
126
+ result
127
+ end
128
+
129
+ promise.execute
130
+ end
131
+
132
+ #
133
+ # Creates or updates a database's blob auditing policy.
134
+ #
135
+ # @param resource_group_name [String] The name of the resource group that
136
+ # contains the resource. You can obtain this value from the Azure Resource
137
+ # Manager API or the portal.
138
+ # @param server_name [String] The name of the server.
139
+ # @param database_name [String] The name of the database for which the blob
140
+ # auditing policy will be defined.
141
+ # @param parameters [DatabaseBlobAuditingPolicy] The database blob auditing
142
+ # policy.
143
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
144
+ # will be added to the HTTP request.
145
+ #
146
+ # @return [DatabaseBlobAuditingPolicy] operation results.
147
+ #
148
+ def create_or_update(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
149
+ response = create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
150
+ response.body unless response.nil?
151
+ end
152
+
153
+ #
154
+ # Creates or updates a database's blob auditing policy.
155
+ #
156
+ # @param resource_group_name [String] The name of the resource group that
157
+ # contains the resource. You can obtain this value from the Azure Resource
158
+ # Manager API or the portal.
159
+ # @param server_name [String] The name of the server.
160
+ # @param database_name [String] The name of the database for which the blob
161
+ # auditing policy will be defined.
162
+ # @param parameters [DatabaseBlobAuditingPolicy] The database blob auditing
163
+ # policy.
164
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
165
+ # will be added to the HTTP request.
166
+ #
167
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
168
+ #
169
+ def create_or_update_with_http_info(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
170
+ create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers).value!
171
+ end
172
+
173
+ #
174
+ # Creates or updates a database's blob auditing policy.
175
+ #
176
+ # @param resource_group_name [String] The name of the resource group that
177
+ # contains the resource. You can obtain this value from the Azure Resource
178
+ # Manager API or the portal.
179
+ # @param server_name [String] The name of the server.
180
+ # @param database_name [String] The name of the database for which the blob
181
+ # auditing policy will be defined.
182
+ # @param parameters [DatabaseBlobAuditingPolicy] The database blob auditing
183
+ # policy.
184
+ # @param [Hash{String => String}] A hash of custom headers that will be added
185
+ # to the HTTP request.
186
+ #
187
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
188
+ #
189
+ def create_or_update_async(resource_group_name, server_name, database_name, parameters, custom_headers = nil)
190
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
191
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
192
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
193
+ blob_auditing_policy_name = 'default'
194
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
195
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
196
+ api_version = '2015-05-01-preview'
197
+
198
+
199
+ request_headers = {}
200
+
201
+ # Set Headers
202
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
203
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
204
+
205
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
206
+
207
+ # Serialize Request
208
+ request_mapper = Azure::ARM::SQL::Models::DatabaseBlobAuditingPolicy.mapper()
209
+ request_content = @client.serialize(request_mapper, parameters)
210
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
211
+
212
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}'
213
+
214
+ request_url = @base_url || @client.base_url
215
+
216
+ options = {
217
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
218
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'blobAuditingPolicyName' => blob_auditing_policy_name,'subscriptionId' => @client.subscription_id},
219
+ query_params: {'api-version' => api_version},
220
+ body: request_content,
221
+ headers: request_headers.merge(custom_headers || {}),
222
+ base_url: request_url
223
+ }
224
+ promise = @client.make_request_async(:put, path_template, options)
225
+
226
+ promise = promise.then do |result|
227
+ http_response = result.response
228
+ status_code = http_response.status
229
+ response_content = http_response.body
230
+ unless status_code == 200 || status_code == 201
231
+ error_model = JSON.load(response_content)
232
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
233
+ end
234
+
235
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
236
+ # Deserialize Response
237
+ if status_code == 200
238
+ begin
239
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
240
+ result_mapper = Azure::ARM::SQL::Models::DatabaseBlobAuditingPolicy.mapper()
241
+ result.body = @client.deserialize(result_mapper, parsed_response)
242
+ rescue Exception => e
243
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
244
+ end
245
+ end
246
+ # Deserialize Response
247
+ if status_code == 201
248
+ begin
249
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
250
+ result_mapper = Azure::ARM::SQL::Models::DatabaseBlobAuditingPolicy.mapper()
251
+ result.body = @client.deserialize(result_mapper, parsed_response)
252
+ rescue Exception => e
253
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
254
+ end
255
+ end
256
+
257
+ result
258
+ end
259
+
260
+ promise.execute
261
+ end
262
+
263
+ end
264
+ end