Class: Azure::Monitor::Mgmt::V2016_03_01::LogProfiles

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2016-03-01/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/2016-03-01/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/2016-03-01/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.



203
204
205
206
# File 'lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb', line 203

def create_or_update(log_profile_name, parameters, custom_headers:nil)
  response = create_or_update_async(log_profile_name, parameters, custom_headers: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.



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
286
287
288
289
290
291
292
# File 'lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb', line 232

def create_or_update_async(log_profile_name, parameters, custom_headers:nil)
  fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Monitor::Mgmt::V2016_03_01::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' => @client.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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::Monitor::Mgmt::V2016_03_01::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.



218
219
220
# File 'lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb', line 218

def create_or_update_with_http_info(log_profile_name, parameters, custom_headers:nil)
  create_or_update_async(log_profile_name, parameters, custom_headers: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/2016-03-01/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: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
99
100
101
# File 'lib/2016-03-01/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?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  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' => @client.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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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/2016-03-01/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: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.



112
113
114
115
# File 'lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb', line 112

def get(log_profile_name, custom_headers:nil)
  response = get_async(log_profile_name, custom_headers: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.



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
186
187
188
189
190
191
# File 'lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb', line 139

def get_async(log_profile_name, custom_headers:nil)
  fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  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' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail 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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::Monitor::Mgmt::V2016_03_01::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.



126
127
128
# File 'lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb', line 126

def get_with_http_info(log_profile_name, custom_headers:nil)
  get_async(log_profile_name, custom_headers: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.



409
410
411
412
# File 'lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb', line 409

def list(custom_headers:nil)
  response = list_async(custom_headers: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.



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
475
476
477
478
479
480
481
482
483
484
485
# File 'lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb', line 434

def list_async(custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  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' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::Monitor::Mgmt::V2016_03_01::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.



422
423
424
# File 'lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb', line 422

def list_with_http_info(custom_headers:nil)
  list_async(custom_headers: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.



306
307
308
309
# File 'lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb', line 306

def update(log_profile_name, log_profiles_resource, custom_headers:nil)
  response = update_async(log_profile_name, log_profiles_resource, custom_headers: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.



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
392
393
394
395
396
397
398
399
# File 'lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb', line 339

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?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'log_profiles_resource is nil' if log_profiles_resource.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::Monitor::Mgmt::V2016_03_01::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' => @client.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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::Monitor::Mgmt::V2016_03_01::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.



323
324
325
# File 'lib/2016-03-01/generated/azure_mgmt_monitor/log_profiles.rb', line 323

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