azure_mgmt_sql 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
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,443 @@
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 FirewallRules
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the FirewallRules 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 firewall 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 firewall_rule_name [String] The name of the firewall rule.
35
+ # @param parameters [FirewallRule] The required parameters for creating or
36
+ # updating a firewall rule.
37
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
38
+ # will be added to the HTTP request.
39
+ #
40
+ # @return [FirewallRule] operation results.
41
+ #
42
+ def create_or_update(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers = nil)
43
+ response = create_or_update_async(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers).value!
44
+ response.body unless response.nil?
45
+ end
46
+
47
+ #
48
+ # Creates or updates a firewall rule.
49
+ #
50
+ # @param resource_group_name [String] The name of the resource group that
51
+ # contains the resource. You can obtain this value from the Azure Resource
52
+ # Manager API or the portal.
53
+ # @param server_name [String] The name of the server.
54
+ # @param firewall_rule_name [String] The name of the firewall rule.
55
+ # @param parameters [FirewallRule] The required parameters for creating or
56
+ # updating a firewall rule.
57
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
58
+ # will be added to the HTTP request.
59
+ #
60
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
61
+ #
62
+ def create_or_update_with_http_info(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers = nil)
63
+ create_or_update_async(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers).value!
64
+ end
65
+
66
+ #
67
+ # Creates or updates a firewall rule.
68
+ #
69
+ # @param resource_group_name [String] The name of the resource group that
70
+ # contains the resource. You can obtain this value from the Azure Resource
71
+ # Manager API or the portal.
72
+ # @param server_name [String] The name of the server.
73
+ # @param firewall_rule_name [String] The name of the firewall rule.
74
+ # @param parameters [FirewallRule] The required parameters for creating or
75
+ # updating a firewall rule.
76
+ # @param [Hash{String => String}] A hash of custom headers that will be added
77
+ # to the HTTP request.
78
+ #
79
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
80
+ #
81
+ def create_or_update_async(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers = nil)
82
+ api_version = '2014-04-01'
83
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
84
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
85
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
86
+ fail ArgumentError, 'firewall_rule_name is nil' if firewall_rule_name.nil?
87
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
88
+
89
+
90
+ request_headers = {}
91
+
92
+ # Set Headers
93
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
94
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
95
+
96
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
97
+
98
+ # Serialize Request
99
+ request_mapper = Azure::ARM::SQL::Models::FirewallRule.mapper()
100
+ request_content = @client.serialize(request_mapper, parameters)
101
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
102
+
103
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}'
104
+
105
+ request_url = @base_url || @client.base_url
106
+
107
+ options = {
108
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
109
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'firewallRuleName' => firewall_rule_name},
110
+ query_params: {'api-version' => api_version},
111
+ body: request_content,
112
+ headers: request_headers.merge(custom_headers || {}),
113
+ base_url: request_url
114
+ }
115
+ promise = @client.make_request_async(:put, path_template, options)
116
+
117
+ promise = promise.then do |result|
118
+ http_response = result.response
119
+ status_code = http_response.status
120
+ response_content = http_response.body
121
+ unless status_code == 200 || status_code == 201
122
+ error_model = JSON.load(response_content)
123
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
124
+ end
125
+
126
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
127
+ # Deserialize Response
128
+ if status_code == 200
129
+ begin
130
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
131
+ result_mapper = Azure::ARM::SQL::Models::FirewallRule.mapper()
132
+ result.body = @client.deserialize(result_mapper, parsed_response)
133
+ rescue Exception => e
134
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
135
+ end
136
+ end
137
+ # Deserialize Response
138
+ if status_code == 201
139
+ begin
140
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
141
+ result_mapper = Azure::ARM::SQL::Models::FirewallRule.mapper()
142
+ result.body = @client.deserialize(result_mapper, 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
+ # Deletes a firewall rule.
156
+ #
157
+ # @param resource_group_name [String] The name of the resource group that
158
+ # contains the resource. You can obtain this value from the Azure Resource
159
+ # Manager API or the portal.
160
+ # @param server_name [String] The name of the server.
161
+ # @param firewall_rule_name [String] The name of the firewall rule.
162
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
163
+ # will be added to the HTTP request.
164
+ #
165
+ #
166
+ def delete(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
167
+ response = delete_async(resource_group_name, server_name, firewall_rule_name, custom_headers).value!
168
+ nil
169
+ end
170
+
171
+ #
172
+ # Deletes a firewall rule.
173
+ #
174
+ # @param resource_group_name [String] The name of the resource group that
175
+ # contains the resource. You can obtain this value from the Azure Resource
176
+ # Manager API or the portal.
177
+ # @param server_name [String] The name of the server.
178
+ # @param firewall_rule_name [String] The name of the firewall rule.
179
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
180
+ # will be added to the HTTP request.
181
+ #
182
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
183
+ #
184
+ def delete_with_http_info(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
185
+ delete_async(resource_group_name, server_name, firewall_rule_name, custom_headers).value!
186
+ end
187
+
188
+ #
189
+ # Deletes a firewall rule.
190
+ #
191
+ # @param resource_group_name [String] The name of the resource group that
192
+ # contains the resource. You can obtain this value from the Azure Resource
193
+ # Manager API or the portal.
194
+ # @param server_name [String] The name of the server.
195
+ # @param firewall_rule_name [String] The name of the firewall rule.
196
+ # @param [Hash{String => String}] A hash of custom headers that will be added
197
+ # to the HTTP request.
198
+ #
199
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
200
+ #
201
+ def delete_async(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
202
+ api_version = '2014-04-01'
203
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
204
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
205
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
206
+ fail ArgumentError, 'firewall_rule_name is nil' if firewall_rule_name.nil?
207
+
208
+
209
+ request_headers = {}
210
+
211
+ # Set Headers
212
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
213
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
214
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}'
215
+
216
+ request_url = @base_url || @client.base_url
217
+
218
+ options = {
219
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
220
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'firewallRuleName' => firewall_rule_name},
221
+ query_params: {'api-version' => api_version},
222
+ headers: request_headers.merge(custom_headers || {}),
223
+ base_url: request_url
224
+ }
225
+ promise = @client.make_request_async(:delete, path_template, options)
226
+
227
+ promise = promise.then do |result|
228
+ http_response = result.response
229
+ status_code = http_response.status
230
+ response_content = http_response.body
231
+ unless status_code == 200 || status_code == 204
232
+ error_model = JSON.load(response_content)
233
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
234
+ end
235
+
236
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
237
+
238
+ result
239
+ end
240
+
241
+ promise.execute
242
+ end
243
+
244
+ #
245
+ # Gets a firewall rule.
246
+ #
247
+ # @param resource_group_name [String] The name of the resource group that
248
+ # contains the resource. You can obtain this value from the Azure Resource
249
+ # Manager API or the portal.
250
+ # @param server_name [String] The name of the server.
251
+ # @param firewall_rule_name [String] The name of the firewall rule.
252
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
253
+ # will be added to the HTTP request.
254
+ #
255
+ # @return [FirewallRule] operation results.
256
+ #
257
+ def get(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
258
+ response = get_async(resource_group_name, server_name, firewall_rule_name, custom_headers).value!
259
+ response.body unless response.nil?
260
+ end
261
+
262
+ #
263
+ # Gets a firewall rule.
264
+ #
265
+ # @param resource_group_name [String] The name of the resource group that
266
+ # contains the resource. You can obtain this value from the Azure Resource
267
+ # Manager API or the portal.
268
+ # @param server_name [String] The name of the server.
269
+ # @param firewall_rule_name [String] The name of the firewall rule.
270
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
271
+ # will be added to the HTTP request.
272
+ #
273
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
274
+ #
275
+ def get_with_http_info(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
276
+ get_async(resource_group_name, server_name, firewall_rule_name, custom_headers).value!
277
+ end
278
+
279
+ #
280
+ # Gets a firewall rule.
281
+ #
282
+ # @param resource_group_name [String] The name of the resource group that
283
+ # contains the resource. You can obtain this value from the Azure Resource
284
+ # Manager API or the portal.
285
+ # @param server_name [String] The name of the server.
286
+ # @param firewall_rule_name [String] The name of the firewall rule.
287
+ # @param [Hash{String => String}] A hash of custom headers that will be added
288
+ # to the HTTP request.
289
+ #
290
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
291
+ #
292
+ def get_async(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
293
+ api_version = '2014-04-01'
294
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
295
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
296
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
297
+ fail ArgumentError, 'firewall_rule_name is nil' if firewall_rule_name.nil?
298
+
299
+
300
+ request_headers = {}
301
+
302
+ # Set Headers
303
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
304
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
305
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}'
306
+
307
+ request_url = @base_url || @client.base_url
308
+
309
+ options = {
310
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
311
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'firewallRuleName' => firewall_rule_name},
312
+ query_params: {'api-version' => api_version},
313
+ headers: request_headers.merge(custom_headers || {}),
314
+ base_url: request_url
315
+ }
316
+ promise = @client.make_request_async(:get, path_template, options)
317
+
318
+ promise = promise.then do |result|
319
+ http_response = result.response
320
+ status_code = http_response.status
321
+ response_content = http_response.body
322
+ unless status_code == 200
323
+ error_model = JSON.load(response_content)
324
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
325
+ end
326
+
327
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
328
+ # Deserialize Response
329
+ if status_code == 200
330
+ begin
331
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
332
+ result_mapper = Azure::ARM::SQL::Models::FirewallRule.mapper()
333
+ result.body = @client.deserialize(result_mapper, parsed_response)
334
+ rescue Exception => e
335
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
336
+ end
337
+ end
338
+
339
+ result
340
+ end
341
+
342
+ promise.execute
343
+ end
344
+
345
+ #
346
+ # Returns a list of firewall rules.
347
+ #
348
+ # @param resource_group_name [String] The name of the resource group that
349
+ # contains the resource. You can obtain this value from the Azure Resource
350
+ # Manager API or the portal.
351
+ # @param server_name [String] The name of the server.
352
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
353
+ # will be added to the HTTP request.
354
+ #
355
+ # @return [FirewallRuleListResult] operation results.
356
+ #
357
+ def list_by_server(resource_group_name, server_name, custom_headers = nil)
358
+ response = list_by_server_async(resource_group_name, server_name, custom_headers).value!
359
+ response.body unless response.nil?
360
+ end
361
+
362
+ #
363
+ # Returns a list of firewall rules.
364
+ #
365
+ # @param resource_group_name [String] The name of the resource group that
366
+ # contains the resource. You can obtain this value from the Azure Resource
367
+ # Manager API or the portal.
368
+ # @param server_name [String] The name of the server.
369
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
370
+ # will be added to the HTTP request.
371
+ #
372
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
373
+ #
374
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers = nil)
375
+ list_by_server_async(resource_group_name, server_name, custom_headers).value!
376
+ end
377
+
378
+ #
379
+ # Returns a list of firewall rules.
380
+ #
381
+ # @param resource_group_name [String] The name of the resource group that
382
+ # contains the resource. You can obtain this value from the Azure Resource
383
+ # Manager API or the portal.
384
+ # @param server_name [String] The name of the server.
385
+ # @param [Hash{String => String}] A hash of custom headers that will be added
386
+ # to the HTTP request.
387
+ #
388
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
389
+ #
390
+ def list_by_server_async(resource_group_name, server_name, custom_headers = nil)
391
+ api_version = '2014-04-01'
392
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
393
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
394
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
395
+
396
+
397
+ request_headers = {}
398
+
399
+ # Set Headers
400
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
401
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
402
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules'
403
+
404
+ request_url = @base_url || @client.base_url
405
+
406
+ options = {
407
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
408
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
409
+ query_params: {'api-version' => api_version},
410
+ headers: request_headers.merge(custom_headers || {}),
411
+ base_url: request_url
412
+ }
413
+ promise = @client.make_request_async(:get, path_template, options)
414
+
415
+ promise = promise.then do |result|
416
+ http_response = result.response
417
+ status_code = http_response.status
418
+ response_content = http_response.body
419
+ unless status_code == 200
420
+ error_model = JSON.load(response_content)
421
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
422
+ end
423
+
424
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
425
+ # Deserialize Response
426
+ if status_code == 200
427
+ begin
428
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
429
+ result_mapper = Azure::ARM::SQL::Models::FirewallRuleListResult.mapper()
430
+ result.body = @client.deserialize(result_mapper, parsed_response)
431
+ rescue Exception => e
432
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
433
+ end
434
+ end
435
+
436
+ result
437
+ end
438
+
439
+ promise.execute
440
+ end
441
+
442
+ end
443
+ end
@@ -0,0 +1,16 @@
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
+ module Models
8
+ #
9
+ # Defines values for AuthenticationType
10
+ #
11
+ module AuthenticationType
12
+ SQL = "SQL"
13
+ ADPassword = "ADPassword"
14
+ end
15
+ end
16
+ end