azure_mgmt_sql 0.10.0 → 0.11.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 (160) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_sql.rb +124 -41
  3. data/lib/generated/azure_mgmt_sql/capabilities.rb +115 -0
  4. data/lib/generated/azure_mgmt_sql/databases.rb +2877 -443
  5. data/lib/generated/azure_mgmt_sql/elastic_pools.rb +407 -30
  6. data/lib/generated/azure_mgmt_sql/failover_groups.rb +1143 -0
  7. data/lib/generated/azure_mgmt_sql/firewall_rules.rb +443 -0
  8. data/lib/generated/azure_mgmt_sql/models/authentication_type.rb +16 -0
  9. data/lib/generated/azure_mgmt_sql/models/backup_long_term_retention_policy.rb +94 -0
  10. data/lib/generated/azure_mgmt_sql/models/backup_long_term_retention_policy_state.rb +16 -0
  11. data/lib/generated/azure_mgmt_sql/models/backup_long_term_retention_vault.rb +80 -0
  12. data/lib/generated/azure_mgmt_sql/models/{transparent_data_encryption_states.rb → blob_auditing_policy_state.rb} +3 -3
  13. data/lib/generated/azure_mgmt_sql/models/capability_status.rb +18 -0
  14. data/lib/generated/azure_mgmt_sql/models/check_name_availability_reason.rb +16 -0
  15. data/lib/generated/azure_mgmt_sql/models/check_name_availability_request.rb +59 -0
  16. data/lib/generated/azure_mgmt_sql/models/check_name_availability_response.rb +84 -0
  17. data/lib/generated/azure_mgmt_sql/models/create_mode.rb +2 -1
  18. data/lib/generated/azure_mgmt_sql/models/data_masking_function.rb +20 -0
  19. data/lib/generated/azure_mgmt_sql/models/data_masking_policy.rb +131 -0
  20. data/lib/generated/azure_mgmt_sql/models/data_masking_rule.rb +226 -0
  21. data/lib/generated/azure_mgmt_sql/models/data_masking_rule_list_result.rb +54 -0
  22. data/lib/generated/azure_mgmt_sql/models/data_masking_rule_state.rb +16 -0
  23. data/lib/generated/azure_mgmt_sql/models/{server_state.rb → data_masking_state.rb} +4 -4
  24. data/lib/generated/azure_mgmt_sql/models/database.rb +115 -63
  25. data/lib/generated/azure_mgmt_sql/models/database_blob_auditing_policy.rb +156 -0
  26. data/lib/generated/azure_mgmt_sql/models/{database_editions.rb → database_edition.rb} +4 -3
  27. data/lib/generated/azure_mgmt_sql/models/database_list_result.rb +2 -1
  28. data/lib/generated/azure_mgmt_sql/models/database_security_alert_policy.rb +179 -0
  29. data/lib/generated/azure_mgmt_sql/models/database_update.rb +464 -0
  30. data/lib/generated/azure_mgmt_sql/models/{database_metric.rb → database_usage.rb} +13 -11
  31. data/lib/generated/azure_mgmt_sql/models/{database_metric_list_result.rb → database_usage_list_result.rb} +10 -9
  32. data/lib/generated/azure_mgmt_sql/models/edition_capability.rb +79 -0
  33. data/lib/generated/azure_mgmt_sql/models/elastic_pool.rb +15 -14
  34. data/lib/generated/azure_mgmt_sql/models/elastic_pool_activity.rb +12 -22
  35. data/lib/generated/azure_mgmt_sql/models/elastic_pool_activity_list_result.rb +2 -1
  36. data/lib/generated/azure_mgmt_sql/models/elastic_pool_database_activity.rb +12 -22
  37. data/lib/generated/azure_mgmt_sql/models/elastic_pool_database_activity_list_result.rb +2 -1
  38. data/lib/generated/azure_mgmt_sql/models/elastic_pool_dtu_capability.rb +143 -0
  39. data/lib/generated/azure_mgmt_sql/models/{elastic_pool_editions.rb → elastic_pool_edition.rb} +3 -3
  40. data/lib/generated/azure_mgmt_sql/models/elastic_pool_edition_capability.rb +79 -0
  41. data/lib/generated/azure_mgmt_sql/models/elastic_pool_list_result.rb +2 -1
  42. data/lib/generated/azure_mgmt_sql/models/elastic_pool_per_database_max_dtu_capability.rb +79 -0
  43. data/lib/generated/azure_mgmt_sql/models/elastic_pool_per_database_min_dtu_capability.rb +59 -0
  44. data/lib/generated/azure_mgmt_sql/models/elastic_pool_state.rb +1 -1
  45. data/lib/generated/azure_mgmt_sql/models/elastic_pool_update.rb +152 -0
  46. data/lib/generated/azure_mgmt_sql/models/encryption_protector.rb +137 -0
  47. data/lib/generated/azure_mgmt_sql/models/encryption_protector_list_result.rb +96 -0
  48. data/lib/generated/azure_mgmt_sql/models/export_request.rb +101 -0
  49. data/lib/generated/azure_mgmt_sql/models/failover_group.rb +171 -0
  50. data/lib/generated/azure_mgmt_sql/models/failover_group_list_result.rb +96 -0
  51. data/lib/generated/azure_mgmt_sql/models/failover_group_read_only_endpoint.rb +47 -0
  52. data/lib/generated/azure_mgmt_sql/models/failover_group_read_write_endpoint.rb +58 -0
  53. data/lib/generated/azure_mgmt_sql/models/failover_group_replication_role.rb +16 -0
  54. data/lib/generated/azure_mgmt_sql/models/{server_firewall_rule.rb → firewall_rule.rb} +6 -5
  55. data/lib/generated/azure_mgmt_sql/models/{server_firewall_rule_list_result.rb → firewall_rule_list_result.rb} +9 -8
  56. data/lib/generated/azure_mgmt_sql/models/geo_backup_policy.rb +105 -0
  57. data/lib/generated/azure_mgmt_sql/models/geo_backup_policy_list_result.rb +53 -0
  58. data/lib/generated/azure_mgmt_sql/models/geo_backup_policy_state.rb +16 -0
  59. data/lib/generated/azure_mgmt_sql/models/{table_type.rb → identity_type.rb} +4 -5
  60. data/lib/generated/azure_mgmt_sql/models/import_export_response.rb +158 -0
  61. data/lib/generated/azure_mgmt_sql/models/import_extension_request.rb +134 -0
  62. data/lib/generated/azure_mgmt_sql/models/import_request.rb +125 -0
  63. data/lib/generated/azure_mgmt_sql/models/location_capabilities.rb +80 -0
  64. data/lib/generated/azure_mgmt_sql/models/max_size_capability.rb +74 -0
  65. data/lib/generated/azure_mgmt_sql/models/max_size_units.rb +18 -0
  66. data/lib/generated/azure_mgmt_sql/models/metric.rb +114 -0
  67. data/lib/generated/azure_mgmt_sql/models/metric_availability.rb +57 -0
  68. data/lib/generated/azure_mgmt_sql/models/metric_definition.rb +104 -0
  69. data/lib/generated/azure_mgmt_sql/models/metric_definition_list_result.rb +54 -0
  70. data/lib/generated/azure_mgmt_sql/models/metric_list_result.rb +53 -0
  71. data/lib/generated/azure_mgmt_sql/models/metric_name.rb +57 -0
  72. data/lib/generated/azure_mgmt_sql/models/metric_value.rb +117 -0
  73. data/lib/generated/azure_mgmt_sql/models/operation.rb +2 -1
  74. data/lib/generated/azure_mgmt_sql/models/operation_display.rb +2 -1
  75. data/lib/generated/azure_mgmt_sql/models/operation_impact.rb +3 -2
  76. data/lib/generated/azure_mgmt_sql/models/operation_list_result.rb +2 -1
  77. data/lib/generated/azure_mgmt_sql/models/partner_info.rb +68 -0
  78. data/lib/generated/azure_mgmt_sql/models/performance_level_unit.rb +15 -0
  79. data/lib/generated/azure_mgmt_sql/models/primary_aggregation_type.rb +20 -0
  80. data/lib/generated/azure_mgmt_sql/models/proxy_resource.rb +59 -0
  81. data/lib/generated/azure_mgmt_sql/models/read_only_endpoint_failover_policy.rb +16 -0
  82. data/lib/generated/azure_mgmt_sql/models/read_scale.rb +1 -1
  83. data/lib/generated/azure_mgmt_sql/models/read_write_endpoint_failover_policy.rb +16 -0
  84. data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool.rb +9 -29
  85. data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_list_metrics_result.rb +2 -1
  86. data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_list_result.rb +2 -1
  87. data/lib/generated/azure_mgmt_sql/models/recommended_elastic_pool_metric.rb +2 -1
  88. data/lib/generated/azure_mgmt_sql/models/recommended_index.rb +13 -33
  89. data/lib/generated/azure_mgmt_sql/models/{recommended_index_actions.rb → recommended_index_action.rb} +3 -3
  90. data/lib/generated/azure_mgmt_sql/models/{recommended_index_states.rb → recommended_index_state.rb} +3 -3
  91. data/lib/generated/azure_mgmt_sql/models/{recommended_index_types.rb → recommended_index_type.rb} +3 -3
  92. data/lib/generated/azure_mgmt_sql/models/recoverable_database.rb +104 -0
  93. data/lib/generated/azure_mgmt_sql/models/recoverable_database_list_result.rb +53 -0
  94. data/lib/generated/azure_mgmt_sql/models/replication_link.rb +3 -2
  95. data/lib/generated/azure_mgmt_sql/models/replication_link_list_result.rb +2 -1
  96. data/lib/generated/azure_mgmt_sql/models/replication_role.rb +1 -1
  97. data/lib/generated/azure_mgmt_sql/models/replication_state.rb +1 -1
  98. data/lib/generated/azure_mgmt_sql/models/resource_identity.rb +69 -0
  99. data/lib/generated/azure_mgmt_sql/models/restorable_dropped_database.rb +159 -0
  100. data/lib/generated/azure_mgmt_sql/models/restorable_dropped_database_list_result.rb +54 -0
  101. data/lib/generated/azure_mgmt_sql/models/restore_point.rb +10 -30
  102. data/lib/generated/azure_mgmt_sql/models/restore_point_list_result.rb +4 -4
  103. data/lib/generated/azure_mgmt_sql/models/{restore_point_types.rb → restore_point_type.rb} +3 -3
  104. data/lib/generated/azure_mgmt_sql/models/sample_name.rb +1 -1
  105. data/lib/generated/azure_mgmt_sql/models/security_alert_policy_email_account_admins.rb +16 -0
  106. data/lib/generated/azure_mgmt_sql/models/security_alert_policy_state.rb +17 -0
  107. data/lib/generated/azure_mgmt_sql/models/security_alert_policy_use_server_default.rb +16 -0
  108. data/lib/generated/azure_mgmt_sql/models/server.rb +38 -56
  109. data/lib/generated/azure_mgmt_sql/models/server_administrator_list_result.rb +54 -0
  110. data/lib/generated/azure_mgmt_sql/models/server_azure_adadministrator.rb +94 -0
  111. data/lib/generated/azure_mgmt_sql/models/server_communication_link.rb +103 -0
  112. data/lib/generated/azure_mgmt_sql/models/server_communication_link_list_result.rb +54 -0
  113. data/lib/generated/azure_mgmt_sql/models/{schema.rb → server_connection_policy.rb} +33 -38
  114. data/lib/generated/azure_mgmt_sql/models/server_connection_type.rb +17 -0
  115. data/lib/generated/azure_mgmt_sql/models/server_key.rb +135 -0
  116. data/lib/generated/azure_mgmt_sql/models/server_key_list_result.rb +96 -0
  117. data/lib/generated/azure_mgmt_sql/models/server_key_type.rb +16 -0
  118. data/lib/generated/azure_mgmt_sql/models/server_list_result.rb +48 -4
  119. data/lib/generated/azure_mgmt_sql/models/server_update.rb +106 -0
  120. data/lib/generated/azure_mgmt_sql/models/{server_metric.rb → server_usage.rb} +6 -5
  121. data/lib/generated/azure_mgmt_sql/models/{server_metric_list_result.rb → server_usage_list_result.rb} +9 -9
  122. data/lib/generated/azure_mgmt_sql/models/server_version_capability.rb +99 -0
  123. data/lib/generated/azure_mgmt_sql/models/service_objective.rb +3 -2
  124. data/lib/generated/azure_mgmt_sql/models/service_objective_capability.rb +127 -0
  125. data/lib/generated/azure_mgmt_sql/models/service_objective_list_result.rb +2 -1
  126. data/lib/generated/azure_mgmt_sql/models/service_objective_name.rb +2 -1
  127. data/lib/generated/azure_mgmt_sql/models/service_tier_advisor.rb +3 -2
  128. data/lib/generated/azure_mgmt_sql/models/service_tier_advisor_list_result.rb +2 -1
  129. data/lib/generated/azure_mgmt_sql/models/slo_usage_metric.rb +8 -3
  130. data/lib/generated/azure_mgmt_sql/models/sql_sub_resource.rb +3 -2
  131. data/lib/generated/azure_mgmt_sql/models/storage_key_type.rb +16 -0
  132. data/lib/generated/azure_mgmt_sql/models/sub_resource.rb +54 -0
  133. data/lib/generated/azure_mgmt_sql/models/{column.rb → tracked_resource.rb} +19 -23
  134. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption.rb +6 -5
  135. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity.rb +4 -3
  136. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity_list_result.rb +2 -1
  137. data/lib/generated/azure_mgmt_sql/models/{transparent_data_encryption_activity_states.rb → transparent_data_encryption_activity_status.rb} +3 -3
  138. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_status.rb +16 -0
  139. data/lib/generated/azure_mgmt_sql/models/unit_definition_type.rb +20 -0
  140. data/lib/generated/azure_mgmt_sql/models/unit_type.rb +20 -0
  141. data/lib/generated/azure_mgmt_sql/models/virtual_network_rule.rb +69 -0
  142. data/lib/generated/azure_mgmt_sql/models/virtual_network_rule_list_result.rb +96 -0
  143. data/lib/generated/azure_mgmt_sql/module_definition.rb +1 -1
  144. data/lib/generated/azure_mgmt_sql/operations.rb +109 -0
  145. data/lib/generated/azure_mgmt_sql/recommended_elastic_pools.rb +21 -22
  146. data/lib/generated/azure_mgmt_sql/recoverable_databases.rb +229 -0
  147. data/lib/generated/azure_mgmt_sql/restorable_dropped_databases.rb +229 -0
  148. data/lib/generated/azure_mgmt_sql/server_azure_adadministrators.rb +575 -0
  149. data/lib/generated/azure_mgmt_sql/server_communication_links.rb +496 -0
  150. data/lib/generated/azure_mgmt_sql/server_keys.rb +670 -0
  151. data/lib/generated/azure_mgmt_sql/servers.rb +1366 -257
  152. data/lib/generated/azure_mgmt_sql/sql_management_client.rb +44 -85
  153. data/lib/generated/azure_mgmt_sql/version.rb +2 -2
  154. data/lib/generated/azure_mgmt_sql/virtual_network_rules.rb +663 -0
  155. metadata +110 -27
  156. data/lib/generated/azure_mgmt_sql/models/server_version.rb +0 -16
  157. data/lib/generated/azure_mgmt_sql/models/table.rb +0 -131
  158. data/lib/generated/azure_mgmt_sql/models/target_elastic_pool_editions.rb +0 -17
  159. data/lib/generated/azure_mgmt_sql/models/upgrade_hint.rb +0 -54
  160. data/lib/generated/azure_mgmt_sql/models/upgrade_recommended_elastic_pool_properties.rb +0 -131
