azure_mgmt_operational_insights 0.19.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2015-03-20/generated/azure_mgmt_operational_insights.rb +60 -0
  4. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/available_service_tier.rb +124 -0
  5. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/core_summary.rb +57 -0
  6. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/link_target.rb +79 -0
  7. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/operation.rb +59 -0
  8. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/operation_display.rb +68 -0
  9. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/operation_list_result.rb +56 -0
  10. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/proxy_resource.rb +90 -0
  11. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/purge_state.rb +16 -0
  12. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/resource.rb +110 -0
  13. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/saved_search.rb +154 -0
  14. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/saved_searches_list_result.rb +68 -0
  15. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/search_get_schema_response.rb +67 -0
  16. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/search_metadata.rb +241 -0
  17. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/search_metadata_schema.rb +57 -0
  18. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/search_schema_value.rb +123 -0
  19. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/search_sort.rb +58 -0
  20. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/search_sort_enum.rb +16 -0
  21. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/shared_keys.rb +57 -0
  22. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/sku_name_enum.rb +21 -0
  23. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/storage_account.rb +58 -0
  24. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/storage_insight.rb +154 -0
  25. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/storage_insight_list_result.rb +98 -0
  26. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/storage_insight_state.rb +16 -0
  27. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/storage_insight_status.rb +58 -0
  28. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/tag.rb +57 -0
  29. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/workspace_purge_body.rb +67 -0
  30. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/workspace_purge_body_filters.rb +85 -0
  31. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/workspace_purge_response.rb +47 -0
  32. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/models/workspace_purge_status_response.rb +47 -0
  33. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/module_definition.rb +9 -0
  34. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +151 -0
  35. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/operations.rb +109 -0
  36. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/saved_searches.rb +425 -0
  37. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/storage_insights.rb +559 -0
  38. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/workspaces.rb +857 -0
  39. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights.rb +56 -0
  40. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/data_sources.rb +592 -0
  41. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/linked_services.rb +462 -0
  42. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/data_source.rb +117 -0
  43. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/data_source_filter.rb +51 -0
  44. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/data_source_kind.rb +29 -0
  45. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/data_source_list_result.rb +98 -0
  46. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/entity_status.rb +20 -0
  47. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/error_response.rb +57 -0
  48. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/intelligence_pack.rb +69 -0
  49. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/linked_service.rb +90 -0
  50. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/linked_service_list_result.rb +56 -0
  51. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/management_group.rb +128 -0
  52. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/metric_name.rb +57 -0
  53. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/operation.rb +59 -0
  54. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/operation_display.rb +68 -0
  55. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/operation_list_result.rb +101 -0
  56. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/operation_status.rb +102 -0
  57. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/proxy_resource.rb +90 -0
  58. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/resource.rb +110 -0
  59. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/shared_keys.rb +57 -0
  60. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/sku.rb +48 -0
  61. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/sku_name_enum.rb +21 -0
  62. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/usage_metric.rb +103 -0
  63. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/workspace.rb +178 -0
  64. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/workspace_list_management_groups_result.rb +56 -0
  65. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/workspace_list_result.rb +55 -0
  66. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/models/workspace_list_usages_result.rb +56 -0
  67. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/module_definition.rb +9 -0
  68. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +239 -0
  69. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/operations.rb +219 -0
  70. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb +1270 -0
  71. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights.rb +123 -0
  72. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/available_service_tiers.rb +146 -0
  73. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/clusters.rb +959 -0
  74. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/data_exports.rb +473 -0
  75. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/data_sources.rb +603 -0
  76. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/deleted_workspaces.rb +211 -0
  77. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/gateways.rb +123 -0
  78. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/intelligence_packs.rb +351 -0
  79. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/linked_services.rb +577 -0
  80. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/linked_storage_accounts.rb +490 -0
  81. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/management_groups.rb +130 -0
  82. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/available_service_tier.rb +124 -0
  83. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/azure_entity_resource.rb +75 -0
  84. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/cluster.rb +159 -0
  85. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/cluster_entity_status.rb +21 -0
  86. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/cluster_error_response.rb +48 -0
  87. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/cluster_list_result.rb +98 -0
  88. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/cluster_patch.rb +78 -0
  89. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/cluster_sku.rb +58 -0
  90. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/cluster_sku_name_enum.rb +15 -0
  91. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/core_summary.rb +57 -0
  92. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_export.rb +174 -0
  93. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_export_error_response.rb +48 -0
  94. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_export_list_result.rb +56 -0
  95. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_ingestion_status.rb +20 -0
  96. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_source.rb +130 -0
  97. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_source_filter.rb +61 -0
  98. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_source_kind.rb +47 -0
  99. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_source_list_result.rb +98 -0
  100. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_source_type.rb +19 -0
  101. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/error_additional_info.rb +59 -0
  102. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/error_contract.rb +49 -0
  103. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/error_response.rb +113 -0
  104. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/identity.rb +72 -0
  105. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/identity_type.rb +16 -0
  106. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/intelligence_pack.rb +69 -0
  107. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/key_vault_properties.rb +71 -0
  108. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/linked_service.rb +120 -0
  109. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/linked_service_entity_status.rb +18 -0
  110. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/linked_service_list_result.rb +55 -0
  111. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/linked_storage_accounts_list_result.rb +56 -0
  112. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/linked_storage_accounts_resource.rb +95 -0
  113. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/management_group.rb +128 -0
  114. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/metric_name.rb +57 -0
  115. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/operation.rb +59 -0
  116. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/operation_display.rb +79 -0
  117. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/operation_list_result.rb +101 -0
  118. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/operation_status.rb +102 -0
  119. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/private_link_scoped_resource.rb +58 -0
  120. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/proxy_resource.rb +63 -0
  121. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/public_network_access_type.rb +16 -0
  122. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/purge_state.rb +16 -0
  123. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/resource.rb +83 -0
  124. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/saved_search.rb +165 -0
  125. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/saved_searches_list_result.rb +55 -0
  126. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/search_get_schema_response.rb +67 -0
  127. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/search_metadata.rb +241 -0
  128. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/search_metadata_schema.rb +57 -0
  129. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/search_schema_value.rb +123 -0
  130. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/search_sort.rb +58 -0
  131. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/search_sort_enum.rb +16 -0
  132. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/shared_keys.rb +57 -0
  133. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/sku_name_enum.rb +21 -0
  134. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/storage_account.rb +58 -0
  135. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/storage_insight.rb +157 -0
  136. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/storage_insight_list_result.rb +98 -0
  137. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/storage_insight_state.rb +16 -0
  138. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/storage_insight_status.rb +58 -0
  139. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/table.rb +79 -0
  140. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/tables_list_result.rb +55 -0
  141. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/tag.rb +57 -0
  142. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/tracked_resource.rb +92 -0
  143. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/type.rb +16 -0
  144. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/usage_metric.rb +103 -0
  145. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace.rb +214 -0
  146. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace_capping.rb +73 -0
  147. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace_entity_status.rb +21 -0
  148. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace_list_management_groups_result.rb +56 -0
  149. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace_list_result.rb +55 -0
  150. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace_list_usages_result.rb +56 -0
  151. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace_patch.rb +207 -0
  152. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace_purge_body.rb +67 -0
  153. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace_purge_body_filters.rb +85 -0
  154. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace_purge_response.rb +47 -0
  155. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace_purge_status_response.rb +47 -0
  156. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace_sku.rb +85 -0
  157. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/workspace_sku_name_enum.rb +21 -0
  158. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/module_definition.rb +9 -0
  159. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/operation_statuses.rb +121 -0
  160. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +207 -0
  161. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/operations.rb +220 -0
  162. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/saved_searches.rb +457 -0
  163. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/schema.rb +130 -0
  164. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/shared_keys_operations.rb +238 -0
  165. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/storage_insight_configs.rb +592 -0
  166. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/tables.rb +359 -0
  167. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/usages.rb +130 -0
  168. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/workspace_purge.rb +277 -0
  169. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/workspaces.rb +768 -0
  170. data/lib/azure_mgmt_operational_insights.rb +8 -0
  171. data/lib/module_definition.rb +7 -0
  172. data/lib/profiles/latest/modules/operationalinsights_profile_module.rb +417 -0
  173. data/lib/profiles/latest/operationalinsights_latest_profile_client.rb +40 -0
  174. data/lib/profiles/latest/operationalinsights_module_definition.rb +8 -0
  175. data/lib/version.rb +7 -0
  176. metadata +292 -0
