1package search
2
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// Licensed under the MIT License. See License.txt in the project root for license information.
5//
6// Code generated by Microsoft (R) AutoRest Code Generator.
7// Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
9import (
10	"context"
11	"encoding/json"
12	"github.com/Azure/go-autorest/autorest"
13	"github.com/Azure/go-autorest/autorest/azure"
14	"github.com/Azure/go-autorest/autorest/to"
15	"github.com/Azure/go-autorest/tracing"
16	"net/http"
17)
18
19// The package's fully qualified name.
20const fqdn = "github.com/Azure/azure-sdk-for-go/services/search/mgmt/2020-03-13/search"
21
22// AdminKeyResult response containing the primary and secondary admin API keys for a given Azure Cognitive
23// Search service.
24type AdminKeyResult struct {
25	autorest.Response `json:"-"`
26	// PrimaryKey - READ-ONLY; The primary admin API key of the Search service.
27	PrimaryKey *string `json:"primaryKey,omitempty"`
28	// SecondaryKey - READ-ONLY; The secondary admin API key of the Search service.
29	SecondaryKey *string `json:"secondaryKey,omitempty"`
30}
31
32// MarshalJSON is the custom marshaler for AdminKeyResult.
33func (akr AdminKeyResult) MarshalJSON() ([]byte, error) {
34	objectMap := make(map[string]interface{})
35	return json.Marshal(objectMap)
36}
37
38// CheckNameAvailabilityInput input of check name availability API.
39type CheckNameAvailabilityInput struct {
40	// Name - The Search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length.
41	Name *string `json:"name,omitempty"`
42	// Type - The type of the resource whose name is to be validated. This value must always be 'searchServices'.
43	Type *string `json:"type,omitempty"`
44}
45
46// CheckNameAvailabilityOutput output of check name availability API.
47type CheckNameAvailabilityOutput struct {
48	autorest.Response `json:"-"`
49	// IsNameAvailable - READ-ONLY; A value indicating whether the name is available.
50	IsNameAvailable *bool `json:"nameAvailable,omitempty"`
51	// Reason - READ-ONLY; The reason why the name is not available. 'Invalid' indicates the name provided does not match the naming requirements (incorrect length, unsupported characters, etc.). 'AlreadyExists' indicates that the name is already in use and is therefore unavailable. Possible values include: 'Invalid', 'AlreadyExists'
52	Reason UnavailableNameReason `json:"reason,omitempty"`
53	// Message - READ-ONLY; A message that explains why the name is invalid and provides resource naming requirements. Available only if 'Invalid' is returned in the 'reason' property.
54	Message *string `json:"message,omitempty"`
55}
56
57// MarshalJSON is the custom marshaler for CheckNameAvailabilityOutput.
58func (cnao CheckNameAvailabilityOutput) MarshalJSON() ([]byte, error) {
59	objectMap := make(map[string]interface{})
60	return json.Marshal(objectMap)
61}
62
63// CloudError contains information about an API error.
64type CloudError struct {
65	// Error - Describes a particular API error with an error code and a message.
66	Error *CloudErrorBody `json:"error,omitempty"`
67}
68
69// CloudErrorBody describes a particular API error with an error code and a message.
70type CloudErrorBody struct {
71	// Code - An error code that describes the error condition more precisely than an HTTP status code. Can be used to programmatically handle specific error cases.
72	Code *string `json:"code,omitempty"`
73	// Message - A message that describes the error in detail and provides debugging information.
74	Message *string `json:"message,omitempty"`
75	// Target - The target of the particular error (for example, the name of the property in error).
76	Target *string `json:"target,omitempty"`
77	// Details - Contains nested errors that are related to this error.
78	Details *[]CloudErrorBody `json:"details,omitempty"`
79}
80
81// Identity identity for the resource.
82type Identity struct {
83	// PrincipalID - READ-ONLY; The principal ID of resource identity.
84	PrincipalID *string `json:"principalId,omitempty"`
85	// TenantID - READ-ONLY; The tenant ID of resource.
86	TenantID *string `json:"tenantId,omitempty"`
87	// Type - The identity type. Possible values include: 'None', 'SystemAssigned'
88	Type IdentityType `json:"type,omitempty"`
89}
90
91// MarshalJSON is the custom marshaler for Identity.
92func (i Identity) MarshalJSON() ([]byte, error) {
93	objectMap := make(map[string]interface{})
94	if i.Type != "" {
95		objectMap["type"] = i.Type
96	}
97	return json.Marshal(objectMap)
98}
99
100// IPRule the IP restriction rule of the Azure Cognitive Search service.
101type IPRule struct {
102	// Value - Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in CIDR format (eg., 123.1.2.3/24) to be allowed.
103	Value *string `json:"value,omitempty"`
104}
105
106// ListQueryKeysResult response containing the query API keys for a given Azure Cognitive Search service.
107type ListQueryKeysResult struct {
108	autorest.Response `json:"-"`
109	// Value - READ-ONLY; The query keys for the Azure Cognitive Search service.
110	Value *[]QueryKey `json:"value,omitempty"`
111	// NextLink - READ-ONLY; Request URL that can be used to query next page of query keys. Returned when the total number of requested query keys exceed maximum page size.
112	NextLink *string `json:"nextLink,omitempty"`
113}
114
115// MarshalJSON is the custom marshaler for ListQueryKeysResult.
116func (lqkr ListQueryKeysResult) MarshalJSON() ([]byte, error) {
117	objectMap := make(map[string]interface{})
118	return json.Marshal(objectMap)
119}
120
121// ListQueryKeysResultIterator provides access to a complete listing of QueryKey values.
122type ListQueryKeysResultIterator struct {
123	i    int
124	page ListQueryKeysResultPage
125}
126
127// NextWithContext advances to the next value.  If there was an error making
128// the request the iterator does not advance and the error is returned.
129func (iter *ListQueryKeysResultIterator) NextWithContext(ctx context.Context) (err error) {
130	if tracing.IsEnabled() {
131		ctx = tracing.StartSpan(ctx, fqdn+"/ListQueryKeysResultIterator.NextWithContext")
132		defer func() {
133			sc := -1
134			if iter.Response().Response.Response != nil {
135				sc = iter.Response().Response.Response.StatusCode
136			}
137			tracing.EndSpan(ctx, sc, err)
138		}()
139	}
140	iter.i++
141	if iter.i < len(iter.page.Values()) {
142		return nil
143	}
144	err = iter.page.NextWithContext(ctx)
145	if err != nil {
146		iter.i--
147		return err
148	}
149	iter.i = 0
150	return nil
151}
152
153// Next advances to the next value.  If there was an error making
154// the request the iterator does not advance and the error is returned.
155// Deprecated: Use NextWithContext() instead.
156func (iter *ListQueryKeysResultIterator) Next() error {
157	return iter.NextWithContext(context.Background())
158}
159
160// NotDone returns true if the enumeration should be started or is not yet complete.
161func (iter ListQueryKeysResultIterator) NotDone() bool {
162	return iter.page.NotDone() && iter.i < len(iter.page.Values())
163}
164
165// Response returns the raw server response from the last page request.
166func (iter ListQueryKeysResultIterator) Response() ListQueryKeysResult {
167	return iter.page.Response()
168}
169
170// Value returns the current value or a zero-initialized value if the
171// iterator has advanced beyond the end of the collection.
172func (iter ListQueryKeysResultIterator) Value() QueryKey {
173	if !iter.page.NotDone() {
174		return QueryKey{}
175	}
176	return iter.page.Values()[iter.i]
177}
178
179// Creates a new instance of the ListQueryKeysResultIterator type.
180func NewListQueryKeysResultIterator(page ListQueryKeysResultPage) ListQueryKeysResultIterator {
181	return ListQueryKeysResultIterator{page: page}
182}
183
184// IsEmpty returns true if the ListResult contains no values.
185func (lqkr ListQueryKeysResult) IsEmpty() bool {
186	return lqkr.Value == nil || len(*lqkr.Value) == 0
187}
188
189// hasNextLink returns true if the NextLink is not empty.
190func (lqkr ListQueryKeysResult) hasNextLink() bool {
191	return lqkr.NextLink != nil && len(*lqkr.NextLink) != 0
192}
193
194// listQueryKeysResultPreparer prepares a request to retrieve the next set of results.
195// It returns nil if no more results exist.
196func (lqkr ListQueryKeysResult) listQueryKeysResultPreparer(ctx context.Context) (*http.Request, error) {
197	if !lqkr.hasNextLink() {
198		return nil, nil
199	}
200	return autorest.Prepare((&http.Request{}).WithContext(ctx),
201		autorest.AsJSON(),
202		autorest.AsGet(),
203		autorest.WithBaseURL(to.String(lqkr.NextLink)))
204}
205
206// ListQueryKeysResultPage contains a page of QueryKey values.
207type ListQueryKeysResultPage struct {
208	fn   func(context.Context, ListQueryKeysResult) (ListQueryKeysResult, error)
209	lqkr ListQueryKeysResult
210}
211
212// NextWithContext advances to the next page of values.  If there was an error making
213// the request the page does not advance and the error is returned.
214func (page *ListQueryKeysResultPage) NextWithContext(ctx context.Context) (err error) {
215	if tracing.IsEnabled() {
216		ctx = tracing.StartSpan(ctx, fqdn+"/ListQueryKeysResultPage.NextWithContext")
217		defer func() {
218			sc := -1
219			if page.Response().Response.Response != nil {
220				sc = page.Response().Response.Response.StatusCode
221			}
222			tracing.EndSpan(ctx, sc, err)
223		}()
224	}
225	for {
226		next, err := page.fn(ctx, page.lqkr)
227		if err != nil {
228			return err
229		}
230		page.lqkr = next
231		if !next.hasNextLink() || !next.IsEmpty() {
232			break
233		}
234	}
235	return nil
236}
237
238// Next advances to the next page of values.  If there was an error making
239// the request the page does not advance and the error is returned.
240// Deprecated: Use NextWithContext() instead.
241func (page *ListQueryKeysResultPage) Next() error {
242	return page.NextWithContext(context.Background())
243}
244
245// NotDone returns true if the page enumeration should be started or is not yet complete.
246func (page ListQueryKeysResultPage) NotDone() bool {
247	return !page.lqkr.IsEmpty()
248}
249
250// Response returns the raw server response from the last page request.
251func (page ListQueryKeysResultPage) Response() ListQueryKeysResult {
252	return page.lqkr
253}
254
255// Values returns the slice of values for the current page or nil if there are no values.
256func (page ListQueryKeysResultPage) Values() []QueryKey {
257	if page.lqkr.IsEmpty() {
258		return nil
259	}
260	return *page.lqkr.Value
261}
262
263// Creates a new instance of the ListQueryKeysResultPage type.
264func NewListQueryKeysResultPage(cur ListQueryKeysResult, getNextPage func(context.Context, ListQueryKeysResult) (ListQueryKeysResult, error)) ListQueryKeysResultPage {
265	return ListQueryKeysResultPage{
266		fn:   getNextPage,
267		lqkr: cur,
268	}
269}
270
271// NetworkRuleSet network specific rules that determine how the Azure Cognitive Search service may be
272// reached.
273type NetworkRuleSet struct {
274	// IPRules - A list of IP restriction rules that defines the inbound network(s) with allowing access to the search service endpoint. At the meantime, all other public IP networks are blocked by the firewall. These restriction rules are applied only when the 'publicNetworkAccess' of the search service is 'enabled'; otherwise, traffic over public interface is not allowed even with any public IP rules, and private endpoint connections would be the exclusive access method.
275	IPRules *[]IPRule `json:"ipRules,omitempty"`
276}
277
278// Operation describes a REST API operation.
279type Operation struct {
280	// Name - READ-ONLY; The name of the operation. This name is of the form {provider}/{resource}/{operation}.
281	Name *string `json:"name,omitempty"`
282	// Display - READ-ONLY; The object that describes the operation.
283	Display *OperationDisplay `json:"display,omitempty"`
284}
285
286// MarshalJSON is the custom marshaler for Operation.
287func (o Operation) MarshalJSON() ([]byte, error) {
288	objectMap := make(map[string]interface{})
289	return json.Marshal(objectMap)
290}
291
292// OperationDisplay the object that describes the operation.
293type OperationDisplay struct {
294	// Provider - READ-ONLY; The friendly name of the resource provider.
295	Provider *string `json:"provider,omitempty"`
296	// Operation - READ-ONLY; The operation type: read, write, delete, listKeys/action, etc.
297	Operation *string `json:"operation,omitempty"`
298	// Resource - READ-ONLY; The resource type on which the operation is performed.
299	Resource *string `json:"resource,omitempty"`
300	// Description - READ-ONLY; The friendly name of the operation.
301	Description *string `json:"description,omitempty"`
302}
303
304// MarshalJSON is the custom marshaler for OperationDisplay.
305func (o OperationDisplay) MarshalJSON() ([]byte, error) {
306	objectMap := make(map[string]interface{})
307	return json.Marshal(objectMap)
308}
309
310// OperationListResult the result of the request to list REST API operations. It contains a list of
311// operations and a URL  to get the next set of results.
312type OperationListResult struct {
313	autorest.Response `json:"-"`
314	// Value - READ-ONLY; The list of operations supported by the resource provider.
315	Value *[]Operation `json:"value,omitempty"`
316	// NextLink - READ-ONLY; The URL to get the next set of operation list results, if any.
317	NextLink *string `json:"nextLink,omitempty"`
318}
319
320// MarshalJSON is the custom marshaler for OperationListResult.
321func (olr OperationListResult) MarshalJSON() ([]byte, error) {
322	objectMap := make(map[string]interface{})
323	return json.Marshal(objectMap)
324}
325
326// PrivateEndpointConnection describes an existing Private Endpoint connection to the Azure Cognitive
327// Search service.
328type PrivateEndpointConnection struct {
329	autorest.Response `json:"-"`
330	// ID - READ-ONLY; The ID of the private endpoint connection. This can be used with the Azure Resource Manager to link resources together.
331	ID *string `json:"id,omitempty"`
332	// Name - READ-ONLY; The name of the private endpoint connection.
333	Name *string `json:"name,omitempty"`
334	// Type - READ-ONLY; The resource type.
335	Type *string `json:"type,omitempty"`
336	// Properties - Describes the properties of an existing Private Endpoint connection to the Azure Cognitive Search service.
337	Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"`
338}
339
340// MarshalJSON is the custom marshaler for PrivateEndpointConnection.
341func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) {
342	objectMap := make(map[string]interface{})
343	if pec.Properties != nil {
344		objectMap["properties"] = pec.Properties
345	}
346	return json.Marshal(objectMap)
347}
348
349// PrivateEndpointConnectionListResult response containing a list of Private Endpoint connections.
350type PrivateEndpointConnectionListResult struct {
351	autorest.Response `json:"-"`
352	// Value - READ-ONLY; The list of Private Endpoint connections.
353	Value *[]PrivateEndpointConnection `json:"value,omitempty"`
354	// NextLink - READ-ONLY; Request URL that can be used to query next page of private endpoint connections. Returned when the total number of requested private endpoint connections exceed maximum page size.
355	NextLink *string `json:"nextLink,omitempty"`
356}
357
358// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult.
359func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) {
360	objectMap := make(map[string]interface{})
361	return json.Marshal(objectMap)
362}
363
364// PrivateEndpointConnectionListResultIterator provides access to a complete listing of
365// PrivateEndpointConnection values.
366type PrivateEndpointConnectionListResultIterator struct {
367	i    int
368	page PrivateEndpointConnectionListResultPage
369}
370
371// NextWithContext advances to the next value.  If there was an error making
372// the request the iterator does not advance and the error is returned.
373func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) {
374	if tracing.IsEnabled() {
375		ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext")
376		defer func() {
377			sc := -1
378			if iter.Response().Response.Response != nil {
379				sc = iter.Response().Response.Response.StatusCode
380			}
381			tracing.EndSpan(ctx, sc, err)
382		}()
383	}
384	iter.i++
385	if iter.i < len(iter.page.Values()) {
386		return nil
387	}
388	err = iter.page.NextWithContext(ctx)
389	if err != nil {
390		iter.i--
391		return err
392	}
393	iter.i = 0
394	return nil
395}
396
397// Next advances to the next value.  If there was an error making
398// the request the iterator does not advance and the error is returned.
399// Deprecated: Use NextWithContext() instead.
400func (iter *PrivateEndpointConnectionListResultIterator) Next() error {
401	return iter.NextWithContext(context.Background())
402}
403
404// NotDone returns true if the enumeration should be started or is not yet complete.
405func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool {
406	return iter.page.NotDone() && iter.i < len(iter.page.Values())
407}
408
409// Response returns the raw server response from the last page request.
410func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult {
411	return iter.page.Response()
412}
413
414// Value returns the current value or a zero-initialized value if the
415// iterator has advanced beyond the end of the collection.
416func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection {
417	if !iter.page.NotDone() {
418		return PrivateEndpointConnection{}
419	}
420	return iter.page.Values()[iter.i]
421}
422
423// Creates a new instance of the PrivateEndpointConnectionListResultIterator type.
424func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator {
425	return PrivateEndpointConnectionListResultIterator{page: page}
426}
427
428// IsEmpty returns true if the ListResult contains no values.
429func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool {
430	return peclr.Value == nil || len(*peclr.Value) == 0
431}
432
433// hasNextLink returns true if the NextLink is not empty.
434func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool {
435	return peclr.NextLink != nil && len(*peclr.NextLink) != 0
436}
437
438// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results.
439// It returns nil if no more results exist.
440func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) {
441	if !peclr.hasNextLink() {
442		return nil, nil
443	}
444	return autorest.Prepare((&http.Request{}).WithContext(ctx),
445		autorest.AsJSON(),
446		autorest.AsGet(),
447		autorest.WithBaseURL(to.String(peclr.NextLink)))
448}
449
450// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values.
451type PrivateEndpointConnectionListResultPage struct {
452	fn    func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)
453	peclr PrivateEndpointConnectionListResult
454}
455
456// NextWithContext advances to the next page of values.  If there was an error making
457// the request the page does not advance and the error is returned.
458func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) {
459	if tracing.IsEnabled() {
460		ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext")
461		defer func() {
462			sc := -1
463			if page.Response().Response.Response != nil {
464				sc = page.Response().Response.Response.StatusCode
465			}
466			tracing.EndSpan(ctx, sc, err)
467		}()
468	}
469	for {
470		next, err := page.fn(ctx, page.peclr)
471		if err != nil {
472			return err
473		}
474		page.peclr = next
475		if !next.hasNextLink() || !next.IsEmpty() {
476			break
477		}
478	}
479	return nil
480}
481
482// Next advances to the next page of values.  If there was an error making
483// the request the page does not advance and the error is returned.
484// Deprecated: Use NextWithContext() instead.
485func (page *PrivateEndpointConnectionListResultPage) Next() error {
486	return page.NextWithContext(context.Background())
487}
488
489// NotDone returns true if the page enumeration should be started or is not yet complete.
490func (page PrivateEndpointConnectionListResultPage) NotDone() bool {
491	return !page.peclr.IsEmpty()
492}
493
494// Response returns the raw server response from the last page request.
495func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult {
496	return page.peclr
497}
498
499// Values returns the slice of values for the current page or nil if there are no values.
500func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection {
501	if page.peclr.IsEmpty() {
502		return nil
503	}
504	return *page.peclr.Value
505}
506
507// Creates a new instance of the PrivateEndpointConnectionListResultPage type.
508func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage {
509	return PrivateEndpointConnectionListResultPage{
510		fn:    getNextPage,
511		peclr: cur,
512	}
513}
514
515// PrivateEndpointConnectionProperties describes the properties of an existing Private Endpoint connection
516// to the Azure Cognitive Search service.
517type PrivateEndpointConnectionProperties struct {
518	// PrivateEndpoint - The private endpoint resource from Microsoft.Network provider.
519	PrivateEndpoint *PrivateEndpointConnectionPropertiesPrivateEndpoint `json:"privateEndpoint,omitempty"`
520	// PrivateLinkServiceConnectionState - Describes the current state of an existing Private Link Service connection to the Azure Private Endpoint.
521	PrivateLinkServiceConnectionState *PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"`
522}
523
524// PrivateEndpointConnectionPropertiesPrivateEndpoint the private endpoint resource from Microsoft.Network
525// provider.
526type PrivateEndpointConnectionPropertiesPrivateEndpoint struct {
527	// ID - The resource id of the private endpoint resource from Microsoft.Network provider.
528	ID *string `json:"id,omitempty"`
529}
530
531// PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState describes the current state of an
532// existing Private Link Service connection to the Azure Private Endpoint.
533type PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState struct {
534	// Status - Status of the the private link service connection. Can be Pending, Approved, Rejected, or Disconnected. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected'
535	Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"`
536	// Description - The description for the private link service connection state.
537	Description *string `json:"description,omitempty"`
538	// ActionsRequired - A description of any extra actions that may be required.
539	ActionsRequired *string `json:"actionsRequired,omitempty"`
540}
541
542// PrivateLinkResource describes a supported private link resource for the Azure Cognitive Search service.
543type PrivateLinkResource struct {
544	// ID - READ-ONLY; The ID of the private link resource.
545	ID *string `json:"id,omitempty"`
546	// Name - READ-ONLY; The name of the private link resource.
547	Name *string `json:"name,omitempty"`
548	// Type - READ-ONLY; The resource type.
549	Type *string `json:"type,omitempty"`
550	// Properties - READ-ONLY; Describes the properties of a supported private link resource for the Azure Cognitive Search service.
551	Properties *PrivateLinkResourceProperties `json:"properties,omitempty"`
552}
553
554// MarshalJSON is the custom marshaler for PrivateLinkResource.
555func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) {
556	objectMap := make(map[string]interface{})
557	return json.Marshal(objectMap)
558}
559
560// PrivateLinkResourceProperties describes the properties of a supported private link resource for the
561// Azure Cognitive Search service.
562type PrivateLinkResourceProperties struct {
563	// GroupID - READ-ONLY; The group ID of the private link resource.
564	GroupID *string `json:"groupId,omitempty"`
565	// RequiredMembers - READ-ONLY; The list of required members of the private link resource.
566	RequiredMembers *[]string `json:"requiredMembers,omitempty"`
567	// RequiredZoneNames - READ-ONLY; The list of required DNS zone names of the private link resource.
568	RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"`
569}
570
571// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties.
572func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) {
573	objectMap := make(map[string]interface{})
574	return json.Marshal(objectMap)
575}
576
577// PrivateLinkResourcesResult response containing a list of supported Private Link Resources.
578type PrivateLinkResourcesResult struct {
579	autorest.Response `json:"-"`
580	// Value - READ-ONLY; The list of supported Private Link Resources.
581	Value *[]PrivateLinkResource `json:"value,omitempty"`
582}
583
584// MarshalJSON is the custom marshaler for PrivateLinkResourcesResult.
585func (plrr PrivateLinkResourcesResult) MarshalJSON() ([]byte, error) {
586	objectMap := make(map[string]interface{})
587	return json.Marshal(objectMap)
588}
589
590// QueryKey describes an API key for a given Azure Cognitive Search service that has permissions for query
591// operations only.
592type QueryKey struct {
593	autorest.Response `json:"-"`
594	// Name - READ-ONLY; The name of the query API key; may be empty.
595	Name *string `json:"name,omitempty"`
596	// Key - READ-ONLY; The value of the query API key.
597	Key *string `json:"key,omitempty"`
598}
599
600// MarshalJSON is the custom marshaler for QueryKey.
601func (qk QueryKey) MarshalJSON() ([]byte, error) {
602	objectMap := make(map[string]interface{})
603	return json.Marshal(objectMap)
604}
605
606// Resource base type for all Azure resources.
607type Resource struct {
608	// ID - READ-ONLY; The ID of the resource. This can be used with the Azure Resource Manager to link resources together.
609	ID *string `json:"id,omitempty"`
610	// Name - READ-ONLY; The name of the resource.
611	Name *string `json:"name,omitempty"`
612	// Type - READ-ONLY; The resource type.
613	Type *string `json:"type,omitempty"`
614	// Location - The geographic location of the resource. This must be one of the supported and registered Azure Geo Regions (for example, West US, East US, Southeast Asia, and so forth). This property is required when creating a new resource.
615	Location *string `json:"location,omitempty"`
616	// Tags - Tags to help categorize the resource in the Azure portal.
617	Tags map[string]*string `json:"tags"`
618	// Identity - The identity of the resource.
619	Identity *Identity `json:"identity,omitempty"`
620}
621
622// MarshalJSON is the custom marshaler for Resource.
623func (r Resource) MarshalJSON() ([]byte, error) {
624	objectMap := make(map[string]interface{})
625	if r.Location != nil {
626		objectMap["location"] = r.Location
627	}
628	if r.Tags != nil {
629		objectMap["tags"] = r.Tags
630	}
631	if r.Identity != nil {
632		objectMap["identity"] = r.Identity
633	}
634	return json.Marshal(objectMap)
635}
636
637// Service describes an Azure Cognitive Search service and its current state.
638type Service struct {
639	autorest.Response `json:"-"`
640	// ServiceProperties - Properties of the Search service.
641	*ServiceProperties `json:"properties,omitempty"`
642	// Sku - The SKU of the Search Service, which determines price tier and capacity limits. This property is required when creating a new Search Service.
643	Sku *Sku `json:"sku,omitempty"`
644	// ID - READ-ONLY; The ID of the resource. This can be used with the Azure Resource Manager to link resources together.
645	ID *string `json:"id,omitempty"`
646	// Name - READ-ONLY; The name of the resource.
647	Name *string `json:"name,omitempty"`
648	// Type - READ-ONLY; The resource type.
649	Type *string `json:"type,omitempty"`
650	// Location - The geographic location of the resource. This must be one of the supported and registered Azure Geo Regions (for example, West US, East US, Southeast Asia, and so forth). This property is required when creating a new resource.
651	Location *string `json:"location,omitempty"`
652	// Tags - Tags to help categorize the resource in the Azure portal.
653	Tags map[string]*string `json:"tags"`
654	// Identity - The identity of the resource.
655	Identity *Identity `json:"identity,omitempty"`
656}
657
658// MarshalJSON is the custom marshaler for Service.
659func (s Service) MarshalJSON() ([]byte, error) {
660	objectMap := make(map[string]interface{})
661	if s.ServiceProperties != nil {
662		objectMap["properties"] = s.ServiceProperties
663	}
664	if s.Sku != nil {
665		objectMap["sku"] = s.Sku
666	}
667	if s.Location != nil {
668		objectMap["location"] = s.Location
669	}
670	if s.Tags != nil {
671		objectMap["tags"] = s.Tags
672	}
673	if s.Identity != nil {
674		objectMap["identity"] = s.Identity
675	}
676	return json.Marshal(objectMap)
677}
678
679// UnmarshalJSON is the custom unmarshaler for Service struct.
680func (s *Service) UnmarshalJSON(body []byte) error {
681	var m map[string]*json.RawMessage
682	err := json.Unmarshal(body, &m)
683	if err != nil {
684		return err
685	}
686	for k, v := range m {
687		switch k {
688		case "properties":
689			if v != nil {
690				var serviceProperties ServiceProperties
691				err = json.Unmarshal(*v, &serviceProperties)
692				if err != nil {
693					return err
694				}
695				s.ServiceProperties = &serviceProperties
696			}
697		case "sku":
698			if v != nil {
699				var sku Sku
700				err = json.Unmarshal(*v, &sku)
701				if err != nil {
702					return err
703				}
704				s.Sku = &sku
705			}
706		case "id":
707			if v != nil {
708				var ID string
709				err = json.Unmarshal(*v, &ID)
710				if err != nil {
711					return err
712				}
713				s.ID = &ID
714			}
715		case "name":
716			if v != nil {
717				var name string
718				err = json.Unmarshal(*v, &name)
719				if err != nil {
720					return err
721				}
722				s.Name = &name
723			}
724		case "type":
725			if v != nil {
726				var typeVar string
727				err = json.Unmarshal(*v, &typeVar)
728				if err != nil {
729					return err
730				}
731				s.Type = &typeVar
732			}
733		case "location":
734			if v != nil {
735				var location string
736				err = json.Unmarshal(*v, &location)
737				if err != nil {
738					return err
739				}
740				s.Location = &location
741			}
742		case "tags":
743			if v != nil {
744				var tags map[string]*string
745				err = json.Unmarshal(*v, &tags)
746				if err != nil {
747					return err
748				}
749				s.Tags = tags
750			}
751		case "identity":
752			if v != nil {
753				var identity Identity
754				err = json.Unmarshal(*v, &identity)
755				if err != nil {
756					return err
757				}
758				s.Identity = &identity
759			}
760		}
761	}
762
763	return nil
764}
765
766// ServiceListResult response containing a list of Azure Cognitive Search services.
767type ServiceListResult struct {
768	autorest.Response `json:"-"`
769	// Value - READ-ONLY; The list of Search services.
770	Value *[]Service `json:"value,omitempty"`
771	// NextLink - READ-ONLY; Request URL that can be used to query next page of search services. Returned when the total number of requested search services exceed maximum page size.
772	NextLink *string `json:"nextLink,omitempty"`
773}
774
775// MarshalJSON is the custom marshaler for ServiceListResult.
776func (slr ServiceListResult) MarshalJSON() ([]byte, error) {
777	objectMap := make(map[string]interface{})
778	return json.Marshal(objectMap)
779}
780
781// ServiceListResultIterator provides access to a complete listing of Service values.
782type ServiceListResultIterator struct {
783	i    int
784	page ServiceListResultPage
785}
786
787// NextWithContext advances to the next value.  If there was an error making
788// the request the iterator does not advance and the error is returned.
789func (iter *ServiceListResultIterator) NextWithContext(ctx context.Context) (err error) {
790	if tracing.IsEnabled() {
791		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultIterator.NextWithContext")
792		defer func() {
793			sc := -1
794			if iter.Response().Response.Response != nil {
795				sc = iter.Response().Response.Response.StatusCode
796			}
797			tracing.EndSpan(ctx, sc, err)
798		}()
799	}
800	iter.i++
801	if iter.i < len(iter.page.Values()) {
802		return nil
803	}
804	err = iter.page.NextWithContext(ctx)
805	if err != nil {
806		iter.i--
807		return err
808	}
809	iter.i = 0
810	return nil
811}
812
813// Next advances to the next value.  If there was an error making
814// the request the iterator does not advance and the error is returned.
815// Deprecated: Use NextWithContext() instead.
816func (iter *ServiceListResultIterator) Next() error {
817	return iter.NextWithContext(context.Background())
818}
819
820// NotDone returns true if the enumeration should be started or is not yet complete.
821func (iter ServiceListResultIterator) NotDone() bool {
822	return iter.page.NotDone() && iter.i < len(iter.page.Values())
823}
824
825// Response returns the raw server response from the last page request.
826func (iter ServiceListResultIterator) Response() ServiceListResult {
827	return iter.page.Response()
828}
829
830// Value returns the current value or a zero-initialized value if the
831// iterator has advanced beyond the end of the collection.
832func (iter ServiceListResultIterator) Value() Service {
833	if !iter.page.NotDone() {
834		return Service{}
835	}
836	return iter.page.Values()[iter.i]
837}
838
839// Creates a new instance of the ServiceListResultIterator type.
840func NewServiceListResultIterator(page ServiceListResultPage) ServiceListResultIterator {
841	return ServiceListResultIterator{page: page}
842}
843
844// IsEmpty returns true if the ListResult contains no values.
845func (slr ServiceListResult) IsEmpty() bool {
846	return slr.Value == nil || len(*slr.Value) == 0
847}
848
849// hasNextLink returns true if the NextLink is not empty.
850func (slr ServiceListResult) hasNextLink() bool {
851	return slr.NextLink != nil && len(*slr.NextLink) != 0
852}
853
854// serviceListResultPreparer prepares a request to retrieve the next set of results.
855// It returns nil if no more results exist.
856func (slr ServiceListResult) serviceListResultPreparer(ctx context.Context) (*http.Request, error) {
857	if !slr.hasNextLink() {
858		return nil, nil
859	}
860	return autorest.Prepare((&http.Request{}).WithContext(ctx),
861		autorest.AsJSON(),
862		autorest.AsGet(),
863		autorest.WithBaseURL(to.String(slr.NextLink)))
864}
865
866// ServiceListResultPage contains a page of Service values.
867type ServiceListResultPage struct {
868	fn  func(context.Context, ServiceListResult) (ServiceListResult, error)
869	slr ServiceListResult
870}
871
872// NextWithContext advances to the next page of values.  If there was an error making
873// the request the page does not advance and the error is returned.
874func (page *ServiceListResultPage) NextWithContext(ctx context.Context) (err error) {
875	if tracing.IsEnabled() {
876		ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultPage.NextWithContext")
877		defer func() {
878			sc := -1
879			if page.Response().Response.Response != nil {
880				sc = page.Response().Response.Response.StatusCode
881			}
882			tracing.EndSpan(ctx, sc, err)
883		}()
884	}
885	for {
886		next, err := page.fn(ctx, page.slr)
887		if err != nil {
888			return err
889		}
890		page.slr = next
891		if !next.hasNextLink() || !next.IsEmpty() {
892			break
893		}
894	}
895	return nil
896}
897
898// Next advances to the next page of values.  If there was an error making
899// the request the page does not advance and the error is returned.
900// Deprecated: Use NextWithContext() instead.
901func (page *ServiceListResultPage) Next() error {
902	return page.NextWithContext(context.Background())
903}
904
905// NotDone returns true if the page enumeration should be started or is not yet complete.
906func (page ServiceListResultPage) NotDone() bool {
907	return !page.slr.IsEmpty()
908}
909
910// Response returns the raw server response from the last page request.
911func (page ServiceListResultPage) Response() ServiceListResult {
912	return page.slr
913}
914
915// Values returns the slice of values for the current page or nil if there are no values.
916func (page ServiceListResultPage) Values() []Service {
917	if page.slr.IsEmpty() {
918		return nil
919	}
920	return *page.slr.Value
921}
922
923// Creates a new instance of the ServiceListResultPage type.
924func NewServiceListResultPage(cur ServiceListResult, getNextPage func(context.Context, ServiceListResult) (ServiceListResult, error)) ServiceListResultPage {
925	return ServiceListResultPage{
926		fn:  getNextPage,
927		slr: cur,
928	}
929}
930
931// ServiceProperties properties of the Search service.
932type ServiceProperties struct {
933	// ReplicaCount - The number of replicas in the Search service. If specified, it must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU.
934	ReplicaCount *int32 `json:"replicaCount,omitempty"`
935	// PartitionCount - The number of partitions in the Search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 and 3.
936	PartitionCount *int32 `json:"partitionCount,omitempty"`
937	// HostingMode - Applicable only for the standard3 SKU. You can set this property to enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this value must be 'default'. Possible values include: 'Default', 'HighDensity'
938	HostingMode HostingMode `json:"hostingMode,omitempty"`
939	// PublicNetworkAccess - This value can be set to 'enabled' to avoid breaking changes on existing customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and private endpoint connections would be the exclusive access method. Possible values include: 'Enabled', 'Disabled'
940	PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"`
941	// Status - READ-ONLY; The status of the Search service. Possible values include: 'running': The Search service is running and no provisioning operations are underway. 'provisioning': The Search service is being provisioned or scaled up or down. 'deleting': The Search service is being deleted. 'degraded': The Search service is degraded. This can occur when the underlying search units are not healthy. The Search service is most likely operational, but performance might be slow and some requests might be dropped. 'disabled': The Search service is disabled. In this state, the service will reject all API requests. 'error': The Search service is in an error state. If your service is in the degraded, disabled, or error states, it means the Azure Cognitive Search team is actively investigating the underlying issue. Dedicated services in these states are still chargeable based on the number of search units provisioned. Possible values include: 'ServiceStatusRunning', 'ServiceStatusProvisioning', 'ServiceStatusDeleting', 'ServiceStatusDegraded', 'ServiceStatusDisabled', 'ServiceStatusError'
942	Status ServiceStatus `json:"status,omitempty"`
943	// StatusDetails - READ-ONLY; The details of the Search service status.
944	StatusDetails *string `json:"statusDetails,omitempty"`
945	// ProvisioningState - READ-ONLY; The state of the last provisioning operation performed on the Search service. Provisioning is an intermediate state that occurs while service capacity is being established. After capacity is set up, provisioningState changes to either 'succeeded' or 'failed'. Client applications can poll provisioning status (the recommended polling interval is from 30 seconds to one minute) by using the Get Search Service operation to see when an operation is completed. If you are using the free service, this value tends to come back as 'succeeded' directly in the call to Create Search service. This is because the free service uses capacity that is already set up. Possible values include: 'Succeeded', 'Provisioning', 'Failed'
946	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
947	// NetworkRuleSet - Network specific rules that determine how the Azure Cognitive Search service may be reached.
948	NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"`
949	// PrivateEndpointConnections - READ-ONLY; The list of private endpoint connections to the Azure Cognitive Search service.
950	PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"`
951}
952
953// MarshalJSON is the custom marshaler for ServiceProperties.
954func (sp ServiceProperties) MarshalJSON() ([]byte, error) {
955	objectMap := make(map[string]interface{})
956	if sp.ReplicaCount != nil {
957		objectMap["replicaCount"] = sp.ReplicaCount
958	}
959	if sp.PartitionCount != nil {
960		objectMap["partitionCount"] = sp.PartitionCount
961	}
962	if sp.HostingMode != "" {
963		objectMap["hostingMode"] = sp.HostingMode
964	}
965	if sp.PublicNetworkAccess != "" {
966		objectMap["publicNetworkAccess"] = sp.PublicNetworkAccess
967	}
968	if sp.NetworkRuleSet != nil {
969		objectMap["networkRuleSet"] = sp.NetworkRuleSet
970	}
971	return json.Marshal(objectMap)
972}
973
974// ServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
975// operation.
976type ServicesCreateOrUpdateFuture struct {
977	azure.FutureAPI
978	// Result returns the result of the asynchronous operation.
979	// If the operation has not completed it will return an error.
980	Result func(ServicesClient) (Service, error)
981}
982
983// UnmarshalJSON is the custom unmarshaller for CreateFuture.
984func (future *ServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error {
985	var azFuture azure.Future
986	if err := json.Unmarshal(body, &azFuture); err != nil {
987		return err
988	}
989	future.FutureAPI = &azFuture
990	future.Result = future.result
991	return nil
992}
993
994// result is the default implementation for ServicesCreateOrUpdateFuture.Result.
995func (future *ServicesCreateOrUpdateFuture) result(client ServicesClient) (s Service, err error) {
996	var done bool
997	done, err = future.DoneWithContext(context.Background(), client)
998	if err != nil {
999		err = autorest.NewErrorWithError(err, "search.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
1000		return
1001	}
1002	if !done {
1003		s.Response.Response = future.Response()
1004		err = azure.NewAsyncOpIncompleteError("search.ServicesCreateOrUpdateFuture")
1005		return
1006	}
1007	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
1008	if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent {
1009		s, err = client.CreateOrUpdateResponder(s.Response.Response)
1010		if err != nil {
1011			err = autorest.NewErrorWithError(err, "search.ServicesCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request")
1012		}
1013	}
1014	return
1015}
1016
1017// Sku defines the SKU of an Azure Cognitive Search Service, which determines price tier and capacity
1018// limits.
1019type Sku struct {
1020	// Name - The SKU of the Search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or up to 3 partitions with more indexes if you also set the hostingMode property to 'highDensity'). 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.'. Possible values include: 'Free', 'Basic', 'Standard', 'Standard2', 'Standard3', 'StorageOptimizedL1', 'StorageOptimizedL2'
1021	Name SkuName `json:"name,omitempty"`
1022}
1023