Class: Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Workspaces

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2015-11-01-preview/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-11-01-preview/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-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create_or_update(resource_group_name, workspace_name, parameters, custom_headers: nil) ⇒ Workspace

Create or update a workspace.

workspace. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    The name of the workspace.

  • parameters (Workspace)

    The parameters required to create or update a

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

    A hash of custom headers that

Returns:

  • (Workspace)

    operation results.



1160
1161
1162
1163
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 1160

def begin_create_or_update(resource_group_name, workspace_name, parameters, custom_headers:nil)
  response = begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Create or update a workspace.

workspace. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    The name of the workspace.

  • parameters (Workspace)

    The parameters required to create or update a

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 1193

def begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
  fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
  fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
  fail ArgumentError, "'workspace_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$'" if !workspace_name.nil? && workspace_name.match(Regexp.new('^^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$$')).nil?
  fail ArgumentError, 'parameters is nil' if parameters.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?

  # Serialize Request
  request_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::Workspace.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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'

  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},
      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 || status_code == 201
      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_11_01_preview::Models::Workspace.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
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::Workspace.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

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

Create or update a workspace.

workspace. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    The name of the workspace.

  • parameters (Workspace)

    The parameters required to create or update a

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1177
1178
1179
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 1177

def begin_create_or_update_with_http_info(resource_group_name, workspace_name, parameters, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
end

#create_or_update(resource_group_name, workspace_name, parameters, custom_headers: nil) ⇒ Workspace

Create or update a workspace.

workspace. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    The name of the workspace.

  • parameters (Workspace)

    The parameters required to create or update a

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

    A hash of custom headers that

Returns:

  • (Workspace)

    operation results.



829
830
831
832
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 829

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

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

workspace. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    The name of the workspace.

  • parameters (Workspace)

    The parameters required to create or update a

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 845

def create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::Workspace.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#delete(resource_group_name, workspace_name, custom_headers: nil) ⇒ Object

Deletes a workspace instance.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

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

    A hash of custom headers that



872
873
874
875
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 872

def delete(resource_group_name, workspace_name, custom_headers:nil)
  response = delete_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
  nil
end

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

Deletes a workspace instance.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 901

def delete_async(resource_group_name, workspace_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.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}'

  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(: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 || status_code == 204
      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(resource_group_name, workspace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a workspace instance.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



887
888
889
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 887

def delete_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
  delete_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
end

#disable_intelligence_pack(resource_group_name, workspace_name, intelligence_pack_name, custom_headers: nil) ⇒ Object

Disables an intelligence pack for a given workspace.

The name is case insensitive. be disabled. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

  • intelligence_pack_name (String)

    The name of the intelligence pack to

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

    A hash of custom headers that



36
37
38
39
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 36

def disable_intelligence_pack(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:nil)
  response = disable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:custom_headers).value!
  nil
end

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

Disables an intelligence pack for a given workspace.

The name is case insensitive. be disabled. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

  • intelligence_pack_name (String)

    The name of the intelligence pack to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 71

def disable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_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, 'intelligence_pack_name is nil' if intelligence_pack_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}/intelligencePacks/{intelligencePackName}/Disable'

  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,'intelligencePackName' => intelligence_pack_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?

    result
  end

  promise.execute
end

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

Disables an intelligence pack for a given workspace.

The name is case insensitive. be disabled. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

  • intelligence_pack_name (String)

    The name of the intelligence pack to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



54
55
56
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 54

def disable_intelligence_pack_with_http_info(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:nil)
  disable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:custom_headers).value!
end

#enable_intelligence_pack(resource_group_name, workspace_name, intelligence_pack_name, custom_headers: nil) ⇒ Object

Enables an intelligence pack for a given workspace.

The name is case insensitive. be enabled. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

  • intelligence_pack_name (String)

    The name of the intelligence pack to

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

    A hash of custom headers that



132
133
134
135
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 132

def enable_intelligence_pack(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:nil)
  response = enable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:custom_headers).value!
  nil
end

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

Enables an intelligence pack for a given workspace.

The name is case insensitive. be enabled. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

  • intelligence_pack_name (String)

    The name of the intelligence pack to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 167

def enable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_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, 'intelligence_pack_name is nil' if intelligence_pack_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}/intelligencePacks/{intelligencePackName}/Enable'

  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,'intelligencePackName' => intelligence_pack_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?

    result
  end

  promise.execute
end

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

Enables an intelligence pack for a given workspace.

The name is case insensitive. be enabled. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

  • intelligence_pack_name (String)

    The name of the intelligence pack to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



150
151
152
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 150

def enable_intelligence_pack_with_http_info(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:nil)
  enable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:custom_headers).value!
end

#get(resource_group_name, workspace_name, custom_headers: nil) ⇒ Workspace

Gets a workspace instance.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

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

    A hash of custom headers that

Returns:

  • (Workspace)

    operation results.



956
957
958
959
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 956

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

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

Gets a workspace instance.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 985

