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
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -11,7 +11,6 @@ module Azure::ARM::SQL
11
11
  # databases.
12
12
  #
13
13
  class Servers
14
- include Azure::ARM::SQL::Models
15
14
  include MsRestAzure
16
15
 
17
16
  #
@@ -26,66 +25,56 @@ module Azure::ARM::SQL
26
25
  attr_reader :client
27
26
 
28
27
  #
29
- # Creates or updates a firewall rule.
28
+ # Gets a server backup long term retention vault
30
29
  #
31
30
  # @param resource_group_name [String] The name of the resource group that
32
31
  # contains the resource. You can obtain this value from the Azure Resource
33
32
  # Manager API or the portal.
34
33
  # @param server_name [String] The name of the server.
35
- # @param firewall_rule_name [String] The name of the firewall rule.
36
- # @param parameters [ServerFirewallRule] The required parameters for creating
37
- # or updating a firewall rule.
38
34
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
39
35
  # will be added to the HTTP request.
40
36
  #
41
- # @return [ServerFirewallRule] operation results.
37
+ # @return [BackupLongTermRetentionVault] operation results.
42
38
  #
43
- def create_or_update_firewall_rule(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers = nil)
44
- response = create_or_update_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers).value!
39
+ def get_backup_long_term_retention_vault(resource_group_name, server_name, custom_headers = nil)
40
+ response = get_backup_long_term_retention_vault_async(resource_group_name, server_name, custom_headers).value!
45
41
  response.body unless response.nil?
46
42
  end
47
43
 
48
44
  #
49
- # Creates or updates a firewall rule.
45
+ # Gets a server backup long term retention vault
50
46
  #
51
47
  # @param resource_group_name [String] The name of the resource group that
52
48
  # contains the resource. You can obtain this value from the Azure Resource
53
49
  # Manager API or the portal.
54
50
  # @param server_name [String] The name of the server.
55
- # @param firewall_rule_name [String] The name of the firewall rule.
56
- # @param parameters [ServerFirewallRule] The required parameters for creating
57
- # or updating a firewall rule.
58
51
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
59
52
  # will be added to the HTTP request.
60
53
  #
61
54
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
62
55
  #
63
- def create_or_update_firewall_rule_with_http_info(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers = nil)
64
- create_or_update_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers).value!
56
+ def get_backup_long_term_retention_vault_with_http_info(resource_group_name, server_name, custom_headers = nil)
57
+ get_backup_long_term_retention_vault_async(resource_group_name, server_name, custom_headers).value!
65
58
  end
66
59
 
67
60
  #
68
- # Creates or updates a firewall rule.
61
+ # Gets a server backup long term retention vault
69
62
  #
70
63
  # @param resource_group_name [String] The name of the resource group that
71
64
  # contains the resource. You can obtain this value from the Azure Resource
72
65
  # Manager API or the portal.
73
66
  # @param server_name [String] The name of the server.
74
- # @param firewall_rule_name [String] The name of the firewall rule.
75
- # @param parameters [ServerFirewallRule] The required parameters for creating
76
- # or updating a firewall rule.
77
67
  # @param [Hash{String => String}] A hash of custom headers that will be added
78
68
  # to the HTTP request.
79
69
  #
80
70
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
81
71
  #
82
- def create_or_update_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, parameters, custom_headers = nil)
72
+ def get_backup_long_term_retention_vault_async(resource_group_name, server_name, custom_headers = nil)
83
73
  api_version = '2014-04-01'
84
74
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
85
75
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
86
76
  fail ArgumentError, 'server_name is nil' if server_name.nil?
87
- fail ArgumentError, 'firewall_rule_name is nil' if firewall_rule_name.nil?
88
- fail ArgumentError, 'parameters is nil' if parameters.nil?
77
+ backup_long_term_retention_vault_name = 'RegisteredVault'
89
78
 
90
79
 
91
80
  request_headers = {}
@@ -93,33 +82,24 @@ module Azure::ARM::SQL
93
82
  # Set Headers
94
83
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
95
84
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
96
-
97
- request_headers['Content-Type'] = 'application/json; charset=utf-8'
98
-
99
- # Serialize Request
100
- request_mapper = ServerFirewallRule.mapper()
101
- request_content = @client.serialize(request_mapper, parameters, 'parameters')
102
- request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
103
-
104
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}'
85
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}'
105
86
 
106
87
  request_url = @base_url || @client.base_url
107
88
 
108
89
  options = {
109
90
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
110
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'firewallRuleName' => firewall_rule_name},
91
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'backupLongTermRetentionVaultName' => backup_long_term_retention_vault_name},
111
92
  query_params: {'api-version' => api_version},
112
- body: request_content,
113
93
  headers: request_headers.merge(custom_headers || {}),
114
94
  base_url: request_url
115
95
  }
116
- promise = @client.make_request_async(:put, path_template, options)
96
+ promise = @client.make_request_async(:get, path_template, options)
117
97
 
118
98
  promise = promise.then do |result|
119
99
  http_response = result.response
120
100
  status_code = http_response.status
121
101
  response_content = http_response.body
122
- unless status_code == 200 || status_code == 201
102
+ unless status_code == 200
123
103
  error_model = JSON.load(response_content)
124
104
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
125
105
  end
@@ -129,18 +109,8 @@ module Azure::ARM::SQL
129
109
  if status_code == 200
130
110
  begin
131
111
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
132
- result_mapper = ServerFirewallRule.mapper()
133
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
134
- rescue Exception => e
135
- fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
136
- end
137
- end
138
- # Deserialize Response
139
- if status_code == 201
140
- begin
141
- parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
142
- result_mapper = ServerFirewallRule.mapper()
143
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
112
+ result_mapper = Azure::ARM::SQL::Models::BackupLongTermRetentionVault.mapper()
113
+ result.body = @client.deserialize(result_mapper, parsed_response)
144
114
  rescue Exception => e
145
115
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
146
116
  end
@@ -153,58 +123,113 @@ module Azure::ARM::SQL
153
123
  end
154
124
 
155
125
  #
156
- # Deletes a firewall rule.
126
+ # Updates a server backup long term retention vault
157
127
  #
158
128
  # @param resource_group_name [String] The name of the resource group that
159
129
  # contains the resource. You can obtain this value from the Azure Resource
160
130
  # Manager API or the portal.
161
131
  # @param server_name [String] The name of the server.
162
- # @param firewall_rule_name [String] The name of the firewall rule.
132
+ # @param parameters [BackupLongTermRetentionVault] The required parameters to
133
+ # update a backup long term retention vault
163
134
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
164
135
  # will be added to the HTTP request.
165
136
  #
137
+ # @return [BackupLongTermRetentionVault] operation results.
166
138
  #
167
- def delete_firewall_rule(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
168
- response = delete_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, custom_headers).value!
169
- nil
139
+ def create_backup_long_term_retention_vault(resource_group_name, server_name, parameters, custom_headers = nil)
140
+ response = create_backup_long_term_retention_vault_async(resource_group_name, server_name, parameters, custom_headers).value!
141
+ response.body unless response.nil?
142
+ end
143
+
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 parameters [BackupLongTermRetentionVault] The required parameters to
150
+ # update a backup long term retention vault
151
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
152
+ # will be added to the HTTP request.
153
+ #
154
+ # @return [Concurrent::Promise] promise which provides async access to http
155
+ # response.
156
+ #
157
+ def create_backup_long_term_retention_vault_async(resource_group_name, server_name, parameters, custom_headers = nil)
158
+ # Send request
159
+ promise = begin_create_backup_long_term_retention_vault_async(resource_group_name, server_name, parameters, custom_headers)
160
+
161
+ promise = promise.then do |response|
162
+ # Defining deserialization method.
163
+ deserialize_method = lambda do |parsed_response|
164
+ result_mapper = Azure::ARM::SQL::Models::BackupLongTermRetentionVault.mapper()
165
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
166
+ end
167
+
168
+ # Waiting for response.
169
+ @client.get_long_running_operation_result(response, deserialize_method)
170
+ end
171
+
172
+ promise
173
+ end
174
+
175
+ #
176
+ # Creates or updates the server's connection policy.
177
+ #
178
+ # @param resource_group_name [String] The name of the resource group that
179
+ # contains the resource. You can obtain this value from the Azure Resource
180
+ # Manager API or the portal.
181
+ # @param server_name [String] The name of the server.
182
+ # @param parameters [ServerConnectionPolicy] The required parameters for
183
+ # updating a secure connection policy.
184
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
185
+ # will be added to the HTTP request.
186
+ #
187
+ # @return [ServerConnectionPolicy] operation results.
188
+ #
189
+ def create_or_update_connection_policy(resource_group_name, server_name, parameters, custom_headers = nil)
190
+ response = create_or_update_connection_policy_async(resource_group_name, server_name, parameters, custom_headers).value!
191
+ response.body unless response.nil?
170
192
  end
171
193
 
172
194
  #
173
- # Deletes a firewall rule.
195
+ # Creates or updates the server's connection policy.
174
196
  #
175
197
  # @param resource_group_name [String] The name of the resource group that
176
198
  # contains the resource. You can obtain this value from the Azure Resource
177
199
  # Manager API or the portal.
178
200
  # @param server_name [String] The name of the server.
179
- # @param firewall_rule_name [String] The name of the firewall rule.
201
+ # @param parameters [ServerConnectionPolicy] The required parameters for
202
+ # updating a secure connection policy.
180
203
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
181
204
  # will be added to the HTTP request.
182
205
  #
183
206
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
184
207
  #
185
- def delete_firewall_rule_with_http_info(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
186
- delete_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, custom_headers).value!
208
+ def create_or_update_connection_policy_with_http_info(resource_group_name, server_name, parameters, custom_headers = nil)
209
+ create_or_update_connection_policy_async(resource_group_name, server_name, parameters, custom_headers).value!
187
210
  end
188
211
 
189
212
  #
190
- # Deletes a firewall rule.
213
+ # Creates or updates the server's connection policy.
191
214
  #
192
215
  # @param resource_group_name [String] The name of the resource group that
193
216
  # contains the resource. You can obtain this value from the Azure Resource
194
217
  # Manager API or the portal.
195
218
  # @param server_name [String] The name of the server.
196
- # @param firewall_rule_name [String] The name of the firewall rule.
219
+ # @param parameters [ServerConnectionPolicy] The required parameters for
220
+ # updating a secure connection policy.
197
221
  # @param [Hash{String => String}] A hash of custom headers that will be added
198
222
  # to the HTTP request.
199
223
  #
200
224
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
201
225
  #
202
- def delete_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
226
+ def create_or_update_connection_policy_async(resource_group_name, server_name, parameters, custom_headers = nil)
203
227
  api_version = '2014-04-01'
204
228
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
205
229
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
206
230
  fail ArgumentError, 'server_name is nil' if server_name.nil?
207
- fail ArgumentError, 'firewall_rule_name is nil' if firewall_rule_name.nil?
231
+ connection_policy_name = 'default'
232
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
208
233
 
209
234
 
210
235
  request_headers = {}
@@ -212,29 +237,58 @@ module Azure::ARM::SQL
212
237
  # Set Headers
