azure_mgmt_operational_insights 0.18.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-03-20/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +1 -1
  3. data/lib/2015-11-01-preview/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +1 -1
  4. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights.rb +34 -31
  5. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/data_collector_logs.rb +352 -0
  6. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/data_exports.rb +64 -114
  7. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/linked_storage_accounts.rb +18 -9
  8. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/azure_entity_resource.rb +3 -1
  9. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_collector_log.rb +73 -0
  10. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_collector_logs_list_result.rb +56 -0
  11. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_export.rb +1 -12
  12. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_source.rb +3 -3
  13. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/data_source_type.rb +3 -0
  14. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/error_response.rb +5 -1
  15. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/linked_storage_accounts_resource.rb +1 -1
  16. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/proxy_resource.rb +4 -2
  17. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/resource.rb +8 -5
  18. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/saved_search.rb +3 -3
  19. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/models/tracked_resource.rb +4 -1
  20. data/lib/2020-03-01-preview/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +5 -1
  21. data/lib/2020-08-01/generated/azure_mgmt_operational_insights.rb +123 -0
  22. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/available_service_tiers.rb +146 -0
  23. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/clusters.rb +959 -0
  24. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/data_exports.rb +473 -0
  25. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/data_sources.rb +603 -0
  26. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/deleted_workspaces.rb +211 -0
  27. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/gateways.rb +123 -0
  28. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/intelligence_packs.rb +351 -0
  29. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/linked_services.rb +577 -0
  30. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/linked_storage_accounts.rb +481 -0
  31. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/management_groups.rb +130 -0
  32. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/available_service_tier.rb +124 -0
  33. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/azure_entity_resource.rb +77 -0
  34. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster.rb +159 -0
  35. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_entity_status.rb +21 -0
  36. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_error_response.rb +48 -0
  37. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_list_result.rb +98 -0
  38. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_patch.rb +78 -0
  39. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_sku.rb +58 -0
  40. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_sku_name_enum.rb +15 -0
  41. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/core_summary.rb +57 -0
  42. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_export.rb +163 -0
  43. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_export_error_response.rb +48 -0
  44. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_export_list_result.rb +56 -0
  45. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_ingestion_status.rb +20 -0
  46. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source.rb +130 -0
  47. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source_filter.rb +61 -0
  48. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source_kind.rb +47 -0
  49. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source_list_result.rb +98 -0
  50. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source_type.rb +18 -0
  51. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/error_additional_info.rb +59 -0
  52. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/error_contract.rb +49 -0
  53. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/error_response.rb +117 -0
  54. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/identity.rb +72 -0
  55. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/identity_type.rb +16 -0
  56. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/intelligence_pack.rb +69 -0
  57. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/key_vault_properties.rb +71 -0
  58. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_service.rb +120 -0
  59. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_service_entity_status.rb +18 -0
  60. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_service_list_result.rb +55 -0
  61. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_storage_accounts_list_result.rb +56 -0
  62. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_storage_accounts_resource.rb +95 -0
  63. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/management_group.rb +128 -0
  64. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/metric_name.rb +57 -0
  65. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/operation.rb +59 -0
  66. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/operation_display.rb +79 -0
  67. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/operation_list_result.rb +101 -0
  68. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/operation_status.rb +102 -0
  69. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/private_link_scoped_resource.rb +58 -0
  70. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/proxy_resource.rb +65 -0
  71. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/public_network_access_type.rb +16 -0
  72. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/purge_state.rb +16 -0
  73. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/resource.rb +86 -0
  74. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/saved_search.rb +165 -0
  75. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/saved_searches_list_result.rb +55 -0
  76. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_get_schema_response.rb +67 -0
  77. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_metadata.rb +241 -0
  78. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_metadata_schema.rb +57 -0
  79. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_schema_value.rb +123 -0
  80. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_sort.rb +58 -0
  81. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_sort_enum.rb +16 -0
  82. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/shared_keys.rb +57 -0
  83. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/sku_name_enum.rb +21 -0
  84. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_account.rb +58 -0
  85. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_insight.rb +157 -0
  86. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_insight_list_result.rb +98 -0
  87. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_insight_state.rb +16 -0
  88. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_insight_status.rb +58 -0
  89. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/table.rb +79 -0
  90. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/tables_list_result.rb +55 -0
  91. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/tag.rb +57 -0
  92. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/tracked_resource.rb +95 -0
  93. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/type.rb +16 -0
  94. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/usage_metric.rb +103 -0
  95. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace.rb +213 -0
  96. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_capping.rb +72 -0
  97. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_entity_status.rb +21 -0
  98. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_list_management_groups_result.rb +56 -0
  99. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_list_result.rb +55 -0
  100. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_list_usages_result.rb +56 -0
  101. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_patch.rb +206 -0
  102. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_purge_body.rb +67 -0
  103. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_purge_body_filters.rb +85 -0
  104. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_purge_response.rb +47 -0
  105. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_purge_status_response.rb +47 -0
  106. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_sku.rb +85 -0
  107. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_sku_name_enum.rb +21 -0
  108. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/module_definition.rb +9 -0
  109. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/operation_statuses.rb +121 -0
  110. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +207 -0
  111. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/operations.rb +220 -0
  112. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/saved_searches.rb +457 -0
  113. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/schema.rb +130 -0
  114. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/shared_keys_operations.rb +238 -0
  115. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/storage_insight_configs.rb +592 -0
  116. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/tables.rb +359 -0
  117. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/usages.rb +130 -0
  118. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/workspace_purge.rb +277 -0
  119. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/workspaces.rb +768 -0
  120. data/lib/azure_mgmt_operational_insights.rb +2 -1
  121. data/lib/profiles/latest/modules/operationalinsights_profile_module.rb +173 -173
  122. data/lib/version.rb +1 -1
  123. metadata +105 -3