def get_async(resource_group_name, workspace_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.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}'

  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(: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_11_01_preview::Models::Workspace.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_shared_keys(resource_group_name, workspace_name, custom_headers: nil) ⇒ SharedKeys

Gets the shared keys for a workspace.

The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

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

    A hash of custom headers that

Returns:

  • (SharedKeys)

    operation results.



346
347
348
349
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 346

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

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

Gets the shared keys for a workspace.

The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
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
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 377

def get_shared_keys_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}/sharedKeys'

  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_11_01_preview::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

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

Gets the shared keys for a workspace.

The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



362
363
364
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 362

def get_shared_keys_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
  get_shared_keys_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
end

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

Gets a workspace instance.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



971
972
973
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 971

def get_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
  get_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
end

#list(custom_headers: nil) ⇒ WorkspaceListResult

Gets the workspaces in a subscription.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (WorkspaceListResult)

    operation results.



739
740
741
742
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 739

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

Gets the workspaces in a subscription.

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.



764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
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
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 764

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.OperationalInsights/workspaces'

  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::OperationalInsights::Mgmt::V2015_11_01_preview::Models::WorkspaceListResult.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_by_resource_group(resource_group_name, custom_headers: nil) ⇒ WorkspaceListResult

Gets workspaces in a resource group.

The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

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

    A hash of custom headers that

Returns:

  • (WorkspaceListResult)

    operation results.



645
646
647
648
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 645

def list_by_resource_group(resource_group_name, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_resource_group_async(resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets workspaces in a resource group.

The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
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
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 674

def list_by_resource_group_async(resource_group_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?


  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'

  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},
      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_11_01_preview::Models::WorkspaceListResult.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_by_resource_group_with_http_info(resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets workspaces in a resource group.

The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



660
661
662
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 660

def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
  list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
end

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

Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace.

The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

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

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



228
229
230
231
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 228

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

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

Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace.

The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
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
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 261

def list_intelligence_packs_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}/intelligencePacks'

  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(: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: 'IntelligencePackElementType',
                type: {
                  name: 'Composite',
                  class_name: 'IntelligencePack'
                }
            }
          }
        }
        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_intelligence_packs_with_http_info(resource_group_name, workspace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace.

The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    Name of the Log Analytics Workspace.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



245
246
247
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 245

def list_intelligence_packs_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
  list_intelligence_packs_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
end

#list_management_groups(resource_group_name, workspace_name, custom_headers: nil) ⇒ WorkspaceListManagementGroupsResult

Gets a list of management groups connected to a workspace.

The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    The name of the workspace.

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

    A hash of custom headers that

Returns:

  • (WorkspaceListManagementGroupsResult)

    operation results.



546
547
548
549
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 546

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

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

Gets a list of management groups connected to a workspace.

The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    The name of the workspace.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
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
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 577

def list_management_groups_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}/managementGroups'

  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(: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_11_01_preview::Models::WorkspaceListManagementGroupsResult.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_management_groups_with_http_info(resource_group_name, workspace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of management groups connected to a workspace.

The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    The name of the workspace.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



562
563
564
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 562

def list_management_groups_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
  list_management_groups_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
end

#list_usages(resource_group_name, workspace_name, custom_headers: nil) ⇒ WorkspaceListUsagesResult

Gets a list of usage metrics for a workspace.

The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    The name of the workspace.

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

    A hash of custom headers that

Returns:

  • (WorkspaceListUsagesResult)

    operation results.



446
447
448
449
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 446

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

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

Gets a list of usage metrics for a workspace.

The name is case insensitive. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    The name of the workspace.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
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
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 477

def list_usages_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}/usages'

  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(: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_11_01_preview::Models::WorkspaceListUsagesResult.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_usages_with_http_info(resource_group_name, workspace_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of usage metrics for a workspace.

The name is case insensitive. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to get.

  • workspace_name (String)

    The name of the workspace.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



462
463
464
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 462

def list_usages_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
  list_usages_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
end

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

Gets the workspaces in a subscription.

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.



752
753
754
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 752

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

#update(resource_group_name, workspace_name, parameters, custom_headers: nil) ⇒ Workspace

Updates a workspace.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    The name of the workspace.

  • parameters (Workspace)

    The parameters required to patch a workspace.

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

    A hash of custom headers that

Returns:

  • (Workspace)

    operation results.



1051
1052
1053
1054
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 1051

def update(resource_group_name, workspace_name, parameters, custom_headers:nil)
  response = update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Updates a workspace.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    The name of the workspace.

  • parameters (Workspace)

    The parameters required to patch a workspace.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 1082

def update_async(resource_group_name, workspace_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
  fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
  fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
  fail ArgumentError, "'workspace_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$'" if !workspace_name.nil? && workspace_name.match(Regexp.new('^^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$$')).nil?
  fail ArgumentError, 'parameters is nil' if parameters.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?

  # Serialize Request
  request_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::Workspace.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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'

  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},
      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 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_11_01_preview::Models::Workspace.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(resource_group_name, workspace_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Updates a workspace.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The resource group name of the workspace.

  • workspace_name (String)

    The name of the workspace.

  • parameters (Workspace)

    The parameters required to patch a workspace.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1067
1068
1069
# File 'lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb', line 1067

def update_with_http_info(resource_group_name, workspace_name, parameters, custom_headers:nil)
  update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
end