213
238
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
214
239
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
215
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}'
240
+
241
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
242
+
243
+ # Serialize Request
244
+ request_mapper = Azure::ARM::SQL::Models::ServerConnectionPolicy.mapper()
245
+ request_content = @client.serialize(request_mapper, parameters)
246
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
247
+
248
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}'
216
249
 
217
250
  request_url = @base_url || @client.base_url
218
251
 
219
252
  options = {
220
253
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
221
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'firewallRuleName' => firewall_rule_name},
254
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'connectionPolicyName' => connection_policy_name},
222
255
  query_params: {'api-version' => api_version},
256
+ body: request_content,
223
257
  headers: request_headers.merge(custom_headers || {}),
224
258
  base_url: request_url
225
259
  }
226
- promise = @client.make_request_async(:delete, path_template, options)
260
+ promise = @client.make_request_async(:put, path_template, options)
227
261
 
228
262
  promise = promise.then do |result|
229
263
  http_response = result.response
230
264
  status_code = http_response.status
231
265
  response_content = http_response.body
232
- unless status_code == 200 || status_code == 204
266
+ unless status_code == 200 || status_code == 201
233
267
  error_model = JSON.load(response_content)
234
268
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
235
269
  end
236
270
 
237
271
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
272
+ # Deserialize Response
273
+ if status_code == 200
274
+ begin
275
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
276
+ result_mapper = Azure::ARM::SQL::Models::ServerConnectionPolicy.mapper()
277
+ result.body = @client.deserialize(result_mapper, parsed_response)
278
+ rescue Exception => e
279
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
280
+ end
281
+ end
282
+ # Deserialize Response
283
+ if status_code == 201
284
+ begin
285
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
286
+ result_mapper = Azure::ARM::SQL::Models::ServerConnectionPolicy.mapper()
287
+ result.body = @client.deserialize(result_mapper, parsed_response)
288
+ rescue Exception => e
289
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
290
+ end
291
+ end
238
292
 
239
293
  result
240
294
  end
@@ -243,59 +297,56 @@ module Azure::ARM::SQL
243
297
  end
244
298
 
245
299
  #
246
- # Gets a firewall rule.
300
+ # Gets the server's secure connection policy.
247
301
  #
248
302
  # @param resource_group_name [String] The name of the resource group that
249
303
  # contains the resource. You can obtain this value from the Azure Resource
250
304
  # Manager API or the portal.
251
305
  # @param server_name [String] The name of the server.
252
- # @param firewall_rule_name [String] The name of the firewall rule.
253
306
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
254
307
  # will be added to the HTTP request.
255
308
  #
256
- # @return [ServerFirewallRule] operation results.
309
+ # @return [ServerConnectionPolicy] operation results.
257
310
  #
258
- def get_firewall_rule(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
259
- response = get_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, custom_headers).value!
311
+ def get_connection_policy(resource_group_name, server_name, custom_headers = nil)
312
+ response = get_connection_policy_async(resource_group_name, server_name, custom_headers).value!
260
313
  response.body unless response.nil?
261
314
  end
262
315
 
263
316
  #
264
- # Gets a firewall rule.
317
+ # Gets the server's secure connection policy.
265
318
  #
266
319
  # @param resource_group_name [String] The name of the resource group that
267
320
  # contains the resource. You can obtain this value from the Azure Resource
268
321
  # Manager API or the portal.
269
322
  # @param server_name [String] The name of the server.
270
- # @param firewall_rule_name [String] The name of the firewall rule.
271
323
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
272
324
  # will be added to the HTTP request.
273
325
  #
274
326
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
275
327
  #
276
- def get_firewall_rule_with_http_info(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
277
- get_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, custom_headers).value!
328
+ def get_connection_policy_with_http_info(resource_group_name, server_name, custom_headers = nil)
329
+ get_connection_policy_async(resource_group_name, server_name, custom_headers).value!
278
330
  end
279
331
 
280
332
  #
281
- # Gets a firewall rule.
333
+ # Gets the server's secure connection policy.
282
334
  #
283
335
  # @param resource_group_name [String] The name of the resource group that
284
336
  # contains the resource. You can obtain this value from the Azure Resource
285
337
  # Manager API or the portal.
286
338
  # @param server_name [String] The name of the server.
287
- # @param firewall_rule_name [String] The name of the firewall rule.
288
339
  # @param [Hash{String => String}] A hash of custom headers that will be added
289
340
  # to the HTTP request.
290
341
  #
291
342
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
292
343
  #
293
- def get_firewall_rule_async(resource_group_name, server_name, firewall_rule_name, custom_headers = nil)
344
+ def get_connection_policy_async(resource_group_name, server_name, custom_headers = nil)
294
345
  api_version = '2014-04-01'
295
346
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
296
347
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
297
348
  fail ArgumentError, 'server_name is nil' if server_name.nil?
298
- fail ArgumentError, 'firewall_rule_name is nil' if firewall_rule_name.nil?
349
+ connection_policy_name = 'default'
299
350
 
300
351
 
301
352
  request_headers = {}
@@ -303,13 +354,13 @@ module Azure::ARM::SQL
303
354
  # Set Headers
304
355
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
305
356
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
306
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}'
357
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/connectionPolicies/{connectionPolicyName}'
307
358
 
308
359
  request_url = @base_url || @client.base_url
309
360
 
310
361
  options = {
311
362
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
312
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'firewallRuleName' => firewall_rule_name},
363
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'connectionPolicyName' => connection_policy_name},
313
364
  query_params: {'api-version' => api_version},
314
365
  headers: request_headers.merge(custom_headers || {}),
315
366
  base_url: request_url
@@ -330,8 +381,8 @@ module Azure::ARM::SQL
330
381
  if status_code == 200
331
382
  begin
332
383
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
333
- result_mapper = ServerFirewallRule.mapper()
334
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
384
+ result_mapper = Azure::ARM::SQL::Models::ServerConnectionPolicy.mapper()
385
+ result.body = @client.deserialize(result_mapper, parsed_response)
335
386
  rescue Exception => e
336
387
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
337
388
  end
@@ -344,55 +395,62 @@ module Azure::ARM::SQL
344
395
  end
345
396
 
346
397
  #
347
- # Returns a list of firewall rules.
398
+ # Gets a database service objective.
348
399
  #
349
400
  # @param resource_group_name [String] The name of the resource group that
350
401
  # contains the resource. You can obtain this value from the Azure Resource
351
402
  # Manager API or the portal.
352
403
  # @param server_name [String] The name of the server.
404
+ # @param service_objective_name [String] The name of the service objective to
405
+ # retrieve.
353
406
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
354
407
  # will be added to the HTTP request.
355
408
  #
356
- # @return [ServerFirewallRuleListResult] operation results.
409
+ # @return [ServiceObjective] operation results.
357
410
  #
358
- def list_firewall_rules(resource_group_name, server_name, custom_headers = nil)
359
- response = list_firewall_rules_async(resource_group_name, server_name, custom_headers).value!
411
+ def get_service_objective(resource_group_name, server_name, service_objective_name, custom_headers = nil)
412
+ response = get_service_objective_async(resource_group_name, server_name, service_objective_name, custom_headers).value!
360
413
  response.body unless response.nil?
361
414
  end
362
415
 
363
416
  #
364
- # Returns a list of firewall rules.
417
+ # Gets a database service objective.
365
418
  #
366
419
  # @param resource_group_name [String] The name of the resource group that
367
420
  # contains the resource. You can obtain this value from the Azure Resource
368
421
  # Manager API or the portal.
369
422
  # @param server_name [String] The name of the server.
423
+ # @param service_objective_name [String] The name of the service objective to
424
+ # retrieve.
370
425
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
371
426
  # will be added to the HTTP request.
372
427
  #
373
428
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
374
429
  #
375
- def list_firewall_rules_with_http_info(resource_group_name, server_name, custom_headers = nil)
376
- list_firewall_rules_async(resource_group_name, server_name, custom_headers).value!
430
+ def get_service_objective_with_http_info(resource_group_name, server_name, service_objective_name, custom_headers = nil)
431
+ get_service_objective_async(resource_group_name, server_name, service_objective_name, custom_headers).value!
377
432
  end
378
433
 
379
434
  #
380
- # Returns a list of firewall rules.
435
+ # Gets a database service objective.
381
436
  #
382
437
  # @param resource_group_name [String] The name of the resource group that
383
438
  # contains the resource. You can obtain this value from the Azure Resource
384
439
  # Manager API or the portal.
385
440
  # @param server_name [String] The name of the server.
441
+ # @param service_objective_name [String] The name of the service objective to
442
+ # retrieve.
386
443
  # @param [Hash{String => String}] A hash of custom headers that will be added
387
444
  # to the HTTP request.
388
445
  #
389
446
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
390
447
  #
391
- def list_firewall_rules_async(resource_group_name, server_name, custom_headers = nil)
448
+ def get_service_objective_async(resource_group_name, server_name, service_objective_name, custom_headers = nil)
392
449
  api_version = '2014-04-01'
393
450
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
394
451
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
395
452
  fail ArgumentError, 'server_name is nil' if server_name.nil?
453
+ fail ArgumentError, 'service_objective_name is nil' if service_objective_name.nil?
396
454
 
397
455
 
398
456
  request_headers = {}
@@ -400,13 +458,13 @@ module Azure::ARM::SQL
400
458
  # Set Headers
401
459
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
402
460
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
403
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules'
461
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}'
404
462
 
405
463
  request_url = @base_url || @client.base_url
406
464
 
407
465
  options = {
408
466
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
409
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
467
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'serviceObjectiveName' => service_objective_name},
410
468
  query_params: {'api-version' => api_version},
411
469
  headers: request_headers.merge(custom_headers || {}),
412
470
  base_url: request_url
@@ -427,8 +485,8 @@ module Azure::ARM::SQL
427
485
  if status_code == 200
428
486
  begin
429
487
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
430
- result_mapper = ServerFirewallRuleListResult.mapper()
431
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
488
+ result_mapper = Azure::ARM::SQL::Models::ServiceObjective.mapper()
489
+ result.body = @client.deserialize(result_mapper, parsed_response)
432
490
  rescue Exception => e
433
491
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
434
492
  end
@@ -441,41 +499,55 @@ module Azure::ARM::SQL
441
499
  end
442
500
 
443
501
  #
444
- # Returns a list of servers.
502
+ # Returns database service objectives.
445
503
  #
504
+ # @param resource_group_name [String] The name of the resource group that
505
+ # contains the resource. You can obtain this value from the Azure Resource
506
+ # Manager API or the portal.
507
+ # @param server_name [String] The name of the server.
446
508
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
447
509
  # will be added to the HTTP request.
448
510
  #
449
- # @return [ServerListResult] operation results.
511
+ # @return [ServiceObjectiveListResult] operation results.
450
512
  #
451
- def list(custom_headers = nil)
452
- response = list_async(custom_headers).value!
513
+ def list_service_objectives(resource_group_name, server_name, custom_headers = nil)
514
+ response = list_service_objectives_async(resource_group_name, server_name, custom_headers).value!
453
515
  response.body unless response.nil?
454
516
  end
455
517
 
456
518
  #
