azure_mgmt_sql 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_sql.rb +95 -46
  3. data/lib/generated/azure_mgmt_sql/backup_long_term_retention_policies.rb +310 -0
  4. data/lib/generated/azure_mgmt_sql/backup_long_term_retention_vaults.rb +300 -0
  5. data/lib/generated/azure_mgmt_sql/data_masking_policies.rb +248 -0
  6. data/lib/generated/azure_mgmt_sql/data_masking_rules.rb +262 -0
  7. data/lib/generated/azure_mgmt_sql/database_blob_auditing_policies.rb +264 -0
  8. data/lib/generated/azure_mgmt_sql/database_threat_detection_policies.rb +264 -0
  9. data/lib/generated/azure_mgmt_sql/database_usages.rb +129 -0
  10. data/lib/generated/azure_mgmt_sql/databases.rb +357 -2825
  11. data/lib/generated/azure_mgmt_sql/elastic_pool_activities.rb +132 -0
  12. data/lib/generated/azure_mgmt_sql/elastic_pool_database_activities.rb +129 -0
  13. data/lib/generated/azure_mgmt_sql/elastic_pools.rb +0 -417
  14. data/lib/generated/azure_mgmt_sql/encryption_protectors.rb +498 -0
  15. data/lib/generated/azure_mgmt_sql/failover_groups.rb +6 -6
  16. data/lib/generated/azure_mgmt_sql/geo_backup_policies.rb +359 -0
  17. data/lib/generated/azure_mgmt_sql/models/database_usage.rb +4 -9
  18. data/lib/generated/azure_mgmt_sql/models/encryption_protector.rb +3 -4
  19. data/lib/generated/azure_mgmt_sql/models/failover_group.rb +2 -2
  20. data/lib/generated/azure_mgmt_sql/models/failover_group_read_write_endpoint.rb +6 -4
  21. data/lib/generated/azure_mgmt_sql/models/failover_group_update.rb +93 -0
  22. data/lib/generated/azure_mgmt_sql/models/firewall_rule.rb +11 -14
  23. data/lib/generated/azure_mgmt_sql/models/metric_value.rb +1 -17
  24. data/lib/generated/azure_mgmt_sql/models/operation.rb +36 -3
  25. data/lib/generated/azure_mgmt_sql/models/operation_display.rb +20 -5
  26. data/lib/generated/azure_mgmt_sql/models/operation_list_result.rb +36 -6
  27. data/lib/generated/azure_mgmt_sql/models/operation_origin.rb +16 -0
  28. data/lib/generated/azure_mgmt_sql/models/partner_info.rb +1 -1
  29. data/lib/generated/azure_mgmt_sql/models/replication_link.rb +9 -12
  30. data/lib/generated/azure_mgmt_sql/models/server_azure_adadministrator.rb +11 -3
  31. data/lib/generated/azure_mgmt_sql/models/server_key.rb +3 -4
  32. data/lib/generated/azure_mgmt_sql/models/service_objective.rb +11 -3
  33. data/lib/generated/azure_mgmt_sql/models/service_tier_advisor.rb +11 -3
  34. data/lib/generated/azure_mgmt_sql/models/sync_agent.rb +137 -0
  35. data/lib/generated/azure_mgmt_sql/models/{sql_sub_resource.rb → sync_agent_key_properties.rb} +9 -20
  36. data/lib/generated/azure_mgmt_sql/models/sync_agent_linked_database.rb +126 -0
  37. data/lib/generated/azure_mgmt_sql/models/sync_agent_linked_database_list_result.rb +96 -0
  38. data/lib/generated/azure_mgmt_sql/models/sync_agent_list_result.rb +96 -0
  39. data/lib/generated/azure_mgmt_sql/models/sync_agent_state.rb +17 -0
  40. data/lib/generated/azure_mgmt_sql/models/sync_conflict_resolution_policy.rb +16 -0
  41. data/lib/generated/azure_mgmt_sql/models/sync_database_id_list_result.rb +96 -0
  42. data/lib/generated/azure_mgmt_sql/models/{sub_resource.rb → sync_database_id_properties.rb} +7 -15
  43. data/lib/generated/azure_mgmt_sql/models/sync_direction.rb +17 -0
  44. data/lib/generated/azure_mgmt_sql/models/sync_full_schema_properties.rb +66 -0
  45. data/lib/generated/azure_mgmt_sql/models/sync_full_schema_properties_list_result.rb +96 -0
  46. data/lib/generated/azure_mgmt_sql/models/sync_full_schema_table.rb +99 -0
  47. data/lib/generated/azure_mgmt_sql/models/sync_full_schema_table_column.rb +112 -0
  48. data/lib/generated/azure_mgmt_sql/models/sync_group.rb +145 -0
  49. data/lib/generated/azure_mgmt_sql/models/sync_group_list_result.rb +96 -0
  50. data/lib/generated/azure_mgmt_sql/models/sync_group_log_list_result.rb +96 -0
  51. data/lib/generated/azure_mgmt_sql/models/sync_group_log_properties.rb +102 -0
  52. data/lib/generated/azure_mgmt_sql/models/sync_group_log_type.rb +18 -0
  53. data/lib/generated/azure_mgmt_sql/models/sync_group_schema.rb +64 -0
  54. data/lib/generated/azure_mgmt_sql/models/sync_group_schema_table.rb +64 -0
  55. data/lib/generated/azure_mgmt_sql/models/sync_group_schema_table_column.rb +65 -0
  56. data/lib/generated/azure_mgmt_sql/models/sync_group_state.rb +19 -0
  57. data/lib/generated/azure_mgmt_sql/models/sync_member.rb +160 -0
  58. data/lib/generated/azure_mgmt_sql/models/sync_member_db_type.rb +16 -0
  59. data/lib/generated/azure_mgmt_sql/models/sync_member_list_result.rb +96 -0
  60. data/lib/generated/azure_mgmt_sql/models/sync_member_state.rb +32 -0
  61. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption.rb +22 -3
  62. data/lib/generated/azure_mgmt_sql/models/transparent_data_encryption_activity.rb +22 -3
  63. data/lib/generated/azure_mgmt_sql/models/virtual_network_rule.rb +2 -2
  64. data/lib/generated/azure_mgmt_sql/operations.rb +111 -4
  65. data/lib/generated/azure_mgmt_sql/recommended_elastic_pools.rb +3 -215
  66. data/lib/generated/azure_mgmt_sql/replication_links.rb +629 -0
  67. data/lib/generated/azure_mgmt_sql/restore_points.rb +132 -0
  68. data/lib/generated/azure_mgmt_sql/server_azure_adadministrators.rb +5 -5
  69. data/lib/generated/azure_mgmt_sql/server_connection_policies.rb +250 -0
  70. data/lib/generated/azure_mgmt_sql/server_keys.rb +10 -10
  71. data/lib/generated/azure_mgmt_sql/server_usages.rb +125 -0
  72. data/lib/generated/azure_mgmt_sql/servers.rb +161 -1423
  73. data/lib/generated/azure_mgmt_sql/service_objectives.rb +229 -0
  74. data/lib/generated/azure_mgmt_sql/service_tier_advisors.rb +234 -0
  75. data/lib/generated/azure_mgmt_sql/sql_management_client.rb +100 -9
  76. data/lib/generated/azure_mgmt_sql/sync_agents.rb +983 -0
  77. data/lib/generated/azure_mgmt_sql/sync_groups.rb +1863 -0
  78. data/lib/generated/azure_mgmt_sql/sync_members.rb +1290 -0
  79. data/lib/generated/azure_mgmt_sql/transparent_data_encryption_activities.rb +133 -0
  80. data/lib/generated/azure_mgmt_sql/transparent_data_encryptions.rb +264 -0
  81. data/lib/generated/azure_mgmt_sql/version.rb +1 -1
  82. metadata +55 -6
