azure_mgmt_operational_insights 0.19.1 → 0.19.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) 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/operational_insights_management_client.rb +1 -1
  5. data/lib/2020-08-01/generated/azure_mgmt_operational_insights.rb +123 -0
  6. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/available_service_tiers.rb +146 -0
  7. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/clusters.rb +959 -0
  8. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/data_exports.rb +473 -0
  9. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/data_sources.rb +603 -0
  10. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/deleted_workspaces.rb +211 -0
  11. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/gateways.rb +123 -0
  12. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/intelligence_packs.rb +351 -0
  13. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/linked_services.rb +577 -0
  14. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/linked_storage_accounts.rb +481 -0
  15. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/management_groups.rb +130 -0
  16. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/available_service_tier.rb +124 -0
  17. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/azure_entity_resource.rb +75 -0
  18. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster.rb +159 -0
  19. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_entity_status.rb +21 -0
  20. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_error_response.rb +48 -0
  21. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_list_result.rb +98 -0
  22. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_patch.rb +78 -0
  23. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_sku.rb +58 -0
  24. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/cluster_sku_name_enum.rb +15 -0
  25. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/core_summary.rb +57 -0
  26. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_export.rb +174 -0
  27. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_export_error_response.rb +48 -0
  28. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_export_list_result.rb +56 -0
  29. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_ingestion_status.rb +20 -0
  30. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source.rb +130 -0
  31. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source_filter.rb +61 -0
  32. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source_kind.rb +47 -0
  33. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source_list_result.rb +98 -0
  34. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/data_source_type.rb +18 -0
  35. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/error_additional_info.rb +59 -0
  36. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/error_contract.rb +49 -0
  37. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/error_response.rb +113 -0
  38. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/identity.rb +72 -0
  39. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/identity_type.rb +16 -0
  40. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/intelligence_pack.rb +69 -0
  41. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/key_vault_properties.rb +71 -0
  42. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_service.rb +120 -0
  43. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_service_entity_status.rb +18 -0
  44. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_service_list_result.rb +55 -0
  45. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_storage_accounts_list_result.rb +56 -0
  46. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/linked_storage_accounts_resource.rb +95 -0
  47. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/management_group.rb +128 -0
  48. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/metric_name.rb +57 -0
  49. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/operation.rb +59 -0
  50. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/operation_display.rb +79 -0
  51. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/operation_list_result.rb +101 -0
  52. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/operation_status.rb +102 -0
  53. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/private_link_scoped_resource.rb +58 -0
  54. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/proxy_resource.rb +63 -0
  55. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/public_network_access_type.rb +16 -0
  56. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/purge_state.rb +16 -0
  57. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/resource.rb +83 -0
  58. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/saved_search.rb +165 -0
  59. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/saved_searches_list_result.rb +55 -0
  60. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_get_schema_response.rb +67 -0
  61. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_metadata.rb +241 -0
  62. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_metadata_schema.rb +57 -0
  63. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_schema_value.rb +123 -0
  64. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_sort.rb +58 -0
  65. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/search_sort_enum.rb +16 -0
  66. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/shared_keys.rb +57 -0
  67. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/sku_name_enum.rb +21 -0
  68. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_account.rb +58 -0
  69. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_insight.rb +157 -0
  70. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_insight_list_result.rb +98 -0
  71. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_insight_state.rb +16 -0
  72. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/storage_insight_status.rb +58 -0
  73. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/table.rb +79 -0
  74. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/tables_list_result.rb +55 -0
  75. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/tag.rb +57 -0
  76. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/tracked_resource.rb +92 -0
  77. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/type.rb +16 -0
  78. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/usage_metric.rb +103 -0
  79. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace.rb +213 -0
  80. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_capping.rb +72 -0
  81. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_entity_status.rb +21 -0
  82. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_list_management_groups_result.rb +56 -0
  83. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_list_result.rb +55 -0
  84. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_list_usages_result.rb +56 -0
  85. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_patch.rb +206 -0
  86. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_purge_body.rb +67 -0
  87. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_purge_body_filters.rb +85 -0
  88. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_purge_response.rb +47 -0
  89. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_purge_status_response.rb +47 -0
  90. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_sku.rb +85 -0
  91. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/models/workspace_sku_name_enum.rb +21 -0
  92. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/module_definition.rb +9 -0
  93. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/operation_statuses.rb +121 -0
  94. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/operational_insights_management_client.rb +207 -0
  95. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/operations.rb +220 -0
  96. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/saved_searches.rb +457 -0
  97. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/schema.rb +130 -0
  98. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/shared_keys_operations.rb +238 -0
  99. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/storage_insight_configs.rb +592 -0
  100. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/tables.rb +359 -0
  101. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/usages.rb +130 -0
  102. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/workspace_purge.rb +277 -0
  103. data/lib/2020-08-01/generated/azure_mgmt_operational_insights/workspaces.rb +768 -0
  104. data/lib/azure_mgmt_operational_insights.rb +1 -0
  105. data/lib/profiles/latest/modules/operationalinsights_profile_module.rb +173 -173
  106. data/lib/version.rb +1 -1
  107. metadata +101 -2