457
- # Returns a list of servers.
519
+ # Returns database service objectives.
458
520
  #
521
+ # @param resource_group_name [String] The name of the resource group that
522
+ # contains the resource. You can obtain this value from the Azure Resource
523
+ # Manager API or the portal.
524
+ # @param server_name [String] The name of the server.
459
525
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
460
526
  # will be added to the HTTP request.
461
527
  #
462
528
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
463
529
  #
464
- def list_with_http_info(custom_headers = nil)
465
- list_async(custom_headers).value!
530
+ def list_service_objectives_with_http_info(resource_group_name, server_name, custom_headers = nil)
531
+ list_service_objectives_async(resource_group_name, server_name, custom_headers).value!
466
532
  end
467
533
 
468
534
  #
469
- # Returns a list of servers.
535
+ # Returns database service objectives.
470
536
  #
537
+ # @param resource_group_name [String] The name of the resource group that
538
+ # contains the resource. You can obtain this value from the Azure Resource
539
+ # Manager API or the portal.
540
+ # @param server_name [String] The name of the server.
471
541
  # @param [Hash{String => String}] A hash of custom headers that will be added
472
542
  # to the HTTP request.
473
543
  #
474
544
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
475
545
  #
476
- def list_async(custom_headers = nil)
546
+ def list_service_objectives_async(resource_group_name, server_name, custom_headers = nil)
477
547
  api_version = '2014-04-01'
478
548
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
549
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
550
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
479
551
 
480
552
 
481
553
  request_headers = {}
@@ -483,13 +555,13 @@ module Azure::ARM::SQL
483
555
  # Set Headers
484
556
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
485
557
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
486
- path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers'
558
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives'
487
559
 
488
560
  request_url = @base_url || @client.base_url
489
561
 
490
562
  options = {
491
563
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
492
- path_params: {'subscriptionId' => @client.subscription_id},
564
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
493
565
  query_params: {'api-version' => api_version},
494
566
  headers: request_headers.merge(custom_headers || {}),
495
567
  base_url: request_url
@@ -510,8 +582,8 @@ module Azure::ARM::SQL
510
582
  if status_code == 200
511
583
  begin
512
584
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
513
- result_mapper = ServerListResult.mapper()
514
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
585
+ result_mapper = Azure::ARM::SQL::Models::ServiceObjectiveListResult.mapper()
586
+ result.body = @client.deserialize(result_mapper, parsed_response)
515
587
  rescue Exception => e
516
588
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
517
589
  end
@@ -524,61 +596,47 @@ module Azure::ARM::SQL
524
596
  end
525
597
 
526
598
  #
527
- # Creates or updates a new server.
599
+ # Determines whether a resource can be created with the specified name.
528
600
  #
529
- # @param resource_group_name [String] The name of the resource group that
530
- # contains the resource. You can obtain this value from the Azure Resource
531
- # Manager API or the portal.
532
- # @param server_name [String] The name of the server.
533
- # @param parameters [Server] The required parameters for creating or updating a
534
- # server.
601
+ # @param parameters [CheckNameAvailabilityRequest] The parameters to request
602
+ # for name availability.
535
603
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
536
604
  # will be added to the HTTP request.
537
605
  #
538
- # @return [Server] operation results.
606
+ # @return [CheckNameAvailabilityResponse] operation results.
539
607
  #
540
- def create_or_update(resource_group_name, server_name, parameters, custom_headers = nil)
541
- response = create_or_update_async(resource_group_name, server_name, parameters, custom_headers).value!
608
+ def check_name_availability(parameters, custom_headers = nil)
609
+ response = check_name_availability_async(parameters, custom_headers).value!
542
610
  response.body unless response.nil?
543
611
  end
544
612
 
545
613
  #
546
- # Creates or updates a new server.
614
+ # Determines whether a resource can be created with the specified name.
547
615
  #
548
- # @param resource_group_name [String] The name of the resource group that
549
- # contains the resource. You can obtain this value from the Azure Resource
550
- # Manager API or the portal.
551
- # @param server_name [String] The name of the server.
552
- # @param parameters [Server] The required parameters for creating or updating a
553
- # server.
616
+ # @param parameters [CheckNameAvailabilityRequest] The parameters to request
617
+ # for name availability.
554
618
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
555
619
  # will be added to the HTTP request.
556
620
  #
557
621
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
558
622
  #
559
- def create_or_update_with_http_info(resource_group_name, server_name, parameters, custom_headers = nil)
560
- create_or_update_async(resource_group_name, server_name, parameters, custom_headers).value!
623
+ def check_name_availability_with_http_info(parameters, custom_headers = nil)
624
+ check_name_availability_async(parameters, custom_headers).value!
561
625
  end
562
626
 
563
627
  #
564
- # Creates or updates a new server.
628
+ # Determines whether a resource can be created with the specified name.
565
629
  #
566
- # @param resource_group_name [String] The name of the resource group that
567
- # contains the resource. You can obtain this value from the Azure Resource
568
- # Manager API or the portal.
569
- # @param server_name [String] The name of the server.
570
- # @param parameters [Server] The required parameters for creating or updating a
571
- # server.
630
+ # @param parameters [CheckNameAvailabilityRequest] The parameters to request
631
+ # for name availability.
572
632
  # @param [Hash{String => String}] A hash of custom headers that will be added
573
633
  # to the HTTP request.
574
634
  #
575
635
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
576
636
  #
577
- def create_or_update_async(resource_group_name, server_name, parameters, custom_headers = nil)
637
+ def check_name_availability_async(parameters, custom_headers = nil)
578
638
  api_version = '2014-04-01'
579
639
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
580
- fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
581
- fail ArgumentError, 'server_name is nil' if server_name.nil?
582
640
  fail ArgumentError, 'parameters is nil' if parameters.nil?
583
641
 
584
642
 
@@ -591,29 +649,29 @@ module Azure::ARM::SQL
591
649
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
592
650
 
593
651
  # Serialize Request
594
- request_mapper = Server.mapper()
595
- request_content = @client.serialize(request_mapper, parameters, 'parameters')
652
+ request_mapper = Azure::ARM::SQL::Models::CheckNameAvailabilityRequest.mapper()
653
+ request_content = @client.serialize(request_mapper, parameters)
596
654
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
597
655
 
598
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'
656
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability'
599
657
 
600
658
  request_url = @base_url || @client.base_url
601
659
 
602
660
  options = {
603
661
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
604
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
662
+ path_params: {'subscriptionId' => @client.subscription_id},
605
663
  query_params: {'api-version' => api_version},
606
664
  body: request_content,
607
665
  headers: request_headers.merge(custom_headers || {}),
608
666
  base_url: request_url
609
667
  }
610
- promise = @client.make_request_async(:put, path_template, options)
668
+ promise = @client.make_request_async(:post, path_template, options)
611
669
 
612
670
  promise = promise.then do |result|
613
671
  http_response = result.response
614
672
  status_code = http_response.status
615
673
  response_content = http_response.body
616
- unless status_code == 200 || status_code == 201
674
+ unless status_code == 200
617
675
  error_model = JSON.load(response_content)
618
676
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
619
677
  end
@@ -623,18 +681,8 @@ module Azure::ARM::SQL
623
681
  if status_code == 200
624
682
  begin
625
683
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
626
- result_mapper = Server.mapper()
627
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
628
- rescue Exception => e
629
- fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
630
- end
631
- end
632
- # Deserialize Response
633
- if status_code == 201
634
- begin
635
- parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
636
- result_mapper = Server.mapper()
637
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
684
+ result_mapper = Azure::ARM::SQL::Models::CheckNameAvailabilityResponse.mapper()
685
+ result.body = @client.deserialize(result_mapper, parsed_response)
638
686
  rescue Exception => e
639
687
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
640
688
  end
@@ -647,7 +695,7 @@ module Azure::ARM::SQL
647
695
  end
648
696
 
649
697
  #
650
- # Deletes a SQL server.
698
+ # Returns server usages.
651
699
  #
652
700
  # @param resource_group_name [String] The name of the resource group that
653
701
  # contains the resource. You can obtain this value from the Azure Resource
@@ -656,14 +704,15 @@ module Azure::ARM::SQL
656
704
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
657
705
  # will be added to the HTTP request.
658
706
  #
707
+ # @return [ServerUsageListResult] operation results.
659
708
  #
660
- def delete(resource_group_name, server_name, custom_headers = nil)
661
- response = delete_async(resource_group_name, server_name, custom_headers).value!
662
- nil
709
+ def list_usages(resource_group_name, server_name, custom_headers = nil)
710
+ response = list_usages_async(resource_group_name, server_name, custom_headers).value!
711
+ response.body unless response.nil?
663
712
  end
664
713
 
665
714
  #
666
- # Deletes a SQL server.
715
+ # Returns server usages.
667
716
  #
668
717
  # @param resource_group_name [String] The name of the resource group that
669
718
  # contains the resource. You can obtain this value from the Azure Resource
@@ -674,12 +723,12 @@ module Azure::ARM::SQL
674
723
  #
675
724
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
676
725
  #
677
- def delete_with_http_info(resource_group_name, server_name, custom_headers = nil)
678
- delete_async(resource_group_name, server_name, custom_headers).value!
726
+ def list_usages_with_http_info(resource_group_name, server_name, custom_headers = nil)
727
+ list_usages_async(resource_group_name, server_name, custom_headers).value!
679
728
  end
680
729
 
681
730
  #
682
- # Deletes a SQL server.
731
+ # Returns server usages.
683
732
  #
684
733
  # @param resource_group_name [String] The name of the resource group that
685
734
  # contains the resource. You can obtain this value from the Azure Resource
@@ -690,7 +739,7 @@ module Azure::ARM::SQL
690
739
  #
691
740
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
692
741
  #
693
- def delete_async(resource_group_name, server_name, custom_headers = nil)
742
+ def list_usages_async(resource_group_name, server_name, custom_headers = nil)
694
743
  api_version = '2014-04-01'
695
744
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
696
745
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
@@ -702,7 +751,7 @@ module Azure::ARM::SQL
702
751
  # Set Headers
703
752
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
704
753
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
705
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'
754
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages'
706
755
 
707
756
  request_url = @base_url || @client.base_url
708
757
 
@@ -713,18 +762,28 @@ module Azure::ARM::SQL
713
762
  headers: request_headers.merge(custom_headers || {}),
714
763
  base_url: request_url
715
764
  }
716
- promise = @client.make_request_async(:delete, path_template, options)
765
+ promise = @client.make_request_async(:get, path_template, options)
717
766
 
718
767
  promise = promise.then do |result|
719
768
  http_response = result.response
720
769
  status_code = http_response.status
721
770
  response_content = http_response.body
722
- unless status_code == 200 || status_code == 204
771
+ unless status_code == 200
723
772
  error_model = JSON.load(response_content)
724
773
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
725
774
  end
726
775
 
727
776
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
777
+ # Deserialize Response
778
+ if status_code == 200
779
+ begin
780
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
781
+ result_mapper = Azure::ARM::SQL::Models::ServerUsageListResult.mapper()
782
+ result.body = @client.deserialize(result_mapper, parsed_response)
783
+ rescue Exception => e
784
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
785
+ end
786
+ end
728
787
 
