diff --git a/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/sensitivity_label.rb b/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/sensitivity_label.rb index 5376430a2b..c7f5db225e 100644 --- a/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/sensitivity_label.rb +++ b/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/sensitivity_label.rb @@ -15,9 +15,15 @@ class SensitivityLabel < ProxyResource # @return [String] The label name. attr_accessor :label_name + # @return [String] The label ID. + attr_accessor :label_id + # @return [String] The information type. attr_accessor :information_type + # @return [String] The information type ID. + attr_accessor :information_type_id + # # Mapper for SensitivityLabel class as Ruby Hash. @@ -25,7 +31,6 @@ class SensitivityLabel < ProxyResource # def self.mapper() { - client_side_validation: true, required: false, serialized_name: 'SensitivityLabel', type: { @@ -33,7 +38,6 @@ def self.mapper() class_name: 'SensitivityLabel', model_properties: { id: { - client_side_validation: true, required: false, read_only: true, serialized_name: 'id', @@ -42,7 +46,6 @@ def self.mapper() } }, name: { - client_side_validation: true, required: false, read_only: true, serialized_name: 'name', @@ -51,7 +54,6 @@ def self.mapper() } }, type: { - client_side_validation: true, required: false, read_only: true, serialized_name: 'type', @@ -60,20 +62,32 @@ def self.mapper() } }, label_name: { - client_side_validation: true, required: false, serialized_name: 'properties.labelName', type: { name: 'String' } }, + label_id: { + required: false, + serialized_name: 'properties.labelId', + type: { + name: 'String' + } + }, information_type: { - client_side_validation: true, required: false, serialized_name: 'properties.informationType', type: { name: 'String' } + }, + information_type_id: { + required: false, + serialized_name: 'properties.informationTypeId', + type: { + name: 'String' + } } } } diff --git a/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/sensitivity_label_list_result.rb b/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/sensitivity_label_list_result.rb index 9e96e01136..5ad5866b61 100644 --- a/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/sensitivity_label_list_result.rb +++ b/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/models/sensitivity_label_list_result.rb @@ -57,7 +57,6 @@ def get_next_page # def self.mapper() { - client_side_validation: true, required: false, serialized_name: 'SensitivityLabelListResult', type: { @@ -65,14 +64,12 @@ def self.mapper() class_name: 'SensitivityLabelListResult', model_properties: { value: { - client_side_validation: true, required: false, read_only: true, serialized_name: 'value', type: { name: 'Sequence', element: { - client_side_validation: true, required: false, serialized_name: 'SensitivityLabelElementType', type: { @@ -83,7 +80,6 @@ def self.mapper() } }, next_link: { - client_side_validation: true, required: false, read_only: true, serialized_name: 'nextLink', diff --git a/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/sensitivity_labels.rb b/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/sensitivity_labels.rb index aeac27a837..2c0d44fc8c 100644 --- a/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/sensitivity_labels.rb +++ b/management/azure_mgmt_sql/lib/2017-03-01-preview/generated/azure_mgmt_sql/sensitivity_labels.rb @@ -39,8 +39,8 @@ def initialize(client) # # @return [Array] operation results. # - def list_by_database(resource_group_name, server_name, database_name, filter:nil, custom_headers:nil) - first_page = list_by_database_as_lazy(resource_group_name, server_name, database_name, filter:filter, custom_headers:custom_headers) + def list_current_by_database(resource_group_name, server_name, database_name, filter = nil, custom_headers = nil) + first_page = list_current_by_database_as_lazy(resource_group_name, server_name, database_name, filter, custom_headers) first_page.get_all_items end @@ -59,8 +59,8 @@ def list_by_database(resource_group_name, server_name, database_name, filter:nil # # @return [MsRestAzure::AzureOperationResponse] HTTP response information. # - def list_by_database_with_http_info(resource_group_name, server_name, database_name, filter:nil, custom_headers:nil) - list_by_database_async(resource_group_name, server_name, database_name, filter:filter, custom_headers:custom_headers).value! + def list_current_by_database_with_http_info(resource_group_name, server_name, database_name, filter = nil, custom_headers = nil) + list_current_by_database_async(resource_group_name, server_name, database_name, filter, custom_headers).value! end # @@ -78,7 +78,221 @@ def list_by_database_with_http_info(resource_group_name, server_name, database_n # # @return [Concurrent::Promise] Promise object which holds the HTTP response. # - def list_by_database_async(resource_group_name, server_name, database_name, filter:nil, custom_headers:nil) + def list_current_by_database_async(resource_group_name, server_name, database_name, filter = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'server_name is nil' if server_name.nil? + fail ArgumentError, 'database_name is nil' if database_name.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id}, + query_params: {'$filter' => filter,'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::SensitivityLabelListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Gets the sensitivity labels of a given database + # + # @param resource_group_name [String] The name of the resource group that + # contains the resource. You can obtain this value from the Azure Resource + # Manager API or the portal. + # @param server_name [String] The name of the server. + # @param database_name [String] The name of the database. + # @param filter [String] An OData filter expression that filters elements in + # the collection. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Array] operation results. + # + def list_recommended_by_database(resource_group_name, server_name, database_name, filter = nil, custom_headers = nil) + first_page = list_recommended_by_database_as_lazy(resource_group_name, server_name, database_name, filter, custom_headers) + first_page.get_all_items + end + + # + # Gets the sensitivity labels of a given database + # + # @param resource_group_name [String] The name of the resource group that + # contains the resource. You can obtain this value from the Azure Resource + # Manager API or the portal. + # @param server_name [String] The name of the server. + # @param database_name [String] The name of the database. + # @param filter [String] An OData filter expression that filters elements in + # the collection. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_recommended_by_database_with_http_info(resource_group_name, server_name, database_name, filter = nil, custom_headers = nil) + list_recommended_by_database_async(resource_group_name, server_name, database_name, filter, custom_headers).value! + end + + # + # Gets the sensitivity labels of a given database + # + # @param resource_group_name [String] The name of the resource group that + # contains the resource. You can obtain this value from the Azure Resource + # Manager API or the portal. + # @param server_name [String] The name of the server. + # @param database_name [String] The name of the database. + # @param filter [String] An OData filter expression that filters elements in + # the collection. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_recommended_by_database_async(resource_group_name, server_name, database_name, filter = nil, custom_headers = nil) + fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? + fail ArgumentError, 'server_name is nil' if server_name.nil? + fail ArgumentError, 'database_name is nil' if database_name.nil? + fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? + fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'databaseName' => database_name,'subscriptionId' => @client.subscription_id}, + query_params: {'$filter' => filter,'api-version' => @client.api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::SensitivityLabelListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Gets the sensitivity labels of a given database + # + # @param resource_group_name [String] The name of the resource group that + # contains the resource. You can obtain this value from the Azure Resource + # Manager API or the portal. + # @param server_name [String] The name of the server. + # @param database_name [String] The name of the database. + # @param filter [String] An OData filter expression that filters elements in + # the collection. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [Array] operation results. + # + def list_by_database(resource_group_name, server_name, database_name, filter = nil, custom_headers = nil) + first_page = list_by_database_as_lazy(resource_group_name, server_name, database_name, filter, custom_headers) + first_page.get_all_items + end + + # + # Gets the sensitivity labels of a given database + # + # @param resource_group_name [String] The name of the resource group that + # contains the resource. You can obtain this value from the Azure Resource + # Manager API or the portal. + # @param server_name [String] The name of the server. + # @param database_name [String] The name of the database. + # @param filter [String] An OData filter expression that filters elements in + # the collection. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_by_database_with_http_info(resource_group_name, server_name, database_name, filter = nil, custom_headers = nil) + list_by_database_async(resource_group_name, server_name, database_name, filter, custom_headers).value! + end + + # + # Gets the sensitivity labels of a given database + # + # @param resource_group_name [String] The name of the resource group that + # contains the resource. You can obtain this value from the Azure Resource + # Manager API or the portal. + # @param server_name [String] The name of the server. + # @param database_name [String] The name of the database. + # @param filter [String] An OData filter expression that filters elements in + # the collection. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_by_database_async(resource_group_name, server_name, database_name, filter = nil, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'database_name is nil' if database_name.nil? @@ -87,7 +301,6 @@ def list_by_database_async(resource_group_name, server_name, database_name, filt request_headers = {} - request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid @@ -150,8 +363,8 @@ def list_by_database_async(resource_group_name, server_name, database_name, filt # # @return [SensitivityLabel] operation results. # - def get(resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers:nil) - response = get_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers:custom_headers).value! + def get(resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers = nil) + response = get_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers).value! response.body unless response.nil? end @@ -173,8 +386,8 @@ def get(resource_group_name, server_name, database_name, schema_name, table_name # # @return [MsRestAzure::AzureOperationResponse] HTTP response information. # - def get_with_http_info(resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers:nil) - get_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers:custom_headers).value! + def get_with_http_info(resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers = nil) + get_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers).value! end # @@ -195,7 +408,7 @@ def get_with_http_info(resource_group_name, server_name, database_name, schema_n # # @return [Concurrent::Promise] Promise object which holds the HTTP response. # - def get_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers:nil) + def get_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'database_name is nil' if database_name.nil? @@ -208,7 +421,6 @@ def get_async(resource_group_name, server_name, database_name, schema_name, tabl request_headers = {} - request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid @@ -270,8 +482,8 @@ def get_async(resource_group_name, server_name, database_name, schema_name, tabl # # @return [SensitivityLabel] operation results. # - def create_or_update(resource_group_name, server_name, database_name, schema_name, table_name, column_name, parameters, custom_headers:nil) - response = create_or_update_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, parameters, custom_headers:custom_headers).value! + def create_or_update(resource_group_name, server_name, database_name, schema_name, table_name, column_name, parameters, custom_headers = nil) + response = create_or_update_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, parameters, custom_headers).value! response.body unless response.nil? end @@ -292,8 +504,8 @@ def create_or_update(resource_group_name, server_name, database_name, schema_nam # # @return [MsRestAzure::AzureOperationResponse] HTTP response information. # - def create_or_update_with_http_info(resource_group_name, server_name, database_name, schema_name, table_name, column_name, parameters, custom_headers:nil) - create_or_update_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, parameters, custom_headers:custom_headers).value! + def create_or_update_with_http_info(resource_group_name, server_name, database_name, schema_name, table_name, column_name, parameters, custom_headers = nil) + create_or_update_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, parameters, custom_headers).value! end # @@ -313,7 +525,7 @@ def create_or_update_with_http_info(resource_group_name, server_name, database_n # # @return [Concurrent::Promise] Promise object which holds the HTTP response. # - def create_or_update_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, parameters, custom_headers:nil) + def create_or_update_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, parameters, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'database_name is nil' if database_name.nil? @@ -327,12 +539,13 @@ def create_or_update_async(resource_group_name, server_name, database_name, sche request_headers = {} - request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + request_headers['Content-Type'] = 'application/json; charset=utf-8' + # Serialize Request request_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::SensitivityLabel.mapper() request_content = @client.serialize(request_mapper, parameters) @@ -404,8 +617,8 @@ def create_or_update_async(resource_group_name, server_name, database_name, sche # will be added to the HTTP request. # # - def delete(resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers:nil) - response = delete_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers:custom_headers).value! + def delete(resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers = nil) + response = delete_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers).value! nil end @@ -425,8 +638,8 @@ def delete(resource_group_name, server_name, database_name, schema_name, table_n # # @return [MsRestAzure::AzureOperationResponse] HTTP response information. # - def delete_with_http_info(resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers:nil) - delete_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers:custom_headers).value! + def delete_with_http_info(resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers = nil) + delete_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers).value! end # @@ -445,7 +658,7 @@ def delete_with_http_info(resource_group_name, server_name, database_name, schem # # @return [Concurrent::Promise] Promise object which holds the HTTP response. # - def delete_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers:nil) + def delete_async(resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'server_name is nil' if server_name.nil? fail ArgumentError, 'database_name is nil' if database_name.nil? @@ -458,7 +671,6 @@ def delete_async(resource_group_name, server_name, database_name, schema_name, t request_headers = {} - request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid @@ -503,8 +715,8 @@ def delete_async(resource_group_name, server_name, database_name, schema_name, t # # @return [SensitivityLabelListResult] operation results. # - def list_by_database_next(next_page_link, custom_headers:nil) - response = list_by_database_next_async(next_page_link, custom_headers:custom_headers).value! + def list_current_by_database_next(next_page_link, custom_headers = nil) + response = list_current_by_database_next_async(next_page_link, custom_headers).value! response.body unless response.nil? end @@ -518,8 +730,8 @@ def list_by_database_next(next_page_link, custom_headers:nil) # # @return [MsRestAzure::AzureOperationResponse] HTTP response information. # - def list_by_database_next_with_http_info(next_page_link, custom_headers:nil) - list_by_database_next_async(next_page_link, custom_headers:custom_headers).value! + def list_current_by_database_next_with_http_info(next_page_link, custom_headers = nil) + list_current_by_database_next_async(next_page_link, custom_headers).value! end # @@ -532,12 +744,11 @@ def list_by_database_next_with_http_info(next_page_link, custom_headers:nil) # # @return [Concurrent::Promise] Promise object which holds the HTTP response. # - def list_by_database_next_async(next_page_link, custom_headers:nil) + def list_current_by_database_next_async(next_page_link, custom_headers = nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} - request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid @@ -581,6 +792,234 @@ def list_by_database_next_async(next_page_link, custom_headers:nil) promise.execute end + # + # Gets the sensitivity labels of a given database + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [SensitivityLabelListResult] operation results. + # + def list_recommended_by_database_next(next_page_link, custom_headers = nil) + response = list_recommended_by_database_next_async(next_page_link, custom_headers).value! + response.body unless response.nil? + end + + # + # Gets the sensitivity labels of a given database + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_recommended_by_database_next_with_http_info(next_page_link, custom_headers = nil) + list_recommended_by_database_next_async(next_page_link, custom_headers).value! + end + + # + # Gets the sensitivity labels of a given database + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_recommended_by_database_next_async(next_page_link, custom_headers = nil) + fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = '{nextLink}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + skip_encoding_path_params: {'nextLink' => next_page_link}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::SensitivityLabelListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Gets the sensitivity labels of a given database + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [SensitivityLabelListResult] operation results. + # + def list_by_database_next(next_page_link, custom_headers = nil) + response = list_by_database_next_async(next_page_link, custom_headers).value! + response.body unless response.nil? + end + + # + # Gets the sensitivity labels of a given database + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [MsRestAzure::AzureOperationResponse] HTTP response information. + # + def list_by_database_next_with_http_info(next_page_link, custom_headers = nil) + list_by_database_next_async(next_page_link, custom_headers).value! + end + + # + # Gets the sensitivity labels of a given database + # + # @param next_page_link [String] The NextLink from the previous successful call + # to List operation. + # @param [Hash{String => String}] A hash of custom headers that will be added + # to the HTTP request. + # + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def list_by_database_next_async(next_page_link, custom_headers = nil) + fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? + path_template = '{nextLink}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + skip_encoding_path_params: {'nextLink' => next_page_link}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:get, path_template, options) + + promise = promise.then do |result| + http_response = result.response + status_code = http_response.status + response_content = http_response.body + unless status_code == 200 + error_model = JSON.load(response_content) + fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) + end + + result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::SensitivityLabelListResult.mapper() + result.body = @client.deserialize(result_mapper, parsed_response) + rescue Exception => e + fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) + end + end + + result + end + + promise.execute + end + + # + # Gets the sensitivity labels of a given database + # + # @param resource_group_name [String] The name of the resource group that + # contains the resource. You can obtain this value from the Azure Resource + # Manager API or the portal. + # @param server_name [String] The name of the server. + # @param database_name [String] The name of the database. + # @param filter [String] An OData filter expression that filters elements in + # the collection. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [SensitivityLabelListResult] which provide lazy access to pages of + # the response. + # + def list_current_by_database_as_lazy(resource_group_name, server_name, database_name, filter = nil, custom_headers = nil) + response = list_current_by_database_async(resource_group_name, server_name, database_name, filter, custom_headers).value! + unless response.nil? + page = response.body + page.next_method = Proc.new do |next_page_link| + list_current_by_database_next_async(next_page_link, custom_headers) + end + page + end + end + + # + # Gets the sensitivity labels of a given database + # + # @param resource_group_name [String] The name of the resource group that + # contains the resource. You can obtain this value from the Azure Resource + # Manager API or the portal. + # @param server_name [String] The name of the server. + # @param database_name [String] The name of the database. + # @param filter [String] An OData filter expression that filters elements in + # the collection. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [SensitivityLabelListResult] which provide lazy access to pages of + # the response. + # + def list_recommended_by_database_as_lazy(resource_group_name, server_name, database_name, filter = nil, custom_headers = nil) + response = list_recommended_by_database_async(resource_group_name, server_name, database_name, filter, custom_headers).value! + unless response.nil? + page = response.body + page.next_method = Proc.new do |next_page_link| + list_recommended_by_database_next_async(next_page_link, custom_headers) + end + page + end + end + # # Gets the sensitivity labels of a given database # @@ -597,12 +1036,12 @@ def list_by_database_next_async(next_page_link, custom_headers:nil) # @return [SensitivityLabelListResult] which provide lazy access to pages of # the response. # - def list_by_database_as_lazy(resource_group_name, server_name, database_name, filter:nil, custom_headers:nil) - response = list_by_database_async(resource_group_name, server_name, database_name, filter:filter, custom_headers:custom_headers).value! + def list_by_database_as_lazy(resource_group_name, server_name, database_name, filter = nil, custom_headers = nil) + response = list_by_database_async(resource_group_name, server_name, database_name, filter, custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_page_link| - list_by_database_next_async(next_page_link, custom_headers:custom_headers) + list_by_database_next_async(next_page_link, custom_headers) end page end