@@ -0,0 +1,146 @@
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::V2020_08_01
7
+ #
8
+ # Operational Insights Client
9
+ #
10
+ class AvailableServiceTiers
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the AvailableServiceTiers 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
+ # Gets the available service tiers for the workspace.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group. The name
28
+ # is case insensitive.
29
+ # @param workspace_name [String] The name of the workspace.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Array] operation results.
34
+ #
35
+ def list_by_workspace(resource_group_name, workspace_name, custom_headers:nil)
36
+ response = list_by_workspace_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Gets the available service tiers for the workspace.
42
+ #
43
+ # @param resource_group_name [String] The name of the resource group. The name
44
+ # is case insensitive.
45
+ # @param workspace_name [String] The name of the workspace.
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def list_by_workspace_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
52
+ list_by_workspace_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Gets the available service tiers for the workspace.
57
+ #
58
+ # @param resource_group_name [String] The name of the resource group. The name
59
+ # is case insensitive.
60
+ # @param workspace_name [String] The name of the workspace.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def list_by_workspace_async(resource_group_name, workspace_name, custom_headers:nil)
67
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
68
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
69
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
70
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
71
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
72
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
73
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
74
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
75
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
76
+ 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?
77
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
78
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
79
+
80
+
81
+ request_headers = {}
82
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
83
+
84
+ # Set Headers
85
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
86
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
87
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/availableServiceTiers'
88
+
89
+ request_url = @base_url || @client.base_url
90
+
91
+ options = {
92
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
93
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name},
94
+ query_params: {'api-version' => @client.api_version},
95
+ headers: request_headers.merge(custom_headers || {}),
96
+ base_url: request_url
97
+ }
98
+ promise = @client.make_request_async(:get, path_template, options)
99
+
100
+ promise = promise.then do |result|
101
+ http_response = result.response
102
+ status_code = http_response.status
103
+ response_content = http_response.body
104
+ unless status_code == 200
105
+ error_model = JSON.load(response_content)
106
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
107
+ end
108
+
109
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
110
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
111
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
112
+ # Deserialize Response
113
+ if status_code == 200
114
+ begin
115
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
116
+ result_mapper = {
117
+ client_side_validation: true,
118
+ required: false,
119
+ serialized_name: 'parsed_response',
120
+ type: {
121
+ name: 'Sequence',
122
+ element: {
123
+ client_side_validation: true,
124
+ required: false,
125
+ serialized_name: 'AvailableServiceTierElementType',
126
+ type: {
127
+ name: 'Composite',
128
+ class_name: 'AvailableServiceTier'
129
+ }
130
+ }
131
+ }
132
+ }
133
+ result.body = @client.deserialize(result_mapper, parsed_response)
134
+ rescue Exception => e
135
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
136
+ end
137
+ end
138
+
139
+ result
140
+ end
141
+
142
+ promise.execute
143
+ end
144
+
145
+ end
146
+ end
@@ -0,0 +1,959 @@
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::V2020_08_01
7
+ #
8
+ # Operational Insights Client
9
+ #
10
+ class Clusters
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Clusters 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
+ # Gets Log Analytics clusters in a resource group.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group. The name
28
+ # is case insensitive.
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [Array<Cluster>] operation results.
33
+ #
34
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
35
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
36
+ first_page.get_all_items
37
+ end
38
+
39
+ #
40
+ # Gets Log Analytics clusters in a resource group.
41
+ #
42
+ # @param resource_group_name [String] The name of the resource group. The name
43
+ # is case insensitive.
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
50
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Gets Log Analytics clusters in a resource group.
55
+ #
56
+ # @param resource_group_name [String] The name of the resource group. The name
57
+ # is case insensitive.
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
64
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
65
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
66
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
67
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
68
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
69
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
70
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
71
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
72
+
73
+
74
+ request_headers = {}
75
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
76
+
77
+ # Set Headers
78
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
79
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
80
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters'
81
+
82
+ request_url = @base_url || @client.base_url
83
+
84
+ options = {
85
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
86
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
87
+ query_params: {'api-version' => @client.api_version},
88
+ headers: request_headers.merge(custom_headers || {}),
89
+ base_url: request_url
90
+ }
91
+ promise = @client.make_request_async(:get, path_template, options)
92
+
93
+ promise = promise.then do |result|
94
+ http_response = result.response
95
+ status_code = http_response.status
96
+ response_content = http_response.body
97
+ unless status_code == 200
98
+ error_model = JSON.load(response_content)
99
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
100
+ end
101
+
102
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
103
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
104
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
105
+ # Deserialize Response
106
+ if status_code == 200
107
+ begin
108
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
109
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::ClusterListResult.mapper()
110
+ result.body = @client.deserialize(result_mapper, parsed_response)
111
+ rescue Exception => e
112
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
113
+ end
114
+ end
115
+
116
+ result
117
+ end
118
+
119
+ promise.execute
120
+ end
121
+
122
+ #
123
+ # Gets the Log Analytics clusters in a subscription.
124
+ #
125
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
126
+ # will be added to the HTTP request.
127
+ #
128
+ # @return [Array<Cluster>] operation results.
129
+ #
130
+ def list(custom_headers:nil)
131
+ first_page = list_as_lazy(custom_headers:custom_headers)
132
+ first_page.get_all_items
133
+ end
134
+
135
+ #
136
+ # Gets the Log Analytics clusters in a subscription.
137
+ #
138
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
139
+ # will be added to the HTTP request.
140
+ #
141
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
142
+ #
143
+ def list_with_http_info(custom_headers:nil)
144
+ list_async(custom_headers:custom_headers).value!
145
+ end
146
+
147
+ #
148
+ # Gets the Log Analytics clusters in a subscription.
149
+ #
150
+ # @param [Hash{String => String}] A hash of custom headers that will be added
151
+ # to the HTTP request.
152
+ #
153
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
154
+ #
155
+ def list_async(custom_headers:nil)
156
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
157
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
158
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
159
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
160
+
161
+
162
+ request_headers = {}
163
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
164
+
165
+ # Set Headers
166
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
167
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
168
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/clusters'
169
+
170
+ request_url = @base_url || @client.base_url
171
+
172
+ options = {
173
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
174
+ path_params: {'subscriptionId' => @client.subscription_id},
175
+ query_params: {'api-version' => @client.api_version},
176
+ headers: request_headers.merge(custom_headers || {}),
177
+ base_url: request_url
178
+ }
179
+ promise = @client.make_request_async(:get, path_template, options)
180
+
181
+ promise = promise.then do |result|
182
+ http_response = result.response
183
+ status_code = http_response.status
184
+ response_content = http_response.body
185
+ unless status_code == 200
186
+ error_model = JSON.load(response_content)
187
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
188
+ end
189
+
190
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
191
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
192
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
193
+ # Deserialize Response
194
+ if status_code == 200
195
+ begin
196
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
197
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::ClusterListResult.mapper()
198
+ result.body = @client.deserialize(result_mapper, parsed_response)
199
+ rescue Exception => e
200
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
201
+ end
202
+ end
203
+
204
+ result
205
+ end
206
+
207
+ promise.execute
208
+ end
209
+
210
+ #
211
+ # Create or update a Log Analytics cluster.
212
+ #
213
+ # @param resource_group_name [String] The name of the resource group. The name
214
+ # is case insensitive.
215
+ # @param cluster_name [String] The name of the Log Analytics cluster.
216
+ # @param parameters [Cluster] The parameters required to create or update a Log
217
+ # Analytics cluster.
218
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
219
+ # will be added to the HTTP request.
220
+ #
221
+ # @return [Cluster] operation results.
222
+ #
223
+ def create_or_update(resource_group_name, cluster_name, parameters, custom_headers:nil)
224
+ response = create_or_update_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
225
+ response.body unless response.nil?
226
+ end
227
+
228
+ #
229
+ # @param resource_group_name [String] The name of the resource group. The name
230
+ # is case insensitive.
231
+ # @param cluster_name [String] The name of the Log Analytics cluster.
232
+ # @param parameters [Cluster] The parameters required to create or update a Log
233
+ # Analytics cluster.
234
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
235
+ # will be added to the HTTP request.
236
+ #
237
+ # @return [Concurrent::Promise] promise which provides async access to http
238
+ # response.
239
+ #
240
+ def create_or_update_async(resource_group_name, cluster_name, parameters, custom_headers:nil)
241
+ # Send request
242
+ promise = begin_create_or_update_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers)
243
+
244
+ promise = promise.then do |response|
245
+ # Defining deserialization method.
246
+ deserialize_method = lambda do |parsed_response|
247
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::Cluster.mapper()
248
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
249
+ end
250
+
251
+ # Waiting for response.
252
+ @client.get_long_running_operation_result(response, deserialize_method)
253
+ end
254
+
255
+ promise
256
+ end
257
+
258
+ #
259
+ # Deletes a cluster instance.
260
+ #
261
+ # @param resource_group_name [String] The name of the resource group. The name
262
+ # is case insensitive.
263
+ # @param cluster_name [String] Name of the Log Analytics Cluster.
264
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
265
+ # will be added to the HTTP request.
266
+ #
267
+ def delete(resource_group_name, cluster_name, custom_headers:nil)
268
+ response = delete_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
269
+ nil
270
+ end
271
+
272
+ #
273
+ # @param resource_group_name [String] The name of the resource group. The name
274
+ # is case insensitive.
275
+ # @param cluster_name [String] Name of the Log Analytics Cluster.
276
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
277
+ # will be added to the HTTP request.
278
+ #
279
+ # @return [Concurrent::Promise] promise which provides async access to http
280
+ # response.
281
+ #
282
+ def delete_async(resource_group_name, cluster_name, custom_headers:nil)
283
+ # Send request
284
+ promise = begin_delete_async(resource_group_name, cluster_name, custom_headers:custom_headers)
285
+
286
+ promise = promise.then do |response|
287
+ # Defining deserialization method.
288
+ deserialize_method = lambda do |parsed_response|
289
+ end
290
+
291
+ # Waiting for response.
292
+ @client.get_long_running_operation_result(response, deserialize_method)
293
+ end
294
+
295
+ promise
296
+ end
297
+
298
+ #
299
+ # Gets a Log Analytics cluster instance.
300
+ #
301
+ # @param resource_group_name [String] The name of the resource group. The name
302
+ # is case insensitive.
303
+ # @param cluster_name [String] Name of the Log Analytics Cluster.
304
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
305
+ # will be added to the HTTP request.
306
+ #
307
+ # @return [Cluster] operation results.
308
+ #
309
+ def get(resource_group_name, cluster_name, custom_headers:nil)
310
+ response = get_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
311
+ response.body unless response.nil?
312
+ end
313
+
314
+ #
315
+ # Gets a Log Analytics cluster instance.
316
+ #
317
+ # @param resource_group_name [String] The name of the resource group. The name
318
+ # is case insensitive.
319
+ # @param cluster_name [String] Name of the Log Analytics Cluster.
320
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
321
+ # will be added to the HTTP request.
322
+ #
323
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
324
+ #
325
+ def get_with_http_info(resource_group_name, cluster_name, custom_headers:nil)
326
+ get_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
327
+ end
328
+
329
+ #
330
+ # Gets a Log Analytics cluster instance.
331
+ #
332
+ # @param resource_group_name [String] The name of the resource group. The name
333
+ # is case insensitive.
334
+ # @param cluster_name [String] Name of the Log Analytics Cluster.
335
+ # @param [Hash{String => String}] A hash of custom headers that will be added
336
+ # to the HTTP request.
337
+ #
338
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
339
+ #
340
+ def get_async(resource_group_name, cluster_name, custom_headers:nil)
341
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
342
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
343
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
344
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
345
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
346
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
347
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
348
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
349
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
350
+
351
+
352
+ request_headers = {}
353
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
354
+
355
+ # Set Headers
356
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
357
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
358
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}'
359
+
360
+ request_url = @base_url || @client.base_url
361
+
362
+ options = {
363
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
364
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'clusterName' => cluster_name},
365
+ query_params: {'api-version' => @client.api_version},
366
+ headers: request_headers.merge(custom_headers || {}),
367
+ base_url: request_url
368
+ }
369
+ promise = @client.make_request_async(:get, path_template, options)
370
+
371
+ promise = promise.then do |result|
372
+ http_response = result.response
373
+ status_code = http_response.status
374
+ response_content = http_response.body
375
+ unless status_code == 200
376
+ error_model = JSON.load(response_content)
377
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
378
+ end
379
+
380
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
381
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
382
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
383
+ # Deserialize Response
384
+ if status_code == 200
385
+ begin
386
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
387
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::Cluster.mapper()
388
+ result.body = @client.deserialize(result_mapper, parsed_response)
389
+ rescue Exception => e
390
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
391
+ end
392
+ end
393
+
394
+ result
395
+ end
396
+
397
+ promise.execute
398
+ end
399
+
400
+ #
401
+ # Updates a Log Analytics cluster.
402
+ #
403
+ # @param resource_group_name [String] The name of the resource group. The name
404
+ # is case insensitive.
405
+ # @param cluster_name [String] Name of the Log Analytics Cluster.
406
+ # @param parameters [ClusterPatch] The parameters required to patch a Log
407
+ # Analytics cluster.
408
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
409
+ # will be added to the HTTP request.
410
+ #
411
+ # @return [Cluster] operation results.
412
+ #
413
+ def update(resource_group_name, cluster_name, parameters, custom_headers:nil)
414
+ response = update_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
415
+ response.body unless response.nil?
416
+ end
417
+
418
+ #
419
+ # Updates a Log Analytics cluster.
420
+ #
421
+ # @param resource_group_name [String] The name of the resource group. The name
422
+ # is case insensitive.
423
+ # @param cluster_name [String] Name of the Log Analytics Cluster.
424
+ # @param parameters [ClusterPatch] The parameters required to patch a Log
425
+ # Analytics cluster.
426
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
427
+ # will be added to the HTTP request.
428
+ #
429
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
430
+ #
431
+ def update_with_http_info(resource_group_name, cluster_name, parameters, custom_headers:nil)
432
+ update_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
433
+ end
434
+
435
+ #
436
+ # Updates a Log Analytics cluster.
437
+ #
438
+ # @param resource_group_name [String] The name of the resource group. The name
439
+ # is case insensitive.
440
+ # @param cluster_name [String] Name of the Log Analytics Cluster.
441
+ # @param parameters [ClusterPatch] The parameters required to patch a Log
442
+ # Analytics cluster.
443
+ # @param [Hash{String => String}] A hash of custom headers that will be added
444
+ # to the HTTP request.
445
+ #
446
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
447
+ #
448
+ def update_async(resource_group_name, cluster_name, parameters, custom_headers:nil)
449
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
450
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
451
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
452
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
453
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
454
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
455
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
456
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
457
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
458
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
459
+
460
+
461
+ request_headers = {}
462
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
463
+
464
+ # Set Headers
465
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
466
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
467
+
468
+ # Serialize Request
469
+ request_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::ClusterPatch.mapper()
470
+ request_content = @client.serialize(request_mapper, parameters)
471
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
472
+
473
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}'
474
+
475
+ request_url = @base_url || @client.base_url
476
+
477
+ options = {
478
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
479
+ path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'subscriptionId' => @client.subscription_id},
480
+ query_params: {'api-version' => @client.api_version},
481
+ body: request_content,
482
+ headers: request_headers.merge(custom_headers || {}),
483
+ base_url: request_url
484
+ }
485
+ promise = @client.make_request_async(:patch, path_template, options)
486
+
487
+ promise = promise.then do |result|
488
+ http_response = result.response
489
+ status_code = http_response.status
490
+ response_content = http_response.body
491
+ unless status_code == 200
492
+ error_model = JSON.load(response_content)
493
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
494
+ end
495
+
496
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
497
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
498
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
499
+ # Deserialize Response
500
+ if status_code == 200
501
+ begin
502
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
503
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::Cluster.mapper()
504
+ result.body = @client.deserialize(result_mapper, parsed_response)
505
+ rescue Exception => e
506
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
507
+ end
508
+ end
509
+
510
+ result
511
+ end
512
+
513
+ promise.execute
514
+ end
515
+
516
+ #
517
+ # Create or update a Log Analytics cluster.
518
+ #
519
+ # @param resource_group_name [String] The name of the resource group. The name
520
+ # is case insensitive.
521
+ # @param cluster_name [String] The name of the Log Analytics cluster.
522
+ # @param parameters [Cluster] The parameters required to create or update a Log
523
+ # Analytics cluster.
524
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
525
+ # will be added to the HTTP request.
526
+ #
527
+ # @return [Cluster] operation results.
528
+ #
529
+ def begin_create_or_update(resource_group_name, cluster_name, parameters, custom_headers:nil)
530
+ response = begin_create_or_update_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
531
+ response.body unless response.nil?
532
+ end
533
+
534
+ #
535
+ # Create or update a Log Analytics cluster.
536
+ #
537
+ # @param resource_group_name [String] The name of the resource group. The name
538
+ # is case insensitive.
539
+ # @param cluster_name [String] The name of the Log Analytics cluster.
540
+ # @param parameters [Cluster] The parameters required to create or update a Log
541
+ # Analytics cluster.
542
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
543
+ # will be added to the HTTP request.
544
+ #
545
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
546
+ #
547
+ def begin_create_or_update_with_http_info(resource_group_name, cluster_name, parameters, custom_headers:nil)
548
+ begin_create_or_update_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
549
+ end
550
+
551
+ #
552
+ # Create or update a Log Analytics cluster.
553
+ #
554
+ # @param resource_group_name [String] The name of the resource group. The name
555
+ # is case insensitive.
556
+ # @param cluster_name [String] The name of the Log Analytics cluster.
557
+ # @param parameters [Cluster] The parameters required to create or update a Log
558
+ # Analytics cluster.
559
+ # @param [Hash{String => String}] A hash of custom headers that will be added
560
+ # to the HTTP request.
561
+ #
562
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
563
+ #
564
+ def begin_create_or_update_async(resource_group_name, cluster_name, parameters, custom_headers:nil)
565
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
566
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
567
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
568
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
569
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
570
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
571
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
572
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
573
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
574
+ fail ArgumentError, "'cluster_name' should satisfy the constraint - 'MaxLength': '63'" if !cluster_name.nil? && cluster_name.length > 63
575
+ fail ArgumentError, "'cluster_name' should satisfy the constraint - 'MinLength': '4'" if !cluster_name.nil? && cluster_name.length < 4
576
+ fail ArgumentError, "'cluster_name' should satisfy the constraint - 'Pattern': '^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$'" if !cluster_name.nil? && cluster_name.match(Regexp.new('^^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$$')).nil?
577
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
578
+
579
+
580
+ request_headers = {}
581
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
582
+
583
+ # Set Headers
584
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
585
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
586
+
587
+ # Serialize Request
588
+ request_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::Cluster.mapper()
589
+ request_content = @client.serialize(request_mapper, parameters)
590
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
591
+
592
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}'
593
+
594
+ request_url = @base_url || @client.base_url
595
+
596
+ options = {
597
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
598
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'clusterName' => cluster_name},
599
+ query_params: {'api-version' => @client.api_version},
600
+ body: request_content,
601
+ headers: request_headers.merge(custom_headers || {}),
602
+ base_url: request_url
603
+ }
604
+ promise = @client.make_request_async(:put, 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 == 202 || status_code == 200 || status_code == 201
611
+ error_model = JSON.load(response_content)
612
+ fail MsRest::HttpOperationError.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::V2020_08_01::Models::Cluster.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
+ # Deserialize Response
629
+ if status_code == 201
630
+ begin
631
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
632
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::Cluster.mapper()
633
+ result.body = @client.deserialize(result_mapper, parsed_response)
634
+ rescue Exception => e
635
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
636
+ end
637
+ end
638
+
639
+ result
640
+ end
641
+
642
+ promise.execute
643
+ end
644
+
645
+ #
646
+ # Deletes a cluster instance.
647
+ #
648
+ # @param resource_group_name [String] The name of the resource group. The name
649
+ # is case insensitive.
650
+ # @param cluster_name [String] Name of the Log Analytics Cluster.
651
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
652
+ # will be added to the HTTP request.
653
+ #
654
+ #
655
+ def begin_delete(resource_group_name, cluster_name, custom_headers:nil)
656
+ response = begin_delete_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
657
+ nil
658
+ end
659
+
660
+ #
661
+ # Deletes a cluster instance.
662
+ #
663
+ # @param resource_group_name [String] The name of the resource group. The name
664
+ # is case insensitive.
665
+ # @param cluster_name [String] Name of the Log Analytics Cluster.
666
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
667
+ # will be added to the HTTP request.
668
+ #
669
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
670
+ #
671
+ def begin_delete_with_http_info(resource_group_name, cluster_name, custom_headers:nil)
672
+ begin_delete_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
673
+ end
674
+
675
+ #
676
+ # Deletes a cluster instance.
677
+ #
678
+ # @param resource_group_name [String] The name of the resource group. The name
679
+ # is case insensitive.
680
+ # @param cluster_name [String] Name of the Log Analytics Cluster.
681
+ # @param [Hash{String => String}] A hash of custom headers that will be added
682
+ # to the HTTP request.
683
+ #
684
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
685
+ #
686
+ def begin_delete_async(resource_group_name, cluster_name, custom_headers:nil)
687
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
688
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
689
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
690
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
691
+ fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
692
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
693
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
694
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
695
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
696
+
697
+
698
+ request_headers = {}
699
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
700
+
701
+ # Set Headers
702
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
703
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
704
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}'
705
+
706
+ request_url = @base_url || @client.base_url
707
+
708
+ options = {
709
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
710
+ path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'subscriptionId' => @client.subscription_id},
711
+ query_params: {'api-version' => @client.api_version},
712
+ headers: request_headers.merge(custom_headers || {}),
713
+ base_url: request_url
714
+ }
715
+ promise = @client.make_request_async(:delete, path_template, options)
716
+
717
+ promise = promise.then do |result|
718
+ http_response = result.response
719
+ status_code = http_response.status
720
+ response_content = http_response.body
721
+ unless status_code == 200 || status_code == 204
722
+ error_model = JSON.load(response_content)
723
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
724
+ end
725
+
726
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
727
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
728
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
729
+
730
+ result
731
+ end
732
+
733
+ promise.execute
734
+ end
735
+
736
+ #
737
+ # Gets Log Analytics clusters in a resource group.
738
+ #
739
+ # @param next_page_link [String] The NextLink from the previous successful call
740
+ # to List operation.
741
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
742
+ # will be added to the HTTP request.
743
+ #
744
+ # @return [ClusterListResult] operation results.
745
+ #
746
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
747
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
748
+ response.body unless response.nil?
749
+ end
750
+
751
+ #
752
+ # Gets Log Analytics clusters in a resource group.
753
+ #
754
+ # @param next_page_link [String] The NextLink from the previous successful call
755
+ # to List operation.
756
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
757
+ # will be added to the HTTP request.
758
+ #
759
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
760
+ #
761
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
762
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
763
+ end
764
+
765
+ #
766
+ # Gets Log Analytics clusters in a resource group.
767
+ #
768
+ # @param next_page_link [String] The NextLink from the previous successful call
769
+ # to List operation.
770
+ # @param [Hash{String => String}] A hash of custom headers that will be added
771
+ # to the HTTP request.
772
+ #
773
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
774
+ #
775
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
776
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
777
+
778
+
779
+ request_headers = {}
780
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
781
+
782
+ # Set Headers
783
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
784
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
785
+ path_template = '{nextLink}'
786
+
787
+ request_url = @base_url || @client.base_url
788
+
789
+ options = {
790
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
791
+ skip_encoding_path_params: {'nextLink' => next_page_link},
792
+ headers: request_headers.merge(custom_headers || {}),
793
+ base_url: request_url
794
+ }
795
+ promise = @client.make_request_async(:get, path_template, options)
796
+
797
+ promise = promise.then do |result|
798
+ http_response = result.response
799
+ status_code = http_response.status
800
+ response_content = http_response.body
801
+ unless status_code == 200
802
+ error_model = JSON.load(response_content)
803
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
804
+ end
805
+
806
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
807
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
808
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
809
+ # Deserialize Response
810
+ if status_code == 200
811
+ begin
812
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
813
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::ClusterListResult.mapper()
814
+ result.body = @client.deserialize(result_mapper, parsed_response)
815
+ rescue Exception => e
816
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
817
+ end
818
+ end
819
+
820
+ result
821
+ end
822
+
823
+ promise.execute
824
+ end
825
+
826
+ #
827
+ # Gets the Log Analytics clusters in a subscription.
828
+ #
829
+ # @param next_page_link [String] The NextLink from the previous successful call
830
+ # to List operation.
831
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
832
+ # will be added to the HTTP request.
833
+ #
834
+ # @return [ClusterListResult] operation results.
835
+ #
836
+ def list_next(next_page_link, custom_headers:nil)
837
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
838
+ response.body unless response.nil?
839
+ end
840
+
841
+ #
842
+ # Gets the Log Analytics clusters in a subscription.
843
+ #
844
+ # @param next_page_link [String] The NextLink from the previous successful call
845
+ # to List operation.
846
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
847
+ # will be added to the HTTP request.
848
+ #
849
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
850
+ #
851
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
852
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
853
+ end
854
+
855
+ #
856
+ # Gets the Log Analytics clusters in a subscription.
857
+ #
858
+ # @param next_page_link [String] The NextLink from the previous successful call
859
+ # to List operation.
860
+ # @param [Hash{String => String}] A hash of custom headers that will be added
861
+ # to the HTTP request.
862
+ #
863
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
864
+ #
865
+ def list_next_async(next_page_link, custom_headers:nil)
866
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
867
+
868
+
869
+ request_headers = {}
870
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
871
+
872
+ # Set Headers
873
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
874
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
875
+ path_template = '{nextLink}'
876
+
877
+ request_url = @base_url || @client.base_url
878
+
879
+ options = {
880
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
881
+ skip_encoding_path_params: {'nextLink' => next_page_link},
882
+ headers: request_headers.merge(custom_headers || {}),
883
+ base_url: request_url
884
+ }
885
+ promise = @client.make_request_async(:get, path_template, options)
886
+
887
+ promise = promise.then do |result|
888
+ http_response = result.response
889
+ status_code = http_response.status
890
+ response_content = http_response.body
891
+ unless status_code == 200
892
+ error_model = JSON.load(response_content)
893
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
894
+ end
895
+
896
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
897
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
898
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
899
+ # Deserialize Response
900
+ if status_code == 200
901
+ begin
902
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
903
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::ClusterListResult.mapper()
904
+ result.body = @client.deserialize(result_mapper, parsed_response)
905
+ rescue Exception => e
906
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
907
+ end
908
+ end
909
+
910
+ result
911
+ end
912
+
913
+ promise.execute
914
+ end
915
+
916
+ #
917
+ # Gets Log Analytics clusters in a resource group.
918
+ #
919
+ # @param resource_group_name [String] The name of the resource group. The name
920
+ # is case insensitive.
921
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
922
+ # will be added to the HTTP request.
923
+ #
924
+ # @return [ClusterListResult] which provide lazy access to pages of the
925
+ # response.
926
+ #
927
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
928
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
929
+ unless response.nil?
930
+ page = response.body
931
+ page.next_method = Proc.new do |next_page_link|
932
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
933
+ end
934
+ page
935
+ end
936
+ end
937
+
938
+ #
939
+ # Gets the Log Analytics clusters in a subscription.
940
+ #
941
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
942
+ # will be added to the HTTP request.
943
+ #
944
+ # @return [ClusterListResult] which provide lazy access to pages of the
945
+ # response.
946
+ #
947
+ def list_as_lazy(custom_headers:nil)
948
+ response = list_async(custom_headers:custom_headers).value!
949
+ unless response.nil?
950
+ page = response.body
951
+ page.next_method = Proc.new do |next_page_link|
952
+ list_next_async(next_page_link, custom_headers:custom_headers)
953
+ end
954
+ page
955
+ end
956
+ end
957
+
958
+ end
959
+ end