729
788
  result
730
789
  end
@@ -733,7 +792,7 @@ module Azure::ARM::SQL
733
792
  end
734
793
 
735
794
  #
736
- # Gets a server.
795
+ # Returns a list of the server encryption protectors
737
796
  #
738
797
  # @param resource_group_name [String] The name of the resource group that
739
798
  # contains the resource. You can obtain this value from the Azure Resource
@@ -742,15 +801,15 @@ module Azure::ARM::SQL
742
801
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
743
802
  # will be added to the HTTP request.
744
803
  #
745
- # @return [Server] operation results.
804
+ # @return [Array<EncryptionProtector>] operation results.
746
805
  #
747
- def get_by_resource_group(resource_group_name, server_name, custom_headers = nil)
748
- response = get_by_resource_group_async(resource_group_name, server_name, custom_headers).value!
749
- response.body unless response.nil?
806
+ def list_encryption_protectors(resource_group_name, server_name, custom_headers = nil)
807
+ first_page = list_encryption_protectors_as_lazy(resource_group_name, server_name, custom_headers)
808
+ first_page.get_all_items
750
809
  end
751
810
 
752
811
  #
753
- # Gets a server.
812
+ # Returns a list of the server encryption protectors
754
813
  #
755
814
  # @param resource_group_name [String] The name of the resource group that
756
815
  # contains the resource. You can obtain this value from the Azure Resource
@@ -761,12 +820,12 @@ module Azure::ARM::SQL
761
820
  #
762
821
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
763
822
  #
764
- def get_by_resource_group_with_http_info(resource_group_name, server_name, custom_headers = nil)
765
- get_by_resource_group_async(resource_group_name, server_name, custom_headers).value!
823
+ def list_encryption_protectors_with_http_info(resource_group_name, server_name, custom_headers = nil)
824
+ list_encryption_protectors_async(resource_group_name, server_name, custom_headers).value!
766
825
  end
767
826
 
768
827
  #
769
- # Gets a server.
828
+ # Returns a list of the server encryption protectors
770
829
  #
771
830
  # @param resource_group_name [String] The name of the resource group that
772
831
  # contains the resource. You can obtain this value from the Azure Resource
@@ -777,11 +836,11 @@ module Azure::ARM::SQL
777
836
  #
778
837
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
779
838
  #
780
- def get_by_resource_group_async(resource_group_name, server_name, custom_headers = nil)
781
- api_version = '2014-04-01'
782
- fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
839
+ def list_encryption_protectors_async(resource_group_name, server_name, custom_headers = nil)
783
840
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
784
841
  fail ArgumentError, 'server_name is nil' if server_name.nil?
842
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
843
+ api_version = '2015-05-01-preview'
785
844
 
786
845
 
787
846
  request_headers = {}
@@ -789,13 +848,13 @@ module Azure::ARM::SQL
789
848
  # Set Headers
790
849
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
791
850
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
792
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'
851
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector'
793
852
 
794
853
  request_url = @base_url || @client.base_url
795
854
 
796
855
  options = {
797
856
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
798
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
857
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
799
858
  query_params: {'api-version' => api_version},
800
859
  headers: request_headers.merge(custom_headers || {}),
801
860
  base_url: request_url
@@ -816,8 +875,8 @@ module Azure::ARM::SQL
816
875
  if status_code == 200
817
876
  begin
818
877
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
819
- result_mapper = Server.mapper()
820
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
878
+ result_mapper = Azure::ARM::SQL::Models::EncryptionProtectorListResult.mapper()
879
+ result.body = @client.deserialize(result_mapper, parsed_response)
821
880
  rescue Exception => e
822
881
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
823
882
  end
@@ -830,51 +889,56 @@ module Azure::ARM::SQL
830
889
  end
831
890
 
832
891
  #
833
- # Returns a list of servers in a resource group.
892
+ # Returns the server encryption protector.
834
893
  #
835
894
  # @param resource_group_name [String] The name of the resource group that
836
895
  # contains the resource. You can obtain this value from the Azure Resource
837
896
  # Manager API or the portal.
897
+ # @param server_name [String] The name of the server.
838
898
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
839
899
  # will be added to the HTTP request.
840
900
  #
841
- # @return [ServerListResult] operation results.
901
+ # @return [EncryptionProtector] operation results.
842
902
  #
843
- def list_by_resource_group(resource_group_name, custom_headers = nil)
844
- response = list_by_resource_group_async(resource_group_name, custom_headers).value!
903
+ def get_encryption_protector(resource_group_name, server_name, custom_headers = nil)
904
+ response = get_encryption_protector_async(resource_group_name, server_name, custom_headers).value!
845
905
  response.body unless response.nil?
846
906
  end
847
907
 
848
908
  #
849
- # Returns a list of servers in a resource group.
909
+ # Returns the server encryption protector.
850
910
  #
851
911
  # @param resource_group_name [String] The name of the resource group that
852
912
  # contains the resource. You can obtain this value from the Azure Resource
853
913
  # Manager API or the portal.
914
+ # @param server_name [String] The name of the server.
854
915
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
855
916
  # will be added to the HTTP request.
856
917
  #
857
918
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
858
919
  #
859
- def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
860
- list_by_resource_group_async(resource_group_name, custom_headers).value!
920
+ def get_encryption_protector_with_http_info(resource_group_name, server_name, custom_headers = nil)
921
+ get_encryption_protector_async(resource_group_name, server_name, custom_headers).value!
861
922
  end
862
923
 
863
924
  #
864
- # Returns a list of servers in a resource group.
925
+ # Returns the server encryption protector.
865
926
  #
866
927
  # @param resource_group_name [String] The name of the resource group that
867
928
  # contains the resource. You can obtain this value from the Azure Resource
868
929
  # Manager API or the portal.
930
+ # @param server_name [String] The name of the server.
869
931
  # @param [Hash{String => String}] A hash of custom headers that will be added
870
932
  # to the HTTP request.
871
933
  #
872
934
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
873
935
  #
874
- def list_by_resource_group_async(resource_group_name, custom_headers = nil)
875
- api_version = '2014-04-01'
876
- fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
936
+ def get_encryption_protector_async(resource_group_name, server_name, custom_headers = nil)
877
937
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
938
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
939
+ encryption_protector_name = 'current'
940
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
941
+ api_version = '2015-05-01-preview'
878
942
 
879
943
 
880
944
  request_headers = {}
@@ -882,13 +946,13 @@ module Azure::ARM::SQL
882
946
  # Set Headers
883
947
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
884
948
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
885
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers'
949
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}'
886
950
 
887
951
  request_url = @base_url || @client.base_url
888
952
 
889
953
  options = {
890
954
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
891
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
955
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'encryptionProtectorName' => encryption_protector_name,'subscriptionId' => @client.subscription_id},
892
956
  query_params: {'api-version' => api_version},
893
957
  headers: request_headers.merge(custom_headers || {}),
894
958
  base_url: request_url
@@ -909,8 +973,8 @@ module Azure::ARM::SQL
909
973
  if status_code == 200
910
974
  begin
911
975
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
912
- result_mapper = ServerListResult.mapper()
913
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
976
+ result_mapper = Azure::ARM::SQL::Models::EncryptionProtector.mapper()
977
+ result.body = @client.deserialize(result_mapper, parsed_response)
914
978
  rescue Exception => e
915
979
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
916
980
  end
@@ -923,55 +987,91 @@ module Azure::ARM::SQL
923
987
  end
924
988
 
925
989
  #
926
- # Returns server usages.
990
+ # Updates an existing encryption protector.
927
991
  #
928
992
  # @param resource_group_name [String] The name of the resource group that
929
993
  # contains the resource. You can obtain this value from the Azure Resource
930
994
  # Manager API or the portal.
931
995
  # @param server_name [String] The name of the server.
996
+ # @param parameters [EncryptionProtector] The requested encryption protector
997
+ # resource state.
932
998
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
933
999
  # will be added to the HTTP request.
934
1000
  #
935
- # @return [ServerMetricListResult] operation results.
1001
+ # @return [EncryptionProtector] operation results.
936
1002
  #
937
- def list_usages(resource_group_name, server_name, custom_headers = nil)
938
- response = list_usages_async(resource_group_name, server_name, custom_headers).value!
1003
+ def create_or_update_encryption_protector(resource_group_name, server_name, parameters, custom_headers = nil)
1004
+ response = create_or_update_encryption_protector_async(resource_group_name, server_name, parameters, custom_headers).value!
939
1005
  response.body unless response.nil?
940
1006
  end
941
1007
 
942
- #
943
- # Returns server usages.
944
1008
  #
945
1009
  # @param resource_group_name [String] The name of the resource group that
946
1010
  # contains the resource. You can obtain this value from the Azure Resource
947
1011
  # Manager API or the portal.
948
1012
  # @param server_name [String] The name of the server.
1013
+ # @param parameters [EncryptionProtector] The requested encryption protector
1014
+ # resource state.
1015
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1016
+ # will be added to the HTTP request.
1017
+ #
1018
+ # @return [Concurrent::Promise] promise which provides async access to http
1019
+ # response.
1020
+ #
1021
+ def create_or_update_encryption_protector_async(resource_group_name, server_name, parameters, custom_headers = nil)
1022
+ # Send request
1023
+ promise = begin_create_or_update_encryption_protector_async(resource_group_name, server_name, parameters, custom_headers)
1024
+
1025
+ promise = promise.then do |response|
1026
+ # Defining deserialization method.
1027
+ deserialize_method = lambda do |parsed_response|
1028
+ result_mapper = Azure::ARM::SQL::Models::EncryptionProtector.mapper()
1029
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1030
+ end
1031
+
1032
+ # Waiting for response.
1033
+ @client.get_long_running_operation_result(response, deserialize_method)
1034
+ end
1035
+
1036
+ promise
1037
+ end
1038
+
1039
+ #
1040
+ # Gets a list of all servers in the subscription.
1041
+ #
1042
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1043
+ # will be added to the HTTP request.
1044
+ #
1045
+ # @return [Array<Server>] operation results.
1046
+ #
1047
+ def list(custom_headers = nil)
1048
+ first_page = list_as_lazy(custom_headers)
1049
+ first_page.get_all_items
1050
+ end
1051
+
1052
+ #
1053
+ # Gets a list of all servers in the subscription.
1054
+ #
949
1055
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
950
1056
  # will be added to the HTTP request.
951
1057
  #
952
1058
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
953
1059
  #
954
- def list_usages_with_http_info(resource_group_name, server_name, custom_headers = nil)
955
- list_usages_async(resource_group_name, server_name, custom_headers).value!
1060
+ def list_with_http_info(custom_headers = nil)
1061
+ list_async(custom_headers).value!
956
1062
  end
957
1063
 
958
1064
  #
959
- # Returns server usages.
1065
+ # Gets a list of all servers in the subscription.
960
1066
  #
961
- # @param resource_group_name [String] The name of the resource group that
962
- # contains the resource. You can obtain this value from the Azure Resource
963
- # Manager API or the portal.
964
- # @param server_name [String] The name of the server.
965
1067
  # @param [Hash{String => String}] A hash of custom headers that will be added
