1package operationalinsights 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/operationalinsights/mgmt/2020-10-01/operationalinsights" 21 22// AssociatedWorkspace the list of Log Analytics workspaces associated with the cluster. 23type AssociatedWorkspace struct { 24 // WorkspaceID - READ-ONLY; The id of the assigned workspace. 25 WorkspaceID *string `json:"workspaceId,omitempty"` 26 // WorkspaceName - READ-ONLY; The name id the assigned workspace. 27 WorkspaceName *string `json:"workspaceName,omitempty"` 28 // ResourceID - READ-ONLY; The ResourceId id the assigned workspace. 29 ResourceID *string `json:"resourceId,omitempty"` 30 // AssociateDate - READ-ONLY; The time of workspace association. 31 AssociateDate *string `json:"associateDate,omitempty"` 32} 33 34// MarshalJSON is the custom marshaler for AssociatedWorkspace. 35func (aw AssociatedWorkspace) MarshalJSON() ([]byte, error) { 36 objectMap := make(map[string]interface{}) 37 return json.Marshal(objectMap) 38} 39 40// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. 41type AzureEntityResource struct { 42 // Etag - READ-ONLY; Resource Etag. 43 Etag *string `json:"etag,omitempty"` 44 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 45 ID *string `json:"id,omitempty"` 46 // Name - READ-ONLY; The name of the resource 47 Name *string `json:"name,omitempty"` 48 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 49 Type *string `json:"type,omitempty"` 50} 51 52// MarshalJSON is the custom marshaler for AzureEntityResource. 53func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { 54 objectMap := make(map[string]interface{}) 55 return json.Marshal(objectMap) 56} 57 58// CapacityReservationProperties the Capacity Reservation properties. 59type CapacityReservationProperties struct { 60 // LastSkuUpdate - READ-ONLY; The last time Sku was updated. 61 LastSkuUpdate *string `json:"lastSkuUpdate,omitempty"` 62 // MinCapacity - READ-ONLY; Minimum CapacityReservation value in GB. 63 MinCapacity *int64 `json:"minCapacity,omitempty"` 64 // MaxCapacity - READ-ONLY; Maximum CapacityReservation value in GB. 65 MaxCapacity *int64 `json:"maxCapacity,omitempty"` 66} 67 68// MarshalJSON is the custom marshaler for CapacityReservationProperties. 69func (crp CapacityReservationProperties) MarshalJSON() ([]byte, error) { 70 objectMap := make(map[string]interface{}) 71 return json.Marshal(objectMap) 72} 73 74// Cluster the top level Log Analytics cluster resource container. 75type Cluster struct { 76 autorest.Response `json:"-"` 77 // Identity - The identity of the resource. 78 Identity *Identity `json:"identity,omitempty"` 79 // Sku - The sku properties. 80 Sku *ClusterSku `json:"sku,omitempty"` 81 // ClusterProperties - Log Analytics cluster properties. 82 *ClusterProperties `json:"properties,omitempty"` 83 // Tags - Resource tags. 84 Tags map[string]*string `json:"tags"` 85 // Location - The geo-location where the resource lives 86 Location *string `json:"location,omitempty"` 87 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 88 ID *string `json:"id,omitempty"` 89 // Name - READ-ONLY; The name of the resource 90 Name *string `json:"name,omitempty"` 91 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 92 Type *string `json:"type,omitempty"` 93} 94 95// MarshalJSON is the custom marshaler for Cluster. 96func (c Cluster) MarshalJSON() ([]byte, error) { 97 objectMap := make(map[string]interface{}) 98 if c.Identity != nil { 99 objectMap["identity"] = c.Identity 100 } 101 if c.Sku != nil { 102 objectMap["sku"] = c.Sku 103 } 104 if c.ClusterProperties != nil { 105 objectMap["properties"] = c.ClusterProperties 106 } 107 if c.Tags != nil { 108 objectMap["tags"] = c.Tags 109 } 110 if c.Location != nil { 111 objectMap["location"] = c.Location 112 } 113 return json.Marshal(objectMap) 114} 115 116// UnmarshalJSON is the custom unmarshaler for Cluster struct. 117func (c *Cluster) UnmarshalJSON(body []byte) error { 118 var m map[string]*json.RawMessage 119 err := json.Unmarshal(body, &m) 120 if err != nil { 121 return err 122 } 123 for k, v := range m { 124 switch k { 125 case "identity": 126 if v != nil { 127 var identity Identity 128 err = json.Unmarshal(*v, &identity) 129 if err != nil { 130 return err 131 } 132 c.Identity = &identity 133 } 134 case "sku": 135 if v != nil { 136 var sku ClusterSku 137 err = json.Unmarshal(*v, &sku) 138 if err != nil { 139 return err 140 } 141 c.Sku = &sku 142 } 143 case "properties": 144 if v != nil { 145 var clusterProperties ClusterProperties 146 err = json.Unmarshal(*v, &clusterProperties) 147 if err != nil { 148 return err 149 } 150 c.ClusterProperties = &clusterProperties 151 } 152 case "tags": 153 if v != nil { 154 var tags map[string]*string 155 err = json.Unmarshal(*v, &tags) 156 if err != nil { 157 return err 158 } 159 c.Tags = tags 160 } 161 case "location": 162 if v != nil { 163 var location string 164 err = json.Unmarshal(*v, &location) 165 if err != nil { 166 return err 167 } 168 c.Location = &location 169 } 170 case "id": 171 if v != nil { 172 var ID string 173 err = json.Unmarshal(*v, &ID) 174 if err != nil { 175 return err 176 } 177 c.ID = &ID 178 } 179 case "name": 180 if v != nil { 181 var name string 182 err = json.Unmarshal(*v, &name) 183 if err != nil { 184 return err 185 } 186 c.Name = &name 187 } 188 case "type": 189 if v != nil { 190 var typeVar string 191 err = json.Unmarshal(*v, &typeVar) 192 if err != nil { 193 return err 194 } 195 c.Type = &typeVar 196 } 197 } 198 } 199 200 return nil 201} 202 203// ClusterListResult the list clusters operation response. 204type ClusterListResult struct { 205 autorest.Response `json:"-"` 206 // NextLink - The link used to get the next page of recommendations. 207 NextLink *string `json:"nextLink,omitempty"` 208 // Value - A list of Log Analytics clusters. 209 Value *[]Cluster `json:"value,omitempty"` 210} 211 212// ClusterListResultIterator provides access to a complete listing of Cluster values. 213type ClusterListResultIterator struct { 214 i int 215 page ClusterListResultPage 216} 217 218// NextWithContext advances to the next value. If there was an error making 219// the request the iterator does not advance and the error is returned. 220func (iter *ClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { 221 if tracing.IsEnabled() { 222 ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListResultIterator.NextWithContext") 223 defer func() { 224 sc := -1 225 if iter.Response().Response.Response != nil { 226 sc = iter.Response().Response.Response.StatusCode 227 } 228 tracing.EndSpan(ctx, sc, err) 229 }() 230 } 231 iter.i++ 232 if iter.i < len(iter.page.Values()) { 233 return nil 234 } 235 err = iter.page.NextWithContext(ctx) 236 if err != nil { 237 iter.i-- 238 return err 239 } 240 iter.i = 0 241 return nil 242} 243 244// Next advances to the next value. If there was an error making 245// the request the iterator does not advance and the error is returned. 246// Deprecated: Use NextWithContext() instead. 247func (iter *ClusterListResultIterator) Next() error { 248 return iter.NextWithContext(context.Background()) 249} 250 251// NotDone returns true if the enumeration should be started or is not yet complete. 252func (iter ClusterListResultIterator) NotDone() bool { 253 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 254} 255 256// Response returns the raw server response from the last page request. 257func (iter ClusterListResultIterator) Response() ClusterListResult { 258 return iter.page.Response() 259} 260 261// Value returns the current value or a zero-initialized value if the 262// iterator has advanced beyond the end of the collection. 263func (iter ClusterListResultIterator) Value() Cluster { 264 if !iter.page.NotDone() { 265 return Cluster{} 266 } 267 return iter.page.Values()[iter.i] 268} 269 270// Creates a new instance of the ClusterListResultIterator type. 271func NewClusterListResultIterator(page ClusterListResultPage) ClusterListResultIterator { 272 return ClusterListResultIterator{page: page} 273} 274 275// IsEmpty returns true if the ListResult contains no values. 276func (clr ClusterListResult) IsEmpty() bool { 277 return clr.Value == nil || len(*clr.Value) == 0 278} 279 280// hasNextLink returns true if the NextLink is not empty. 281func (clr ClusterListResult) hasNextLink() bool { 282 return clr.NextLink != nil && len(*clr.NextLink) != 0 283} 284 285// clusterListResultPreparer prepares a request to retrieve the next set of results. 286// It returns nil if no more results exist. 287func (clr ClusterListResult) clusterListResultPreparer(ctx context.Context) (*http.Request, error) { 288 if !clr.hasNextLink() { 289 return nil, nil 290 } 291 return autorest.Prepare((&http.Request{}).WithContext(ctx), 292 autorest.AsJSON(), 293 autorest.AsGet(), 294 autorest.WithBaseURL(to.String(clr.NextLink))) 295} 296 297// ClusterListResultPage contains a page of Cluster values. 298type ClusterListResultPage struct { 299 fn func(context.Context, ClusterListResult) (ClusterListResult, error) 300 clr ClusterListResult 301} 302 303// NextWithContext advances to the next page of values. If there was an error making 304// the request the page does not advance and the error is returned. 305func (page *ClusterListResultPage) NextWithContext(ctx context.Context) (err error) { 306 if tracing.IsEnabled() { 307 ctx = tracing.StartSpan(ctx, fqdn+"/ClusterListResultPage.NextWithContext") 308 defer func() { 309 sc := -1 310 if page.Response().Response.Response != nil { 311 sc = page.Response().Response.Response.StatusCode 312 } 313 tracing.EndSpan(ctx, sc, err) 314 }() 315 } 316 for { 317 next, err := page.fn(ctx, page.clr) 318 if err != nil { 319 return err 320 } 321 page.clr = next 322 if !next.hasNextLink() || !next.IsEmpty() { 323 break 324 } 325 } 326 return nil 327} 328 329// Next advances to the next page of values. If there was an error making 330// the request the page does not advance and the error is returned. 331// Deprecated: Use NextWithContext() instead. 332func (page *ClusterListResultPage) Next() error { 333 return page.NextWithContext(context.Background()) 334} 335 336// NotDone returns true if the page enumeration should be started or is not yet complete. 337func (page ClusterListResultPage) NotDone() bool { 338 return !page.clr.IsEmpty() 339} 340 341// Response returns the raw server response from the last page request. 342func (page ClusterListResultPage) Response() ClusterListResult { 343 return page.clr 344} 345 346// Values returns the slice of values for the current page or nil if there are no values. 347func (page ClusterListResultPage) Values() []Cluster { 348 if page.clr.IsEmpty() { 349 return nil 350 } 351 return *page.clr.Value 352} 353 354// Creates a new instance of the ClusterListResultPage type. 355func NewClusterListResultPage(cur ClusterListResult, getNextPage func(context.Context, ClusterListResult) (ClusterListResult, error)) ClusterListResultPage { 356 return ClusterListResultPage{ 357 fn: getNextPage, 358 clr: cur, 359 } 360} 361 362// ClusterPatch the top level Log Analytics cluster resource container. 363type ClusterPatch struct { 364 // ClusterPatchProperties - Log Analytics cluster properties. 365 *ClusterPatchProperties `json:"properties,omitempty"` 366 // Identity - The identity of the resource. 367 Identity *Identity `json:"identity,omitempty"` 368 // Sku - The sku properties. 369 Sku *ClusterSku `json:"sku,omitempty"` 370 // Tags - Resource tags. 371 Tags map[string]*string `json:"tags"` 372} 373 374// MarshalJSON is the custom marshaler for ClusterPatch. 375func (cp ClusterPatch) MarshalJSON() ([]byte, error) { 376 objectMap := make(map[string]interface{}) 377 if cp.ClusterPatchProperties != nil { 378 objectMap["properties"] = cp.ClusterPatchProperties 379 } 380 if cp.Identity != nil { 381 objectMap["identity"] = cp.Identity 382 } 383 if cp.Sku != nil { 384 objectMap["sku"] = cp.Sku 385 } 386 if cp.Tags != nil { 387 objectMap["tags"] = cp.Tags 388 } 389 return json.Marshal(objectMap) 390} 391 392// UnmarshalJSON is the custom unmarshaler for ClusterPatch struct. 393func (cp *ClusterPatch) UnmarshalJSON(body []byte) error { 394 var m map[string]*json.RawMessage 395 err := json.Unmarshal(body, &m) 396 if err != nil { 397 return err 398 } 399 for k, v := range m { 400 switch k { 401 case "properties": 402 if v != nil { 403 var clusterPatchProperties ClusterPatchProperties 404 err = json.Unmarshal(*v, &clusterPatchProperties) 405 if err != nil { 406 return err 407 } 408 cp.ClusterPatchProperties = &clusterPatchProperties 409 } 410 case "identity": 411 if v != nil { 412 var identity Identity 413 err = json.Unmarshal(*v, &identity) 414 if err != nil { 415 return err 416 } 417 cp.Identity = &identity 418 } 419 case "sku": 420 if v != nil { 421 var sku ClusterSku 422 err = json.Unmarshal(*v, &sku) 423 if err != nil { 424 return err 425 } 426 cp.Sku = &sku 427 } 428 case "tags": 429 if v != nil { 430 var tags map[string]*string 431 err = json.Unmarshal(*v, &tags) 432 if err != nil { 433 return err 434 } 435 cp.Tags = tags 436 } 437 } 438 } 439 440 return nil 441} 442 443// ClusterPatchProperties log Analytics cluster patch properties. 444type ClusterPatchProperties struct { 445 // KeyVaultProperties - The associated key properties. 446 KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` 447} 448 449// ClusterProperties cluster properties. 450type ClusterProperties struct { 451 // ClusterID - READ-ONLY; The ID associated with the cluster. 452 ClusterID *string `json:"clusterId,omitempty"` 453 // ProvisioningState - READ-ONLY; The provisioning state of the cluster. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount', 'Updating' 454 ProvisioningState ClusterEntityStatus `json:"provisioningState,omitempty"` 455 // IsDoubleEncryptionEnabled - Configures whether cluster will use double encryption. This Property can not be modified after cluster creation. Default value is 'true' 456 IsDoubleEncryptionEnabled *bool `json:"isDoubleEncryptionEnabled,omitempty"` 457 // IsAvailabilityZonesEnabled - Sets whether the cluster will support availability zones. This can be set as true only in regions where Azure Data Explorer support Availability Zones. This Property can not be modified after cluster creation. Default value is 'true' if region supports Availability Zones. 458 IsAvailabilityZonesEnabled *bool `json:"isAvailabilityZonesEnabled,omitempty"` 459 // BillingType - Configures whether billing will be only on the cluster or each workspace will be billed by its proportional use. This does not change the overall billing, only how it will be distributed. Default value is 'Cluster'. Possible values include: 'BillingTypeCluster', 'BillingTypeWorkspaces' 460 BillingType BillingType `json:"billingType,omitempty"` 461 // KeyVaultProperties - The associated key properties. 462 KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` 463 // LastModifiedDate - READ-ONLY; The last time the cluster was updated. 464 LastModifiedDate *string `json:"lastModifiedDate,omitempty"` 465 // CreatedDate - READ-ONLY; The cluster creation time 466 CreatedDate *string `json:"createdDate,omitempty"` 467 // AssociatedWorkspaces - The list of Log Analytics workspaces associated with the cluster 468 AssociatedWorkspaces *[]AssociatedWorkspace `json:"associatedWorkspaces,omitempty"` 469 // CapacityReservationProperties - Additional properties for capacity reservation 470 CapacityReservationProperties *CapacityReservationProperties `json:"capacityReservationProperties,omitempty"` 471} 472 473// MarshalJSON is the custom marshaler for ClusterProperties. 474func (cp ClusterProperties) MarshalJSON() ([]byte, error) { 475 objectMap := make(map[string]interface{}) 476 if cp.IsDoubleEncryptionEnabled != nil { 477 objectMap["isDoubleEncryptionEnabled"] = cp.IsDoubleEncryptionEnabled 478 } 479 if cp.IsAvailabilityZonesEnabled != nil { 480 objectMap["isAvailabilityZonesEnabled"] = cp.IsAvailabilityZonesEnabled 481 } 482 if cp.BillingType != "" { 483 objectMap["billingType"] = cp.BillingType 484 } 485 if cp.KeyVaultProperties != nil { 486 objectMap["keyVaultProperties"] = cp.KeyVaultProperties 487 } 488 if cp.AssociatedWorkspaces != nil { 489 objectMap["associatedWorkspaces"] = cp.AssociatedWorkspaces 490 } 491 if cp.CapacityReservationProperties != nil { 492 objectMap["capacityReservationProperties"] = cp.CapacityReservationProperties 493 } 494 return json.Marshal(objectMap) 495} 496 497// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 498// operation. 499type ClustersCreateOrUpdateFuture struct { 500 azure.FutureAPI 501 // Result returns the result of the asynchronous operation. 502 // If the operation has not completed it will return an error. 503 Result func(ClustersClient) (Cluster, error) 504} 505 506// UnmarshalJSON is the custom unmarshaller for CreateFuture. 507func (future *ClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 508 var azFuture azure.Future 509 if err := json.Unmarshal(body, &azFuture); err != nil { 510 return err 511 } 512 future.FutureAPI = &azFuture 513 future.Result = future.result 514 return nil 515} 516 517// result is the default implementation for ClustersCreateOrUpdateFuture.Result. 518func (future *ClustersCreateOrUpdateFuture) result(client ClustersClient) (c Cluster, err error) { 519 var done bool 520 done, err = future.DoneWithContext(context.Background(), client) 521 if err != nil { 522 err = autorest.NewErrorWithError(err, "operationalinsights.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 523 return 524 } 525 if !done { 526 c.Response.Response = future.Response() 527 err = azure.NewAsyncOpIncompleteError("operationalinsights.ClustersCreateOrUpdateFuture") 528 return 529 } 530 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 531 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { 532 c, err = client.CreateOrUpdateResponder(c.Response.Response) 533 if err != nil { 534 err = autorest.NewErrorWithError(err, "operationalinsights.ClustersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") 535 } 536 } 537 return 538} 539 540// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 541// operation. 542type ClustersDeleteFuture struct { 543 azure.FutureAPI 544 // Result returns the result of the asynchronous operation. 545 // If the operation has not completed it will return an error. 546 Result func(ClustersClient) (autorest.Response, error) 547} 548 549// UnmarshalJSON is the custom unmarshaller for CreateFuture. 550func (future *ClustersDeleteFuture) UnmarshalJSON(body []byte) error { 551 var azFuture azure.Future 552 if err := json.Unmarshal(body, &azFuture); err != nil { 553 return err 554 } 555 future.FutureAPI = &azFuture 556 future.Result = future.result 557 return nil 558} 559 560// result is the default implementation for ClustersDeleteFuture.Result. 561func (future *ClustersDeleteFuture) result(client ClustersClient) (ar autorest.Response, err error) { 562 var done bool 563 done, err = future.DoneWithContext(context.Background(), client) 564 if err != nil { 565 err = autorest.NewErrorWithError(err, "operationalinsights.ClustersDeleteFuture", "Result", future.Response(), "Polling failure") 566 return 567 } 568 if !done { 569 ar.Response = future.Response() 570 err = azure.NewAsyncOpIncompleteError("operationalinsights.ClustersDeleteFuture") 571 return 572 } 573 ar.Response = future.Response() 574 return 575} 576 577// ClusterSku the cluster sku definition. 578type ClusterSku struct { 579 // Capacity - The capacity value 580 Capacity *int64 `json:"capacity,omitempty"` 581 // Name - The name of the SKU. Possible values include: 'CapacityReservation' 582 Name ClusterSkuNameEnum `json:"name,omitempty"` 583} 584 585// ErrorAdditionalInfo the resource management error additional info. 586type ErrorAdditionalInfo struct { 587 // Type - READ-ONLY; The additional info type. 588 Type *string `json:"type,omitempty"` 589 // Info - READ-ONLY; The additional info. 590 Info interface{} `json:"info,omitempty"` 591} 592 593// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. 594func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { 595 objectMap := make(map[string]interface{}) 596 return json.Marshal(objectMap) 597} 598 599// ErrorDetail the error detail. 600type ErrorDetail struct { 601 // Code - READ-ONLY; The error code. 602 Code *string `json:"code,omitempty"` 603 // Message - READ-ONLY; The error message. 604 Message *string `json:"message,omitempty"` 605 // Target - READ-ONLY; The error target. 606 Target *string `json:"target,omitempty"` 607 // Details - READ-ONLY; The error details. 608 Details *[]ErrorDetail `json:"details,omitempty"` 609 // AdditionalInfo - READ-ONLY; The error additional info. 610 AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` 611} 612 613// MarshalJSON is the custom marshaler for ErrorDetail. 614func (ed ErrorDetail) MarshalJSON() ([]byte, error) { 615 objectMap := make(map[string]interface{}) 616 return json.Marshal(objectMap) 617} 618 619// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for 620// failed operations. (This also follows the OData error response format.). 621type ErrorResponse struct { 622 // Error - The error object. 623 Error *ErrorDetail `json:"error,omitempty"` 624} 625 626// Identity identity for the resource. 627type Identity struct { 628 // PrincipalID - READ-ONLY; The principal ID of resource identity. 629 PrincipalID *string `json:"principalId,omitempty"` 630 // TenantID - READ-ONLY; The tenant ID of resource. 631 TenantID *string `json:"tenantId,omitempty"` 632 // Type - The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. Possible values include: 'SystemAssigned', 'UserAssigned', 'None' 633 Type IdentityType `json:"type,omitempty"` 634 // UserAssignedIdentities - The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. 635 UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` 636} 637 638// MarshalJSON is the custom marshaler for Identity. 639func (i Identity) MarshalJSON() ([]byte, error) { 640 objectMap := make(map[string]interface{}) 641 if i.Type != "" { 642 objectMap["type"] = i.Type 643 } 644 if i.UserAssignedIdentities != nil { 645 objectMap["userAssignedIdentities"] = i.UserAssignedIdentities 646 } 647 return json.Marshal(objectMap) 648} 649 650// KeyVaultProperties the key vault properties. 651type KeyVaultProperties struct { 652 // KeyVaultURI - The Key Vault uri which holds they key associated with the Log Analytics cluster. 653 KeyVaultURI *string `json:"keyVaultUri,omitempty"` 654 // KeyName - The name of the key associated with the Log Analytics cluster. 655 KeyName *string `json:"keyName,omitempty"` 656 // KeyVersion - The version of the key associated with the Log Analytics cluster. 657 KeyVersion *string `json:"keyVersion,omitempty"` 658 // KeyRsaSize - Selected key minimum required size. 659 KeyRsaSize *int32 `json:"keyRsaSize,omitempty"` 660} 661 662// Operation supported operation of OperationalInsights resource provider. 663type Operation struct { 664 // Name - Operation name: {provider}/{resource}/{operation} 665 Name *string `json:"name,omitempty"` 666 // Display - Display metadata associated with the operation. 667 Display *OperationDisplay `json:"display,omitempty"` 668} 669 670// OperationDisplay display metadata associated with the operation. 671type OperationDisplay struct { 672 // Provider - Service provider: Microsoft OperationsManagement. 673 Provider *string `json:"provider,omitempty"` 674 // Resource - Resource on which the operation is performed etc. 675 Resource *string `json:"resource,omitempty"` 676 // Operation - Type of operation: get, read, delete, etc. 677 Operation *string `json:"operation,omitempty"` 678 // Description - Description of operation 679 Description *string `json:"description,omitempty"` 680} 681 682// OperationListResult result of the request to list solution operations. 683type OperationListResult struct { 684 autorest.Response `json:"-"` 685 // Value - List of solution operations supported by the OperationsManagement resource provider. 686 Value *[]Operation `json:"value,omitempty"` 687 // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. 688 NextLink *string `json:"nextLink,omitempty"` 689} 690 691// MarshalJSON is the custom marshaler for OperationListResult. 692func (olr OperationListResult) MarshalJSON() ([]byte, error) { 693 objectMap := make(map[string]interface{}) 694 if olr.Value != nil { 695 objectMap["value"] = olr.Value 696 } 697 return json.Marshal(objectMap) 698} 699 700// OperationListResultIterator provides access to a complete listing of Operation values. 701type OperationListResultIterator struct { 702 i int 703 page OperationListResultPage 704} 705 706// NextWithContext advances to the next value. If there was an error making 707// the request the iterator does not advance and the error is returned. 708func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 709 if tracing.IsEnabled() { 710 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 711 defer func() { 712 sc := -1 713 if iter.Response().Response.Response != nil { 714 sc = iter.Response().Response.Response.StatusCode 715 } 716 tracing.EndSpan(ctx, sc, err) 717 }() 718 } 719 iter.i++ 720 if iter.i < len(iter.page.Values()) { 721 return nil 722 } 723 err = iter.page.NextWithContext(ctx) 724 if err != nil { 725 iter.i-- 726 return err 727 } 728 iter.i = 0 729 return nil 730} 731 732// Next advances to the next value. If there was an error making 733// the request the iterator does not advance and the error is returned. 734// Deprecated: Use NextWithContext() instead. 735func (iter *OperationListResultIterator) Next() error { 736 return iter.NextWithContext(context.Background()) 737} 738 739// NotDone returns true if the enumeration should be started or is not yet complete. 740func (iter OperationListResultIterator) NotDone() bool { 741 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 742} 743 744// Response returns the raw server response from the last page request. 745func (iter OperationListResultIterator) Response() OperationListResult { 746 return iter.page.Response() 747} 748 749// Value returns the current value or a zero-initialized value if the 750// iterator has advanced beyond the end of the collection. 751func (iter OperationListResultIterator) Value() Operation { 752 if !iter.page.NotDone() { 753 return Operation{} 754 } 755 return iter.page.Values()[iter.i] 756} 757 758// Creates a new instance of the OperationListResultIterator type. 759func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 760 return OperationListResultIterator{page: page} 761} 762 763// IsEmpty returns true if the ListResult contains no values. 764func (olr OperationListResult) IsEmpty() bool { 765 return olr.Value == nil || len(*olr.Value) == 0 766} 767 768// hasNextLink returns true if the NextLink is not empty. 769func (olr OperationListResult) hasNextLink() bool { 770 return olr.NextLink != nil && len(*olr.NextLink) != 0 771} 772 773// operationListResultPreparer prepares a request to retrieve the next set of results. 774// It returns nil if no more results exist. 775func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 776 if !olr.hasNextLink() { 777 return nil, nil 778 } 779 return autorest.Prepare((&http.Request{}).WithContext(ctx), 780 autorest.AsJSON(), 781 autorest.AsGet(), 782 autorest.WithBaseURL(to.String(olr.NextLink))) 783} 784 785// OperationListResultPage contains a page of Operation values. 786type OperationListResultPage struct { 787 fn func(context.Context, OperationListResult) (OperationListResult, error) 788 olr OperationListResult 789} 790 791// NextWithContext advances to the next page of values. If there was an error making 792// the request the page does not advance and the error is returned. 793func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 794 if tracing.IsEnabled() { 795 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 796 defer func() { 797 sc := -1 798 if page.Response().Response.Response != nil { 799 sc = page.Response().Response.Response.StatusCode 800 } 801 tracing.EndSpan(ctx, sc, err) 802 }() 803 } 804 for { 805 next, err := page.fn(ctx, page.olr) 806 if err != nil { 807 return err 808 } 809 page.olr = next 810 if !next.hasNextLink() || !next.IsEmpty() { 811 break 812 } 813 } 814 return nil 815} 816 817// Next advances to the next page of values. If there was an error making 818// the request the page does not advance and the error is returned. 819// Deprecated: Use NextWithContext() instead. 820func (page *OperationListResultPage) Next() error { 821 return page.NextWithContext(context.Background()) 822} 823 824// NotDone returns true if the page enumeration should be started or is not yet complete. 825func (page OperationListResultPage) NotDone() bool { 826 return !page.olr.IsEmpty() 827} 828 829// Response returns the raw server response from the last page request. 830func (page OperationListResultPage) Response() OperationListResult { 831 return page.olr 832} 833 834// Values returns the slice of values for the current page or nil if there are no values. 835func (page OperationListResultPage) Values() []Operation { 836 if page.olr.IsEmpty() { 837 return nil 838 } 839 return *page.olr.Value 840} 841 842// Creates a new instance of the OperationListResultPage type. 843func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 844 return OperationListResultPage{ 845 fn: getNextPage, 846 olr: cur, 847 } 848} 849 850// PrivateLinkScopedResource the private link scope resource reference. 851type PrivateLinkScopedResource struct { 852 // ResourceID - The full resource Id of the private link scope resource. 853 ResourceID *string `json:"resourceId,omitempty"` 854 // ScopeID - The private link scope unique Identifier. 855 ScopeID *string `json:"scopeId,omitempty"` 856} 857 858// ProxyResource the resource model definition for an Azure Resource Manager proxy resource. It will have 859// everything other than required location and tags 860type ProxyResource struct { 861 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 862 ID *string `json:"id,omitempty"` 863 // Name - READ-ONLY; The name of the resource 864 Name *string `json:"name,omitempty"` 865 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 866 Type *string `json:"type,omitempty"` 867} 868 869// MarshalJSON is the custom marshaler for ProxyResource. 870func (pr ProxyResource) MarshalJSON() ([]byte, error) { 871 objectMap := make(map[string]interface{}) 872 return json.Marshal(objectMap) 873} 874 875// Resource common fields that are returned in the response for all Azure Resource Manager resources 876type Resource struct { 877 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 878 ID *string `json:"id,omitempty"` 879 // Name - READ-ONLY; The name of the resource 880 Name *string `json:"name,omitempty"` 881 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 882 Type *string `json:"type,omitempty"` 883} 884 885// MarshalJSON is the custom marshaler for Resource. 886func (r Resource) MarshalJSON() ([]byte, error) { 887 objectMap := make(map[string]interface{}) 888 return json.Marshal(objectMap) 889} 890 891// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource 892type TrackedResource struct { 893 // Tags - Resource tags. 894 Tags map[string]*string `json:"tags"` 895 // Location - The geo-location where the resource lives 896 Location *string `json:"location,omitempty"` 897 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 898 ID *string `json:"id,omitempty"` 899 // Name - READ-ONLY; The name of the resource 900 Name *string `json:"name,omitempty"` 901 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 902 Type *string `json:"type,omitempty"` 903} 904 905// MarshalJSON is the custom marshaler for TrackedResource. 906func (tr TrackedResource) MarshalJSON() ([]byte, error) { 907 objectMap := make(map[string]interface{}) 908 if tr.Tags != nil { 909 objectMap["tags"] = tr.Tags 910 } 911 if tr.Location != nil { 912 objectMap["location"] = tr.Location 913 } 914 return json.Marshal(objectMap) 915} 916 917// UserIdentityProperties user assigned identity properties. 918type UserIdentityProperties struct { 919 // PrincipalID - READ-ONLY; The principal id of user assigned identity. 920 PrincipalID *string `json:"principalId,omitempty"` 921 // ClientID - READ-ONLY; The client id of user assigned identity. 922 ClientID *string `json:"clientId,omitempty"` 923} 924 925// MarshalJSON is the custom marshaler for UserIdentityProperties. 926func (uip UserIdentityProperties) MarshalJSON() ([]byte, error) { 927 objectMap := make(map[string]interface{}) 928 return json.Marshal(objectMap) 929} 930 931// Workspace the top level Workspace resource container. 932type Workspace struct { 933 autorest.Response `json:"-"` 934 // WorkspaceProperties - Workspace properties. 935 *WorkspaceProperties `json:"properties,omitempty"` 936 // ETag - The ETag of the workspace. 937 ETag *string `json:"eTag,omitempty"` 938 // Tags - Resource tags. 939 Tags map[string]*string `json:"tags"` 940 // Location - The geo-location where the resource lives 941 Location *string `json:"location,omitempty"` 942 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 943 ID *string `json:"id,omitempty"` 944 // Name - READ-ONLY; The name of the resource 945 Name *string `json:"name,omitempty"` 946 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 947 Type *string `json:"type,omitempty"` 948} 949 950// MarshalJSON is the custom marshaler for Workspace. 951func (w Workspace) MarshalJSON() ([]byte, error) { 952 objectMap := make(map[string]interface{}) 953 if w.WorkspaceProperties != nil { 954 objectMap["properties"] = w.WorkspaceProperties 955 } 956 if w.ETag != nil { 957 objectMap["eTag"] = w.ETag 958 } 959 if w.Tags != nil { 960 objectMap["tags"] = w.Tags 961 } 962 if w.Location != nil { 963 objectMap["location"] = w.Location 964 } 965 return json.Marshal(objectMap) 966} 967 968// UnmarshalJSON is the custom unmarshaler for Workspace struct. 969func (w *Workspace) UnmarshalJSON(body []byte) error { 970 var m map[string]*json.RawMessage 971 err := json.Unmarshal(body, &m) 972 if err != nil { 973 return err 974 } 975 for k, v := range m { 976 switch k { 977 case "properties": 978 if v != nil { 979 var workspaceProperties WorkspaceProperties 980 err = json.Unmarshal(*v, &workspaceProperties) 981 if err != nil { 982 return err 983 } 984 w.WorkspaceProperties = &workspaceProperties 985 } 986 case "eTag": 987 if v != nil { 988 var eTag string 989 err = json.Unmarshal(*v, &eTag) 990 if err != nil { 991 return err 992 } 993 w.ETag = &eTag 994 } 995 case "tags": 996 if v != nil { 997 var tags map[string]*string 998 err = json.Unmarshal(*v, &tags) 999 if err != nil { 1000 return err 1001 } 1002 w.Tags = tags 1003 } 1004 case "location": 1005 if v != nil { 1006 var location string 1007 err = json.Unmarshal(*v, &location) 1008 if err != nil { 1009 return err 1010 } 1011 w.Location = &location 1012 } 1013 case "id": 1014 if v != nil { 1015 var ID string 1016 err = json.Unmarshal(*v, &ID) 1017 if err != nil { 1018 return err 1019 } 1020 w.ID = &ID 1021 } 1022 case "name": 1023 if v != nil { 1024 var name string 1025 err = json.Unmarshal(*v, &name) 1026 if err != nil { 1027 return err 1028 } 1029 w.Name = &name 1030 } 1031 case "type": 1032 if v != nil { 1033 var typeVar string 1034 err = json.Unmarshal(*v, &typeVar) 1035 if err != nil { 1036 return err 1037 } 1038 w.Type = &typeVar 1039 } 1040 } 1041 } 1042 1043 return nil 1044} 1045 1046// WorkspaceCapping the daily volume cap for ingestion. 1047type WorkspaceCapping struct { 1048 // DailyQuotaGb - The workspace daily quota for ingestion. 1049 DailyQuotaGb *float64 `json:"dailyQuotaGb,omitempty"` 1050 // QuotaNextResetTime - READ-ONLY; The time when the quota will be rest. 1051 QuotaNextResetTime *string `json:"quotaNextResetTime,omitempty"` 1052 // DataIngestionStatus - READ-ONLY; The status of data ingestion for this workspace. Possible values include: 'RespectQuota', 'ForceOn', 'ForceOff', 'OverQuota', 'SubscriptionSuspended', 'ApproachingQuota' 1053 DataIngestionStatus DataIngestionStatus `json:"dataIngestionStatus,omitempty"` 1054} 1055 1056// MarshalJSON is the custom marshaler for WorkspaceCapping. 1057func (wc WorkspaceCapping) MarshalJSON() ([]byte, error) { 1058 objectMap := make(map[string]interface{}) 1059 if wc.DailyQuotaGb != nil { 1060 objectMap["dailyQuotaGb"] = wc.DailyQuotaGb 1061 } 1062 return json.Marshal(objectMap) 1063} 1064 1065// WorkspaceListResult the list workspaces operation response. 1066type WorkspaceListResult struct { 1067 autorest.Response `json:"-"` 1068 // Value - A list of workspaces. 1069 Value *[]Workspace `json:"value,omitempty"` 1070} 1071 1072// WorkspacePatch the top level Workspace resource container. 1073type WorkspacePatch struct { 1074 // WorkspaceProperties - Workspace properties. 1075 *WorkspaceProperties `json:"properties,omitempty"` 1076 // Tags - Resource tags. Optional. 1077 Tags map[string]*string `json:"tags"` 1078 // Etag - READ-ONLY; Resource Etag. 1079 Etag *string `json:"etag,omitempty"` 1080 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1081 ID *string `json:"id,omitempty"` 1082 // Name - READ-ONLY; The name of the resource 1083 Name *string `json:"name,omitempty"` 1084 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1085 Type *string `json:"type,omitempty"` 1086} 1087 1088// MarshalJSON is the custom marshaler for WorkspacePatch. 1089func (wp WorkspacePatch) MarshalJSON() ([]byte, error) { 1090 objectMap := make(map[string]interface{}) 1091 if wp.WorkspaceProperties != nil { 1092 objectMap["properties"] = wp.WorkspaceProperties 1093 } 1094 if wp.Tags != nil { 1095 objectMap["tags"] = wp.Tags 1096 } 1097 return json.Marshal(objectMap) 1098} 1099 1100// UnmarshalJSON is the custom unmarshaler for WorkspacePatch struct. 1101func (wp *WorkspacePatch) UnmarshalJSON(body []byte) error { 1102 var m map[string]*json.RawMessage 1103 err := json.Unmarshal(body, &m) 1104 if err != nil { 1105 return err 1106 } 1107 for k, v := range m { 1108 switch k { 1109 case "properties": 1110 if v != nil { 1111 var workspaceProperties WorkspaceProperties 1112 err = json.Unmarshal(*v, &workspaceProperties) 1113 if err != nil { 1114 return err 1115 } 1116 wp.WorkspaceProperties = &workspaceProperties 1117 } 1118 case "tags": 1119 if v != nil { 1120 var tags map[string]*string 1121 err = json.Unmarshal(*v, &tags) 1122 if err != nil { 1123 return err 1124 } 1125 wp.Tags = tags 1126 } 1127 case "etag": 1128 if v != nil { 1129 var etag string 1130 err = json.Unmarshal(*v, &etag) 1131 if err != nil { 1132 return err 1133 } 1134 wp.Etag = &etag 1135 } 1136 case "id": 1137 if v != nil { 1138 var ID string 1139 err = json.Unmarshal(*v, &ID) 1140 if err != nil { 1141 return err 1142 } 1143 wp.ID = &ID 1144 } 1145 case "name": 1146 if v != nil { 1147 var name string 1148 err = json.Unmarshal(*v, &name) 1149 if err != nil { 1150 return err 1151 } 1152 wp.Name = &name 1153 } 1154 case "type": 1155 if v != nil { 1156 var typeVar string 1157 err = json.Unmarshal(*v, &typeVar) 1158 if err != nil { 1159 return err 1160 } 1161 wp.Type = &typeVar 1162 } 1163 } 1164 } 1165 1166 return nil 1167} 1168 1169// WorkspaceProperties workspace properties. 1170type WorkspaceProperties struct { 1171 // ProvisioningState - The provisioning state of the workspace. Possible values include: 'WorkspaceEntityStatusCreating', 'WorkspaceEntityStatusSucceeded', 'WorkspaceEntityStatusFailed', 'WorkspaceEntityStatusCanceled', 'WorkspaceEntityStatusDeleting', 'WorkspaceEntityStatusProvisioningAccount', 'WorkspaceEntityStatusUpdating' 1172 ProvisioningState WorkspaceEntityStatus `json:"provisioningState,omitempty"` 1173 // CustomerID - READ-ONLY; This is a read-only property. Represents the ID associated with the workspace. 1174 CustomerID *string `json:"customerId,omitempty"` 1175 // Sku - The SKU of the workspace. 1176 Sku *WorkspaceSku `json:"sku,omitempty"` 1177 // RetentionInDays - The workspace data retention in days, between 30 and 730. 1178 RetentionInDays *int32 `json:"retentionInDays,omitempty"` 1179 // WorkspaceCapping - The daily volume cap for ingestion. 1180 WorkspaceCapping *WorkspaceCapping `json:"workspaceCapping,omitempty"` 1181 // PublicNetworkAccessForIngestion - The network access type for accessing Log Analytics ingestion. Possible values include: 'Enabled', 'Disabled' 1182 PublicNetworkAccessForIngestion PublicNetworkAccessType `json:"publicNetworkAccessForIngestion,omitempty"` 1183 // PublicNetworkAccessForQuery - The network access type for accessing Log Analytics query. Possible values include: 'Enabled', 'Disabled' 1184 PublicNetworkAccessForQuery PublicNetworkAccessType `json:"publicNetworkAccessForQuery,omitempty"` 1185 // ForceCmkForQuery - Indicates whether customer managed storage is mandatory for query management. 1186 ForceCmkForQuery *bool `json:"forceCmkForQuery,omitempty"` 1187 // PrivateLinkScopedResources - READ-ONLY; List of linked private link scope resources. 1188 PrivateLinkScopedResources *[]PrivateLinkScopedResource `json:"privateLinkScopedResources,omitempty"` 1189} 1190 1191// MarshalJSON is the custom marshaler for WorkspaceProperties. 1192func (wp WorkspaceProperties) MarshalJSON() ([]byte, error) { 1193 objectMap := make(map[string]interface{}) 1194 if wp.ProvisioningState != "" { 1195 objectMap["provisioningState"] = wp.ProvisioningState 1196 } 1197 if wp.Sku != nil { 1198 objectMap["sku"] = wp.Sku 1199 } 1200 if wp.RetentionInDays != nil { 1201 objectMap["retentionInDays"] = wp.RetentionInDays 1202 } 1203 if wp.WorkspaceCapping != nil { 1204 objectMap["workspaceCapping"] = wp.WorkspaceCapping 1205 } 1206 if wp.PublicNetworkAccessForIngestion != "" { 1207 objectMap["publicNetworkAccessForIngestion"] = wp.PublicNetworkAccessForIngestion 1208 } 1209 if wp.PublicNetworkAccessForQuery != "" { 1210 objectMap["publicNetworkAccessForQuery"] = wp.PublicNetworkAccessForQuery 1211 } 1212 if wp.ForceCmkForQuery != nil { 1213 objectMap["forceCmkForQuery"] = wp.ForceCmkForQuery 1214 } 1215 return json.Marshal(objectMap) 1216} 1217 1218// WorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1219// long-running operation. 1220type WorkspacesCreateOrUpdateFuture struct { 1221 azure.FutureAPI 1222 // Result returns the result of the asynchronous operation. 1223 // If the operation has not completed it will return an error. 1224 Result func(WorkspacesClient) (Workspace, error) 1225} 1226 1227// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1228func (future *WorkspacesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1229 var azFuture azure.Future 1230 if err := json.Unmarshal(body, &azFuture); err != nil { 1231 return err 1232 } 1233 future.FutureAPI = &azFuture 1234 future.Result = future.result 1235 return nil 1236} 1237 1238// result is the default implementation for WorkspacesCreateOrUpdateFuture.Result. 1239func (future *WorkspacesCreateOrUpdateFuture) result(client WorkspacesClient) (w Workspace, err error) { 1240 var done bool 1241 done, err = future.DoneWithContext(context.Background(), client) 1242 if err != nil { 1243 err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1244 return 1245 } 1246 if !done { 1247 w.Response.Response = future.Response() 1248 err = azure.NewAsyncOpIncompleteError("operationalinsights.WorkspacesCreateOrUpdateFuture") 1249 return 1250 } 1251 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1252 if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { 1253 w, err = client.CreateOrUpdateResponder(w.Response.Response) 1254 if err != nil { 1255 err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesCreateOrUpdateFuture", "Result", w.Response.Response, "Failure responding to request") 1256 } 1257 } 1258 return 1259} 1260 1261// WorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1262// operation. 1263type WorkspacesDeleteFuture struct { 1264 azure.FutureAPI 1265 // Result returns the result of the asynchronous operation. 1266 // If the operation has not completed it will return an error. 1267 Result func(WorkspacesClient) (autorest.Response, error) 1268} 1269 1270// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1271func (future *WorkspacesDeleteFuture) UnmarshalJSON(body []byte) error { 1272 var azFuture azure.Future 1273 if err := json.Unmarshal(body, &azFuture); err != nil { 1274 return err 1275 } 1276 future.FutureAPI = &azFuture 1277 future.Result = future.result 1278 return nil 1279} 1280 1281// result is the default implementation for WorkspacesDeleteFuture.Result. 1282func (future *WorkspacesDeleteFuture) result(client WorkspacesClient) (ar autorest.Response, err error) { 1283 var done bool 1284 done, err = future.DoneWithContext(context.Background(), client) 1285 if err != nil { 1286 err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") 1287 return 1288 } 1289 if !done { 1290 ar.Response = future.Response() 1291 err = azure.NewAsyncOpIncompleteError("operationalinsights.WorkspacesDeleteFuture") 1292 return 1293 } 1294 ar.Response = future.Response() 1295 return 1296} 1297 1298// WorkspaceSku the SKU (tier) of a workspace. 1299type WorkspaceSku struct { 1300 // Name - The name of the SKU. Possible values include: 'WorkspaceSkuNameEnumFree', 'WorkspaceSkuNameEnumStandard', 'WorkspaceSkuNameEnumPremium', 'WorkspaceSkuNameEnumPerNode', 'WorkspaceSkuNameEnumPerGB2018', 'WorkspaceSkuNameEnumStandalone', 'WorkspaceSkuNameEnumCapacityReservation', 'WorkspaceSkuNameEnumLACluster' 1301 Name WorkspaceSkuNameEnum `json:"name,omitempty"` 1302 // CapacityReservationLevel - The capacity reservation level for this workspace, when CapacityReservation sku is selected. 1303 CapacityReservationLevel *int32 `json:"capacityReservationLevel,omitempty"` 1304 // MaxCapacityReservationLevel - READ-ONLY; The maximum capacity reservation level available for this workspace, when CapacityReservation sku is selected. 1305 MaxCapacityReservationLevel *int32 `json:"maxCapacityReservationLevel,omitempty"` 1306 // LastSkuUpdate - READ-ONLY; The last time when the sku was updated. 1307 LastSkuUpdate *string `json:"lastSkuUpdate,omitempty"` 1308} 1309 1310// MarshalJSON is the custom marshaler for WorkspaceSku. 1311func (ws WorkspaceSku) MarshalJSON() ([]byte, error) { 1312 objectMap := make(map[string]interface{}) 1313 if ws.Name != "" { 1314 objectMap["name"] = ws.Name 1315 } 1316 if ws.CapacityReservationLevel != nil { 1317 objectMap["capacityReservationLevel"] = ws.CapacityReservationLevel 1318 } 1319 return json.Marshal(objectMap) 1320} 1321