@@ -32,11 +32,15 @@ module Azure::ARM::SQL
32
32
  # is generated and included in each request. Default is true.
33
33
  attr_accessor :generate_client_request_id
34
34
 
35
- # @return [Databases] databases
36
- attr_reader :databases
35
+ # @return [BackupLongTermRetentionPolicies]
36
+ # backup_long_term_retention_policies
37
+ attr_reader :backup_long_term_retention_policies
37
38
 
38
- # @return [Servers] servers
39
- attr_reader :servers
39
+ # @return [BackupLongTermRetentionVaults] backup_long_term_retention_vaults
40
+ attr_reader :backup_long_term_retention_vaults
41
+
42
+ # @return [RestorePoints] restore_points
43
+ attr_reader :restore_points
40
44
 
41
45
  # @return [RecoverableDatabases] recoverable_databases
42
46
  attr_reader :recoverable_databases
@@ -47,14 +51,33 @@ module Azure::ARM::SQL
47
51
  # @return [Capabilities] capabilities
48
52
  attr_reader :capabilities
49
53
 
54
+ # @return [ServerConnectionPolicies] server_connection_policies
55
+ attr_reader :server_connection_policies
56
+
57
+ # @return [DatabaseThreatDetectionPolicies]
58
+ # database_threat_detection_policies
59
+ attr_reader :database_threat_detection_policies
60
+
61
+ # @return [DataMaskingPolicies] data_masking_policies
62
+ attr_reader :data_masking_policies
63
+
64
+ # @return [DataMaskingRules] data_masking_rules
65
+ attr_reader :data_masking_rules
66
+
50
67
  # @return [FirewallRules] firewall_rules
51
68
  attr_reader :firewall_rules
52
69
 
70
+ # @return [GeoBackupPolicies] geo_backup_policies
71
+ attr_reader :geo_backup_policies
72
+
73
+ # @return [Databases] databases
74
+ attr_reader :databases
75
+
53
76
  # @return [ElasticPools] elastic_pools
54
77
  attr_reader :elastic_pools
55
78
 
56
- # @return [Operations] operations
57
- attr_reader :operations
79
+ # @return [ReplicationLinks] replication_links
80
+ attr_reader :replication_links
58
81
 
59
82
  # @return [ServerAzureADAdministrators] server_azure_adadministrators
60
83
  attr_reader :server_azure_adadministrators
@@ -62,15 +85,61 @@ module Azure::ARM::SQL
62
85
  # @return [ServerCommunicationLinks] server_communication_links
63
86
  attr_reader :server_communication_links
64
87
 
88
+ # @return [ServiceObjectives] service_objectives
89
+ attr_reader :service_objectives
90
+
91
+ # @return [Servers] servers
92
+ attr_reader :servers
93
+
94
+ # @return [ElasticPoolActivities] elastic_pool_activities
95
+ attr_reader :elastic_pool_activities
96
+
97
+ # @return [ElasticPoolDatabaseActivities] elastic_pool_database_activities
98
+ attr_reader :elastic_pool_database_activities
99
+
65
100
  # @return [RecommendedElasticPools] recommended_elastic_pools
66
101
  attr_reader :recommended_elastic_pools
67
102
 
103
+ # @return [ServiceTierAdvisors] service_tier_advisors
104
+ attr_reader :service_tier_advisors
105
+
106
+ # @return [TransparentDataEncryptions] transparent_data_encryptions
107
+ attr_reader :transparent_data_encryptions
108
+
109
+ # @return [TransparentDataEncryptionActivities]
110
+ # transparent_data_encryption_activities
111
+ attr_reader :transparent_data_encryption_activities
112
+
113
+ # @return [ServerUsages] server_usages
114
+ attr_reader :server_usages
115
+
116
+ # @return [DatabaseUsages] database_usages
117
+ attr_reader :database_usages
118
+
119
+ # @return [DatabaseBlobAuditingPolicies] database_blob_auditing_policies
120
+ attr_reader :database_blob_auditing_policies
121
+
122
+ # @return [EncryptionProtectors] encryption_protectors
123
+ attr_reader :encryption_protectors
124
+
68
125
  # @return [FailoverGroups] failover_groups
