Class: Azure::OperationalInsights::Mgmt::V2015_03_20::Workspaces

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb

Overview

Operational Insights Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Workspaces

Creates and initializes a new instance of the Workspaces class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientOperationalInsightsManagementClient (readonly)

Returns reference to the OperationalInsightsManagementClient.

Returns:



22
23
24
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 22

def client
  @client
end

Instance Method Details

#available_service_tiers(resource_group_name, workspace_name, custom_headers: nil) ⇒ Array

Gets the available service tiers for the workspace.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

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

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



753
754
755
756
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 753

def available_service_tiers(resource_group_name, workspace_name, custom_headers:nil)
  response = available_service_tiers_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#available_service_tiers_async(resource_group_name, workspace_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets the available service tiers for the workspace.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 782

def available_service_tiers_async(resource_group_name, workspace_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/availableServiceTiers'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name},
      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 = {
          client_side_validation: true,
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                client_side_validation: true,
                required: false,
                serialized_name: 'AvailableServiceTierElementType',
                type: {
                  name: 'Composite',
                  class_name: 'AvailableServiceTier'
                }
            }
          }
        }
        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

#available_service_tiers_with_http_info(resource_group_name, workspace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the available service tiers for the workspace.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



768
769
770
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 768

def available_service_tiers_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
  available_service_tiers_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
end

#delete_gateways(resource_group_name, workspace_name, gateway_id, custom_headers: nil) ⇒ Object

Delete a Log Analytics gateway.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

  • gateway_id (String)

    The Log Analytics gateway Id.

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

    A hash of custom headers that



663
664
665
666
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 663

def delete_gateways(resource_group_name, workspace_name, gateway_id, custom_headers:nil)
  response = delete_gateways_async(resource_group_name, workspace_name, gateway_id, custom_headers:custom_headers).value!
  nil
end

#delete_gateways_async(resource_group_name, workspace_name, gateway_id, custom_headers: nil) ⇒ Concurrent::Promise

Delete a Log Analytics gateway.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

  • gateway_id (String)

    The Log Analytics gateway Id.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 694

