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,670 @@
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 ServerKeys
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the ServerKeys 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
+ # Returns a list of server keys.
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 custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [Array<ServerKey>] operation results.
38
+ #
39
+ def list_by_server(resource_group_name, server_name, custom_headers = nil)
40
+ first_page = list_by_server_as_lazy(resource_group_name, server_name, custom_headers)
41
+ first_page.get_all_items
42
+ end
43
+
44
+ #
45
+ # Returns a list of server keys.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group that
48
+ # contains the resource. You can obtain this value from the Azure Resource
49
+ # Manager API or the portal.
50
+ # @param server_name [String] The name of the server.
51
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
52
+ # will be added to the HTTP request.
53
+ #
54
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
55
+ #
56
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers = nil)
57
+ list_by_server_async(resource_group_name, server_name, custom_headers).value!
58
+ end
59
+
60
+ #
61
+ # Returns a list of server keys.
62
+ #
63
+ # @param resource_group_name [String] The name of the resource group that
64
+ # contains the resource. You can obtain this value from the Azure Resource
65
+ # Manager API or the portal.
66
+ # @param server_name [String] The name of the server.
67
+ # @param [Hash{String => String}] A hash of custom headers that will be added
68
+ # to the HTTP request.
69
+ #
70
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
71
+ #
72
+ def list_by_server_async(resource_group_name, server_name, custom_headers = nil)
73
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
74
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
75
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
76
+ api_version = '2015-05-01-preview'
77
+
78
+
79
+ request_headers = {}
80
+
81
+ # Set Headers
82
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
83
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
84
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys'
85
+
86
+ request_url = @base_url || @client.base_url
87
+
88
+ options = {
89
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
90
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
91
+ query_params: {'api-version' => api_version},
92
+ headers: request_headers.merge(custom_headers || {}),
93
+ base_url: request_url
94
+ }
95
+ promise = @client.make_request_async(:get, path_template, options)
96
+
97
+ promise = promise.then do |result|
98
+ http_response = result.response
99
+ status_code = http_response.status
100
+ response_content = http_response.body
101
+ unless status_code == 200
102
+ error_model = JSON.load(response_content)
103
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
104
+ end
105
+
106
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
107
+ # Deserialize Response
108
+ if status_code == 200
109
+ begin
110
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
111
+ result_mapper = Azure::ARM::SQL::Models::ServerKeyListResult.mapper()
112
+ result.body = @client.deserialize(result_mapper, parsed_response)
113
+ rescue Exception => e
114
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
115
+ end
116
+ end
117
+
118
+ result
119
+ end
120
+
121
+ promise.execute
122
+ end
123
+
124
+ #
125
+ # Returns a server key.
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 key_name [String] The name of the server key to be retrieved.
132
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
133
+ # will be added to the HTTP request.
134
+ #
135
+ # @return [ServerKey] operation results.
136
+ #
137
+ def get(resource_group_name, server_name, key_name, custom_headers = nil)
138
+ response = get_async(resource_group_name, server_name, key_name, custom_headers).value!
139
+ response.body unless response.nil?
140
+ end
141
+
142
+ #
143
+ # Returns a server key.
144
+ #
145
+ # @param resource_group_name [String] The name of the resource group that
146
+ # contains the resource. You can obtain this value from the Azure Resource
147
+ # Manager API or the portal.
148
+ # @param server_name [String] The name of the server.
149
+ # @param key_name [String] The name of the server key to be retrieved.
150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
151
+ # will be added to the HTTP request.
152
+ #
153
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
154
+ #
155
+ def get_with_http_info(resource_group_name, server_name, key_name, custom_headers = nil)
156
+ get_async(resource_group_name, server_name, key_name, custom_headers).value!
157
+ end
158
+
159
+ #
160
+ # Returns a server key.
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 key_name [String] The name of the server key to be retrieved.
167
+ # @param [Hash{String => String}] A hash of custom headers that will be added
168
+ # to the HTTP request.
169
+ #
170
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
171
+ #
172
+ def get_async(resource_group_name, server_name, key_name, custom_headers = nil)
173
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
174
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
175
+ fail ArgumentError, 'key_name is nil' if key_name.nil?
176
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
177
+ api_version = '2015-05-01-preview'
178
+
179
+
180
+ request_headers = {}
181
+
182
+ # Set Headers
183
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
184
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
185
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}'
186
+
187
+ request_url = @base_url || @client.base_url
188
+
189
+ options = {
190
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
191
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'keyName' => key_name,'subscriptionId' => @client.subscription_id},
192
+ query_params: {'api-version' => api_version},
193
+ headers: request_headers.merge(custom_headers || {}),
194
+ base_url: request_url
195
+ }
196
+ promise = @client.make_request_async(:get, path_template, options)
197
+
198
+ promise = promise.then do |result|
199
+ http_response = result.response
200
+ status_code = http_response.status
201
+ response_content = http_response.body
202
+ unless status_code == 200
203
+ error_model = JSON.load(response_content)
204
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
205
+ end
206
+
207
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
208
+ # Deserialize Response
209
+ if status_code == 200
210
+ begin
211
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
212
+ result_mapper = Azure::ARM::SQL::Models::ServerKey.mapper()
213
+ result.body = @client.deserialize(result_mapper, parsed_response)
214
+ rescue Exception => e
215
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
216
+ end
217
+ end
218
+
219
+ result
220
+ end
221
+
222
+ promise.execute
223
+ end
224
+
225
+ #
226
+ # Creates or updates a server key.
227
+ #
228
+ # @param resource_group_name [String] The name of the resource group that
229
+ # contains the resource. You can obtain this value from the Azure Resource
230
+ # Manager API or the portal.
231
+ # @param server_name [String] The name of the server.
232
+ # @param key_name [String] The name of the server key to be operated on
233
+ # (updated or created). The key name is required to be in the format of
234
+ # 'vault_key_version'. For example, if the keyId is
235
+ # https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901,
236
+ # then the server key name should be formatted as:
237
+ # YourVaultName_YourKeyName_01234567890123456789012345678901
238
+ # @param parameters [ServerKey] The requested server key resource state.
239
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
240
+ # will be added to the HTTP request.
241
+ #
242
+ # @return [ServerKey] operation results.
243
+ #
244
+ def create_or_update(resource_group_name, server_name, key_name, parameters, custom_headers = nil)
245
+ response = create_or_update_async(resource_group_name, server_name, key_name, parameters, custom_headers).value!
246
+ response.body unless response.nil?
247
+ end
248
+
249
+ #
250
+ # @param resource_group_name [String] The name of the resource group that
251
+ # contains the resource. You can obtain this value from the Azure Resource
252
+ # Manager API or the portal.
253
+ # @param server_name [String] The name of the server.
254
+ # @param key_name [String] The name of the server key to be operated on
255
+ # (updated or created). The key name is required to be in the format of
256
+ # 'vault_key_version'. For example, if the keyId is
257
+ # https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901,
258
+ # then the server key name should be formatted as:
259
+ # YourVaultName_YourKeyName_01234567890123456789012345678901
260
+ # @param parameters [ServerKey] The requested server key resource state.
261
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
262
+ # will be added to the HTTP request.
263
+ #
264
+ # @return [Concurrent::Promise] promise which provides async access to http
265
+ # response.
266
+ #
267
+ def create_or_update_async(resource_group_name, server_name, key_name, parameters, custom_headers = nil)
268
+ # Send request
269
+ promise = begin_create_or_update_async(resource_group_name, server_name, key_name, parameters, custom_headers)
270
+
271
+ promise = promise.then do |response|
272
+ # Defining deserialization method.
273
+ deserialize_method = lambda do |parsed_response|
274
+ result_mapper = Azure::ARM::SQL::Models::ServerKey.mapper()
275
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
276
+ end
277
+
278
+ # Waiting for response.
279
+ @client.get_long_running_operation_result(response, deserialize_method)
280
+ end
281
+
282
+ promise
283
+ end
284
+
285
+ #
286
+ # Deletes the server key with the given name.
287
+ #
288
+ # @param resource_group_name [String] The name of the resource group that
289
+ # contains the resource. You can obtain this value from the Azure Resource
290
+ # Manager API or the portal.
291
+ # @param server_name [String] The name of the server.
292
+ # @param key_name [String] The name of the server key to be deleted.
293
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
294
+ # will be added to the HTTP request.
295
+ #
296
+ def delete(resource_group_name, server_name, key_name, custom_headers = nil)
297
+ response = delete_async(resource_group_name, server_name, key_name, custom_headers).value!
298
+ nil
299
+ end
300
+
301
+ #
302
+ # @param resource_group_name [String] The name of the resource group that
303
+ # contains the resource. You can obtain this value from the Azure Resource
304
+ # Manager API or the portal.
305
+ # @param server_name [String] The name of the server.
306
+ # @param key_name [String] The name of the server key to be deleted.
307
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
308
+ # will be added to the HTTP request.
309
+ #
310
+ # @return [Concurrent::Promise] promise which provides async access to http
311
+ # response.
312
+ #
313
+ def delete_async(resource_group_name, server_name, key_name, custom_headers = nil)
314
+ # Send request
315
+ promise = begin_delete_async(resource_group_name, server_name, key_name, custom_headers)
316
+
317
+ promise = promise.then do |response|
318
+ # Defining deserialization method.
319
+ deserialize_method = lambda do |parsed_response|
320
+ end
321
+
322
+ # Waiting for response.
323
+ @client.get_long_running_operation_result(response, deserialize_method)
324
+ end
325
+
326
+ promise
327
+ end
328
+
329
+ #
330
+ # Creates or updates a server key.
331
+ #
332
+ # @param resource_group_name [String] The name of the resource group that
333
+ # contains the resource. You can obtain this value from the Azure Resource
334
+ # Manager API or the portal.
335
+ # @param server_name [String] The name of the server.
336
+ # @param key_name [String] The name of the server key to be operated on
337
+ # (updated or created). The key name is required to be in the format of
338
+ # 'vault_key_version'. For example, if the keyId is
339
+ # https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901,
340
+ # then the server key name should be formatted as:
341
+ # YourVaultName_YourKeyName_01234567890123456789012345678901
342
+ # @param parameters [ServerKey] The requested server key resource state.
343
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
344
+ # will be added to the HTTP request.
345
+ #
346
+ # @return [ServerKey] operation results.
347
+ #
348
+ def begin_create_or_update(resource_group_name, server_name, key_name, parameters, custom_headers = nil)
349
+ response = begin_create_or_update_async(resource_group_name, server_name, key_name, parameters, custom_headers).value!
350
+ response.body unless response.nil?
351
+ end
352
+
353
+ #
354
+ # Creates or updates a server key.
355
+ #
356
+ # @param resource_group_name [String] The name of the resource group that
357
+ # contains the resource. You can obtain this value from the Azure Resource
358
+ # Manager API or the portal.
359
+ # @param server_name [String] The name of the server.
360
+ # @param key_name [String] The name of the server key to be operated on
361
+ # (updated or created). The key name is required to be in the format of
362
+ # 'vault_key_version'. For example, if the keyId is
363
+ # https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901,
364
+ # then the server key name should be formatted as:
365
+ # YourVaultName_YourKeyName_01234567890123456789012345678901
366
+ # @param parameters [ServerKey] The requested server key resource state.
367
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
368
+ # will be added to the HTTP request.
369
+ #
370
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
371
+ #
372
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, key_name, parameters, custom_headers = nil)
373
+ begin_create_or_update_async(resource_group_name, server_name, key_name, parameters, custom_headers).value!
374
+ end
375
+
376
+ #
377
+ # Creates or updates a server key.
378
+ #
379
+ # @param resource_group_name [String] The name of the resource group that
380
+ # contains the resource. You can obtain this value from the Azure Resource
381
+ # Manager API or the portal.
382
+ # @param server_name [String] The name of the server.
383
+ # @param key_name [String] The name of the server key to be operated on
384
+ # (updated or created). The key name is required to be in the format of
385
+ # 'vault_key_version'. For example, if the keyId is
386
+ # https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901,
387
+ # then the server key name should be formatted as:
388
+ # YourVaultName_YourKeyName_01234567890123456789012345678901
389
+ # @param parameters [ServerKey] The requested server key resource state.
390
+ # @param [Hash{String => String}] A hash of custom headers that will be added
391
+ # to the HTTP request.
392
+ #
393
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
394
+ #
395
+ def begin_create_or_update_async(resource_group_name, server_name, key_name, parameters, custom_headers = nil)
396
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
397
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
398
+ fail ArgumentError, 'key_name is nil' if key_name.nil?
399
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
400
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
401
+ api_version = '2015-05-01-preview'
402
+
403
+
404
+ request_headers = {}
405
+
406
+ # Set Headers
407
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
408
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
409
+
410
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
411
+
412
+ # Serialize Request
413
+ request_mapper = Azure::ARM::SQL::Models::ServerKey.mapper()
414
+ request_content = @client.serialize(request_mapper, parameters)
415
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
416
+
417
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}'
418
+
419
+ request_url = @base_url || @client.base_url
420
+
421
+ options = {
422
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
423
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'keyName' => key_name,'subscriptionId' => @client.subscription_id},
424
+ query_params: {'api-version' => api_version},
425
+ body: request_content,
426
+ headers: request_headers.merge(custom_headers || {}),
427
+ base_url: request_url
428
+ }
429
+ promise = @client.make_request_async(:put, path_template, options)
430
+
431
+ promise = promise.then do |result|
432
+ http_response = result.response
433
+ status_code = http_response.status
434
+ response_content = http_response.body
435
+ unless status_code == 200 || status_code == 202 || status_code == 201
436
+ error_model = JSON.load(response_content)
437
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
438
+ end
439
+
440
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
441
+ # Deserialize Response
442
+ if status_code == 200
443
+ begin
444
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
445
+ result_mapper = Azure::ARM::SQL::Models::ServerKey.mapper()
446
+ result.body = @client.deserialize(result_mapper, parsed_response)
447
+ rescue Exception => e
448
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
449
+ end
450
+ end
451
+ # Deserialize Response
452
+ if status_code == 201
453
+ begin
454
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
455
+ result_mapper = Azure::ARM::SQL::Models::ServerKey.mapper()
456
+ result.body = @client.deserialize(result_mapper, parsed_response)
457
+ rescue Exception => e
458
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
459
+ end
460
+ end
461
+
462
+ result
463
+ end
464
+
465
+ promise.execute
466
+ end
467
+
468
+ #
469
+ # Deletes the server key with the given name.
470
+ #
471
+ # @param resource_group_name [String] The name of the resource group that
472
+ # contains the resource. You can obtain this value from the Azure Resource
473
+ # Manager API or the portal.
474
+ # @param server_name [String] The name of the server.
475
+ # @param key_name [String] The name of the server key to be deleted.
476
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
477
+ # will be added to the HTTP request.
478
+ #
479
+ #
480
+ def begin_delete(resource_group_name, server_name, key_name, custom_headers = nil)
481
+ response = begin_delete_async(resource_group_name, server_name, key_name, custom_headers).value!
482
+ nil
483
+ end
484
+
485
+ #
486
+ # Deletes the server key with the given name.
487
+ #
488
+ # @param resource_group_name [String] The name of the resource group that
489
+ # contains the resource. You can obtain this value from the Azure Resource
490
+ # Manager API or the portal.
491
+ # @param server_name [String] The name of the server.
492
+ # @param key_name [String] The name of the server key to be deleted.
493
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
494
+ # will be added to the HTTP request.
495
+ #
496
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
497
+ #
498
+ def begin_delete_with_http_info(resource_group_name, server_name, key_name, custom_headers = nil)
499
+ begin_delete_async(resource_group_name, server_name, key_name, custom_headers).value!
500
+ end
501
+
502
+ #
503
+ # Deletes the server key with the given name.
504
+ #
505
+ # @param resource_group_name [String] The name of the resource group that
506
+ # contains the resource. You can obtain this value from the Azure Resource
507
+ # Manager API or the portal.
508
+ # @param server_name [String] The name of the server.
509
+ # @param key_name [String] The name of the server key to be deleted.
510
+ # @param [Hash{String => String}] A hash of custom headers that will be added
511
+ # to the HTTP request.
512
+ #
513
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
514
+ #
515
+ def begin_delete_async(resource_group_name, server_name, key_name, custom_headers = nil)
516
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
517
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
518
+ fail ArgumentError, 'key_name is nil' if key_name.nil?
519
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
520
+ api_version = '2015-05-01-preview'
521
+
522
+
523
+ request_headers = {}
524
+
525
+ # Set Headers
526
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
527
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
528
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/keys/{keyName}'
529
+
530
+ request_url = @base_url || @client.base_url
531
+
532
+ options = {
533
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
534
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'keyName' => key_name,'subscriptionId' => @client.subscription_id},
535
+ query_params: {'api-version' => api_version},
536
+ headers: request_headers.merge(custom_headers || {}),
537
+ base_url: request_url
538
+ }
539
+ promise = @client.make_request_async(:delete, path_template, options)
540
+
541
+ promise = promise.then do |result|
542
+ http_response = result.response
543
+ status_code = http_response.status
544
+ response_content = http_response.body
545
+ unless status_code == 200 || status_code == 202 || status_code == 204
546
+ error_model = JSON.load(response_content)
547
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
548
+ end
549
+
550
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
551
+
552
+ result
553
+ end
554
+
555
+ promise.execute
556
+ end
557
+
558
+ #
559
+ # Returns a list of server keys.
560
+ #
561
+ # @param next_page_link [String] The NextLink from the previous successful call
562
+ # to List operation.
563
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
564
+ # will be added to the HTTP request.
565
+ #
566
+ # @return [ServerKeyListResult] operation results.
567
+ #
568
+ def list_by_server_next(next_page_link, custom_headers = nil)
569
+ response = list_by_server_next_async(next_page_link, custom_headers).value!
570
+ response.body unless response.nil?
571
+ end
572
+
573
+ #
574
+ # Returns a list of server keys.
575
+ #
576
+ # @param next_page_link [String] The NextLink from the previous successful call
577
+ # to List operation.
578
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
579
+ # will be added to the HTTP request.
580
+ #
581
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
582
+ #
583
+ def list_by_server_next_with_http_info(next_page_link, custom_headers = nil)
584
+ list_by_server_next_async(next_page_link, custom_headers).value!
585
+ end
586
+
587
+ #
588
+ # Returns a list of server keys.
589
+ #
590
+ # @param next_page_link [String] The NextLink from the previous successful call
591
+ # to List operation.
592
+ # @param [Hash{String => String}] A hash of custom headers that will be added
593
+ # to the HTTP request.
594
+ #
595
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
596
+ #
597
+ def list_by_server_next_async(next_page_link, custom_headers = nil)
598
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
599
+
600
+
601
+ request_headers = {}
602
+
603
+ # Set Headers
604
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
605
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
606
+ path_template = '{nextLink}'
607
+
608
+ request_url = @base_url || @client.base_url
609
+
610
+ options = {
611
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
612
+ skip_encoding_path_params: {'nextLink' => next_page_link},
613
+ headers: request_headers.merge(custom_headers || {}),
614
+ base_url: request_url
615
+ }
616
+ promise = @client.make_request_async(:get, path_template, options)
617
+
618
+ promise = promise.then do |result|
619
+ http_response = result.response
620
+ status_code = http_response.status
621
+ response_content = http_response.body
622
+ unless status_code == 200
623
+ error_model = JSON.load(response_content)
624
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
625
+ end
626
+
627
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
628
+ # Deserialize Response
629
+ if status_code == 200
630
+ begin
631
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
632
+ result_mapper = Azure::ARM::SQL::Models::ServerKeyListResult.mapper()
633
+ result.body = @client.deserialize(result_mapper, parsed_response)
634
+ rescue Exception => e
635
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
636
+ end
637
+ end
638
+
639
+ result
640
+ end
641
+
642
+ promise.execute
643
+ end
644
+
645
+ #
646
+ # Returns a list of server keys.
647
+ #
648
+ # @param resource_group_name [String] The name of the resource group that
649
+ # contains the resource. You can obtain this value from the Azure Resource
650
+ # Manager API or the portal.
651
+ # @param server_name [String] The name of the server.
652
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
653
+ # will be added to the HTTP request.
654
+ #
655
+ # @return [ServerKeyListResult] which provide lazy access to pages of the
656
+ # response.
657
+ #
658
+ def list_by_server_as_lazy(resource_group_name, server_name, custom_headers = nil)
659
+ response = list_by_server_async(resource_group_name, server_name, custom_headers).value!
660
+ unless response.nil?
661
+ page = response.body
662
+ page.next_method = Proc.new do |next_page_link|
663
+ list_by_server_next_async(next_page_link, custom_headers)
664
+ end
665
+ page
666
+ end
667
+ end
668
+
669
+ end
670
+ end