69
126
  attr_reader :failover_groups
70
127
 
128
+ # @return [Operations] operations
129
+ attr_reader :operations
130
+
71
131
  # @return [ServerKeys] server_keys
72
132
  attr_reader :server_keys
73
133
 
134
+ # @return [SyncAgents] sync_agents
135
+ attr_reader :sync_agents
136
+
137
+ # @return [SyncGroups] sync_groups
138
+ attr_reader :sync_groups
139
+
140
+ # @return [SyncMembers] sync_members
141
+ attr_reader :sync_members
142
+
74
143
  # @return [VirtualNetworkRules] virtual_network_rules
75
144
  attr_reader :virtual_network_rules
76
145
 
@@ -87,19 +156,41 @@ module Azure::ARM::SQL
87
156
  fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
88
157
  @credentials = credentials
89
158
 
90
- @databases = Databases.new(self)
91
- @servers = Servers.new(self)
159
+ @backup_long_term_retention_policies = BackupLongTermRetentionPolicies.new(self)
160
+ @backup_long_term_retention_vaults = BackupLongTermRetentionVaults.new(self)
161
+ @restore_points = RestorePoints.new(self)
92
162
  @recoverable_databases = RecoverableDatabases.new(self)
93
163
  @restorable_dropped_databases = RestorableDroppedDatabases.new(self)
94
164
  @capabilities = Capabilities.new(self)
165
+ @server_connection_policies = ServerConnectionPolicies.new(self)
166
+ @database_threat_detection_policies = DatabaseThreatDetectionPolicies.new(self)
167
+ @data_masking_policies = DataMaskingPolicies.new(self)
168
+ @data_masking_rules = DataMaskingRules.new(self)
95
169
  @firewall_rules = FirewallRules.new(self)
170
+ @geo_backup_policies = GeoBackupPolicies.new(self)
171
+ @databases = Databases.new(self)
96
172
  @elastic_pools = ElasticPools.new(self)
97
- @operations = Operations.new(self)
173
+ @replication_links = ReplicationLinks.new(self)
98
174
  @server_azure_adadministrators = ServerAzureADAdministrators.new(self)
99
175
  @server_communication_links = ServerCommunicationLinks.new(self)
176
+ @service_objectives = ServiceObjectives.new(self)
177
+ @servers = Servers.new(self)
178
+ @elastic_pool_activities = ElasticPoolActivities.new(self)
179
+ @elastic_pool_database_activities = ElasticPoolDatabaseActivities.new(self)
100
180
  @recommended_elastic_pools = RecommendedElasticPools.new(self)
181
+ @service_tier_advisors = ServiceTierAdvisors.new(self)
182
+ @transparent_data_encryptions = TransparentDataEncryptions.new(self)
183
+ @transparent_data_encryption_activities = TransparentDataEncryptionActivities.new(self)
184
+ @server_usages = ServerUsages.new(self)
185
+ @database_usages = DatabaseUsages.new(self)
186
+ @database_blob_auditing_policies = DatabaseBlobAuditingPolicies.new(self)
187
+ @encryption_protectors = EncryptionProtectors.new(self)
101
188
  @failover_groups = FailoverGroups.new(self)
189
+ @operations = Operations.new(self)
102
190
  @server_keys = ServerKeys.new(self)
191
+ @sync_agents = SyncAgents.new(self)
192
+ @sync_groups = SyncGroups.new(self)
193
+ @sync_members = SyncMembers.new(self)
103
194
  @virtual_network_rules = VirtualNetworkRules.new(self)
104
195
  @accept_language = 'en-US'
105
196
  @long_running_operation_retry_timeout = 30