def delete_gateways_async(resource_group_name, workspace_name, gateway_id, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
  fail ArgumentError, 'gateway_id is nil' if gateway_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/gateways/{gatewayId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'gatewayId' => gateway_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_gateways_with_http_info(resource_group_name, workspace_name, gateway_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Delete a Log Analytics gateway.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

  • gateway_id (String)

    The Log Analytics gateway Id.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



679
680
681
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 679

def delete_gateways_with_http_info(resource_group_name, workspace_name, gateway_id, custom_headers:nil)
  delete_gateways_async(resource_group_name, workspace_name, gateway_id, custom_headers:custom_headers).value!
end

#get_purge_status(resource_group_name, workspace_name, custom_headers: nil) ⇒ WorkspacePurgeStatusResponse

Gets status of an ongoing purge operation.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

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

    A hash of custom headers that

Returns:

  • (WorkspacePurgeStatusResponse)

    operation results.



365
366
367
368
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 365

def get_purge_status(resource_group_name, workspace_name, custom_headers:nil)
  response = get_purge_status_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_purge_status_async(resource_group_name, workspace_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets status of an ongoing purge operation.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
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
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 394

def get_purge_status_async(resource_group_name, workspace_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).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?
  fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
  fail ArgumentError, '@client.purge_id is nil' if @client.purge_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}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/operations/{purgeId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'workspaceName' => workspace_name,'purgeId' => @client.purge_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::OperationalInsights::Mgmt::V2015_03_20::Models::WorkspacePurgeStatusResponse.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_purge_status_with_http_info(resource_group_name, workspace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets status of an ongoing purge operation.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



380
381
382
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 380

def get_purge_status_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
  get_purge_status_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
end

#get_schema(resource_group_name, workspace_name, custom_headers: nil) ⇒ SearchGetSchemaResponse

Gets the schema for a given workspace.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

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

    A hash of custom headers that

Returns:

  • (SearchGetSchemaResponse)

    operation results.



142
143
144
145
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 142

def get_schema(resource_group_name, workspace_name, custom_headers:nil)
  response = get_schema_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_schema_async(resource_group_name, workspace_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets the schema for a given workspace.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 171

def get_schema_async(resource_group_name, workspace_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'workspace_name is nil' if workspace_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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/schema'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_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(:post, 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::OperationalInsights::Mgmt::V2015_03_20::Models::SearchGetSchemaResponse.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_schema_with_http_info(resource_group_name, workspace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the schema for a given workspace.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



157
158
159
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 157

def get_schema_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
  get_schema_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
end

#list_keys(resource_group_name, workspace_name, custom_headers: nil) ⇒ SharedKeys

Gets the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational Insights agents to the workspace.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

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

    A hash of custom headers that

Returns:

  • (SharedKeys)

    operation results.



464
465
466
467
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 464

def list_keys(resource_group_name, workspace_name, custom_headers:nil)
  response = list_keys_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_keys_async(resource_group_name, workspace_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational Insights agents to the workspace.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 495

def list_keys_async(resource_group_name, workspace_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/listKeys'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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::OperationalInsights::Mgmt::V2015_03_20::Models::SharedKeys.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_keys_with_http_info(resource_group_name, workspace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational Insights agents to the workspace.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



480
481
482
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 480

def list_keys_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
  list_keys_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
end

Get a list of workspaces which the current user has administrator privileges and are not associated with an Azure Subscription. The subscriptionId parameter in the Url is ignored.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



34
35
36
37
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 34

def list_link_targets(custom_headers:nil)
  response = list_link_targets_async(custom_headers:custom_headers).value!
  response.body unless response.nil?
end

Get a list of workspaces which the current user has administrator privileges and are not associated with an Azure Subscription. The subscriptionId parameter in the Url is ignored.

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.



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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 63

def list_link_targets_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.OperationalInsights/linkTargets'

  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 = {
          client_side_validation: true,
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                client_side_validation: true,
                required: false,
                serialized_name: 'LinkTargetElementType',
                type: {
                  name: 'Composite',
                  class_name: 'LinkTarget'
                }
            }
          }
        }
        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 a list of workspaces which the current user has administrator privileges and are not associated with an Azure Subscription. The subscriptionId parameter in the Url is ignored.

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.



49
50
51
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 49

def list_link_targets_with_http_info(custom_headers:nil)
  list_link_targets_async(custom_headers:custom_headers).value!
end

#purge(resource_group_name, workspace_name, custom_headers: nil) ⇒ WorkspacePurgeResponse

Purges data in an Log Analytics workspace by a set of user-defined filters.

In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

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

    A hash of custom headers that

Returns:

  • (WorkspacePurgeResponse)

    operation results.



246
247
248
249
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 246

def purge(resource_group_name, workspace_name, custom_headers:nil)
  response = purge_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#purge_async(resource_group_name, workspace_name, custom_headers: nil) ⇒ Concurrent::Promise

Purges data in an Log Analytics workspace by a set of user-defined filters.

In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 289

def purge_async(resource_group_name, workspace_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).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?
  fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
  fail ArgumentError, '@client.body is nil' if @client.body.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::OperationalInsights::Mgmt::V2015_03_20::Models::WorkspacePurgeBody.mapper()
  request_content = @client.serialize(request_mapper,  @client.body)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/purge'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'workspaceName' => workspace_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(:post, 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 == 202
      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 == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::OperationalInsights::Mgmt::V2015_03_20::Models::WorkspacePurgeResponse.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

#purge_with_http_info(resource_group_name, workspace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Purges data in an Log Analytics workspace by a set of user-defined filters.

In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



268
269
270
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 268

def purge_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
  purge_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
end

#regenerate_shared_keys(resource_group_name, workspace_name, custom_headers: nil) ⇒ SharedKeys

Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational Insights agents to the workspace.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

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

    A hash of custom headers that

Returns:

  • (SharedKeys)

    operation results.



564
565
566
567
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 564

def regenerate_shared_keys(resource_group_name, workspace_name, custom_headers:nil)
  response = regenerate_shared_keys_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#regenerate_shared_keys_async(resource_group_name, workspace_name, custom_headers: nil) ⇒ Concurrent::Promise

Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational Insights agents to the workspace.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 595

def regenerate_shared_keys_async(resource_group_name, workspace_name, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/regenerateSharedKey'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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::OperationalInsights::Mgmt::V2015_03_20::Models::SharedKeys.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

#regenerate_shared_keys_with_http_info(resource_group_name, workspace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational Insights agents to the workspace.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The Resource Group name.

  • workspace_name (String)

    The Log Analytics Workspace name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



580
581
582
# File 'lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb', line 580

def regenerate_shared_keys_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
  regenerate_shared_keys_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
end