966
1068
  # to the HTTP request.
967
1069
  #
968
1070
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
969
1071
  #
970
- def list_usages_async(resource_group_name, server_name, custom_headers = nil)
971
- api_version = '2014-04-01'
1072
+ def list_async(custom_headers = nil)
972
1073
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
973
- fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
974
- fail ArgumentError, 'server_name is nil' if server_name.nil?
1074
+ api_version = '2015-05-01-preview'
975
1075
 
976
1076
 
977
1077
  request_headers = {}
@@ -979,13 +1079,13 @@ module Azure::ARM::SQL
979
1079
  # Set Headers
980
1080
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
981
1081
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
982
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/usages'
1082
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers'
983
1083
 
984
1084
  request_url = @base_url || @client.base_url
985
1085
 
986
1086
  options = {
987
1087
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
988
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
1088
+ path_params: {'subscriptionId' => @client.subscription_id},
989
1089
  query_params: {'api-version' => api_version},
990
1090
  headers: request_headers.merge(custom_headers || {}),
991
1091
  base_url: request_url
@@ -1006,8 +1106,8 @@ module Azure::ARM::SQL
1006
1106
  if status_code == 200
1007
1107
  begin
1008
1108
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1009
- result_mapper = ServerMetricListResult.mapper()
1010
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1109
+ result_mapper = Azure::ARM::SQL::Models::ServerListResult.mapper()
1110
+ result.body = @client.deserialize(result_mapper, parsed_response)
1011
1111
  rescue Exception => e
1012
1112
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1013
1113
  end
@@ -1020,62 +1120,148 @@ module Azure::ARM::SQL
1020
1120
  end
1021
1121
 
1022
1122
  #
1023
- # Gets a database service objective.
1123
+ # Gets a list of servers in a resource groups.
1024
1124
  #
1025
1125
  # @param resource_group_name [String] The name of the resource group that
1026
1126
  # contains the resource. You can obtain this value from the Azure Resource
1027
1127
  # Manager API or the portal.
1028
- # @param server_name [String] The name of the server.
1029
- # @param service_objective_name [String] The name of the service objective to
1030
- # retrieve.
1031
1128
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1032
1129
  # will be added to the HTTP request.
1033
1130
  #
1034
- # @return [ServiceObjective] operation results.
1131
+ # @return [Array<Server>] operation results.
1035
1132
  #
1036
- def get_service_objective(resource_group_name, server_name, service_objective_name, custom_headers = nil)
1037
- response = get_service_objective_async(resource_group_name, server_name, service_objective_name, custom_headers).value!
1038
- response.body unless response.nil?
1133
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
1134
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers)
1135
+ first_page.get_all_items
1039
1136
  end
1040
1137
 
1041
1138
  #
1042
- # Gets a database service objective.
1139
+ # Gets a list of servers in a resource groups.
1140
+ #
1141
+ # @param resource_group_name [String] The name of the resource group that
1142
+ # contains the resource. You can obtain this value from the Azure Resource
1143
+ # Manager API or the portal.
1144
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1145
+ # will be added to the HTTP request.
1146
+ #
1147
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1148
+ #
1149
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
1150
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
1151
+ end
1152
+
1153
+ #
1154
+ # Gets a list of servers in a resource groups.
1155
+ #
1156
+ # @param resource_group_name [String] The name of the resource group that
1157
+ # contains the resource. You can obtain this value from the Azure Resource
1158
+ # Manager API or the portal.
1159
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1160
+ # to the HTTP request.
1161
+ #
1162
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1163
+ #
1164
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
1165
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1166
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1167
+ api_version = '2015-05-01-preview'
1168
+
1169
+
1170
+ request_headers = {}
1171
+
1172
+ # Set Headers
1173
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1174
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1175
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers'
1176
+
1177
+ request_url = @base_url || @client.base_url
1178
+
1179
+ options = {
1180
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1181
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
1182
+ query_params: {'api-version' => api_version},
1183
+ headers: request_headers.merge(custom_headers || {}),
1184
+ base_url: request_url
1185
+ }
1186
+ promise = @client.make_request_async(:get, path_template, options)
1187
+
1188
+ promise = promise.then do |result|
1189
+ http_response = result.response
1190
+ status_code = http_response.status
1191
+ response_content = http_response.body
1192
+ unless status_code == 200
1193
+ error_model = JSON.load(response_content)
1194
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1195
+ end
1196
+
1197
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1198
+ # Deserialize Response
1199
+ if status_code == 200
1200
+ begin
1201
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1202
+ result_mapper = Azure::ARM::SQL::Models::ServerListResult.mapper()
1203
+ result.body = @client.deserialize(result_mapper, parsed_response)
1204
+ rescue Exception => e
1205
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1206
+ end
1207
+ end
1208
+
1209
+ result
1210
+ end
1211
+
1212
+ promise.execute
1213
+ end
1214
+
1215
+ #
1216
+ # Gets a server.
1217
+ #
1218
+ # @param resource_group_name [String] The name of the resource group that
1219
+ # contains the resource. You can obtain this value from the Azure Resource
1220
+ # Manager API or the portal.
1221
+ # @param server_name [String] The name of the server.
1222
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1223
+ # will be added to the HTTP request.
1224
+ #
1225
+ # @return [Server] operation results.
1226
+ #
1227
+ def get(resource_group_name, server_name, custom_headers = nil)
1228
+ response = get_async(resource_group_name, server_name, custom_headers).value!
1229
+ response.body unless response.nil?
1230
+ end
1231
+
1232
+ #
1233
+ # Gets a server.
1043
1234
  #
1044
1235
  # @param resource_group_name [String] The name of the resource group that
1045
1236
  # contains the resource. You can obtain this value from the Azure Resource
1046
1237
  # Manager API or the portal.
1047
1238
  # @param server_name [String] The name of the server.
1048
- # @param service_objective_name [String] The name of the service objective to
1049
- # retrieve.
1050
1239
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1051
1240
  # will be added to the HTTP request.
1052
1241
  #
1053
1242
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1054
1243
  #
1055
- def get_service_objective_with_http_info(resource_group_name, server_name, service_objective_name, custom_headers = nil)
1056
- get_service_objective_async(resource_group_name, server_name, service_objective_name, custom_headers).value!
1244
+ def get_with_http_info(resource_group_name, server_name, custom_headers = nil)
1245
+ get_async(resource_group_name, server_name, custom_headers).value!
1057
1246
  end
1058
1247
 
1059
1248
  #
1060
- # Gets a database service objective.
1249
+ # Gets a server.
1061
1250
  #
1062
1251
  # @param resource_group_name [String] The name of the resource group that
1063
1252
  # contains the resource. You can obtain this value from the Azure Resource
1064
1253
  # Manager API or the portal.
1065
1254
  # @param server_name [String] The name of the server.
1066
- # @param service_objective_name [String] The name of the service objective to
1067
- # retrieve.
1068
1255
  # @param [Hash{String => String}] A hash of custom headers that will be added
1069
1256
  # to the HTTP request.
1070
1257
  #
1071
1258
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1072
1259
  #
1073
- def get_service_objective_async(resource_group_name, server_name, service_objective_name, custom_headers = nil)
1074
- api_version = '2014-04-01'
1075
- fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1260
+ def get_async(resource_group_name, server_name, custom_headers = nil)
1076
1261
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1077
1262
  fail ArgumentError, 'server_name is nil' if server_name.nil?
1078
- fail ArgumentError, 'service_objective_name is nil' if service_objective_name.nil?
1263
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1264
+ api_version = '2015-05-01-preview'
1079
1265
 
1080
1266
 
1081
1267
  request_headers = {}
@@ -1083,13 +1269,13 @@ module Azure::ARM::SQL
1083
1269
  # Set Headers
1084
1270
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1085
1271
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1086
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives/{serviceObjectiveName}'
1272
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'
1087
1273
 
1088
1274
  request_url = @base_url || @client.base_url
1089
1275
 
1090
1276
  options = {
1091
1277
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1092
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'serviceObjectiveName' => service_objective_name},
1278
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
1093
1279
  query_params: {'api-version' => api_version},
1094
1280
  headers: request_headers.merge(custom_headers || {}),
1095
1281
  base_url: request_url
@@ -1110,8 +1296,8 @@ module Azure::ARM::SQL
1110
1296
  if status_code == 200
1111
1297
  begin
1112
1298
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1113
- result_mapper = ServiceObjective.mapper()
1114
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1299
+ result_mapper = Azure::ARM::SQL::Models::Server.mapper()
1300
+ result.body = @client.deserialize(result_mapper, parsed_response)
1115
1301
  rescue Exception => e
1116
1302
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1117
1303
  end
@@ -1124,55 +1310,201 @@ module Azure::ARM::SQL
1124
1310
  end
1125
1311
 
1126
1312
  #
1127
- # Returns database service objectives.
1313
+ # Creates or updates a server.
1128
1314
  #
1129
1315
  # @param resource_group_name [String] The name of the resource group that
1130
1316
  # contains the resource. You can obtain this value from the Azure Resource
1131
1317
  # Manager API or the portal.
1132
1318
  # @param server_name [String] The name of the server.
1319
+ # @param parameters [Server] The requested server resource state.
1133
1320
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1134
1321
  # will be added to the HTTP request.
1135
1322
  #
1136
- # @return [ServiceObjectiveListResult] operation results.
1323
+ # @return [Server] operation results.
1137
1324
  #
1138
- def list_service_objectives(resource_group_name, server_name, custom_headers = nil)
1139
- response = list_service_objectives_async(resource_group_name, server_name, custom_headers).value!
1325
+ def create_or_update(resource_group_name, server_name, parameters, custom_headers = nil)
1326
+ response = create_or_update_async(resource_group_name, server_name, parameters, custom_headers).value!
1140
1327
  response.body unless response.nil?
1141
1328
  end
1142
1329
 
1143
1330
  #