@@ -0,0 +1,983 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::SQL
7
+ #
8
+ # The Azure SQL Database management API provides a RESTful set of web
9
+ # services that interact with Azure SQL Database services to manage your
10
+ # databases. The API enables you to create, retrieve, update, and delete
11
+ # databases.
12
+ #
13
+ class SyncAgents
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the SyncAgents class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [SqlManagementClient] reference to the SqlManagementClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Gets a sync agent.
29
+ #
30
+ # @param resource_group_name [String] The name of the resource group that
31
+ # contains the resource. You can obtain this value from the Azure Resource
32
+ # Manager API or the portal.
33
+ # @param server_name [String] The name of the server on which the sync agent is
34
+ # hosted.
35
+ # @param sync_agent_name [String] The name of the sync agent.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [SyncAgent] operation results.
40
+ #
41
+ def get(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
42
+ response = get_async(resource_group_name, server_name, sync_agent_name, custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # Gets a sync agent.
48
+ #
49
+ # @param resource_group_name [String] The name of the resource group that
50
+ # contains the resource. You can obtain this value from the Azure Resource
51
+ # Manager API or the portal.
52
+ # @param server_name [String] The name of the server on which the sync agent is
53
+ # hosted.
54
+ # @param sync_agent_name [String] The name of the sync agent.
55
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
56
+ # will be added to the HTTP request.
57
+ #
58
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
59
+ #
60
+ def get_with_http_info(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
61
+ get_async(resource_group_name, server_name, sync_agent_name, custom_headers).value!
62
+ end
63
+
64
+ #
65
+ # Gets a sync agent.
66
+ #
67
+ # @param resource_group_name [String] The name of the resource group that
68
+ # contains the resource. You can obtain this value from the Azure Resource
69
+ # Manager API or the portal.
70
+ # @param server_name [String] The name of the server on which the sync agent is
71
+ # hosted.
72
+ # @param sync_agent_name [String] The name of the sync agent.
73
+ # @param [Hash{String => String}] A hash of custom headers that will be added
74
+ # to the HTTP request.
75
+ #
76
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
77
+ #
78
+ def get_async(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
79
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
80
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
81
+ fail ArgumentError, 'sync_agent_name is nil' if sync_agent_name.nil?
82
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
83
+ api_version = '2015-05-01-preview'
84
+
85
+
86
+ request_headers = {}
87
+
88
+ # Set Headers
89
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
90
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
91
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}'
92
+
93
+ request_url = @base_url || @client.base_url
94
+
95
+ options = {
96
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
97
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'syncAgentName' => sync_agent_name,'subscriptionId' => @client.subscription_id},
98
+ query_params: {'api-version' => api_version},
99
+ headers: request_headers.merge(custom_headers || {}),
100
+ base_url: request_url
101
+ }
102
+ promise = @client.make_request_async(:get, path_template, options)
103
+
104
+ promise = promise.then do |result|
105
+ http_response = result.response
106
+ status_code = http_response.status
107
+ response_content = http_response.body
108
+ unless status_code == 200
109
+ error_model = JSON.load(response_content)
110
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
111
+ end
112
+
113
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
114
+ # Deserialize Response
115
+ if status_code == 200
116
+ begin
117
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
118
+ result_mapper = Azure::ARM::SQL::Models::SyncAgent.mapper()
119
+ result.body = @client.deserialize(result_mapper, parsed_response)
120
+ rescue Exception => e
121
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
122
+ end
123
+ end
124
+
125
+ result
126
+ end
127
+
128
+ promise.execute
129
+ end
130
+
131
+ #
132
+ # Creates or updates a sync agent.
133
+ #
134
+ # @param resource_group_name [String] The name of the resource group that
135
+ # contains the resource. You can obtain this value from the Azure Resource
136
+ # Manager API or the portal.
137
+ # @param server_name [String] The name of the server on which the sync agent is
138
+ # hosted.
139
+ # @param sync_agent_name [String] The name of the sync agent.
140
+ # @param parameters [SyncAgent] The requested sync agent resource state.
141
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
142
+ # will be added to the HTTP request.
143
+ #
144
+ # @return [SyncAgent] operation results.
145
+ #
146
+ def create_or_update(resource_group_name, server_name, sync_agent_name, parameters, custom_headers = nil)
147
+ response = create_or_update_async(resource_group_name, server_name, sync_agent_name, parameters, custom_headers).value!
148
+ response.body unless response.nil?
149
+ end
150
+
151
+ #
152
+ # @param resource_group_name [String] The name of the resource group that
153
+ # contains the resource. You can obtain this value from the Azure Resource
154
+ # Manager API or the portal.
155
+ # @param server_name [String] The name of the server on which the sync agent is
156
+ # hosted.
157
+ # @param sync_agent_name [String] The name of the sync agent.
158
+ # @param parameters [SyncAgent] The requested sync agent resource state.
159
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
160
+ # will be added to the HTTP request.
161
+ #
162
+ # @return [Concurrent::Promise] promise which provides async access to http
163
+ # response.
164
+ #
165
+ def create_or_update_async(resource_group_name, server_name, sync_agent_name, parameters, custom_headers = nil)
166
+ # Send request
167
+ promise = begin_create_or_update_async(resource_group_name, server_name, sync_agent_name, parameters, custom_headers)
168
+
169
+ promise = promise.then do |response|
170
+ # Defining deserialization method.
171
+ deserialize_method = lambda do |parsed_response|
172
+ result_mapper = Azure::ARM::SQL::Models::SyncAgent.mapper()
173
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
174
+ end
175
+
176
+ # Waiting for response.
177
+ @client.get_long_running_operation_result(response, deserialize_method)
178
+ end
179
+
180
+ promise
181
+ end
182
+
183
+ #
184
+ # Deletes a sync agent.
185
+ #
186
+ # @param resource_group_name [String] The name of the resource group that
187
+ # contains the resource. You can obtain this value from the Azure Resource
188
+ # Manager API or the portal.
189
+ # @param server_name [String] The name of the server on which the sync agent is
190
+ # hosted.
191
+ # @param sync_agent_name [String] The name of the sync agent.
192
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
193
+ # will be added to the HTTP request.
194
+ #
195
+ def delete(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
196
+ response = delete_async(resource_group_name, server_name, sync_agent_name, custom_headers).value!
197
+ nil
198
+ end
199
+
200
+ #
201
+ # @param resource_group_name [String] The name of the resource group that
202
+ # contains the resource. You can obtain this value from the Azure Resource
203
+ # Manager API or the portal.
204
+ # @param server_name [String] The name of the server on which the sync agent is
205
+ # hosted.
206
+ # @param sync_agent_name [String] The name of the sync agent.
207
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
208
+ # will be added to the HTTP request.
209
+ #
210
+ # @return [Concurrent::Promise] promise which provides async access to http
211
+ # response.
212
+ #
213
+ def delete_async(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
214
+ # Send request
215
+ promise = begin_delete_async(resource_group_name, server_name, sync_agent_name, custom_headers)
216
+
217
+ promise = promise.then do |response|
218
+ # Defining deserialization method.
219
+ deserialize_method = lambda do |parsed_response|
220
+ end
221
+
222
+ # Waiting for response.
223
+ @client.get_long_running_operation_result(response, deserialize_method)
224
+ end
225
+
226
+ promise
227
+ end
228
+
229
+ #
230
+ # Lists sync agents in a server.
231
+ #
232
+ # @param resource_group_name [String] The name of the resource group that
233
+ # contains the resource. You can obtain this value from the Azure Resource
234
+ # Manager API or the portal.
235
+ # @param server_name [String] The name of the server on which the sync agent is
236
+ # hosted.
237
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
238
+ # will be added to the HTTP request.
239
+ #
240
+ # @return [Array<SyncAgent>] operation results.
241
+ #
242
+ def list_by_server(resource_group_name, server_name, custom_headers = nil)
243
+ first_page = list_by_server_as_lazy(resource_group_name, server_name, custom_headers)
244
+ first_page.get_all_items
245
+ end
246
+
247
+ #
248
+ # Lists sync agents in a server.
249
+ #
250
+ # @param resource_group_name [String] The name of the resource group that
251
+ # contains the resource. You can obtain this value from the Azure Resource
252
+ # Manager API or the portal.
253
+ # @param server_name [String] The name of the server on which the sync agent is
254
+ # hosted.
255
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
256
+ # will be added to the HTTP request.
257
+ #
258
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
259
+ #
260
+ def list_by_server_with_http_info(resource_group_name, server_name, custom_headers = nil)
261
+ list_by_server_async(resource_group_name, server_name, custom_headers).value!
262
+ end
263
+
264
+ #
265
+ # Lists sync agents in a server.
266
+ #
267
+ # @param resource_group_name [String] The name of the resource group that
268
+ # contains the resource. You can obtain this value from the Azure Resource
269
+ # Manager API or the portal.
270
+ # @param server_name [String] The name of the server on which the sync agent is
271
+ # hosted.
272
+ # @param [Hash{String => String}] A hash of custom headers that will be added
273
+ # to the HTTP request.
274
+ #
275
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
276
+ #
277
+ def list_by_server_async(resource_group_name, server_name, custom_headers = nil)
278
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
279
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
280
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
281
+ api_version = '2015-05-01-preview'
282
+
283
+
284
+ request_headers = {}
285
+
286
+ # Set Headers
287
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
288
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
289
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents'
290
+
291
+ request_url = @base_url || @client.base_url
292
+
293
+ options = {
294
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
295
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
296
+ query_params: {'api-version' => api_version},
297
+ headers: request_headers.merge(custom_headers || {}),
298
+ base_url: request_url
299
+ }
300
+ promise = @client.make_request_async(:get, path_template, options)
301
+
302
+ promise = promise.then do |result|
303
+ http_response = result.response
304
+ status_code = http_response.status
305
+ response_content = http_response.body
306
+ unless status_code == 200
307
+ error_model = JSON.load(response_content)
308
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
309
+ end
310
+
311
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
312
+ # Deserialize Response
313
+ if status_code == 200
314
+ begin
315
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
316
+ result_mapper = Azure::ARM::SQL::Models::SyncAgentListResult.mapper()
317
+ result.body = @client.deserialize(result_mapper, parsed_response)
318
+ rescue Exception => e
319
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
320
+ end
321
+ end
322
+
323
+ result
324
+ end
325
+
326
+ promise.execute
327
+ end
328
+
329
+ #
330
+ # Generates a sync agent key.
331
+ #
332
+ # @param resource_group_name [String] The name of the resource group that
333
+ # contains the resource. You can obtain this value from the Azure Resource
334
+ # Manager API or the portal.
335
+ # @param server_name [String] The name of the server on which the sync agent is
336
+ # hosted.
337
+ # @param sync_agent_name [String] The name of the sync agent.
338
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
339
+ # will be added to the HTTP request.
340
+ #
341
+ # @return [SyncAgentKeyProperties] operation results.
342
+ #
343
+ def generate_key(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
344
+ response = generate_key_async(resource_group_name, server_name, sync_agent_name, custom_headers).value!
345
+ response.body unless response.nil?
346
+ end
347
+
348
+ #
349
+ # Generates a sync agent key.
350
+ #
351
+ # @param resource_group_name [String] The name of the resource group that
352
+ # contains the resource. You can obtain this value from the Azure Resource
353
+ # Manager API or the portal.
354
+ # @param server_name [String] The name of the server on which the sync agent is
355
+ # hosted.
356
+ # @param sync_agent_name [String] The name of the sync agent.
357
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
358
+ # will be added to the HTTP request.
359
+ #
360
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
361
+ #
362
+ def generate_key_with_http_info(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
363
+ generate_key_async(resource_group_name, server_name, sync_agent_name, custom_headers).value!
364
+ end
365
+
366
+ #
367
+ # Generates a sync agent key.
368
+ #
369
+ # @param resource_group_name [String] The name of the resource group that
370
+ # contains the resource. You can obtain this value from the Azure Resource
371
+ # Manager API or the portal.
372
+ # @param server_name [String] The name of the server on which the sync agent is
373
+ # hosted.
374
+ # @param sync_agent_name [String] The name of the sync agent.
375
+ # @param [Hash{String => String}] A hash of custom headers that will be added
376
+ # to the HTTP request.
377
+ #
378
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
379
+ #
380
+ def generate_key_async(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
381
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
382
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
383
+ fail ArgumentError, 'sync_agent_name is nil' if sync_agent_name.nil?
384
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
385
+ api_version = '2015-05-01-preview'
386
+
387
+
388
+ request_headers = {}
389
+
390
+ # Set Headers
391
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
392
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
393
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}/generateKey'
394
+
395
+ request_url = @base_url || @client.base_url
396
+
397
+ options = {
398
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
399
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'syncAgentName' => sync_agent_name,'subscriptionId' => @client.subscription_id},
400
+ query_params: {'api-version' => api_version},
401
+ headers: request_headers.merge(custom_headers || {}),
402
+ base_url: request_url
403
+ }
404
+ promise = @client.make_request_async(:post, path_template, options)
405
+
406
+ promise = promise.then do |result|
407
+ http_response = result.response
408
+ status_code = http_response.status
409
+ response_content = http_response.body
410
+ unless status_code == 200
411
+ error_model = JSON.load(response_content)
412
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
413
+ end
414
+
415
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
416
+ # Deserialize Response
417
+ if status_code == 200
418
+ begin
419
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
420
+ result_mapper = Azure::ARM::SQL::Models::SyncAgentKeyProperties.mapper()
421
+ result.body = @client.deserialize(result_mapper, parsed_response)
422
+ rescue Exception => e
423
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
424
+ end
425
+ end
426
+
427
+ result
428
+ end
429
+
430
+ promise.execute
431
+ end
432
+
433
+ #
434
+ # Lists databases linked to a sync agent.
435
+ #
436
+ # @param resource_group_name [String] The name of the resource group that
437
+ # contains the resource. You can obtain this value from the Azure Resource
438
+ # Manager API or the portal.
439
+ # @param server_name [String] The name of the server on which the sync agent is
440
+ # hosted.
441
+ # @param sync_agent_name [String] The name of the sync agent.
442
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
443
+ # will be added to the HTTP request.
444
+ #
445
+ # @return [Array<SyncAgentLinkedDatabase>] operation results.
446
+ #
447
+ def list_linked_databases(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
448
+ first_page = list_linked_databases_as_lazy(resource_group_name, server_name, sync_agent_name, custom_headers)
449
+ first_page.get_all_items
450
+ end
451
+
452
+ #
453
+ # Lists databases linked to a sync agent.
454
+ #
455
+ # @param resource_group_name [String] The name of the resource group that
456
+ # contains the resource. You can obtain this value from the Azure Resource
457
+ # Manager API or the portal.
458
+ # @param server_name [String] The name of the server on which the sync agent is
459
+ # hosted.
460
+ # @param sync_agent_name [String] The name of the sync agent.
461
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
462
+ # will be added to the HTTP request.
463
+ #
464
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
465
+ #
466
+ def list_linked_databases_with_http_info(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
467
+ list_linked_databases_async(resource_group_name, server_name, sync_agent_name, custom_headers).value!
468
+ end
469
+
470
+ #
471
+ # Lists databases linked to a sync agent.
472
+ #
473
+ # @param resource_group_name [String] The name of the resource group that
474
+ # contains the resource. You can obtain this value from the Azure Resource
475
+ # Manager API or the portal.
476
+ # @param server_name [String] The name of the server on which the sync agent is
477
+ # hosted.
478
+ # @param sync_agent_name [String] The name of the sync agent.
479
+ # @param [Hash{String => String}] A hash of custom headers that will be added
480
+ # to the HTTP request.
481
+ #
482
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
483
+ #
484
+ def list_linked_databases_async(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
485
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
486
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
487
+ fail ArgumentError, 'sync_agent_name is nil' if sync_agent_name.nil?
488
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
489
+ api_version = '2015-05-01-preview'
490
+
491
+
492
+ request_headers = {}
493
+
494
+ # Set Headers
495
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
496
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
497
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}/linkedDatabases'
498
+
499
+ request_url = @base_url || @client.base_url
500
+
501
+ options = {
502
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
503
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'syncAgentName' => sync_agent_name,'subscriptionId' => @client.subscription_id},
504
+ query_params: {'api-version' => api_version},
505
+ headers: request_headers.merge(custom_headers || {}),
506
+ base_url: request_url
507
+ }
508
+ promise = @client.make_request_async(:get, path_template, options)
509
+
510
+ promise = promise.then do |result|
511
+ http_response = result.response
512
+ status_code = http_response.status
513
+ response_content = http_response.body
514
+ unless status_code == 200
515
+ error_model = JSON.load(response_content)
516
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
517
+ end
518
+
519
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
520
+ # Deserialize Response
521
+ if status_code == 200
522
+ begin
523
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
524
+ result_mapper = Azure::ARM::SQL::Models::SyncAgentLinkedDatabaseListResult.mapper()
525
+ result.body = @client.deserialize(result_mapper, parsed_response)
526
+ rescue Exception => e
527
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
528
+ end
529
+ end
530
+
531
+ result
532
+ end
533
+
534
+ promise.execute
535
+ end
536
+
537
+ #
538
+ # Creates or updates a sync agent.
539
+ #
540
+ # @param resource_group_name [String] The name of the resource group that
541
+ # contains the resource. You can obtain this value from the Azure Resource
542
+ # Manager API or the portal.
543
+ # @param server_name [String] The name of the server on which the sync agent is
544
+ # hosted.
545
+ # @param sync_agent_name [String] The name of the sync agent.
546
+ # @param parameters [SyncAgent] The requested sync agent resource state.
547
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
548
+ # will be added to the HTTP request.
549
+ #
550
+ # @return [SyncAgent] operation results.
551
+ #
552
+ def begin_create_or_update(resource_group_name, server_name, sync_agent_name, parameters, custom_headers = nil)
553
+ response = begin_create_or_update_async(resource_group_name, server_name, sync_agent_name, parameters, custom_headers).value!
554
+ response.body unless response.nil?
555
+ end
556
+
557
+ #
558
+ # Creates or updates a sync agent.
559
+ #
560
+ # @param resource_group_name [String] The name of the resource group that
561
+ # contains the resource. You can obtain this value from the Azure Resource
562
+ # Manager API or the portal.
563
+ # @param server_name [String] The name of the server on which the sync agent is
564
+ # hosted.
565
+ # @param sync_agent_name [String] The name of the sync agent.
566
+ # @param parameters [SyncAgent] The requested sync agent resource state.
567
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
568
+ # will be added to the HTTP request.
569
+ #
570
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
571
+ #
572
+ def begin_create_or_update_with_http_info(resource_group_name, server_name, sync_agent_name, parameters, custom_headers = nil)
573
+ begin_create_or_update_async(resource_group_name, server_name, sync_agent_name, parameters, custom_headers).value!
574
+ end
575
+
576
+ #
577
+ # Creates or updates a sync agent.
578
+ #
579
+ # @param resource_group_name [String] The name of the resource group that
580
+ # contains the resource. You can obtain this value from the Azure Resource
581
+ # Manager API or the portal.
582
+ # @param server_name [String] The name of the server on which the sync agent is
583
+ # hosted.
584
+ # @param sync_agent_name [String] The name of the sync agent.
585
+ # @param parameters [SyncAgent] The requested sync agent resource state.
586
+ # @param [Hash{String => String}] A hash of custom headers that will be added
587
+ # to the HTTP request.
588
+ #
589
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
590
+ #
591
+ def begin_create_or_update_async(resource_group_name, server_name, sync_agent_name, parameters, custom_headers = nil)
592
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
593
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
594
+ fail ArgumentError, 'sync_agent_name is nil' if sync_agent_name.nil?
595
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
596
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
597
+ api_version = '2015-05-01-preview'
598
+
599
+
600
+ request_headers = {}
601
+
602
+ # Set Headers
603
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
604
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
605
+
606
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
607
+
608
+ # Serialize Request
609
+ request_mapper = Azure::ARM::SQL::Models::SyncAgent.mapper()
610
+ request_content = @client.serialize(request_mapper, parameters)
611
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
612
+
613
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}'
614
+
615
+ request_url = @base_url || @client.base_url
616
+
617
+ options = {
618
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
619
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'syncAgentName' => sync_agent_name,'subscriptionId' => @client.subscription_id},
620
+ query_params: {'api-version' => api_version},
621
+ body: request_content,
622
+ headers: request_headers.merge(custom_headers || {}),
623
+ base_url: request_url
624
+ }
625
+ promise = @client.make_request_async(:put, path_template, options)
626
+
627
+ promise = promise.then do |result|
628
+ http_response = result.response
629
+ status_code = http_response.status
630
+ response_content = http_response.body
631
+ unless status_code == 200 || status_code == 202 || status_code == 201
632
+ error_model = JSON.load(response_content)
633
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
634
+ end
635
+
636
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
637
+ # Deserialize Response
638
+ if status_code == 200
639
+ begin
640
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
641
+ result_mapper = Azure::ARM::SQL::Models::SyncAgent.mapper()
642
+ result.body = @client.deserialize(result_mapper, parsed_response)
643
+ rescue Exception => e
644
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
645
+ end
646
+ end
647
+ # Deserialize Response
648
+ if status_code == 201
649
+ begin
650
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
651
+ result_mapper = Azure::ARM::SQL::Models::SyncAgent.mapper()
652
+ result.body = @client.deserialize(result_mapper, parsed_response)
653
+ rescue Exception => e
654
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
655
+ end
656
+ end
657
+
658
+ result
659
+ end
660
+
661
+ promise.execute
662
+ end
663
+
664
+ #
665
+ # Deletes a sync agent.
666
+ #
667
+ # @param resource_group_name [String] The name of the resource group that
668
+ # contains the resource. You can obtain this value from the Azure Resource
669
+ # Manager API or the portal.
670
+ # @param server_name [String] The name of the server on which the sync agent is
671
+ # hosted.
672
+ # @param sync_agent_name [String] The name of the sync agent.
673
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
674
+ # will be added to the HTTP request.
675
+ #
676
+ #
677
+ def begin_delete(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
678
+ response = begin_delete_async(resource_group_name, server_name, sync_agent_name, custom_headers).value!
679
+ nil
680
+ end
681
+
682
+ #
683
+ # Deletes a sync agent.
684
+ #
685
+ # @param resource_group_name [String] The name of the resource group that
686
+ # contains the resource. You can obtain this value from the Azure Resource
687
+ # Manager API or the portal.
688
+ # @param server_name [String] The name of the server on which the sync agent is
689
+ # hosted.
690
+ # @param sync_agent_name [String] The name of the sync agent.
691
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
692
+ # will be added to the HTTP request.
693
+ #
694
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
695
+ #
696
+ def begin_delete_with_http_info(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
697
+ begin_delete_async(resource_group_name, server_name, sync_agent_name, custom_headers).value!
698
+ end
699
+
700
+ #
701
+ # Deletes a sync agent.
702
+ #
703
+ # @param resource_group_name [String] The name of the resource group that
704
+ # contains the resource. You can obtain this value from the Azure Resource
705
+ # Manager API or the portal.
706
+ # @param server_name [String] The name of the server on which the sync agent is
707
+ # hosted.
708
+ # @param sync_agent_name [String] The name of the sync agent.
709
+ # @param [Hash{String => String}] A hash of custom headers that will be added
710
+ # to the HTTP request.
711
+ #
712
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
713
+ #
714
+ def begin_delete_async(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
715
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
716
+ fail ArgumentError, 'server_name is nil' if server_name.nil?
717
+ fail ArgumentError, 'sync_agent_name is nil' if sync_agent_name.nil?
718
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
719
+ api_version = '2015-05-01-preview'
720
+
721
+
722
+ request_headers = {}
723
+
724
+ # Set Headers
725
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
726
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
727
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/syncAgents/{syncAgentName}'
728
+
729
+ request_url = @base_url || @client.base_url
730
+
731
+ options = {
732
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
733
+ path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'syncAgentName' => sync_agent_name,'subscriptionId' => @client.subscription_id},
734
+ query_params: {'api-version' => api_version},
735
+ headers: request_headers.merge(custom_headers || {}),
736
+ base_url: request_url
737
+ }
738
+ promise = @client.make_request_async(:delete, path_template, options)
739
+
740
+ promise = promise.then do |result|
741
+ http_response = result.response
742
+ status_code = http_response.status
743
+ response_content = http_response.body
744
+ unless status_code == 200 || status_code == 202 || status_code == 204
745
+ error_model = JSON.load(response_content)
746
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
747
+ end
748
+
749
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
750
+
751
+ result
752
+ end
753
+
754
+ promise.execute
755
+ end
756
+
757
+ #
758
+ # Lists sync agents in a server.
759
+ #
760
+ # @param next_page_link [String] The NextLink from the previous successful call
761
+ # to List operation.
762
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
763
+ # will be added to the HTTP request.
764
+ #
765
+ # @return [SyncAgentListResult] operation results.
766
+ #
767
+ def list_by_server_next(next_page_link, custom_headers = nil)
768
+ response = list_by_server_next_async(next_page_link, custom_headers).value!
769
+ response.body unless response.nil?
770
+ end
771
+
772
+ #
773
+ # Lists sync agents in a server.
774
+ #
775
+ # @param next_page_link [String] The NextLink from the previous successful call
776
+ # to List operation.
777
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
778
+ # will be added to the HTTP request.
779
+ #
780
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
781
+ #
782
+ def list_by_server_next_with_http_info(next_page_link, custom_headers = nil)
783
+ list_by_server_next_async(next_page_link, custom_headers).value!
784
+ end
785
+
786
+ #
787
+ # Lists sync agents in a server.
788
+ #
789
+ # @param next_page_link [String] The NextLink from the previous successful call
790
+ # to List operation.
791
+ # @param [Hash{String => String}] A hash of custom headers that will be added
792
+ # to the HTTP request.
793
+ #
794
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
795
+ #
796
+ def list_by_server_next_async(next_page_link, custom_headers = nil)
797
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
798
+
799
+
800
+ request_headers = {}
801
+
802
+ # Set Headers
803
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
804
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
805
+ path_template = '{nextLink}'
806
+
807
+ request_url = @base_url || @client.base_url
808
+
809
+ options = {
810
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
811
+ skip_encoding_path_params: {'nextLink' => next_page_link},
812
+ headers: request_headers.merge(custom_headers || {}),
813
+ base_url: request_url
814
+ }
815
+ promise = @client.make_request_async(:get, path_template, options)
816
+
817
+ promise = promise.then do |result|
818
+ http_response = result.response
819
+ status_code = http_response.status
820
+ response_content = http_response.body
821
+ unless status_code == 200
822
+ error_model = JSON.load(response_content)
823
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
824
+ end
825
+
826
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
827
+ # Deserialize Response
828
+ if status_code == 200
829
+ begin
830
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
831
+ result_mapper = Azure::ARM::SQL::Models::SyncAgentListResult.mapper()
832
+ result.body = @client.deserialize(result_mapper, parsed_response)
833
+ rescue Exception => e
834
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
835
+ end
836
+ end
837
+
838
+ result
839
+ end
840
+
841
+ promise.execute
842
+ end
843
+
844
+ #
845
+ # Lists databases linked to a sync agent.
846
+ #
847
+ # @param next_page_link [String] The NextLink from the previous successful call
848
+ # to List operation.
849
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
850
+ # will be added to the HTTP request.
851
+ #
852
+ # @return [SyncAgentLinkedDatabaseListResult] operation results.
853
+ #
854
+ def list_linked_databases_next(next_page_link, custom_headers = nil)
855
+ response = list_linked_databases_next_async(next_page_link, custom_headers).value!
856
+ response.body unless response.nil?
857
+ end
858
+
859
+ #
860
+ # Lists databases linked to a sync agent.
861
+ #
862
+ # @param next_page_link [String] The NextLink from the previous successful call
863
+ # to List operation.
864
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
865
+ # will be added to the HTTP request.
866
+ #
867
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
868
+ #
869
+ def list_linked_databases_next_with_http_info(next_page_link, custom_headers = nil)
870
+ list_linked_databases_next_async(next_page_link, custom_headers).value!
871
+ end
872
+
873
+ #
874
+ # Lists databases linked to a sync agent.
875
+ #
876
+ # @param next_page_link [String] The NextLink from the previous successful call
877
+ # to List operation.
878
+ # @param [Hash{String => String}] A hash of custom headers that will be added
879
+ # to the HTTP request.
880
+ #
881
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
882
+ #
883
+ def list_linked_databases_next_async(next_page_link, custom_headers = nil)
884
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
885
+
886
+
887
+ request_headers = {}
888
+
889
+ # Set Headers
890
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
891
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
892
+ path_template = '{nextLink}'
893
+
894
+ request_url = @base_url || @client.base_url
895
+
896
+ options = {
897
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
898
+ skip_encoding_path_params: {'nextLink' => next_page_link},
899
+ headers: request_headers.merge(custom_headers || {}),
900
+ base_url: request_url
901
+ }
902
+ promise = @client.make_request_async(:get, path_template, options)
903
+
904
+ promise = promise.then do |result|
905
+ http_response = result.response
906
+ status_code = http_response.status
907
+ response_content = http_response.body
908
+ unless status_code == 200
909
+ error_model = JSON.load(response_content)
910
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
911
+ end
912
+
913
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
914
+ # Deserialize Response
915
+ if status_code == 200
916
+ begin
917
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
918
+ result_mapper = Azure::ARM::SQL::Models::SyncAgentLinkedDatabaseListResult.mapper()
919
+ result.body = @client.deserialize(result_mapper, parsed_response)
920
+ rescue Exception => e
921
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
922
+ end
923
+ end
924
+
925
+ result
926
+ end
927
+
928
+ promise.execute
929
+ end
930
+
931
+ #
932
+ # Lists sync agents in a server.
933
+ #
934
+ # @param resource_group_name [String] The name of the resource group that
935
+ # contains the resource. You can obtain this value from the Azure Resource
936
+ # Manager API or the portal.
937
+ # @param server_name [String] The name of the server on which the sync agent is
938
+ # hosted.
939
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
940
+ # will be added to the HTTP request.
941
+ #
942
+ # @return [SyncAgentListResult] which provide lazy access to pages of the
943
+ # response.
944
+ #
945
+ def list_by_server_as_lazy(resource_group_name, server_name, custom_headers = nil)
946
+ response = list_by_server_async(resource_group_name, server_name, custom_headers).value!
947
+ unless response.nil?
948
+ page = response.body
949
+ page.next_method = Proc.new do |next_page_link|
950
+ list_by_server_next_async(next_page_link, custom_headers)
951
+ end
952
+ page
953
+ end
954
+ end
955
+
956
+ #
957
+ # Lists databases linked to a sync agent.
958
+ #
959
+ # @param resource_group_name [String] The name of the resource group that
960
+ # contains the resource. You can obtain this value from the Azure Resource
961
+ # Manager API or the portal.
962
+ # @param server_name [String] The name of the server on which the sync agent is
963
+ # hosted.
964
+ # @param sync_agent_name [String] The name of the sync agent.
965
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
966
+ # will be added to the HTTP request.
967
+ #
968
+ # @return [SyncAgentLinkedDatabaseListResult] which provide lazy access to
969
+ # pages of the response.
970
+ #
971
+ def list_linked_databases_as_lazy(resource_group_name, server_name, sync_agent_name, custom_headers = nil)
972
+ response = list_linked_databases_async(resource_group_name, server_name, sync_agent_name, custom_headers).value!
973
+ unless response.nil?
974
+ page = response.body
975
+ page.next_method = Proc.new do |next_page_link|
976
+ list_linked_databases_next_async(next_page_link, custom_headers)
977
+ end
978
+ page
979
+ end
980
+ end
981
+
982
+ end
983
+ end