Class: Azure::ARM::Monitor::LogProfiles

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/generated/azure_mgmt_monitor/log_profiles.rb

Overview

Monitor Management Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ LogProfiles

Creates and initializes a new instance of the LogProfiles class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientMonitorManagementClient (readonly)

Returns reference to the MonitorManagementClient.

Returns:



22
23
24
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 22

def client
  @client
end

Instance Method Details

#create_or_update(log_profile_name, parameters, custom_headers = nil) ⇒ LogProfileResource

Create or update a log profile in Azure Monitoring REST API.

will be added to the HTTP request.

Parameters:

  • log_profile_name (String)

    The name of the log profile.

  • parameters (LogProfileResource)

    Parameters supplied to the operation.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (LogProfileResource)

    operation results.



197
198
199
200
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 197

def create_or_update(log_profile_name, parameters, custom_headers = nil)
  response = create_or_update_async(log_profile_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(log_profile_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Create or update a log profile in Azure Monitoring REST API.

to the HTTP request.

Parameters:

  • log_profile_name (String)

    The name of the log profile.

  • parameters (LogProfileResource)

    Parameters supplied to the operation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 226

def create_or_update_async(log_profile_name, parameters, custom_headers = nil)
  fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
  api_version = '2016-03-01'
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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::LogProfileResource.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'logProfileName' => log_profile_name,'subscriptionId' => @client.subscription_id},
      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::LogProfileResource.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_with_http_info(log_profile_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Create or update a log profile in Azure Monitoring REST API.

will be added to the HTTP request.

Parameters:

  • log_profile_name (String)

    The name of the log profile.

  • parameters (LogProfileResource)

    Parameters supplied to the operation.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



212
213
214
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 212

def create_or_update_with_http_info(log_profile_name, parameters, custom_headers = nil)
  create_or_update_async(log_profile_name, parameters, custom_headers).value!
end

#delete(log_profile_name, custom_headers = nil) ⇒ Object

Deletes the log profile.

will be added to the HTTP request.

Parameters:

  • log_profile_name (String)

    The name of the log profile.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



32
33
34
35
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 32

def delete(log_profile_name, custom_headers = nil)
  response = delete_async(log_profile_name, custom_headers).value!
  nil
end

#delete_async(log_profile_name, custom_headers = nil) ⇒ Concurrent::Promise

Deletes the log profile.

to the HTTP request.

Parameters:

  • log_profile_name (String)

    The name of the log profile.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 59

def delete_async(log_profile_name, custom_headers = nil)
  fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
  api_version = '2016-03-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'logProfileName' => log_profile_name,'subscriptionId' => @client.subscription_id},
      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
      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?

    result
  end

  promise.execute
end

#delete_with_http_info(log_profile_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes the log profile.

will be added to the HTTP request.

Parameters:

  • log_profile_name (String)

    The name of the log profile.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



46
47
48
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 46

def delete_with_http_info(log_profile_name, custom_headers = nil)
  delete_async(log_profile_name, custom_headers).value!
end

#get(log_profile_name, custom_headers = nil) ⇒ LogProfileResource

Gets the log profile.

will be added to the HTTP request.

Parameters:

  • log_profile_name (String)

    The name of the log profile.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (LogProfileResource)

    operation results.



109
110
111
112
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 109

def get(log_profile_name, custom_headers = nil)
  response = get_async(log_profile_name, custom_headers).value!
  response.body unless response.nil?
end

#get_async(log_profile_name, custom_headers = nil) ⇒ Concurrent::Promise

Gets the log profile.

to the HTTP request.

Parameters:

  • log_profile_name (String)

    The name of the log profile.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 136

def get_async(log_profile_name, custom_headers = nil)
  fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
  api_version = '2016-03-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'logProfileName' => log_profile_name,'subscriptionId' => @client.subscription_id},
      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::LogProfileResource.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

#get_with_http_info(log_profile_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the log profile.

will be added to the HTTP request.

Parameters:

  • log_profile_name (String)

    The name of the log profile.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



123
124
125
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 123

def get_with_http_info(log_profile_name, custom_headers = nil)
  get_async(log_profile_name, custom_headers).value!
end

#list(custom_headers = nil) ⇒ LogProfileCollection

List the log profiles.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (LogProfileCollection)

    operation results.



401
402
403
404
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 401

def list(custom_headers = nil)
  response = list_async(custom_headers).value!
  response.body unless response.nil?
end

#list_async(custom_headers = nil) ⇒ Concurrent::Promise

List the log profiles.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 426

def list_async(custom_headers = nil)
  api_version = '2016-03-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      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::LogProfileCollection.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

#list_with_http_info(custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

List the log profiles.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



414
415
416
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 414

def list_with_http_info(custom_headers = nil)
  list_async(custom_headers).value!
end

#update(log_profile_name, log_profiles_resource, custom_headers = nil) ⇒ LogProfileResource

Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method.

the operation. will be added to the HTTP request.

Parameters:

  • log_profile_name (String)

    The name of the log profile.

  • log_profiles_resource (LogProfileResourcePatch)

    Parameters supplied to

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (LogProfileResource)

    operation results.



299
300
301
302
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 299

def update(log_profile_name, log_profiles_resource, custom_headers = nil)
  response = update_async(log_profile_name, log_profiles_resource, custom_headers).value!
  response.body unless response.nil?
end

#update_async(log_profile_name, log_profiles_resource, custom_headers = nil) ⇒ Concurrent::Promise

Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method.

the operation. to the HTTP request.

Parameters:

  • log_profile_name (String)

    The name of the log profile.

  • log_profiles_resource (LogProfileResourcePatch)

    Parameters supplied to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 332

def update_async(log_profile_name, log_profiles_resource, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
  api_version = '2016-03-01'
  fail ArgumentError, 'log_profiles_resource is nil' if log_profiles_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::LogProfileResourcePatch.mapper()
  request_content = @client.serialize(request_mapper,  log_profiles_resource)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'logProfileName' => log_profile_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(: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::LogProfileResource.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

#update_with_http_info(log_profile_name, log_profiles_resource, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method.

the operation. will be added to the HTTP request.

Parameters:

  • log_profile_name (String)

    The name of the log profile.

  • log_profiles_resource (LogProfileResourcePatch)

    Parameters supplied to

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



316
317
318
# File 'lib/generated/azure_mgmt_monitor/log_profiles.rb', line 316

def update_with_http_info(log_profile_name, log_profiles_resource, custom_headers = nil)
  update_async(log_profile_name, log_profiles_resource, custom_headers).value!
end