diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor.rb index e85fa25eb..12f3f0dad 100644 --- a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor.rb +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor.rb @@ -21,55 +21,62 @@ require 'ms_rest_azure' module Azure::ARM::Monitor autoload :AutoscaleSettings, 'generated/azure_mgmt_monitor/autoscale_settings.rb' + autoload :Operations, 'generated/azure_mgmt_monitor/operations.rb' autoload :AlertRuleIncidents, 'generated/azure_mgmt_monitor/alert_rule_incidents.rb' autoload :AlertRules, 'generated/azure_mgmt_monitor/alert_rules.rb' autoload :LogProfiles, 'generated/azure_mgmt_monitor/log_profiles.rb' - autoload :ServiceDiagnosticSettingsOperations, 'generated/azure_mgmt_monitor/service_diagnostic_settings_operations.rb' + autoload :DiagnosticSettingsOperations, 'generated/azure_mgmt_monitor/diagnostic_settings_operations.rb' + autoload :DiagnosticSettingsCategoryOperations, 'generated/azure_mgmt_monitor/diagnostic_settings_category_operations.rb' autoload :ActionGroups, 'generated/azure_mgmt_monitor/action_groups.rb' autoload :ActivityLogAlerts, 'generated/azure_mgmt_monitor/activity_log_alerts.rb' autoload :MonitorManagementClient, 'generated/azure_mgmt_monitor/monitor_management_client.rb' module Models autoload :RuleAction, 'generated/azure_mgmt_monitor/models/rule_action.rb' - autoload :ActionGroupList, 'generated/azure_mgmt_monitor/models/action_group_list.rb' + autoload :WebhookReceiver, 'generated/azure_mgmt_monitor/models/webhook_receiver.rb' autoload :MetricTrigger, 'generated/azure_mgmt_monitor/models/metric_trigger.rb' autoload :ActivityLogAlertLeafCondition, 'generated/azure_mgmt_monitor/models/activity_log_alert_leaf_condition.rb' autoload :ScaleRule, 'generated/azure_mgmt_monitor/models/scale_rule.rb' - autoload :ManagementEventAggregationCondition, 'generated/azure_mgmt_monitor/models/management_event_aggregation_condition.rb' - autoload :RecurrentSchedule, 'generated/azure_mgmt_monitor/models/recurrent_schedule.rb' autoload :EnableRequest, 'generated/azure_mgmt_monitor/models/enable_request.rb' + autoload :RecurrentSchedule, 'generated/azure_mgmt_monitor/models/recurrent_schedule.rb' + autoload :ManagementEventAggregationCondition, 'generated/azure_mgmt_monitor/models/management_event_aggregation_condition.rb' autoload :AutoscaleProfile, 'generated/azure_mgmt_monitor/models/autoscale_profile.rb' - autoload :ScaleCapacity, 'generated/azure_mgmt_monitor/models/scale_capacity.rb' + autoload :ActionGroupList, 'generated/azure_mgmt_monitor/models/action_group_list.rb' autoload :WebhookNotification, 'generated/azure_mgmt_monitor/models/webhook_notification.rb' + autoload :ScaleCapacity, 'generated/azure_mgmt_monitor/models/scale_capacity.rb' autoload :AutoscaleNotification, 'generated/azure_mgmt_monitor/models/autoscale_notification.rb' - autoload :AutoscaleSettingResourcePatch, 'generated/azure_mgmt_monitor/models/autoscale_setting_resource_patch.rb' - autoload :SmsReceiver, 'generated/azure_mgmt_monitor/models/sms_receiver.rb' - autoload :ErrorResponse, 'generated/azure_mgmt_monitor/models/error_response.rb' - autoload :ActivityLogAlertPatchBody, 'generated/azure_mgmt_monitor/models/activity_log_alert_patch_body.rb' - autoload :IncidentListResult, 'generated/azure_mgmt_monitor/models/incident_list_result.rb' - autoload :ActivityLogAlertList, 'generated/azure_mgmt_monitor/models/activity_log_alert_list.rb' - autoload :RuleCondition, 'generated/azure_mgmt_monitor/models/rule_condition.rb' - autoload :AlertRuleResourcePatch, 'generated/azure_mgmt_monitor/models/alert_rule_resource_patch.rb' - autoload :RuleManagementEventClaimsDataSource, 'generated/azure_mgmt_monitor/models/rule_management_event_claims_data_source.rb' - autoload :AlertRuleResourceCollection, 'generated/azure_mgmt_monitor/models/alert_rule_resource_collection.rb' - autoload :ScaleAction, 'generated/azure_mgmt_monitor/models/scale_action.rb' - autoload :RetentionPolicy, 'generated/azure_mgmt_monitor/models/retention_policy.rb' - autoload :Recurrence, 'generated/azure_mgmt_monitor/models/recurrence.rb' - autoload :ActivityLogAlertActionList, 'generated/azure_mgmt_monitor/models/activity_log_alert_action_list.rb' - autoload :AutoscaleSettingResourceCollection, 'generated/azure_mgmt_monitor/models/autoscale_setting_resource_collection.rb' - autoload :LogProfileResourcePatch, 'generated/azure_mgmt_monitor/models/log_profile_resource_patch.rb' - autoload :RuleDataSource, 'generated/azure_mgmt_monitor/models/rule_data_source.rb' - autoload :LogProfileCollection, 'generated/azure_mgmt_monitor/models/log_profile_collection.rb' - autoload :WebhookReceiver, 'generated/azure_mgmt_monitor/models/webhook_receiver.rb' - autoload :MetricSettings, 'generated/azure_mgmt_monitor/models/metric_settings.rb' - autoload :EmailNotification, 'generated/azure_mgmt_monitor/models/email_notification.rb' - autoload :LogSettings, 'generated/azure_mgmt_monitor/models/log_settings.rb' - autoload :ActivityLogAlertAllOfCondition, 'generated/azure_mgmt_monitor/models/activity_log_alert_all_of_condition.rb' - autoload :ActivityLogAlertActionGroup, 'generated/azure_mgmt_monitor/models/activity_log_alert_action_group.rb' - autoload :Incident, 'generated/azure_mgmt_monitor/models/incident.rb' - autoload :ServiceDiagnosticSettingsResourcePatch, 'generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource_patch.rb' - autoload :TimeWindow, 'generated/azure_mgmt_monitor/models/time_window.rb' autoload :EmailReceiver, 'generated/azure_mgmt_monitor/models/email_receiver.rb' + autoload :AutoscaleSettingResourceCollection, 'generated/azure_mgmt_monitor/models/autoscale_setting_resource_collection.rb' + autoload :OperationDisplay, 'generated/azure_mgmt_monitor/models/operation_display.rb' + autoload :ActivityLogAlertPatchBody, 'generated/azure_mgmt_monitor/models/activity_log_alert_patch_body.rb' + autoload :OperationListResult, 'generated/azure_mgmt_monitor/models/operation_list_result.rb' + autoload :ActivityLogAlertList, 'generated/azure_mgmt_monitor/models/activity_log_alert_list.rb' + autoload :IncidentListResult, 'generated/azure_mgmt_monitor/models/incident_list_result.rb' + autoload :AlertRuleResourcePatch, 'generated/azure_mgmt_monitor/models/alert_rule_resource_patch.rb' + autoload :RuleCondition, 'generated/azure_mgmt_monitor/models/rule_condition.rb' + autoload :AlertRuleResourceCollection, 'generated/azure_mgmt_monitor/models/alert_rule_resource_collection.rb' + autoload :RuleManagementEventClaimsDataSource, 'generated/azure_mgmt_monitor/models/rule_management_event_claims_data_source.rb' + autoload :RetentionPolicy, 'generated/azure_mgmt_monitor/models/retention_policy.rb' + autoload :TimeWindow, 'generated/azure_mgmt_monitor/models/time_window.rb' + autoload :ActivityLogAlertActionList, 'generated/azure_mgmt_monitor/models/activity_log_alert_action_list.rb' + autoload :EmailNotification, 'generated/azure_mgmt_monitor/models/email_notification.rb' + autoload :LogProfileResourcePatch, 'generated/azure_mgmt_monitor/models/log_profile_resource_patch.rb' + autoload :ErrorResponse, 'generated/azure_mgmt_monitor/models/error_response.rb' + autoload :LogProfileCollection, 'generated/azure_mgmt_monitor/models/log_profile_collection.rb' + autoload :Incident, 'generated/azure_mgmt_monitor/models/incident.rb' + autoload :ProxyOnlyResource, 'generated/azure_mgmt_monitor/models/proxy_only_resource.rb' + autoload :SmsReceiver, 'generated/azure_mgmt_monitor/models/sms_receiver.rb' + autoload :MetricSettings, 'generated/azure_mgmt_monitor/models/metric_settings.rb' + autoload :Recurrence, 'generated/azure_mgmt_monitor/models/recurrence.rb' + autoload :LogSettings, 'generated/azure_mgmt_monitor/models/log_settings.rb' + autoload :Operation, 'generated/azure_mgmt_monitor/models/operation.rb' + autoload :ActivityLogAlertActionGroup, 'generated/azure_mgmt_monitor/models/activity_log_alert_action_group.rb' + autoload :ScaleAction, 'generated/azure_mgmt_monitor/models/scale_action.rb' + autoload :DiagnosticSettingsResourceCollection, 'generated/azure_mgmt_monitor/models/diagnostic_settings_resource_collection.rb' + autoload :RuleDataSource, 'generated/azure_mgmt_monitor/models/rule_data_source.rb' + autoload :ActivityLogAlertAllOfCondition, 'generated/azure_mgmt_monitor/models/activity_log_alert_all_of_condition.rb' + autoload :AutoscaleSettingResourcePatch, 'generated/azure_mgmt_monitor/models/autoscale_setting_resource_patch.rb' + autoload :DiagnosticSettingsCategoryResourceCollection, 'generated/azure_mgmt_monitor/models/diagnostic_settings_category_resource_collection.rb' autoload :AutoscaleSettingResource, 'generated/azure_mgmt_monitor/models/autoscale_setting_resource.rb' autoload :RuleMetricDataSource, 'generated/azure_mgmt_monitor/models/rule_metric_data_source.rb' autoload :RuleManagementEventDataSource, 'generated/azure_mgmt_monitor/models/rule_management_event_data_source.rb' @@ -80,7 +87,8 @@ module Azure::ARM::Monitor autoload :RuleWebhookAction, 'generated/azure_mgmt_monitor/models/rule_webhook_action.rb' autoload :AlertRuleResource, 'generated/azure_mgmt_monitor/models/alert_rule_resource.rb' autoload :LogProfileResource, 'generated/azure_mgmt_monitor/models/log_profile_resource.rb' - autoload :ServiceDiagnosticSettingsResource, 'generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource.rb' + autoload :DiagnosticSettingsResource, 'generated/azure_mgmt_monitor/models/diagnostic_settings_resource.rb' + autoload :DiagnosticSettingsCategoryResource, 'generated/azure_mgmt_monitor/models/diagnostic_settings_category_resource.rb' autoload :ActionGroupResource, 'generated/azure_mgmt_monitor/models/action_group_resource.rb' autoload :ActivityLogAlertResource, 'generated/azure_mgmt_monitor/models/activity_log_alert_resource.rb' autoload :MetricStatisticType, 'generated/azure_mgmt_monitor/models/metric_statistic_type.rb' @@ -91,6 +99,7 @@ module Azure::ARM::Monitor autoload :RecurrenceFrequency, 'generated/azure_mgmt_monitor/models/recurrence_frequency.rb' autoload :ConditionOperator, 'generated/azure_mgmt_monitor/models/condition_operator.rb' autoload :TimeAggregationOperator, 'generated/azure_mgmt_monitor/models/time_aggregation_operator.rb' + autoload :CategoryType, 'generated/azure_mgmt_monitor/models/category_type.rb' autoload :ReceiverStatus, 'generated/azure_mgmt_monitor/models/receiver_status.rb' end end diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/diagnostic_settings_category_operations.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/diagnostic_settings_category_operations.rb new file mode 100644 index 000000000..5134abafb --- /dev/null +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/diagnostic_settings_category_operations.rb @@ -0,0 +1,201 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::Monitor + # + # Monitor Management Client + # + class DiagnosticSettingsCategoryOperations + include MsRestAzure + + # + # Creates and initializes a new instance of the DiagnosticSettingsCategoryOperations class. + # @param client service class for accessing basic functionality. + # + def initialize(client) + @client = client + end + + # @return [MonitorManagementClient] reference to the MonitorManagementClient + attr_reader :client + + # + # Gets the diagnostic settings category for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @param name [String] The name of the diagnostic setting. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [DiagnosticSettingsCategoryResource] operation results. + # + def get(resource_uri, name, custom_headers = nil) + response = get_async(resource_uri, name, custom_headers).value! + response.body unless response.nil? + end + + # + # Gets the diagnostic settings category for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @param name [String] The name of the diagnostic setting. + # @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 get_with_http_info(resource_uri, name, custom_headers = nil) + get_async(resource_uri, name, custom_headers).value! + end + + # + # Gets the diagnostic settings category for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @param name [String] The name of the diagnostic setting. + # @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 get_async(resource_uri, name, custom_headers = nil) + fail ArgumentError, 'resource_uri is nil' if resource_uri.nil? + api_version = '2017-05-01-preview' + fail ArgumentError, 'name is nil' if name.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 = '{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceUri' => resource_uri,'name' => name}, + query_params: {'api-version' => 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 MsRest::HttpOperationError.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::ARM::Monitor::Models::DiagnosticSettingsCategoryResource.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 + + # + # Lists the diagnostic settings categories for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [DiagnosticSettingsCategoryResourceCollection] operation results. + # + def list(resource_uri, custom_headers = nil) + response = list_async(resource_uri, custom_headers).value! + response.body unless response.nil? + end + + # + # Lists the diagnostic settings categories for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @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_with_http_info(resource_uri, custom_headers = nil) + list_async(resource_uri, custom_headers).value! + end + + # + # Lists the diagnostic settings categories for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @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_async(resource_uri, custom_headers = nil) + fail ArgumentError, 'resource_uri is nil' if resource_uri.nil? + api_version = '2017-05-01-preview' + + + 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 = '{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceUri' => resource_uri}, + query_params: {'api-version' => 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 MsRest::HttpOperationError.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::ARM::Monitor::Models::DiagnosticSettingsCategoryResourceCollection.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 + + end +end diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/service_diagnostic_settings_operations.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/diagnostic_settings_operations.rb similarity index 58% rename from management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/service_diagnostic_settings_operations.rb rename to management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/diagnostic_settings_operations.rb index cf7b4d178..9b58056cc 100644 --- a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/service_diagnostic_settings_operations.rb +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/diagnostic_settings_operations.rb @@ -7,11 +7,11 @@ module Azure::ARM::Monitor # # Monitor Management Client # - class ServiceDiagnosticSettingsOperations + class DiagnosticSettingsOperations include MsRestAzure # - # Creates and initializes a new instance of the ServiceDiagnosticSettingsOperations class. + # Creates and initializes a new instance of the DiagnosticSettingsOperations class. # @param client service class for accessing basic functionality. # def initialize(client) @@ -22,47 +22,48 @@ module Azure::ARM::Monitor attr_reader :client # - # Gets the active diagnostic settings for the specified resource. **WARNING**: - # This method will be deprecated in future releases. + # Gets the active diagnostic settings for the specified resource. # # @param resource_uri [String] The identifier of the resource. + # @param name [String] The name of the diagnostic setting. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # - # @return [ServiceDiagnosticSettingsResource] operation results. + # @return [DiagnosticSettingsResource] operation results. # - def get(resource_uri, custom_headers = nil) - response = get_async(resource_uri, custom_headers).value! + def get(resource_uri, name, custom_headers = nil) + response = get_async(resource_uri, name, custom_headers).value! response.body unless response.nil? end # - # Gets the active diagnostic settings for the specified resource. **WARNING**: - # This method will be deprecated in future releases. + # Gets the active diagnostic settings for the specified resource. # # @param resource_uri [String] The identifier of the resource. + # @param name [String] The name of the diagnostic setting. # @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 get_with_http_info(resource_uri, custom_headers = nil) - get_async(resource_uri, custom_headers).value! + def get_with_http_info(resource_uri, name, custom_headers = nil) + get_async(resource_uri, name, custom_headers).value! end # - # Gets the active diagnostic settings for the specified resource. **WARNING**: - # This method will be deprecated in future releases. + # Gets the active diagnostic settings for the specified resource. # # @param resource_uri [String] The identifier of the resource. + # @param name [String] The name of the diagnostic setting. # @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 get_async(resource_uri, custom_headers = nil) + def get_async(resource_uri, name, custom_headers = nil) fail ArgumentError, 'resource_uri is nil' if resource_uri.nil? - api_version = '2016-09-01' + api_version = '2017-05-01-preview' + fail ArgumentError, 'name is nil' if name.nil? request_headers = {} @@ -70,7 +71,278 @@ module Azure::ARM::Monitor # 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 = '{resourceUri}/providers/microsoft.insights/diagnosticSettings/service' + path_template = '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceUri' => resource_uri,'name' => name}, + query_params: {'api-version' => 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 MsRest::HttpOperationError.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::ARM::Monitor::Models::DiagnosticSettingsResource.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 + + # + # Creates or updates diagnostic settings for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @param parameters [DiagnosticSettingsResource] Parameters supplied to the + # operation. + # @param name [String] The name of the diagnostic setting. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [DiagnosticSettingsResource] operation results. + # + def create_or_update(resource_uri, parameters, name, custom_headers = nil) + response = create_or_update_async(resource_uri, parameters, name, custom_headers).value! + response.body unless response.nil? + end + + # + # Creates or updates diagnostic settings for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @param parameters [DiagnosticSettingsResource] Parameters supplied to the + # operation. + # @param name [String] The name of the diagnostic setting. + # @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 create_or_update_with_http_info(resource_uri, parameters, name, custom_headers = nil) + create_or_update_async(resource_uri, parameters, name, custom_headers).value! + end + + # + # Creates or updates diagnostic settings for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @param parameters [DiagnosticSettingsResource] Parameters supplied to the + # operation. + # @param name [String] The name of the diagnostic setting. + # @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 create_or_update_async(resource_uri, parameters, name, custom_headers = nil) + fail ArgumentError, 'resource_uri is nil' if resource_uri.nil? + api_version = '2017-05-01-preview' + fail ArgumentError, 'parameters is nil' if parameters.nil? + fail ArgumentError, 'name is nil' if name.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? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::ARM::Monitor::Models::DiagnosticSettingsResource.mapper() + request_content = @client.serialize(request_mapper, parameters) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceUri' => resource_uri,'name' => name}, + query_params: {'api-version' => api_version}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:put, 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 MsRest::HttpOperationError.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::ARM::Monitor::Models::DiagnosticSettingsResource.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 + + # + # Deletes existing diagnostic settings for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @param name [String] The name of the diagnostic setting. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # + def delete(resource_uri, name, custom_headers = nil) + response = delete_async(resource_uri, name, custom_headers).value! + nil + end + + # + # Deletes existing diagnostic settings for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @param name [String] The name of the diagnostic setting. + # @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 delete_with_http_info(resource_uri, name, custom_headers = nil) + delete_async(resource_uri, name, custom_headers).value! + end + + # + # Deletes existing diagnostic settings for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @param name [String] The name of the diagnostic setting. + # @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 delete_async(resource_uri, name, custom_headers = nil) + fail ArgumentError, 'resource_uri is nil' if resource_uri.nil? + api_version = '2017-05-01-preview' + fail ArgumentError, 'name is nil' if name.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 = '{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'resourceUri' => resource_uri,'name' => name}, + query_params: {'api-version' => api_version}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = @client.make_request_async(:delete, 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 || status_code == 204 + error_model = JSON.load(response_content) + fail MsRest::HttpOperationError.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? + + result + end + + promise.execute + end + + # + # Gets the active diagnostic settings list for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [DiagnosticSettingsResourceCollection] operation results. + # + def list(resource_uri, custom_headers = nil) + response = list_async(resource_uri, custom_headers).value! + response.body unless response.nil? + end + + # + # Gets the active diagnostic settings list for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @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_with_http_info(resource_uri, custom_headers = nil) + list_async(resource_uri, custom_headers).value! + end + + # + # Gets the active diagnostic settings list for the specified resource. + # + # @param resource_uri [String] The identifier of the resource. + # @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_async(resource_uri, custom_headers = nil) + fail ArgumentError, 'resource_uri is nil' if resource_uri.nil? + api_version = '2017-05-01-preview' + + + 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 = '{resourceUri}/providers/microsoft.insights/diagnosticSettings' request_url = @base_url || @client.base_url @@ -97,223 +369,7 @@ module Azure::ARM::Monitor if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) - result_mapper = Azure::ARM::Monitor::Models::ServiceDiagnosticSettingsResource.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 - - # - # Create or update new diagnostic settings for the specified resource. - # **WARNING**: This method will be deprecated in future releases. - # - # @param resource_uri [String] The identifier of the resource. - # @param parameters [ServiceDiagnosticSettingsResource] Parameters supplied to - # the operation. - # @param custom_headers [Hash{String => String}] A hash of custom headers that - # will be added to the HTTP request. - # - # @return [ServiceDiagnosticSettingsResource] operation results. - # - def create_or_update(resource_uri, parameters, custom_headers = nil) - response = create_or_update_async(resource_uri, parameters, custom_headers).value! - response.body unless response.nil? - end - - # - # Create or update new diagnostic settings for the specified resource. - # **WARNING**: This method will be deprecated in future releases. - # - # @param resource_uri [String] The identifier of the resource. - # @param parameters [ServiceDiagnosticSettingsResource] Parameters supplied to - # the 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 create_or_update_with_http_info(resource_uri, parameters, custom_headers = nil) - create_or_update_async(resource_uri, parameters, custom_headers).value! - end - - # - # Create or update new diagnostic settings for the specified resource. - # **WARNING**: This method will be deprecated in future releases. - # - # @param resource_uri [String] The identifier of the resource. - # @param parameters [ServiceDiagnosticSettingsResource] Parameters supplied to - # the 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 create_or_update_async(resource_uri, parameters, custom_headers = nil) - fail ArgumentError, 'resource_uri is nil' if resource_uri.nil? - api_version = '2016-09-01' - fail ArgumentError, 'parameters is nil' if parameters.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? - - request_headers['Content-Type'] = 'application/json; charset=utf-8' - - # Serialize Request - request_mapper = Azure::ARM::Monitor::Models::ServiceDiagnosticSettingsResource.mapper() - request_content = @client.serialize(request_mapper, parameters) - request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil - - path_template = '{resourceUri}/providers/microsoft.insights/diagnosticSettings/service' - - request_url = @base_url || @client.base_url - - options = { - middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], - path_params: {'resourceUri' => resource_uri}, - query_params: {'api-version' => api_version}, - body: request_content, - headers: request_headers.merge(custom_headers || {}), - base_url: request_url - } - promise = @client.make_request_async(:put, 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::ARM::Monitor::Models::ServiceDiagnosticSettingsResource.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 - - # - # Updates an existing ServiceDiagnosticSettingsResource. To update other fields - # use the CreateOrUpdate method. **WARNING**: This method will be deprecated in - # future releases. - # - # @param resource_uri [String] The identifier of the resource. - # @param service_diagnostic_settings_resource - # [ServiceDiagnosticSettingsResourcePatch] Parameters supplied to the - # operation. - # @param custom_headers [Hash{String => String}] A hash of custom headers that - # will be added to the HTTP request. - # - # @return [ServiceDiagnosticSettingsResource] operation results. - # - def update(resource_uri, service_diagnostic_settings_resource, custom_headers = nil) - response = update_async(resource_uri, service_diagnostic_settings_resource, custom_headers).value! - response.body unless response.nil? - end - - # - # Updates an existing ServiceDiagnosticSettingsResource. To update other fields - # use the CreateOrUpdate method. **WARNING**: This method will be deprecated in - # future releases. - # - # @param resource_uri [String] The identifier of the resource. - # @param service_diagnostic_settings_resource - # [ServiceDiagnosticSettingsResourcePatch] Parameters supplied to the - # 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 update_with_http_info(resource_uri, service_diagnostic_settings_resource, custom_headers = nil) - update_async(resource_uri, service_diagnostic_settings_resource, custom_headers).value! - end - - # - # Updates an existing ServiceDiagnosticSettingsResource. To update other fields - # use the CreateOrUpdate method. **WARNING**: This method will be deprecated in - # future releases. - # - # @param resource_uri [String] The identifier of the resource. - # @param service_diagnostic_settings_resource - # [ServiceDiagnosticSettingsResourcePatch] Parameters supplied to the - # 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 update_async(resource_uri, service_diagnostic_settings_resource, custom_headers = nil) - fail ArgumentError, 'resource_uri is nil' if resource_uri.nil? - api_version = '2016-09-01' - fail ArgumentError, 'service_diagnostic_settings_resource is nil' if service_diagnostic_settings_resource.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? - - request_headers['Content-Type'] = 'application/json; charset=utf-8' - - # Serialize Request - request_mapper = Azure::ARM::Monitor::Models::ServiceDiagnosticSettingsResourcePatch.mapper() - request_content = @client.serialize(request_mapper, service_diagnostic_settings_resource) - request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil - - path_template = '{resourceUri}/providers/microsoft.insights/diagnosticSettings/service' - - request_url = @base_url || @client.base_url - - options = { - middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], - path_params: {'resourceUri' => resource_uri}, - query_params: {'api-version' => api_version}, - body: request_content, - headers: request_headers.merge(custom_headers || {}), - base_url: request_url - } - promise = @client.make_request_async(:patch, 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 MsRest::HttpOperationError.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::ARM::Monitor::Models::ServiceDiagnosticSettingsResource.mapper() + result_mapper = Azure::ARM::Monitor::Models::DiagnosticSettingsResourceCollection.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) diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/category_type.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/category_type.rb new file mode 100644 index 000000000..e08f9e791 --- /dev/null +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/category_type.rb @@ -0,0 +1,16 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::Monitor + module Models + # + # Defines values for CategoryType + # + module CategoryType + Metrics = "Metrics" + Logs = "Logs" + end + end +end diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/diagnostic_settings_category_resource.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/diagnostic_settings_category_resource.rb new file mode 100644 index 000000000..8bc2f9e58 --- /dev/null +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/diagnostic_settings_category_resource.rb @@ -0,0 +1,71 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::Monitor + module Models + # + # The diagnostic settings category resource. + # + class DiagnosticSettingsCategoryResource < MsRestAzure::ProxyOnlyResource + + include MsRestAzure + + include MsRest::JSONable + # @return [CategoryType] The type of the diagnostic settings category. + # Possible values include: 'Metrics', 'Logs' + attr_accessor :category_type + + + # + # Mapper for DiagnosticSettingsCategoryResource class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'DiagnosticSettingsCategoryResource', + type: { + name: 'Composite', + class_name: 'DiagnosticSettingsCategoryResource', + model_properties: { + id: { + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + }, + category_type: { + required: false, + serialized_name: 'properties.categoryType', + type: { + name: 'Enum', + module: 'CategoryType' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/diagnostic_settings_category_resource_collection.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/diagnostic_settings_category_resource_collection.rb new file mode 100644 index 000000000..22129f89c --- /dev/null +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/diagnostic_settings_category_resource_collection.rb @@ -0,0 +1,55 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::Monitor + module Models + # + # Represents a collection of diagnostic setting category resources. + # + class DiagnosticSettingsCategoryResourceCollection + + include MsRestAzure + + include MsRest::JSONable + # @return [Array] The collection of + # diagnostic settings category resources. + attr_accessor :value + + + # + # Mapper for DiagnosticSettingsCategoryResourceCollection class as Ruby + # Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'DiagnosticSettingsCategoryResourceCollection', + type: { + name: 'Composite', + class_name: 'DiagnosticSettingsCategoryResourceCollection', + model_properties: { + value: { + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'DiagnosticSettingsCategoryResourceElementType', + type: { + name: 'Composite', + class_name: 'DiagnosticSettingsCategoryResource' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/diagnostic_settings_resource.rb similarity index 72% rename from management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource.rb rename to management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/diagnostic_settings_resource.rb index 00ea38e63..b36af3bc3 100644 --- a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource.rb +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/diagnostic_settings_resource.rb @@ -6,9 +6,9 @@ module Azure::ARM::Monitor module Models # - # Description of a service diagnostic setting + # The diagnostic setting resource. # - class ServiceDiagnosticSettingsResource < MsRestAzure::Resource + class DiagnosticSettingsResource < MsRestAzure::ProxyOnlyResource include MsRestAzure @@ -17,16 +17,13 @@ module Azure::ARM::Monitor # would like to send Diagnostic Logs. attr_accessor :storage_account_id - # @return [String] The service bus rule ID of the service bus namespace - # in which you would like to have Event Hubs created for streaming - # Diagnostic Logs. The rule ID is of the format: '{service bus resource - # ID}/authorizationrules/{key name}'. - attr_accessor :service_bus_rule_id - - # @return [String] The resource Id for the event hub namespace - # authorization rule. + # @return [String] The resource Id for the event hub authorization rule. attr_accessor :event_hub_authorization_rule_id + # @return [String] The name of the event hub. If none is specified, the + # default event hub will be selected. + attr_accessor :event_hub_name + # @return [Array] the list of metric settings. attr_accessor :metrics @@ -41,16 +38,16 @@ module Azure::ARM::Monitor # - # Mapper for ServiceDiagnosticSettingsResource class as Ruby Hash. + # Mapper for DiagnosticSettingsResource class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { required: false, - serialized_name: 'ServiceDiagnosticSettingsResource', + serialized_name: 'DiagnosticSettingsResource', type: { name: 'Composite', - class_name: 'ServiceDiagnosticSettingsResource', + class_name: 'DiagnosticSettingsResource', model_properties: { id: { required: false, @@ -76,27 +73,6 @@ module Azure::ARM::Monitor name: 'String' } }, - location: { - required: true, - serialized_name: 'location', - type: { - name: 'String' - } - }, - tags: { - required: false, - serialized_name: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serialized_name: 'StringElementType', - type: { - name: 'String' - } - } - } - }, storage_account_id: { required: false, serialized_name: 'properties.storageAccountId', @@ -104,16 +80,16 @@ module Azure::ARM::Monitor name: 'String' } }, - service_bus_rule_id: { + event_hub_authorization_rule_id: { required: false, - serialized_name: 'properties.serviceBusRuleId', + serialized_name: 'properties.eventHubAuthorizationRuleId', type: { name: 'String' } }, - event_hub_authorization_rule_id: { + event_hub_name: { required: false, - serialized_name: 'properties.eventHubAuthorizationRuleId', + serialized_name: 'properties.eventHubName', type: { name: 'String' } diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/diagnostic_settings_resource_collection.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/diagnostic_settings_resource_collection.rb new file mode 100644 index 000000000..c9d4051e8 --- /dev/null +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/diagnostic_settings_resource_collection.rb @@ -0,0 +1,54 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::Monitor + module Models + # + # Represents a collection of alert rule resources. + # + class DiagnosticSettingsResourceCollection + + include MsRestAzure + + include MsRest::JSONable + # @return [Array] The collection of + # diagnostic settings resources;. + attr_accessor :value + + + # + # Mapper for DiagnosticSettingsResourceCollection class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'DiagnosticSettingsResourceCollection', + type: { + name: 'Composite', + class_name: 'DiagnosticSettingsResourceCollection', + model_properties: { + value: { + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'DiagnosticSettingsResourceElementType', + type: { + name: 'Composite', + class_name: 'DiagnosticSettingsResource' + } + } + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/metric_settings.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/metric_settings.rb index a77b6728d..bed28e87c 100644 --- a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/metric_settings.rb +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/metric_settings.rb @@ -17,10 +17,16 @@ module Azure::ARM::Monitor # @return [Duration] the timegrain of the metric in ISO8601 format. attr_accessor :time_grain - # @return [Boolean] a value indicating whether this timegrain is enabled. + # @return [String] Name of a Diagnostic Metric category for a resource + # type this setting is applied to. To obtain the list of Diagnostic + # metric categories for a resource, first perform a GET diagnostic + # settings operation. + attr_accessor :category + + # @return [Boolean] a value indicating whether this category is enabled. attr_accessor :enabled - # @return [RetentionPolicy] the retention policy for this timegrain. + # @return [RetentionPolicy] the retention policy for this category. attr_accessor :retention_policy @@ -37,12 +43,19 @@ module Azure::ARM::Monitor class_name: 'MetricSettings', model_properties: { time_grain: { - required: true, + required: false, serialized_name: 'timeGrain', type: { name: 'TimeSpan' } }, + category: { + required: false, + serialized_name: 'category', + type: { + name: 'String' + } + }, enabled: { required: true, serialized_name: 'enabled', diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/operation.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/operation.rb new file mode 100644 index 000000000..66396dd30 --- /dev/null +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/operation.rb @@ -0,0 +1,57 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::Monitor + module Models + # + # Microsoft Insights API operation definition. + # + class Operation + + include MsRestAzure + + include MsRest::JSONable + # @return [String] Operation name: {provider}/{resource}/{operation} + attr_accessor :name + + # @return [OperationDisplay] Display metadata associated with the + # operation. + attr_accessor :display + + + # + # Mapper for Operation class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'Operation', + type: { + name: 'Composite', + class_name: 'Operation', + model_properties: { + name: { + required: false, + serialized_name: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serialized_name: 'display', + type: { + name: 'Composite', + class_name: 'OperationDisplay' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/operation_display.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/operation_display.rb new file mode 100644 index 000000000..65c97dba7 --- /dev/null +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/operation_display.rb @@ -0,0 +1,66 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::Monitor + module Models + # + # Display metadata associated with the operation. + # + class OperationDisplay + + include MsRestAzure + + include MsRest::JSONable + # @return [String] Service provider: Microsoft.Insights + attr_accessor :provider + + # @return [String] Resource on which the operation is performed: + # AlertRules, Autoscale, etc. + attr_accessor :resource + + # @return [String] Operation type: Read, write, delete, etc. + attr_accessor :operation + + + # + # Mapper for OperationDisplay class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'Operation_display', + type: { + name: 'Composite', + class_name: 'OperationDisplay', + model_properties: { + provider: { + required: false, + serialized_name: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serialized_name: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + serialized_name: 'operation', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/operation_list_result.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/operation_list_result.rb new file mode 100644 index 000000000..a9bdd5525 --- /dev/null +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/operation_list_result.rb @@ -0,0 +1,66 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::Monitor + module Models + # + # Result of the request to list Microsoft.Insights operations. It contains + # a list of operations and a URL link to get the next set of results. + # + class OperationListResult + + include MsRestAzure + + include MsRest::JSONable + # @return [Array] List of operations supported by the + # Microsoft.Insights provider. + attr_accessor :value + + # @return [String] URL to get the next set of operation list results if + # there are any. + attr_accessor :next_link + + + # + # Mapper for OperationListResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'OperationListResult', + type: { + name: 'Composite', + class_name: 'OperationListResult', + model_properties: { + value: { + required: false, + serialized_name: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'OperationElementType', + type: { + name: 'Composite', + class_name: 'Operation' + } + } + } + }, + next_link: { + required: false, + serialized_name: 'nextLink', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/proxy_only_resource.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/proxy_only_resource.rb new file mode 100644 index 000000000..0650dc1c8 --- /dev/null +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/proxy_only_resource.rb @@ -0,0 +1,68 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::Monitor + module Models + # + # A proxy only azure resource object + # + class ProxyOnlyResource + + include MsRestAzure + + include MsRest::JSONable + # @return [String] Azure resource Id + attr_accessor :id + + # @return [String] Azure resource name + attr_accessor :name + + # @return [String] Azure resource type + attr_accessor :type + + + # + # Mapper for ProxyOnlyResource class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ProxyOnlyResource', + type: { + name: 'Composite', + class_name: 'ProxyOnlyResource', + model_properties: { + id: { + required: false, + read_only: true, + serialized_name: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + read_only: true, + serialized_name: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + read_only: true, + serialized_name: 'type', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource_patch.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource_patch.rb deleted file mode 100644 index d3e57b9e7..000000000 --- a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource_patch.rb +++ /dev/null @@ -1,136 +0,0 @@ -# encoding: utf-8 -# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. - -module Azure::ARM::Monitor - module Models - # - # Service diagnostic setting resource for patch operations - # - class ServiceDiagnosticSettingsResourcePatch - - include MsRestAzure - - include MsRest::JSONable - # @return [Hash{String => String}] Resource tags - attr_accessor :tags - - # @return [String] The resource ID of the storage account to which you - # would like to send Diagnostic Logs. - attr_accessor :storage_account_id - - # @return [String] The service bus rule ID of the service bus namespace - # in which you would like to have Event Hubs created for streaming - # Diagnostic Logs. The rule ID is of the format: '{service bus resource - # ID}/authorizationrules/{key name}'. - attr_accessor :service_bus_rule_id - - # @return [String] The resource Id for the event hub namespace - # authorization rule. - attr_accessor :event_hub_authorization_rule_id - - # @return [Array] the list of metric settings. - attr_accessor :metrics - - # @return [Array] the list of logs settings. - attr_accessor :logs - - # @return [String] The workspace ID (resource ID of a Log Analytics - # workspace) for a Log Analytics workspace to which you would like to - # send Diagnostic Logs. Example: - # /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - attr_accessor :workspace_id - - - # - # Mapper for ServiceDiagnosticSettingsResourcePatch class as Ruby Hash. - # This will be used for serialization/deserialization. - # - def self.mapper() - { - required: false, - serialized_name: 'ServiceDiagnosticSettingsResourcePatch', - type: { - name: 'Composite', - class_name: 'ServiceDiagnosticSettingsResourcePatch', - model_properties: { - tags: { - required: false, - serialized_name: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serialized_name: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - storage_account_id: { - required: false, - serialized_name: 'properties.storageAccountId', - type: { - name: 'String' - } - }, - service_bus_rule_id: { - required: false, - serialized_name: 'properties.serviceBusRuleId', - type: { - name: 'String' - } - }, - event_hub_authorization_rule_id: { - required: false, - serialized_name: 'properties.eventHubAuthorizationRuleId', - type: { - name: 'String' - } - }, - metrics: { - required: false, - serialized_name: 'properties.metrics', - type: { - name: 'Sequence', - element: { - required: false, - serialized_name: 'MetricSettingsElementType', - type: { - name: 'Composite', - class_name: 'MetricSettings' - } - } - } - }, - logs: { - required: false, - serialized_name: 'properties.logs', - type: { - name: 'Sequence', - element: { - required: false, - serialized_name: 'LogSettingsElementType', - type: { - name: 'Composite', - class_name: 'LogSettings' - } - } - } - }, - workspace_id: { - required: false, - serialized_name: 'properties.workspaceId', - type: { - name: 'String' - } - } - } - } - } - end - end - end -end diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/monitor_management_client.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/monitor_management_client.rb index 411a2fe95..ac017295d 100644 --- a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/monitor_management_client.rb +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/monitor_management_client.rb @@ -34,6 +34,9 @@ module Azure::ARM::Monitor # @return [AutoscaleSettings] autoscale_settings attr_reader :autoscale_settings + # @return [Operations] operations + attr_reader :operations + # @return [AlertRuleIncidents] alert_rule_incidents attr_reader :alert_rule_incidents @@ -43,9 +46,12 @@ module Azure::ARM::Monitor # @return [LogProfiles] log_profiles attr_reader :log_profiles - # @return [ServiceDiagnosticSettingsOperations] - # service_diagnostic_settings_operations - attr_reader :service_diagnostic_settings_operations + # @return [DiagnosticSettingsOperations] diagnostic_settings_operations + attr_reader :diagnostic_settings_operations + + # @return [DiagnosticSettingsCategoryOperations] + # diagnostic_settings_category_operations + attr_reader :diagnostic_settings_category_operations # @return [ActionGroups] action_groups attr_reader :action_groups @@ -67,10 +73,12 @@ module Azure::ARM::Monitor @credentials = credentials @autoscale_settings = AutoscaleSettings.new(self) + @operations = Operations.new(self) @alert_rule_incidents = AlertRuleIncidents.new(self) @alert_rules = AlertRules.new(self) @log_profiles = LogProfiles.new(self) - @service_diagnostic_settings_operations = ServiceDiagnosticSettingsOperations.new(self) + @diagnostic_settings_operations = DiagnosticSettingsOperations.new(self) + @diagnostic_settings_category_operations = DiagnosticSettingsCategoryOperations.new(self) @action_groups = ActionGroups.new(self) @activity_log_alerts = ActivityLogAlerts.new(self) @accept_language = 'en-US' diff --git a/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/operations.rb b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/operations.rb new file mode 100644 index 000000000..10342bc90 --- /dev/null +++ b/management/azure_mgmt_monitor/lib/generated/azure_mgmt_monitor/operations.rb @@ -0,0 +1,106 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::ARM::Monitor + # + # Monitor Management Client + # + class Operations + include MsRestAzure + + # + # Creates and initializes a new instance of the Operations class. + # @param client service class for accessing basic functionality. + # + def initialize(client) + @client = client + end + + # @return [MonitorManagementClient] reference to the MonitorManagementClient + attr_reader :client + + # + # Lists all of the available operations from Microsoft.Insights provider. + # + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [OperationListResult] operation results. + # + def list(custom_headers = nil) + response = list_async(custom_headers).value! + response.body unless response.nil? + end + + # + # Lists all of the available operations from Microsoft.Insights provider. + # + # @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_with_http_info(custom_headers = nil) + list_async(custom_headers).value! + end + + # + # Lists all of the available operations from Microsoft.Insights provider. + # + # @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_async(custom_headers = nil) + api_version = '2015-04-01' + + + 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 = 'providers/microsoft.insights/operations' + + request_url = @base_url || @client.base_url + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'api-version' => 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::ARM::Monitor::Models::OperationListResult.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 + + end +end