1144
- # Returns database service objectives.
1331
+ # @param resource_group_name [String] The name of the resource group that
1332
+ # contains the resource. You can obtain this value from the Azure Resource
1333
+ # Manager API or the portal.
1334
+ # @param server_name [String] The name of the server.
1335
+ # @param parameters [Server] The requested server resource state.
1336
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1337
+ # will be added to the HTTP request.
1338
+ #
1339
+ # @return [Concurrent::Promise] promise which provides async access to http
1340
+ # response.
1341
+ #
1342
+ def create_or_update_async(resource_group_name, server_name, parameters, custom_headers = nil)
1343
+ # Send request
1344
+ promise = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers)
1345
+
1346
+ promise = promise.then do |response|
1347
+ # Defining deserialization method.
1348
+ deserialize_method = lambda do |parsed_response|
1349
+ result_mapper = Azure::ARM::SQL::Models::Server.mapper()
1350
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1351
+ end
1352
+
1353
+ # Waiting for response.
1354
+ @client.get_long_running_operation_result(response, deserialize_method)
1355
+ end
1356
+
1357
+ promise
1358
+ end
1359
+
1360
+ #
1361
+ # Deletes a server.
1362
+ #
1363
+ # @param resource_group_name [String] The name of the resource group that
1364
+ # contains the resource. You can obtain this value from the Azure Resource
1365
+ # Manager API or the portal.
1366
+ # @param server_name [String] The name of the server.
1367
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1368
+ # will be added to the HTTP request.
1369
+ #
1370
+ def delete(resource_group_name, server_name, custom_headers = nil)
1371
+ response = delete_async(resource_group_name, server_name, custom_headers).value!
1372
+ nil
1373
+ end
1374
+
1375
+ #
1376
+ # @param resource_group_name [String] The name of the resource group that
1377
+ # contains the resource. You can obtain this value from the Azure Resource
1378
+ # Manager API or the portal.
1379
+ # @param server_name [String] The name of the server.
1380
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1381
+ # will be added to the HTTP request.
1382
+ #
1383
+ # @return [Concurrent::Promise] promise which provides async access to http
1384
+ # response.
1385
+ #
1386
+ def delete_async(resource_group_name, server_name, custom_headers = nil)
1387
+ # Send request
1388
+ promise = begin_delete_async(resource_group_name, server_name, custom_headers)
1389
+
1390
+ promise = promise.then do |response|
1391
+ # Defining deserialization method.
1392
+ deserialize_method = lambda do |parsed_response|
1393
+ end
1394
+
1395
+ # Waiting for response.
1396
+ @client.get_long_running_operation_result(response, deserialize_method)
1397
+ end
1398
+
1399
+ promise
1400
+ end
1401
+
1402
+ #
1403
+ # Updates a server.
1404
+ #
1405
+ # @param resource_group_name [String] The name of the resource group that
1406
+ # contains the resource. You can obtain this value from the Azure Resource
1407
+ # Manager API or the portal.
1408
+ # @param server_name [String] The name of the server.
1409
+ # @param parameters [ServerUpdate] The requested server resource state.
1410
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1411
+ # will be added to the HTTP request.
1412
+ #
1413
+ # @return [Server] operation results.
1414
+ #
1415
+ def update(resource_group_name, server_name, parameters, custom_headers = nil)
1416
+ response = update_async(resource_group_name, server_name, parameters, custom_headers).value!
1417
+ response.body unless response.nil?
1418
+ end
1419
+
1420
+ #
1421
+ # @param resource_group_name [String] The name of the resource group that
1422
+ # contains the resource. You can obtain this value from the Azure Resource
1423
+ # Manager API or the portal.
1424
+ # @param server_name [String] The name of the server.
1425
+ # @param parameters [ServerUpdate] The requested server resource state.
1426
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1427
+ # will be added to the HTTP request.
1428
+ #
1429
+ # @return [Concurrent::Promise] promise which provides async access to http
1430
+ # response.
1431
+ #
1432
+ def update_async(resource_group_name, server_name, parameters, custom_headers = nil)
1433
+ # Send request
1434
+ promise = begin_update_async(resource_group_name, server_name, parameters, custom_headers)
1435
+
1436
+ promise = promise.then do |response|
1437
+ # Defining deserialization method.
1438
+ deserialize_method = lambda do |parsed_response|
1439
+ result_mapper = Azure::ARM::SQL::Models::Server.mapper()
1440
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1441
+ end
1442
+
1443
+ # Waiting for response.
1444
+ @client.get_long_running_operation_result(response, deserialize_method)
1445
+ end
1446
+
1447
+ promise
1448
+ end
1449
+
1450
+ #
1451
+ # Updates a server backup long term retention vault
1452
+ #
1453
+ # @param resource_group_name [String] The name of the resource group that
1454
+ # contains the resource. You can obtain this value from the Azure Resource
1455
+ # Manager API or the portal.
1456
+ # @param server_name [String] The name of the server.
1457
+ # @param parameters [BackupLongTermRetentionVault] The required parameters to
1458
+ # update a backup long term retention vault
1459
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1460
+ # will be added to the HTTP request.
1461
+ #
1462
+ # @return [BackupLongTermRetentionVault] operation results.
1463
+ #
1464
+ def begin_create_backup_long_term_retention_vault(resource_group_name, server_name, parameters, custom_headers = nil)
1465
+ response = begin_create_backup_long_term_retention_vault_async(resource_group_name, server_name, parameters, custom_headers).value!
1466
+ response.body unless response.nil?
1467
+ end
1468
+
1469
+ #
1470
+ # Updates a server backup long term retention vault
1145
1471
  #
1146
1472
  # @param resource_group_name [String] The name of the resource group that
1147
1473
  # contains the resource. You can obtain this value from the Azure Resource
1148
1474
  # Manager API or the portal.
1149
1475
  # @param server_name [String] The name of the server.
1476
+ # @param parameters [BackupLongTermRetentionVault] The required parameters to
1477
+ # update a backup long term retention vault
1150
1478
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
1151
1479
  # will be added to the HTTP request.
1152
1480
  #
1153
1481
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1154
1482
  #
1155
- def list_service_objectives_with_http_info(resource_group_name, server_name, custom_headers = nil)
1156
- list_service_objectives_async(resource_group_name, server_name, custom_headers).value!
1483
+ def begin_create_backup_long_term_retention_vault_with_http_info(resource_group_name, server_name, parameters, custom_headers = nil)
1484
+ begin_create_backup_long_term_retention_vault_async(resource_group_name, server_name, parameters, custom_headers).value!
1157
1485
  end
1158
1486
 
1159
1487
  #
1160
- # Returns database service objectives.
1488
+ # Updates a server backup long term retention vault
1161
1489
  #
1162
1490
  # @param resource_group_name [String] The name of the resource group that
1163
1491
  # contains the resource. You can obtain this value from the Azure Resource
1164
1492
  # Manager API or the portal.
1165
1493
  # @param server_name [String] The name of the server.
1494
+ # @param parameters [BackupLongTermRetentionVault] The required parameters to
1495
+ # update a backup long term retention vault
1166
1496
  # @param [Hash{String => String}] A hash of custom headers that will be added
1167
1497
  # to the HTTP request.
1168
1498
  #
1169
1499
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1170
1500
  #
1171
- def list_service_objectives_async(resource_group_name, server_name, custom_headers = nil)
1501
+ def begin_create_backup_long_term_retention_vault_async(resource_group_name, server_name, parameters, custom_headers = nil)
1172
1502
  api_version = '2014-04-01'
1173
1503
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1174
1504
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1175
1505
  fail ArgumentError, 'server_name is nil' if server_name.nil?
1506
+ backup_long_term_retention_vault_name = 'RegisteredVault'
1507
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1176
1508
 
1177
1509
 
1178
1510
  request_headers = {}
@@ -1180,24 +1512,33 @@ module Azure::ARM::SQL
1180
1512
  # Set Headers
1181
1513
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1182
1514
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1183
- path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/serviceObjectives'
1515
+
1516
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1517
+
1518
+ # Serialize Request
1519
+ request_mapper = Azure::ARM::SQL::Models::BackupLongTermRetentionVault.mapper()
1520
+ request_content = @client.serialize(request_mapper, parameters)
1521
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1522
+
1523
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/backupLongTermRetentionVaults/{backupLongTermRetentionVaultName}'
1184
1524
 
1185
1525
  request_url = @base_url || @client.base_url
1186
1526
 
1187
1527
  options = {
1188
1528
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1189
- path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name},
1529
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serverName' => server_name,'backupLongTermRetentionVaultName' => backup_long_term_retention_vault_name},
1190
1530
  query_params: {'api-version' => api_version},
1531
+ body: request_content,
1191
1532
  headers: request_headers.merge(custom_headers || {}),
1192
1533
  base_url: request_url
1193
1534
  }
1194
- promise = @client.make_request_async(:get, path_template, options)
1535
+ promise = @client.make_request_async(:put, path_template, options)
1195
1536
 
1196
1537
  promise = promise.then do |result|
1197
1538
  http_response = result.response
1198
1539
  status_code = http_response.status
1199
1540
  response_content = http_response.body
1200
- unless status_code == 200
1541
+ unless status_code == 200 || status_code == 201 || status_code == 202
1201
1542
  error_model = JSON.load(response_content)
1202
1543
  fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1203
1544
  end
@@ -1207,8 +1548,18 @@ module Azure::ARM::SQL
1207
1548
  if status_code == 200
1208
1549
  begin
1209
1550
  parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1210
- result_mapper = ServiceObjectiveListResult.mapper()
1211
- result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1551
+ result_mapper = Azure::ARM::SQL::Models::BackupLongTermRetentionVault.mapper()
1552
+ result.body = @client.deserialize(result_mapper, parsed_response)
1553
+ rescue Exception => e
1554
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1555
+ end
1556
+ end
1557
+ # Deserialize Response
1558
+ if status_code == 201
1559
+ begin
1560
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1561
+ result_mapper = Azure::ARM::SQL::Models::BackupLongTermRetentionVault.mapper()
1562
+ result.body = @client.deserialize(result_mapper, parsed_response)
1212
1563
  rescue Exception => e
1213
1564
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1214
1565
  end
@@ -1220,5 +1571,763 @@ module Azure::ARM::SQL
1220
1571
  promise.execute
1221
1572
  end
1222
1573
 
