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-08-01/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// AsyncOperationResult the details of a long running asynchronous shared private link resource operation 39type AsyncOperationResult struct { 40 // Status - The current status of the long running asynchronous shared private link resource operation. Possible values include: 'SharedPrivateLinkResourceAsyncOperationResultRunning', 'SharedPrivateLinkResourceAsyncOperationResultSucceeded', 'SharedPrivateLinkResourceAsyncOperationResultFailed' 41 Status SharedPrivateLinkResourceAsyncOperationResult `json:"status,omitempty"` 42} 43 44// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. 45type AzureEntityResource struct { 46 // Etag - READ-ONLY; Resource Etag. 47 Etag *string `json:"etag,omitempty"` 48 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 49 ID *string `json:"id,omitempty"` 50 // Name - READ-ONLY; The name of the resource 51 Name *string `json:"name,omitempty"` 52 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 53 Type *string `json:"type,omitempty"` 54} 55 56// MarshalJSON is the custom marshaler for AzureEntityResource. 57func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { 58 objectMap := make(map[string]interface{}) 59 return json.Marshal(objectMap) 60} 61 62// CheckNameAvailabilityInput input of check name availability API. 63type CheckNameAvailabilityInput struct { 64 // 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. 65 Name *string `json:"name,omitempty"` 66 // Type - The type of the resource whose name is to be validated. This value must always be 'searchServices'. 67 Type *string `json:"type,omitempty"` 68} 69 70// CheckNameAvailabilityOutput output of check name availability API. 71type CheckNameAvailabilityOutput struct { 72 autorest.Response `json:"-"` 73 // IsNameAvailable - READ-ONLY; A value indicating whether the name is available. 74 IsNameAvailable *bool `json:"nameAvailable,omitempty"` 75 // 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' 76 Reason UnavailableNameReason `json:"reason,omitempty"` 77 // 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. 78 Message *string `json:"message,omitempty"` 79} 80 81// MarshalJSON is the custom marshaler for CheckNameAvailabilityOutput. 82func (cnao CheckNameAvailabilityOutput) MarshalJSON() ([]byte, error) { 83 objectMap := make(map[string]interface{}) 84 return json.Marshal(objectMap) 85} 86 87// CloudError contains information about an API error. 88type CloudError struct { 89 // Error - Describes a particular API error with an error code and a message. 90 Error *CloudErrorBody `json:"error,omitempty"` 91} 92 93// CloudErrorBody describes a particular API error with an error code and a message. 94type CloudErrorBody struct { 95 // 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. 96 Code *string `json:"code,omitempty"` 97 // Message - A message that describes the error in detail and provides debugging information. 98 Message *string `json:"message,omitempty"` 99 // Target - The target of the particular error (for example, the name of the property in error). 100 Target *string `json:"target,omitempty"` 101 // Details - Contains nested errors that are related to this error. 102 Details *[]CloudErrorBody `json:"details,omitempty"` 103} 104 105// Identity identity for the resource. 106type Identity struct { 107 // PrincipalID - READ-ONLY; The principal ID of resource identity. 108 PrincipalID *string `json:"principalId,omitempty"` 109 // TenantID - READ-ONLY; The tenant ID of resource. 110 TenantID *string `json:"tenantId,omitempty"` 111 // Type - The identity type. Possible values include: 'None', 'SystemAssigned' 112 Type IdentityType `json:"type,omitempty"` 113} 114 115// MarshalJSON is the custom marshaler for Identity. 116func (i Identity) MarshalJSON() ([]byte, error) { 117 objectMap := make(map[string]interface{}) 118 if i.Type != "" { 119 objectMap["type"] = i.Type 120 } 121 return json.Marshal(objectMap) 122} 123 124// IPRule the IP restriction rule of the Azure Cognitive Search service. 125type IPRule struct { 126 // 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. 127 Value *string `json:"value,omitempty"` 128} 129 130// ListQueryKeysResult response containing the query API keys for a given Azure Cognitive Search service. 131type ListQueryKeysResult struct { 132 autorest.Response `json:"-"` 133 // Value - READ-ONLY; The query keys for the Azure Cognitive Search service. 134 Value *[]QueryKey `json:"value,omitempty"` 135 // 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. 136 NextLink *string `json:"nextLink,omitempty"` 137} 138 139// MarshalJSON is the custom marshaler for ListQueryKeysResult. 140func (lqkr ListQueryKeysResult) MarshalJSON() ([]byte, error) { 141 objectMap := make(map[string]interface{}) 142 return json.Marshal(objectMap) 143} 144 145// ListQueryKeysResultIterator provides access to a complete listing of QueryKey values. 146type ListQueryKeysResultIterator struct { 147 i int 148 page ListQueryKeysResultPage 149} 150 151// NextWithContext advances to the next value. If there was an error making 152// the request the iterator does not advance and the error is returned. 153func (iter *ListQueryKeysResultIterator) NextWithContext(ctx context.Context) (err error) { 154 if tracing.IsEnabled() { 155 ctx = tracing.StartSpan(ctx, fqdn+"/ListQueryKeysResultIterator.NextWithContext") 156 defer func() { 157 sc := -1 158 if iter.Response().Response.Response != nil { 159 sc = iter.Response().Response.Response.StatusCode 160 } 161 tracing.EndSpan(ctx, sc, err) 162 }() 163 } 164 iter.i++ 165 if iter.i < len(iter.page.Values()) { 166 return nil 167 } 168 err = iter.page.NextWithContext(ctx) 169 if err != nil { 170 iter.i-- 171 return err 172 } 173 iter.i = 0 174 return nil 175} 176 177// Next advances to the next value. If there was an error making 178// the request the iterator does not advance and the error is returned. 179// Deprecated: Use NextWithContext() instead. 180func (iter *ListQueryKeysResultIterator) Next() error { 181 return iter.NextWithContext(context.Background()) 182} 183 184// NotDone returns true if the enumeration should be started or is not yet complete. 185func (iter ListQueryKeysResultIterator) NotDone() bool { 186 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 187} 188 189// Response returns the raw server response from the last page request. 190func (iter ListQueryKeysResultIterator) Response() ListQueryKeysResult { 191 return iter.page.Response() 192} 193 194// Value returns the current value or a zero-initialized value if the 195// iterator has advanced beyond the end of the collection. 196func (iter ListQueryKeysResultIterator) Value() QueryKey { 197 if !iter.page.NotDone() { 198 return QueryKey{} 199 } 200 return iter.page.Values()[iter.i] 201} 202 203// Creates a new instance of the ListQueryKeysResultIterator type. 204func NewListQueryKeysResultIterator(page ListQueryKeysResultPage) ListQueryKeysResultIterator { 205 return ListQueryKeysResultIterator{page: page} 206} 207 208// IsEmpty returns true if the ListResult contains no values. 209func (lqkr ListQueryKeysResult) IsEmpty() bool { 210 return lqkr.Value == nil || len(*lqkr.Value) == 0 211} 212 213// hasNextLink returns true if the NextLink is not empty. 214func (lqkr ListQueryKeysResult) hasNextLink() bool { 215 return lqkr.NextLink != nil && len(*lqkr.NextLink) != 0 216} 217 218// listQueryKeysResultPreparer prepares a request to retrieve the next set of results. 219// It returns nil if no more results exist. 220func (lqkr ListQueryKeysResult) listQueryKeysResultPreparer(ctx context.Context) (*http.Request, error) { 221 if !lqkr.hasNextLink() { 222 return nil, nil 223 } 224 return autorest.Prepare((&http.Request{}).WithContext(ctx), 225 autorest.AsJSON(), 226 autorest.AsGet(), 227 autorest.WithBaseURL(to.String(lqkr.NextLink))) 228} 229 230// ListQueryKeysResultPage contains a page of QueryKey values. 231type ListQueryKeysResultPage struct { 232 fn func(context.Context, ListQueryKeysResult) (ListQueryKeysResult, error) 233 lqkr ListQueryKeysResult 234} 235 236// NextWithContext advances to the next page of values. If there was an error making 237// the request the page does not advance and the error is returned. 238func (page *ListQueryKeysResultPage) NextWithContext(ctx context.Context) (err error) { 239 if tracing.IsEnabled() { 240 ctx = tracing.StartSpan(ctx, fqdn+"/ListQueryKeysResultPage.NextWithContext") 241 defer func() { 242 sc := -1 243 if page.Response().Response.Response != nil { 244 sc = page.Response().Response.Response.StatusCode 245 } 246 tracing.EndSpan(ctx, sc, err) 247 }() 248 } 249 for { 250 next, err := page.fn(ctx, page.lqkr) 251 if err != nil { 252 return err 253 } 254 page.lqkr = next 255 if !next.hasNextLink() || !next.IsEmpty() { 256 break 257 } 258 } 259 return nil 260} 261 262// Next advances to the next page of values. If there was an error making 263// the request the page does not advance and the error is returned. 264// Deprecated: Use NextWithContext() instead. 265func (page *ListQueryKeysResultPage) Next() error { 266 return page.NextWithContext(context.Background()) 267} 268 269// NotDone returns true if the page enumeration should be started or is not yet complete. 270func (page ListQueryKeysResultPage) NotDone() bool { 271 return !page.lqkr.IsEmpty() 272} 273 274// Response returns the raw server response from the last page request. 275func (page ListQueryKeysResultPage) Response() ListQueryKeysResult { 276 return page.lqkr 277} 278 279// Values returns the slice of values for the current page or nil if there are no values. 280func (page ListQueryKeysResultPage) Values() []QueryKey { 281 if page.lqkr.IsEmpty() { 282 return nil 283 } 284 return *page.lqkr.Value 285} 286 287// Creates a new instance of the ListQueryKeysResultPage type. 288func NewListQueryKeysResultPage(cur ListQueryKeysResult, getNextPage func(context.Context, ListQueryKeysResult) (ListQueryKeysResult, error)) ListQueryKeysResultPage { 289 return ListQueryKeysResultPage{ 290 fn: getNextPage, 291 lqkr: cur, 292 } 293} 294 295// NetworkRuleSet network specific rules that determine how the Azure Cognitive Search service may be 296// reached. 297type NetworkRuleSet struct { 298 // 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. 299 IPRules *[]IPRule `json:"ipRules,omitempty"` 300} 301 302// Operation describes a REST API operation. 303type Operation struct { 304 // Name - READ-ONLY; The name of the operation. This name is of the form {provider}/{resource}/{operation}. 305 Name *string `json:"name,omitempty"` 306 // Display - READ-ONLY; The object that describes the operation. 307 Display *OperationDisplay `json:"display,omitempty"` 308} 309 310// MarshalJSON is the custom marshaler for Operation. 311func (o Operation) MarshalJSON() ([]byte, error) { 312 objectMap := make(map[string]interface{}) 313 return json.Marshal(objectMap) 314} 315 316// OperationDisplay the object that describes the operation. 317type OperationDisplay struct { 318 // Provider - READ-ONLY; The friendly name of the resource provider. 319 Provider *string `json:"provider,omitempty"` 320 // Operation - READ-ONLY; The operation type: read, write, delete, listKeys/action, etc. 321 Operation *string `json:"operation,omitempty"` 322 // Resource - READ-ONLY; The resource type on which the operation is performed. 323 Resource *string `json:"resource,omitempty"` 324 // Description - READ-ONLY; The friendly name of the operation. 325 Description *string `json:"description,omitempty"` 326} 327 328// MarshalJSON is the custom marshaler for OperationDisplay. 329func (o OperationDisplay) MarshalJSON() ([]byte, error) { 330 objectMap := make(map[string]interface{}) 331 return json.Marshal(objectMap) 332} 333 334// OperationListResult the result of the request to list REST API operations. It contains a list of 335// operations and a URL to get the next set of results. 336type OperationListResult struct { 337 autorest.Response `json:"-"` 338 // Value - READ-ONLY; The list of operations supported by the resource provider. 339 Value *[]Operation `json:"value,omitempty"` 340 // NextLink - READ-ONLY; The URL to get the next set of operation list results, if any. 341 NextLink *string `json:"nextLink,omitempty"` 342} 343 344// MarshalJSON is the custom marshaler for OperationListResult. 345func (olr OperationListResult) MarshalJSON() ([]byte, error) { 346 objectMap := make(map[string]interface{}) 347 return json.Marshal(objectMap) 348} 349 350// PrivateEndpointConnection describes an existing Private Endpoint connection to the Azure Cognitive 351// Search service. 352type PrivateEndpointConnection struct { 353 autorest.Response `json:"-"` 354 // Properties - Describes the properties of an existing Private Endpoint connection to the Azure Cognitive Search service. 355 Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` 356 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 357 ID *string `json:"id,omitempty"` 358 // Name - READ-ONLY; The name of the resource 359 Name *string `json:"name,omitempty"` 360 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 361 Type *string `json:"type,omitempty"` 362} 363 364// MarshalJSON is the custom marshaler for PrivateEndpointConnection. 365func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { 366 objectMap := make(map[string]interface{}) 367 if pec.Properties != nil { 368 objectMap["properties"] = pec.Properties 369 } 370 return json.Marshal(objectMap) 371} 372 373// PrivateEndpointConnectionListResult response containing a list of Private Endpoint connections. 374type PrivateEndpointConnectionListResult struct { 375 autorest.Response `json:"-"` 376 // Value - READ-ONLY; The list of Private Endpoint connections. 377 Value *[]PrivateEndpointConnection `json:"value,omitempty"` 378 // 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. 379 NextLink *string `json:"nextLink,omitempty"` 380} 381 382// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. 383func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { 384 objectMap := make(map[string]interface{}) 385 return json.Marshal(objectMap) 386} 387 388// PrivateEndpointConnectionListResultIterator provides access to a complete listing of 389// PrivateEndpointConnection values. 390type PrivateEndpointConnectionListResultIterator struct { 391 i int 392 page PrivateEndpointConnectionListResultPage 393} 394 395// NextWithContext advances to the next value. If there was an error making 396// the request the iterator does not advance and the error is returned. 397func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { 398 if tracing.IsEnabled() { 399 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") 400 defer func() { 401 sc := -1 402 if iter.Response().Response.Response != nil { 403 sc = iter.Response().Response.Response.StatusCode 404 } 405 tracing.EndSpan(ctx, sc, err) 406 }() 407 } 408 iter.i++ 409 if iter.i < len(iter.page.Values()) { 410 return nil 411 } 412 err = iter.page.NextWithContext(ctx) 413 if err != nil { 414 iter.i-- 415 return err 416 } 417 iter.i = 0 418 return nil 419} 420 421// Next advances to the next value. If there was an error making 422// the request the iterator does not advance and the error is returned. 423// Deprecated: Use NextWithContext() instead. 424func (iter *PrivateEndpointConnectionListResultIterator) Next() error { 425 return iter.NextWithContext(context.Background()) 426} 427 428// NotDone returns true if the enumeration should be started or is not yet complete. 429func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { 430 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 431} 432 433// Response returns the raw server response from the last page request. 434func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { 435 return iter.page.Response() 436} 437 438// Value returns the current value or a zero-initialized value if the 439// iterator has advanced beyond the end of the collection. 440func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { 441 if !iter.page.NotDone() { 442 return PrivateEndpointConnection{} 443 } 444 return iter.page.Values()[iter.i] 445} 446 447// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. 448func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { 449 return PrivateEndpointConnectionListResultIterator{page: page} 450} 451 452// IsEmpty returns true if the ListResult contains no values. 453func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { 454 return peclr.Value == nil || len(*peclr.Value) == 0 455} 456 457// hasNextLink returns true if the NextLink is not empty. 458func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { 459 return peclr.NextLink != nil && len(*peclr.NextLink) != 0 460} 461 462// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. 463// It returns nil if no more results exist. 464func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { 465 if !peclr.hasNextLink() { 466 return nil, nil 467 } 468 return autorest.Prepare((&http.Request{}).WithContext(ctx), 469 autorest.AsJSON(), 470 autorest.AsGet(), 471 autorest.WithBaseURL(to.String(peclr.NextLink))) 472} 473 474// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. 475type PrivateEndpointConnectionListResultPage struct { 476 fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) 477 peclr PrivateEndpointConnectionListResult 478} 479 480// NextWithContext advances to the next page of values. If there was an error making 481// the request the page does not advance and the error is returned. 482func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { 483 if tracing.IsEnabled() { 484 ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") 485 defer func() { 486 sc := -1 487 if page.Response().Response.Response != nil { 488 sc = page.Response().Response.Response.StatusCode 489 } 490 tracing.EndSpan(ctx, sc, err) 491 }() 492 } 493 for { 494 next, err := page.fn(ctx, page.peclr) 495 if err != nil { 496 return err 497 } 498 page.peclr = next 499 if !next.hasNextLink() || !next.IsEmpty() { 500 break 501 } 502 } 503 return nil 504} 505 506// Next advances to the next page of values. If there was an error making 507// the request the page does not advance and the error is returned. 508// Deprecated: Use NextWithContext() instead. 509func (page *PrivateEndpointConnectionListResultPage) Next() error { 510 return page.NextWithContext(context.Background()) 511} 512 513// NotDone returns true if the page enumeration should be started or is not yet complete. 514func (page PrivateEndpointConnectionListResultPage) NotDone() bool { 515 return !page.peclr.IsEmpty() 516} 517 518// Response returns the raw server response from the last page request. 519func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { 520 return page.peclr 521} 522 523// Values returns the slice of values for the current page or nil if there are no values. 524func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { 525 if page.peclr.IsEmpty() { 526 return nil 527 } 528 return *page.peclr.Value 529} 530 531// Creates a new instance of the PrivateEndpointConnectionListResultPage type. 532func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { 533 return PrivateEndpointConnectionListResultPage{ 534 fn: getNextPage, 535 peclr: cur, 536 } 537} 538 539// PrivateEndpointConnectionProperties describes the properties of an existing Private Endpoint connection 540// to the Azure Cognitive Search service. 541type PrivateEndpointConnectionProperties struct { 542 // PrivateEndpoint - The private endpoint resource from Microsoft.Network provider. 543 PrivateEndpoint *PrivateEndpointConnectionPropertiesPrivateEndpoint `json:"privateEndpoint,omitempty"` 544 // PrivateLinkServiceConnectionState - Describes the current state of an existing Private Link Service connection to the Azure Private Endpoint. 545 PrivateLinkServiceConnectionState *PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` 546} 547 548// PrivateEndpointConnectionPropertiesPrivateEndpoint the private endpoint resource from Microsoft.Network 549// provider. 550type PrivateEndpointConnectionPropertiesPrivateEndpoint struct { 551 // ID - The resource id of the private endpoint resource from Microsoft.Network provider. 552 ID *string `json:"id,omitempty"` 553} 554 555// PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState describes the current state of an 556// existing Private Link Service connection to the Azure Private Endpoint. 557type PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState struct { 558 // Status - Status of the the private link service connection. Can be Pending, Approved, Rejected, or Disconnected. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' 559 Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` 560 // Description - The description for the private link service connection state. 561 Description *string `json:"description,omitempty"` 562 // ActionsRequired - A description of any extra actions that may be required. 563 ActionsRequired *string `json:"actionsRequired,omitempty"` 564} 565 566// PrivateLinkResource describes a supported private link resource for the Azure Cognitive Search service. 567type PrivateLinkResource struct { 568 // Properties - READ-ONLY; Describes the properties of a supported private link resource for the Azure Cognitive Search service. 569 Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` 570 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 571 ID *string `json:"id,omitempty"` 572 // Name - READ-ONLY; The name of the resource 573 Name *string `json:"name,omitempty"` 574 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 575 Type *string `json:"type,omitempty"` 576} 577 578// MarshalJSON is the custom marshaler for PrivateLinkResource. 579func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { 580 objectMap := make(map[string]interface{}) 581 return json.Marshal(objectMap) 582} 583 584// PrivateLinkResourceProperties describes the properties of a supported private link resource for the 585// Azure Cognitive Search service. For a given API version, this represents the 'supported' groupIds when 586// creating a shared private link resource. 587type PrivateLinkResourceProperties struct { 588 // GroupID - READ-ONLY; The group ID of the private link resource. 589 GroupID *string `json:"groupId,omitempty"` 590 // RequiredMembers - READ-ONLY; The list of required members of the private link resource. 591 RequiredMembers *[]string `json:"requiredMembers,omitempty"` 592 // RequiredZoneNames - READ-ONLY; The list of required DNS zone names of the private link resource. 593 RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` 594 // ShareablePrivateLinkResourceTypes - READ-ONLY; The list of resources that are onboarded to private link service, that are supported by Azure Cognitive Search. 595 ShareablePrivateLinkResourceTypes *[]ShareablePrivateLinkResourceType `json:"shareablePrivateLinkResourceTypes,omitempty"` 596} 597 598// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. 599func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { 600 objectMap := make(map[string]interface{}) 601 return json.Marshal(objectMap) 602} 603 604// PrivateLinkResourcesResult response containing a list of supported Private Link Resources. 605type PrivateLinkResourcesResult struct { 606 autorest.Response `json:"-"` 607 // Value - READ-ONLY; The list of supported Private Link Resources. 608 Value *[]PrivateLinkResource `json:"value,omitempty"` 609} 610 611// MarshalJSON is the custom marshaler for PrivateLinkResourcesResult. 612func (plrr PrivateLinkResourcesResult) MarshalJSON() ([]byte, error) { 613 objectMap := make(map[string]interface{}) 614 return json.Marshal(objectMap) 615} 616 617// ProxyResource the resource model definition for an Azure Resource Manager proxy resource. It will have 618// everything other than required location and tags 619type ProxyResource struct { 620 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 621 ID *string `json:"id,omitempty"` 622 // Name - READ-ONLY; The name of the resource 623 Name *string `json:"name,omitempty"` 624 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 625 Type *string `json:"type,omitempty"` 626} 627 628// MarshalJSON is the custom marshaler for ProxyResource. 629func (pr ProxyResource) MarshalJSON() ([]byte, error) { 630 objectMap := make(map[string]interface{}) 631 return json.Marshal(objectMap) 632} 633 634// QueryKey describes an API key for a given Azure Cognitive Search service that has permissions for query 635// operations only. 636type QueryKey struct { 637 autorest.Response `json:"-"` 638 // Name - READ-ONLY; The name of the query API key; may be empty. 639 Name *string `json:"name,omitempty"` 640 // Key - READ-ONLY; The value of the query API key. 641 Key *string `json:"key,omitempty"` 642} 643 644// MarshalJSON is the custom marshaler for QueryKey. 645func (qk QueryKey) MarshalJSON() ([]byte, error) { 646 objectMap := make(map[string]interface{}) 647 return json.Marshal(objectMap) 648} 649 650// Resource common fields that are returned in the response for all Azure Resource Manager resources 651type Resource struct { 652 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 653 ID *string `json:"id,omitempty"` 654 // Name - READ-ONLY; The name of the resource 655 Name *string `json:"name,omitempty"` 656 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 657 Type *string `json:"type,omitempty"` 658} 659 660// MarshalJSON is the custom marshaler for Resource. 661func (r Resource) MarshalJSON() ([]byte, error) { 662 objectMap := make(map[string]interface{}) 663 return json.Marshal(objectMap) 664} 665 666// Service describes an Azure Cognitive Search service and its current state. 667type Service struct { 668 autorest.Response `json:"-"` 669 // ServiceProperties - Properties of the search service. 670 *ServiceProperties `json:"properties,omitempty"` 671 // Sku - The SKU of the Search Service, which determines price tier and capacity limits. This property is required when creating a new Search Service. 672 Sku *Sku `json:"sku,omitempty"` 673 // Identity - The identity of the resource. 674 Identity *Identity `json:"identity,omitempty"` 675 // Tags - Resource tags. 676 Tags map[string]*string `json:"tags"` 677 // Location - The geo-location where the resource lives 678 Location *string `json:"location,omitempty"` 679 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 680 ID *string `json:"id,omitempty"` 681 // Name - READ-ONLY; The name of the resource 682 Name *string `json:"name,omitempty"` 683 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 684 Type *string `json:"type,omitempty"` 685} 686 687// MarshalJSON is the custom marshaler for Service. 688func (s Service) MarshalJSON() ([]byte, error) { 689 objectMap := make(map[string]interface{}) 690 if s.ServiceProperties != nil { 691 objectMap["properties"] = s.ServiceProperties 692 } 693 if s.Sku != nil { 694 objectMap["sku"] = s.Sku 695 } 696 if s.Identity != nil { 697 objectMap["identity"] = s.Identity 698 } 699 if s.Tags != nil { 700 objectMap["tags"] = s.Tags 701 } 702 if s.Location != nil { 703 objectMap["location"] = s.Location 704 } 705 return json.Marshal(objectMap) 706} 707 708// UnmarshalJSON is the custom unmarshaler for Service struct. 709func (s *Service) UnmarshalJSON(body []byte) error { 710 var m map[string]*json.RawMessage 711 err := json.Unmarshal(body, &m) 712 if err != nil { 713 return err 714 } 715 for k, v := range m { 716 switch k { 717 case "properties": 718 if v != nil { 719 var serviceProperties ServiceProperties 720 err = json.Unmarshal(*v, &serviceProperties) 721 if err != nil { 722 return err 723 } 724 s.ServiceProperties = &serviceProperties 725 } 726 case "sku": 727 if v != nil { 728 var sku Sku 729 err = json.Unmarshal(*v, &sku) 730 if err != nil { 731 return err 732 } 733 s.Sku = &sku 734 } 735 case "identity": 736 if v != nil { 737 var identity Identity 738 err = json.Unmarshal(*v, &identity) 739 if err != nil { 740 return err 741 } 742 s.Identity = &identity 743 } 744 case "tags": 745 if v != nil { 746 var tags map[string]*string 747 err = json.Unmarshal(*v, &tags) 748 if err != nil { 749 return err 750 } 751 s.Tags = tags 752 } 753 case "location": 754 if v != nil { 755 var location string 756 err = json.Unmarshal(*v, &location) 757 if err != nil { 758 return err 759 } 760 s.Location = &location 761 } 762 case "id": 763 if v != nil { 764 var ID string 765 err = json.Unmarshal(*v, &ID) 766 if err != nil { 767 return err 768 } 769 s.ID = &ID 770 } 771 case "name": 772 if v != nil { 773 var name string 774 err = json.Unmarshal(*v, &name) 775 if err != nil { 776 return err 777 } 778 s.Name = &name 779 } 780 case "type": 781 if v != nil { 782 var typeVar string 783 err = json.Unmarshal(*v, &typeVar) 784 if err != nil { 785 return err 786 } 787 s.Type = &typeVar 788 } 789 } 790 } 791 792 return nil 793} 794 795// ServiceListResult response containing a list of Azure Cognitive Search services. 796type ServiceListResult struct { 797 autorest.Response `json:"-"` 798 // Value - READ-ONLY; The list of search services. 799 Value *[]Service `json:"value,omitempty"` 800 // 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. 801 NextLink *string `json:"nextLink,omitempty"` 802} 803 804// MarshalJSON is the custom marshaler for ServiceListResult. 805func (slr ServiceListResult) MarshalJSON() ([]byte, error) { 806 objectMap := make(map[string]interface{}) 807 return json.Marshal(objectMap) 808} 809 810// ServiceListResultIterator provides access to a complete listing of Service values. 811type ServiceListResultIterator struct { 812 i int 813 page ServiceListResultPage 814} 815 816// NextWithContext advances to the next value. If there was an error making 817// the request the iterator does not advance and the error is returned. 818func (iter *ServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { 819 if tracing.IsEnabled() { 820 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultIterator.NextWithContext") 821 defer func() { 822 sc := -1 823 if iter.Response().Response.Response != nil { 824 sc = iter.Response().Response.Response.StatusCode 825 } 826 tracing.EndSpan(ctx, sc, err) 827 }() 828 } 829 iter.i++ 830 if iter.i < len(iter.page.Values()) { 831 return nil 832 } 833 err = iter.page.NextWithContext(ctx) 834 if err != nil { 835 iter.i-- 836 return err 837 } 838 iter.i = 0 839 return nil 840} 841 842// Next advances to the next value. If there was an error making 843// the request the iterator does not advance and the error is returned. 844// Deprecated: Use NextWithContext() instead. 845func (iter *ServiceListResultIterator) Next() error { 846 return iter.NextWithContext(context.Background()) 847} 848 849// NotDone returns true if the enumeration should be started or is not yet complete. 850func (iter ServiceListResultIterator) NotDone() bool { 851 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 852} 853 854// Response returns the raw server response from the last page request. 855func (iter ServiceListResultIterator) Response() ServiceListResult { 856 return iter.page.Response() 857} 858 859// Value returns the current value or a zero-initialized value if the 860// iterator has advanced beyond the end of the collection. 861func (iter ServiceListResultIterator) Value() Service { 862 if !iter.page.NotDone() { 863 return Service{} 864 } 865 return iter.page.Values()[iter.i] 866} 867 868// Creates a new instance of the ServiceListResultIterator type. 869func NewServiceListResultIterator(page ServiceListResultPage) ServiceListResultIterator { 870 return ServiceListResultIterator{page: page} 871} 872 873// IsEmpty returns true if the ListResult contains no values. 874func (slr ServiceListResult) IsEmpty() bool { 875 return slr.Value == nil || len(*slr.Value) == 0 876} 877 878// hasNextLink returns true if the NextLink is not empty. 879func (slr ServiceListResult) hasNextLink() bool { 880 return slr.NextLink != nil && len(*slr.NextLink) != 0 881} 882 883// serviceListResultPreparer prepares a request to retrieve the next set of results. 884// It returns nil if no more results exist. 885func (slr ServiceListResult) serviceListResultPreparer(ctx context.Context) (*http.Request, error) { 886 if !slr.hasNextLink() { 887 return nil, nil 888 } 889 return autorest.Prepare((&http.Request{}).WithContext(ctx), 890 autorest.AsJSON(), 891 autorest.AsGet(), 892 autorest.WithBaseURL(to.String(slr.NextLink))) 893} 894 895// ServiceListResultPage contains a page of Service values. 896type ServiceListResultPage struct { 897 fn func(context.Context, ServiceListResult) (ServiceListResult, error) 898 slr ServiceListResult 899} 900 901// NextWithContext advances to the next page of values. If there was an error making 902// the request the page does not advance and the error is returned. 903func (page *ServiceListResultPage) NextWithContext(ctx context.Context) (err error) { 904 if tracing.IsEnabled() { 905 ctx = tracing.StartSpan(ctx, fqdn+"/ServiceListResultPage.NextWithContext") 906 defer func() { 907 sc := -1 908 if page.Response().Response.Response != nil { 909 sc = page.Response().Response.Response.StatusCode 910 } 911 tracing.EndSpan(ctx, sc, err) 912 }() 913 } 914 for { 915 next, err := page.fn(ctx, page.slr) 916 if err != nil { 917 return err 918 } 919 page.slr = next 920 if !next.hasNextLink() || !next.IsEmpty() { 921 break 922 } 923 } 924 return nil 925} 926 927// Next advances to the next page of values. If there was an error making 928// the request the page does not advance and the error is returned. 929// Deprecated: Use NextWithContext() instead. 930func (page *ServiceListResultPage) Next() error { 931 return page.NextWithContext(context.Background()) 932} 933 934// NotDone returns true if the page enumeration should be started or is not yet complete. 935func (page ServiceListResultPage) NotDone() bool { 936 return !page.slr.IsEmpty() 937} 938 939// Response returns the raw server response from the last page request. 940func (page ServiceListResultPage) Response() ServiceListResult { 941 return page.slr 942} 943 944// Values returns the slice of values for the current page or nil if there are no values. 945func (page ServiceListResultPage) Values() []Service { 946 if page.slr.IsEmpty() { 947 return nil 948 } 949 return *page.slr.Value 950} 951 952// Creates a new instance of the ServiceListResultPage type. 953func NewServiceListResultPage(cur ServiceListResult, getNextPage func(context.Context, ServiceListResult) (ServiceListResult, error)) ServiceListResultPage { 954 return ServiceListResultPage{ 955 fn: getNextPage, 956 slr: cur, 957 } 958} 959 960// ServiceProperties properties of the search service. 961type ServiceProperties struct { 962 // 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. 963 ReplicaCount *int32 `json:"replicaCount,omitempty"` 964 // 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. 965 PartitionCount *int32 `json:"partitionCount,omitempty"` 966 // 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' 967 HostingMode HostingMode `json:"hostingMode,omitempty"` 968 // 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' 969 PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` 970 // 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' 971 Status ServiceStatus `json:"status,omitempty"` 972 // StatusDetails - READ-ONLY; The details of the search service status. 973 StatusDetails *string `json:"statusDetails,omitempty"` 974 // 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' 975 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 976 // NetworkRuleSet - Network specific rules that determine how the Azure Cognitive Search service may be reached. 977 NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` 978 // PrivateEndpointConnections - READ-ONLY; The list of private endpoint connections to the Azure Cognitive Search service. 979 PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` 980 // SharedPrivateLinkResources - READ-ONLY; The list of shared private link resources managed by the Azure Cognitive Search service. 981 SharedPrivateLinkResources *[]SharedPrivateLinkResource `json:"sharedPrivateLinkResources,omitempty"` 982} 983 984// MarshalJSON is the custom marshaler for ServiceProperties. 985func (sp ServiceProperties) MarshalJSON() ([]byte, error) { 986 objectMap := make(map[string]interface{}) 987 if sp.ReplicaCount != nil { 988 objectMap["replicaCount"] = sp.ReplicaCount 989 } 990 if sp.PartitionCount != nil { 991 objectMap["partitionCount"] = sp.PartitionCount 992 } 993 if sp.HostingMode != "" { 994 objectMap["hostingMode"] = sp.HostingMode 995 } 996 if sp.PublicNetworkAccess != "" { 997 objectMap["publicNetworkAccess"] = sp.PublicNetworkAccess 998 } 999 if sp.NetworkRuleSet != nil { 1000 objectMap["networkRuleSet"] = sp.NetworkRuleSet 1001 } 1002 return json.Marshal(objectMap) 1003} 1004 1005// ServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 1006// operation. 1007type ServicesCreateOrUpdateFuture struct { 1008 azure.FutureAPI 1009 // Result returns the result of the asynchronous operation. 1010 // If the operation has not completed it will return an error. 1011 Result func(ServicesClient) (Service, error) 1012} 1013 1014// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1015func (future *ServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1016 var azFuture azure.Future 1017 if err := json.Unmarshal(body, &azFuture); err != nil { 1018 return err 1019 } 1020 future.FutureAPI = &azFuture 1021 future.Result = future.result 1022 return nil 1023} 1024 1025// result is the default implementation for ServicesCreateOrUpdateFuture.Result. 1026func (future *ServicesCreateOrUpdateFuture) result(client ServicesClient) (s Service, err error) { 1027 var done bool 1028 done, err = future.DoneWithContext(context.Background(), client) 1029 if err != nil { 1030 err = autorest.NewErrorWithError(err, "search.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1031 return 1032 } 1033 if !done { 1034 s.Response.Response = future.Response() 1035 err = azure.NewAsyncOpIncompleteError("search.ServicesCreateOrUpdateFuture") 1036 return 1037 } 1038 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1039 if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { 1040 s, err = client.CreateOrUpdateResponder(s.Response.Response) 1041 if err != nil { 1042 err = autorest.NewErrorWithError(err, "search.ServicesCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") 1043 } 1044 } 1045 return 1046} 1047 1048// ServiceUpdate the parameters used to update an Azure Cognitive Search service. 1049type ServiceUpdate struct { 1050 // ServiceProperties - Properties of the search service. 1051 *ServiceProperties `json:"properties,omitempty"` 1052 // Sku - The SKU of the Search Service, which determines price tier and capacity limits. This property is required when creating a new Search Service. 1053 Sku *Sku `json:"sku,omitempty"` 1054 // 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. 1055 Location *string `json:"location,omitempty"` 1056 // Tags - Tags to help categorize the resource in the Azure portal. 1057 Tags map[string]*string `json:"tags"` 1058 // Identity - The identity of the resource. 1059 Identity *Identity `json:"identity,omitempty"` 1060 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1061 ID *string `json:"id,omitempty"` 1062 // Name - READ-ONLY; The name of the resource 1063 Name *string `json:"name,omitempty"` 1064 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1065 Type *string `json:"type,omitempty"` 1066} 1067 1068// MarshalJSON is the custom marshaler for ServiceUpdate. 1069func (su ServiceUpdate) MarshalJSON() ([]byte, error) { 1070 objectMap := make(map[string]interface{}) 1071 if su.ServiceProperties != nil { 1072 objectMap["properties"] = su.ServiceProperties 1073 } 1074 if su.Sku != nil { 1075 objectMap["sku"] = su.Sku 1076 } 1077 if su.Location != nil { 1078 objectMap["location"] = su.Location 1079 } 1080 if su.Tags != nil { 1081 objectMap["tags"] = su.Tags 1082 } 1083 if su.Identity != nil { 1084 objectMap["identity"] = su.Identity 1085 } 1086 return json.Marshal(objectMap) 1087} 1088 1089// UnmarshalJSON is the custom unmarshaler for ServiceUpdate struct. 1090func (su *ServiceUpdate) UnmarshalJSON(body []byte) error { 1091 var m map[string]*json.RawMessage 1092 err := json.Unmarshal(body, &m) 1093 if err != nil { 1094 return err 1095 } 1096 for k, v := range m { 1097 switch k { 1098 case "properties": 1099 if v != nil { 1100 var serviceProperties ServiceProperties 1101 err = json.Unmarshal(*v, &serviceProperties) 1102 if err != nil { 1103 return err 1104 } 1105 su.ServiceProperties = &serviceProperties 1106 } 1107 case "sku": 1108 if v != nil { 1109 var sku Sku 1110 err = json.Unmarshal(*v, &sku) 1111 if err != nil { 1112 return err 1113 } 1114 su.Sku = &sku 1115 } 1116 case "location": 1117 if v != nil { 1118 var location string 1119 err = json.Unmarshal(*v, &location) 1120 if err != nil { 1121 return err 1122 } 1123 su.Location = &location 1124 } 1125 case "tags": 1126 if v != nil { 1127 var tags map[string]*string 1128 err = json.Unmarshal(*v, &tags) 1129 if err != nil { 1130 return err 1131 } 1132 su.Tags = tags 1133 } 1134 case "identity": 1135 if v != nil { 1136 var identity Identity 1137 err = json.Unmarshal(*v, &identity) 1138 if err != nil { 1139 return err 1140 } 1141 su.Identity = &identity 1142 } 1143 case "id": 1144 if v != nil { 1145 var ID string 1146 err = json.Unmarshal(*v, &ID) 1147 if err != nil { 1148 return err 1149 } 1150 su.ID = &ID 1151 } 1152 case "name": 1153 if v != nil { 1154 var name string 1155 err = json.Unmarshal(*v, &name) 1156 if err != nil { 1157 return err 1158 } 1159 su.Name = &name 1160 } 1161 case "type": 1162 if v != nil { 1163 var typeVar string 1164 err = json.Unmarshal(*v, &typeVar) 1165 if err != nil { 1166 return err 1167 } 1168 su.Type = &typeVar 1169 } 1170 } 1171 } 1172 1173 return nil 1174} 1175 1176// ShareablePrivateLinkResourceProperties describes the properties of a resource type that has been 1177// onboarded to private link service, supported by Azure Cognitive Search. 1178type ShareablePrivateLinkResourceProperties struct { 1179 // Type - READ-ONLY; The resource provider type for the resource that has been onboarded to private link service, supported by Azure Cognitive Search. 1180 Type *string `json:"type,omitempty"` 1181 // GroupID - READ-ONLY; The resource provider group id for the resource that has been onboarded to private link service, supported by Azure Cognitive Search. 1182 GroupID *string `json:"groupId,omitempty"` 1183 // Description - READ-ONLY; The description of the resource type that has been onboarded to private link service, supported by Azure Cognitive Search. 1184 Description *string `json:"description,omitempty"` 1185} 1186 1187// MarshalJSON is the custom marshaler for ShareablePrivateLinkResourceProperties. 1188func (splrp ShareablePrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { 1189 objectMap := make(map[string]interface{}) 1190 return json.Marshal(objectMap) 1191} 1192 1193// ShareablePrivateLinkResourceType describes an resource type that has been onboarded to private link 1194// service, supported by Azure Cognitive Search. 1195type ShareablePrivateLinkResourceType struct { 1196 // Name - READ-ONLY; The name of the resource type that has been onboarded to private link service, supported by Azure Cognitive Search. 1197 Name *string `json:"name,omitempty"` 1198 // Properties - READ-ONLY; Describes the properties of a resource type that has been onboarded to private link service, supported by Azure Cognitive Search. 1199 Properties *ShareablePrivateLinkResourceProperties `json:"properties,omitempty"` 1200} 1201 1202// MarshalJSON is the custom marshaler for ShareablePrivateLinkResourceType. 1203func (splrt ShareablePrivateLinkResourceType) MarshalJSON() ([]byte, error) { 1204 objectMap := make(map[string]interface{}) 1205 return json.Marshal(objectMap) 1206} 1207 1208// SharedPrivateLinkResource describes a Shared Private Link Resource managed by the Azure Cognitive Search 1209// service. 1210type SharedPrivateLinkResource struct { 1211 autorest.Response `json:"-"` 1212 // Properties - Describes the properties of a Shared Private Link Resource managed by the Azure Cognitive Search service. 1213 Properties *SharedPrivateLinkResourceProperties `json:"properties,omitempty"` 1214 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1215 ID *string `json:"id,omitempty"` 1216 // Name - READ-ONLY; The name of the resource 1217 Name *string `json:"name,omitempty"` 1218 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1219 Type *string `json:"type,omitempty"` 1220} 1221 1222// MarshalJSON is the custom marshaler for SharedPrivateLinkResource. 1223func (splr SharedPrivateLinkResource) MarshalJSON() ([]byte, error) { 1224 objectMap := make(map[string]interface{}) 1225 if splr.Properties != nil { 1226 objectMap["properties"] = splr.Properties 1227 } 1228 return json.Marshal(objectMap) 1229} 1230 1231// SharedPrivateLinkResourceListResult response containing a list of Shared Private Link Resources. 1232type SharedPrivateLinkResourceListResult struct { 1233 autorest.Response `json:"-"` 1234 // Value - READ-ONLY; The list of Shared Private Link Resources. 1235 Value *[]SharedPrivateLinkResource `json:"value,omitempty"` 1236 // NextLink - The URL to get the next set of shared private link resources, if there are any. 1237 NextLink *string `json:"nextLink,omitempty"` 1238} 1239 1240// MarshalJSON is the custom marshaler for SharedPrivateLinkResourceListResult. 1241func (splrlr SharedPrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { 1242 objectMap := make(map[string]interface{}) 1243 if splrlr.NextLink != nil { 1244 objectMap["nextLink"] = splrlr.NextLink 1245 } 1246 return json.Marshal(objectMap) 1247} 1248 1249// SharedPrivateLinkResourceListResultIterator provides access to a complete listing of 1250// SharedPrivateLinkResource values. 1251type SharedPrivateLinkResourceListResultIterator struct { 1252 i int 1253 page SharedPrivateLinkResourceListResultPage 1254} 1255 1256// NextWithContext advances to the next value. If there was an error making 1257// the request the iterator does not advance and the error is returned. 1258func (iter *SharedPrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { 1259 if tracing.IsEnabled() { 1260 ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourceListResultIterator.NextWithContext") 1261 defer func() { 1262 sc := -1 1263 if iter.Response().Response.Response != nil { 1264 sc = iter.Response().Response.Response.StatusCode 1265 } 1266 tracing.EndSpan(ctx, sc, err) 1267 }() 1268 } 1269 iter.i++ 1270 if iter.i < len(iter.page.Values()) { 1271 return nil 1272 } 1273 err = iter.page.NextWithContext(ctx) 1274 if err != nil { 1275 iter.i-- 1276 return err 1277 } 1278 iter.i = 0 1279 return nil 1280} 1281 1282// Next advances to the next value. If there was an error making 1283// the request the iterator does not advance and the error is returned. 1284// Deprecated: Use NextWithContext() instead. 1285func (iter *SharedPrivateLinkResourceListResultIterator) Next() error { 1286 return iter.NextWithContext(context.Background()) 1287} 1288 1289// NotDone returns true if the enumeration should be started or is not yet complete. 1290func (iter SharedPrivateLinkResourceListResultIterator) NotDone() bool { 1291 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1292} 1293 1294// Response returns the raw server response from the last page request. 1295func (iter SharedPrivateLinkResourceListResultIterator) Response() SharedPrivateLinkResourceListResult { 1296 return iter.page.Response() 1297} 1298 1299// Value returns the current value or a zero-initialized value if the 1300// iterator has advanced beyond the end of the collection. 1301func (iter SharedPrivateLinkResourceListResultIterator) Value() SharedPrivateLinkResource { 1302 if !iter.page.NotDone() { 1303 return SharedPrivateLinkResource{} 1304 } 1305 return iter.page.Values()[iter.i] 1306} 1307 1308// Creates a new instance of the SharedPrivateLinkResourceListResultIterator type. 1309func NewSharedPrivateLinkResourceListResultIterator(page SharedPrivateLinkResourceListResultPage) SharedPrivateLinkResourceListResultIterator { 1310 return SharedPrivateLinkResourceListResultIterator{page: page} 1311} 1312 1313// IsEmpty returns true if the ListResult contains no values. 1314func (splrlr SharedPrivateLinkResourceListResult) IsEmpty() bool { 1315 return splrlr.Value == nil || len(*splrlr.Value) == 0 1316} 1317 1318// hasNextLink returns true if the NextLink is not empty. 1319func (splrlr SharedPrivateLinkResourceListResult) hasNextLink() bool { 1320 return splrlr.NextLink != nil && len(*splrlr.NextLink) != 0 1321} 1322 1323// sharedPrivateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. 1324// It returns nil if no more results exist. 1325func (splrlr SharedPrivateLinkResourceListResult) sharedPrivateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { 1326 if !splrlr.hasNextLink() { 1327 return nil, nil 1328 } 1329 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1330 autorest.AsJSON(), 1331 autorest.AsGet(), 1332 autorest.WithBaseURL(to.String(splrlr.NextLink))) 1333} 1334 1335// SharedPrivateLinkResourceListResultPage contains a page of SharedPrivateLinkResource values. 1336type SharedPrivateLinkResourceListResultPage struct { 1337 fn func(context.Context, SharedPrivateLinkResourceListResult) (SharedPrivateLinkResourceListResult, error) 1338 splrlr SharedPrivateLinkResourceListResult 1339} 1340 1341// NextWithContext advances to the next page of values. If there was an error making 1342// the request the page does not advance and the error is returned. 1343func (page *SharedPrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { 1344 if tracing.IsEnabled() { 1345 ctx = tracing.StartSpan(ctx, fqdn+"/SharedPrivateLinkResourceListResultPage.NextWithContext") 1346 defer func() { 1347 sc := -1 1348 if page.Response().Response.Response != nil { 1349 sc = page.Response().Response.Response.StatusCode 1350 } 1351 tracing.EndSpan(ctx, sc, err) 1352 }() 1353 } 1354 for { 1355 next, err := page.fn(ctx, page.splrlr) 1356 if err != nil { 1357 return err 1358 } 1359 page.splrlr = next 1360 if !next.hasNextLink() || !next.IsEmpty() { 1361 break 1362 } 1363 } 1364 return nil 1365} 1366 1367// Next advances to the next page of values. If there was an error making 1368// the request the page does not advance and the error is returned. 1369// Deprecated: Use NextWithContext() instead. 1370func (page *SharedPrivateLinkResourceListResultPage) Next() error { 1371 return page.NextWithContext(context.Background()) 1372} 1373 1374// NotDone returns true if the page enumeration should be started or is not yet complete. 1375func (page SharedPrivateLinkResourceListResultPage) NotDone() bool { 1376 return !page.splrlr.IsEmpty() 1377} 1378 1379// Response returns the raw server response from the last page request. 1380func (page SharedPrivateLinkResourceListResultPage) Response() SharedPrivateLinkResourceListResult { 1381 return page.splrlr 1382} 1383 1384// Values returns the slice of values for the current page or nil if there are no values. 1385func (page SharedPrivateLinkResourceListResultPage) Values() []SharedPrivateLinkResource { 1386 if page.splrlr.IsEmpty() { 1387 return nil 1388 } 1389 return *page.splrlr.Value 1390} 1391 1392// Creates a new instance of the SharedPrivateLinkResourceListResultPage type. 1393func NewSharedPrivateLinkResourceListResultPage(cur SharedPrivateLinkResourceListResult, getNextPage func(context.Context, SharedPrivateLinkResourceListResult) (SharedPrivateLinkResourceListResult, error)) SharedPrivateLinkResourceListResultPage { 1394 return SharedPrivateLinkResourceListResultPage{ 1395 fn: getNextPage, 1396 splrlr: cur, 1397 } 1398} 1399 1400// SharedPrivateLinkResourceProperties describes the properties of an existing Shared Private Link Resource 1401// managed by the Azure Cognitive Search service. 1402type SharedPrivateLinkResourceProperties struct { 1403 // PrivateLinkResourceID - The resource id of the resource the shared private link resource is for. 1404 PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` 1405 // GroupID - The group id from the provider of resource the shared private link resource is for. 1406 GroupID *string `json:"groupId,omitempty"` 1407 // RequestMessage - The request message for requesting approval of the shared private link resource. 1408 RequestMessage *string `json:"requestMessage,omitempty"` 1409 // ResourceRegion - Optional. Can be used to specify the Azure Resource Manager location of the resource to which a shared private link is to be created. This is only required for those resources whose DNS configuration are regional (such as Azure Kubernetes Service). 1410 ResourceRegion *string `json:"resourceRegion,omitempty"` 1411 // Status - Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected. Possible values include: 'SharedPrivateLinkResourceStatusPending', 'SharedPrivateLinkResourceStatusApproved', 'SharedPrivateLinkResourceStatusRejected', 'SharedPrivateLinkResourceStatusDisconnected' 1412 Status SharedPrivateLinkResourceStatus `json:"status,omitempty"` 1413 // ProvisioningState - The provisioning state of the shared private link resource. Can be Updating, Deleting, Failed, Succeeded or Incomplete. Possible values include: 'SharedPrivateLinkResourceProvisioningStateUpdating', 'SharedPrivateLinkResourceProvisioningStateDeleting', 'SharedPrivateLinkResourceProvisioningStateFailed', 'SharedPrivateLinkResourceProvisioningStateSucceeded', 'SharedPrivateLinkResourceProvisioningStateIncomplete' 1414 ProvisioningState SharedPrivateLinkResourceProvisioningState `json:"provisioningState,omitempty"` 1415} 1416 1417// SharedPrivateLinkResourcesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results 1418// of a long-running operation. 1419type SharedPrivateLinkResourcesCreateOrUpdateFuture struct { 1420 azure.FutureAPI 1421 // Result returns the result of the asynchronous operation. 1422 // If the operation has not completed it will return an error. 1423 Result func(SharedPrivateLinkResourcesClient) (SharedPrivateLinkResource, error) 1424} 1425 1426// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1427func (future *SharedPrivateLinkResourcesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1428 var azFuture azure.Future 1429 if err := json.Unmarshal(body, &azFuture); err != nil { 1430 return err 1431 } 1432 future.FutureAPI = &azFuture 1433 future.Result = future.result 1434 return nil 1435} 1436 1437// result is the default implementation for SharedPrivateLinkResourcesCreateOrUpdateFuture.Result. 1438func (future *SharedPrivateLinkResourcesCreateOrUpdateFuture) result(client SharedPrivateLinkResourcesClient) (splr SharedPrivateLinkResource, err error) { 1439 var done bool 1440 done, err = future.DoneWithContext(context.Background(), client) 1441 if err != nil { 1442 err = autorest.NewErrorWithError(err, "search.SharedPrivateLinkResourcesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1443 return 1444 } 1445 if !done { 1446 splr.Response.Response = future.Response() 1447 err = azure.NewAsyncOpIncompleteError("search.SharedPrivateLinkResourcesCreateOrUpdateFuture") 1448 return 1449 } 1450 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1451 if splr.Response.Response, err = future.GetResult(sender); err == nil && splr.Response.Response.StatusCode != http.StatusNoContent { 1452 splr, err = client.CreateOrUpdateResponder(splr.Response.Response) 1453 if err != nil { 1454 err = autorest.NewErrorWithError(err, "search.SharedPrivateLinkResourcesCreateOrUpdateFuture", "Result", splr.Response.Response, "Failure responding to request") 1455 } 1456 } 1457 return 1458} 1459 1460// SharedPrivateLinkResourcesDeleteFuture an abstraction for monitoring and retrieving the results of a 1461// long-running operation. 1462type SharedPrivateLinkResourcesDeleteFuture struct { 1463 azure.FutureAPI 1464 // Result returns the result of the asynchronous operation. 1465 // If the operation has not completed it will return an error. 1466 Result func(SharedPrivateLinkResourcesClient) (autorest.Response, error) 1467} 1468 1469// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1470func (future *SharedPrivateLinkResourcesDeleteFuture) UnmarshalJSON(body []byte) error { 1471 var azFuture azure.Future 1472 if err := json.Unmarshal(body, &azFuture); err != nil { 1473 return err 1474 } 1475 future.FutureAPI = &azFuture 1476 future.Result = future.result 1477 return nil 1478} 1479 1480// result is the default implementation for SharedPrivateLinkResourcesDeleteFuture.Result. 1481func (future *SharedPrivateLinkResourcesDeleteFuture) result(client SharedPrivateLinkResourcesClient) (ar autorest.Response, err error) { 1482 var done bool 1483 done, err = future.DoneWithContext(context.Background(), client) 1484 if err != nil { 1485 err = autorest.NewErrorWithError(err, "search.SharedPrivateLinkResourcesDeleteFuture", "Result", future.Response(), "Polling failure") 1486 return 1487 } 1488 if !done { 1489 ar.Response = future.Response() 1490 err = azure.NewAsyncOpIncompleteError("search.SharedPrivateLinkResourcesDeleteFuture") 1491 return 1492 } 1493 ar.Response = future.Response() 1494 return 1495} 1496 1497// Sku defines the SKU of an Azure Cognitive Search Service, which determines price tier and capacity 1498// limits. 1499type Sku struct { 1500 // 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' 1501 Name SkuName `json:"name,omitempty"` 1502} 1503 1504// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource 1505type TrackedResource struct { 1506 // Tags - Resource tags. 1507 Tags map[string]*string `json:"tags"` 1508 // Location - The geo-location where the resource lives 1509 Location *string `json:"location,omitempty"` 1510 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1511 ID *string `json:"id,omitempty"` 1512 // Name - READ-ONLY; The name of the resource 1513 Name *string `json:"name,omitempty"` 1514 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1515 Type *string `json:"type,omitempty"` 1516} 1517 1518// MarshalJSON is the custom marshaler for TrackedResource. 1519func (tr TrackedResource) MarshalJSON() ([]byte, error) { 1520 objectMap := make(map[string]interface{}) 1521 if tr.Tags != nil { 1522 objectMap["tags"] = tr.Tags 1523 } 1524 if tr.Location != nil { 1525 objectMap["location"] = tr.Location 1526 } 1527 return json.Marshal(objectMap) 1528} 1529