@@ -0,0 +1,229 @@
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 RestorableDroppedDatabases
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the RestorableDroppedDatabases 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 deleted database that can be restored
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 restorable_droppeded_database_id [String] The id of the deleted
35
+ # database in the form of databaseName,deletionTimeInFileTimeFormat
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [RestorableDroppedDatabase] operation results.
40
+ #
41
+ def get(resource_group_name, server_name, restorable_droppeded_database_id, custom_headers = nil)
42
+ response = get_async(resource_group_name, server_name, restorable_droppeded_database_id, custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # Gets a deleted database that can be restored
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 restorable_droppeded_database_id [String] The id of the deleted
54
+ # database in the form of databaseName,deletionTimeInFileTimeFormat
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, restorable_droppeded_database_id, custom_headers = nil)
61
+ get_async(resource_group_name, server_name, restorable_droppeded_database_id, custom_headers).value!
62
+ end
63
+
64
+ #
65
+ # Gets a deleted database that can be restored
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 restorable_droppeded_database_id [String] The id of the deleted
72
+ # database in the form of databaseName,deletionTimeInFileTimeFormat
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, restorable_droppeded_database_id, custom_headers = nil)
79
+ api_version = '2014-04-01'
80
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
81
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
82
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
83
+ fail ArgumentError, 'restorable_droppeded_database_id is nil' if restorable_droppeded_database_id.nil?
84
+
85
+
86
+ request_headers = {}
87
+
88
+ # Set Headers
89
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
90
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
91
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases/{restorableDroppededDatabaseId}'
92
+
93
+ request_url = @base_url || @client.base_url
94
+
95
+ options = {
96
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
97
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'restorableDroppededDatabaseId' => restorable_droppeded_database_id},
98
+ query_params: {'api-version' => api_version},
99
+ headers: request_headers.merge(custom_headers || {}),
100
+ base_url: request_url
101
+ }
102
+ promise = @client.make_request_async(:get, path_template, options)
103
+
104
+ promise = promise.then do |result|
105
+ http_response = result.response
106
+ status_code = http_response.status
107
+ response_content = http_response.body
108
+ unless status_code == 200
109
+ error_model = JSON.load(response_content)
110
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
111
+ end
112
+
113
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
114
+ # Deserialize Response
115
+ if status_code == 200
116
+ begin
117
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
118
+ result_mapper = Azure::ARM::SQL::Models::RestorableDroppedDatabase.mapper()
119
+ result.body = @client.deserialize(result_mapper, parsed_response)
120
+ rescue Exception => e
121
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
122
+ end
123
+ end
124
+
125
+ result
126
+ end
127
+
128
+ promise.execute
129
+ end
130
+
131
+ #
132
+ # Gets a list of deleted databases that can be restored
133
+ #
134
+ # @param resource_group_name [String] The name of the resource group that
135
+ # contains the resource. You can obtain this value from the Azure Resource
136
+ # Manager API or the portal.
137
+ # @param server_name [String] The name of the server.
138
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
139
+ # will be added to the HTTP request.
140
+ #
141
+ # @return [RestorableDroppedDatabaseListResult] operation results.
142
+ #
143
+ def list_by_server(resource_group_name, server_name, custom_headers = nil)
144
+ response = list_by_server_async(resource_group_name, server_name, custom_headers).value!
145
+ response.body unless response.nil?
146
+ end
147
+
148
+ #
149
+ # Gets a list of deleted databases that can be restored
150
+ #
151
+ # @param resource_group_name [String] The name of the resource group that
152
+ # contains the resource. You can obtain this value from the Azure Resource
153
+ # Manager API or the portal.
154
+ # @param server_name [String] The name of the server.
155
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
156
+ # will be added to the HTTP request.
157
+ #
158
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
159
+ #
160
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers = nil)
161
+ list_by_server_async(resource_group_name, server_name, custom_headers).value!
162
+ end
163
+
164
+ #
165
+ # Gets a list of deleted databases that can be restored
166
+ #
167
+ # @param resource_group_name [String] The name of the resource group that
168
+ # contains the resource. You can obtain this value from the Azure Resource
169
+ # Manager API or the portal.
170
+ # @param server_name [String] The name of the server.
171
+ # @param [Hash{String => String}] A hash of custom headers that will be added
172
+ # to the HTTP request.
173
+ #
174
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
175
+ #
176
+ def list_by_server_async(resource_group_name, server_name, custom_headers = nil)
177
+ api_version = '2014-04-01'
178
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
179
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
180
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
181
+
182
+
183
+ request_headers = {}
184
+
185
+ # Set Headers
186
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
187
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
188
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/restorableDroppedDatabases'
189
+
190
+ request_url = @base_url || @client.base_url
191
+
192
+ options = {
193
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
194
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
195
+ query_params: {'api-version' => api_version},
196
+ headers: request_headers.merge(custom_headers || {}),
197
+ base_url: request_url
198
+ }
199
+ promise = @client.make_request_async(:get, path_template, options)
200
+
201
+ promise = promise.then do |result|
202
+ http_response = result.response
203
+ status_code = http_response.status
204
+ response_content = http_response.body
205
+ unless status_code == 200
206
+ error_model = JSON.load(response_content)
207
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
208
+ end
209
+
210
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
211
+ # Deserialize Response
212
+ if status_code == 200
213
+ begin
214
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
215
+ result_mapper = Azure::ARM::SQL::Models::RestorableDroppedDatabaseListResult.mapper()
216
+ result.body = @client.deserialize(result_mapper, parsed_response)
217
+ rescue Exception => e
218
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
219
+ end
220
+ end
221
+
222
+ result
223
+ end
224
+
225
+ promise.execute
226
+ end
227
+
228
+ end
229
+ end
@@ -0,0 +1,575 @@
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 ServerAzureADAdministrators
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the ServerAzureADAdministrators 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 a new Server Active Directory Administrator or updates an existing
29
+ # server Active Directory Administrator.
30
+ #
31
+ # @param resource_group_name [String] The name of the resource group that
32
+ # contains the resource. You can obtain this value from the Azure Resource
33
+ # Manager API or the portal.
34
+ # @param server_name [String] The name of the server.
35
+ # @param properties [ServerAzureADAdministrator] The required parameters for
36
+ # creating or updating an Active Directory Administrator.
37
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
38
+ # will be added to the HTTP request.
39
+ #
40
+ # @return [ServerAzureADAdministrator] operation results.
41
+ #
42
+ def create_or_update(resource_group_name, server_name, properties, custom_headers = nil)
43
+ response = create_or_update_async(resource_group_name, server_name, properties, custom_headers).value!
44
+ response.body unless response.nil?
45
+ end
46
+
47
+ #
48
+ # @param resource_group_name [String] The name of the resource group that
49
+ # contains the resource. You can obtain this value from the Azure Resource
50
+ # Manager API or the portal.
51
+ # @param server_name [String] The name of the server.
52
+ # @param properties [ServerAzureADAdministrator] The required parameters for
53
+ # creating or updating an Active Directory Administrator.
54
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
55
+ # will be added to the HTTP request.
56
+ #
57
+ # @return [Concurrent::Promise] promise which provides async access to http
58
+ # response.
59
+ #
60
+ def create_or_update_async(resource_group_name, server_name, properties, custom_headers = nil)
61
+ # Send request
62
+ promise = begin_create_or_update_async(resource_group_name, server_name, properties, custom_headers)
63
+
64
+ promise = promise.then do |response|
65
+ # Defining deserialization method.
66
+ deserialize_method = lambda do |parsed_response|
67
+ result_mapper = Azure::ARM::SQL::Models::ServerAzureADAdministrator.mapper()
68
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
69
+ end
70
+
71
+ # Waiting for response.
72
+ @client.get_long_running_operation_result(response, deserialize_method)
73
+ end
74
+
75
+ promise
76
+ end
77
+
78
+ #
79
+ # Deletes an existing server Active Directory Administrator.
80
+ #
81
+ # @param resource_group_name [String] The name of the resource group that
82
+ # contains the resource. You can obtain this value from the Azure Resource
83
+ # Manager API or the portal.
84
+ # @param server_name [String] The name of the server.
85
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
86
+ # will be added to the HTTP request.
87
+ #
88
+ # @return [ServerAzureADAdministrator] operation results.
89
+ #
90
+ def delete(resource_group_name, server_name, custom_headers = nil)
91
+ response = delete_async(resource_group_name, server_name, custom_headers).value!
92
+ response.body unless response.nil?
93
+ end
94
+
95
+ #
96
+ # @param resource_group_name [String] The name of the resource group that
97
+ # contains the resource. You can obtain this value from the Azure Resource
98
+ # Manager API or the portal.
99
+ # @param server_name [String] The name of the server.
100
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
101
+ # will be added to the HTTP request.
102
+ #
103
+ # @return [Concurrent::Promise] promise which provides async access to http
104
+ # response.
105
+ #
106
+ def delete_async(resource_group_name, server_name, custom_headers = nil)
107
+ # Send request
108
+ promise = begin_delete_async(resource_group_name, server_name, custom_headers)
109
+
110
+ promise = promise.then do |response|
111
+ # Defining deserialization method.
112
+ deserialize_method = lambda do |parsed_response|
113
+ result_mapper = Azure::ARM::SQL::Models::ServerAzureADAdministrator.mapper()
114
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
115
+ end
116
+
117
+ # Waiting for response.
118
+ @client.get_long_running_operation_result(response, deserialize_method)
119
+ end
120
+
121
+ promise
122
+ end
123
+
124
+ #
125
+ # Returns an server Administrator.
126
+ #
127
+ # @param resource_group_name [String] The name of the resource group that
128
+ # contains the resource. You can obtain this value from the Azure Resource
129
+ # Manager API or the portal.
130
+ # @param server_name [String] The name of the server.
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ # @return [ServerAzureADAdministrator] operation results.
135
+ #
136
+ def get(resource_group_name, server_name, custom_headers = nil)
137
+ response = get_async(resource_group_name, server_name, custom_headers).value!
138
+ response.body unless response.nil?
139
+ end
140
+
141
+ #
142
+ # Returns an server Administrator.
143
+ #
144
+ # @param resource_group_name [String] The name of the resource group that
145
+ # contains the resource. You can obtain this value from the Azure Resource
146
+ # Manager API or the portal.
147
+ # @param server_name [String] The name of the server.
148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
149
+ # will be added to the HTTP request.
150
+ #
151
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
152
+ #
153
+ def get_with_http_info(resource_group_name, server_name, custom_headers = nil)
154
+ get_async(resource_group_name, server_name, custom_headers).value!
155
+ end
156
+
157
+ #
158
+ # Returns an server Administrator.
159
+ #
160
+ # @param resource_group_name [String] The name of the resource group that
161
+ # contains the resource. You can obtain this value from the Azure Resource
162
+ # Manager API or the portal.
163
+ # @param server_name [String] The name of the server.
164
+ # @param [Hash{String => String}] A hash of custom headers that will be added
165
+ # to the HTTP request.
166
+ #
167
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
168
+ #
169
+ def get_async(resource_group_name, server_name, custom_headers = nil)
170
+ api_version = '2014-04-01'
171
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
172
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
173
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
174
+ administrator_name = 'activeDirectory'
175
+
176
+
177
+ request_headers = {}
178
+
179
+ # Set Headers
180
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
181
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
182
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}'
183
+
184
+ request_url = @base_url || @client.base_url
185
+
186
+ options = {
187
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
188
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'administratorName' => administrator_name},
189
+ query_params: {'api-version' => api_version},
190
+ headers: request_headers.merge(custom_headers || {}),
191
+ base_url: request_url
192
+ }
193
+ promise = @client.make_request_async(:get, path_template, options)
194
+
195
+ promise = promise.then do |result|
196
+ http_response = result.response
197
+ status_code = http_response.status
198
+ response_content = http_response.body
199
+ unless status_code == 200
200
+ error_model = JSON.load(response_content)
201
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
202
+ end
203
+
204
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
205
+ # Deserialize Response
206
+ if status_code == 200
207
+ begin
208
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
209
+ result_mapper = Azure::ARM::SQL::Models::ServerAzureADAdministrator.mapper()
210
+ result.body = @client.deserialize(result_mapper, parsed_response)
211
+ rescue Exception => e
212
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
213
+ end
214
+ end
215
+
216
+ result
217
+ end
218
+
219
+ promise.execute
220
+ end
221
+
222
+ #
223
+ # Returns a list of server Administrators.
224
+ #
225
+ # @param resource_group_name [String] The name of the resource group that
226
+ # contains the resource. You can obtain this value from the Azure Resource
227
+ # Manager API or the portal.
228
+ # @param server_name [String] The name of the server.
229
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
230
+ # will be added to the HTTP request.
231
+ #
232
+ # @return [ServerAdministratorListResult] operation results.
233
+ #
234
+ def list(resource_group_name, server_name, custom_headers = nil)
235
+ response = list_async(resource_group_name, server_name, custom_headers).value!
236
+ response.body unless response.nil?
237
+ end
238
+
239
+ #
240
+ # Returns a list of server Administrators.
241
+ #
242
+ # @param resource_group_name [String] The name of the resource group that
243
+ # contains the resource. You can obtain this value from the Azure Resource
244
+ # Manager API or the portal.
245
+ # @param server_name [String] The name of the server.
246
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
247
+ # will be added to the HTTP request.
248
+ #
249
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
250
+ #
251
+ def list_with_http_info(resource_group_name, server_name, custom_headers = nil)
252
+ list_async(resource_group_name, server_name, custom_headers).value!
253
+ end
254
+
255
+ #
256
+ # Returns a list of server Administrators.
257
+ #
258
+ # @param resource_group_name [String] The name of the resource group that
259
+ # contains the resource. You can obtain this value from the Azure Resource
260
+ # Manager API or the portal.
261
+ # @param server_name [String] The name of the server.
262
+ # @param [Hash{String => String}] A hash of custom headers that will be added
263
+ # to the HTTP request.
264
+ #
265
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
266
+ #
267
+ def list_async(resource_group_name, server_name, custom_headers = nil)
268
+ api_version = '2014-04-01'
269
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
270
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
271
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
272
+
273
+
274
+ request_headers = {}
275
+
276
+ # Set Headers
277
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
278
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
279
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators'
280
+
281
+ request_url = @base_url || @client.base_url
282
+
283
+ options = {
284
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
285
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
286
+ query_params: {'api-version' => api_version},
287
+ headers: request_headers.merge(custom_headers || {}),
288
+ base_url: request_url
289
+ }
290
+ promise = @client.make_request_async(:get, path_template, options)
291
+
292
+ promise = promise.then do |result|
293
+ http_response = result.response
294
+ status_code = http_response.status
295
+ response_content = http_response.body
296
+ unless status_code == 200
297
+ error_model = JSON.load(response_content)
298
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
299
+ end
300
+
301
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
302
+ # Deserialize Response
303
+ if status_code == 200
304
+ begin
305
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
306
+ result_mapper = Azure::ARM::SQL::Models::ServerAdministratorListResult.mapper()
307
+ result.body = @client.deserialize(result_mapper, parsed_response)
308
+ rescue Exception => e
309
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
310
+ end
311
+ end
312
+
313
+ result
314
+ end
315
+
316
+ promise.execute
317
+ end
318
+
319
+ #
320
+ # Creates a new Server Active Directory Administrator or updates an existing
321
+ # server Active Directory Administrator.
322
+ #
323
+ # @param resource_group_name [String] The name of the resource group that
324
+ # contains the resource. You can obtain this value from the Azure Resource
325
+ # Manager API or the portal.
326
+ # @param server_name [String] The name of the server.
327
+ # @param properties [ServerAzureADAdministrator] The required parameters for
328
+ # creating or updating an Active Directory Administrator.
329
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
330
+ # will be added to the HTTP request.
331
+ #
332
+ # @return [ServerAzureADAdministrator] operation results.
333
+ #
334
+ def begin_create_or_update(resource_group_name, server_name, properties, custom_headers = nil)
335
+ response = begin_create_or_update_async(resource_group_name, server_name, properties, custom_headers).value!
336
+ response.body unless response.nil?
337
+ end
338
+
339
+ #
340
+ # Creates a new Server Active Directory Administrator or updates an existing
341
+ # server Active Directory Administrator.
342
+ #
343
+ # @param resource_group_name [String] The name of the resource group that
344
+ # contains the resource. You can obtain this value from the Azure Resource
345
+ # Manager API or the portal.
346
+ # @param server_name [String] The name of the server.
347
+ # @param properties [ServerAzureADAdministrator] The required parameters for
348
+ # creating or updating an Active Directory Administrator.
349
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
350
+ # will be added to the HTTP request.
351
+ #
352
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
353
+ #
354
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, properties, custom_headers = nil)
355
+ begin_create_or_update_async(resource_group_name, server_name, properties, custom_headers).value!
356
+ end
357
+
358
+ #
359
+ # Creates a new Server Active Directory Administrator or updates an existing
360
+ # server Active Directory Administrator.
361
+ #
362
+ # @param resource_group_name [String] The name of the resource group that
363
+ # contains the resource. You can obtain this value from the Azure Resource
364
+ # Manager API or the portal.
365
+ # @param server_name [String] The name of the server.
366
+ # @param properties [ServerAzureADAdministrator] The required parameters for
367
+ # creating or updating an Active Directory Administrator.
368
+ # @param [Hash{String => String}] A hash of custom headers that will be added
369
+ # to the HTTP request.
370
+ #
371
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
372
+ #
373
+ def begin_create_or_update_async(resource_group_name, server_name, properties, custom_headers = nil)
374
+ api_version = '2014-04-01'
375
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
376
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
377
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
378
+ administrator_name = 'activeDirectory'
379
+ fail ArgumentError, 'properties is nil' if properties.nil?
380
+
381
+
382
+ request_headers = {}
383
+
384
+ # Set Headers
385
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
386
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
387
+
388
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
389
+
390
+ # Serialize Request
391
+ request_mapper = Azure::ARM::SQL::Models::ServerAzureADAdministrator.mapper()
392
+ request_content = @client.serialize(request_mapper, properties)
393
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
394
+
395
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}'
396
+
397
+ request_url = @base_url || @client.base_url
398
+
399
+ options = {
400
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
401
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'administratorName' => administrator_name},
402
+ query_params: {'api-version' => api_version},
403
+ body: request_content,
404
+ headers: request_headers.merge(custom_headers || {}),
405
+ base_url: request_url
406
+ }
407
+ promise = @client.make_request_async(:put, path_template, options)
408
+
409
+ promise = promise.then do |result|
410
+ http_response = result.response
411
+ status_code = http_response.status
412
+ response_content = http_response.body
413
+ unless status_code == 200 || status_code == 201 || status_code == 202
414
+ error_model = JSON.load(response_content)
415
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
416
+ end
417
+
418
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
419
+ # Deserialize Response
420
+ if status_code == 200
421
+ begin
422
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
423
+ result_mapper = Azure::ARM::SQL::Models::ServerAzureADAdministrator.mapper()
424
+ result.body = @client.deserialize(result_mapper, parsed_response)
425
+ rescue Exception => e
426
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
427
+ end
428
+ end
429
+ # Deserialize Response
430
+ if status_code == 201
431
+ begin
432
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
433
+ result_mapper = Azure::ARM::SQL::Models::ServerAzureADAdministrator.mapper()
434
+ result.body = @client.deserialize(result_mapper, parsed_response)
435
+ rescue Exception => e
436
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
437
+ end
438
+ end
439
+ # Deserialize Response
440
+ if status_code == 202
441
+ begin
442
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
443
+ result_mapper = Azure::ARM::SQL::Models::ServerAzureADAdministrator.mapper()
444
+ result.body = @client.deserialize(result_mapper, parsed_response)
445
+ rescue Exception => e
446
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
447
+ end
448
+ end
449
+
450
+ result
451
+ end
452
+
453
+ promise.execute
454
+ end
455
+
456
+ #
457
+ # Deletes an existing server Active Directory Administrator.
458
+ #
459
+ # @param resource_group_name [String] The name of the resource group that
460
+ # contains the resource. You can obtain this value from the Azure Resource
461
+ # Manager API or the portal.
462
+ # @param server_name [String] The name of the server.
463
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
464
+ # will be added to the HTTP request.
465
+ #
466
+ # @return [ServerAzureADAdministrator] operation results.
467
+ #
468
+ def begin_delete(resource_group_name, server_name, custom_headers = nil)
469
+ response = begin_delete_async(resource_group_name, server_name, custom_headers).value!
470
+ response.body unless response.nil?
471
+ end
472
+
473
+ #
474
+ # Deletes an existing server Active Directory Administrator.
475
+ #
476
+ # @param resource_group_name [String] The name of the resource group that
477
+ # contains the resource. You can obtain this value from the Azure Resource
478
+ # Manager API or the portal.
479
+ # @param server_name [String] The name of the server.
480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
481
+ # will be added to the HTTP request.
482
+ #
483
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
484
+ #
485
+ def begin_delete_with_http_info(resource_group_name, server_name, custom_headers = nil)
486
+ begin_delete_async(resource_group_name, server_name, custom_headers).value!
487
+ end
488
+
489
+ #
490
+ # Deletes an existing server Active Directory Administrator.
491
+ #
492
+ # @param resource_group_name [String] The name of the resource group that
493
+ # contains the resource. You can obtain this value from the Azure Resource
494
+ # Manager API or the portal.
495
+ # @param server_name [String] The name of the server.
496
+ # @param [Hash{String => String}] A hash of custom headers that will be added
497
+ # to the HTTP request.
498
+ #
499
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
500
+ #
501
+ def begin_delete_async(resource_group_name, server_name, custom_headers = nil)
502
+ api_version = '2014-04-01'
503
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
504
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
505
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
506
+ administrator_name = 'activeDirectory'
507
+
508
+
509
+ request_headers = {}
510
+
511
+ # Set Headers
512
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
513
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
514
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/{administratorName}'
515
+
516
+ request_url = @base_url || @client.base_url
517
+
518
+ options = {
519
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
520
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'administratorName' => administrator_name},
521
+ query_params: {'api-version' => api_version},
522
+ headers: request_headers.merge(custom_headers || {}),
523
+ base_url: request_url
524
+ }
525
+ promise = @client.make_request_async(:delete, path_template, options)
526
+
527
+ promise = promise.then do |result|
528
+ http_response = result.response
529
+ status_code = http_response.status
530
+ response_content = http_response.body
531
+ unless status_code == 202 || status_code == 204 || status_code == 200
532
+ error_model = JSON.load(response_content)
533
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
534
+ end
535
+
536
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
537
+ # Deserialize Response
538
+ if status_code == 202
539
+ begin
540
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
541
+ result_mapper = Azure::ARM::SQL::Models::ServerAzureADAdministrator.mapper()
542
+ result.body = @client.deserialize(result_mapper, parsed_response)
543
+ rescue Exception => e
544
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
545
+ end
546
+ end
547
+ # Deserialize Response
548
+ if status_code == 204
549
+ begin
550
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
551
+ result_mapper = Azure::ARM::SQL::Models::ServerAzureADAdministrator.mapper()
552
+ result.body = @client.deserialize(result_mapper, parsed_response)
553
+ rescue Exception => e
554
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
555
+ end
556
+ end
557
+ # Deserialize Response
558
+ if status_code == 200
559
+ begin
560
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
561
+ result_mapper = Azure::ARM::SQL::Models::ServerAzureADAdministrator.mapper()
562
+ result.body = @client.deserialize(result_mapper, parsed_response)
563
+ rescue Exception => e
564
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
565
+ end
566
+ end
567
+
568
+ result
569
+ end
570
+
571
+ promise.execute
572
+ end
573
+
574
+ end
575
+ end