1574
+ #
1575
+ # Updates an existing encryption protector.
1576
+ #
1577
+ # @param resource_group_name [String] The name of the resource group that
1578
+ # contains the resource. You can obtain this value from the Azure Resource
1579
+ # Manager API or the portal.
1580
+ # @param server_name [String] The name of the server.
1581
+ # @param parameters [EncryptionProtector] The requested encryption protector
1582
+ # resource state.
1583
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1584
+ # will be added to the HTTP request.
1585
+ #
1586
+ # @return [EncryptionProtector] operation results.
1587
+ #
1588
+ def begin_create_or_update_encryption_protector(resource_group_name, server_name, parameters, custom_headers = nil)
1589
+ response = begin_create_or_update_encryption_protector_async(resource_group_name, server_name, parameters, custom_headers).value!
1590
+ response.body unless response.nil?
1591
+ end
1592
+
1593
+ #
1594
+ # Updates an existing encryption protector.
1595
+ #
1596
+ # @param resource_group_name [String] The name of the resource group that
1597
+ # contains the resource. You can obtain this value from the Azure Resource
1598
+ # Manager API or the portal.
1599
+ # @param server_name [String] The name of the server.
1600
+ # @param parameters [EncryptionProtector] The requested encryption protector
1601
+ # resource state.
1602
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1603
+ # will be added to the HTTP request.
1604
+ #
1605
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1606
+ #
1607
+ def begin_create_or_update_encryption_protector_with_http_info(resource_group_name, server_name, parameters, custom_headers = nil)
1608
+ begin_create_or_update_encryption_protector_async(resource_group_name, server_name, parameters, custom_headers).value!
1609
+ end
1610
+
1611
+ #
1612
+ # Updates an existing encryption protector.
1613
+ #
1614
+ # @param resource_group_name [String] The name of the resource group that
1615
+ # contains the resource. You can obtain this value from the Azure Resource
1616
+ # Manager API or the portal.
1617
+ # @param server_name [String] The name of the server.
1618
+ # @param parameters [EncryptionProtector] The requested encryption protector
1619
+ # resource state.
1620
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1621
+ # to the HTTP request.
1622
+ #
1623
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1624
+ #
1625
+ def begin_create_or_update_encryption_protector_async(resource_group_name, server_name, parameters, custom_headers = nil)
1626
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1627
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1628
+ encryption_protector_name = 'current'
1629
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1630
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1631
+ api_version = '2015-05-01-preview'
1632
+
1633
+
1634
+ request_headers = {}
1635
+
1636
+ # Set Headers
1637
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1638
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1639
+
1640
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1641
+
1642
+ # Serialize Request
1643
+ request_mapper = Azure::ARM::SQL::Models::EncryptionProtector.mapper()
1644
+ request_content = @client.serialize(request_mapper, parameters)
1645
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1646
+
1647
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/encryptionProtector/{encryptionProtectorName}'
1648
+
1649
+ request_url = @base_url || @client.base_url
1650
+
1651
+ options = {
1652
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1653
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'encryptionProtectorName' => encryption_protector_name,'subscriptionId' => @client.subscription_id},
1654
+ query_params: {'api-version' => api_version},
1655
+ body: request_content,
1656
+ headers: request_headers.merge(custom_headers || {}),
1657
+ base_url: request_url
1658
+ }
1659
+ promise = @client.make_request_async(:put, path_template, options)
1660
+
1661
+ promise = promise.then do |result|
1662
+ http_response = result.response
1663
+ status_code = http_response.status
1664
+ response_content = http_response.body
1665
+ unless status_code == 200 || status_code == 202
1666
+ error_model = JSON.load(response_content)
1667
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1668
+ end
1669
+
1670
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1671
+ # Deserialize Response
1672
+ if status_code == 200
1673
+ begin
1674
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1675
+ result_mapper = Azure::ARM::SQL::Models::EncryptionProtector.mapper()
1676
+ result.body = @client.deserialize(result_mapper, parsed_response)
1677
+ rescue Exception => e
1678
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1679
+ end
1680
+ end
1681
+
1682
+ result
1683
+ end
1684
+
1685
+ promise.execute
1686
+ end
1687
+
1688
+ #
1689
+ # Creates or updates a server.
1690
+ #
1691
+ # @param resource_group_name [String] The name of the resource group that
1692
+ # contains the resource. You can obtain this value from the Azure Resource
1693
+ # Manager API or the portal.
1694
+ # @param server_name [String] The name of the server.
1695
+ # @param parameters [Server] The requested server resource state.
1696
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1697
+ # will be added to the HTTP request.
1698
+ #
1699
+ # @return [Server] operation results.
1700
+ #
1701
+ def begin_create_or_update(resource_group_name, server_name, parameters, custom_headers = nil)
1702
+ response = begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers).value!
1703
+ response.body unless response.nil?
1704
+ end
1705
+
1706
+ #
1707
+ # Creates or updates a server.
1708
+ #
1709
+ # @param resource_group_name [String] The name of the resource group that
1710
+ # contains the resource. You can obtain this value from the Azure Resource
1711
+ # Manager API or the portal.
1712
+ # @param server_name [String] The name of the server.
1713
+ # @param parameters [Server] The requested server resource state.
1714
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1715
+ # will be added to the HTTP request.
1716
+ #
1717
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1718
+ #
1719
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, parameters, custom_headers = nil)
1720
+ begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers).value!
1721
+ end
1722
+
1723
+ #
1724
+ # Creates or updates a server.
1725
+ #
1726
+ # @param resource_group_name [String] The name of the resource group that
1727
+ # contains the resource. You can obtain this value from the Azure Resource
1728
+ # Manager API or the portal.
1729
+ # @param server_name [String] The name of the server.
1730
+ # @param parameters [Server] The requested server resource state.
1731
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1732
+ # to the HTTP request.
1733
+ #
1734
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1735
+ #
1736
+ def begin_create_or_update_async(resource_group_name, server_name, parameters, custom_headers = nil)
1737
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1738
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1739
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1740
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1741
+ api_version = '2015-05-01-preview'
1742
+
1743
+
1744
+ request_headers = {}
1745
+
1746
+ # Set Headers
1747
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1748
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1749
+
1750
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1751
+
1752
+ # Serialize Request
1753
+ request_mapper = Azure::ARM::SQL::Models::Server.mapper()
1754
+ request_content = @client.serialize(request_mapper, parameters)
1755
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1756
+
1757
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'
1758
+
1759
+ request_url = @base_url || @client.base_url
1760
+
1761
+ options = {
1762
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1763
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
1764
+ query_params: {'api-version' => api_version},
1765
+ body: request_content,
1766
+ headers: request_headers.merge(custom_headers || {}),
1767
+ base_url: request_url
1768
+ }
1769
+ promise = @client.make_request_async(:put, path_template, options)
1770
+
1771
+ promise = promise.then do |result|
1772
+ http_response = result.response
1773
+ status_code = http_response.status
1774
+ response_content = http_response.body
1775
+ unless status_code == 200 || status_code == 202 || status_code == 201
1776
+ error_model = JSON.load(response_content)
1777
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1778
+ end
1779
+
1780
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1781
+ # Deserialize Response
1782
+ if status_code == 200
1783
+ begin
1784
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1785
+ result_mapper = Azure::ARM::SQL::Models::Server.mapper()
1786
+ result.body = @client.deserialize(result_mapper, parsed_response)
1787
+ rescue Exception => e
1788
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1789
+ end
1790
+ end
1791
+ # Deserialize Response
1792
+ if status_code == 201
1793
+ begin
1794
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1795
+ result_mapper = Azure::ARM::SQL::Models::Server.mapper()
1796
+ result.body = @client.deserialize(result_mapper, parsed_response)
1797
+ rescue Exception => e
1798
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1799
+ end
1800
+ end
1801
+
1802
+ result
1803
+ end
1804
+
1805
+ promise.execute
1806
+ end
1807
+
1808
+ #
1809
+ # Deletes a server.
1810
+ #
1811
+ # @param resource_group_name [String] The name of the resource group that
1812
+ # contains the resource. You can obtain this value from the Azure Resource
1813
+ # Manager API or the portal.
1814
+ # @param server_name [String] The name of the server.
1815
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1816
+ # will be added to the HTTP request.
1817
+ #
1818
+ #
1819
+ def begin_delete(resource_group_name, server_name, custom_headers = nil)
1820
+ response = begin_delete_async(resource_group_name, server_name, custom_headers).value!
1821
+ nil
1822
+ end
1823
+
1824
+ #
1825
+ # Deletes a server.
1826
+ #
1827
+ # @param resource_group_name [String] The name of the resource group that
1828
+ # contains the resource. You can obtain this value from the Azure Resource
1829
+ # Manager API or the portal.
1830
+ # @param server_name [String] The name of the server.
1831
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1832
+ # will be added to the HTTP request.
1833
+ #
1834
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1835
+ #
1836
+ def begin_delete_with_http_info(resource_group_name, server_name, custom_headers = nil)
1837
+ begin_delete_async(resource_group_name, server_name, custom_headers).value!
1838
+ end
1839
+
1840
+ #
1841
+ # Deletes a server.
1842
+ #
1843
+ # @param resource_group_name [String] The name of the resource group that
1844
+ # contains the resource. You can obtain this value from the Azure Resource
1845
+ # Manager API or the portal.
1846
+ # @param server_name [String] The name of the server.
1847
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1848
+ # to the HTTP request.
1849
+ #
1850
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1851
+ #
1852
+ def begin_delete_async(resource_group_name, server_name, custom_headers = nil)
1853
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1854
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1855
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1856
+ api_version = '2015-05-01-preview'
1857
+
1858
+
1859
+ request_headers = {}
1860
+
1861
+ # Set Headers
1862
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1863
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1864
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'
1865
+
1866
+ request_url = @base_url || @client.base_url
1867
+
1868
+ options = {
1869
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1870
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
1871
+ query_params: {'api-version' => api_version},
1872
+ headers: request_headers.merge(custom_headers || {}),
1873
+ base_url: request_url
1874
+ }
1875
+ promise = @client.make_request_async(:delete, path_template, options)
1876
+
1877
+ promise = promise.then do |result|
1878
+ http_response = result.response
1879
+ status_code = http_response.status
1880
+ response_content = http_response.body
1881
+ unless status_code == 200 || status_code == 202 || status_code == 204
1882
+ error_model = JSON.load(response_content)
1883
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1884
+ end
1885
+
1886
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1887
+
1888
+ result
1889
+ end
1890
+
1891
+ promise.execute
1892
+ end
1893
+
1894
+ #
1895
+ # Updates a server.
1896
+ #
1897
+ # @param resource_group_name [String] The name of the resource group that
1898
+ # contains the resource. You can obtain this value from the Azure Resource
1899
+ # Manager API or the portal.
1900
+ # @param server_name [String] The name of the server.
1901
+ # @param parameters [ServerUpdate] The requested server resource state.
1902
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1903
+ # will be added to the HTTP request.
1904
+ #
1905
+ # @return [Server] operation results.
1906
+ #
1907
+ def begin_update(resource_group_name, server_name, parameters, custom_headers = nil)
1908
+ response = begin_update_async(resource_group_name, server_name, parameters, custom_headers).value!
1909
+ response.body unless response.nil?
1910
+ end
1911
+
1912
+ #
1913
+ # Updates a server.
1914
+ #
1915
+ # @param resource_group_name [String] The name of the resource group that
1916
+ # contains the resource. You can obtain this value from the Azure Resource
1917
+ # Manager API or the portal.
1918
+ # @param server_name [String] The name of the server.
1919
+ # @param parameters [ServerUpdate] The requested server resource state.
1920
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1921
+ # will be added to the HTTP request.
1922
+ #
1923
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1924
+ #
1925
+ def begin_update_with_http_info(resource_group_name, server_name, parameters, custom_headers = nil)
1926
+ begin_update_async(resource_group_name, server_name, parameters, custom_headers).value!
1927
+ end
1928
+
1929
+ #
1930
+ # Updates a server.
1931
+ #
1932
+ # @param resource_group_name [String] The name of the resource group that
1933
+ # contains the resource. You can obtain this value from the Azure Resource
1934
+ # Manager API or the portal.
1935
+ # @param server_name [String] The name of the server.
1936
+ # @param parameters [ServerUpdate] The requested server resource state.
1937
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1938
+ # to the HTTP request.
1939
+ #
1940
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1941
+ #
1942
+ def begin_update_async(resource_group_name, server_name, parameters, custom_headers = nil)
1943
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1944
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
1945
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1946
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1947
+ api_version = '2015-05-01-preview'
1948
+
1949
+
1950
+ request_headers = {}
1951
+
1952
+ # Set Headers
1953
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1954
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1955
+
1956
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1957
+
1958
+ # Serialize Request
1959
+ request_mapper = Azure::ARM::SQL::Models::ServerUpdate.mapper()
1960
+ request_content = @client.serialize(request_mapper, parameters)
1961
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1962
+
1963
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}'
1964
+
1965
+ request_url = @base_url || @client.base_url
1966
+
1967
+ options = {
1968
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1969
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
1970
+ query_params: {'api-version' => api_version},
1971
+ body: request_content,
1972
+ headers: request_headers.merge(custom_headers || {}),
1973
+ base_url: request_url
1974
+ }
1975
+ promise = @client.make_request_async(:patch, path_template, options)
1976
+
1977
+ promise = promise.then do |result|
1978
+ http_response = result.response
1979
+ status_code = http_response.status
1980
+ response_content = http_response.body
1981
+ unless status_code == 200 || status_code == 202
1982
+ error_model = JSON.load(response_content)
1983
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1984
+ end
1985
+
1986
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1987
+ # Deserialize Response
1988
+ if status_code == 200
1989
+ begin
1990
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1991
+ result_mapper = Azure::ARM::SQL::Models::Server.mapper()
1992
+ result.body = @client.deserialize(result_mapper, parsed_response)
1993
+ rescue Exception => e
1994
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1995
+ end
1996
+ end
1997
+
1998
+ result
1999
+ end
2000
+
2001
+ promise.execute
2002
+ end
2003
+
2004
+ #
2005
+ # Returns a list of the server encryption protectors
2006
+ #
2007
+ # @param next_page_link [String] The NextLink from the previous successful call
2008
+ # to List operation.
2009
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2010
+ # will be added to the HTTP request.
2011
+ #
2012
+ # @return [EncryptionProtectorListResult] operation results.
2013
+ #
2014
+ def list_encryption_protectors_next(next_page_link, custom_headers = nil)
2015
+ response = list_encryption_protectors_next_async(next_page_link, custom_headers).value!
2016
+ response.body unless response.nil?
2017
+ end
2018
+
2019
+ #
2020
+ # Returns a list of the server encryption protectors
2021
+ #
2022
+ # @param next_page_link [String] The NextLink from the previous successful call
2023
+ # to List operation.
2024
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2025
+ # will be added to the HTTP request.
2026
+ #
2027
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2028
+ #
2029
+ def list_encryption_protectors_next_with_http_info(next_page_link, custom_headers = nil)
2030
+ list_encryption_protectors_next_async(next_page_link, custom_headers).value!
2031
+ end
2032
+
2033
+ #
2034
+ # Returns a list of the server encryption protectors
2035
+ #
2036
+ # @param next_page_link [String] The NextLink from the previous successful call
2037
+ # to List operation.
2038
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2039
+ # to the HTTP request.
2040
+ #
2041
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2042
+ #
2043
+ def list_encryption_protectors_next_async(next_page_link, custom_headers = nil)
2044
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2045
+
2046
+
2047
+ request_headers = {}
2048
+
2049
+ # Set Headers
2050
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2051
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2052
+ path_template = '{nextLink}'
2053
+
2054
+ request_url = @base_url || @client.base_url
2055
+
2056
+ options = {
2057
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2058
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2059
+ headers: request_headers.merge(custom_headers || {}),
2060
+ base_url: request_url
2061
+ }
2062
+ promise = @client.make_request_async(:get, path_template, options)
2063
+
2064
+ promise = promise.then do |result|
2065
+ http_response = result.response
2066
+ status_code = http_response.status
2067
+ response_content = http_response.body
2068
+ unless status_code == 200
2069
+ error_model = JSON.load(response_content)
2070
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2071
+ end
2072
+
2073
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2074
+ # Deserialize Response
2075
+ if status_code == 200
2076
+ begin
2077
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2078
+ result_mapper = Azure::ARM::SQL::Models::EncryptionProtectorListResult.mapper()
2079
+ result.body = @client.deserialize(result_mapper, parsed_response)
2080
+ rescue Exception => e
2081
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2082
+ end
2083
+ end
2084
+
2085
+ result
2086
+ end
2087
+
2088
+ promise.execute
2089
+ end
2090
+
2091
+ #
2092
+ # Gets a list of all servers in the subscription.
2093
+ #
2094
+ # @param next_page_link [String] The NextLink from the previous successful call
2095
+ # to List operation.
2096
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2097
+ # will be added to the HTTP request.
2098
+ #
2099
+ # @return [ServerListResult] operation results.
2100
+ #
2101
+ def list_next(next_page_link, custom_headers = nil)
2102
+ response = list_next_async(next_page_link, custom_headers).value!
2103
+ response.body unless response.nil?
2104
+ end
2105
+
2106
+ #
2107
+ # Gets a list of all servers in the subscription.
2108
+ #
2109
+ # @param next_page_link [String] The NextLink from the previous successful call
2110
+ # to List operation.
2111
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2112
+ # will be added to the HTTP request.
2113
+ #
2114
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2115
+ #
2116
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
2117
+ list_next_async(next_page_link, custom_headers).value!
2118
+ end
2119
+
2120
+ #
2121
+ # Gets a list of all servers in the subscription.
2122
+ #
2123
+ # @param next_page_link [String] The NextLink from the previous successful call
2124
+ # to List operation.
2125
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2126
+ # to the HTTP request.
2127
+ #
2128
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2129
+ #
2130
+ def list_next_async(next_page_link, custom_headers = nil)
2131
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2132
+
2133
+
2134
+ request_headers = {}
2135
+
2136
+ # Set Headers
2137
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2138
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2139
+ path_template = '{nextLink}'
2140
+
2141
+ request_url = @base_url || @client.base_url
2142
+
2143
+ options = {
2144
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2145
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2146
+ headers: request_headers.merge(custom_headers || {}),
2147
+ base_url: request_url
2148
+ }
2149
+ promise = @client.make_request_async(:get, path_template, options)
2150
+
2151
+ promise = promise.then do |result|
2152
+ http_response = result.response
2153
+ status_code = http_response.status
2154
+ response_content = http_response.body
2155
+ unless status_code == 200
2156
+ error_model = JSON.load(response_content)
2157
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2158
+ end
2159
+
2160
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2161
+ # Deserialize Response
2162
+ if status_code == 200
2163
+ begin
2164
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2165
+ result_mapper = Azure::ARM::SQL::Models::ServerListResult.mapper()
2166
+ result.body = @client.deserialize(result_mapper, parsed_response)
2167
+ rescue Exception => e
2168
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2169
+ end
2170
+ end
2171
+
2172
+ result
2173
+ end
2174
+
2175
+ promise.execute
2176
+ end
2177
+
2178
+ #
2179
+ # Gets a list of servers in a resource groups.
2180
+ #
2181
+ # @param next_page_link [String] The NextLink from the previous successful call
2182
+ # to List operation.
2183
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2184
+ # will be added to the HTTP request.
2185
+ #
2186
+ # @return [ServerListResult] operation results.
2187
+ #
2188
+ def list_by_resource_group_next(next_page_link, custom_headers = nil)
2189
+ response = list_by_resource_group_next_async(next_page_link, custom_headers).value!
2190
+ response.body unless response.nil?
2191
+ end
2192
+
2193
+ #
2194
+ # Gets a list of servers in a resource groups.
2195
+ #
2196
+ # @param next_page_link [String] The NextLink from the previous successful call
2197
+ # to List operation.
2198
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2199
+ # will be added to the HTTP request.
2200
+ #
2201
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2202
+ #
2203
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers = nil)
2204
+ list_by_resource_group_next_async(next_page_link, custom_headers).value!
2205
+ end
2206
+
2207
+ #
2208
+ # Gets a list of servers in a resource groups.
2209
+ #
2210
+ # @param next_page_link [String] The NextLink from the previous successful call
2211
+ # to List operation.
2212
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2213
+ # to the HTTP request.
2214
+ #
2215
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2216
+ #
2217
+ def list_by_resource_group_next_async(next_page_link, custom_headers = nil)
2218
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2219
+
2220
+
2221
+ request_headers = {}
2222
+
2223
+ # Set Headers
2224
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2225
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2226
+ path_template = '{nextLink}'
2227
+
2228
+ request_url = @base_url || @client.base_url
2229
+
2230
+ options = {
2231
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2232
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2233
+ headers: request_headers.merge(custom_headers || {}),
2234
+ base_url: request_url
2235
+ }
2236
+ promise = @client.make_request_async(:get, path_template, options)
2237
+
2238
+ promise = promise.then do |result|
2239
+ http_response = result.response
2240
+ status_code = http_response.status
2241
+ response_content = http_response.body
2242
+ unless status_code == 200
2243
+ error_model = JSON.load(response_content)
2244
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2245
+ end
2246
+
2247
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2248
+ # Deserialize Response
2249
+ if status_code == 200
2250
+ begin
2251
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2252
+ result_mapper = Azure::ARM::SQL::Models::ServerListResult.mapper()
2253
+ result.body = @client.deserialize(result_mapper, parsed_response)
2254
+ rescue Exception => e
2255
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2256
+ end
2257
+ end
2258
+
2259
+ result
2260
+ end
2261
+
2262
+ promise.execute
2263
+ end
2264
+
2265
+ #
2266
+ # Returns a list of the server encryption protectors
2267
+ #
2268
+ # @param resource_group_name [String] The name of the resource group that
2269
+ # contains the resource. You can obtain this value from the Azure Resource
2270
+ # Manager API or the portal.
2271
+ # @param server_name [String] The name of the server.
2272
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2273
+ # will be added to the HTTP request.
2274
+ #
2275
+ # @return [EncryptionProtectorListResult] which provide lazy access to pages of
2276
+ # the response.
2277
+ #
2278
+ def list_encryption_protectors_as_lazy(resource_group_name, server_name, custom_headers = nil)
2279
+ response = list_encryption_protectors_async(resource_group_name, server_name, custom_headers).value!
2280
+ unless response.nil?
2281
+ page = response.body
2282
+ page.next_method = Proc.new do |next_page_link|
2283
+ list_encryption_protectors_next_async(next_page_link, custom_headers)
2284
+ end
2285
+ page
2286
+ end
2287
+ end
2288
+
2289
+ #
2290
+ # Gets a list of all servers in the subscription.
2291
+ #
2292
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2293
+ # will be added to the HTTP request.
2294
+ #
2295
+ # @return [ServerListResult] which provide lazy access to pages of the
2296
+ # response.
2297
+ #
2298
+ def list_as_lazy(custom_headers = nil)
2299
+ response = list_async(custom_headers).value!
2300
+ unless response.nil?
2301
+ page = response.body
2302
+ page.next_method = Proc.new do |next_page_link|
2303
+ list_next_async(next_page_link, custom_headers)
2304
+ end
2305
+ page
2306
+ end
2307
+ end
2308
+
2309
+ #
2310
+ # Gets a list of servers in a resource groups.
2311
+ #
2312
+ # @param resource_group_name [String] The name of the resource group that
2313
+ # contains the resource. You can obtain this value from the Azure Resource
2314
+ # Manager API or the portal.
2315
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2316
+ # will be added to the HTTP request.
2317
+ #
2318
+ # @return [ServerListResult] which provide lazy access to pages of the
2319
+ # response.
2320
+ #
2321
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers = nil)
2322
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
2323
+ unless response.nil?
2324
+ page = response.body
2325
+ page.next_method = Proc.new do |next_page_link|
2326
+ list_by_resource_group_next_async(next_page_link, custom_headers)
2327
+ end
2328
+ page
2329
+ end
2330
+ end
2331
+
1223
2332
  end
1224
2333
  end