@@ -0,0 +1,1270 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::OperationalInsights::Mgmt::V2015_11_01_preview
7
+ #
8
+ # Operational Insights Client
9
+ #
10
+ class Workspaces
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Workspaces class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [OperationalInsightsManagementClient] reference to the OperationalInsightsManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Disables an intelligence pack for a given workspace.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group to get.
28
+ # The name is case insensitive.
29
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
30
+ # @param intelligence_pack_name [String] The name of the intelligence pack to
31
+ # be disabled.
32
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
33
+ # will be added to the HTTP request.
34
+ #
35
+ #
36
+ def disable_intelligence_pack(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:nil)
37
+ response = disable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:custom_headers).value!
38
+ nil
39
+ end
40
+
41
+ #
42
+ # Disables an intelligence pack for a given workspace.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group to get.
45
+ # The name is case insensitive.
46
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
47
+ # @param intelligence_pack_name [String] The name of the intelligence pack to
48
+ # be disabled.
49
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
50
+ # will be added to the HTTP request.
51
+ #
52
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
53
+ #
54
+ def disable_intelligence_pack_with_http_info(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:nil)
55
+ disable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:custom_headers).value!
56
+ end
57
+
58
+ #
59
+ # Disables an intelligence pack for a given workspace.
60
+ #
61
+ # @param resource_group_name [String] The name of the resource group to get.
62
+ # The name is case insensitive.
63
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
64
+ # @param intelligence_pack_name [String] The name of the intelligence pack to
65
+ # be disabled.
66
+ # @param [Hash{String => String}] A hash of custom headers that will be added
67
+ # to the HTTP request.
68
+ #
69
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
70
+ #
71
+ def disable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:nil)
72
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
73
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
74
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
75
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
76
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
77
+ fail ArgumentError, 'intelligence_pack_name is nil' if intelligence_pack_name.nil?
78
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
79
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
80
+
81
+
82
+ request_headers = {}
83
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
84
+
85
+ # Set Headers
86
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
87
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
88
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Disable'
89
+
90
+ request_url = @base_url || @client.base_url
91
+
92
+ options = {
93
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
94
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'intelligencePackName' => intelligence_pack_name,'subscriptionId' => @client.subscription_id},
95
+ query_params: {'api-version' => @client.api_version},
96
+ headers: request_headers.merge(custom_headers || {}),
97
+ base_url: request_url
98
+ }
99
+ promise = @client.make_request_async(:post, path_template, options)
100
+
101
+ promise = promise.then do |result|
102
+ http_response = result.response
103
+ status_code = http_response.status
104
+ response_content = http_response.body
105
+ unless status_code == 200
106
+ error_model = JSON.load(response_content)
107
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
108
+ end
109
+
110
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
111
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
112
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
113
+
114
+ result
115
+ end
116
+
117
+ promise.execute
118
+ end
119
+
120
+ #
121
+ # Enables an intelligence pack for a given workspace.
122
+ #
123
+ # @param resource_group_name [String] The name of the resource group to get.
124
+ # The name is case insensitive.
125
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
126
+ # @param intelligence_pack_name [String] The name of the intelligence pack to
127
+ # be enabled.
128
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
129
+ # will be added to the HTTP request.
130
+ #
131
+ #
132
+ def enable_intelligence_pack(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:nil)
133
+ response = enable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:custom_headers).value!
134
+ nil
135
+ end
136
+
137
+ #
138
+ # Enables an intelligence pack for a given workspace.
139
+ #
140
+ # @param resource_group_name [String] The name of the resource group to get.
141
+ # The name is case insensitive.
142
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
143
+ # @param intelligence_pack_name [String] The name of the intelligence pack to
144
+ # be enabled.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
149
+ #
150
+ def enable_intelligence_pack_with_http_info(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:nil)
151
+ enable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:custom_headers).value!
152
+ end
153
+
154
+ #
155
+ # Enables an intelligence pack for a given workspace.
156
+ #
157
+ # @param resource_group_name [String] The name of the resource group to get.
158
+ # The name is case insensitive.
159
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
160
+ # @param intelligence_pack_name [String] The name of the intelligence pack to
161
+ # be enabled.
162
+ # @param [Hash{String => String}] A hash of custom headers that will be added
163
+ # to the HTTP request.
164
+ #
165
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
166
+ #
167
+ def enable_intelligence_pack_async(resource_group_name, workspace_name, intelligence_pack_name, custom_headers:nil)
168
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
169
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
170
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
171
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
172
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
173
+ fail ArgumentError, 'intelligence_pack_name is nil' if intelligence_pack_name.nil?
174
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
175
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
176
+
177
+
178
+ request_headers = {}
179
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
180
+
181
+ # Set Headers
182
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
183
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
184
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Enable'
185
+
186
+ request_url = @base_url || @client.base_url
187
+
188
+ options = {
189
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
190
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'intelligencePackName' => intelligence_pack_name,'subscriptionId' => @client.subscription_id},
191
+ query_params: {'api-version' => @client.api_version},
192
+ headers: request_headers.merge(custom_headers || {}),
193
+ base_url: request_url
194
+ }
195
+ promise = @client.make_request_async(:post, path_template, options)
196
+
197
+ promise = promise.then do |result|
198
+ http_response = result.response
199
+ status_code = http_response.status
200
+ response_content = http_response.body
201
+ unless status_code == 200
202
+ error_model = JSON.load(response_content)
203
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
204
+ end
205
+
206
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
207
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
208
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
209
+
210
+ result
211
+ end
212
+
213
+ promise.execute
214
+ end
215
+
216
+ #
217
+ # Lists all the intelligence packs possible and whether they are enabled or
218
+ # disabled for a given workspace.
219
+ #
220
+ # @param resource_group_name [String] The name of the resource group to get.
221
+ # The name is case insensitive.
222
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
223
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
224
+ # will be added to the HTTP request.
225
+ #
226
+ # @return [Array] operation results.
227
+ #
228
+ def list_intelligence_packs(resource_group_name, workspace_name, custom_headers:nil)
229
+ response = list_intelligence_packs_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
230
+ response.body unless response.nil?
231
+ end
232
+
233
+ #
234
+ # Lists all the intelligence packs possible and whether they are enabled or
235
+ # disabled for a given workspace.
236
+ #
237
+ # @param resource_group_name [String] The name of the resource group to get.
238
+ # The name is case insensitive.
239
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
240
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
241
+ # will be added to the HTTP request.
242
+ #
243
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
244
+ #
245
+ def list_intelligence_packs_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
246
+ list_intelligence_packs_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
247
+ end
248
+
249
+ #
250
+ # Lists all the intelligence packs possible and whether they are enabled or
251
+ # disabled for a given workspace.
252
+ #
253
+ # @param resource_group_name [String] The name of the resource group to get.
254
+ # The name is case insensitive.
255
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
256
+ # @param [Hash{String => String}] A hash of custom headers that will be added
257
+ # to the HTTP request.
258
+ #
259
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
260
+ #
261
+ def list_intelligence_packs_async(resource_group_name, workspace_name, custom_headers:nil)
262
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
263
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
264
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
265
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
266
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
267
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
268
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
269
+
270
+
271
+ request_headers = {}
272
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
273
+
274
+ # Set Headers
275
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
276
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
277
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks'
278
+
279
+ request_url = @base_url || @client.base_url
280
+
281
+ options = {
282
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
283
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
284
+ query_params: {'api-version' => @client.api_version},
285
+ headers: request_headers.merge(custom_headers || {}),
286
+ base_url: request_url
287
+ }
288
+ promise = @client.make_request_async(:get, path_template, options)
289
+
290
+ promise = promise.then do |result|
291
+ http_response = result.response
292
+ status_code = http_response.status
293
+ response_content = http_response.body
294
+ unless status_code == 200
295
+ error_model = JSON.load(response_content)
296
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
297
+ end
298
+
299
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
300
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
301
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
302
+ # Deserialize Response
303
+ if status_code == 200
304
+ begin
305
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
306
+ result_mapper = {
307
+ client_side_validation: true,
308
+ required: false,
309
+ serialized_name: 'parsed_response',
310
+ type: {
311
+ name: 'Sequence',
312
+ element: {
313
+ client_side_validation: true,
314
+ required: false,
315
+ serialized_name: 'IntelligencePackElementType',
316
+ type: {
317
+ name: 'Composite',
318
+ class_name: 'IntelligencePack'
319
+ }
320
+ }
321
+ }
322
+ }
323
+ result.body = @client.deserialize(result_mapper, parsed_response)
324
+ rescue Exception => e
325
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
326
+ end
327
+ end
328
+
329
+ result
330
+ end
331
+
332
+ promise.execute
333
+ end
334
+
335
+ #
336
+ # Gets the shared keys for a workspace.
337
+ #
338
+ # @param resource_group_name [String] The name of the resource group to get.
339
+ # The name is case insensitive.
340
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
341
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
342
+ # will be added to the HTTP request.
343
+ #
344
+ # @return [SharedKeys] operation results.
345
+ #
346
+ def get_shared_keys(resource_group_name, workspace_name, custom_headers:nil)
347
+ response = get_shared_keys_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
348
+ response.body unless response.nil?
349
+ end
350
+
351
+ #
352
+ # Gets the shared keys for a workspace.
353
+ #
354
+ # @param resource_group_name [String] The name of the resource group to get.
355
+ # The name is case insensitive.
356
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
357
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
358
+ # will be added to the HTTP request.
359
+ #
360
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
361
+ #
362
+ def get_shared_keys_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
363
+ get_shared_keys_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
364
+ end
365
+
366
+ #
367
+ # Gets the shared keys for a workspace.
368
+ #
369
+ # @param resource_group_name [String] The name of the resource group to get.
370
+ # The name is case insensitive.
371
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
372
+ # @param [Hash{String => String}] A hash of custom headers that will be added
373
+ # to the HTTP request.
374
+ #
375
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
376
+ #
377
+ def get_shared_keys_async(resource_group_name, workspace_name, custom_headers:nil)
378
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
379
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
380
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
381
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
382
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
383
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
384
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
385
+
386
+
387
+ request_headers = {}
388
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
389
+
390
+ # Set Headers
391
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
392
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
393
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/sharedKeys'
394
+
395
+ request_url = @base_url || @client.base_url
396
+
397
+ options = {
398
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
399
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
400
+ query_params: {'api-version' => @client.api_version},
401
+ headers: request_headers.merge(custom_headers || {}),
402
+ base_url: request_url
403
+ }
404
+ promise = @client.make_request_async(:post, path_template, options)
405
+
406
+ promise = promise.then do |result|
407
+ http_response = result.response
408
+ status_code = http_response.status
409
+ response_content = http_response.body
410
+ unless status_code == 200
411
+ error_model = JSON.load(response_content)
412
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
413
+ end
414
+
415
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
416
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
417
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
418
+ # Deserialize Response
419
+ if status_code == 200
420
+ begin
421
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
422
+ result_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::SharedKeys.mapper()
423
+ result.body = @client.deserialize(result_mapper, parsed_response)
424
+ rescue Exception => e
425
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
426
+ end
427
+ end
428
+
429
+ result
430
+ end
431
+
432
+ promise.execute
433
+ end
434
+
435
+ #
436
+ # Gets a list of usage metrics for a workspace.
437
+ #
438
+ # @param resource_group_name [String] The name of the resource group to get.
439
+ # The name is case insensitive.
440
+ # @param workspace_name [String] The name of the workspace.
441
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
442
+ # will be added to the HTTP request.
443
+ #
444
+ # @return [WorkspaceListUsagesResult] operation results.
445
+ #
446
+ def list_usages(resource_group_name, workspace_name, custom_headers:nil)
447
+ response = list_usages_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
448
+ response.body unless response.nil?
449
+ end
450
+
451
+ #
452
+ # Gets a list of usage metrics for a workspace.
453
+ #
454
+ # @param resource_group_name [String] The name of the resource group to get.
455
+ # The name is case insensitive.
456
+ # @param workspace_name [String] The name of the workspace.
457
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
458
+ # will be added to the HTTP request.
459
+ #
460
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
461
+ #
462
+ def list_usages_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
463
+ list_usages_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
464
+ end
465
+
466
+ #
467
+ # Gets a list of usage metrics for a workspace.
468
+ #
469
+ # @param resource_group_name [String] The name of the resource group to get.
470
+ # The name is case insensitive.
471
+ # @param workspace_name [String] The name of the workspace.
472
+ # @param [Hash{String => String}] A hash of custom headers that will be added
473
+ # to the HTTP request.
474
+ #
475
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
476
+ #
477
+ def list_usages_async(resource_group_name, workspace_name, custom_headers:nil)
478
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
479
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
480
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
481
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
482
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
483
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
484
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
485
+
486
+
487
+ request_headers = {}
488
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
489
+
490
+ # Set Headers
491
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
492
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
493
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/usages'
494
+
495
+ request_url = @base_url || @client.base_url
496
+
497
+ options = {
498
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
499
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
500
+ query_params: {'api-version' => @client.api_version},
501
+ headers: request_headers.merge(custom_headers || {}),
502
+ base_url: request_url
503
+ }
504
+ promise = @client.make_request_async(:get, path_template, options)
505
+
506
+ promise = promise.then do |result|
507
+ http_response = result.response
508
+ status_code = http_response.status
509
+ response_content = http_response.body
510
+ unless status_code == 200
511
+ error_model = JSON.load(response_content)
512
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
513
+ end
514
+
515
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
516
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
517
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
518
+ # Deserialize Response
519
+ if status_code == 200
520
+ begin
521
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
522
+ result_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::WorkspaceListUsagesResult.mapper()
523
+ result.body = @client.deserialize(result_mapper, parsed_response)
524
+ rescue Exception => e
525
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
526
+ end
527
+ end
528
+
529
+ result
530
+ end
531
+
532
+ promise.execute
533
+ end
534
+
535
+ #
536
+ # Gets a list of management groups connected to a workspace.
537
+ #
538
+ # @param resource_group_name [String] The name of the resource group to get.
539
+ # The name is case insensitive.
540
+ # @param workspace_name [String] The name of the workspace.
541
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
542
+ # will be added to the HTTP request.
543
+ #
544
+ # @return [WorkspaceListManagementGroupsResult] operation results.
545
+ #
546
+ def list_management_groups(resource_group_name, workspace_name, custom_headers:nil)
547
+ response = list_management_groups_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
548
+ response.body unless response.nil?
549
+ end
550
+
551
+ #
552
+ # Gets a list of management groups connected to a workspace.
553
+ #
554
+ # @param resource_group_name [String] The name of the resource group to get.
555
+ # The name is case insensitive.
556
+ # @param workspace_name [String] The name of the workspace.
557
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
558
+ # will be added to the HTTP request.
559
+ #
560
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
561
+ #
562
+ def list_management_groups_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
563
+ list_management_groups_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
564
+ end
565
+
566
+ #
567
+ # Gets a list of management groups connected to a workspace.
568
+ #
569
+ # @param resource_group_name [String] The name of the resource group to get.
570
+ # The name is case insensitive.
571
+ # @param workspace_name [String] The name of the workspace.
572
+ # @param [Hash{String => String}] A hash of custom headers that will be added
573
+ # to the HTTP request.
574
+ #
575
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
576
+ #
577
+ def list_management_groups_async(resource_group_name, workspace_name, custom_headers:nil)
578
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
579
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
580
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
581
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
582
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
583
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
584
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
585
+
586
+
587
+ request_headers = {}
588
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
589
+
590
+ # Set Headers
591
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
592
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
593
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/managementGroups'
594
+
595
+ request_url = @base_url || @client.base_url
596
+
597
+ options = {
598
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
599
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
600
+ query_params: {'api-version' => @client.api_version},
601
+ headers: request_headers.merge(custom_headers || {}),
602
+ base_url: request_url
603
+ }
604
+ promise = @client.make_request_async(:get, path_template, options)
605
+
606
+ promise = promise.then do |result|
607
+ http_response = result.response
608
+ status_code = http_response.status
609
+ response_content = http_response.body
610
+ unless status_code == 200
611
+ error_model = JSON.load(response_content)
612
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
613
+ end
614
+
615
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
616
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
617
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
618
+ # Deserialize Response
619
+ if status_code == 200
620
+ begin
621
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
622
+ result_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::WorkspaceListManagementGroupsResult.mapper()
623
+ result.body = @client.deserialize(result_mapper, parsed_response)
624
+ rescue Exception => e
625
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
626
+ end
627
+ end
628
+
629
+ result
630
+ end
631
+
632
+ promise.execute
633
+ end
634
+
635
+ #
636
+ # Gets workspaces in a resource group.
637
+ #
638
+ # @param resource_group_name [String] The name of the resource group to get.
639
+ # The name is case insensitive.
640
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
641
+ # will be added to the HTTP request.
642
+ #
643
+ # @return [WorkspaceListResult] operation results.
644
+ #
645
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
646
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
647
+ response.body unless response.nil?
648
+ end
649
+
650
+ #
651
+ # Gets workspaces in a resource group.
652
+ #
653
+ # @param resource_group_name [String] The name of the resource group to get.
654
+ # The name is case insensitive.
655
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
656
+ # will be added to the HTTP request.
657
+ #
658
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
659
+ #
660
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
661
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
662
+ end
663
+
664
+ #
665
+ # Gets workspaces in a resource group.
666
+ #
667
+ # @param resource_group_name [String] The name of the resource group to get.
668
+ # The name is case insensitive.
669
+ # @param [Hash{String => String}] A hash of custom headers that will be added
670
+ # to the HTTP request.
671
+ #
672
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
673
+ #
674
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
675
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
676
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
677
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
678
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
679
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
680
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
681
+
682
+
683
+ request_headers = {}
684
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
685
+
686
+ # Set Headers
687
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
688
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
689
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces'
690
+
691
+ request_url = @base_url || @client.base_url
692
+
693
+ options = {
694
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
695
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
696
+ query_params: {'api-version' => @client.api_version},
697
+ headers: request_headers.merge(custom_headers || {}),
698
+ base_url: request_url
699
+ }
700
+ promise = @client.make_request_async(:get, path_template, options)
701
+
702
+ promise = promise.then do |result|
703
+ http_response = result.response
704
+ status_code = http_response.status
705
+ response_content = http_response.body
706
+ unless status_code == 200
707
+ error_model = JSON.load(response_content)
708
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
709
+ end
710
+
711
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
712
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
713
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
714
+ # Deserialize Response
715
+ if status_code == 200
716
+ begin
717
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
718
+ result_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::WorkspaceListResult.mapper()
719
+ result.body = @client.deserialize(result_mapper, parsed_response)
720
+ rescue Exception => e
721
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
722
+ end
723
+ end
724
+
725
+ result
726
+ end
727
+
728
+ promise.execute
729
+ end
730
+
731
+ #
732
+ # Gets the workspaces in a subscription.
733
+ #
734
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
735
+ # will be added to the HTTP request.
736
+ #
737
+ # @return [WorkspaceListResult] operation results.
738
+ #
739
+ def list(custom_headers:nil)
740
+ response = list_async(custom_headers:custom_headers).value!
741
+ response.body unless response.nil?
742
+ end
743
+
744
+ #
745
+ # Gets the workspaces in a subscription.
746
+ #
747
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
748
+ # will be added to the HTTP request.
749
+ #
750
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
751
+ #
752
+ def list_with_http_info(custom_headers:nil)
753
+ list_async(custom_headers:custom_headers).value!
754
+ end
755
+
756
+ #
757
+ # Gets the workspaces in a subscription.
758
+ #
759
+ # @param [Hash{String => String}] A hash of custom headers that will be added
760
+ # to the HTTP request.
761
+ #
762
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
763
+ #
764
+ def list_async(custom_headers:nil)
765
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
766
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
767
+
768
+
769
+ request_headers = {}
770
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
771
+
772
+ # Set Headers
773
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
774
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
775
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/workspaces'
776
+
777
+ request_url = @base_url || @client.base_url
778
+
779
+ options = {
780
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
781
+ path_params: {'subscriptionId' => @client.subscription_id},
782
+ query_params: {'api-version' => @client.api_version},
783
+ headers: request_headers.merge(custom_headers || {}),
784
+ base_url: request_url
785
+ }
786
+ promise = @client.make_request_async(:get, path_template, options)
787
+
788
+ promise = promise.then do |result|
789
+ http_response = result.response
790
+ status_code = http_response.status
791
+ response_content = http_response.body
792
+ unless status_code == 200
793
+ error_model = JSON.load(response_content)
794
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
795
+ end
796
+
797
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
798
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
799
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
800
+ # Deserialize Response
801
+ if status_code == 200
802
+ begin
803
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
804
+ result_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::WorkspaceListResult.mapper()
805
+ result.body = @client.deserialize(result_mapper, parsed_response)
806
+ rescue Exception => e
807
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
808
+ end
809
+ end
810
+
811
+ result
812
+ end
813
+
814
+ promise.execute
815
+ end
816
+
817
+ #
818
+ # Create or update a workspace.
819
+ #
820
+ # @param resource_group_name [String] The resource group name of the workspace.
821
+ # @param workspace_name [String] The name of the workspace.
822
+ # @param parameters [Workspace] The parameters required to create or update a
823
+ # workspace.
824
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
825
+ # will be added to the HTTP request.
826
+ #
827
+ # @return [Workspace] operation results.
828
+ #
829
+ def create_or_update(resource_group_name, workspace_name, parameters, custom_headers:nil)
830
+ response = create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
831
+ response.body unless response.nil?
832
+ end
833
+
834
+ #
835
+ # @param resource_group_name [String] The resource group name of the workspace.
836
+ # @param workspace_name [String] The name of the workspace.
837
+ # @param parameters [Workspace] The parameters required to create or update a
838
+ # workspace.
839
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
840
+ # will be added to the HTTP request.
841
+ #
842
+ # @return [Concurrent::Promise] promise which provides async access to http
843
+ # response.
844
+ #
845
+ def create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:nil)
846
+ # Send request
847
+ promise = begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers)
848
+
849
+ promise = promise.then do |response|
850
+ # Defining deserialization method.
851
+ deserialize_method = lambda do |parsed_response|
852
+ result_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::Workspace.mapper()
853
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
854
+ end
855
+
856
+ # Waiting for response.
857
+ @client.get_long_running_operation_result(response, deserialize_method)
858
+ end
859
+
860
+ promise
861
+ end
862
+
863
+ #
864
+ # Deletes a workspace instance.
865
+ #
866
+ # @param resource_group_name [String] The resource group name of the workspace.
867
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
868
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
869
+ # will be added to the HTTP request.
870
+ #
871
+ #
872
+ def delete(resource_group_name, workspace_name, custom_headers:nil)
873
+ response = delete_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
874
+ nil
875
+ end
876
+
877
+ #
878
+ # Deletes a workspace instance.
879
+ #
880
+ # @param resource_group_name [String] The resource group name of the workspace.
881
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
882
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
883
+ # will be added to the HTTP request.
884
+ #
885
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
886
+ #
887
+ def delete_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
888
+ delete_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
889
+ end
890
+
891
+ #
892
+ # Deletes a workspace instance.
893
+ #
894
+ # @param resource_group_name [String] The resource group name of the workspace.
895
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
896
+ # @param [Hash{String => String}] A hash of custom headers that will be added
897
+ # to the HTTP request.
898
+ #
899
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
900
+ #
901
+ def delete_async(resource_group_name, workspace_name, custom_headers:nil)
902
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
903
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
904
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
905
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
906
+
907
+
908
+ request_headers = {}
909
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
910
+
911
+ # Set Headers
912
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
913
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
914
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'
915
+
916
+ request_url = @base_url || @client.base_url
917
+
918
+ options = {
919
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
920
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
921
+ query_params: {'api-version' => @client.api_version},
922
+ headers: request_headers.merge(custom_headers || {}),
923
+ base_url: request_url
924
+ }
925
+ promise = @client.make_request_async(:delete, path_template, options)
926
+
927
+ promise = promise.then do |result|
928
+ http_response = result.response
929
+ status_code = http_response.status
930
+ response_content = http_response.body
931
+ unless status_code == 200 || status_code == 204
932
+ error_model = JSON.load(response_content)
933
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
934
+ end
935
+
936
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
937
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
938
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
939
+
940
+ result
941
+ end
942
+
943
+ promise.execute
944
+ end
945
+
946
+ #
947
+ # Gets a workspace instance.
948
+ #
949
+ # @param resource_group_name [String] The resource group name of the workspace.
950
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
951
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
952
+ # will be added to the HTTP request.
953
+ #
954
+ # @return [Workspace] operation results.
955
+ #
956
+ def get(resource_group_name, workspace_name, custom_headers:nil)
957
+ response = get_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
958
+ response.body unless response.nil?
959
+ end
960
+
961
+ #
962
+ # Gets a workspace instance.
963
+ #
964
+ # @param resource_group_name [String] The resource group name of the workspace.
965
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
966
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
967
+ # will be added to the HTTP request.
968
+ #
969
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
970
+ #
971
+ def get_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
972
+ get_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
973
+ end
974
+
975
+ #
976
+ # Gets a workspace instance.
977
+ #
978
+ # @param resource_group_name [String] The resource group name of the workspace.
979
+ # @param workspace_name [String] Name of the Log Analytics Workspace.
980
+ # @param [Hash{String => String}] A hash of custom headers that will be added
981
+ # to the HTTP request.
982
+ #
983
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
984
+ #
985
+ def get_async(resource_group_name, workspace_name, custom_headers:nil)
986
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
987
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
988
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
989
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
990
+
991
+
992
+ request_headers = {}
993
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
994
+
995
+ # Set Headers
996
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
997
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
998
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'
999
+
1000
+ request_url = @base_url || @client.base_url
1001
+
1002
+ options = {
1003
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1004
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
1005
+ query_params: {'api-version' => @client.api_version},
1006
+ headers: request_headers.merge(custom_headers || {}),
1007
+ base_url: request_url
1008
+ }
1009
+ promise = @client.make_request_async(:get, path_template, options)
1010
+
1011
+ promise = promise.then do |result|
1012
+ http_response = result.response
1013
+ status_code = http_response.status
1014
+ response_content = http_response.body
1015
+ unless status_code == 200
1016
+ error_model = JSON.load(response_content)
1017
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1018
+ end
1019
+
1020
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1021
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1022
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1023
+ # Deserialize Response
1024
+ if status_code == 200
1025
+ begin
1026
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1027
+ result_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::Workspace.mapper()
1028
+ result.body = @client.deserialize(result_mapper, parsed_response)
1029
+ rescue Exception => e
1030
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1031
+ end
1032
+ end
1033
+
1034
+ result
1035
+ end
1036
+
1037
+ promise.execute
1038
+ end
1039
+
1040
+ #
1041
+ # Updates a workspace.
1042
+ #
1043
+ # @param resource_group_name [String] The resource group name of the workspace.
1044
+ # @param workspace_name [String] The name of the workspace.
1045
+ # @param parameters [Workspace] The parameters required to patch a workspace.
1046
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1047
+ # will be added to the HTTP request.
1048
+ #
1049
+ # @return [Workspace] operation results.
1050
+ #
1051
+ def update(resource_group_name, workspace_name, parameters, custom_headers:nil)
1052
+ response = update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
1053
+ response.body unless response.nil?
1054
+ end
1055
+
1056
+ #
1057
+ # Updates a workspace.
1058
+ #
1059
+ # @param resource_group_name [String] The resource group name of the workspace.
1060
+ # @param workspace_name [String] The name of the workspace.
1061
+ # @param parameters [Workspace] The parameters required to patch a workspace.
1062
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1063
+ # will be added to the HTTP request.
1064
+ #
1065
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1066
+ #
1067
+ def update_with_http_info(resource_group_name, workspace_name, parameters, custom_headers:nil)
1068
+ update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
1069
+ end
1070
+
1071
+ #
1072
+ # Updates a workspace.
1073
+ #
1074
+ # @param resource_group_name [String] The resource group name of the workspace.
1075
+ # @param workspace_name [String] The name of the workspace.
1076
+ # @param parameters [Workspace] The parameters required to patch a workspace.
1077
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1078
+ # to the HTTP request.
1079
+ #
1080
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1081
+ #
1082
+ def update_async(resource_group_name, workspace_name, parameters, custom_headers:nil)
1083
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1084
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
1085
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
1086
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
1087
+ 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?
1088
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1089
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1090
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1091
+
1092
+
1093
+ request_headers = {}
1094
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1095
+
1096
+ # Set Headers
1097
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1098
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1099
+
1100
+ # Serialize Request
1101
+ request_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::Workspace.mapper()
1102
+ request_content = @client.serialize(request_mapper, parameters)
1103
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1104
+
1105
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'
1106
+
1107
+ request_url = @base_url || @client.base_url
1108
+
1109
+ options = {
1110
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1111
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
1112
+ query_params: {'api-version' => @client.api_version},
1113
+ body: request_content,
1114
+ headers: request_headers.merge(custom_headers || {}),
1115
+ base_url: request_url
1116
+ }
1117
+ promise = @client.make_request_async(:patch, path_template, options)
1118
+
1119
+ promise = promise.then do |result|
1120
+ http_response = result.response
1121
+ status_code = http_response.status
1122
+ response_content = http_response.body
1123
+ unless status_code == 200
1124
+ error_model = JSON.load(response_content)
1125
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1126
+ end
1127
+
1128
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1129
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1130
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1131
+ # Deserialize Response
1132
+ if status_code == 200
1133
+ begin
1134
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1135
+ result_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::Workspace.mapper()
1136
+ result.body = @client.deserialize(result_mapper, parsed_response)
1137
+ rescue Exception => e
1138
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1139
+ end
1140
+ end
1141
+
1142
+ result
1143
+ end
1144
+
1145
+ promise.execute
1146
+ end
1147
+
1148
+ #
1149
+ # Create or update a workspace.
1150
+ #
1151
+ # @param resource_group_name [String] The resource group name of the workspace.
1152
+ # @param workspace_name [String] The name of the workspace.
1153
+ # @param parameters [Workspace] The parameters required to create or update a
1154
+ # workspace.
1155
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1156
+ # will be added to the HTTP request.
1157
+ #
1158
+ # @return [Workspace] operation results.
1159
+ #
1160
+ def begin_create_or_update(resource_group_name, workspace_name, parameters, custom_headers:nil)
1161
+ response = begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
1162
+ response.body unless response.nil?
1163
+ end
1164
+
1165
+ #
1166
+ # Create or update a workspace.
1167
+ #
1168
+ # @param resource_group_name [String] The resource group name of the workspace.
1169
+ # @param workspace_name [String] The name of the workspace.
1170
+ # @param parameters [Workspace] The parameters required to create or update a
1171
+ # workspace.
1172
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1173
+ # will be added to the HTTP request.
1174
+ #
1175
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1176
+ #
1177
+ def begin_create_or_update_with_http_info(resource_group_name, workspace_name, parameters, custom_headers:nil)
1178
+ begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
1179
+ end
1180
+
1181
+ #
1182
+ # Create or update a workspace.
1183
+ #
1184
+ # @param resource_group_name [String] The resource group name of the workspace.
1185
+ # @param workspace_name [String] The name of the workspace.
1186
+ # @param parameters [Workspace] The parameters required to create or update a
1187
+ # workspace.
1188
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1189
+ # to the HTTP request.
1190
+ #
1191
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1192
+ #
1193
+ def begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:nil)
1194
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1195
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
1196
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
1197
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
1198
+ 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?
1199
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1200
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1201
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1202
+
1203
+
1204
+ request_headers = {}
1205
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1206
+
1207
+ # Set Headers
1208
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1209
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1210
+
1211
+ # Serialize Request
1212
+ request_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::Workspace.mapper()
1213
+ request_content = @client.serialize(request_mapper, parameters)
1214
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1215
+
1216
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'
1217
+
1218
+ request_url = @base_url || @client.base_url
1219
+
1220
+ options = {
1221
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1222
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
1223
+ query_params: {'api-version' => @client.api_version},
1224
+ body: request_content,
1225
+ headers: request_headers.merge(custom_headers || {}),
1226
+ base_url: request_url
1227
+ }
1228
+ promise = @client.make_request_async(:put, path_template, options)
1229
+
1230
+ promise = promise.then do |result|
1231
+ http_response = result.response
1232
+ status_code = http_response.status
1233
+ response_content = http_response.body
1234
+ unless status_code == 200 || status_code == 201
1235
+ error_model = JSON.load(response_content)
1236
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1237
+ end
1238
+
1239
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1240
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1241
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1242
+ # Deserialize Response
1243
+ if status_code == 200
1244
+ begin
1245
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1246
+ result_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::Workspace.mapper()
1247
+ result.body = @client.deserialize(result_mapper, parsed_response)
1248
+ rescue Exception => e
1249
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1250
+ end
1251
+ end
1252
+ # Deserialize Response
1253
+ if status_code == 201
1254
+ begin
1255
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1256
+ result_mapper = Azure::OperationalInsights::Mgmt::V2015_11_01_preview::Models::Workspace.mapper()
1257
+ result.body = @client.deserialize(result_mapper, parsed_response)
1258
+ rescue Exception => e
1259
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1260
+ end
1261
+ end
1262
+
1263
+ result
1264
+ end
1265
+
1266
+ promise.execute
1267
+ end
1268
+
1269
+ end
1270
+ end