azure_mgmt_monitor 0.16.0 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-04-01/generated/azure_mgmt_monitor.rb +14 -4
  3. data/lib/2015-04-01/generated/azure_mgmt_monitor/activity_logs.rb +313 -0
  4. data/lib/2015-04-01/generated/azure_mgmt_monitor/autoscale_settings.rb +1 -1
  5. data/lib/2015-04-01/generated/azure_mgmt_monitor/event_categories.rb +113 -0
  6. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/event_category_collection.rb +57 -0
  7. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/event_data.rb +380 -0
  8. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/event_data_collection.rb +99 -0
  9. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/event_level.rb +19 -0
  10. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/http_request_info.rb +79 -0
  11. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/localizable_string.rb +57 -0
  12. data/lib/2015-04-01/generated/azure_mgmt_monitor/models/sender_authorization.rb +71 -0
  13. data/lib/2015-04-01/generated/azure_mgmt_monitor/monitor_management_client.rb +12 -0
  14. data/lib/2015-04-01/generated/azure_mgmt_monitor/operations.rb +1 -1
  15. data/lib/2015-04-01/generated/azure_mgmt_monitor/tenant_activity_logs.rb +339 -0
  16. data/lib/2016-03-01/generated/azure_mgmt_monitor.rb +17 -10
  17. data/lib/2016-03-01/generated/azure_mgmt_monitor/alert_rule_incidents.rb +1 -1
  18. data/lib/2016-03-01/generated/azure_mgmt_monitor/alert_rules.rb +1 -1
  19. data/lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb +1 -1
  20. data/lib/2016-03-01/generated/azure_mgmt_monitor/metric_definitions.rb +133 -0
  21. data/lib/2016-03-01/generated/azure_mgmt_monitor/models/aggregation_type.rb +20 -0
  22. data/lib/2016-03-01/generated/azure_mgmt_monitor/models/localizable_string.rb +57 -0
  23. data/lib/2016-03-01/generated/azure_mgmt_monitor/models/metric_availability.rb +60 -0
  24. data/lib/2016-03-01/generated/azure_mgmt_monitor/models/metric_definition.rb +120 -0
  25. data/lib/2016-03-01/generated/azure_mgmt_monitor/models/metric_definition_collection.rb +56 -0
  26. data/lib/2016-03-01/generated/azure_mgmt_monitor/models/unit.rb +21 -0
  27. data/lib/2016-03-01/generated/azure_mgmt_monitor/monitor_management_client.rb +8 -4
  28. data/lib/2016-09-01/generated/azure_mgmt_monitor.rb +9 -3
  29. data/lib/2016-09-01/generated/azure_mgmt_monitor/metrics.rb +172 -0
  30. data/lib/2016-09-01/generated/azure_mgmt_monitor/models/localizable_string.rb +57 -0
  31. data/lib/2016-09-01/generated/azure_mgmt_monitor/models/metric.rb +105 -0
  32. data/lib/2016-09-01/generated/azure_mgmt_monitor/models/metric_collection.rb +55 -0
  33. data/lib/2016-09-01/generated/azure_mgmt_monitor/models/metric_value.rb +104 -0
  34. data/lib/2016-09-01/generated/azure_mgmt_monitor/models/unit.rb +21 -0
  35. data/lib/2016-09-01/generated/azure_mgmt_monitor/monitor_client.rb +4 -0
  36. data/lib/2016-09-01/generated/azure_mgmt_monitor/service_diagnostic_settings_operations.rb +4 -4
  37. data/lib/2017-04-01/generated/azure_mgmt_monitor/action_groups.rb +1 -1
  38. data/lib/2017-04-01/generated/azure_mgmt_monitor/activity_log_alerts.rb +1 -1
  39. data/lib/2017-04-01/generated/azure_mgmt_monitor/models/action_group_resource.rb +1 -1
  40. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor.rb +19 -5
  41. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/diagnostic_settings_category_operations.rb +4 -3
  42. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/diagnostic_settings_operations.rb +8 -5
  43. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/metric_definitions.rb +112 -0
  44. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/metrics.rb +190 -0
  45. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/aggregation_type.rb +20 -0
  46. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/localizable_string.rb +57 -0
  47. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/metadata_value.rb +58 -0
  48. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/metric.rb +105 -0
  49. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/metric_availability.rb +60 -0
  50. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/metric_definition.rb +152 -0
  51. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/metric_definition_collection.rb +56 -0
  52. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/metric_value.rb +104 -0
  53. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/response.rb +98 -0
  54. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/result_type.rb +16 -0
  55. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/time_series_element.rb +79 -0
  56. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/models/unit.rb +23 -0
  57. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/monitor_management_client.rb +11 -3
  58. data/lib/2017-11-01-preview/generated/azure_mgmt_monitor/metric_baseline.rb +1 -1
  59. data/lib/2018-01-01/generated/azure_mgmt_monitor.rb +42 -0
  60. data/lib/2018-01-01/generated/azure_mgmt_monitor/metric_definitions.rb +118 -0
  61. data/lib/2018-01-01/generated/azure_mgmt_monitor/metrics.rb +199 -0
  62. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/aggregation_type.rb +20 -0
  63. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/error_response.rb +57 -0
  64. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/localizable_string.rb +57 -0
  65. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/metadata_value.rb +58 -0
  66. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/metric.rb +105 -0
  67. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/metric_availability.rb +60 -0
  68. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/metric_definition.rb +184 -0
  69. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/metric_definition_collection.rb +56 -0
  70. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/metric_value.rb +104 -0
  71. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/response.rb +120 -0
  72. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/result_type.rb +16 -0
  73. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/time_series_element.rb +79 -0
  74. data/lib/2018-01-01/generated/azure_mgmt_monitor/models/unit.rb +23 -0
  75. data/lib/2018-01-01/generated/azure_mgmt_monitor/module_definition.rb +9 -0
  76. data/lib/2018-01-01/generated/azure_mgmt_monitor/monitor_management_client.rb +131 -0
  77. data/lib/2018-03-01/generated/azure_mgmt_monitor.rb +57 -0
  78. data/lib/2018-03-01/generated/azure_mgmt_monitor/action_groups.rb +693 -0
  79. data/lib/2018-03-01/generated/azure_mgmt_monitor/metric_alerts.rb +582 -0
  80. data/lib/2018-03-01/generated/azure_mgmt_monitor/metric_alerts_status.rb +213 -0
  81. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/action_group_list.rb +67 -0
  82. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/action_group_patch_body.rb +68 -0
  83. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/action_group_resource.rb +304 -0
  84. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/automation_runbook_receiver.rb +102 -0
  85. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/azure_app_push_receiver.rb +58 -0
  86. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/azure_function_receiver.rb +80 -0
  87. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/email_receiver.rb +72 -0
  88. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/enable_request.rb +46 -0
  89. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/error_response.rb +57 -0
  90. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/itsm_receiver.rb +94 -0
  91. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/logic_app_receiver.rb +69 -0
  92. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_action.rb +65 -0
  93. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_criteria.rb +65 -0
  94. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_resource.rb +226 -0
  95. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_resource_collection.rb +56 -0
  96. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_resource_patch.rb +194 -0
  97. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_single_resource_multiple_metric_criteria.rb +88 -0
  98. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_status.rb +81 -0
  99. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_status_collection.rb +56 -0
  100. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_status_properties.rb +76 -0
  101. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_criteria.rb +122 -0
  102. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/metric_dimension.rb +77 -0
  103. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/receiver_status.rb +17 -0
  104. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/resource.rb +101 -0
  105. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/sms_receiver.rb +83 -0
  106. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/voice_receiver.rb +69 -0
  107. data/lib/2018-03-01/generated/azure_mgmt_monitor/models/webhook_receiver.rb +58 -0
  108. data/lib/2018-03-01/generated/azure_mgmt_monitor/module_definition.rb +9 -0
  109. data/lib/2018-03-01/generated/azure_mgmt_monitor/monitor_management_client.rb +138 -0
  110. data/lib/2018-04-16/generated/azure_mgmt_monitor.rb +46 -0
  111. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/action.rb +47 -0
  112. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/alert_severity.rb +19 -0
  113. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/alerting_action.rb +99 -0
  114. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/az_ns_action_group.rb +78 -0
  115. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/conditional_operator.rb +17 -0
  116. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/enabled.rb +16 -0
  117. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/error_response.rb +57 -0
  118. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/log_metric_trigger.rb +83 -0
  119. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/log_search_rule_resource.rb +174 -0
  120. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/log_search_rule_resource_collection.rb +56 -0
  121. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/log_search_rule_resource_patch.rb +67 -0
  122. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/metric_trigger_type.rb +16 -0
  123. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/provisioning_state.rb +18 -0
  124. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/query_type.rb +15 -0
  125. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/resource.rb +101 -0
  126. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/schedule.rb +59 -0
  127. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/source.rb +89 -0
  128. data/lib/2018-04-16/generated/azure_mgmt_monitor/models/trigger_condition.rb +72 -0
  129. data/lib/2018-04-16/generated/azure_mgmt_monitor/module_definition.rb +9 -0
  130. data/lib/2018-04-16/generated/azure_mgmt_monitor/monitor_client.rb +130 -0
  131. data/lib/2018-04-16/generated/azure_mgmt_monitor/scheduled_query_rules.rb +610 -0
  132. data/lib/azure_mgmt_monitor.rb +5 -2
  133. data/lib/profiles/latest/modules/monitor_profile_module.rb +119 -45
  134. data/lib/version.rb +1 -1
  135. metadata +113 -3
