1package kusto 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/kusto/mgmt/2019-09-07/kusto" 21 22// AttachedDatabaseConfiguration class representing an attached database configuration. 23type AttachedDatabaseConfiguration struct { 24 autorest.Response `json:"-"` 25 // Location - Resource location. 26 Location *string `json:"location,omitempty"` 27 // AttachedDatabaseConfigurationProperties - The properties of the attached database configuration. 28 *AttachedDatabaseConfigurationProperties `json:"properties,omitempty"` 29 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 30 ID *string `json:"id,omitempty"` 31 // Name - READ-ONLY; The name of the resource 32 Name *string `json:"name,omitempty"` 33 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 34 Type *string `json:"type,omitempty"` 35} 36 37// MarshalJSON is the custom marshaler for AttachedDatabaseConfiguration. 38func (adc AttachedDatabaseConfiguration) MarshalJSON() ([]byte, error) { 39 objectMap := make(map[string]interface{}) 40 if adc.Location != nil { 41 objectMap["location"] = adc.Location 42 } 43 if adc.AttachedDatabaseConfigurationProperties != nil { 44 objectMap["properties"] = adc.AttachedDatabaseConfigurationProperties 45 } 46 return json.Marshal(objectMap) 47} 48 49// UnmarshalJSON is the custom unmarshaler for AttachedDatabaseConfiguration struct. 50func (adc *AttachedDatabaseConfiguration) UnmarshalJSON(body []byte) error { 51 var m map[string]*json.RawMessage 52 err := json.Unmarshal(body, &m) 53 if err != nil { 54 return err 55 } 56 for k, v := range m { 57 switch k { 58 case "location": 59 if v != nil { 60 var location string 61 err = json.Unmarshal(*v, &location) 62 if err != nil { 63 return err 64 } 65 adc.Location = &location 66 } 67 case "properties": 68 if v != nil { 69 var attachedDatabaseConfigurationProperties AttachedDatabaseConfigurationProperties 70 err = json.Unmarshal(*v, &attachedDatabaseConfigurationProperties) 71 if err != nil { 72 return err 73 } 74 adc.AttachedDatabaseConfigurationProperties = &attachedDatabaseConfigurationProperties 75 } 76 case "id": 77 if v != nil { 78 var ID string 79 err = json.Unmarshal(*v, &ID) 80 if err != nil { 81 return err 82 } 83 adc.ID = &ID 84 } 85 case "name": 86 if v != nil { 87 var name string 88 err = json.Unmarshal(*v, &name) 89 if err != nil { 90 return err 91 } 92 adc.Name = &name 93 } 94 case "type": 95 if v != nil { 96 var typeVar string 97 err = json.Unmarshal(*v, &typeVar) 98 if err != nil { 99 return err 100 } 101 adc.Type = &typeVar 102 } 103 } 104 } 105 106 return nil 107} 108 109// AttachedDatabaseConfigurationListResult the list attached database configurations operation response. 110type AttachedDatabaseConfigurationListResult struct { 111 autorest.Response `json:"-"` 112 // Value - The list of attached database configurations. 113 Value *[]AttachedDatabaseConfiguration `json:"value,omitempty"` 114} 115 116// AttachedDatabaseConfigurationProperties class representing the an attached database configuration 117// properties of kind specific. 118type AttachedDatabaseConfigurationProperties struct { 119 // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' 120 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 121 // DatabaseName - The name of the database which you would like to attach, use * if you want to follow all current and future databases. 122 DatabaseName *string `json:"databaseName,omitempty"` 123 // ClusterResourceID - The resource id of the cluster where the databases you would like to attach reside. 124 ClusterResourceID *string `json:"clusterResourceId,omitempty"` 125 // AttachedDatabaseNames - READ-ONLY; The list of databases from the clusterResourceId which are currently attached to the cluster. 126 AttachedDatabaseNames *[]string `json:"attachedDatabaseNames,omitempty"` 127 // DefaultPrincipalsModificationKind - The default principals modification kind. Possible values include: 'DefaultPrincipalsModificationKindUnion', 'DefaultPrincipalsModificationKindReplace', 'DefaultPrincipalsModificationKindNone' 128 DefaultPrincipalsModificationKind DefaultPrincipalsModificationKind `json:"defaultPrincipalsModificationKind,omitempty"` 129} 130 131// MarshalJSON is the custom marshaler for AttachedDatabaseConfigurationProperties. 132func (adcp AttachedDatabaseConfigurationProperties) MarshalJSON() ([]byte, error) { 133 objectMap := make(map[string]interface{}) 134 if adcp.DatabaseName != nil { 135 objectMap["databaseName"] = adcp.DatabaseName 136 } 137 if adcp.ClusterResourceID != nil { 138 objectMap["clusterResourceId"] = adcp.ClusterResourceID 139 } 140 if adcp.DefaultPrincipalsModificationKind != "" { 141 objectMap["defaultPrincipalsModificationKind"] = adcp.DefaultPrincipalsModificationKind 142 } 143 return json.Marshal(objectMap) 144} 145 146// AttachedDatabaseConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the 147// results of a long-running operation. 148type AttachedDatabaseConfigurationsCreateOrUpdateFuture struct { 149 azure.FutureAPI 150 // Result returns the result of the asynchronous operation. 151 // If the operation has not completed it will return an error. 152 Result func(AttachedDatabaseConfigurationsClient) (AttachedDatabaseConfiguration, error) 153} 154 155// UnmarshalJSON is the custom unmarshaller for CreateFuture. 156func (future *AttachedDatabaseConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 157 var azFuture azure.Future 158 if err := json.Unmarshal(body, &azFuture); err != nil { 159 return err 160 } 161 future.FutureAPI = &azFuture 162 future.Result = future.result 163 return nil 164} 165 166// result is the default implementation for AttachedDatabaseConfigurationsCreateOrUpdateFuture.Result. 167func (future *AttachedDatabaseConfigurationsCreateOrUpdateFuture) result(client AttachedDatabaseConfigurationsClient) (adc AttachedDatabaseConfiguration, err error) { 168 var done bool 169 done, err = future.DoneWithContext(context.Background(), client) 170 if err != nil { 171 err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 172 return 173 } 174 if !done { 175 adc.Response.Response = future.Response() 176 err = azure.NewAsyncOpIncompleteError("kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture") 177 return 178 } 179 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 180 if adc.Response.Response, err = future.GetResult(sender); err == nil && adc.Response.Response.StatusCode != http.StatusNoContent { 181 adc, err = client.CreateOrUpdateResponder(adc.Response.Response) 182 if err != nil { 183 err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture", "Result", adc.Response.Response, "Failure responding to request") 184 } 185 } 186 return 187} 188 189// AttachedDatabaseConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a 190// long-running operation. 191type AttachedDatabaseConfigurationsDeleteFuture struct { 192 azure.FutureAPI 193 // Result returns the result of the asynchronous operation. 194 // If the operation has not completed it will return an error. 195 Result func(AttachedDatabaseConfigurationsClient) (autorest.Response, error) 196} 197 198// UnmarshalJSON is the custom unmarshaller for CreateFuture. 199func (future *AttachedDatabaseConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { 200 var azFuture azure.Future 201 if err := json.Unmarshal(body, &azFuture); err != nil { 202 return err 203 } 204 future.FutureAPI = &azFuture 205 future.Result = future.result 206 return nil 207} 208 209// result is the default implementation for AttachedDatabaseConfigurationsDeleteFuture.Result. 210func (future *AttachedDatabaseConfigurationsDeleteFuture) result(client AttachedDatabaseConfigurationsClient) (ar autorest.Response, err error) { 211 var done bool 212 done, err = future.DoneWithContext(context.Background(), client) 213 if err != nil { 214 err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") 215 return 216 } 217 if !done { 218 ar.Response = future.Response() 219 err = azure.NewAsyncOpIncompleteError("kusto.AttachedDatabaseConfigurationsDeleteFuture") 220 return 221 } 222 ar.Response = future.Response() 223 return 224} 225 226// AzureCapacity azure capacity definition. 227type AzureCapacity struct { 228 // ScaleType - Scale type. Possible values include: 'Automatic', 'Manual', 'None' 229 ScaleType AzureScaleType `json:"scaleType,omitempty"` 230 // Minimum - Minimum allowed capacity. 231 Minimum *int32 `json:"minimum,omitempty"` 232 // Maximum - Maximum allowed capacity. 233 Maximum *int32 `json:"maximum,omitempty"` 234 // Default - The default capacity that would be used. 235 Default *int32 `json:"default,omitempty"` 236} 237 238// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. 239type AzureEntityResource struct { 240 // Etag - READ-ONLY; Resource Etag. 241 Etag *string `json:"etag,omitempty"` 242 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 243 ID *string `json:"id,omitempty"` 244 // Name - READ-ONLY; The name of the resource 245 Name *string `json:"name,omitempty"` 246 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 247 Type *string `json:"type,omitempty"` 248} 249 250// MarshalJSON is the custom marshaler for AzureEntityResource. 251func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { 252 objectMap := make(map[string]interface{}) 253 return json.Marshal(objectMap) 254} 255 256// AzureResourceSku azure resource SKU definition. 257type AzureResourceSku struct { 258 // ResourceType - Resource Namespace and Type. 259 ResourceType *string `json:"resourceType,omitempty"` 260 // Sku - The SKU details. 261 Sku *AzureSku `json:"sku,omitempty"` 262 // Capacity - The number of instances of the cluster. 263 Capacity *AzureCapacity `json:"capacity,omitempty"` 264} 265 266// AzureSku azure SKU definition. 267type AzureSku struct { 268 // Name - SKU name. Possible values include: 'StandardDS13V21TBPS', 'StandardDS13V22TBPS', 'StandardDS14V23TBPS', 'StandardDS14V24TBPS', 'StandardD13V2', 'StandardD14V2', 'StandardL8s', 'StandardL16s', 'StandardD11V2', 'StandardD12V2', 'StandardL4s', 'DevNoSLAStandardD11V2' 269 Name AzureSkuName `json:"name,omitempty"` 270 // Capacity - The number of instances of the cluster. 271 Capacity *int32 `json:"capacity,omitempty"` 272 // Tier - SKU tier. Possible values include: 'Basic', 'Standard' 273 Tier AzureSkuTier `json:"tier,omitempty"` 274} 275 276// CheckNameRequest the result returned from a database check name availability request. 277type CheckNameRequest struct { 278 // Name - Resource name. 279 Name *string `json:"name,omitempty"` 280 // Type - The type of resource, for instance Microsoft.Kusto/clusters/databases. Possible values include: 'MicrosoftKustoclustersdatabases', 'MicrosoftKustoclustersattachedDatabaseConfigurations' 281 Type Type `json:"type,omitempty"` 282} 283 284// CheckNameResult the result returned from a check name availability request. 285type CheckNameResult struct { 286 autorest.Response `json:"-"` 287 // NameAvailable - Specifies a Boolean value that indicates if the name is available. 288 NameAvailable *bool `json:"nameAvailable,omitempty"` 289 // Name - The name that was checked. 290 Name *string `json:"name,omitempty"` 291 // Message - Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. 292 Message *string `json:"message,omitempty"` 293 // Reason - Message providing the reason why the given name is invalid. Possible values include: 'Invalid', 'AlreadyExists' 294 Reason Reason `json:"reason,omitempty"` 295} 296 297// CloudError an error response from Kusto. 298type CloudError struct { 299 // Error - An error response from Kusto. 300 Error *CloudErrorBody `json:"error,omitempty"` 301} 302 303// CloudErrorBody an error response from Kusto. 304type CloudErrorBody struct { 305 // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. 306 Code *string `json:"code,omitempty"` 307 // Message - A message describing the error, intended to be suitable for displaying in a user interface. 308 Message *string `json:"message,omitempty"` 309 // Target - The target of the particular error. For example, the name of the property in error. 310 Target *string `json:"target,omitempty"` 311 // Details - A list of additional details about the error. 312 Details *[]CloudErrorBody `json:"details,omitempty"` 313} 314 315// Cluster class representing a Kusto cluster. 316type Cluster struct { 317 autorest.Response `json:"-"` 318 // Sku - The SKU of the cluster. 319 Sku *AzureSku `json:"sku,omitempty"` 320 // Zones - The availability zones of the cluster. 321 Zones *[]string `json:"zones,omitempty"` 322 // Identity - The identity of the cluster, if configured. 323 Identity *Identity `json:"identity,omitempty"` 324 // ClusterProperties - The cluster properties. 325 *ClusterProperties `json:"properties,omitempty"` 326 // Tags - Resource tags. 327 Tags map[string]*string `json:"tags"` 328 // Location - The geo-location where the resource lives 329 Location *string `json:"location,omitempty"` 330 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 331 ID *string `json:"id,omitempty"` 332 // Name - READ-ONLY; The name of the resource 333 Name *string `json:"name,omitempty"` 334 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 335 Type *string `json:"type,omitempty"` 336} 337 338// MarshalJSON is the custom marshaler for Cluster. 339func (c Cluster) MarshalJSON() ([]byte, error) { 340 objectMap := make(map[string]interface{}) 341 if c.Sku != nil { 342 objectMap["sku"] = c.Sku 343 } 344 if c.Zones != nil { 345 objectMap["zones"] = c.Zones 346 } 347 if c.Identity != nil { 348 objectMap["identity"] = c.Identity 349 } 350 if c.ClusterProperties != nil { 351 objectMap["properties"] = c.ClusterProperties 352 } 353 if c.Tags != nil { 354 objectMap["tags"] = c.Tags 355 } 356 if c.Location != nil { 357 objectMap["location"] = c.Location 358 } 359 return json.Marshal(objectMap) 360} 361 362// UnmarshalJSON is the custom unmarshaler for Cluster struct. 363func (c *Cluster) UnmarshalJSON(body []byte) error { 364 var m map[string]*json.RawMessage 365 err := json.Unmarshal(body, &m) 366 if err != nil { 367 return err 368 } 369 for k, v := range m { 370 switch k { 371 case "sku": 372 if v != nil { 373 var sku AzureSku 374 err = json.Unmarshal(*v, &sku) 375 if err != nil { 376 return err 377 } 378 c.Sku = &sku 379 } 380 case "zones": 381 if v != nil { 382 var zones []string 383 err = json.Unmarshal(*v, &zones) 384 if err != nil { 385 return err 386 } 387 c.Zones = &zones 388 } 389 case "identity": 390 if v != nil { 391 var identity Identity 392 err = json.Unmarshal(*v, &identity) 393 if err != nil { 394 return err 395 } 396 c.Identity = &identity 397 } 398 case "properties": 399 if v != nil { 400 var clusterProperties ClusterProperties 401 err = json.Unmarshal(*v, &clusterProperties) 402 if err != nil { 403 return err 404 } 405 c.ClusterProperties = &clusterProperties 406 } 407 case "tags": 408 if v != nil { 409 var tags map[string]*string 410 err = json.Unmarshal(*v, &tags) 411 if err != nil { 412 return err 413 } 414 c.Tags = tags 415 } 416 case "location": 417 if v != nil { 418 var location string 419 err = json.Unmarshal(*v, &location) 420 if err != nil { 421 return err 422 } 423 c.Location = &location 424 } 425 case "id": 426 if v != nil { 427 var ID string 428 err = json.Unmarshal(*v, &ID) 429 if err != nil { 430 return err 431 } 432 c.ID = &ID 433 } 434 case "name": 435 if v != nil { 436 var name string 437 err = json.Unmarshal(*v, &name) 438 if err != nil { 439 return err 440 } 441 c.Name = &name 442 } 443 case "type": 444 if v != nil { 445 var typeVar string 446 err = json.Unmarshal(*v, &typeVar) 447 if err != nil { 448 return err 449 } 450 c.Type = &typeVar 451 } 452 } 453 } 454 455 return nil 456} 457 458// ClusterCheckNameRequest the result returned from a cluster check name availability request. 459type ClusterCheckNameRequest struct { 460 // Name - Cluster name. 461 Name *string `json:"name,omitempty"` 462 // Type - The type of resource, Microsoft.Kusto/clusters. 463 Type *string `json:"type,omitempty"` 464} 465 466// ClusterListResult the list Kusto clusters operation response. 467type ClusterListResult struct { 468 autorest.Response `json:"-"` 469 // Value - The list of Kusto clusters. 470 Value *[]Cluster `json:"value,omitempty"` 471} 472 473// ClusterProperties class representing the Kusto cluster properties. 474type ClusterProperties struct { 475 // State - READ-ONLY; The state of the resource. Possible values include: 'StateCreating', 'StateUnavailable', 'StateRunning', 'StateDeleting', 'StateDeleted', 'StateStopping', 'StateStopped', 'StateStarting', 'StateUpdating' 476 State State `json:"state,omitempty"` 477 // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' 478 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 479 // URI - READ-ONLY; The cluster URI. 480 URI *string `json:"uri,omitempty"` 481 // DataIngestionURI - READ-ONLY; The cluster data ingestion URI. 482 DataIngestionURI *string `json:"dataIngestionUri,omitempty"` 483 // TrustedExternalTenants - The cluster's external tenants. 484 TrustedExternalTenants *[]TrustedExternalTenant `json:"trustedExternalTenants,omitempty"` 485 // OptimizedAutoscale - Optimized auto scale definition. 486 OptimizedAutoscale *OptimizedAutoscale `json:"optimizedAutoscale,omitempty"` 487 // EnableDiskEncryption - A boolean value that indicates if the cluster's disks are encrypted. 488 EnableDiskEncryption *bool `json:"enableDiskEncryption,omitempty"` 489 // EnableStreamingIngest - A boolean value that indicates if the streaming ingest is enabled. 490 EnableStreamingIngest *bool `json:"enableStreamingIngest,omitempty"` 491 // VirtualNetworkConfiguration - Virtual network definition. 492 VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` 493 // KeyVaultProperties - KeyVault properties for the cluster encryption. 494 KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` 495} 496 497// MarshalJSON is the custom marshaler for ClusterProperties. 498func (cp ClusterProperties) MarshalJSON() ([]byte, error) { 499 objectMap := make(map[string]interface{}) 500 if cp.TrustedExternalTenants != nil { 501 objectMap["trustedExternalTenants"] = cp.TrustedExternalTenants 502 } 503 if cp.OptimizedAutoscale != nil { 504 objectMap["optimizedAutoscale"] = cp.OptimizedAutoscale 505 } 506 if cp.EnableDiskEncryption != nil { 507 objectMap["enableDiskEncryption"] = cp.EnableDiskEncryption 508 } 509 if cp.EnableStreamingIngest != nil { 510 objectMap["enableStreamingIngest"] = cp.EnableStreamingIngest 511 } 512 if cp.VirtualNetworkConfiguration != nil { 513 objectMap["virtualNetworkConfiguration"] = cp.VirtualNetworkConfiguration 514 } 515 if cp.KeyVaultProperties != nil { 516 objectMap["keyVaultProperties"] = cp.KeyVaultProperties 517 } 518 return json.Marshal(objectMap) 519} 520 521// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 522// operation. 523type ClustersCreateOrUpdateFuture struct { 524 azure.FutureAPI 525 // Result returns the result of the asynchronous operation. 526 // If the operation has not completed it will return an error. 527 Result func(ClustersClient) (Cluster, error) 528} 529 530// UnmarshalJSON is the custom unmarshaller for CreateFuture. 531func (future *ClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 532 var azFuture azure.Future 533 if err := json.Unmarshal(body, &azFuture); err != nil { 534 return err 535 } 536 future.FutureAPI = &azFuture 537 future.Result = future.result 538 return nil 539} 540 541// result is the default implementation for ClustersCreateOrUpdateFuture.Result. 542func (future *ClustersCreateOrUpdateFuture) result(client ClustersClient) (c Cluster, err error) { 543 var done bool 544 done, err = future.DoneWithContext(context.Background(), client) 545 if err != nil { 546 err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 547 return 548 } 549 if !done { 550 c.Response.Response = future.Response() 551 err = azure.NewAsyncOpIncompleteError("kusto.ClustersCreateOrUpdateFuture") 552 return 553 } 554 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 555 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { 556 c, err = client.CreateOrUpdateResponder(c.Response.Response) 557 if err != nil { 558 err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") 559 } 560 } 561 return 562} 563 564// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 565// operation. 566type ClustersDeleteFuture struct { 567 azure.FutureAPI 568 // Result returns the result of the asynchronous operation. 569 // If the operation has not completed it will return an error. 570 Result func(ClustersClient) (autorest.Response, error) 571} 572 573// UnmarshalJSON is the custom unmarshaller for CreateFuture. 574func (future *ClustersDeleteFuture) UnmarshalJSON(body []byte) error { 575 var azFuture azure.Future 576 if err := json.Unmarshal(body, &azFuture); err != nil { 577 return err 578 } 579 future.FutureAPI = &azFuture 580 future.Result = future.result 581 return nil 582} 583 584// result is the default implementation for ClustersDeleteFuture.Result. 585func (future *ClustersDeleteFuture) result(client ClustersClient) (ar autorest.Response, err error) { 586 var done bool 587 done, err = future.DoneWithContext(context.Background(), client) 588 if err != nil { 589 err = autorest.NewErrorWithError(err, "kusto.ClustersDeleteFuture", "Result", future.Response(), "Polling failure") 590 return 591 } 592 if !done { 593 ar.Response = future.Response() 594 err = azure.NewAsyncOpIncompleteError("kusto.ClustersDeleteFuture") 595 return 596 } 597 ar.Response = future.Response() 598 return 599} 600 601// ClustersDetachFollowerDatabasesFuture an abstraction for monitoring and retrieving the results of a 602// long-running operation. 603type ClustersDetachFollowerDatabasesFuture struct { 604 azure.FutureAPI 605 // Result returns the result of the asynchronous operation. 606 // If the operation has not completed it will return an error. 607 Result func(ClustersClient) (autorest.Response, error) 608} 609 610// UnmarshalJSON is the custom unmarshaller for CreateFuture. 611func (future *ClustersDetachFollowerDatabasesFuture) UnmarshalJSON(body []byte) error { 612 var azFuture azure.Future 613 if err := json.Unmarshal(body, &azFuture); err != nil { 614 return err 615 } 616 future.FutureAPI = &azFuture 617 future.Result = future.result 618 return nil 619} 620 621// result is the default implementation for ClustersDetachFollowerDatabasesFuture.Result. 622func (future *ClustersDetachFollowerDatabasesFuture) result(client ClustersClient) (ar autorest.Response, err error) { 623 var done bool 624 done, err = future.DoneWithContext(context.Background(), client) 625 if err != nil { 626 err = autorest.NewErrorWithError(err, "kusto.ClustersDetachFollowerDatabasesFuture", "Result", future.Response(), "Polling failure") 627 return 628 } 629 if !done { 630 ar.Response = future.Response() 631 err = azure.NewAsyncOpIncompleteError("kusto.ClustersDetachFollowerDatabasesFuture") 632 return 633 } 634 ar.Response = future.Response() 635 return 636} 637 638// ClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running 639// operation. 640type ClustersStartFuture struct { 641 azure.FutureAPI 642 // Result returns the result of the asynchronous operation. 643 // If the operation has not completed it will return an error. 644 Result func(ClustersClient) (autorest.Response, error) 645} 646 647// UnmarshalJSON is the custom unmarshaller for CreateFuture. 648func (future *ClustersStartFuture) UnmarshalJSON(body []byte) error { 649 var azFuture azure.Future 650 if err := json.Unmarshal(body, &azFuture); err != nil { 651 return err 652 } 653 future.FutureAPI = &azFuture 654 future.Result = future.result 655 return nil 656} 657 658// result is the default implementation for ClustersStartFuture.Result. 659func (future *ClustersStartFuture) result(client ClustersClient) (ar autorest.Response, err error) { 660 var done bool 661 done, err = future.DoneWithContext(context.Background(), client) 662 if err != nil { 663 err = autorest.NewErrorWithError(err, "kusto.ClustersStartFuture", "Result", future.Response(), "Polling failure") 664 return 665 } 666 if !done { 667 ar.Response = future.Response() 668 err = azure.NewAsyncOpIncompleteError("kusto.ClustersStartFuture") 669 return 670 } 671 ar.Response = future.Response() 672 return 673} 674 675// ClustersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. 676type ClustersStopFuture struct { 677 azure.FutureAPI 678 // Result returns the result of the asynchronous operation. 679 // If the operation has not completed it will return an error. 680 Result func(ClustersClient) (autorest.Response, error) 681} 682 683// UnmarshalJSON is the custom unmarshaller for CreateFuture. 684func (future *ClustersStopFuture) UnmarshalJSON(body []byte) error { 685 var azFuture azure.Future 686 if err := json.Unmarshal(body, &azFuture); err != nil { 687 return err 688 } 689 future.FutureAPI = &azFuture 690 future.Result = future.result 691 return nil 692} 693 694// result is the default implementation for ClustersStopFuture.Result. 695func (future *ClustersStopFuture) result(client ClustersClient) (ar autorest.Response, err error) { 696 var done bool 697 done, err = future.DoneWithContext(context.Background(), client) 698 if err != nil { 699 err = autorest.NewErrorWithError(err, "kusto.ClustersStopFuture", "Result", future.Response(), "Polling failure") 700 return 701 } 702 if !done { 703 ar.Response = future.Response() 704 err = azure.NewAsyncOpIncompleteError("kusto.ClustersStopFuture") 705 return 706 } 707 ar.Response = future.Response() 708 return 709} 710 711// ClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 712// operation. 713type ClustersUpdateFuture struct { 714 azure.FutureAPI 715 // Result returns the result of the asynchronous operation. 716 // If the operation has not completed it will return an error. 717 Result func(ClustersClient) (Cluster, error) 718} 719 720// UnmarshalJSON is the custom unmarshaller for CreateFuture. 721func (future *ClustersUpdateFuture) UnmarshalJSON(body []byte) error { 722 var azFuture azure.Future 723 if err := json.Unmarshal(body, &azFuture); err != nil { 724 return err 725 } 726 future.FutureAPI = &azFuture 727 future.Result = future.result 728 return nil 729} 730 731// result is the default implementation for ClustersUpdateFuture.Result. 732func (future *ClustersUpdateFuture) result(client ClustersClient) (c Cluster, err error) { 733 var done bool 734 done, err = future.DoneWithContext(context.Background(), client) 735 if err != nil { 736 err = autorest.NewErrorWithError(err, "kusto.ClustersUpdateFuture", "Result", future.Response(), "Polling failure") 737 return 738 } 739 if !done { 740 c.Response.Response = future.Response() 741 err = azure.NewAsyncOpIncompleteError("kusto.ClustersUpdateFuture") 742 return 743 } 744 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 745 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { 746 c, err = client.UpdateResponder(c.Response.Response) 747 if err != nil { 748 err = autorest.NewErrorWithError(err, "kusto.ClustersUpdateFuture", "Result", c.Response.Response, "Failure responding to request") 749 } 750 } 751 return 752} 753 754// ClusterUpdate class representing an update to a Kusto cluster. 755type ClusterUpdate struct { 756 // Tags - Resource tags. 757 Tags map[string]*string `json:"tags"` 758 // Location - Resource location. 759 Location *string `json:"location,omitempty"` 760 // Sku - The SKU of the cluster. 761 Sku *AzureSku `json:"sku,omitempty"` 762 // Identity - The identity of the cluster, if configured. 763 Identity *Identity `json:"identity,omitempty"` 764 // ClusterProperties - The cluster properties. 765 *ClusterProperties `json:"properties,omitempty"` 766 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 767 ID *string `json:"id,omitempty"` 768 // Name - READ-ONLY; The name of the resource 769 Name *string `json:"name,omitempty"` 770 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 771 Type *string `json:"type,omitempty"` 772} 773 774// MarshalJSON is the custom marshaler for ClusterUpdate. 775func (cu ClusterUpdate) MarshalJSON() ([]byte, error) { 776 objectMap := make(map[string]interface{}) 777 if cu.Tags != nil { 778 objectMap["tags"] = cu.Tags 779 } 780 if cu.Location != nil { 781 objectMap["location"] = cu.Location 782 } 783 if cu.Sku != nil { 784 objectMap["sku"] = cu.Sku 785 } 786 if cu.Identity != nil { 787 objectMap["identity"] = cu.Identity 788 } 789 if cu.ClusterProperties != nil { 790 objectMap["properties"] = cu.ClusterProperties 791 } 792 return json.Marshal(objectMap) 793} 794 795// UnmarshalJSON is the custom unmarshaler for ClusterUpdate struct. 796func (cu *ClusterUpdate) UnmarshalJSON(body []byte) error { 797 var m map[string]*json.RawMessage 798 err := json.Unmarshal(body, &m) 799 if err != nil { 800 return err 801 } 802 for k, v := range m { 803 switch k { 804 case "tags": 805 if v != nil { 806 var tags map[string]*string 807 err = json.Unmarshal(*v, &tags) 808 if err != nil { 809 return err 810 } 811 cu.Tags = tags 812 } 813 case "location": 814 if v != nil { 815 var location string 816 err = json.Unmarshal(*v, &location) 817 if err != nil { 818 return err 819 } 820 cu.Location = &location 821 } 822 case "sku": 823 if v != nil { 824 var sku AzureSku 825 err = json.Unmarshal(*v, &sku) 826 if err != nil { 827 return err 828 } 829 cu.Sku = &sku 830 } 831 case "identity": 832 if v != nil { 833 var identity Identity 834 err = json.Unmarshal(*v, &identity) 835 if err != nil { 836 return err 837 } 838 cu.Identity = &identity 839 } 840 case "properties": 841 if v != nil { 842 var clusterProperties ClusterProperties 843 err = json.Unmarshal(*v, &clusterProperties) 844 if err != nil { 845 return err 846 } 847 cu.ClusterProperties = &clusterProperties 848 } 849 case "id": 850 if v != nil { 851 var ID string 852 err = json.Unmarshal(*v, &ID) 853 if err != nil { 854 return err 855 } 856 cu.ID = &ID 857 } 858 case "name": 859 if v != nil { 860 var name string 861 err = json.Unmarshal(*v, &name) 862 if err != nil { 863 return err 864 } 865 cu.Name = &name 866 } 867 case "type": 868 if v != nil { 869 var typeVar string 870 err = json.Unmarshal(*v, &typeVar) 871 if err != nil { 872 return err 873 } 874 cu.Type = &typeVar 875 } 876 } 877 } 878 879 return nil 880} 881 882// BasicDatabase class representing a Kusto database. 883type BasicDatabase interface { 884 AsReadWriteDatabase() (*ReadWriteDatabase, bool) 885 AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) 886 AsDatabase() (*Database, bool) 887} 888 889// Database class representing a Kusto database. 890type Database struct { 891 autorest.Response `json:"-"` 892 // Location - Resource location. 893 Location *string `json:"location,omitempty"` 894 // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' 895 Kind Kind `json:"kind,omitempty"` 896 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 897 ID *string `json:"id,omitempty"` 898 // Name - READ-ONLY; The name of the resource 899 Name *string `json:"name,omitempty"` 900 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 901 Type *string `json:"type,omitempty"` 902} 903 904func unmarshalBasicDatabase(body []byte) (BasicDatabase, error) { 905 var m map[string]interface{} 906 err := json.Unmarshal(body, &m) 907 if err != nil { 908 return nil, err 909 } 910 911 switch m["kind"] { 912 case string(KindReadWrite): 913 var rwd ReadWriteDatabase 914 err := json.Unmarshal(body, &rwd) 915 return rwd, err 916 case string(KindReadOnlyFollowing): 917 var rofd ReadOnlyFollowingDatabase 918 err := json.Unmarshal(body, &rofd) 919 return rofd, err 920 default: 921 var d Database 922 err := json.Unmarshal(body, &d) 923 return d, err 924 } 925} 926func unmarshalBasicDatabaseArray(body []byte) ([]BasicDatabase, error) { 927 var rawMessages []*json.RawMessage 928 err := json.Unmarshal(body, &rawMessages) 929 if err != nil { 930 return nil, err 931 } 932 933 dArray := make([]BasicDatabase, len(rawMessages)) 934 935 for index, rawMessage := range rawMessages { 936 d, err := unmarshalBasicDatabase(*rawMessage) 937 if err != nil { 938 return nil, err 939 } 940 dArray[index] = d 941 } 942 return dArray, nil 943} 944 945// MarshalJSON is the custom marshaler for Database. 946func (d Database) MarshalJSON() ([]byte, error) { 947 d.Kind = KindDatabase 948 objectMap := make(map[string]interface{}) 949 if d.Location != nil { 950 objectMap["location"] = d.Location 951 } 952 if d.Kind != "" { 953 objectMap["kind"] = d.Kind 954 } 955 return json.Marshal(objectMap) 956} 957 958// AsReadWriteDatabase is the BasicDatabase implementation for Database. 959func (d Database) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { 960 return nil, false 961} 962 963// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for Database. 964func (d Database) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { 965 return nil, false 966} 967 968// AsDatabase is the BasicDatabase implementation for Database. 969func (d Database) AsDatabase() (*Database, bool) { 970 return &d, true 971} 972 973// AsBasicDatabase is the BasicDatabase implementation for Database. 974func (d Database) AsBasicDatabase() (BasicDatabase, bool) { 975 return &d, true 976} 977 978// DatabaseListResult the list Kusto databases operation response. 979type DatabaseListResult struct { 980 autorest.Response `json:"-"` 981 // Value - The list of Kusto databases. 982 Value *[]BasicDatabase `json:"value,omitempty"` 983} 984 985// UnmarshalJSON is the custom unmarshaler for DatabaseListResult struct. 986func (dlr *DatabaseListResult) UnmarshalJSON(body []byte) error { 987 var m map[string]*json.RawMessage 988 err := json.Unmarshal(body, &m) 989 if err != nil { 990 return err 991 } 992 for k, v := range m { 993 switch k { 994 case "value": 995 if v != nil { 996 value, err := unmarshalBasicDatabaseArray(*v) 997 if err != nil { 998 return err 999 } 1000 dlr.Value = &value 1001 } 1002 } 1003 } 1004 1005 return nil 1006} 1007 1008// DatabaseModel ... 1009type DatabaseModel struct { 1010 autorest.Response `json:"-"` 1011 Value BasicDatabase `json:"value,omitempty"` 1012} 1013 1014// UnmarshalJSON is the custom unmarshaler for DatabaseModel struct. 1015func (dm *DatabaseModel) UnmarshalJSON(body []byte) error { 1016 d, err := unmarshalBasicDatabase(body) 1017 if err != nil { 1018 return err 1019 } 1020 dm.Value = d 1021 1022 return nil 1023} 1024 1025// DatabasePrincipal a class representing database principal entity. 1026type DatabasePrincipal struct { 1027 // Role - Database principal role. Possible values include: 'Admin', 'Ingestor', 'Monitor', 'User', 'UnrestrictedViewers', 'Viewer' 1028 Role DatabasePrincipalRole `json:"role,omitempty"` 1029 // Name - Database principal name. 1030 Name *string `json:"name,omitempty"` 1031 // Type - Database principal type. Possible values include: 'DatabasePrincipalTypeApp', 'DatabasePrincipalTypeGroup', 'DatabasePrincipalTypeUser' 1032 Type DatabasePrincipalType `json:"type,omitempty"` 1033 // Fqn - Database principal fully qualified name. 1034 Fqn *string `json:"fqn,omitempty"` 1035 // Email - Database principal email if exists. 1036 Email *string `json:"email,omitempty"` 1037 // AppID - Application id - relevant only for application principal type. 1038 AppID *string `json:"appId,omitempty"` 1039 // TenantName - READ-ONLY; The tenant name of the principal 1040 TenantName *string `json:"tenantName,omitempty"` 1041} 1042 1043// MarshalJSON is the custom marshaler for DatabasePrincipal. 1044func (dp DatabasePrincipal) MarshalJSON() ([]byte, error) { 1045 objectMap := make(map[string]interface{}) 1046 if dp.Role != "" { 1047 objectMap["role"] = dp.Role 1048 } 1049 if dp.Name != nil { 1050 objectMap["name"] = dp.Name 1051 } 1052 if dp.Type != "" { 1053 objectMap["type"] = dp.Type 1054 } 1055 if dp.Fqn != nil { 1056 objectMap["fqn"] = dp.Fqn 1057 } 1058 if dp.Email != nil { 1059 objectMap["email"] = dp.Email 1060 } 1061 if dp.AppID != nil { 1062 objectMap["appId"] = dp.AppID 1063 } 1064 return json.Marshal(objectMap) 1065} 1066 1067// DatabasePrincipalListRequest the list Kusto database principals operation request. 1068type DatabasePrincipalListRequest struct { 1069 // Value - The list of Kusto database principals. 1070 Value *[]DatabasePrincipal `json:"value,omitempty"` 1071} 1072 1073// DatabasePrincipalListResult the list Kusto database principals operation response. 1074type DatabasePrincipalListResult struct { 1075 autorest.Response `json:"-"` 1076 // Value - The list of Kusto database principals. 1077 Value *[]DatabasePrincipal `json:"value,omitempty"` 1078} 1079 1080// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 1081// operation. 1082type DatabasesCreateOrUpdateFuture struct { 1083 azure.FutureAPI 1084 // Result returns the result of the asynchronous operation. 1085 // If the operation has not completed it will return an error. 1086 Result func(DatabasesClient) (DatabaseModel, error) 1087} 1088 1089// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1090func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1091 var azFuture azure.Future 1092 if err := json.Unmarshal(body, &azFuture); err != nil { 1093 return err 1094 } 1095 future.FutureAPI = &azFuture 1096 future.Result = future.result 1097 return nil 1098} 1099 1100// result is the default implementation for DatabasesCreateOrUpdateFuture.Result. 1101func (future *DatabasesCreateOrUpdateFuture) result(client DatabasesClient) (dm DatabaseModel, err error) { 1102 var done bool 1103 done, err = future.DoneWithContext(context.Background(), client) 1104 if err != nil { 1105 err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1106 return 1107 } 1108 if !done { 1109 dm.Response.Response = future.Response() 1110 err = azure.NewAsyncOpIncompleteError("kusto.DatabasesCreateOrUpdateFuture") 1111 return 1112 } 1113 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1114 if dm.Response.Response, err = future.GetResult(sender); err == nil && dm.Response.Response.StatusCode != http.StatusNoContent { 1115 dm, err = client.CreateOrUpdateResponder(dm.Response.Response) 1116 if err != nil { 1117 err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", dm.Response.Response, "Failure responding to request") 1118 } 1119 } 1120 return 1121} 1122 1123// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1124// operation. 1125type DatabasesDeleteFuture struct { 1126 azure.FutureAPI 1127 // Result returns the result of the asynchronous operation. 1128 // If the operation has not completed it will return an error. 1129 Result func(DatabasesClient) (autorest.Response, error) 1130} 1131 1132// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1133func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error { 1134 var azFuture azure.Future 1135 if err := json.Unmarshal(body, &azFuture); err != nil { 1136 return err 1137 } 1138 future.FutureAPI = &azFuture 1139 future.Result = future.result 1140 return nil 1141} 1142 1143// result is the default implementation for DatabasesDeleteFuture.Result. 1144func (future *DatabasesDeleteFuture) result(client DatabasesClient) (ar autorest.Response, err error) { 1145 var done bool 1146 done, err = future.DoneWithContext(context.Background(), client) 1147 if err != nil { 1148 err = autorest.NewErrorWithError(err, "kusto.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") 1149 return 1150 } 1151 if !done { 1152 ar.Response = future.Response() 1153 err = azure.NewAsyncOpIncompleteError("kusto.DatabasesDeleteFuture") 1154 return 1155 } 1156 ar.Response = future.Response() 1157 return 1158} 1159 1160// DatabaseStatistics a class that contains database statistics information. 1161type DatabaseStatistics struct { 1162 // Size - The database size - the total size of compressed data and index in bytes. 1163 Size *float64 `json:"size,omitempty"` 1164} 1165 1166// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 1167// operation. 1168type DatabasesUpdateFuture struct { 1169 azure.FutureAPI 1170 // Result returns the result of the asynchronous operation. 1171 // If the operation has not completed it will return an error. 1172 Result func(DatabasesClient) (DatabaseModel, error) 1173} 1174 1175// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1176func (future *DatabasesUpdateFuture) UnmarshalJSON(body []byte) error { 1177 var azFuture azure.Future 1178 if err := json.Unmarshal(body, &azFuture); err != nil { 1179 return err 1180 } 1181 future.FutureAPI = &azFuture 1182 future.Result = future.result 1183 return nil 1184} 1185 1186// result is the default implementation for DatabasesUpdateFuture.Result. 1187func (future *DatabasesUpdateFuture) result(client DatabasesClient) (dm DatabaseModel, err error) { 1188 var done bool 1189 done, err = future.DoneWithContext(context.Background(), client) 1190 if err != nil { 1191 err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") 1192 return 1193 } 1194 if !done { 1195 dm.Response.Response = future.Response() 1196 err = azure.NewAsyncOpIncompleteError("kusto.DatabasesUpdateFuture") 1197 return 1198 } 1199 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1200 if dm.Response.Response, err = future.GetResult(sender); err == nil && dm.Response.Response.StatusCode != http.StatusNoContent { 1201 dm, err = client.UpdateResponder(dm.Response.Response) 1202 if err != nil { 1203 err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", dm.Response.Response, "Failure responding to request") 1204 } 1205 } 1206 return 1207} 1208 1209// BasicDataConnection class representing an data connection. 1210type BasicDataConnection interface { 1211 AsEventHubDataConnection() (*EventHubDataConnection, bool) 1212 AsIotHubDataConnection() (*IotHubDataConnection, bool) 1213 AsEventGridDataConnection() (*EventGridDataConnection, bool) 1214 AsDataConnection() (*DataConnection, bool) 1215} 1216 1217// DataConnection class representing an data connection. 1218type DataConnection struct { 1219 autorest.Response `json:"-"` 1220 // Location - Resource location. 1221 Location *string `json:"location,omitempty"` 1222 // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindIotHub', 'KindEventGrid' 1223 Kind KindBasicDataConnection `json:"kind,omitempty"` 1224 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1225 ID *string `json:"id,omitempty"` 1226 // Name - READ-ONLY; The name of the resource 1227 Name *string `json:"name,omitempty"` 1228 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1229 Type *string `json:"type,omitempty"` 1230} 1231 1232func unmarshalBasicDataConnection(body []byte) (BasicDataConnection, error) { 1233 var m map[string]interface{} 1234 err := json.Unmarshal(body, &m) 1235 if err != nil { 1236 return nil, err 1237 } 1238 1239 switch m["kind"] { 1240 case string(KindEventHub): 1241 var ehdc EventHubDataConnection 1242 err := json.Unmarshal(body, &ehdc) 1243 return ehdc, err 1244 case string(KindIotHub): 1245 var ihdc IotHubDataConnection 1246 err := json.Unmarshal(body, &ihdc) 1247 return ihdc, err 1248 case string(KindEventGrid): 1249 var egdc EventGridDataConnection 1250 err := json.Unmarshal(body, &egdc) 1251 return egdc, err 1252 default: 1253 var dc DataConnection 1254 err := json.Unmarshal(body, &dc) 1255 return dc, err 1256 } 1257} 1258func unmarshalBasicDataConnectionArray(body []byte) ([]BasicDataConnection, error) { 1259 var rawMessages []*json.RawMessage 1260 err := json.Unmarshal(body, &rawMessages) 1261 if err != nil { 1262 return nil, err 1263 } 1264 1265 dcArray := make([]BasicDataConnection, len(rawMessages)) 1266 1267 for index, rawMessage := range rawMessages { 1268 dc, err := unmarshalBasicDataConnection(*rawMessage) 1269 if err != nil { 1270 return nil, err 1271 } 1272 dcArray[index] = dc 1273 } 1274 return dcArray, nil 1275} 1276 1277// MarshalJSON is the custom marshaler for DataConnection. 1278func (dc DataConnection) MarshalJSON() ([]byte, error) { 1279 dc.Kind = KindDataConnection 1280 objectMap := make(map[string]interface{}) 1281 if dc.Location != nil { 1282 objectMap["location"] = dc.Location 1283 } 1284 if dc.Kind != "" { 1285 objectMap["kind"] = dc.Kind 1286 } 1287 return json.Marshal(objectMap) 1288} 1289 1290// AsEventHubDataConnection is the BasicDataConnection implementation for DataConnection. 1291func (dc DataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { 1292 return nil, false 1293} 1294 1295// AsIotHubDataConnection is the BasicDataConnection implementation for DataConnection. 1296func (dc DataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { 1297 return nil, false 1298} 1299 1300// AsEventGridDataConnection is the BasicDataConnection implementation for DataConnection. 1301func (dc DataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { 1302 return nil, false 1303} 1304 1305// AsDataConnection is the BasicDataConnection implementation for DataConnection. 1306func (dc DataConnection) AsDataConnection() (*DataConnection, bool) { 1307 return &dc, true 1308} 1309 1310// AsBasicDataConnection is the BasicDataConnection implementation for DataConnection. 1311func (dc DataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { 1312 return &dc, true 1313} 1314 1315// DataConnectionCheckNameRequest the result returned from a data connections check name availability 1316// request. 1317type DataConnectionCheckNameRequest struct { 1318 // Name - Data Connection name. 1319 Name *string `json:"name,omitempty"` 1320 // Type - The type of resource, Microsoft.Kusto/clusters/databases/dataConnections. 1321 Type *string `json:"type,omitempty"` 1322} 1323 1324// DataConnectionListResult the list Kusto data connections operation response. 1325type DataConnectionListResult struct { 1326 autorest.Response `json:"-"` 1327 // Value - The list of Kusto data connections. 1328 Value *[]BasicDataConnection `json:"value,omitempty"` 1329} 1330 1331// UnmarshalJSON is the custom unmarshaler for DataConnectionListResult struct. 1332func (dclr *DataConnectionListResult) UnmarshalJSON(body []byte) error { 1333 var m map[string]*json.RawMessage 1334 err := json.Unmarshal(body, &m) 1335 if err != nil { 1336 return err 1337 } 1338 for k, v := range m { 1339 switch k { 1340 case "value": 1341 if v != nil { 1342 value, err := unmarshalBasicDataConnectionArray(*v) 1343 if err != nil { 1344 return err 1345 } 1346 dclr.Value = &value 1347 } 1348 } 1349 } 1350 1351 return nil 1352} 1353 1354// DataConnectionModel ... 1355type DataConnectionModel struct { 1356 autorest.Response `json:"-"` 1357 Value BasicDataConnection `json:"value,omitempty"` 1358} 1359 1360// UnmarshalJSON is the custom unmarshaler for DataConnectionModel struct. 1361func (dcm *DataConnectionModel) UnmarshalJSON(body []byte) error { 1362 dc, err := unmarshalBasicDataConnection(body) 1363 if err != nil { 1364 return err 1365 } 1366 dcm.Value = dc 1367 1368 return nil 1369} 1370 1371// DataConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1372// long-running operation. 1373type DataConnectionsCreateOrUpdateFuture struct { 1374 azure.FutureAPI 1375 // Result returns the result of the asynchronous operation. 1376 // If the operation has not completed it will return an error. 1377 Result func(DataConnectionsClient) (DataConnectionModel, error) 1378} 1379 1380// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1381func (future *DataConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { 1382 var azFuture azure.Future 1383 if err := json.Unmarshal(body, &azFuture); err != nil { 1384 return err 1385 } 1386 future.FutureAPI = &azFuture 1387 future.Result = future.result 1388 return nil 1389} 1390 1391// result is the default implementation for DataConnectionsCreateOrUpdateFuture.Result. 1392func (future *DataConnectionsCreateOrUpdateFuture) result(client DataConnectionsClient) (dcm DataConnectionModel, err error) { 1393 var done bool 1394 done, err = future.DoneWithContext(context.Background(), client) 1395 if err != nil { 1396 err = autorest.NewErrorWithError(err, "kusto.DataConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1397 return 1398 } 1399 if !done { 1400 dcm.Response.Response = future.Response() 1401 err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsCreateOrUpdateFuture") 1402 return 1403 } 1404 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1405 if dcm.Response.Response, err = future.GetResult(sender); err == nil && dcm.Response.Response.StatusCode != http.StatusNoContent { 1406 dcm, err = client.CreateOrUpdateResponder(dcm.Response.Response) 1407 if err != nil { 1408 err = autorest.NewErrorWithError(err, "kusto.DataConnectionsCreateOrUpdateFuture", "Result", dcm.Response.Response, "Failure responding to request") 1409 } 1410 } 1411 return 1412} 1413 1414// DataConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1415// operation. 1416type DataConnectionsDeleteFuture struct { 1417 azure.FutureAPI 1418 // Result returns the result of the asynchronous operation. 1419 // If the operation has not completed it will return an error. 1420 Result func(DataConnectionsClient) (autorest.Response, error) 1421} 1422 1423// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1424func (future *DataConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { 1425 var azFuture azure.Future 1426 if err := json.Unmarshal(body, &azFuture); err != nil { 1427 return err 1428 } 1429 future.FutureAPI = &azFuture 1430 future.Result = future.result 1431 return nil 1432} 1433 1434// result is the default implementation for DataConnectionsDeleteFuture.Result. 1435func (future *DataConnectionsDeleteFuture) result(client DataConnectionsClient) (ar autorest.Response, err error) { 1436 var done bool 1437 done, err = future.DoneWithContext(context.Background(), client) 1438 if err != nil { 1439 err = autorest.NewErrorWithError(err, "kusto.DataConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") 1440 return 1441 } 1442 if !done { 1443 ar.Response = future.Response() 1444 err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsDeleteFuture") 1445 return 1446 } 1447 ar.Response = future.Response() 1448 return 1449} 1450 1451// DataConnectionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 1452// operation. 1453type DataConnectionsUpdateFuture struct { 1454 azure.FutureAPI 1455 // Result returns the result of the asynchronous operation. 1456 // If the operation has not completed it will return an error. 1457 Result func(DataConnectionsClient) (DataConnectionModel, error) 1458} 1459 1460// UnmarshalJSON is the custom unmarshaller for CreateFuture. 1461func (future *DataConnectionsUpdateFuture) UnmarshalJSON(body []byte) error { 1462 var azFuture azure.Future 1463 if err := json.Unmarshal(body, &azFuture); err != nil { 1464 return err 1465 } 1466 future.FutureAPI = &azFuture 1467 future.Result = future.result 1468 return nil 1469} 1470 1471// result is the default implementation for DataConnectionsUpdateFuture.Result. 1472func (future *DataConnectionsUpdateFuture) result(client DataConnectionsClient) (dcm DataConnectionModel, err error) { 1473 var done bool 1474 done, err = future.DoneWithContext(context.Background(), client) 1475 if err != nil { 1476 err = autorest.NewErrorWithError(err, "kusto.DataConnectionsUpdateFuture", "Result", future.Response(), "Polling failure") 1477 return 1478 } 1479 if !done { 1480 dcm.Response.Response = future.Response() 1481 err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsUpdateFuture") 1482 return 1483 } 1484 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1485 if dcm.Response.Response, err = future.GetResult(sender); err == nil && dcm.Response.Response.StatusCode != http.StatusNoContent { 1486 dcm, err = client.UpdateResponder(dcm.Response.Response) 1487 if err != nil { 1488 err = autorest.NewErrorWithError(err, "kusto.DataConnectionsUpdateFuture", "Result", dcm.Response.Response, "Failure responding to request") 1489 } 1490 } 1491 return 1492} 1493 1494// DataConnectionValidation class representing an data connection validation. 1495type DataConnectionValidation struct { 1496 // DataConnectionName - The name of the data connection. 1497 DataConnectionName *string `json:"dataConnectionName,omitempty"` 1498 // Properties - The data connection properties to validate. 1499 Properties BasicDataConnection `json:"properties,omitempty"` 1500} 1501 1502// UnmarshalJSON is the custom unmarshaler for DataConnectionValidation struct. 1503func (dcv *DataConnectionValidation) UnmarshalJSON(body []byte) error { 1504 var m map[string]*json.RawMessage 1505 err := json.Unmarshal(body, &m) 1506 if err != nil { 1507 return err 1508 } 1509 for k, v := range m { 1510 switch k { 1511 case "dataConnectionName": 1512 if v != nil { 1513 var dataConnectionName string 1514 err = json.Unmarshal(*v, &dataConnectionName) 1515 if err != nil { 1516 return err 1517 } 1518 dcv.DataConnectionName = &dataConnectionName 1519 } 1520 case "properties": 1521 if v != nil { 1522 properties, err := unmarshalBasicDataConnection(*v) 1523 if err != nil { 1524 return err 1525 } 1526 dcv.Properties = properties 1527 } 1528 } 1529 } 1530 1531 return nil 1532} 1533 1534// DataConnectionValidationListResult the list Kusto data connection validation result. 1535type DataConnectionValidationListResult struct { 1536 autorest.Response `json:"-"` 1537 // Value - The list of Kusto data connection validation errors. 1538 Value *[]DataConnectionValidationResult `json:"value,omitempty"` 1539} 1540 1541// DataConnectionValidationResult the result returned from a data connection validation request. 1542type DataConnectionValidationResult struct { 1543 // ErrorMessage - A message which indicates a problem in data connection validation. 1544 ErrorMessage *string `json:"errorMessage,omitempty"` 1545} 1546 1547// EventGridConnectionProperties class representing the Kusto event grid connection properties. 1548type EventGridConnectionProperties struct { 1549 // StorageAccountResourceID - The resource ID of the storage account where the data resides. 1550 StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` 1551 // EventHubResourceID - The resource ID where the event grid is configured to send events. 1552 EventHubResourceID *string `json:"eventHubResourceId,omitempty"` 1553 // ConsumerGroup - The event hub consumer group. 1554 ConsumerGroup *string `json:"consumerGroup,omitempty"` 1555 // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. 1556 TableName *string `json:"tableName,omitempty"` 1557 // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. 1558 MappingRuleName *string `json:"mappingRuleName,omitempty"` 1559 // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE' 1560 DataFormat DataFormat `json:"dataFormat,omitempty"` 1561} 1562 1563// EventGridDataConnection class representing an Event Grid data connection. 1564type EventGridDataConnection struct { 1565 // EventGridConnectionProperties - The properties of the Event Grid data connection. 1566 *EventGridConnectionProperties `json:"properties,omitempty"` 1567 // Location - Resource location. 1568 Location *string `json:"location,omitempty"` 1569 // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindIotHub', 'KindEventGrid' 1570 Kind KindBasicDataConnection `json:"kind,omitempty"` 1571 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1572 ID *string `json:"id,omitempty"` 1573 // Name - READ-ONLY; The name of the resource 1574 Name *string `json:"name,omitempty"` 1575 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1576 Type *string `json:"type,omitempty"` 1577} 1578 1579// MarshalJSON is the custom marshaler for EventGridDataConnection. 1580func (egdc EventGridDataConnection) MarshalJSON() ([]byte, error) { 1581 egdc.Kind = KindEventGrid 1582 objectMap := make(map[string]interface{}) 1583 if egdc.EventGridConnectionProperties != nil { 1584 objectMap["properties"] = egdc.EventGridConnectionProperties 1585 } 1586 if egdc.Location != nil { 1587 objectMap["location"] = egdc.Location 1588 } 1589 if egdc.Kind != "" { 1590 objectMap["kind"] = egdc.Kind 1591 } 1592 return json.Marshal(objectMap) 1593} 1594 1595// AsEventHubDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 1596func (egdc EventGridDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { 1597 return nil, false 1598} 1599 1600// AsIotHubDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 1601func (egdc EventGridDataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { 1602 return nil, false 1603} 1604 1605// AsEventGridDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 1606func (egdc EventGridDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { 1607 return &egdc, true 1608} 1609 1610// AsDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 1611func (egdc EventGridDataConnection) AsDataConnection() (*DataConnection, bool) { 1612 return nil, false 1613} 1614 1615// AsBasicDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 1616func (egdc EventGridDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { 1617 return &egdc, true 1618} 1619 1620// UnmarshalJSON is the custom unmarshaler for EventGridDataConnection struct. 1621func (egdc *EventGridDataConnection) UnmarshalJSON(body []byte) error { 1622 var m map[string]*json.RawMessage 1623 err := json.Unmarshal(body, &m) 1624 if err != nil { 1625 return err 1626 } 1627 for k, v := range m { 1628 switch k { 1629 case "properties": 1630 if v != nil { 1631 var eventGridConnectionProperties EventGridConnectionProperties 1632 err = json.Unmarshal(*v, &eventGridConnectionProperties) 1633 if err != nil { 1634 return err 1635 } 1636 egdc.EventGridConnectionProperties = &eventGridConnectionProperties 1637 } 1638 case "location": 1639 if v != nil { 1640 var location string 1641 err = json.Unmarshal(*v, &location) 1642 if err != nil { 1643 return err 1644 } 1645 egdc.Location = &location 1646 } 1647 case "kind": 1648 if v != nil { 1649 var kind KindBasicDataConnection 1650 err = json.Unmarshal(*v, &kind) 1651 if err != nil { 1652 return err 1653 } 1654 egdc.Kind = kind 1655 } 1656 case "id": 1657 if v != nil { 1658 var ID string 1659 err = json.Unmarshal(*v, &ID) 1660 if err != nil { 1661 return err 1662 } 1663 egdc.ID = &ID 1664 } 1665 case "name": 1666 if v != nil { 1667 var name string 1668 err = json.Unmarshal(*v, &name) 1669 if err != nil { 1670 return err 1671 } 1672 egdc.Name = &name 1673 } 1674 case "type": 1675 if v != nil { 1676 var typeVar string 1677 err = json.Unmarshal(*v, &typeVar) 1678 if err != nil { 1679 return err 1680 } 1681 egdc.Type = &typeVar 1682 } 1683 } 1684 } 1685 1686 return nil 1687} 1688 1689// EventHubConnectionProperties class representing the Kusto event hub connection properties. 1690type EventHubConnectionProperties struct { 1691 // EventHubResourceID - The resource ID of the event hub to be used to create a data connection. 1692 EventHubResourceID *string `json:"eventHubResourceId,omitempty"` 1693 // ConsumerGroup - The event hub consumer group. 1694 ConsumerGroup *string `json:"consumerGroup,omitempty"` 1695 // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. 1696 TableName *string `json:"tableName,omitempty"` 1697 // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. 1698 MappingRuleName *string `json:"mappingRuleName,omitempty"` 1699 // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE' 1700 DataFormat DataFormat `json:"dataFormat,omitempty"` 1701 // EventSystemProperties - System properties of the event hub 1702 EventSystemProperties *[]string `json:"eventSystemProperties,omitempty"` 1703} 1704 1705// EventHubDataConnection class representing an event hub data connection. 1706type EventHubDataConnection struct { 1707 // EventHubConnectionProperties - The Event Hub data connection properties to validate. 1708 *EventHubConnectionProperties `json:"properties,omitempty"` 1709 // Location - Resource location. 1710 Location *string `json:"location,omitempty"` 1711 // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindIotHub', 'KindEventGrid' 1712 Kind KindBasicDataConnection `json:"kind,omitempty"` 1713 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1714 ID *string `json:"id,omitempty"` 1715 // Name - READ-ONLY; The name of the resource 1716 Name *string `json:"name,omitempty"` 1717 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1718 Type *string `json:"type,omitempty"` 1719} 1720 1721// MarshalJSON is the custom marshaler for EventHubDataConnection. 1722func (ehdc EventHubDataConnection) MarshalJSON() ([]byte, error) { 1723 ehdc.Kind = KindEventHub 1724 objectMap := make(map[string]interface{}) 1725 if ehdc.EventHubConnectionProperties != nil { 1726 objectMap["properties"] = ehdc.EventHubConnectionProperties 1727 } 1728 if ehdc.Location != nil { 1729 objectMap["location"] = ehdc.Location 1730 } 1731 if ehdc.Kind != "" { 1732 objectMap["kind"] = ehdc.Kind 1733 } 1734 return json.Marshal(objectMap) 1735} 1736 1737// AsEventHubDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1738func (ehdc EventHubDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { 1739 return &ehdc, true 1740} 1741 1742// AsIotHubDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1743func (ehdc EventHubDataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { 1744 return nil, false 1745} 1746 1747// AsEventGridDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1748func (ehdc EventHubDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { 1749 return nil, false 1750} 1751 1752// AsDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1753func (ehdc EventHubDataConnection) AsDataConnection() (*DataConnection, bool) { 1754 return nil, false 1755} 1756 1757// AsBasicDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1758func (ehdc EventHubDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { 1759 return &ehdc, true 1760} 1761 1762// UnmarshalJSON is the custom unmarshaler for EventHubDataConnection struct. 1763func (ehdc *EventHubDataConnection) UnmarshalJSON(body []byte) error { 1764 var m map[string]*json.RawMessage 1765 err := json.Unmarshal(body, &m) 1766 if err != nil { 1767 return err 1768 } 1769 for k, v := range m { 1770 switch k { 1771 case "properties": 1772 if v != nil { 1773 var eventHubConnectionProperties EventHubConnectionProperties 1774 err = json.Unmarshal(*v, &eventHubConnectionProperties) 1775 if err != nil { 1776 return err 1777 } 1778 ehdc.EventHubConnectionProperties = &eventHubConnectionProperties 1779 } 1780 case "location": 1781 if v != nil { 1782 var location string 1783 err = json.Unmarshal(*v, &location) 1784 if err != nil { 1785 return err 1786 } 1787 ehdc.Location = &location 1788 } 1789 case "kind": 1790 if v != nil { 1791 var kind KindBasicDataConnection 1792 err = json.Unmarshal(*v, &kind) 1793 if err != nil { 1794 return err 1795 } 1796 ehdc.Kind = kind 1797 } 1798 case "id": 1799 if v != nil { 1800 var ID string 1801 err = json.Unmarshal(*v, &ID) 1802 if err != nil { 1803 return err 1804 } 1805 ehdc.ID = &ID 1806 } 1807 case "name": 1808 if v != nil { 1809 var name string 1810 err = json.Unmarshal(*v, &name) 1811 if err != nil { 1812 return err 1813 } 1814 ehdc.Name = &name 1815 } 1816 case "type": 1817 if v != nil { 1818 var typeVar string 1819 err = json.Unmarshal(*v, &typeVar) 1820 if err != nil { 1821 return err 1822 } 1823 ehdc.Type = &typeVar 1824 } 1825 } 1826 } 1827 1828 return nil 1829} 1830 1831// FollowerDatabaseDefinition a class representing follower database request. 1832type FollowerDatabaseDefinition struct { 1833 // ClusterResourceID - Resource id of the cluster that follows a database owned by this cluster. 1834 ClusterResourceID *string `json:"clusterResourceId,omitempty"` 1835 // AttachedDatabaseConfigurationName - Resource name of the attached database configuration in the follower cluster. 1836 AttachedDatabaseConfigurationName *string `json:"attachedDatabaseConfigurationName,omitempty"` 1837 // DatabaseName - READ-ONLY; The database name owned by this cluster that was followed. * in case following all databases. 1838 DatabaseName *string `json:"databaseName,omitempty"` 1839} 1840 1841// MarshalJSON is the custom marshaler for FollowerDatabaseDefinition. 1842func (fdd FollowerDatabaseDefinition) MarshalJSON() ([]byte, error) { 1843 objectMap := make(map[string]interface{}) 1844 if fdd.ClusterResourceID != nil { 1845 objectMap["clusterResourceId"] = fdd.ClusterResourceID 1846 } 1847 if fdd.AttachedDatabaseConfigurationName != nil { 1848 objectMap["attachedDatabaseConfigurationName"] = fdd.AttachedDatabaseConfigurationName 1849 } 1850 return json.Marshal(objectMap) 1851} 1852 1853// FollowerDatabaseListResult the list Kusto database principals operation response. 1854type FollowerDatabaseListResult struct { 1855 autorest.Response `json:"-"` 1856 // Value - The list of follower database result. 1857 Value *[]FollowerDatabaseDefinition `json:"value,omitempty"` 1858} 1859 1860// Identity identity for the resource. 1861type Identity struct { 1862 // PrincipalID - READ-ONLY; The principal ID of resource identity. 1863 PrincipalID *string `json:"principalId,omitempty"` 1864 // TenantID - READ-ONLY; The tenant ID of resource. 1865 TenantID *string `json:"tenantId,omitempty"` 1866 // Type - The identity type. Possible values include: 'IdentityTypeNone', 'IdentityTypeSystemAssigned' 1867 Type IdentityType `json:"type,omitempty"` 1868 // UserAssignedIdentities - The list of user identities associated with the Kusto cluster. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. 1869 UserAssignedIdentities map[string]*IdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` 1870} 1871 1872// MarshalJSON is the custom marshaler for Identity. 1873func (i Identity) MarshalJSON() ([]byte, error) { 1874 objectMap := make(map[string]interface{}) 1875 if i.Type != "" { 1876 objectMap["type"] = i.Type 1877 } 1878 if i.UserAssignedIdentities != nil { 1879 objectMap["userAssignedIdentities"] = i.UserAssignedIdentities 1880 } 1881 return json.Marshal(objectMap) 1882} 1883 1884// IdentityUserAssignedIdentitiesValue ... 1885type IdentityUserAssignedIdentitiesValue struct { 1886 // PrincipalID - READ-ONLY; The principal id of user assigned identity. 1887 PrincipalID *string `json:"principalId,omitempty"` 1888 // ClientID - READ-ONLY; The client id of user assigned identity. 1889 ClientID *string `json:"clientId,omitempty"` 1890} 1891 1892// MarshalJSON is the custom marshaler for IdentityUserAssignedIdentitiesValue. 1893func (iAiv IdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { 1894 objectMap := make(map[string]interface{}) 1895 return json.Marshal(objectMap) 1896} 1897 1898// IotHubConnectionProperties class representing the Kusto iot hub connection properties. 1899type IotHubConnectionProperties struct { 1900 // IotHubResourceID - The resource ID of the Iot hub to be used to create a data connection. 1901 IotHubResourceID *string `json:"iotHubResourceId,omitempty"` 1902 // ConsumerGroup - The iot hub consumer group. 1903 ConsumerGroup *string `json:"consumerGroup,omitempty"` 1904 // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. 1905 TableName *string `json:"tableName,omitempty"` 1906 // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. 1907 MappingRuleName *string `json:"mappingRuleName,omitempty"` 1908 // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE' 1909 DataFormat DataFormat `json:"dataFormat,omitempty"` 1910 // EventSystemProperties - System properties of the iot hub 1911 EventSystemProperties *[]string `json:"eventSystemProperties,omitempty"` 1912 // SharedAccessPolicyName - The name of the share access policy name 1913 SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` 1914} 1915 1916// IotHubDataConnection class representing an iot hub data connection. 1917type IotHubDataConnection struct { 1918 // IotHubConnectionProperties - The Iot Hub data connection properties. 1919 *IotHubConnectionProperties `json:"properties,omitempty"` 1920 // Location - Resource location. 1921 Location *string `json:"location,omitempty"` 1922 // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindIotHub', 'KindEventGrid' 1923 Kind KindBasicDataConnection `json:"kind,omitempty"` 1924 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1925 ID *string `json:"id,omitempty"` 1926 // Name - READ-ONLY; The name of the resource 1927 Name *string `json:"name,omitempty"` 1928 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1929 Type *string `json:"type,omitempty"` 1930} 1931 1932// MarshalJSON is the custom marshaler for IotHubDataConnection. 1933func (ihdc IotHubDataConnection) MarshalJSON() ([]byte, error) { 1934 ihdc.Kind = KindIotHub 1935 objectMap := make(map[string]interface{}) 1936 if ihdc.IotHubConnectionProperties != nil { 1937 objectMap["properties"] = ihdc.IotHubConnectionProperties 1938 } 1939 if ihdc.Location != nil { 1940 objectMap["location"] = ihdc.Location 1941 } 1942 if ihdc.Kind != "" { 1943 objectMap["kind"] = ihdc.Kind 1944 } 1945 return json.Marshal(objectMap) 1946} 1947 1948// AsEventHubDataConnection is the BasicDataConnection implementation for IotHubDataConnection. 1949func (ihdc IotHubDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { 1950 return nil, false 1951} 1952 1953// AsIotHubDataConnection is the BasicDataConnection implementation for IotHubDataConnection. 1954func (ihdc IotHubDataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { 1955 return &ihdc, true 1956} 1957 1958// AsEventGridDataConnection is the BasicDataConnection implementation for IotHubDataConnection. 1959func (ihdc IotHubDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { 1960 return nil, false 1961} 1962 1963// AsDataConnection is the BasicDataConnection implementation for IotHubDataConnection. 1964func (ihdc IotHubDataConnection) AsDataConnection() (*DataConnection, bool) { 1965 return nil, false 1966} 1967 1968// AsBasicDataConnection is the BasicDataConnection implementation for IotHubDataConnection. 1969func (ihdc IotHubDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { 1970 return &ihdc, true 1971} 1972 1973// UnmarshalJSON is the custom unmarshaler for IotHubDataConnection struct. 1974func (ihdc *IotHubDataConnection) UnmarshalJSON(body []byte) error { 1975 var m map[string]*json.RawMessage 1976 err := json.Unmarshal(body, &m) 1977 if err != nil { 1978 return err 1979 } 1980 for k, v := range m { 1981 switch k { 1982 case "properties": 1983 if v != nil { 1984 var iotHubConnectionProperties IotHubConnectionProperties 1985 err = json.Unmarshal(*v, &iotHubConnectionProperties) 1986 if err != nil { 1987 return err 1988 } 1989 ihdc.IotHubConnectionProperties = &iotHubConnectionProperties 1990 } 1991 case "location": 1992 if v != nil { 1993 var location string 1994 err = json.Unmarshal(*v, &location) 1995 if err != nil { 1996 return err 1997 } 1998 ihdc.Location = &location 1999 } 2000 case "kind": 2001 if v != nil { 2002 var kind KindBasicDataConnection 2003 err = json.Unmarshal(*v, &kind) 2004 if err != nil { 2005 return err 2006 } 2007 ihdc.Kind = kind 2008 } 2009 case "id": 2010 if v != nil { 2011 var ID string 2012 err = json.Unmarshal(*v, &ID) 2013 if err != nil { 2014 return err 2015 } 2016 ihdc.ID = &ID 2017 } 2018 case "name": 2019 if v != nil { 2020 var name string 2021 err = json.Unmarshal(*v, &name) 2022 if err != nil { 2023 return err 2024 } 2025 ihdc.Name = &name 2026 } 2027 case "type": 2028 if v != nil { 2029 var typeVar string 2030 err = json.Unmarshal(*v, &typeVar) 2031 if err != nil { 2032 return err 2033 } 2034 ihdc.Type = &typeVar 2035 } 2036 } 2037 } 2038 2039 return nil 2040} 2041 2042// KeyVaultProperties properties of the key vault. 2043type KeyVaultProperties struct { 2044 // KeyName - The name of the key vault key. 2045 KeyName *string `json:"keyName,omitempty"` 2046 // KeyVersion - The version of the key vault key. 2047 KeyVersion *string `json:"keyVersion,omitempty"` 2048 // KeyVaultURI - The Uri of the key vault. 2049 KeyVaultURI *string `json:"keyVaultUri,omitempty"` 2050} 2051 2052// ListResourceSkusResult list of available SKUs for a Kusto Cluster. 2053type ListResourceSkusResult struct { 2054 autorest.Response `json:"-"` 2055 // Value - The collection of available SKUs for an existing resource. 2056 Value *[]AzureResourceSku `json:"value,omitempty"` 2057} 2058 2059// Operation ... 2060type Operation struct { 2061 // Name - This is of the format {provider}/{resource}/{operation}. 2062 Name *string `json:"name,omitempty"` 2063 Display *OperationDisplay `json:"display,omitempty"` 2064 Origin *string `json:"origin,omitempty"` 2065 Properties interface{} `json:"properties,omitempty"` 2066} 2067 2068// OperationDisplay ... 2069type OperationDisplay struct { 2070 Provider *string `json:"provider,omitempty"` 2071 // Operation - For example: read, write, delete. 2072 Operation *string `json:"operation,omitempty"` 2073 Resource *string `json:"resource,omitempty"` 2074 Description *string `json:"description,omitempty"` 2075} 2076 2077// OperationListResult ... 2078type OperationListResult struct { 2079 autorest.Response `json:"-"` 2080 Value *[]Operation `json:"value,omitempty"` 2081 NextLink *string `json:"nextLink,omitempty"` 2082} 2083 2084// OperationListResultIterator provides access to a complete listing of Operation values. 2085type OperationListResultIterator struct { 2086 i int 2087 page OperationListResultPage 2088} 2089 2090// NextWithContext advances to the next value. If there was an error making 2091// the request the iterator does not advance and the error is returned. 2092func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 2093 if tracing.IsEnabled() { 2094 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 2095 defer func() { 2096 sc := -1 2097 if iter.Response().Response.Response != nil { 2098 sc = iter.Response().Response.Response.StatusCode 2099 } 2100 tracing.EndSpan(ctx, sc, err) 2101 }() 2102 } 2103 iter.i++ 2104 if iter.i < len(iter.page.Values()) { 2105 return nil 2106 } 2107 err = iter.page.NextWithContext(ctx) 2108 if err != nil { 2109 iter.i-- 2110 return err 2111 } 2112 iter.i = 0 2113 return nil 2114} 2115 2116// Next advances to the next value. If there was an error making 2117// the request the iterator does not advance and the error is returned. 2118// Deprecated: Use NextWithContext() instead. 2119func (iter *OperationListResultIterator) Next() error { 2120 return iter.NextWithContext(context.Background()) 2121} 2122 2123// NotDone returns true if the enumeration should be started or is not yet complete. 2124func (iter OperationListResultIterator) NotDone() bool { 2125 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2126} 2127 2128// Response returns the raw server response from the last page request. 2129func (iter OperationListResultIterator) Response() OperationListResult { 2130 return iter.page.Response() 2131} 2132 2133// Value returns the current value or a zero-initialized value if the 2134// iterator has advanced beyond the end of the collection. 2135func (iter OperationListResultIterator) Value() Operation { 2136 if !iter.page.NotDone() { 2137 return Operation{} 2138 } 2139 return iter.page.Values()[iter.i] 2140} 2141 2142// Creates a new instance of the OperationListResultIterator type. 2143func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 2144 return OperationListResultIterator{page: page} 2145} 2146 2147// IsEmpty returns true if the ListResult contains no values. 2148func (olr OperationListResult) IsEmpty() bool { 2149 return olr.Value == nil || len(*olr.Value) == 0 2150} 2151 2152// hasNextLink returns true if the NextLink is not empty. 2153func (olr OperationListResult) hasNextLink() bool { 2154 return olr.NextLink != nil && len(*olr.NextLink) != 0 2155} 2156 2157// operationListResultPreparer prepares a request to retrieve the next set of results. 2158// It returns nil if no more results exist. 2159func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 2160 if !olr.hasNextLink() { 2161 return nil, nil 2162 } 2163 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2164 autorest.AsJSON(), 2165 autorest.AsGet(), 2166 autorest.WithBaseURL(to.String(olr.NextLink))) 2167} 2168 2169// OperationListResultPage contains a page of Operation values. 2170type OperationListResultPage struct { 2171 fn func(context.Context, OperationListResult) (OperationListResult, error) 2172 olr OperationListResult 2173} 2174 2175// NextWithContext advances to the next page of values. If there was an error making 2176// the request the page does not advance and the error is returned. 2177func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 2178 if tracing.IsEnabled() { 2179 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 2180 defer func() { 2181 sc := -1 2182 if page.Response().Response.Response != nil { 2183 sc = page.Response().Response.Response.StatusCode 2184 } 2185 tracing.EndSpan(ctx, sc, err) 2186 }() 2187 } 2188 for { 2189 next, err := page.fn(ctx, page.olr) 2190 if err != nil { 2191 return err 2192 } 2193 page.olr = next 2194 if !next.hasNextLink() || !next.IsEmpty() { 2195 break 2196 } 2197 } 2198 return nil 2199} 2200 2201// Next advances to the next page of values. If there was an error making 2202// the request the page does not advance and the error is returned. 2203// Deprecated: Use NextWithContext() instead. 2204func (page *OperationListResultPage) Next() error { 2205 return page.NextWithContext(context.Background()) 2206} 2207 2208// NotDone returns true if the page enumeration should be started or is not yet complete. 2209func (page OperationListResultPage) NotDone() bool { 2210 return !page.olr.IsEmpty() 2211} 2212 2213// Response returns the raw server response from the last page request. 2214func (page OperationListResultPage) Response() OperationListResult { 2215 return page.olr 2216} 2217 2218// Values returns the slice of values for the current page or nil if there are no values. 2219func (page OperationListResultPage) Values() []Operation { 2220 if page.olr.IsEmpty() { 2221 return nil 2222 } 2223 return *page.olr.Value 2224} 2225 2226// Creates a new instance of the OperationListResultPage type. 2227func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 2228 return OperationListResultPage{ 2229 fn: getNextPage, 2230 olr: cur, 2231 } 2232} 2233 2234// OptimizedAutoscale a class that contains the optimized auto scale definition. 2235type OptimizedAutoscale struct { 2236 // Version - The version of the template defined, for instance 1. 2237 Version *int32 `json:"version,omitempty"` 2238 // IsEnabled - A boolean value that indicate if the optimized autoscale feature is enabled or not. 2239 IsEnabled *bool `json:"isEnabled,omitempty"` 2240 // Minimum - Minimum allowed instances count. 2241 Minimum *int32 `json:"minimum,omitempty"` 2242 // Maximum - Maximum allowed instances count. 2243 Maximum *int32 `json:"maximum,omitempty"` 2244} 2245 2246// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not 2247// have tags and a location 2248type ProxyResource struct { 2249 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2250 ID *string `json:"id,omitempty"` 2251 // Name - READ-ONLY; The name of the resource 2252 Name *string `json:"name,omitempty"` 2253 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2254 Type *string `json:"type,omitempty"` 2255} 2256 2257// MarshalJSON is the custom marshaler for ProxyResource. 2258func (pr ProxyResource) MarshalJSON() ([]byte, error) { 2259 objectMap := make(map[string]interface{}) 2260 return json.Marshal(objectMap) 2261} 2262 2263// ReadOnlyFollowingDatabase class representing a read only following database. 2264type ReadOnlyFollowingDatabase struct { 2265 // ReadOnlyFollowingDatabaseProperties - The database properties. 2266 *ReadOnlyFollowingDatabaseProperties `json:"properties,omitempty"` 2267 // Location - Resource location. 2268 Location *string `json:"location,omitempty"` 2269 // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' 2270 Kind Kind `json:"kind,omitempty"` 2271 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2272 ID *string `json:"id,omitempty"` 2273 // Name - READ-ONLY; The name of the resource 2274 Name *string `json:"name,omitempty"` 2275 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2276 Type *string `json:"type,omitempty"` 2277} 2278 2279// MarshalJSON is the custom marshaler for ReadOnlyFollowingDatabase. 2280func (rofd ReadOnlyFollowingDatabase) MarshalJSON() ([]byte, error) { 2281 rofd.Kind = KindReadOnlyFollowing 2282 objectMap := make(map[string]interface{}) 2283 if rofd.ReadOnlyFollowingDatabaseProperties != nil { 2284 objectMap["properties"] = rofd.ReadOnlyFollowingDatabaseProperties 2285 } 2286 if rofd.Location != nil { 2287 objectMap["location"] = rofd.Location 2288 } 2289 if rofd.Kind != "" { 2290 objectMap["kind"] = rofd.Kind 2291 } 2292 return json.Marshal(objectMap) 2293} 2294 2295// AsReadWriteDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. 2296func (rofd ReadOnlyFollowingDatabase) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { 2297 return nil, false 2298} 2299 2300// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. 2301func (rofd ReadOnlyFollowingDatabase) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { 2302 return &rofd, true 2303} 2304 2305// AsDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. 2306func (rofd ReadOnlyFollowingDatabase) AsDatabase() (*Database, bool) { 2307 return nil, false 2308} 2309 2310// AsBasicDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. 2311func (rofd ReadOnlyFollowingDatabase) AsBasicDatabase() (BasicDatabase, bool) { 2312 return &rofd, true 2313} 2314 2315// UnmarshalJSON is the custom unmarshaler for ReadOnlyFollowingDatabase struct. 2316func (rofd *ReadOnlyFollowingDatabase) UnmarshalJSON(body []byte) error { 2317 var m map[string]*json.RawMessage 2318 err := json.Unmarshal(body, &m) 2319 if err != nil { 2320 return err 2321 } 2322 for k, v := range m { 2323 switch k { 2324 case "properties": 2325 if v != nil { 2326 var readOnlyFollowingDatabaseProperties ReadOnlyFollowingDatabaseProperties 2327 err = json.Unmarshal(*v, &readOnlyFollowingDatabaseProperties) 2328 if err != nil { 2329 return err 2330 } 2331 rofd.ReadOnlyFollowingDatabaseProperties = &readOnlyFollowingDatabaseProperties 2332 } 2333 case "location": 2334 if v != nil { 2335 var location string 2336 err = json.Unmarshal(*v, &location) 2337 if err != nil { 2338 return err 2339 } 2340 rofd.Location = &location 2341 } 2342 case "kind": 2343 if v != nil { 2344 var kind Kind 2345 err = json.Unmarshal(*v, &kind) 2346 if err != nil { 2347 return err 2348 } 2349 rofd.Kind = kind 2350 } 2351 case "id": 2352 if v != nil { 2353 var ID string 2354 err = json.Unmarshal(*v, &ID) 2355 if err != nil { 2356 return err 2357 } 2358 rofd.ID = &ID 2359 } 2360 case "name": 2361 if v != nil { 2362 var name string 2363 err = json.Unmarshal(*v, &name) 2364 if err != nil { 2365 return err 2366 } 2367 rofd.Name = &name 2368 } 2369 case "type": 2370 if v != nil { 2371 var typeVar string 2372 err = json.Unmarshal(*v, &typeVar) 2373 if err != nil { 2374 return err 2375 } 2376 rofd.Type = &typeVar 2377 } 2378 } 2379 } 2380 2381 return nil 2382} 2383 2384// ReadOnlyFollowingDatabaseProperties class representing the Kusto database properties. 2385type ReadOnlyFollowingDatabaseProperties struct { 2386 // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' 2387 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2388 // SoftDeletePeriod - READ-ONLY; The time the data should be kept before it stops being accessible to queries in TimeSpan. 2389 SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` 2390 // HotCachePeriod - The time the data should be kept in cache for fast queries in TimeSpan. 2391 HotCachePeriod *string `json:"hotCachePeriod,omitempty"` 2392 // Statistics - The statistics of the database. 2393 Statistics *DatabaseStatistics `json:"statistics,omitempty"` 2394 // LeaderClusterResourceID - READ-ONLY; The name of the leader cluster 2395 LeaderClusterResourceID *string `json:"leaderClusterResourceId,omitempty"` 2396 // AttachedDatabaseConfigurationName - READ-ONLY; The name of the attached database configuration cluster 2397 AttachedDatabaseConfigurationName *string `json:"attachedDatabaseConfigurationName,omitempty"` 2398 // PrincipalsModificationKind - READ-ONLY; The principals modification kind of the database. Possible values include: 'PrincipalsModificationKindUnion', 'PrincipalsModificationKindReplace', 'PrincipalsModificationKindNone' 2399 PrincipalsModificationKind PrincipalsModificationKind `json:"principalsModificationKind,omitempty"` 2400} 2401 2402// MarshalJSON is the custom marshaler for ReadOnlyFollowingDatabaseProperties. 2403func (rofdp ReadOnlyFollowingDatabaseProperties) MarshalJSON() ([]byte, error) { 2404 objectMap := make(map[string]interface{}) 2405 if rofdp.HotCachePeriod != nil { 2406 objectMap["hotCachePeriod"] = rofdp.HotCachePeriod 2407 } 2408 if rofdp.Statistics != nil { 2409 objectMap["statistics"] = rofdp.Statistics 2410 } 2411 return json.Marshal(objectMap) 2412} 2413 2414// ReadWriteDatabase class representing a read write database. 2415type ReadWriteDatabase struct { 2416 // ReadWriteDatabaseProperties - The database properties. 2417 *ReadWriteDatabaseProperties `json:"properties,omitempty"` 2418 // Location - Resource location. 2419 Location *string `json:"location,omitempty"` 2420 // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' 2421 Kind Kind `json:"kind,omitempty"` 2422 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2423 ID *string `json:"id,omitempty"` 2424 // Name - READ-ONLY; The name of the resource 2425 Name *string `json:"name,omitempty"` 2426 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2427 Type *string `json:"type,omitempty"` 2428} 2429 2430// MarshalJSON is the custom marshaler for ReadWriteDatabase. 2431func (rwd ReadWriteDatabase) MarshalJSON() ([]byte, error) { 2432 rwd.Kind = KindReadWrite 2433 objectMap := make(map[string]interface{}) 2434 if rwd.ReadWriteDatabaseProperties != nil { 2435 objectMap["properties"] = rwd.ReadWriteDatabaseProperties 2436 } 2437 if rwd.Location != nil { 2438 objectMap["location"] = rwd.Location 2439 } 2440 if rwd.Kind != "" { 2441 objectMap["kind"] = rwd.Kind 2442 } 2443 return json.Marshal(objectMap) 2444} 2445 2446// AsReadWriteDatabase is the BasicDatabase implementation for ReadWriteDatabase. 2447func (rwd ReadWriteDatabase) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { 2448 return &rwd, true 2449} 2450 2451// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for ReadWriteDatabase. 2452func (rwd ReadWriteDatabase) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { 2453 return nil, false 2454} 2455 2456// AsDatabase is the BasicDatabase implementation for ReadWriteDatabase. 2457func (rwd ReadWriteDatabase) AsDatabase() (*Database, bool) { 2458 return nil, false 2459} 2460 2461// AsBasicDatabase is the BasicDatabase implementation for ReadWriteDatabase. 2462func (rwd ReadWriteDatabase) AsBasicDatabase() (BasicDatabase, bool) { 2463 return &rwd, true 2464} 2465 2466// UnmarshalJSON is the custom unmarshaler for ReadWriteDatabase struct. 2467func (rwd *ReadWriteDatabase) UnmarshalJSON(body []byte) error { 2468 var m map[string]*json.RawMessage 2469 err := json.Unmarshal(body, &m) 2470 if err != nil { 2471 return err 2472 } 2473 for k, v := range m { 2474 switch k { 2475 case "properties": 2476 if v != nil { 2477 var readWriteDatabaseProperties ReadWriteDatabaseProperties 2478 err = json.Unmarshal(*v, &readWriteDatabaseProperties) 2479 if err != nil { 2480 return err 2481 } 2482 rwd.ReadWriteDatabaseProperties = &readWriteDatabaseProperties 2483 } 2484 case "location": 2485 if v != nil { 2486 var location string 2487 err = json.Unmarshal(*v, &location) 2488 if err != nil { 2489 return err 2490 } 2491 rwd.Location = &location 2492 } 2493 case "kind": 2494 if v != nil { 2495 var kind Kind 2496 err = json.Unmarshal(*v, &kind) 2497 if err != nil { 2498 return err 2499 } 2500 rwd.Kind = kind 2501 } 2502 case "id": 2503 if v != nil { 2504 var ID string 2505 err = json.Unmarshal(*v, &ID) 2506 if err != nil { 2507 return err 2508 } 2509 rwd.ID = &ID 2510 } 2511 case "name": 2512 if v != nil { 2513 var name string 2514 err = json.Unmarshal(*v, &name) 2515 if err != nil { 2516 return err 2517 } 2518 rwd.Name = &name 2519 } 2520 case "type": 2521 if v != nil { 2522 var typeVar string 2523 err = json.Unmarshal(*v, &typeVar) 2524 if err != nil { 2525 return err 2526 } 2527 rwd.Type = &typeVar 2528 } 2529 } 2530 } 2531 2532 return nil 2533} 2534 2535// ReadWriteDatabaseProperties class representing the Kusto database properties. 2536type ReadWriteDatabaseProperties struct { 2537 // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' 2538 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 2539 // SoftDeletePeriod - The time the data should be kept before it stops being accessible to queries in TimeSpan. 2540 SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` 2541 // HotCachePeriod - The time the data should be kept in cache for fast queries in TimeSpan. 2542 HotCachePeriod *string `json:"hotCachePeriod,omitempty"` 2543 // Statistics - The statistics of the database. 2544 Statistics *DatabaseStatistics `json:"statistics,omitempty"` 2545} 2546 2547// MarshalJSON is the custom marshaler for ReadWriteDatabaseProperties. 2548func (rwdp ReadWriteDatabaseProperties) MarshalJSON() ([]byte, error) { 2549 objectMap := make(map[string]interface{}) 2550 if rwdp.SoftDeletePeriod != nil { 2551 objectMap["softDeletePeriod"] = rwdp.SoftDeletePeriod 2552 } 2553 if rwdp.HotCachePeriod != nil { 2554 objectMap["hotCachePeriod"] = rwdp.HotCachePeriod 2555 } 2556 if rwdp.Statistics != nil { 2557 objectMap["statistics"] = rwdp.Statistics 2558 } 2559 return json.Marshal(objectMap) 2560} 2561 2562// Resource common fields that are returned in the response for all Azure Resource Manager resources 2563type Resource struct { 2564 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2565 ID *string `json:"id,omitempty"` 2566 // Name - READ-ONLY; The name of the resource 2567 Name *string `json:"name,omitempty"` 2568 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2569 Type *string `json:"type,omitempty"` 2570} 2571 2572// MarshalJSON is the custom marshaler for Resource. 2573func (r Resource) MarshalJSON() ([]byte, error) { 2574 objectMap := make(map[string]interface{}) 2575 return json.Marshal(objectMap) 2576} 2577 2578// SkuDescription the Kusto SKU description of given resource type 2579type SkuDescription struct { 2580 // ResourceType - READ-ONLY; The resource type 2581 ResourceType *string `json:"resourceType,omitempty"` 2582 // Name - READ-ONLY; The name of the SKU 2583 Name *string `json:"name,omitempty"` 2584 // Tier - READ-ONLY; The tier of the SKU 2585 Tier *string `json:"tier,omitempty"` 2586 // Locations - READ-ONLY; The set of locations that the SKU is available 2587 Locations *[]string `json:"locations,omitempty"` 2588 // LocationInfo - READ-ONLY; Locations and zones 2589 LocationInfo *[]SkuLocationInfoItem `json:"locationInfo,omitempty"` 2590 // Restrictions - READ-ONLY; The restrictions because of which SKU cannot be used 2591 Restrictions *[]interface{} `json:"restrictions,omitempty"` 2592} 2593 2594// MarshalJSON is the custom marshaler for SkuDescription. 2595func (sd SkuDescription) MarshalJSON() ([]byte, error) { 2596 objectMap := make(map[string]interface{}) 2597 return json.Marshal(objectMap) 2598} 2599 2600// SkuDescriptionList the list of the EngagementFabric SKU descriptions 2601type SkuDescriptionList struct { 2602 autorest.Response `json:"-"` 2603 // Value - READ-ONLY; SKU descriptions 2604 Value *[]SkuDescription `json:"value,omitempty"` 2605} 2606 2607// MarshalJSON is the custom marshaler for SkuDescriptionList. 2608func (sdl SkuDescriptionList) MarshalJSON() ([]byte, error) { 2609 objectMap := make(map[string]interface{}) 2610 return json.Marshal(objectMap) 2611} 2612 2613// SkuLocationInfoItem the locations and zones info for SKU. 2614type SkuLocationInfoItem struct { 2615 // Location - The available location of the SKU. 2616 Location *string `json:"location,omitempty"` 2617 // Zones - The available zone of the SKU. 2618 Zones *[]string `json:"zones,omitempty"` 2619} 2620 2621// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource 2622// which has 'tags' and a 'location' 2623type TrackedResource struct { 2624 // Tags - Resource tags. 2625 Tags map[string]*string `json:"tags"` 2626 // Location - The geo-location where the resource lives 2627 Location *string `json:"location,omitempty"` 2628 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 2629 ID *string `json:"id,omitempty"` 2630 // Name - READ-ONLY; The name of the resource 2631 Name *string `json:"name,omitempty"` 2632 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 2633 Type *string `json:"type,omitempty"` 2634} 2635 2636// MarshalJSON is the custom marshaler for TrackedResource. 2637func (tr TrackedResource) MarshalJSON() ([]byte, error) { 2638 objectMap := make(map[string]interface{}) 2639 if tr.Tags != nil { 2640 objectMap["tags"] = tr.Tags 2641 } 2642 if tr.Location != nil { 2643 objectMap["location"] = tr.Location 2644 } 2645 return json.Marshal(objectMap) 2646} 2647 2648// TrustedExternalTenant represents a tenant ID that is trusted by the cluster. 2649type TrustedExternalTenant struct { 2650 // Value - GUID representing an external tenant. 2651 Value *string `json:"value,omitempty"` 2652} 2653 2654// VirtualNetworkConfiguration a class that contains virtual network definition. 2655type VirtualNetworkConfiguration struct { 2656 // SubnetID - The subnet resource id. 2657 SubnetID *string `json:"subnetId,omitempty"` 2658 // EnginePublicIPID - Engine service's public IP address resource id. 2659 EnginePublicIPID *string `json:"enginePublicIpId,omitempty"` 2660 // DataManagementPublicIPID - Data management's service public IP address resource id. 2661 DataManagementPublicIPID *string `json:"dataManagementPublicIpId,omitempty"` 2662} 2663