azure_mgmt_insights 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/azure_mgmt_insights.rb +5 -0
- data/lib/generated/azure_mgmt_insights.rb +77 -0
- data/lib/generated/azure_mgmt_insights/alert_rule_incidents.rb +121 -0
- data/lib/generated/azure_mgmt_insights/alert_rules.rb +410 -0
- data/lib/generated/azure_mgmt_insights/autoscale_settings.rb +521 -0
- data/lib/generated/azure_mgmt_insights/incidents.rb +117 -0
- data/lib/generated/azure_mgmt_insights/insights_management_client.rb +147 -0
- data/lib/generated/azure_mgmt_insights/log_profiles.rb +375 -0
- data/lib/generated/azure_mgmt_insights/models/alert_rule_resource.rb +156 -0
- data/lib/generated/azure_mgmt_insights/models/alert_rule_resource_collection.rb +53 -0
- data/lib/generated/azure_mgmt_insights/models/autoscale_notification.rb +77 -0
- data/lib/generated/azure_mgmt_insights/models/autoscale_profile.rb +100 -0
- data/lib/generated/azure_mgmt_insights/models/autoscale_setting_resource.rb +152 -0
- data/lib/generated/azure_mgmt_insights/models/autoscale_setting_resource_collection.rb +94 -0
- data/lib/generated/azure_mgmt_insights/models/comparison_operation_type.rb +20 -0
- data/lib/generated/azure_mgmt_insights/models/condition_operator.rb +18 -0
- data/lib/generated/azure_mgmt_insights/models/email_notification.rb +73 -0
- data/lib/generated/azure_mgmt_insights/models/incident.rb +92 -0
- data/lib/generated/azure_mgmt_insights/models/incident_list_result.rb +52 -0
- data/lib/generated/azure_mgmt_insights/models/location_threshold_rule_condition.rb +85 -0
- data/lib/generated/azure_mgmt_insights/models/log_profile_collection.rb +52 -0
- data/lib/generated/azure_mgmt_insights/models/log_profile_create_or_update_parameters.rb +99 -0
- data/lib/generated/azure_mgmt_insights/models/log_profile_resource.rb +143 -0
- data/lib/generated/azure_mgmt_insights/models/log_settings.rb +66 -0
- data/lib/generated/azure_mgmt_insights/models/management_event_aggregation_condition.rb +69 -0
- data/lib/generated/azure_mgmt_insights/models/management_event_rule_condition.rb +74 -0
- data/lib/generated/azure_mgmt_insights/models/metric_settings.rb +66 -0
- data/lib/generated/azure_mgmt_insights/models/metric_statistic_type.rb +18 -0
- data/lib/generated/azure_mgmt_insights/models/metric_trigger.rb +133 -0
- data/lib/generated/azure_mgmt_insights/models/recurrence.rb +61 -0
- data/lib/generated/azure_mgmt_insights/models/recurrence_frequency.rb +22 -0
- data/lib/generated/azure_mgmt_insights/models/recurrent_schedule.rb +101 -0
- data/lib/generated/azure_mgmt_insights/models/retention_policy.rb +55 -0
- data/lib/generated/azure_mgmt_insights/models/rule_action.rb +47 -0
- data/lib/generated/azure_mgmt_insights/models/rule_condition.rb +47 -0
- data/lib/generated/azure_mgmt_insights/models/rule_data_source.rb +46 -0
- data/lib/generated/azure_mgmt_insights/models/rule_email_action.rb +78 -0
- data/lib/generated/azure_mgmt_insights/models/rule_management_event_claims_data_source.rb +44 -0
- data/lib/generated/azure_mgmt_insights/models/rule_management_event_data_source.rb +151 -0
- data/lib/generated/azure_mgmt_insights/models/rule_metric_data_source.rb +70 -0
- data/lib/generated/azure_mgmt_insights/models/rule_webhook_action.rb +77 -0
- data/lib/generated/azure_mgmt_insights/models/scale_action.rb +85 -0
- data/lib/generated/azure_mgmt_insights/models/scale_capacity.rb +67 -0
- data/lib/generated/azure_mgmt_insights/models/scale_direction.rb +17 -0
- data/lib/generated/azure_mgmt_insights/models/scale_rule.rb +57 -0
- data/lib/generated/azure_mgmt_insights/models/service_diagnostic_settings_create_or_update_parameters.rb +101 -0
- data/lib/generated/azure_mgmt_insights/models/service_diagnostic_settings_resource.rb +144 -0
- data/lib/generated/azure_mgmt_insights/models/threshold_rule_condition.rb +111 -0
- data/lib/generated/azure_mgmt_insights/models/time_aggregation_operator.rb +19 -0
- data/lib/generated/azure_mgmt_insights/models/time_aggregation_type.rb +19 -0
- data/lib/generated/azure_mgmt_insights/models/time_window.rb +67 -0
- data/lib/generated/azure_mgmt_insights/models/webhook_notification.rb +61 -0
- data/lib/generated/azure_mgmt_insights/module_definition.rb +8 -0
- data/lib/generated/azure_mgmt_insights/service_diagnostic_settings_operations.rb +216 -0
- data/lib/generated/azure_mgmt_insights/version.rb +8 -0
- metadata +169 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Insights
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# A rule condition based on a metric crossing a threshold.
|
10
|
+
#
|
11
|
+
class ThresholdRuleCondition < RuleCondition
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@odata.type = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_accessor :odata.type
|
21
|
+
|
22
|
+
# @return [RuleDataSource] the resource from which the rule collects its
|
23
|
+
# data.
|
24
|
+
attr_accessor :data_source
|
25
|
+
|
26
|
+
# @return [ConditionOperator] the operator used to compare the data and
|
27
|
+
# the threshold. Possible values include: 'GreaterThan',
|
28
|
+
# 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'
|
29
|
+
attr_accessor :operator
|
30
|
+
|
31
|
+
# @return [Float] the threshold value that activates the alert.
|
32
|
+
attr_accessor :threshold
|
33
|
+
|
34
|
+
# @return [Duration] the period of time (in ISO 8601 duration format)
|
35
|
+
# that is used to monitor alert activity based on the threshold. If
|
36
|
+
# specified then it must be between 5 minutes and 1 day.
|
37
|
+
attr_accessor :window_size
|
38
|
+
|
39
|
+
# @return [TimeAggregationOperator] the time aggregation operator. How
|
40
|
+
# the data that is collected should be combined over time. The default
|
41
|
+
# value is the PrimaryAggregationType of the Metric. Possible values
|
42
|
+
# include: 'Average', 'Minimum', 'Maximum', 'Total', 'Last'
|
43
|
+
attr_accessor :time_aggregation
|
44
|
+
|
45
|
+
|
46
|
+
#
|
47
|
+
# Mapper for ThresholdRuleCondition class as Ruby Hash.
|
48
|
+
# This will be used for serialization/deserialization.
|
49
|
+
#
|
50
|
+
def self.mapper()
|
51
|
+
{
|
52
|
+
required: false,
|
53
|
+
serialized_name: 'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition',
|
54
|
+
type: {
|
55
|
+
name: 'Composite',
|
56
|
+
class_name: 'ThresholdRuleCondition',
|
57
|
+
model_properties: {
|
58
|
+
odata.type: {
|
59
|
+
required: true,
|
60
|
+
serialized_name: 'odata.type',
|
61
|
+
type: {
|
62
|
+
name: 'String'
|
63
|
+
}
|
64
|
+
},
|
65
|
+
data_source: {
|
66
|
+
required: false,
|
67
|
+
serialized_name: 'dataSource',
|
68
|
+
type: {
|
69
|
+
name: 'Composite',
|
70
|
+
polymorphic_discriminator: 'odata.type',
|
71
|
+
uber_parent: 'RuleDataSource',
|
72
|
+
class_name: 'RuleDataSource'
|
73
|
+
}
|
74
|
+
},
|
75
|
+
operator: {
|
76
|
+
required: true,
|
77
|
+
serialized_name: 'operator',
|
78
|
+
type: {
|
79
|
+
name: 'Enum',
|
80
|
+
module: 'ConditionOperator'
|
81
|
+
}
|
82
|
+
},
|
83
|
+
threshold: {
|
84
|
+
required: true,
|
85
|
+
serialized_name: 'threshold',
|
86
|
+
type: {
|
87
|
+
name: 'Double'
|
88
|
+
}
|
89
|
+
},
|
90
|
+
window_size: {
|
91
|
+
required: false,
|
92
|
+
serialized_name: 'windowSize',
|
93
|
+
type: {
|
94
|
+
name: 'TimeSpan'
|
95
|
+
}
|
96
|
+
},
|
97
|
+
time_aggregation: {
|
98
|
+
required: false,
|
99
|
+
serialized_name: 'timeAggregation',
|
100
|
+
type: {
|
101
|
+
name: 'Enum',
|
102
|
+
module: 'TimeAggregationOperator'
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Insights
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for TimeAggregationOperator
|
10
|
+
#
|
11
|
+
module TimeAggregationOperator
|
12
|
+
Average = "Average"
|
13
|
+
Minimum = "Minimum"
|
14
|
+
Maximum = "Maximum"
|
15
|
+
Total = "Total"
|
16
|
+
Last = "Last"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Insights
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for TimeAggregationType
|
10
|
+
#
|
11
|
+
module TimeAggregationType
|
12
|
+
Average = "Average"
|
13
|
+
Minimum = "Minimum"
|
14
|
+
Maximum = "Maximum"
|
15
|
+
Total = "Total"
|
16
|
+
Count = "Count"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Insights
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# A specific date-time for the profile. This element is not used if the
|
10
|
+
# Recurrence element is used.
|
11
|
+
#
|
12
|
+
class TimeWindow
|
13
|
+
|
14
|
+
include MsRestAzure
|
15
|
+
|
16
|
+
# @return [String] the time zone of the start and end times for the
|
17
|
+
# profile. See examples of valid timezone ids over here:
|
18
|
+
# https://msdn.microsoft.com/en-us/library/azure/dn931928.aspx
|
19
|
+
attr_accessor :time_zone
|
20
|
+
|
21
|
+
# @return [DateTime] the start time for the profile in ISO 8601 format.
|
22
|
+
attr_accessor :start
|
23
|
+
|
24
|
+
# @return [DateTime] the end time for the profile in ISO 8601 format.
|
25
|
+
attr_accessor :end_property
|
26
|
+
|
27
|
+
|
28
|
+
#
|
29
|
+
# Mapper for TimeWindow class as Ruby Hash.
|
30
|
+
# This will be used for serialization/deserialization.
|
31
|
+
#
|
32
|
+
def self.mapper()
|
33
|
+
{
|
34
|
+
required: false,
|
35
|
+
serialized_name: 'TimeWindow',
|
36
|
+
type: {
|
37
|
+
name: 'Composite',
|
38
|
+
class_name: 'TimeWindow',
|
39
|
+
model_properties: {
|
40
|
+
time_zone: {
|
41
|
+
required: false,
|
42
|
+
serialized_name: 'timeZone',
|
43
|
+
type: {
|
44
|
+
name: 'String'
|
45
|
+
}
|
46
|
+
},
|
47
|
+
start: {
|
48
|
+
required: true,
|
49
|
+
serialized_name: 'start',
|
50
|
+
type: {
|
51
|
+
name: 'DateTime'
|
52
|
+
}
|
53
|
+
},
|
54
|
+
end_property: {
|
55
|
+
required: true,
|
56
|
+
serialized_name: 'end',
|
57
|
+
type: {
|
58
|
+
name: 'DateTime'
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Insights
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Webhook notification.
|
10
|
+
#
|
11
|
+
class WebhookNotification
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] the service address to receive the notification.
|
16
|
+
attr_accessor :service_uri
|
17
|
+
|
18
|
+
# @return [Hash{String => String}] a property bag of settings.
|
19
|
+
attr_accessor :properties
|
20
|
+
|
21
|
+
|
22
|
+
#
|
23
|
+
# Mapper for WebhookNotification class as Ruby Hash.
|
24
|
+
# This will be used for serialization/deserialization.
|
25
|
+
#
|
26
|
+
def self.mapper()
|
27
|
+
{
|
28
|
+
required: false,
|
29
|
+
serialized_name: 'WebhookNotification',
|
30
|
+
type: {
|
31
|
+
name: 'Composite',
|
32
|
+
class_name: 'WebhookNotification',
|
33
|
+
model_properties: {
|
34
|
+
service_uri: {
|
35
|
+
required: false,
|
36
|
+
serialized_name: 'serviceUri',
|
37
|
+
type: {
|
38
|
+
name: 'String'
|
39
|
+
}
|
40
|
+
},
|
41
|
+
properties: {
|
42
|
+
required: false,
|
43
|
+
serialized_name: 'properties',
|
44
|
+
type: {
|
45
|
+
name: 'Dictionary',
|
46
|
+
value: {
|
47
|
+
required: false,
|
48
|
+
serialized_name: 'StringElementType',
|
49
|
+
type: {
|
50
|
+
name: 'String'
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,216 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Insights
|
7
|
+
#
|
8
|
+
# Composite Swagger for Insights Management Client
|
9
|
+
#
|
10
|
+
class ServiceDiagnosticSettingsOperations
|
11
|
+
include Azure::ARM::Insights::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the ServiceDiagnosticSettingsOperations class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [InsightsManagementClient] reference to the InsightsManagementClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Gets the active diagnostic settings for the specified resource.
|
27
|
+
#
|
28
|
+
# @param resource_uri [String] The identifier of the resource.
|
29
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
30
|
+
# will be added to the HTTP request.
|
31
|
+
#
|
32
|
+
# @return [ServiceDiagnosticSettingsResource] operation results.
|
33
|
+
#
|
34
|
+
def get(resource_uri, custom_headers = nil)
|
35
|
+
response = get_async(resource_uri, custom_headers).value!
|
36
|
+
response.body unless response.nil?
|
37
|
+
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# Gets the active diagnostic settings for the specified resource.
|
41
|
+
#
|
42
|
+
# @param resource_uri [String] The identifier of the resource.
|
43
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
44
|
+
# will be added to the HTTP request.
|
45
|
+
#
|
46
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
47
|
+
#
|
48
|
+
def get_with_http_info(resource_uri, custom_headers = nil)
|
49
|
+
get_async(resource_uri, custom_headers).value!
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# Gets the active diagnostic settings for the specified resource.
|
54
|
+
#
|
55
|
+
# @param resource_uri [String] The identifier of the resource.
|
56
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
57
|
+
# to the HTTP request.
|
58
|
+
#
|
59
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
60
|
+
#
|
61
|
+
def get_async(resource_uri, custom_headers = nil)
|
62
|
+
fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
|
63
|
+
api_version = '2015-07-01'
|
64
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
65
|
+
|
66
|
+
|
67
|
+
request_headers = {}
|
68
|
+
|
69
|
+
# Set Headers
|
70
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
71
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
72
|
+
path_template = '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'
|
73
|
+
|
74
|
+
request_url = @base_url || @client.base_url
|
75
|
+
|
76
|
+
options = {
|
77
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
78
|
+
path_params: {'resourceUri' => resource_uri,'subscriptionId' => @client.subscription_id},
|
79
|
+
query_params: {'api-version' => api_version},
|
80
|
+
headers: request_headers.merge(custom_headers || {}),
|
81
|
+
base_url: request_url
|
82
|
+
}
|
83
|
+
promise = @client.make_request_async(:get, path_template, options)
|
84
|
+
|
85
|
+
promise = promise.then do |result|
|
86
|
+
http_response = result.response
|
87
|
+
status_code = http_response.status
|
88
|
+
response_content = http_response.body
|
89
|
+
unless status_code == 200
|
90
|
+
error_model = JSON.load(response_content)
|
91
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
92
|
+
end
|
93
|
+
|
94
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
95
|
+
# Deserialize Response
|
96
|
+
if status_code == 200
|
97
|
+
begin
|
98
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
99
|
+
result_mapper = ServiceDiagnosticSettingsResource.mapper()
|
100
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
101
|
+
rescue Exception => e
|
102
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
result
|
107
|
+
end
|
108
|
+
|
109
|
+
promise.execute
|
110
|
+
end
|
111
|
+
|
112
|
+
#
|
113
|
+
# Create or update new diagnostic settings for the specified resource.
|
114
|
+
#
|
115
|
+
# @param resource_uri [String] The identifier of the resource.
|
116
|
+
# @param parameters [ServiceDiagnosticSettingsCreateOrUpdateParameters]
|
117
|
+
# Parameters supplied to the operation.
|
118
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
119
|
+
# will be added to the HTTP request.
|
120
|
+
#
|
121
|
+
# @return [ServiceDiagnosticSettingsResource] operation results.
|
122
|
+
#
|
123
|
+
def create_or_update(resource_uri, parameters, custom_headers = nil)
|
124
|
+
response = create_or_update_async(resource_uri, parameters, custom_headers).value!
|
125
|
+
response.body unless response.nil?
|
126
|
+
end
|
127
|
+
|
128
|
+
#
|
129
|
+
# Create or update new diagnostic settings for the specified resource.
|
130
|
+
#
|
131
|
+
# @param resource_uri [String] The identifier of the resource.
|
132
|
+
# @param parameters [ServiceDiagnosticSettingsCreateOrUpdateParameters]
|
133
|
+
# Parameters supplied to the operation.
|
134
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
135
|
+
# will be added to the HTTP request.
|
136
|
+
#
|
137
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
138
|
+
#
|
139
|
+
def create_or_update_with_http_info(resource_uri, parameters, custom_headers = nil)
|
140
|
+
create_or_update_async(resource_uri, parameters, custom_headers).value!
|
141
|
+
end
|
142
|
+
|
143
|
+
#
|
144
|
+
# Create or update new diagnostic settings for the specified resource.
|
145
|
+
#
|
146
|
+
# @param resource_uri [String] The identifier of the resource.
|
147
|
+
# @param parameters [ServiceDiagnosticSettingsCreateOrUpdateParameters]
|
148
|
+
# Parameters supplied to the operation.
|
149
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
150
|
+
# to the HTTP request.
|
151
|
+
#
|
152
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
153
|
+
#
|
154
|
+
def create_or_update_async(resource_uri, parameters, custom_headers = nil)
|
155
|
+
fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
|
156
|
+
api_version = '2015-07-01'
|
157
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
158
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
159
|
+
|
160
|
+
|
161
|
+
request_headers = {}
|
162
|
+
|
163
|
+
# Set Headers
|
164
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
165
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
166
|
+
|
167
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
168
|
+
|
169
|
+
# Serialize Request
|
170
|
+
request_mapper = ServiceDiagnosticSettingsCreateOrUpdateParameters.mapper()
|
171
|
+
request_content = @client.serialize(request_mapper, parameters, 'parameters')
|
172
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
173
|
+
|
174
|
+
path_template = '/{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'
|
175
|
+
|
176
|
+
request_url = @base_url || @client.base_url
|
177
|
+
|
178
|
+
options = {
|
179
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
180
|
+
path_params: {'resourceUri' => resource_uri,'subscriptionId' => @client.subscription_id},
|
181
|
+
query_params: {'api-version' => api_version},
|
182
|
+
body: request_content,
|
183
|
+
headers: request_headers.merge(custom_headers || {}),
|
184
|
+
base_url: request_url
|
185
|
+
}
|
186
|
+
promise = @client.make_request_async(:put, path_template, options)
|
187
|
+
|
188
|
+
promise = promise.then do |result|
|
189
|
+
http_response = result.response
|
190
|
+
status_code = http_response.status
|
191
|
+
response_content = http_response.body
|
192
|
+
unless status_code == 200
|
193
|
+
error_model = JSON.load(response_content)
|
194
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
195
|
+
end
|
196
|
+
|
197
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
198
|
+
# Deserialize Response
|
199
|
+
if status_code == 200
|
200
|
+
begin
|
201
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
202
|
+
result_mapper = ServiceDiagnosticSettingsResource.mapper()
|
203
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
204
|
+
rescue Exception => e
|
205
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
result
|
210
|
+
end
|
211
|
+
|
212
|
+
promise.execute
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
216
|
+
end
|