@@ -0,0 +1,57 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2018-03-01/generated/azure_mgmt_monitor/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::Monitor::Mgmt::V2018_03_01
23
+ autoload :MetricAlerts, '2018-03-01/generated/azure_mgmt_monitor/metric_alerts.rb'
24
+ autoload :MetricAlertsStatus, '2018-03-01/generated/azure_mgmt_monitor/metric_alerts_status.rb'
25
+ autoload :ActionGroups, '2018-03-01/generated/azure_mgmt_monitor/action_groups.rb'
26
+ autoload :MonitorManagementClient, '2018-03-01/generated/azure_mgmt_monitor/monitor_management_client.rb'
27
+
28
+ module Models
29
+ autoload :EmailReceiver, '2018-03-01/generated/azure_mgmt_monitor/models/email_receiver.rb'
30
+ autoload :Resource, '2018-03-01/generated/azure_mgmt_monitor/models/resource.rb'
31
+ autoload :SmsReceiver, '2018-03-01/generated/azure_mgmt_monitor/models/sms_receiver.rb'
32
+ autoload :MetricAlertCriteria, '2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_criteria.rb'
33
+ autoload :WebhookReceiver, '2018-03-01/generated/azure_mgmt_monitor/models/webhook_receiver.rb'
34
+ autoload :MetricAlertResourcePatch, '2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_resource_patch.rb'
35
+ autoload :ItsmReceiver, '2018-03-01/generated/azure_mgmt_monitor/models/itsm_receiver.rb'
36
+ autoload :MetricAlertStatusProperties, '2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_status_properties.rb'
37
+ autoload :AzureAppPushReceiver, '2018-03-01/generated/azure_mgmt_monitor/models/azure_app_push_receiver.rb'
38
+ autoload :MetricAlertStatusCollection, '2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_status_collection.rb'
39
+ autoload :AutomationRunbookReceiver, '2018-03-01/generated/azure_mgmt_monitor/models/automation_runbook_receiver.rb'
40
+ autoload :MetricCriteria, '2018-03-01/generated/azure_mgmt_monitor/models/metric_criteria.rb'
41
+ autoload :VoiceReceiver, '2018-03-01/generated/azure_mgmt_monitor/models/voice_receiver.rb'
42
+ autoload :ErrorResponse, '2018-03-01/generated/azure_mgmt_monitor/models/error_response.rb'
43
+ autoload :LogicAppReceiver, '2018-03-01/generated/azure_mgmt_monitor/models/logic_app_receiver.rb'
44
+ autoload :MetricAlertAction, '2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_action.rb'
45
+ autoload :MetricAlertResourceCollection, '2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_resource_collection.rb'
46
+ autoload :ActionGroupPatchBody, '2018-03-01/generated/azure_mgmt_monitor/models/action_group_patch_body.rb'
47
+ autoload :MetricDimension, '2018-03-01/generated/azure_mgmt_monitor/models/metric_dimension.rb'
48
+ autoload :AzureFunctionReceiver, '2018-03-01/generated/azure_mgmt_monitor/models/azure_function_receiver.rb'
49
+ autoload :MetricAlertStatus, '2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_status.rb'
50
+ autoload :EnableRequest, '2018-03-01/generated/azure_mgmt_monitor/models/enable_request.rb'
51
+ autoload :ActionGroupList, '2018-03-01/generated/azure_mgmt_monitor/models/action_group_list.rb'
52
+ autoload :MetricAlertResource, '2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_resource.rb'
53
+ autoload :MetricAlertSingleResourceMultipleMetricCriteria, '2018-03-01/generated/azure_mgmt_monitor/models/metric_alert_single_resource_multiple_metric_criteria.rb'
54
+ autoload :ActionGroupResource, '2018-03-01/generated/azure_mgmt_monitor/models/action_group_resource.rb'
55
+ autoload :ReceiverStatus, '2018-03-01/generated/azure_mgmt_monitor/models/receiver_status.rb'
56
+ end
57
+ end
@@ -0,0 +1,693 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Monitor::Mgmt::V2018_03_01
7
+ #
8
+ # Monitor Management Client
9
+ #
10
+ class ActionGroups
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ActionGroups class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [MonitorManagementClient] reference to the MonitorManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Create a new action group or update an existing one.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group.
28
+ # @param action_group_name [String] The name of the action group.
29
+ # @param action_group [ActionGroupResource] The action group to create or use
30
+ # for the update.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [ActionGroupResource] operation results.
35
+ #
36
+ def create_or_update(resource_group_name, action_group_name, action_group, custom_headers:nil)
37
+ response = create_or_update_async(resource_group_name, action_group_name, action_group, custom_headers:custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Create a new action group or update an existing one.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group.
45
+ # @param action_group_name [String] The name of the action group.
46
+ # @param action_group [ActionGroupResource] The action group to create or use
47
+ # for the update.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def create_or_update_with_http_info(resource_group_name, action_group_name, action_group, custom_headers:nil)
54
+ create_or_update_async(resource_group_name, action_group_name, action_group, custom_headers:custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Create a new action group or update an existing one.
59
+ #
60
+ # @param resource_group_name [String] The name of the resource group.
61
+ # @param action_group_name [String] The name of the action group.
62
+ # @param action_group [ActionGroupResource] The action group to create or use
63
+ # for the update.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def create_or_update_async(resource_group_name, action_group_name, action_group, custom_headers:nil)
70
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
71
+ fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
72
+ fail ArgumentError, 'action_group is nil' if action_group.nil?
73
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
74
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
75
+
76
+
77
+ request_headers = {}
78
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
79
+
80
+ # Set Headers
81
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
82
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
83
+
84
+ # Serialize Request
85
+ request_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupResource.mapper()
86
+ request_content = @client.serialize(request_mapper, action_group)
87
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
88
+
89
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'
90
+
91
+ request_url = @base_url || @client.base_url
92
+
93
+ options = {
94
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
95
+ path_params: {'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name,'subscriptionId' => @client.subscription_id},
96
+ query_params: {'api-version' => @client.api_version},
97
+ body: request_content,
98
+ headers: request_headers.merge(custom_headers || {}),
99
+ base_url: request_url
100
+ }
101
+ promise = @client.make_request_async(:put, path_template, options)
102
+
103
+ promise = promise.then do |result|
104
+ http_response = result.response
105
+ status_code = http_response.status
106
+ response_content = http_response.body
107
+ unless status_code == 200 || status_code == 201
108
+ error_model = JSON.load(response_content)
109
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
110
+ end
111
+
112
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
113
+ # Deserialize Response
114
+ if status_code == 200
115
+ begin
116
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
117
+ result_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupResource.mapper()
118
+ result.body = @client.deserialize(result_mapper, parsed_response)
119
+ rescue Exception => e
120
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
121
+ end
122
+ end
123
+ # Deserialize Response
124
+ if status_code == 201
125
+ begin
126
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
127
+ result_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupResource.mapper()
128
+ result.body = @client.deserialize(result_mapper, parsed_response)
129
+ rescue Exception => e
130
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
131
+ end
132
+ end
133
+
134
+ result
135
+ end
136
+
137
+ promise.execute
138
+ end
139
+
140
+ #
141
+ # Get an action group.
142
+ #
143
+ # @param resource_group_name [String] The name of the resource group.
144
+ # @param action_group_name [String] The name of the action group.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [ActionGroupResource] operation results.
149
+ #
150
+ def get(resource_group_name, action_group_name, custom_headers:nil)
151
+ response = get_async(resource_group_name, action_group_name, custom_headers:custom_headers).value!
152
+ response.body unless response.nil?
153
+ end
154
+
155
+ #
156
+ # Get an action group.
157
+ #
158
+ # @param resource_group_name [String] The name of the resource group.
159
+ # @param action_group_name [String] The name of the action group.
160
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
161
+ # will be added to the HTTP request.
162
+ #
163
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
164
+ #
165
+ def get_with_http_info(resource_group_name, action_group_name, custom_headers:nil)
166
+ get_async(resource_group_name, action_group_name, custom_headers:custom_headers).value!
167
+ end
168
+
169
+ #
170
+ # Get an action group.
171
+ #
172
+ # @param resource_group_name [String] The name of the resource group.
173
+ # @param action_group_name [String] The name of the action group.
174
+ # @param [Hash{String => String}] A hash of custom headers that will be added
175
+ # to the HTTP request.
176
+ #
177
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
178
+ #
179
+ def get_async(resource_group_name, action_group_name, custom_headers:nil)
180
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
181
+ fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
182
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
183
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
184
+
185
+
186
+ request_headers = {}
187
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
188
+
189
+ # Set Headers
190
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
191
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
192
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'
193
+
194
+ request_url = @base_url || @client.base_url
195
+
196
+ options = {
197
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
198
+ path_params: {'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name,'subscriptionId' => @client.subscription_id},
199
+ query_params: {'api-version' => @client.api_version},
200
+ headers: request_headers.merge(custom_headers || {}),
201
+ base_url: request_url
202
+ }
203
+ promise = @client.make_request_async(:get, path_template, options)
204
+
205
+ promise = promise.then do |result|
206
+ http_response = result.response
207
+ status_code = http_response.status
208
+ response_content = http_response.body
209
+ unless status_code == 200
210
+ error_model = JSON.load(response_content)
211
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
212
+ end
213
+
214
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
215
+ # Deserialize Response
216
+ if status_code == 200
217
+ begin
218
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
219
+ result_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupResource.mapper()
220
+ result.body = @client.deserialize(result_mapper, parsed_response)
221
+ rescue Exception => e
222
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
223
+ end
224
+ end
225
+
226
+ result
227
+ end
228
+
229
+ promise.execute
230
+ end
231
+
232
+ #
233
+ # Delete an action group.
234
+ #
235
+ # @param resource_group_name [String] The name of the resource group.
236
+ # @param action_group_name [String] The name of the action group.
237
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
238
+ # will be added to the HTTP request.
239
+ #
240
+ #
241
+ def delete(resource_group_name, action_group_name, custom_headers:nil)
242
+ response = delete_async(resource_group_name, action_group_name, custom_headers:custom_headers).value!
243
+ nil
244
+ end
245
+
246
+ #
247
+ # Delete an action group.
248
+ #
249
+ # @param resource_group_name [String] The name of the resource group.
250
+ # @param action_group_name [String] The name of the action group.
251
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
252
+ # will be added to the HTTP request.
253
+ #
254
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
255
+ #
256
+ def delete_with_http_info(resource_group_name, action_group_name, custom_headers:nil)
257
+ delete_async(resource_group_name, action_group_name, custom_headers:custom_headers).value!
258
+ end
259
+
260
+ #
261
+ # Delete an action group.
262
+ #
263
+ # @param resource_group_name [String] The name of the resource group.
264
+ # @param action_group_name [String] The name of the action group.
265
+ # @param [Hash{String => String}] A hash of custom headers that will be added
266
+ # to the HTTP request.
267
+ #
268
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
269
+ #
270
+ def delete_async(resource_group_name, action_group_name, custom_headers:nil)
271
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
272
+ fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
273
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
274
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
275
+
276
+
277
+ request_headers = {}
278
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
279
+
280
+ # Set Headers
281
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
282
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
283
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'
284
+
285
+ request_url = @base_url || @client.base_url
286
+
287
+ options = {
288
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
289
+ path_params: {'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name,'subscriptionId' => @client.subscription_id},
290
+ query_params: {'api-version' => @client.api_version},
291
+ headers: request_headers.merge(custom_headers || {}),
292
+ base_url: request_url
293
+ }
294
+ promise = @client.make_request_async(:delete, path_template, options)
295
+
296
+ promise = promise.then do |result|
297
+ http_response = result.response
298
+ status_code = http_response.status
299
+ response_content = http_response.body
300
+ unless status_code == 200 || status_code == 204
301
+ error_model = JSON.load(response_content)
302
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
303
+ end
304
+
305
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
306
+
307
+ result
308
+ end
309
+
310
+ promise.execute
311
+ end
312
+
313
+ #
314
+ # Updates an existing action group's tags. To update other fields use the
315
+ # CreateOrUpdate method.
316
+ #
317
+ # @param resource_group_name [String] The name of the resource group.
318
+ # @param action_group_name [String] The name of the action group.
319
+ # @param action_group_patch [ActionGroupPatchBody] Parameters supplied to the
320
+ # operation.
321
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
322
+ # will be added to the HTTP request.
323
+ #
324
+ # @return [ActionGroupResource] operation results.
325
+ #
326
+ def update(resource_group_name, action_group_name, action_group_patch, custom_headers:nil)
327
+ response = update_async(resource_group_name, action_group_name, action_group_patch, custom_headers:custom_headers).value!
328
+ response.body unless response.nil?
329
+ end
330
+
331
+ #
332
+ # Updates an existing action group's tags. To update other fields use the
333
+ # CreateOrUpdate method.
334
+ #
335
+ # @param resource_group_name [String] The name of the resource group.
336
+ # @param action_group_name [String] The name of the action group.
337
+ # @param action_group_patch [ActionGroupPatchBody] Parameters supplied to the
338
+ # operation.
339
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
340
+ # will be added to the HTTP request.
341
+ #
342
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
343
+ #
344
+ def update_with_http_info(resource_group_name, action_group_name, action_group_patch, custom_headers:nil)
345
+ update_async(resource_group_name, action_group_name, action_group_patch, custom_headers:custom_headers).value!
346
+ end
347
+
348
+ #
349
+ # Updates an existing action group's tags. To update other fields use the
350
+ # CreateOrUpdate method.
351
+ #
352
+ # @param resource_group_name [String] The name of the resource group.
353
+ # @param action_group_name [String] The name of the action group.
354
+ # @param action_group_patch [ActionGroupPatchBody] Parameters supplied to the
355
+ # operation.
356
+ # @param [Hash{String => String}] A hash of custom headers that will be added
357
+ # to the HTTP request.
358
+ #
359
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
360
+ #
361
+ def update_async(resource_group_name, action_group_name, action_group_patch, custom_headers:nil)
362
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
363
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
364
+ fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
365
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
366
+ fail ArgumentError, 'action_group_patch is nil' if action_group_patch.nil?
367
+
368
+
369
+ request_headers = {}
370
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
371
+
372
+ # Set Headers
373
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
374
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
375
+
376
+ # Serialize Request
377
+ request_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupPatchBody.mapper()
378
+ request_content = @client.serialize(request_mapper, action_group_patch)
379
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
380
+
381
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}'
382
+
383
+ request_url = @base_url || @client.base_url
384
+
385
+ options = {
386
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
387
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name},
388
+ query_params: {'api-version' => @client.api_version},
389
+ body: request_content,
390
+ headers: request_headers.merge(custom_headers || {}),
391
+ base_url: request_url
392
+ }
393
+ promise = @client.make_request_async(:patch, path_template, options)
394
+
395
+ promise = promise.then do |result|
396
+ http_response = result.response
397
+ status_code = http_response.status
398
+ response_content = http_response.body
399
+ unless status_code == 200
400
+ error_model = JSON.load(response_content)
401
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
402
+ end
403
+
404
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
405
+ # Deserialize Response
406
+ if status_code == 200
407
+ begin
408
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
409
+ result_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupResource.mapper()
410
+ result.body = @client.deserialize(result_mapper, parsed_response)
411
+ rescue Exception => e
412
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
413
+ end
414
+ end
415
+
416
+ result
417
+ end
418
+
419
+ promise.execute
420
+ end
421
+
422
+ #
423
+ # Get a list of all action groups in a subscription.
424
+ #
425
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
426
+ # will be added to the HTTP request.
427
+ #
428
+ # @return [ActionGroupList] operation results.
429
+ #
430
+ def list_by_subscription_id(custom_headers:nil)
431
+ response = list_by_subscription_id_async(custom_headers:custom_headers).value!
432
+ response.body unless response.nil?
433
+ end
434
+
435
+ #
436
+ # Get a list of all action groups in a subscription.
437
+ #
438
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
439
+ # will be added to the HTTP request.
440
+ #
441
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
442
+ #
443
+ def list_by_subscription_id_with_http_info(custom_headers:nil)
444
+ list_by_subscription_id_async(custom_headers:custom_headers).value!
445
+ end
446
+
447
+ #
448
+ # Get a list of all action groups in a subscription.
449
+ #
450
+ # @param [Hash{String => String}] A hash of custom headers that will be added
451
+ # to the HTTP request.
452
+ #
453
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
454
+ #
455
+ def list_by_subscription_id_async(custom_headers:nil)
456
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
457
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
458
+
459
+
460
+ request_headers = {}
461
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
462
+
463
+ # Set Headers
464
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
465
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
466
+ path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups'
467
+
468
+ request_url = @base_url || @client.base_url
469
+
470
+ options = {
471
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
472
+ path_params: {'subscriptionId' => @client.subscription_id},
473
+ query_params: {'api-version' => @client.api_version},
474
+ headers: request_headers.merge(custom_headers || {}),
475
+ base_url: request_url
476
+ }
477
+ promise = @client.make_request_async(:get, path_template, options)
478
+
479
+ promise = promise.then do |result|
480
+ http_response = result.response
481
+ status_code = http_response.status
482
+ response_content = http_response.body
483
+ unless status_code == 200
484
+ error_model = JSON.load(response_content)
485
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
486
+ end
487
+
488
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
489
+ # Deserialize Response
490
+ if status_code == 200
491
+ begin
492
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
493
+ result_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupList.mapper()
494
+ result.body = @client.deserialize(result_mapper, parsed_response)
495
+ rescue Exception => e
496
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
497
+ end
498
+ end
499
+
500
+ result
501
+ end
502
+
503
+ promise.execute
504
+ end
505
+
506
+ #
507
+ # Get a list of all action groups in a resource group.
508
+ #
509
+ # @param resource_group_name [String] The name of the resource group.
510
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
511
+ # will be added to the HTTP request.
512
+ #
513
+ # @return [ActionGroupList] operation results.
514
+ #
515
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
516
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
517
+ response.body unless response.nil?
518
+ end
519
+
520
+ #
521
+ # Get a list of all action groups in a resource group.
522
+ #
523
+ # @param resource_group_name [String] The name of the resource group.
524
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
525
+ # will be added to the HTTP request.
526
+ #
527
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
528
+ #
529
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
530
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
531
+ end
532
+
533
+ #
534
+ # Get a list of all action groups in a resource group.
535
+ #
536
+ # @param resource_group_name [String] The name of the resource group.
537
+ # @param [Hash{String => String}] A hash of custom headers that will be added
538
+ # to the HTTP request.
539
+ #
540
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
541
+ #
542
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
543
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
544
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
545
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
546
+
547
+
548
+ request_headers = {}
549
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
550
+
551
+ # Set Headers
552
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
553
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
554
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups'
555
+
556
+ request_url = @base_url || @client.base_url
557
+
558
+ options = {
559
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
560
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
561
+ query_params: {'api-version' => @client.api_version},
562
+ headers: request_headers.merge(custom_headers || {}),
563
+ base_url: request_url
564
+ }
565
+ promise = @client.make_request_async(:get, path_template, options)
566
+
567
+ promise = promise.then do |result|
568
+ http_response = result.response
569
+ status_code = http_response.status
570
+ response_content = http_response.body
571
+ unless status_code == 200
572
+ error_model = JSON.load(response_content)
573
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
574
+ end
575
+
576
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
577
+ # Deserialize Response
578
+ if status_code == 200
579
+ begin
580
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
581
+ result_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::ActionGroupList.mapper()
582
+ result.body = @client.deserialize(result_mapper, parsed_response)
583
+ rescue Exception => e
584
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
585
+ end
586
+ end
587
+
588
+ result
589
+ end
590
+
591
+ promise.execute
592
+ end
593
+
594
+ #
595
+ # Enable a receiver in an action group. This changes the receiver's status from
596
+ # Disabled to Enabled. This operation is only supported for Email or SMS
597
+ # receivers.
598
+ #
599
+ # @param resource_group_name [String] The name of the resource group.
600
+ # @param action_group_name [String] The name of the action group.
601
+ # @param enable_request [EnableRequest] The receiver to re-enable.
602
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
603
+ # will be added to the HTTP request.
604
+ #
605
+ #
606
+ def enable_receiver(resource_group_name, action_group_name, enable_request, custom_headers:nil)
607
+ response = enable_receiver_async(resource_group_name, action_group_name, enable_request, custom_headers:custom_headers).value!
608
+ nil
609
+ end
610
+
611
+ #
612
+ # Enable a receiver in an action group. This changes the receiver's status from
613
+ # Disabled to Enabled. This operation is only supported for Email or SMS
614
+ # receivers.
615
+ #
616
+ # @param resource_group_name [String] The name of the resource group.
617
+ # @param action_group_name [String] The name of the action group.
618
+ # @param enable_request [EnableRequest] The receiver to re-enable.
619
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
620
+ # will be added to the HTTP request.
621
+ #
622
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
623
+ #
624
+ def enable_receiver_with_http_info(resource_group_name, action_group_name, enable_request, custom_headers:nil)
625
+ enable_receiver_async(resource_group_name, action_group_name, enable_request, custom_headers:custom_headers).value!
626
+ end
627
+
628
+ #
629
+ # Enable a receiver in an action group. This changes the receiver's status from
630
+ # Disabled to Enabled. This operation is only supported for Email or SMS
631
+ # receivers.
632
+ #
633
+ # @param resource_group_name [String] The name of the resource group.
634
+ # @param action_group_name [String] The name of the action group.
635
+ # @param enable_request [EnableRequest] The receiver to re-enable.
636
+ # @param [Hash{String => String}] A hash of custom headers that will be added
637
+ # to the HTTP request.
638
+ #
639
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
640
+ #
641
+ def enable_receiver_async(resource_group_name, action_group_name, enable_request, custom_headers:nil)
642
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
643
+ fail ArgumentError, 'action_group_name is nil' if action_group_name.nil?
644
+ fail ArgumentError, 'enable_request is nil' if enable_request.nil?
645
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
646
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
647
+
648
+
649
+ request_headers = {}
650
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
651
+
652
+ # Set Headers
653
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
654
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
655
+
656
+ # Serialize Request
657
+ request_mapper = Azure::Monitor::Mgmt::V2018_03_01::Models::EnableRequest.mapper()
658
+ request_content = @client.serialize(request_mapper, enable_request)
659
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
660
+
661
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe'
662
+
663
+ request_url = @base_url || @client.base_url
664
+
665
+ options = {
666
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
667
+ path_params: {'resourceGroupName' => resource_group_name,'actionGroupName' => action_group_name,'subscriptionId' => @client.subscription_id},
668
+ query_params: {'api-version' => @client.api_version},
669
+ body: request_content,
670
+ headers: request_headers.merge(custom_headers || {}),
671
+ base_url: request_url
672
+ }
673
+ promise = @client.make_request_async(:post, path_template, options)
674
+
675
+ promise = promise.then do |result|
676
+ http_response = result.response
677
+ status_code = http_response.status
678
+ response_content = http_response.body
679
+ unless status_code == 200 || status_code == 409
680
+ error_model = JSON.load(response_content)
681
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
682
+ end
683
+
684
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
685
+
686
+ result
687
+ end
688
+
689
+ promise.execute
690
+ end
691
+
692
+ end
693
+ end