@@ -0,0 +1,277 @@
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 WorkspacePurge
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the WorkspacePurge 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
+ # Purges data in an Log Analytics workspace by a set of user-defined filters.
26
+ #
27
+ # In order to manage system resources, purge requests are throttled at 50
28
+ # requests per hour. You should batch the execution of purge requests by
29
+ # sending a single command whose predicate includes all user identities that
30
+ # require purging. Use the in operator to specify multiple identities. You
31
+ # should run the query prior to using for a purge request to verify that the
32
+ # results are expected.
33
+ #
34
+ # @param resource_group_name [String] The name of the resource group. The name
35
+ # is case insensitive.
36
+ # @param workspace_name [String] The name of the workspace.
37
+ # @param body [WorkspacePurgeBody] Describes the body of a request to purge
38
+ # data in a single table of an Log Analytics Workspace
39
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
40
+ # will be added to the HTTP request.
41
+ #
42
+ # @return [WorkspacePurgeResponse] operation results.
43
+ #
44
+ def purge(resource_group_name, workspace_name, body, custom_headers:nil)
45
+ response = purge_async(resource_group_name, workspace_name, body, custom_headers:custom_headers).value!
46
+ response.body unless response.nil?
47
+ end
48
+
49
+ #
50
+ # Purges data in an Log Analytics workspace by a set of user-defined filters.
51
+ #
52
+ # In order to manage system resources, purge requests are throttled at 50
53
+ # requests per hour. You should batch the execution of purge requests by
54
+ # sending a single command whose predicate includes all user identities that
55
+ # require purging. Use the in operator to specify multiple identities. You
56
+ # should run the query prior to using for a purge request to verify that the
57
+ # results are expected.
58
+ #
59
+ # @param resource_group_name [String] The name of the resource group. The name
60
+ # is case insensitive.
61
+ # @param workspace_name [String] The name of the workspace.
62
+ # @param body [WorkspacePurgeBody] Describes the body of a request to purge
63
+ # data in a single table of an Log Analytics Workspace
64
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
65
+ # will be added to the HTTP request.
66
+ #
67
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
68
+ #
69
+ def purge_with_http_info(resource_group_name, workspace_name, body, custom_headers:nil)
70
+ purge_async(resource_group_name, workspace_name, body, custom_headers:custom_headers).value!
71
+ end
72
+
73
+ #
74
+ # Purges data in an Log Analytics workspace by a set of user-defined filters.
75
+ #
76
+ # In order to manage system resources, purge requests are throttled at 50
77
+ # requests per hour. You should batch the execution of purge requests by
78
+ # sending a single command whose predicate includes all user identities that
79
+ # require purging. Use the in operator to specify multiple identities. You
80
+ # should run the query prior to using for a purge request to verify that the
81
+ # results are expected.
82
+ #
83
+ # @param resource_group_name [String] The name of the resource group. The name
84
+ # is case insensitive.
85
+ # @param workspace_name [String] The name of the workspace.
86
+ # @param body [WorkspacePurgeBody] Describes the body of a request to purge
87
+ # data in a single table of an Log Analytics Workspace
88
+ # @param [Hash{String => String}] A hash of custom headers that will be added
89
+ # to the HTTP request.
90
+ #
91
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
92
+ #
93
+ def purge_async(resource_group_name, workspace_name, body, custom_headers:nil)
94
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
95
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
96
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
97
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
98
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
99
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
100
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
101
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
102
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
103
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
104
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
105
+ 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?
106
+ fail ArgumentError, 'body is nil' if body.nil?
107
+
108
+
109
+ request_headers = {}
110
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
111
+
112
+ # Set Headers
113
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
114
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
115
+
116
+ # Serialize Request
117
+ request_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::WorkspacePurgeBody.mapper()
118
+ request_content = @client.serialize(request_mapper, body)
119
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
120
+
121
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/purge'
122
+
123
+ request_url = @base_url || @client.base_url
124
+
125
+ options = {
126
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
127
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'workspaceName' => workspace_name},
128
+ query_params: {'api-version' => @client.api_version},
129
+ body: request_content,
130
+ headers: request_headers.merge(custom_headers || {}),
131
+ base_url: request_url
132
+ }
133
+ promise = @client.make_request_async(:post, path_template, options)
134
+
135
+ promise = promise.then do |result|
136
+ http_response = result.response
137
+ status_code = http_response.status
138
+ response_content = http_response.body
139
+ unless status_code == 202
140
+ error_model = JSON.load(response_content)
141
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
142
+ end
143
+
144
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
145
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
146
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
147
+ # Deserialize Response
148
+ if status_code == 202
149
+ begin
150
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
151
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::WorkspacePurgeResponse.mapper()
152
+ result.body = @client.deserialize(result_mapper, parsed_response)
153
+ rescue Exception => e
154
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
155
+ end
156
+ end
157
+
158
+ result
159
+ end
160
+
161
+ promise.execute
162
+ end
163
+
164
+ #
165
+ # Gets status of an ongoing purge operation.
166
+ #
167
+ # @param resource_group_name [String] The name of the resource group. The name
168
+ # is case insensitive.
169
+ # @param workspace_name [String] The name of the workspace.
170
+ # @param purge_id [String] In a purge status request, this is the Id of the
171
+ # operation the status of which is returned.
172
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
173
+ # will be added to the HTTP request.
174
+ #
175
+ # @return [WorkspacePurgeStatusResponse] operation results.
176
+ #
177
+ def get_purge_status(resource_group_name, workspace_name, purge_id, custom_headers:nil)
178
+ response = get_purge_status_async(resource_group_name, workspace_name, purge_id, custom_headers:custom_headers).value!
179
+ response.body unless response.nil?
180
+ end
181
+
182
+ #
183
+ # Gets status of an ongoing purge operation.
184
+ #
185
+ # @param resource_group_name [String] The name of the resource group. The name
186
+ # is case insensitive.
187
+ # @param workspace_name [String] The name of the workspace.
188
+ # @param purge_id [String] In a purge status request, this is the Id of the
189
+ # operation the status of which is returned.
190
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
191
+ # will be added to the HTTP request.
192
+ #
193
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
194
+ #
195
+ def get_purge_status_with_http_info(resource_group_name, workspace_name, purge_id, custom_headers:nil)
196
+ get_purge_status_async(resource_group_name, workspace_name, purge_id, custom_headers:custom_headers).value!
197
+ end
198
+
199
+ #
200
+ # Gets status of an ongoing purge operation.
201
+ #
202
+ # @param resource_group_name [String] The name of the resource group. The name
203
+ # is case insensitive.
204
+ # @param workspace_name [String] The name of the workspace.
205
+ # @param purge_id [String] In a purge status request, this is the Id of the
206
+ # operation the status of which is returned.
207
+ # @param [Hash{String => String}] A hash of custom headers that will be added
208
+ # to the HTTP request.
209
+ #
210
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
211
+ #
212
+ def get_purge_status_async(resource_group_name, workspace_name, purge_id, custom_headers:nil)
213
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
214
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
215
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
216
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
217
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
218
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
219
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
220
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
221
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
222
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
223
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
224
+ 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?
225
+ fail ArgumentError, 'purge_id is nil' if purge_id.nil?
226
+
227
+
228
+ request_headers = {}
229
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
230
+
231
+ # Set Headers
232
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
233
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
234
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/operations/{purgeId}'
235
+
236
+ request_url = @base_url || @client.base_url
237
+
238
+ options = {
239
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
240
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id,'workspaceName' => workspace_name,'purgeId' => purge_id},
241
+ query_params: {'api-version' => @client.api_version},
242
+ headers: request_headers.merge(custom_headers || {}),
243
+ base_url: request_url
244
+ }
245
+ promise = @client.make_request_async(:get, path_template, options)
246
+
247
+ promise = promise.then do |result|
248
+ http_response = result.response
249
+ status_code = http_response.status
250
+ response_content = http_response.body
251
+ unless status_code == 200
252
+ error_model = JSON.load(response_content)
253
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
254
+ end
255
+
256
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
257
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
258
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
259
+ # Deserialize Response
260
+ if status_code == 200
261
+ begin
262
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
263
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::WorkspacePurgeStatusResponse.mapper()
264
+ result.body = @client.deserialize(result_mapper, parsed_response)
265
+ rescue Exception => e
266
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
267
+ end
268
+ end
269
+
270
+ result
271
+ end
272
+
273
+ promise.execute
274
+ end
275
+
276
+ end
277
+ end
@@ -0,0 +1,768 @@
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 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
+ # Gets the workspaces in a subscription.
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [WorkspaceListResult] operation results.
31
+ #
32
+ def list(custom_headers:nil)
33
+ response = list_async(custom_headers:custom_headers).value!
34
+ response.body unless response.nil?
35
+ end
36
+
37
+ #
38
+ # Gets the workspaces in a subscription.
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def list_with_http_info(custom_headers:nil)
46
+ list_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # Gets the workspaces in a subscription.
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def list_async(custom_headers:nil)
58
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
59
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
60
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
61
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
62
+
63
+
64
+ request_headers = {}
65
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
66
+
67
+ # Set Headers
68
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
69
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
70
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/workspaces'
71
+
72
+ request_url = @base_url || @client.base_url
73
+
74
+ options = {
75
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
76
+ path_params: {'subscriptionId' => @client.subscription_id},
77
+ query_params: {'api-version' => @client.api_version},
78
+ headers: request_headers.merge(custom_headers || {}),
79
+ base_url: request_url
80
+ }
81
+ promise = @client.make_request_async(:get, path_template, options)
82
+
83
+ promise = promise.then do |result|
84
+ http_response = result.response
85
+ status_code = http_response.status
86
+ response_content = http_response.body
87
+ unless status_code == 200
88
+ error_model = JSON.load(response_content)
89
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
90
+ end
91
+
92
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
93
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
94
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
95
+ # Deserialize Response
96
+ if status_code == 200
97
+ begin
98
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
99
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::WorkspaceListResult.mapper()
100
+ result.body = @client.deserialize(result_mapper, parsed_response)
101
+ rescue Exception => e
102
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
103
+ end
104
+ end
105
+
106
+ result
107
+ end
108
+
109
+ promise.execute
110
+ end
111
+
112
+ #
113
+ # Gets workspaces in a resource group.
114
+ #
115
+ # @param resource_group_name [String] The name of the resource group. The name
116
+ # is case insensitive.
117
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
118
+ # will be added to the HTTP request.
119
+ #
120
+ # @return [WorkspaceListResult] operation results.
121
+ #
122
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
123
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
124
+ response.body unless response.nil?
125
+ end
126
+
127
+ #
128
+ # Gets workspaces in a resource group.
129
+ #
130
+ # @param resource_group_name [String] The name of the resource group. The name
131
+ # is case insensitive.
132
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
133
+ # will be added to the HTTP request.
134
+ #
135
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
136
+ #
137
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
138
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
139
+ end
140
+
141
+ #
142
+ # Gets workspaces in a resource group.
143
+ #
144
+ # @param resource_group_name [String] The name of the resource group. The name
145
+ # is case insensitive.
146
+ # @param [Hash{String => String}] A hash of custom headers that will be added
147
+ # to the HTTP request.
148
+ #
149
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
150
+ #
151
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
152
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
153
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
154
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
155
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces'
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: {'resourceGroupName' => resource_group_name,'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 MsRestAzure::AzureOperationError.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::WorkspaceListResult.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 workspace.
212
+ #
213
+ # @param resource_group_name [String] The name of the resource group. The name
214
+ # is case insensitive.
215
+ # @param workspace_name [String] The name of the workspace.
216
+ # @param parameters [Workspace] The parameters required to create or update a
217
+ # workspace.
218
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
219
+ # will be added to the HTTP request.
220
+ #
221
+ # @return [Workspace] operation results.
222
+ #
223
+ def create_or_update(resource_group_name, workspace_name, parameters, custom_headers:nil)
224
+ response = create_or_update_async(resource_group_name, workspace_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 workspace_name [String] The name of the workspace.
232
+ # @param parameters [Workspace] The parameters required to create or update a
233
+ # workspace.
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, workspace_name, parameters, custom_headers:nil)
241
+ # Send request
242
+ promise = begin_create_or_update_async(resource_group_name, workspace_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::Workspace.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 workspace resource. To recover the workspace, create it again with
260
+ # the same name, in the same subscription, resource group and location. The
261
+ # name is kept for 14 days and cannot be used for another workspace. To remove
262
+ # the workspace completely and release the name, use the force flag.
263
+ #
264
+ # @param resource_group_name [String] The name of the resource group. The name
265
+ # is case insensitive.
266
+ # @param workspace_name [String] The name of the workspace.
267
+ # @param force [Boolean] Deletes the workspace without the recovery option. A
268
+ # workspace that was deleted with this flag cannot be recovered.
269
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
270
+ # will be added to the HTTP request.
271
+ #
272
+ def delete(resource_group_name, workspace_name, force:nil, custom_headers:nil)
273
+ response = delete_async(resource_group_name, workspace_name, force:force, custom_headers:custom_headers).value!
274
+ nil
275
+ end
276
+
277
+ #
278
+ # @param resource_group_name [String] The name of the resource group. The name
279
+ # is case insensitive.
280
+ # @param workspace_name [String] The name of the workspace.
281
+ # @param force [Boolean] Deletes the workspace without the recovery option. A
282
+ # workspace that was deleted with this flag cannot be recovered.
283
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
284
+ # will be added to the HTTP request.
285
+ #
286
+ # @return [Concurrent::Promise] promise which provides async access to http
287
+ # response.
288
+ #
289
+ def delete_async(resource_group_name, workspace_name, force:nil, custom_headers:nil)
290
+ # Send request
291
+ promise = begin_delete_async(resource_group_name, workspace_name, force:force, custom_headers:custom_headers)
292
+
293
+ promise = promise.then do |response|
294
+ # Defining deserialization method.
295
+ deserialize_method = lambda do |parsed_response|
296
+ end
297
+
298
+ # Waiting for response.
299
+ @client.get_long_running_operation_result(response, deserialize_method)
300
+ end
301
+
302
+ promise
303
+ end
304
+
305
+ #
306
+ # Gets a workspace instance.
307
+ #
308
+ # @param resource_group_name [String] The name of the resource group. The name
309
+ # is case insensitive.
310
+ # @param workspace_name [String] The name of the workspace.
311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
312
+ # will be added to the HTTP request.
313
+ #
314
+ # @return [Workspace] operation results.
315
+ #
316
+ def get(resource_group_name, workspace_name, custom_headers:nil)
317
+ response = get_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
318
+ response.body unless response.nil?
319
+ end
320
+
321
+ #
322
+ # Gets a workspace instance.
323
+ #
324
+ # @param resource_group_name [String] The name of the resource group. The name
325
+ # is case insensitive.
326
+ # @param workspace_name [String] The name of the workspace.
327
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
328
+ # will be added to the HTTP request.
329
+ #
330
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
331
+ #
332
+ def get_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
333
+ get_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
334
+ end
335
+
336
+ #
337
+ # Gets a workspace instance.
338
+ #
339
+ # @param resource_group_name [String] The name of the resource group. The name
340
+ # is case insensitive.
341
+ # @param workspace_name [String] The name of the workspace.
342
+ # @param [Hash{String => String}] A hash of custom headers that will be added
343
+ # to the HTTP request.
344
+ #
345
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
346
+ #
347
+ def get_async(resource_group_name, workspace_name, custom_headers:nil)
348
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
349
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
350
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
351
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
352
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
353
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
354
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
355
+ 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?
356
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
357
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
358
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
359
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
360
+
361
+
362
+ request_headers = {}
363
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
364
+
365
+ # Set Headers
366
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
367
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
368
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'
369
+
370
+ request_url = @base_url || @client.base_url
371
+
372
+ options = {
373
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
374
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
375
+ query_params: {'api-version' => @client.api_version},
376
+ headers: request_headers.merge(custom_headers || {}),
377
+ base_url: request_url
378
+ }
379
+ promise = @client.make_request_async(:get, path_template, options)
380
+
381
+ promise = promise.then do |result|
382
+ http_response = result.response
383
+ status_code = http_response.status
384
+ response_content = http_response.body
385
+ unless status_code == 200
386
+ error_model = JSON.load(response_content)
387
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
388
+ end
389
+
390
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
391
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
392
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
393
+ # Deserialize Response
394
+ if status_code == 200
395
+ begin
396
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
397
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::Workspace.mapper()
398
+ result.body = @client.deserialize(result_mapper, parsed_response)
399
+ rescue Exception => e
400
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
401
+ end
402
+ end
403
+
404
+ result
405
+ end
406
+
407
+ promise.execute
408
+ end
409
+
410
+ #
411
+ # Updates a workspace.
412
+ #
413
+ # @param resource_group_name [String] The name of the resource group. The name
414
+ # is case insensitive.
415
+ # @param workspace_name [String] The name of the workspace.
416
+ # @param parameters [WorkspacePatch] The parameters required to patch a
417
+ # workspace.
418
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
419
+ # will be added to the HTTP request.
420
+ #
421
+ # @return [Workspace] operation results.
422
+ #
423
+ def update(resource_group_name, workspace_name, parameters, custom_headers:nil)
424
+ response = update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
425
+ response.body unless response.nil?
426
+ end
427
+
428
+ #
429
+ # Updates a workspace.
430
+ #
431
+ # @param resource_group_name [String] The name of the resource group. The name
432
+ # is case insensitive.
433
+ # @param workspace_name [String] The name of the workspace.
434
+ # @param parameters [WorkspacePatch] The parameters required to patch a
435
+ # workspace.
436
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
437
+ # will be added to the HTTP request.
438
+ #
439
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
440
+ #
441
+ def update_with_http_info(resource_group_name, workspace_name, parameters, custom_headers:nil)
442
+ update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
443
+ end
444
+
445
+ #
446
+ # Updates a workspace.
447
+ #
448
+ # @param resource_group_name [String] The name of the resource group. The name
449
+ # is case insensitive.
450
+ # @param workspace_name [String] The name of the workspace.
451
+ # @param parameters [WorkspacePatch] The parameters required to patch a
452
+ # workspace.
453
+ # @param [Hash{String => String}] A hash of custom headers that will be added
454
+ # to the HTTP request.
455
+ #
456
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
457
+ #
458
+ def update_async(resource_group_name, workspace_name, parameters, custom_headers:nil)
459
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
460
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
461
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
462
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
463
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
464
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
465
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
466
+ 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?
467
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
468
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
469
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
470
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
471
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
472
+
473
+
474
+ request_headers = {}
475
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
476
+
477
+ # Set Headers
478
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
479
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
480
+
481
+ # Serialize Request
482
+ request_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::WorkspacePatch.mapper()
483
+ request_content = @client.serialize(request_mapper, parameters)
484
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
485
+
486
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'
487
+
488
+ request_url = @base_url || @client.base_url
489
+
490
+ options = {
491
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
492
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
493
+ query_params: {'api-version' => @client.api_version},
494
+ body: request_content,
495
+ headers: request_headers.merge(custom_headers || {}),
496
+ base_url: request_url
497
+ }
498
+ promise = @client.make_request_async(:patch, path_template, options)
499
+
500
+ promise = promise.then do |result|
501
+ http_response = result.response
502
+ status_code = http_response.status
503
+ response_content = http_response.body
504
+ unless status_code == 200
505
+ error_model = JSON.load(response_content)
506
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
507
+ end
508
+
509
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
510
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
511
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
512
+ # Deserialize Response
513
+ if status_code == 200
514
+ begin
515
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
516
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::Workspace.mapper()
517
+ result.body = @client.deserialize(result_mapper, parsed_response)
518
+ rescue Exception => e
519
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
520
+ end
521
+ end
522
+
523
+ result
524
+ end
525
+
526
+ promise.execute
527
+ end
528
+
529
+ #
530
+ # Create or update a workspace.
531
+ #
532
+ # @param resource_group_name [String] The name of the resource group. The name
533
+ # is case insensitive.
534
+ # @param workspace_name [String] The name of the workspace.
535
+ # @param parameters [Workspace] The parameters required to create or update a
536
+ # workspace.
537
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
538
+ # will be added to the HTTP request.
539
+ #
540
+ # @return [Workspace] operation results.
541
+ #
542
+ def begin_create_or_update(resource_group_name, workspace_name, parameters, custom_headers:nil)
543
+ response = begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
544
+ response.body unless response.nil?
545
+ end
546
+
547
+ #
548
+ # Create or update a workspace.
549
+ #
550
+ # @param resource_group_name [String] The name of the resource group. The name
551
+ # is case insensitive.
552
+ # @param workspace_name [String] The name of the workspace.
553
+ # @param parameters [Workspace] The parameters required to create or update a
554
+ # workspace.
555
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
556
+ # will be added to the HTTP request.
557
+ #
558
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
559
+ #
560
+ def begin_create_or_update_with_http_info(resource_group_name, workspace_name, parameters, custom_headers:nil)
561
+ begin_create_or_update_async(resource_group_name, workspace_name, parameters, custom_headers:custom_headers).value!
562
+ end
563
+
564
+ #
565
+ # Create or update a workspace.
566
+ #
567
+ # @param resource_group_name [String] The name of the resource group. The name
568
+ # is case insensitive.
569
+ # @param workspace_name [String] The name of the workspace.
570
+ # @param parameters [Workspace] The parameters required to create or update a
571
+ # 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 begin_create_or_update_async(resource_group_name, workspace_name, parameters, 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, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
584
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
585
+ 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?
586
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
587
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
588
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
589
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
590
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
591
+
592
+
593
+ request_headers = {}
594
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
595
+
596
+ # Set Headers
597
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
598
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
599
+
600
+ # Serialize Request
601
+ request_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::Workspace.mapper()
602
+ request_content = @client.serialize(request_mapper, parameters)
603
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
604
+
605
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'
606
+
607
+ request_url = @base_url || @client.base_url
608
+
609
+ options = {
610
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
611
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
612
+ query_params: {'api-version' => @client.api_version},
613
+ body: request_content,
614
+ headers: request_headers.merge(custom_headers || {}),
615
+ base_url: request_url
616
+ }
617
+ promise = @client.make_request_async(:put, path_template, options)
618
+
619
+ promise = promise.then do |result|
620
+ http_response = result.response
621
+ status_code = http_response.status
622
+ response_content = http_response.body
623
+ unless status_code == 200 || status_code == 201 || status_code == 202
624
+ error_model = JSON.load(response_content)
625
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
626
+ end
627
+
628
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
629
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
630
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
631
+ # Deserialize Response
632
+ if status_code == 200
633
+ begin
634
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
635
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::Workspace.mapper()
636
+ result.body = @client.deserialize(result_mapper, parsed_response)
637
+ rescue Exception => e
638
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
639
+ end
640
+ end
641
+ # Deserialize Response
642
+ if status_code == 201
643
+ begin
644
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
645
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::Workspace.mapper()
646
+ result.body = @client.deserialize(result_mapper, parsed_response)
647
+ rescue Exception => e
648
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
649
+ end
650
+ end
651
+
652
+ result
653
+ end
654
+
655
+ promise.execute
656
+ end
657
+
658
+ #
659
+ # Deletes a workspace resource. To recover the workspace, create it again with
660
+ # the same name, in the same subscription, resource group and location. The
661
+ # name is kept for 14 days and cannot be used for another workspace. To remove
662
+ # the workspace completely and release the name, use the force flag.
663
+ #
664
+ # @param resource_group_name [String] The name of the resource group. The name
665
+ # is case insensitive.
666
+ # @param workspace_name [String] The name of the workspace.
667
+ # @param force [Boolean] Deletes the workspace without the recovery option. A
668
+ # workspace that was deleted with this flag cannot be recovered.
669
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
670
+ # will be added to the HTTP request.
671
+ #
672
+ #
673
+ def begin_delete(resource_group_name, workspace_name, force:nil, custom_headers:nil)
674
+ response = begin_delete_async(resource_group_name, workspace_name, force:force, custom_headers:custom_headers).value!
675
+ nil
676
+ end
677
+
678
+ #
679
+ # Deletes a workspace resource. To recover the workspace, create it again with
680
+ # the same name, in the same subscription, resource group and location. The
681
+ # name is kept for 14 days and cannot be used for another workspace. To remove
682
+ # the workspace completely and release the name, use the force flag.
683
+ #
684
+ # @param resource_group_name [String] The name of the resource group. The name
685
+ # is case insensitive.
686
+ # @param workspace_name [String] The name of the workspace.
687
+ # @param force [Boolean] Deletes the workspace without the recovery option. A
688
+ # workspace that was deleted with this flag cannot be recovered.
689
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
690
+ # will be added to the HTTP request.
691
+ #
692
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
693
+ #
694
+ def begin_delete_with_http_info(resource_group_name, workspace_name, force:nil, custom_headers:nil)
695
+ begin_delete_async(resource_group_name, workspace_name, force:force, custom_headers:custom_headers).value!
696
+ end
697
+
698
+ #
699
+ # Deletes a workspace resource. To recover the workspace, create it again with
700
+ # the same name, in the same subscription, resource group and location. The
701
+ # name is kept for 14 days and cannot be used for another workspace. To remove
702
+ # the workspace completely and release the name, use the force flag.
703
+ #
704
+ # @param resource_group_name [String] The name of the resource group. The name
705
+ # is case insensitive.
706
+ # @param workspace_name [String] The name of the workspace.
707
+ # @param force [Boolean] Deletes the workspace without the recovery option. A
708
+ # workspace that was deleted with this flag cannot be recovered.
709
+ # @param [Hash{String => String}] A hash of custom headers that will be added
710
+ # to the HTTP request.
711
+ #
712
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
713
+ #
714
+ def begin_delete_async(resource_group_name, workspace_name, force:nil, custom_headers:nil)
715
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
716
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
717
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
718
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
719
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
720
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
721
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
722
+ 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?
723
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
724
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
725
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
726
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
727
+
728
+
729
+ request_headers = {}
730
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
731
+
732
+ # Set Headers
733
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
734
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
735
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'
736
+
737
+ request_url = @base_url || @client.base_url
738
+
739
+ options = {
740
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
741
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
742
+ query_params: {'api-version' => @client.api_version,'force' => force},
743
+ headers: request_headers.merge(custom_headers || {}),
744
+ base_url: request_url
745
+ }
746
+ promise = @client.make_request_async(:delete, path_template, options)
747
+
748
+ promise = promise.then do |result|
749
+ http_response = result.response
750
+ status_code = http_response.status
751
+ response_content = http_response.body
752
+ unless status_code == 200 || status_code == 202 || status_code == 204
753
+ error_model = JSON.load(response_content)
754
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
755
+ end
756
+
757
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
758
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
759
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
760
+
761
+ result
762
+ end
763
+
764
+ promise.execute
765
+ end
766
+
767
+ end
768
+ end