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,207 @@
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
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class OperationalInsightsManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] The API version to use for this operation.
21
+ attr_reader :api_version
22
+
23
+ # @return [String] The ID of the target subscription.
24
+ attr_accessor :subscription_id
25
+
26
+ # @return [String] The preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return [DataExports] data_exports
39
+ attr_reader :data_exports
40
+
41
+ # @return [DataSources] data_sources
42
+ attr_reader :data_sources
43
+
44
+ # @return [IntelligencePacks] intelligence_packs
45
+ attr_reader :intelligence_packs
46
+
47
+ # @return [LinkedServices] linked_services
48
+ attr_reader :linked_services
49
+
50
+ # @return [LinkedStorageAccounts] linked_storage_accounts
51
+ attr_reader :linked_storage_accounts
52
+
53
+ # @return [ManagementGroups] management_groups
54
+ attr_reader :management_groups
55
+
56
+ # @return [Operations] operations
57
+ attr_reader :operations
58
+
59
+ # @return [OperationStatuses] operation_statuses
60
+ attr_reader :operation_statuses
61
+
62
+ # @return [SharedKeysOperations] shared_keys_operations
63
+ attr_reader :shared_keys_operations
64
+
65
+ # @return [Usages] usages
66
+ attr_reader :usages
67
+
68
+ # @return [Workspaces] workspaces
69
+ attr_reader :workspaces
70
+
71
+ # @return [DeletedWorkspaces] deleted_workspaces
72
+ attr_reader :deleted_workspaces
73
+
74
+ # @return [Clusters] clusters
75
+ attr_reader :clusters
76
+
77
+ # @return [StorageInsightConfigs] storage_insight_configs
78
+ attr_reader :storage_insight_configs
79
+
80
+ # @return [SavedSearches] saved_searches
81
+ attr_reader :saved_searches
82
+
83
+ # @return [AvailableServiceTiers] available_service_tiers
84
+ attr_reader :available_service_tiers
85
+
86
+ # @return [Gateways] gateways
87
+ attr_reader :gateways
88
+
89
+ # @return [Schema] schema
90
+ attr_reader :schema
91
+
92
+ # @return [WorkspacePurge] workspace_purge
93
+ attr_reader :workspace_purge
94
+
95
+ # @return [Tables] tables
96
+ attr_reader :tables
97
+
98
+ #
99
+ # Creates initializes a new instance of the OperationalInsightsManagementClient class.
100
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
101
+ # @param base_url [String] the base URI of the service.
102
+ # @param options [Array] filters to be applied to the HTTP requests.
103
+ #
104
+ def initialize(credentials = nil, base_url = nil, options = nil)
105
+ super(credentials, options)
106
+ @base_url = base_url || 'https://management.azure.com'
107
+
108
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
109
+ @credentials = credentials
110
+
111
+ @data_exports = DataExports.new(self)
112
+ @data_sources = DataSources.new(self)
113
+ @intelligence_packs = IntelligencePacks.new(self)
114
+ @linked_services = LinkedServices.new(self)
115
+ @linked_storage_accounts = LinkedStorageAccounts.new(self)
116
+ @management_groups = ManagementGroups.new(self)
117
+ @operations = Operations.new(self)
118
+ @operation_statuses = OperationStatuses.new(self)
119
+ @shared_keys_operations = SharedKeysOperations.new(self)
120
+ @usages = Usages.new(self)
121
+ @workspaces = Workspaces.new(self)
122
+ @deleted_workspaces = DeletedWorkspaces.new(self)
123
+ @clusters = Clusters.new(self)
124
+ @storage_insight_configs = StorageInsightConfigs.new(self)
125
+ @saved_searches = SavedSearches.new(self)
126
+ @available_service_tiers = AvailableServiceTiers.new(self)
127
+ @gateways = Gateways.new(self)
128
+ @schema = Schema.new(self)
129
+ @workspace_purge = WorkspacePurge.new(self)
130
+ @tables = Tables.new(self)
131
+ @api_version = '2020-08-01'
132
+ @accept_language = 'en-US'
133
+ @long_running_operation_retry_timeout = 30
134
+ @generate_client_request_id = true
135
+ add_telemetry
136
+ end
137
+
138
+ #
139
+ # Makes a request and returns the body of the response.
140
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
141
+ # @param path [String] the path, relative to {base_url}.
142
+ # @param options [Hash{String=>String}] specifying any request options like :body.
143
+ # @return [Hash{String=>String}] containing the body of the response.
144
+ # Example:
145
+ #
146
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
147
+ # path = "/path"
148
+ # options = {
149
+ # body: request_content,
150
+ # query_params: {'api-version' => '2016-02-01'}
151
+ # }
152
+ # result = @client.make_request(:put, path, options)
153
+ #
154
+ def make_request(method, path, options = {})
155
+ result = make_request_with_http_info(method, path, options)
156
+ result.body unless result.nil?
157
+ end
158
+
159
+ #
160
+ # Makes a request and returns the operation response.
161
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
162
+ # @param path [String] the path, relative to {base_url}.
163
+ # @param options [Hash{String=>String}] specifying any request options like :body.
164
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
165
+ #
166
+ def make_request_with_http_info(method, path, options = {})
167
+ result = make_request_async(method, path, options).value!
168
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
169
+ result
170
+ end
171
+
172
+ #
173
+ # Makes a request asynchronously.
174
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
175
+ # @param path [String] the path, relative to {base_url}.
176
+ # @param options [Hash{String=>String}] specifying any request options like :body.
177
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
178
+ #
179
+ def make_request_async(method, path, options = {})
180
+ fail ArgumentError, 'method is nil' if method.nil?
181
+ fail ArgumentError, 'path is nil' if path.nil?
182
+
183
+ request_url = options[:base_url] || @base_url
184
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
185
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
186
+ end
187
+
188
+ request_headers = @request_headers
189
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
190
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
191
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
192
+
193
+ super(request_url, method, path, options)
194
+ end
195
+
196
+
197
+ private
198
+ #
199
+ # Adds telemetry information.
200
+ #
201
+ def add_telemetry
202
+ sdk_information = 'azure_mgmt_operational_insights'
203
+ sdk_information = "#{sdk_information}/0.19.2"
204
+ add_user_agent_information(sdk_information)
205
+ end
206
+ end
207
+ end
@@ -0,0 +1,220 @@
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 Operations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Operations 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
+ # Lists all of the available OperationalInsights Rest API operations.
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 [Array<Operation>] operation results.
31
+ #
32
+ def list(custom_headers:nil)
33
+ first_page = list_as_lazy(custom_headers:custom_headers)
34
+ first_page.get_all_items
35
+ end
36
+
37
+ #
38
+ # Lists all of the available OperationalInsights Rest API operations.
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
+ # Lists all of the available OperationalInsights Rest API operations.
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
+
61
+
62
+ request_headers = {}
63
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
64
+
65
+ # Set Headers
66
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
67
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
68
+ path_template = 'providers/Microsoft.OperationalInsights/operations'
69
+
70
+ request_url = @base_url || @client.base_url
71
+
72
+ options = {
73
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
74
+ query_params: {'api-version' => @client.api_version},
75
+ headers: request_headers.merge(custom_headers || {}),
76
+ base_url: request_url
77
+ }
78
+ promise = @client.make_request_async(:get, path_template, options)
79
+
80
+ promise = promise.then do |result|
81
+ http_response = result.response
82
+ status_code = http_response.status
83
+ response_content = http_response.body
84
+ unless status_code == 200
85
+ error_model = JSON.load(response_content)
86
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
87
+ end
88
+
89
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
90
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
91
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
92
+ # Deserialize Response
93
+ if status_code == 200
94
+ begin
95
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
96
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::OperationListResult.mapper()
97
+ result.body = @client.deserialize(result_mapper, parsed_response)
98
+ rescue Exception => e
99
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
100
+ end
101
+ end
102
+
103
+ result
104
+ end
105
+
106
+ promise.execute
107
+ end
108
+
109
+ #
110
+ # Lists all of the available OperationalInsights Rest API operations.
111
+ #
112
+ # @param next_page_link [String] The NextLink from the previous successful call
113
+ # to List operation.
114
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
115
+ # will be added to the HTTP request.
116
+ #
117
+ # @return [OperationListResult] operation results.
118
+ #
119
+ def list_next(next_page_link, custom_headers:nil)
120
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
121
+ response.body unless response.nil?
122
+ end
123
+
124
+ #
125
+ # Lists all of the available OperationalInsights Rest API operations.
126
+ #
127
+ # @param next_page_link [String] The NextLink from the previous successful call
128
+ # to List operation.
129
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
130
+ # will be added to the HTTP request.
131
+ #
132
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
133
+ #
134
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
135
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
136
+ end
137
+
138
+ #
139
+ # Lists all of the available OperationalInsights Rest API operations.
140
+ #
141
+ # @param next_page_link [String] The NextLink from the previous successful call
142
+ # to List operation.
143
+ # @param [Hash{String => String}] A hash of custom headers that will be added
144
+ # to the HTTP request.
145
+ #
146
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
147
+ #
148
+ def list_next_async(next_page_link, custom_headers:nil)
149
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
150
+
151
+
152
+ request_headers = {}
153
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
154
+
155
+ # Set Headers
156
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
157
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
158
+ path_template = '{nextLink}'
159
+
160
+ request_url = @base_url || @client.base_url
161
+
162
+ options = {
163
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
164
+ skip_encoding_path_params: {'nextLink' => next_page_link},
165
+ headers: request_headers.merge(custom_headers || {}),
166
+ base_url: request_url
167
+ }
168
+ promise = @client.make_request_async(:get, path_template, options)
169
+
170
+ promise = promise.then do |result|
171
+ http_response = result.response
172
+ status_code = http_response.status
173
+ response_content = http_response.body
174
+ unless status_code == 200
175
+ error_model = JSON.load(response_content)
176
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
177
+ end
178
+
179
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
180
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
181
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
182
+ # Deserialize Response
183
+ if status_code == 200
184
+ begin
185
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
186
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::OperationListResult.mapper()
187
+ result.body = @client.deserialize(result_mapper, parsed_response)
188
+ rescue Exception => e
189
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
190
+ end
191
+ end
192
+
193
+ result
194
+ end
195
+
196
+ promise.execute
197
+ end
198
+
199
+ #
200
+ # Lists all of the available OperationalInsights Rest API operations.
201
+ #
202
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
203
+ # will be added to the HTTP request.
204
+ #
205
+ # @return [OperationListResult] which provide lazy access to pages of the
206
+ # response.
207
+ #
208
+ def list_as_lazy(custom_headers:nil)
209
+ response = list_async(custom_headers:custom_headers).value!
210
+ unless response.nil?
211
+ page = response.body
212
+ page.next_method = Proc.new do |next_page_link|
213
+ list_next_async(next_page_link, custom_headers:custom_headers)
214
+ end
215
+ page
216
+ end
217
+ end
218
+
219
+ end
220
+ end
@@ -0,0 +1,457 @@
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 SavedSearches
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the SavedSearches 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
+ # Deletes the specified saved search in a given 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 saved_search_id [String] The id of the saved search.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ #
35
+ def delete(resource_group_name, workspace_name, saved_search_id, custom_headers:nil)
36
+ response = delete_async(resource_group_name, workspace_name, saved_search_id, custom_headers:custom_headers).value!
37
+ nil
38
+ end
39
+
40
+ #
41
+ # Deletes the specified saved search in a given 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 saved_search_id [String] The id of the saved search.
47
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
+ # will be added to the HTTP request.
49
+ #
50
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
51
+ #
52
+ def delete_with_http_info(resource_group_name, workspace_name, saved_search_id, custom_headers:nil)
53
+ delete_async(resource_group_name, workspace_name, saved_search_id, custom_headers:custom_headers).value!
54
+ end
55
+
56
+ #
57
+ # Deletes the specified saved search in a given workspace.
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 saved_search_id [String] The id of the saved search.
63
+ # @param [Hash{String => String}] A hash of custom headers that will be added
64
+ # to the HTTP request.
65
+ #
66
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
67
+ #
68
+ def delete_async(resource_group_name, workspace_name, saved_search_id, custom_headers:nil)
69
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
70
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
71
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
72
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
73
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
74
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
75
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
76
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
77
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
78
+ 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?
79
+ fail ArgumentError, 'saved_search_id is nil' if saved_search_id.nil?
80
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
81
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
82
+
83
+
84
+ request_headers = {}
85
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
86
+
87
+ # Set Headers
88
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
89
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
90
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchId}'
91
+
92
+ request_url = @base_url || @client.base_url
93
+
94
+ options = {
95
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
96
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'savedSearchId' => saved_search_id},
97
+ query_params: {'api-version' => @client.api_version},
98
+ headers: request_headers.merge(custom_headers || {}),
99
+ base_url: request_url
100
+ }
101
+ promise = @client.make_request_async(:delete, path_template, options)
102
+
103
+ promise = promise.then do |result|
104
+ http_response = result.response
105
+ status_code = http_response.status
106
+ response_content = http_response.body
107
+ unless status_code == 200
108
+ error_model = JSON.load(response_content)
109
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
110
+ end
111
+
112
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
113
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
114
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
115
+
116
+ result
117
+ end
118
+
119
+ promise.execute
120
+ end
121
+
122
+ #
123
+ # Creates or updates a saved search for a given workspace.
124
+ #
125
+ # @param resource_group_name [String] The name of the resource group. The name
126
+ # is case insensitive.
127
+ # @param workspace_name [String] The name of the workspace.
128
+ # @param saved_search_id [String] The id of the saved search.
129
+ # @param parameters [SavedSearch] The parameters required to save a search.
130
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
131
+ # will be added to the HTTP request.
132
+ #
133
+ # @return [SavedSearch] operation results.
134
+ #
135
+ def create_or_update(resource_group_name, workspace_name, saved_search_id, parameters, custom_headers:nil)
136
+ response = create_or_update_async(resource_group_name, workspace_name, saved_search_id, parameters, custom_headers:custom_headers).value!
137
+ response.body unless response.nil?
138
+ end
139
+
140
+ #
141
+ # Creates or updates a saved search for a given workspace.
142
+ #
143
+ # @param resource_group_name [String] The name of the resource group. The name
144
+ # is case insensitive.
145
+ # @param workspace_name [String] The name of the workspace.
146
+ # @param saved_search_id [String] The id of the saved search.
147
+ # @param parameters [SavedSearch] The parameters required to save a search.
148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
149
+ # will be added to the HTTP request.
150
+ #
151
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
152
+ #
153
+ def create_or_update_with_http_info(resource_group_name, workspace_name, saved_search_id, parameters, custom_headers:nil)
154
+ create_or_update_async(resource_group_name, workspace_name, saved_search_id, parameters, custom_headers:custom_headers).value!
155
+ end
156
+
157
+ #
158
+ # Creates or updates a saved search for a given workspace.
159
+ #
160
+ # @param resource_group_name [String] The name of the resource group. The name
161
+ # is case insensitive.
162
+ # @param workspace_name [String] The name of the workspace.
163
+ # @param saved_search_id [String] The id of the saved search.
164
+ # @param parameters [SavedSearch] The parameters required to save a search.
165
+ # @param [Hash{String => String}] A hash of custom headers that will be added
166
+ # to the HTTP request.
167
+ #
168
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
169
+ #
170
+ def create_or_update_async(resource_group_name, workspace_name, saved_search_id, parameters, custom_headers:nil)
171
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
172
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
173
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
174
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
175
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
176
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
177
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
178
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
179
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
180
+ 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?
181
+ fail ArgumentError, 'saved_search_id is nil' if saved_search_id.nil?
182
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
183
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
184
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
185
+
186
+
187
+ request_headers = {}
188
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
189
+
190
+ # Set Headers
191
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
192
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
193
+
194
+ # Serialize Request
195
+ request_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::SavedSearch.mapper()
196
+ request_content = @client.serialize(request_mapper, parameters)
197
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
198
+
199
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchId}'
200
+
201
+ request_url = @base_url || @client.base_url
202
+
203
+ options = {
204
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
205
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'savedSearchId' => saved_search_id},
206
+ query_params: {'api-version' => @client.api_version},
207
+ body: request_content,
208
+ headers: request_headers.merge(custom_headers || {}),
209
+ base_url: request_url
210
+ }
211
+ promise = @client.make_request_async(:put, path_template, options)
212
+
213
+ promise = promise.then do |result|
214
+ http_response = result.response
215
+ status_code = http_response.status
216
+ response_content = http_response.body
217
+ unless status_code == 200
218
+ error_model = JSON.load(response_content)
219
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
220
+ end
221
+
222
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
223
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
224
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
225
+ # Deserialize Response
226
+ if status_code == 200
227
+ begin
228
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
229
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::SavedSearch.mapper()
230
+ result.body = @client.deserialize(result_mapper, parsed_response)
231
+ rescue Exception => e
232
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
233
+ end
234
+ end
235
+
236
+ result
237
+ end
238
+
239
+ promise.execute
240
+ end
241
+
242
+ #
243
+ # Gets the specified saved search for a given workspace.
244
+ #
245
+ # @param resource_group_name [String] The name of the resource group. The name
246
+ # is case insensitive.
247
+ # @param workspace_name [String] The name of the workspace.
248
+ # @param saved_search_id [String] The id of the saved search.
249
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
250
+ # will be added to the HTTP request.
251
+ #
252
+ # @return [SavedSearch] operation results.
253
+ #
254
+ def get(resource_group_name, workspace_name, saved_search_id, custom_headers:nil)
255
+ response = get_async(resource_group_name, workspace_name, saved_search_id, custom_headers:custom_headers).value!
256
+ response.body unless response.nil?
257
+ end
258
+
259
+ #
260
+ # Gets the specified saved search for a given workspace.
261
+ #
262
+ # @param resource_group_name [String] The name of the resource group. The name
263
+ # is case insensitive.
264
+ # @param workspace_name [String] The name of the workspace.
265
+ # @param saved_search_id [String] The id of the saved search.
266
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
267
+ # will be added to the HTTP request.
268
+ #
269
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
270
+ #
271
+ def get_with_http_info(resource_group_name, workspace_name, saved_search_id, custom_headers:nil)
272
+ get_async(resource_group_name, workspace_name, saved_search_id, custom_headers:custom_headers).value!
273
+ end
274
+
275
+ #
276
+ # Gets the specified saved search for a given workspace.
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 saved_search_id [String] The id of the saved search.
282
+ # @param [Hash{String => String}] A hash of custom headers that will be added
283
+ # to the HTTP request.
284
+ #
285
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
286
+ #
287
+ def get_async(resource_group_name, workspace_name, saved_search_id, custom_headers:nil)
288
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
289
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
290
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
291
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
292
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
293
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
294
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
295
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
296
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
297
+ 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?
298
+ fail ArgumentError, 'saved_search_id is nil' if saved_search_id.nil?
299
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
300
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
301
+
302
+
303
+ request_headers = {}
304
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
305
+
306
+ # Set Headers
307
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
308
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
309
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchId}'
310
+
311
+ request_url = @base_url || @client.base_url
312
+
313
+ options = {
314
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
315
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'savedSearchId' => saved_search_id},
316
+ query_params: {'api-version' => @client.api_version},
317
+ headers: request_headers.merge(custom_headers || {}),
318
+ base_url: request_url
319
+ }
320
+ promise = @client.make_request_async(:get, path_template, options)
321
+
322
+ promise = promise.then do |result|
323
+ http_response = result.response
324
+ status_code = http_response.status
325
+ response_content = http_response.body
326
+ unless status_code == 200
327
+ error_model = JSON.load(response_content)
328
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
329
+ end
330
+
331
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
332
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
333
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
334
+ # Deserialize Response
335
+ if status_code == 200
336
+ begin
337
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
338
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::SavedSearch.mapper()
339
+ result.body = @client.deserialize(result_mapper, parsed_response)
340
+ rescue Exception => e
341
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
342
+ end
343
+ end
344
+
345
+ result
346
+ end
347
+
348
+ promise.execute
349
+ end
350
+
351
+ #
352
+ # Gets the saved searches for a given Log Analytics Workspace
353
+ #
354
+ # @param resource_group_name [String] The name of the resource group. The name
355
+ # is case insensitive.
356
+ # @param workspace_name [String] The name of the workspace.
357
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
358
+ # will be added to the HTTP request.
359
+ #
360
+ # @return [SavedSearchesListResult] operation results.
361
+ #
362
+ def list_by_workspace(resource_group_name, workspace_name, custom_headers:nil)
363
+ response = list_by_workspace_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
364
+ response.body unless response.nil?
365
+ end
366
+
367
+ #
368
+ # Gets the saved searches for a given Log Analytics Workspace
369
+ #
370
+ # @param resource_group_name [String] The name of the resource group. The name
371
+ # is case insensitive.
372
+ # @param workspace_name [String] The name of the workspace.
373
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
374
+ # will be added to the HTTP request.
375
+ #
376
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
377
+ #
378
+ def list_by_workspace_with_http_info(resource_group_name, workspace_name, custom_headers:nil)
379
+ list_by_workspace_async(resource_group_name, workspace_name, custom_headers:custom_headers).value!
380
+ end
381
+
382
+ #
383
+ # Gets the saved searches for a given Log Analytics Workspace
384
+ #
385
+ # @param resource_group_name [String] The name of the resource group. The name
386
+ # is case insensitive.
387
+ # @param workspace_name [String] The name of the workspace.
388
+ # @param [Hash{String => String}] A hash of custom headers that will be added
389
+ # to the HTTP request.
390
+ #
391
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
392
+ #
393
+ def list_by_workspace_async(resource_group_name, workspace_name, custom_headers:nil)
394
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
395
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
396
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
397
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
398
+ fail ArgumentError, 'workspace_name is nil' if workspace_name.nil?
399
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MaxLength': '63'" if !workspace_name.nil? && workspace_name.length > 63
400
+ fail ArgumentError, "'workspace_name' should satisfy the constraint - 'MinLength': '4'" if !workspace_name.nil? && workspace_name.length < 4
401
+ 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?
402
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
403
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
404
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
405
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
406
+
407
+
408
+ request_headers = {}
409
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
410
+
411
+ # Set Headers
412
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
413
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
414
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches'
415
+
416
+ request_url = @base_url || @client.base_url
417
+
418
+ options = {
419
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
420
+ path_params: {'resourceGroupName' => resource_group_name,'workspaceName' => workspace_name,'subscriptionId' => @client.subscription_id},
421
+ query_params: {'api-version' => @client.api_version},
422
+ headers: request_headers.merge(custom_headers || {}),
423
+ base_url: request_url
424
+ }
425
+ promise = @client.make_request_async(:get, path_template, options)
426
+
427
+ promise = promise.then do |result|
428
+ http_response = result.response
429
+ status_code = http_response.status
430
+ response_content = http_response.body
431
+ unless status_code == 200
432
+ error_model = JSON.load(response_content)
433
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
434
+ end
435
+
436
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
437
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
438
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
439
+ # Deserialize Response
440
+ if status_code == 200
441
+ begin
442
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
443
+ result_mapper = Azure::OperationalInsights::Mgmt::V2020_08_01::Models::SavedSearchesListResult.mapper()
444
+ result.body = @client.deserialize(result_mapper, parsed_response)
445
+ rescue Exception => e
446
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
447
+ end
448
+ end
449
+
450
+ result
451
+ end
452
+
453
+ promise.execute
454
+ end
455
+
456
+ end
457
+ end