1package operationalinsights
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"encoding/json"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24	"github.com/Azure/go-autorest/autorest/date"
25	"github.com/Azure/go-autorest/autorest/to"
26	"net/http"
27)
28
29// PurgeState enumerates the values for purge state.
30type PurgeState string
31
32const (
33	// Completed ...
34	Completed PurgeState = "Completed"
35	// Pending ...
36	Pending PurgeState = "Pending"
37)
38
39// PossiblePurgeStateValues returns an array of possible values for the PurgeState const type.
40func PossiblePurgeStateValues() []PurgeState {
41	return []PurgeState{Completed, Pending}
42}
43
44// SearchSortEnum enumerates the values for search sort enum.
45type SearchSortEnum string
46
47const (
48	// Asc ...
49	Asc SearchSortEnum = "asc"
50	// Desc ...
51	Desc SearchSortEnum = "desc"
52)
53
54// PossibleSearchSortEnumValues returns an array of possible values for the SearchSortEnum const type.
55func PossibleSearchSortEnumValues() []SearchSortEnum {
56	return []SearchSortEnum{Asc, Desc}
57}
58
59// StorageInsightState enumerates the values for storage insight state.
60type StorageInsightState string
61
62const (
63	// ERROR ...
64	ERROR StorageInsightState = "ERROR"
65	// OK ...
66	OK StorageInsightState = "OK"
67)
68
69// PossibleStorageInsightStateValues returns an array of possible values for the StorageInsightState const type.
70func PossibleStorageInsightStateValues() []StorageInsightState {
71	return []StorageInsightState{ERROR, OK}
72}
73
74// CoreSummary the core summary of a search.
75type CoreSummary struct {
76	// Status - The status of a core summary.
77	Status *string `json:"status,omitempty"`
78	// NumberOfDocuments - The number of documents of a core summary.
79	NumberOfDocuments *int64 `json:"numberOfDocuments,omitempty"`
80}
81
82// LinkTarget metadata for a workspace that isn't linked to an Azure subscription.
83type LinkTarget struct {
84	// CustomerID - The GUID that uniquely identifies the workspace.
85	CustomerID *string `json:"customerId,omitempty"`
86	// DisplayName - The display name of the workspace.
87	DisplayName *string `json:"accountName,omitempty"`
88	// WorkspaceName - The DNS valid workspace name.
89	WorkspaceName *string `json:"workspaceName,omitempty"`
90	// Location - The location of the workspace.
91	Location *string `json:"location,omitempty"`
92}
93
94// ListLinkTarget ...
95type ListLinkTarget struct {
96	autorest.Response `json:"-"`
97	Value             *[]LinkTarget `json:"value,omitempty"`
98}
99
100// Operation supported operation of OperationsManagement resource provider.
101type Operation struct {
102	// Name - Operation name: {provider}/{resource}/{operation}
103	Name *string `json:"name,omitempty"`
104	// Display - Display metadata associated with the operation.
105	Display *OperationDisplay `json:"display,omitempty"`
106}
107
108// OperationDisplay display metadata associated with the operation.
109type OperationDisplay struct {
110	// Provider - Service provider: Microsoft OperationsManagement.
111	Provider *string `json:"provider,omitempty"`
112	// Resource - Resource on which the operation is performed etc.
113	Resource *string `json:"resource,omitempty"`
114	// Operation - Type of operation: get, read, delete, etc.
115	Operation *string `json:"operation,omitempty"`
116}
117
118// OperationListResult result of the request to list solution operations.
119type OperationListResult struct {
120	autorest.Response `json:"-"`
121	// Value - List of solution operations supported by the OperationsManagement resource provider.
122	Value *[]Operation `json:"value,omitempty"`
123}
124
125// ProxyResource common properties of proxy resource.
126type ProxyResource struct {
127	// ID - Resource ID.
128	ID *string `json:"id,omitempty"`
129	// Name - Resource name.
130	Name *string `json:"name,omitempty"`
131	// Type - Resource type.
132	Type *string `json:"type,omitempty"`
133	// Tags - Resource tags
134	Tags map[string]*string `json:"tags"`
135}
136
137// MarshalJSON is the custom marshaler for ProxyResource.
138func (pr ProxyResource) MarshalJSON() ([]byte, error) {
139	objectMap := make(map[string]interface{})
140	if pr.ID != nil {
141		objectMap["id"] = pr.ID
142	}
143	if pr.Name != nil {
144		objectMap["name"] = pr.Name
145	}
146	if pr.Type != nil {
147		objectMap["type"] = pr.Type
148	}
149	if pr.Tags != nil {
150		objectMap["tags"] = pr.Tags
151	}
152	return json.Marshal(objectMap)
153}
154
155// Resource the resource definition.
156type Resource struct {
157	// ID - Resource Id
158	ID *string `json:"id,omitempty"`
159	// Name - Resource name
160	Name *string `json:"name,omitempty"`
161	// Type - Resource type
162	Type *string `json:"type,omitempty"`
163	// Location - Resource location
164	Location *string `json:"location,omitempty"`
165	// Tags - Resource tags
166	Tags map[string]*string `json:"tags"`
167}
168
169// MarshalJSON is the custom marshaler for Resource.
170func (r Resource) MarshalJSON() ([]byte, error) {
171	objectMap := make(map[string]interface{})
172	if r.ID != nil {
173		objectMap["id"] = r.ID
174	}
175	if r.Name != nil {
176		objectMap["name"] = r.Name
177	}
178	if r.Type != nil {
179		objectMap["type"] = r.Type
180	}
181	if r.Location != nil {
182		objectMap["location"] = r.Location
183	}
184	if r.Tags != nil {
185		objectMap["tags"] = r.Tags
186	}
187	return json.Marshal(objectMap)
188}
189
190// SavedSearch value object for saved search results.
191type SavedSearch struct {
192	autorest.Response `json:"-"`
193	// ID - The id of the saved search.
194	ID *string `json:"id,omitempty"`
195	// Name - The name of the saved search.
196	Name *string `json:"name,omitempty"`
197	// Type - The type of the saved search.
198	Type *string `json:"type,omitempty"`
199	// ETag - The etag of the saved search.
200	ETag *string `json:"eTag,omitempty"`
201	// SavedSearchProperties - Gets or sets properties of the saved search.
202	*SavedSearchProperties `json:"properties,omitempty"`
203}
204
205// MarshalJSON is the custom marshaler for SavedSearch.
206func (ss SavedSearch) MarshalJSON() ([]byte, error) {
207	objectMap := make(map[string]interface{})
208	if ss.ID != nil {
209		objectMap["id"] = ss.ID
210	}
211	if ss.Name != nil {
212		objectMap["name"] = ss.Name
213	}
214	if ss.Type != nil {
215		objectMap["type"] = ss.Type
216	}
217	if ss.ETag != nil {
218		objectMap["eTag"] = ss.ETag
219	}
220	if ss.SavedSearchProperties != nil {
221		objectMap["properties"] = ss.SavedSearchProperties
222	}
223	return json.Marshal(objectMap)
224}
225
226// UnmarshalJSON is the custom unmarshaler for SavedSearch struct.
227func (ss *SavedSearch) UnmarshalJSON(body []byte) error {
228	var m map[string]*json.RawMessage
229	err := json.Unmarshal(body, &m)
230	if err != nil {
231		return err
232	}
233	for k, v := range m {
234		switch k {
235		case "id":
236			if v != nil {
237				var ID string
238				err = json.Unmarshal(*v, &ID)
239				if err != nil {
240					return err
241				}
242				ss.ID = &ID
243			}
244		case "name":
245			if v != nil {
246				var name string
247				err = json.Unmarshal(*v, &name)
248				if err != nil {
249					return err
250				}
251				ss.Name = &name
252			}
253		case "type":
254			if v != nil {
255				var typeVar string
256				err = json.Unmarshal(*v, &typeVar)
257				if err != nil {
258					return err
259				}
260				ss.Type = &typeVar
261			}
262		case "eTag":
263			if v != nil {
264				var eTag string
265				err = json.Unmarshal(*v, &eTag)
266				if err != nil {
267					return err
268				}
269				ss.ETag = &eTag
270			}
271		case "properties":
272			if v != nil {
273				var savedSearchProperties SavedSearchProperties
274				err = json.Unmarshal(*v, &savedSearchProperties)
275				if err != nil {
276					return err
277				}
278				ss.SavedSearchProperties = &savedSearchProperties
279			}
280		}
281	}
282
283	return nil
284}
285
286// SavedSearchesListResult the saved search operation response.
287type SavedSearchesListResult struct {
288	autorest.Response `json:"-"`
289	// Metadata - The metadata from search results.
290	Metadata *SearchMetadata `json:"metaData,omitempty"`
291	// Value - The array of result values.
292	Value *[]SavedSearch `json:"value,omitempty"`
293}
294
295// SavedSearchProperties value object for saved search results.
296type SavedSearchProperties struct {
297	// Category - The category of the saved search. This helps the user to find a saved search faster.
298	Category *string `json:"category,omitempty"`
299	// DisplayName - Saved search display name.
300	DisplayName *string `json:"displayName,omitempty"`
301	// Query - The query expression for the saved search. Please see https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-search-reference for reference.
302	Query *string `json:"query,omitempty"`
303	// Version - The version number of the query lanuage. Only verion 1 is allowed here.
304	Version *int64 `json:"version,omitempty"`
305	// Tags - The tags attached to the saved search.
306	Tags *[]Tag `json:"tags,omitempty"`
307}
308
309// SearchError details for a search error.
310type SearchError struct {
311	// Type - The error type.
312	Type *string `json:"type,omitempty"`
313	// Message - The error message.
314	Message *string `json:"message,omitempty"`
315}
316
317// SearchGetSchemaResponse the get schema operation response.
318type SearchGetSchemaResponse struct {
319	autorest.Response `json:"-"`
320	// Metadata - The metadata from search results.
321	Metadata *SearchMetadata `json:"metadata,omitempty"`
322	// Value - The array of result values.
323	Value *[]SearchSchemaValue `json:"value,omitempty"`
324}
325
326// SearchHighlight highlight details.
327type SearchHighlight struct {
328	// Pre - The string that is put before a matched result.
329	Pre *string `json:"pre,omitempty"`
330	// Post - The string that is put after a matched result.
331	Post *string `json:"post,omitempty"`
332}
333
334// SearchMetadata metadata for search results.
335type SearchMetadata struct {
336	// SearchID - The request id of the search.
337	SearchID *string `json:"requestId,omitempty"`
338	// ResultType - The search result type.
339	ResultType *string `json:"resultType,omitempty"`
340	// Total - The total number of search results.
341	Total *int64 `json:"total,omitempty"`
342	// Top - The number of top search results.
343	Top *int64 `json:"top,omitempty"`
344	// ID - The id of the search results request.
345	ID *string `json:"id,omitempty"`
346	// CoreSummaries - The core summaries.
347	CoreSummaries *[]CoreSummary `json:"coreSummaries,omitempty"`
348	// Status - The status of the search results.
349	Status *string `json:"status,omitempty"`
350	// StartTime - The start time for the search.
351	StartTime *date.Time `json:"startTime,omitempty"`
352	// LastUpdated - The time of last update.
353	LastUpdated *date.Time `json:"lastUpdated,omitempty"`
354	// ETag - The ETag of the search results.
355	ETag *string `json:"eTag,omitempty"`
356	// Sort - How the results are sorted.
357	Sort *[]SearchSort `json:"sort,omitempty"`
358	// RequestTime - The request time.
359	RequestTime *int64 `json:"requestTime,omitempty"`
360	// AggregatedValueField - The aggregated value field.
361	AggregatedValueField *string `json:"aggregatedValueField,omitempty"`
362	// AggregatedGroupingFields - The aggregated grouping fields.
363	AggregatedGroupingFields *string `json:"aggregatedGroupingFields,omitempty"`
364	// Sum - The sum of all aggregates returned in the result set.
365	Sum *int64 `json:"sum,omitempty"`
366	// Max - The max of all aggregates returned in the result set.
367	Max *int64 `json:"max,omitempty"`
368	// Schema - The schema.
369	Schema *SearchMetadataSchema `json:"schema,omitempty"`
370}
371
372// SearchMetadataSchema schema metadata for search.
373type SearchMetadataSchema struct {
374	// Name - The name of the metadata schema.
375	Name *string `json:"name,omitempty"`
376	// Version - The version of the metadata schema.
377	Version *int32 `json:"version,omitempty"`
378}
379
380// SearchParameters parameters specifying the search query and range.
381type SearchParameters struct {
382	// Top - The number to get from the top.
383	Top *int64 `json:"top,omitempty"`
384	// Highlight - The highlight that looks for all occurences of a string.
385	Highlight *SearchHighlight `json:"highlight,omitempty"`
386	// Query - The query to search.
387	Query *string `json:"query,omitempty"`
388	// Start - The start date filter, so the only query results returned are after this date.
389	Start *date.Time `json:"start,omitempty"`
390	// End - The end date filter, so the only query results returned are before this date.
391	End *date.Time `json:"end,omitempty"`
392}
393
394// SearchResultsResponse the get search result operation response.
395type SearchResultsResponse struct {
396	autorest.Response `json:"-"`
397	// ID - The id of the search, which includes the full url.
398	ID *string `json:"id,omitempty"`
399	// Metadata - The metadata from search results.
400	Metadata *SearchMetadata `json:"metaData,omitempty"`
401	// Value - The array of result values.
402	Value *[]interface{} `json:"value,omitempty"`
403	// Error - The error.
404	Error *SearchError `json:"error,omitempty"`
405}
406
407// SearchSchemaValue value object for schema results.
408type SearchSchemaValue struct {
409	// Name - The name of the schema.
410	Name *string `json:"name,omitempty"`
411	// DisplayName - The display name of the schema.
412	DisplayName *string `json:"displayName,omitempty"`
413	// Type - The type.
414	Type *string `json:"type,omitempty"`
415	// Indexed - The boolean that indicates the field is searchable as free text.
416	Indexed *bool `json:"indexed,omitempty"`
417	// Stored - The boolean that indicates whether or not the field is stored.
418	Stored *bool `json:"stored,omitempty"`
419	// Facet - The boolean that indicates whether or not the field is a facet.
420	Facet *bool `json:"facet,omitempty"`
421	// OwnerType - The array of workflows containing the field.
422	OwnerType *[]string `json:"ownerType,omitempty"`
423}
424
425// SearchSort the sort parameters for search.
426type SearchSort struct {
427	// Name - The name of the field the search query is sorted on.
428	Name *string `json:"name,omitempty"`
429	// Order - The sort order of the search. Possible values include: 'Asc', 'Desc'
430	Order SearchSortEnum `json:"order,omitempty"`
431}
432
433// SetObject ...
434type SetObject struct {
435	autorest.Response `json:"-"`
436	Value             interface{} `json:"value,omitempty"`
437}
438
439// StorageAccount describes a storage account connection.
440type StorageAccount struct {
441	// ID - The Azure Resource Manager ID of the storage account resource.
442	ID *string `json:"id,omitempty"`
443	// Key - The storage account key.
444	Key *string `json:"key,omitempty"`
445}
446
447// StorageInsight the top level storage insight resource container.
448type StorageInsight struct {
449	autorest.Response `json:"-"`
450	// StorageInsightProperties - Storage insight properties.
451	*StorageInsightProperties `json:"properties,omitempty"`
452	// ETag - The ETag of the storage insight.
453	ETag *string `json:"eTag,omitempty"`
454	// ID - Resource ID.
455	ID *string `json:"id,omitempty"`
456	// Name - Resource name.
457	Name *string `json:"name,omitempty"`
458	// Type - Resource type.
459	Type *string `json:"type,omitempty"`
460	// Tags - Resource tags
461	Tags map[string]*string `json:"tags"`
462}
463
464// MarshalJSON is the custom marshaler for StorageInsight.
465func (si StorageInsight) MarshalJSON() ([]byte, error) {
466	objectMap := make(map[string]interface{})
467	if si.StorageInsightProperties != nil {
468		objectMap["properties"] = si.StorageInsightProperties
469	}
470	if si.ETag != nil {
471		objectMap["eTag"] = si.ETag
472	}
473	if si.ID != nil {
474		objectMap["id"] = si.ID
475	}
476	if si.Name != nil {
477		objectMap["name"] = si.Name
478	}
479	if si.Type != nil {
480		objectMap["type"] = si.Type
481	}
482	if si.Tags != nil {
483		objectMap["tags"] = si.Tags
484	}
485	return json.Marshal(objectMap)
486}
487
488// UnmarshalJSON is the custom unmarshaler for StorageInsight struct.
489func (si *StorageInsight) UnmarshalJSON(body []byte) error {
490	var m map[string]*json.RawMessage
491	err := json.Unmarshal(body, &m)
492	if err != nil {
493		return err
494	}
495	for k, v := range m {
496		switch k {
497		case "properties":
498			if v != nil {
499				var storageInsightProperties StorageInsightProperties
500				err = json.Unmarshal(*v, &storageInsightProperties)
501				if err != nil {
502					return err
503				}
504				si.StorageInsightProperties = &storageInsightProperties
505			}
506		case "eTag":
507			if v != nil {
508				var eTag string
509				err = json.Unmarshal(*v, &eTag)
510				if err != nil {
511					return err
512				}
513				si.ETag = &eTag
514			}
515		case "id":
516			if v != nil {
517				var ID string
518				err = json.Unmarshal(*v, &ID)
519				if err != nil {
520					return err
521				}
522				si.ID = &ID
523			}
524		case "name":
525			if v != nil {
526				var name string
527				err = json.Unmarshal(*v, &name)
528				if err != nil {
529					return err
530				}
531				si.Name = &name
532			}
533		case "type":
534			if v != nil {
535				var typeVar string
536				err = json.Unmarshal(*v, &typeVar)
537				if err != nil {
538					return err
539				}
540				si.Type = &typeVar
541			}
542		case "tags":
543			if v != nil {
544				var tags map[string]*string
545				err = json.Unmarshal(*v, &tags)
546				if err != nil {
547					return err
548				}
549				si.Tags = tags
550			}
551		}
552	}
553
554	return nil
555}
556
557// StorageInsightListResult the list storage insights operation response.
558type StorageInsightListResult struct {
559	autorest.Response `json:"-"`
560	// Value - Gets or sets a list of storage insight instances.
561	Value *[]StorageInsight `json:"value,omitempty"`
562	// OdataNextLink - The link (url) to the next page of results.
563	OdataNextLink *string `json:"@odata.nextLink,omitempty"`
564}
565
566// StorageInsightListResultIterator provides access to a complete listing of StorageInsight values.
567type StorageInsightListResultIterator struct {
568	i    int
569	page StorageInsightListResultPage
570}
571
572// Next advances to the next value.  If there was an error making
573// the request the iterator does not advance and the error is returned.
574func (iter *StorageInsightListResultIterator) Next() error {
575	iter.i++
576	if iter.i < len(iter.page.Values()) {
577		return nil
578	}
579	err := iter.page.Next()
580	if err != nil {
581		iter.i--
582		return err
583	}
584	iter.i = 0
585	return nil
586}
587
588// NotDone returns true if the enumeration should be started or is not yet complete.
589func (iter StorageInsightListResultIterator) NotDone() bool {
590	return iter.page.NotDone() && iter.i < len(iter.page.Values())
591}
592
593// Response returns the raw server response from the last page request.
594func (iter StorageInsightListResultIterator) Response() StorageInsightListResult {
595	return iter.page.Response()
596}
597
598// Value returns the current value or a zero-initialized value if the
599// iterator has advanced beyond the end of the collection.
600func (iter StorageInsightListResultIterator) Value() StorageInsight {
601	if !iter.page.NotDone() {
602		return StorageInsight{}
603	}
604	return iter.page.Values()[iter.i]
605}
606
607// IsEmpty returns true if the ListResult contains no values.
608func (silr StorageInsightListResult) IsEmpty() bool {
609	return silr.Value == nil || len(*silr.Value) == 0
610}
611
612// storageInsightListResultPreparer prepares a request to retrieve the next set of results.
613// It returns nil if no more results exist.
614func (silr StorageInsightListResult) storageInsightListResultPreparer() (*http.Request, error) {
615	if silr.OdataNextLink == nil || len(to.String(silr.OdataNextLink)) < 1 {
616		return nil, nil
617	}
618	return autorest.Prepare(&http.Request{},
619		autorest.AsJSON(),
620		autorest.AsGet(),
621		autorest.WithBaseURL(to.String(silr.OdataNextLink)))
622}
623
624// StorageInsightListResultPage contains a page of StorageInsight values.
625type StorageInsightListResultPage struct {
626	fn   func(StorageInsightListResult) (StorageInsightListResult, error)
627	silr StorageInsightListResult
628}
629
630// Next advances to the next page of values.  If there was an error making
631// the request the page does not advance and the error is returned.
632func (page *StorageInsightListResultPage) Next() error {
633	next, err := page.fn(page.silr)
634	if err != nil {
635		return err
636	}
637	page.silr = next
638	return nil
639}
640
641// NotDone returns true if the page enumeration should be started or is not yet complete.
642func (page StorageInsightListResultPage) NotDone() bool {
643	return !page.silr.IsEmpty()
644}
645
646// Response returns the raw server response from the last page request.
647func (page StorageInsightListResultPage) Response() StorageInsightListResult {
648	return page.silr
649}
650
651// Values returns the slice of values for the current page or nil if there are no values.
652func (page StorageInsightListResultPage) Values() []StorageInsight {
653	if page.silr.IsEmpty() {
654		return nil
655	}
656	return *page.silr.Value
657}
658
659// StorageInsightProperties storage insight properties.
660type StorageInsightProperties struct {
661	// Containers - The names of the blob containers that the workspace should read
662	Containers *[]string `json:"containers,omitempty"`
663	// Tables - The names of the Azure tables that the workspace should read
664	Tables *[]string `json:"tables,omitempty"`
665	// StorageAccount - The storage account connection details
666	StorageAccount *StorageAccount `json:"storageAccount,omitempty"`
667	// Status - The status of the storage insight
668	Status *StorageInsightStatus `json:"status,omitempty"`
669}
670
671// StorageInsightStatus the status of the storage insight.
672type StorageInsightStatus struct {
673	// State - The state of the storage insight connection to the workspace. Possible values include: 'OK', 'ERROR'
674	State StorageInsightState `json:"state,omitempty"`
675	// Description - Description of the state of the storage insight.
676	Description *string `json:"description,omitempty"`
677}
678
679// Tag a tag of a saved search.
680type Tag struct {
681	// Name - The tag name.
682	Name *string `json:"name,omitempty"`
683	// Value - The tag value.
684	Value *string `json:"value,omitempty"`
685}
686
687// WorkspacePurgeBody describes the body of a purge request for an App Insights Workspace
688type WorkspacePurgeBody struct {
689	// Table - Table from which to purge data.
690	Table *string `json:"table,omitempty"`
691	// Filters - The set of columns and filters (queries) to run over them to purge the resulting data.
692	Filters *[]WorkspacePurgeBodyFilters `json:"filters,omitempty"`
693}
694
695// WorkspacePurgeBodyFilters user-defined filters to return data which will be purged from the table.
696type WorkspacePurgeBodyFilters struct {
697	// Column - The column of the table over which the given query should run
698	Column *string `json:"column,omitempty"`
699	// Operator - A query operator to evaluate over the provided column and value(s).
700	Operator *string `json:"operator,omitempty"`
701	// Value - the value for the operator to function over. This can be a number (e.g., > 100), a string (timestamp >= '2017-09-01') or array of values.
702	Value interface{} `json:"value,omitempty"`
703}
704
705// WorkspacePurgeResponse response containing operationId for a specific purge action.
706type WorkspacePurgeResponse struct {
707	// OperationID - Id to use when querying for status for a particular purge operation.
708	OperationID *string `json:"operationId,omitempty"`
709}
710
711// WorkspacePurgeStatusResponse response containing status for a specific purge operation.
712type WorkspacePurgeStatusResponse struct {
713	// Status - Status of the operation represented by the requested Id. Possible values include: 'Pending', 'Completed'
714	Status PurgeState `json:"status,omitempty"`
715}
716
717// WorkspacesGetSearchResultsFuture an abstraction for monitoring and retrieving the results of a long-running
718// operation.
719type WorkspacesGetSearchResultsFuture struct {
720	azure.Future
721	req *http.Request
722}
723
724// Result returns the result of the asynchronous operation.
725// If the operation has not completed it will return an error.
726func (future WorkspacesGetSearchResultsFuture) Result(client WorkspacesClient) (srr SearchResultsResponse, err error) {
727	var done bool
728	done, err = future.Done(client)
729	if err != nil {
730		err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesGetSearchResultsFuture", "Result", future.Response(), "Polling failure")
731		return
732	}
733	if !done {
734		return srr, azure.NewAsyncOpIncompleteError("operationalinsights.WorkspacesGetSearchResultsFuture")
735	}
736	if future.PollingMethod() == azure.PollingLocation {
737		srr, err = client.GetSearchResultsResponder(future.Response())
738		if err != nil {
739			err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesGetSearchResultsFuture", "Result", future.Response(), "Failure responding to request")
740		}
741		return
742	}
743	var req *http.Request
744	var resp *http.Response
745	if future.PollingURL() != "" {
746		req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
747		if err != nil {
748			return
749		}
750	} else {
751		req = autorest.ChangeToGet(future.req)
752	}
753	resp, err = autorest.SendWithSender(client, req,
754		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
755	if err != nil {
756		err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesGetSearchResultsFuture", "Result", resp, "Failure sending request")
757		return
758	}
759	srr, err = client.GetSearchResultsResponder(resp)
760	if err != nil {
761		err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesGetSearchResultsFuture", "Result", resp, "Failure responding to request")
762	}
763	return
764}
765
766// WorkspacesPurgeFuture an abstraction for monitoring and retrieving the results of a long-running operation.
767type WorkspacesPurgeFuture struct {
768	azure.Future
769	req *http.Request
770}
771
772// Result returns the result of the asynchronous operation.
773// If the operation has not completed it will return an error.
774func (future WorkspacesPurgeFuture) Result(client WorkspacesClient) (so SetObject, err error) {
775	var done bool
776	done, err = future.Done(client)
777	if err != nil {
778		err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesPurgeFuture", "Result", future.Response(), "Polling failure")
779		return
780	}
781	if !done {
782		return so, azure.NewAsyncOpIncompleteError("operationalinsights.WorkspacesPurgeFuture")
783	}
784	if future.PollingMethod() == azure.PollingLocation {
785		so, err = client.PurgeResponder(future.Response())
786		if err != nil {
787			err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesPurgeFuture", "Result", future.Response(), "Failure responding to request")
788		}
789		return
790	}
791	var req *http.Request
792	var resp *http.Response
793	if future.PollingURL() != "" {
794		req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
795		if err != nil {
796			return
797		}
798	} else {
799		req = autorest.ChangeToGet(future.req)
800	}
801	resp, err = autorest.SendWithSender(client, req,
802		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
803	if err != nil {
804		err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesPurgeFuture", "Result", resp, "Failure sending request")
805		return
806	}
807	so, err = client.PurgeResponder(resp)
808	if err != nil {
809		err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesPurgeFuture", "Result", resp, "Failure responding to request")
810	}
811	return
812}
813