1package kusto 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/azure" 25 "github.com/Azure/go-autorest/autorest/to" 26 "github.com/Azure/go-autorest/tracing" 27 "net/http" 28) 29 30// The package's fully qualified name. 31const fqdn = "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-01-21/kusto" 32 33// AzureScaleType enumerates the values for azure scale type. 34type AzureScaleType string 35 36const ( 37 // Automatic ... 38 Automatic AzureScaleType = "automatic" 39 // Manual ... 40 Manual AzureScaleType = "manual" 41 // None ... 42 None AzureScaleType = "none" 43) 44 45// PossibleAzureScaleTypeValues returns an array of possible values for the AzureScaleType const type. 46func PossibleAzureScaleTypeValues() []AzureScaleType { 47 return []AzureScaleType{Automatic, Manual, None} 48} 49 50// AzureSkuName enumerates the values for azure sku name. 51type AzureSkuName string 52 53const ( 54 // DevNoSLAStandardD11V2 ... 55 DevNoSLAStandardD11V2 AzureSkuName = "Dev(No SLA)_Standard_D11_v2" 56 // StandardD11V2 ... 57 StandardD11V2 AzureSkuName = "Standard_D11_v2" 58 // StandardD12V2 ... 59 StandardD12V2 AzureSkuName = "Standard_D12_v2" 60 // StandardD13V2 ... 61 StandardD13V2 AzureSkuName = "Standard_D13_v2" 62 // StandardD14V2 ... 63 StandardD14V2 AzureSkuName = "Standard_D14_v2" 64 // StandardDS13V21TBPS ... 65 StandardDS13V21TBPS AzureSkuName = "Standard_DS13_v2+1TB_PS" 66 // StandardDS13V22TBPS ... 67 StandardDS13V22TBPS AzureSkuName = "Standard_DS13_v2+2TB_PS" 68 // StandardDS14V23TBPS ... 69 StandardDS14V23TBPS AzureSkuName = "Standard_DS14_v2+3TB_PS" 70 // StandardDS14V24TBPS ... 71 StandardDS14V24TBPS AzureSkuName = "Standard_DS14_v2+4TB_PS" 72 // StandardL16s ... 73 StandardL16s AzureSkuName = "Standard_L16s" 74 // StandardL4s ... 75 StandardL4s AzureSkuName = "Standard_L4s" 76 // StandardL8s ... 77 StandardL8s AzureSkuName = "Standard_L8s" 78) 79 80// PossibleAzureSkuNameValues returns an array of possible values for the AzureSkuName const type. 81func PossibleAzureSkuNameValues() []AzureSkuName { 82 return []AzureSkuName{DevNoSLAStandardD11V2, StandardD11V2, StandardD12V2, StandardD13V2, StandardD14V2, StandardDS13V21TBPS, StandardDS13V22TBPS, StandardDS14V23TBPS, StandardDS14V24TBPS, StandardL16s, StandardL4s, StandardL8s} 83} 84 85// AzureSkuTier enumerates the values for azure sku tier. 86type AzureSkuTier string 87 88const ( 89 // Basic ... 90 Basic AzureSkuTier = "Basic" 91 // Standard ... 92 Standard AzureSkuTier = "Standard" 93) 94 95// PossibleAzureSkuTierValues returns an array of possible values for the AzureSkuTier const type. 96func PossibleAzureSkuTierValues() []AzureSkuTier { 97 return []AzureSkuTier{Basic, Standard} 98} 99 100// DatabasePrincipalRole enumerates the values for database principal role. 101type DatabasePrincipalRole string 102 103const ( 104 // Admin ... 105 Admin DatabasePrincipalRole = "Admin" 106 // Ingestor ... 107 Ingestor DatabasePrincipalRole = "Ingestor" 108 // Monitor ... 109 Monitor DatabasePrincipalRole = "Monitor" 110 // UnrestrictedViewers ... 111 UnrestrictedViewers DatabasePrincipalRole = "UnrestrictedViewers" 112 // User ... 113 User DatabasePrincipalRole = "User" 114 // Viewer ... 115 Viewer DatabasePrincipalRole = "Viewer" 116) 117 118// PossibleDatabasePrincipalRoleValues returns an array of possible values for the DatabasePrincipalRole const type. 119func PossibleDatabasePrincipalRoleValues() []DatabasePrincipalRole { 120 return []DatabasePrincipalRole{Admin, Ingestor, Monitor, UnrestrictedViewers, User, Viewer} 121} 122 123// DatabasePrincipalType enumerates the values for database principal type. 124type DatabasePrincipalType string 125 126const ( 127 // DatabasePrincipalTypeApp ... 128 DatabasePrincipalTypeApp DatabasePrincipalType = "App" 129 // DatabasePrincipalTypeGroup ... 130 DatabasePrincipalTypeGroup DatabasePrincipalType = "Group" 131 // DatabasePrincipalTypeUser ... 132 DatabasePrincipalTypeUser DatabasePrincipalType = "User" 133) 134 135// PossibleDatabasePrincipalTypeValues returns an array of possible values for the DatabasePrincipalType const type. 136func PossibleDatabasePrincipalTypeValues() []DatabasePrincipalType { 137 return []DatabasePrincipalType{DatabasePrincipalTypeApp, DatabasePrincipalTypeGroup, DatabasePrincipalTypeUser} 138} 139 140// DataFormat enumerates the values for data format. 141type DataFormat string 142 143const ( 144 // AVRO ... 145 AVRO DataFormat = "AVRO" 146 // CSV ... 147 CSV DataFormat = "CSV" 148 // JSON ... 149 JSON DataFormat = "JSON" 150 // MULTIJSON ... 151 MULTIJSON DataFormat = "MULTIJSON" 152 // PSV ... 153 PSV DataFormat = "PSV" 154 // RAW ... 155 RAW DataFormat = "RAW" 156 // SCSV ... 157 SCSV DataFormat = "SCSV" 158 // SINGLEJSON ... 159 SINGLEJSON DataFormat = "SINGLEJSON" 160 // SOHSV ... 161 SOHSV DataFormat = "SOHSV" 162 // TSV ... 163 TSV DataFormat = "TSV" 164 // TXT ... 165 TXT DataFormat = "TXT" 166) 167 168// PossibleDataFormatValues returns an array of possible values for the DataFormat const type. 169func PossibleDataFormatValues() []DataFormat { 170 return []DataFormat{AVRO, CSV, JSON, MULTIJSON, PSV, RAW, SCSV, SINGLEJSON, SOHSV, TSV, TXT} 171} 172 173// Kind enumerates the values for kind. 174type Kind string 175 176const ( 177 // KindDataConnection ... 178 KindDataConnection Kind = "DataConnection" 179 // KindEventGrid ... 180 KindEventGrid Kind = "EventGrid" 181 // KindEventHub ... 182 KindEventHub Kind = "EventHub" 183) 184 185// PossibleKindValues returns an array of possible values for the Kind const type. 186func PossibleKindValues() []Kind { 187 return []Kind{KindDataConnection, KindEventGrid, KindEventHub} 188} 189 190// ProvisioningState enumerates the values for provisioning state. 191type ProvisioningState string 192 193const ( 194 // Creating ... 195 Creating ProvisioningState = "Creating" 196 // Deleting ... 197 Deleting ProvisioningState = "Deleting" 198 // Failed ... 199 Failed ProvisioningState = "Failed" 200 // Running ... 201 Running ProvisioningState = "Running" 202 // Succeeded ... 203 Succeeded ProvisioningState = "Succeeded" 204) 205 206// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. 207func PossibleProvisioningStateValues() []ProvisioningState { 208 return []ProvisioningState{Creating, Deleting, Failed, Running, Succeeded} 209} 210 211// Reason enumerates the values for reason. 212type Reason string 213 214const ( 215 // AlreadyExists ... 216 AlreadyExists Reason = "AlreadyExists" 217 // Invalid ... 218 Invalid Reason = "Invalid" 219) 220 221// PossibleReasonValues returns an array of possible values for the Reason const type. 222func PossibleReasonValues() []Reason { 223 return []Reason{AlreadyExists, Invalid} 224} 225 226// State enumerates the values for state. 227type State string 228 229const ( 230 // StateCreating ... 231 StateCreating State = "Creating" 232 // StateDeleted ... 233 StateDeleted State = "Deleted" 234 // StateDeleting ... 235 StateDeleting State = "Deleting" 236 // StateRunning ... 237 StateRunning State = "Running" 238 // StateStarting ... 239 StateStarting State = "Starting" 240 // StateStopped ... 241 StateStopped State = "Stopped" 242 // StateStopping ... 243 StateStopping State = "Stopping" 244 // StateUnavailable ... 245 StateUnavailable State = "Unavailable" 246 // StateUpdating ... 247 StateUpdating State = "Updating" 248) 249 250// PossibleStateValues returns an array of possible values for the State const type. 251func PossibleStateValues() []State { 252 return []State{StateCreating, StateDeleted, StateDeleting, StateRunning, StateStarting, StateStopped, StateStopping, StateUnavailable, StateUpdating} 253} 254 255// AzureCapacity azure capacity definition. 256type AzureCapacity struct { 257 // ScaleType - Scale type. Possible values include: 'Automatic', 'Manual', 'None' 258 ScaleType AzureScaleType `json:"scaleType,omitempty"` 259 // Minimum - Minimum allowed instances count. 260 Minimum *int32 `json:"minimum,omitempty"` 261 // Maximum - Maximum allowed instances count. 262 Maximum *int32 `json:"maximum,omitempty"` 263 // Default - The default capacity that would be used. 264 Default *int32 `json:"default,omitempty"` 265} 266 267// AzureEntityResource the resource model definition for a Azure Resource Manager resource with an etag. 268type AzureEntityResource struct { 269 // Etag - READ-ONLY; Resource Etag. 270 Etag *string `json:"etag,omitempty"` 271 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 272 ID *string `json:"id,omitempty"` 273 // Name - READ-ONLY; The name of the resource 274 Name *string `json:"name,omitempty"` 275 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 276 Type *string `json:"type,omitempty"` 277} 278 279// AzureResourceSku azure resource SKU definition. 280type AzureResourceSku struct { 281 // ResourceType - Resource Namespace and Type. 282 ResourceType *string `json:"resourceType,omitempty"` 283 // Sku - The SKU details. 284 Sku *AzureSku `json:"sku,omitempty"` 285 // Capacity - The number of instances of the cluster. 286 Capacity *AzureCapacity `json:"capacity,omitempty"` 287} 288 289// AzureSku azure SKU definition. 290type AzureSku struct { 291 // Name - SKU name. Possible values include: 'StandardDS13V21TBPS', 'StandardDS13V22TBPS', 'StandardDS14V23TBPS', 'StandardDS14V24TBPS', 'StandardD13V2', 'StandardD14V2', 'StandardL8s', 'StandardL16s', 'StandardD11V2', 'StandardD12V2', 'StandardL4s', 'DevNoSLAStandardD11V2' 292 Name AzureSkuName `json:"name,omitempty"` 293 // Capacity - The number of instances of the cluster. 294 Capacity *int32 `json:"capacity,omitempty"` 295 // Tier - SKU tier. Possible values include: 'Basic', 'Standard' 296 Tier AzureSkuTier `json:"tier,omitempty"` 297} 298 299// CheckNameResult the result returned from a check name availability request. 300type CheckNameResult struct { 301 autorest.Response `json:"-"` 302 // NameAvailable - Specifies a Boolean value that indicates if the name is available. 303 NameAvailable *bool `json:"nameAvailable,omitempty"` 304 // Name - The name that was checked. 305 Name *string `json:"name,omitempty"` 306 // Message - Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. 307 Message *string `json:"message,omitempty"` 308 // Reason - Message providing the reason why the given name is invalid. Possible values include: 'Invalid', 'AlreadyExists' 309 Reason Reason `json:"reason,omitempty"` 310} 311 312// CloudError an error response from Kusto. 313type CloudError struct { 314 // Error - An error response from Kusto. 315 Error *CloudErrorBody `json:"error,omitempty"` 316} 317 318// CloudErrorBody an error response from Kusto. 319type CloudErrorBody struct { 320 // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. 321 Code *string `json:"code,omitempty"` 322 // Message - A message describing the error, intended to be suitable for displaying in a user interface. 323 Message *string `json:"message,omitempty"` 324 // Target - The target of the particular error. For example, the name of the property in error. 325 Target *string `json:"target,omitempty"` 326 // Details - A list of additional details about the error. 327 Details *[]CloudErrorBody `json:"details,omitempty"` 328} 329 330// Cluster class representing a Kusto cluster. 331type Cluster struct { 332 autorest.Response `json:"-"` 333 // Sku - The SKU of the cluster. 334 Sku *AzureSku `json:"sku,omitempty"` 335 // ClusterProperties - The cluster properties. 336 *ClusterProperties `json:"properties,omitempty"` 337 // Tags - Resource tags. 338 Tags map[string]*string `json:"tags"` 339 // Location - The geo-location where the resource lives 340 Location *string `json:"location,omitempty"` 341 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 342 ID *string `json:"id,omitempty"` 343 // Name - READ-ONLY; The name of the resource 344 Name *string `json:"name,omitempty"` 345 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 346 Type *string `json:"type,omitempty"` 347} 348 349// MarshalJSON is the custom marshaler for Cluster. 350func (c Cluster) MarshalJSON() ([]byte, error) { 351 objectMap := make(map[string]interface{}) 352 if c.Sku != nil { 353 objectMap["sku"] = c.Sku 354 } 355 if c.ClusterProperties != nil { 356 objectMap["properties"] = c.ClusterProperties 357 } 358 if c.Tags != nil { 359 objectMap["tags"] = c.Tags 360 } 361 if c.Location != nil { 362 objectMap["location"] = c.Location 363 } 364 return json.Marshal(objectMap) 365} 366 367// UnmarshalJSON is the custom unmarshaler for Cluster struct. 368func (c *Cluster) UnmarshalJSON(body []byte) error { 369 var m map[string]*json.RawMessage 370 err := json.Unmarshal(body, &m) 371 if err != nil { 372 return err 373 } 374 for k, v := range m { 375 switch k { 376 case "sku": 377 if v != nil { 378 var sku AzureSku 379 err = json.Unmarshal(*v, &sku) 380 if err != nil { 381 return err 382 } 383 c.Sku = &sku 384 } 385 case "properties": 386 if v != nil { 387 var clusterProperties ClusterProperties 388 err = json.Unmarshal(*v, &clusterProperties) 389 if err != nil { 390 return err 391 } 392 c.ClusterProperties = &clusterProperties 393 } 394 case "tags": 395 if v != nil { 396 var tags map[string]*string 397 err = json.Unmarshal(*v, &tags) 398 if err != nil { 399 return err 400 } 401 c.Tags = tags 402 } 403 case "location": 404 if v != nil { 405 var location string 406 err = json.Unmarshal(*v, &location) 407 if err != nil { 408 return err 409 } 410 c.Location = &location 411 } 412 case "id": 413 if v != nil { 414 var ID string 415 err = json.Unmarshal(*v, &ID) 416 if err != nil { 417 return err 418 } 419 c.ID = &ID 420 } 421 case "name": 422 if v != nil { 423 var name string 424 err = json.Unmarshal(*v, &name) 425 if err != nil { 426 return err 427 } 428 c.Name = &name 429 } 430 case "type": 431 if v != nil { 432 var typeVar string 433 err = json.Unmarshal(*v, &typeVar) 434 if err != nil { 435 return err 436 } 437 c.Type = &typeVar 438 } 439 } 440 } 441 442 return nil 443} 444 445// ClusterCheckNameRequest the result returned from a cluster check name availability request. 446type ClusterCheckNameRequest struct { 447 // Name - Cluster name. 448 Name *string `json:"name,omitempty"` 449 // Type - The type of resource, Microsoft.Kusto/clusters. 450 Type *string `json:"type,omitempty"` 451} 452 453// ClusterListResult the list Kusto clusters operation response. 454type ClusterListResult struct { 455 autorest.Response `json:"-"` 456 // Value - The list of Kusto clusters. 457 Value *[]Cluster `json:"value,omitempty"` 458} 459 460// ClusterProperties class representing the Kusto cluster properties. 461type ClusterProperties struct { 462 // State - READ-ONLY; The state of the resource. Possible values include: 'StateCreating', 'StateUnavailable', 'StateRunning', 'StateDeleting', 'StateDeleted', 'StateStopping', 'StateStopped', 'StateStarting', 'StateUpdating' 463 State State `json:"state,omitempty"` 464 // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed' 465 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 466 // URI - READ-ONLY; The cluster URI. 467 URI *string `json:"uri,omitempty"` 468 // DataIngestionURI - READ-ONLY; The cluster data ingestion URI. 469 DataIngestionURI *string `json:"dataIngestionUri,omitempty"` 470 // TrustedExternalTenants - The cluster's external tenants. 471 TrustedExternalTenants *[]TrustedExternalTenant `json:"trustedExternalTenants,omitempty"` 472} 473 474// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 475// operation. 476type ClustersCreateOrUpdateFuture struct { 477 azure.Future 478} 479 480// Result returns the result of the asynchronous operation. 481// If the operation has not completed it will return an error. 482func (future *ClustersCreateOrUpdateFuture) Result(client ClustersClient) (c Cluster, err error) { 483 var done bool 484 done, err = future.DoneWithContext(context.Background(), client) 485 if err != nil { 486 err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 487 return 488 } 489 if !done { 490 err = azure.NewAsyncOpIncompleteError("kusto.ClustersCreateOrUpdateFuture") 491 return 492 } 493 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 494 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { 495 c, err = client.CreateOrUpdateResponder(c.Response.Response) 496 if err != nil { 497 err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") 498 } 499 } 500 return 501} 502 503// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 504// operation. 505type ClustersDeleteFuture struct { 506 azure.Future 507} 508 509// Result returns the result of the asynchronous operation. 510// If the operation has not completed it will return an error. 511func (future *ClustersDeleteFuture) Result(client ClustersClient) (ar autorest.Response, err error) { 512 var done bool 513 done, err = future.DoneWithContext(context.Background(), client) 514 if err != nil { 515 err = autorest.NewErrorWithError(err, "kusto.ClustersDeleteFuture", "Result", future.Response(), "Polling failure") 516 return 517 } 518 if !done { 519 err = azure.NewAsyncOpIncompleteError("kusto.ClustersDeleteFuture") 520 return 521 } 522 ar.Response = future.Response() 523 return 524} 525 526// ClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running 527// operation. 528type ClustersStartFuture struct { 529 azure.Future 530} 531 532// Result returns the result of the asynchronous operation. 533// If the operation has not completed it will return an error. 534func (future *ClustersStartFuture) Result(client ClustersClient) (ar autorest.Response, err error) { 535 var done bool 536 done, err = future.DoneWithContext(context.Background(), client) 537 if err != nil { 538 err = autorest.NewErrorWithError(err, "kusto.ClustersStartFuture", "Result", future.Response(), "Polling failure") 539 return 540 } 541 if !done { 542 err = azure.NewAsyncOpIncompleteError("kusto.ClustersStartFuture") 543 return 544 } 545 ar.Response = future.Response() 546 return 547} 548 549// ClustersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. 550type ClustersStopFuture struct { 551 azure.Future 552} 553 554// Result returns the result of the asynchronous operation. 555// If the operation has not completed it will return an error. 556func (future *ClustersStopFuture) Result(client ClustersClient) (ar autorest.Response, err error) { 557 var done bool 558 done, err = future.DoneWithContext(context.Background(), client) 559 if err != nil { 560 err = autorest.NewErrorWithError(err, "kusto.ClustersStopFuture", "Result", future.Response(), "Polling failure") 561 return 562 } 563 if !done { 564 err = azure.NewAsyncOpIncompleteError("kusto.ClustersStopFuture") 565 return 566 } 567 ar.Response = future.Response() 568 return 569} 570 571// ClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 572// operation. 573type ClustersUpdateFuture struct { 574 azure.Future 575} 576 577// Result returns the result of the asynchronous operation. 578// If the operation has not completed it will return an error. 579func (future *ClustersUpdateFuture) Result(client ClustersClient) (c Cluster, err error) { 580 var done bool 581 done, err = future.DoneWithContext(context.Background(), client) 582 if err != nil { 583 err = autorest.NewErrorWithError(err, "kusto.ClustersUpdateFuture", "Result", future.Response(), "Polling failure") 584 return 585 } 586 if !done { 587 err = azure.NewAsyncOpIncompleteError("kusto.ClustersUpdateFuture") 588 return 589 } 590 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 591 if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { 592 c, err = client.UpdateResponder(c.Response.Response) 593 if err != nil { 594 err = autorest.NewErrorWithError(err, "kusto.ClustersUpdateFuture", "Result", c.Response.Response, "Failure responding to request") 595 } 596 } 597 return 598} 599 600// ClusterUpdate class representing an update to a Kusto cluster. 601type ClusterUpdate struct { 602 // Tags - Resource tags. 603 Tags map[string]*string `json:"tags"` 604 // Location - Resource location. 605 Location *string `json:"location,omitempty"` 606 // Sku - The SKU of the cluster. 607 Sku *AzureSku `json:"sku,omitempty"` 608 // ClusterProperties - The cluster properties. 609 *ClusterProperties `json:"properties,omitempty"` 610 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 611 ID *string `json:"id,omitempty"` 612 // Name - READ-ONLY; The name of the resource 613 Name *string `json:"name,omitempty"` 614 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 615 Type *string `json:"type,omitempty"` 616} 617 618// MarshalJSON is the custom marshaler for ClusterUpdate. 619func (cu ClusterUpdate) MarshalJSON() ([]byte, error) { 620 objectMap := make(map[string]interface{}) 621 if cu.Tags != nil { 622 objectMap["tags"] = cu.Tags 623 } 624 if cu.Location != nil { 625 objectMap["location"] = cu.Location 626 } 627 if cu.Sku != nil { 628 objectMap["sku"] = cu.Sku 629 } 630 if cu.ClusterProperties != nil { 631 objectMap["properties"] = cu.ClusterProperties 632 } 633 return json.Marshal(objectMap) 634} 635 636// UnmarshalJSON is the custom unmarshaler for ClusterUpdate struct. 637func (cu *ClusterUpdate) UnmarshalJSON(body []byte) error { 638 var m map[string]*json.RawMessage 639 err := json.Unmarshal(body, &m) 640 if err != nil { 641 return err 642 } 643 for k, v := range m { 644 switch k { 645 case "tags": 646 if v != nil { 647 var tags map[string]*string 648 err = json.Unmarshal(*v, &tags) 649 if err != nil { 650 return err 651 } 652 cu.Tags = tags 653 } 654 case "location": 655 if v != nil { 656 var location string 657 err = json.Unmarshal(*v, &location) 658 if err != nil { 659 return err 660 } 661 cu.Location = &location 662 } 663 case "sku": 664 if v != nil { 665 var sku AzureSku 666 err = json.Unmarshal(*v, &sku) 667 if err != nil { 668 return err 669 } 670 cu.Sku = &sku 671 } 672 case "properties": 673 if v != nil { 674 var clusterProperties ClusterProperties 675 err = json.Unmarshal(*v, &clusterProperties) 676 if err != nil { 677 return err 678 } 679 cu.ClusterProperties = &clusterProperties 680 } 681 case "id": 682 if v != nil { 683 var ID string 684 err = json.Unmarshal(*v, &ID) 685 if err != nil { 686 return err 687 } 688 cu.ID = &ID 689 } 690 case "name": 691 if v != nil { 692 var name string 693 err = json.Unmarshal(*v, &name) 694 if err != nil { 695 return err 696 } 697 cu.Name = &name 698 } 699 case "type": 700 if v != nil { 701 var typeVar string 702 err = json.Unmarshal(*v, &typeVar) 703 if err != nil { 704 return err 705 } 706 cu.Type = &typeVar 707 } 708 } 709 } 710 711 return nil 712} 713 714// Database class representing a Kusto database. 715type Database struct { 716 autorest.Response `json:"-"` 717 // Location - Resource location. 718 Location *string `json:"location,omitempty"` 719 // DatabaseProperties - The database properties. 720 *DatabaseProperties `json:"properties,omitempty"` 721 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 722 ID *string `json:"id,omitempty"` 723 // Name - READ-ONLY; The name of the resource 724 Name *string `json:"name,omitempty"` 725 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 726 Type *string `json:"type,omitempty"` 727} 728 729// MarshalJSON is the custom marshaler for Database. 730func (d Database) MarshalJSON() ([]byte, error) { 731 objectMap := make(map[string]interface{}) 732 if d.Location != nil { 733 objectMap["location"] = d.Location 734 } 735 if d.DatabaseProperties != nil { 736 objectMap["properties"] = d.DatabaseProperties 737 } 738 return json.Marshal(objectMap) 739} 740 741// UnmarshalJSON is the custom unmarshaler for Database struct. 742func (d *Database) UnmarshalJSON(body []byte) error { 743 var m map[string]*json.RawMessage 744 err := json.Unmarshal(body, &m) 745 if err != nil { 746 return err 747 } 748 for k, v := range m { 749 switch k { 750 case "location": 751 if v != nil { 752 var location string 753 err = json.Unmarshal(*v, &location) 754 if err != nil { 755 return err 756 } 757 d.Location = &location 758 } 759 case "properties": 760 if v != nil { 761 var databaseProperties DatabaseProperties 762 err = json.Unmarshal(*v, &databaseProperties) 763 if err != nil { 764 return err 765 } 766 d.DatabaseProperties = &databaseProperties 767 } 768 case "id": 769 if v != nil { 770 var ID string 771 err = json.Unmarshal(*v, &ID) 772 if err != nil { 773 return err 774 } 775 d.ID = &ID 776 } 777 case "name": 778 if v != nil { 779 var name string 780 err = json.Unmarshal(*v, &name) 781 if err != nil { 782 return err 783 } 784 d.Name = &name 785 } 786 case "type": 787 if v != nil { 788 var typeVar string 789 err = json.Unmarshal(*v, &typeVar) 790 if err != nil { 791 return err 792 } 793 d.Type = &typeVar 794 } 795 } 796 } 797 798 return nil 799} 800 801// DatabaseCheckNameRequest the result returned from a database check name availability request. 802type DatabaseCheckNameRequest struct { 803 // Name - Database name. 804 Name *string `json:"name,omitempty"` 805 // Type - The type of resource, Microsoft.Kusto/clusters/databases. 806 Type *string `json:"type,omitempty"` 807} 808 809// DatabaseListResult the list Kusto databases operation response. 810type DatabaseListResult struct { 811 autorest.Response `json:"-"` 812 // Value - The list of Kusto databases. 813 Value *[]Database `json:"value,omitempty"` 814} 815 816// DatabasePrincipal a class representing database principal entity. 817type DatabasePrincipal struct { 818 // Role - Database principal role. Possible values include: 'Admin', 'Ingestor', 'Monitor', 'User', 'UnrestrictedViewers', 'Viewer' 819 Role DatabasePrincipalRole `json:"role,omitempty"` 820 // Name - Database principal name. 821 Name *string `json:"name,omitempty"` 822 // Type - Database principal type. Possible values include: 'DatabasePrincipalTypeApp', 'DatabasePrincipalTypeGroup', 'DatabasePrincipalTypeUser' 823 Type DatabasePrincipalType `json:"type,omitempty"` 824 // Fqn - Database principal fully qualified name. 825 Fqn *string `json:"fqn,omitempty"` 826 // Email - Database principal email if exists. 827 Email *string `json:"email,omitempty"` 828 // AppID - Application id - relevant only for application principal type. 829 AppID *string `json:"appId,omitempty"` 830} 831 832// DatabasePrincipalListRequest the list Kusto database principals operation request. 833type DatabasePrincipalListRequest struct { 834 // Value - The list of Kusto database principals. 835 Value *[]DatabasePrincipal `json:"value,omitempty"` 836} 837 838// DatabasePrincipalListResult the list Kusto database principals operation response. 839type DatabasePrincipalListResult struct { 840 autorest.Response `json:"-"` 841 // Value - The list of Kusto database principals. 842 Value *[]DatabasePrincipal `json:"value,omitempty"` 843} 844 845// DatabaseProperties class representing the Kusto database properties. 846type DatabaseProperties struct { 847 // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed' 848 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 849 // SoftDeletePeriod - The time the data should be kept before it stops being accessible to queries in TimeSpan. 850 SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` 851 // HotCachePeriod - The time the data that should be kept in cache for fast queries in TimeSpan. 852 HotCachePeriod *string `json:"hotCachePeriod,omitempty"` 853 // Statistics - The statistics of the database. 854 Statistics *DatabaseStatistics `json:"statistics,omitempty"` 855} 856 857// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 858// operation. 859type DatabasesCreateOrUpdateFuture struct { 860 azure.Future 861} 862 863// Result returns the result of the asynchronous operation. 864// If the operation has not completed it will return an error. 865func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) { 866 var done bool 867 done, err = future.DoneWithContext(context.Background(), client) 868 if err != nil { 869 err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 870 return 871 } 872 if !done { 873 err = azure.NewAsyncOpIncompleteError("kusto.DatabasesCreateOrUpdateFuture") 874 return 875 } 876 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 877 if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { 878 d, err = client.CreateOrUpdateResponder(d.Response.Response) 879 if err != nil { 880 err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") 881 } 882 } 883 return 884} 885 886// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 887// operation. 888type DatabasesDeleteFuture struct { 889 azure.Future 890} 891 892// Result returns the result of the asynchronous operation. 893// If the operation has not completed it will return an error. 894func (future *DatabasesDeleteFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { 895 var done bool 896 done, err = future.DoneWithContext(context.Background(), client) 897 if err != nil { 898 err = autorest.NewErrorWithError(err, "kusto.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") 899 return 900 } 901 if !done { 902 err = azure.NewAsyncOpIncompleteError("kusto.DatabasesDeleteFuture") 903 return 904 } 905 ar.Response = future.Response() 906 return 907} 908 909// DatabaseStatistics a class that contains database statistics information. 910type DatabaseStatistics struct { 911 // Size - The database size - the total size of compressed data and index in bytes. 912 Size *float64 `json:"size,omitempty"` 913} 914 915// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 916// operation. 917type DatabasesUpdateFuture struct { 918 azure.Future 919} 920 921// Result returns the result of the asynchronous operation. 922// If the operation has not completed it will return an error. 923func (future *DatabasesUpdateFuture) Result(client DatabasesClient) (d Database, err error) { 924 var done bool 925 done, err = future.DoneWithContext(context.Background(), client) 926 if err != nil { 927 err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") 928 return 929 } 930 if !done { 931 err = azure.NewAsyncOpIncompleteError("kusto.DatabasesUpdateFuture") 932 return 933 } 934 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 935 if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { 936 d, err = client.UpdateResponder(d.Response.Response) 937 if err != nil { 938 err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request") 939 } 940 } 941 return 942} 943 944// DatabaseUpdate class representing an update to a Kusto database. 945type DatabaseUpdate struct { 946 // Location - Resource location. 947 Location *string `json:"location,omitempty"` 948 // DatabaseProperties - The properties of the updated database. 949 *DatabaseProperties `json:"properties,omitempty"` 950 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 951 ID *string `json:"id,omitempty"` 952 // Name - READ-ONLY; The name of the resource 953 Name *string `json:"name,omitempty"` 954 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 955 Type *string `json:"type,omitempty"` 956} 957 958// MarshalJSON is the custom marshaler for DatabaseUpdate. 959func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { 960 objectMap := make(map[string]interface{}) 961 if du.Location != nil { 962 objectMap["location"] = du.Location 963 } 964 if du.DatabaseProperties != nil { 965 objectMap["properties"] = du.DatabaseProperties 966 } 967 return json.Marshal(objectMap) 968} 969 970// UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct. 971func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { 972 var m map[string]*json.RawMessage 973 err := json.Unmarshal(body, &m) 974 if err != nil { 975 return err 976 } 977 for k, v := range m { 978 switch k { 979 case "location": 980 if v != nil { 981 var location string 982 err = json.Unmarshal(*v, &location) 983 if err != nil { 984 return err 985 } 986 du.Location = &location 987 } 988 case "properties": 989 if v != nil { 990 var databaseProperties DatabaseProperties 991 err = json.Unmarshal(*v, &databaseProperties) 992 if err != nil { 993 return err 994 } 995 du.DatabaseProperties = &databaseProperties 996 } 997 case "id": 998 if v != nil { 999 var ID string 1000 err = json.Unmarshal(*v, &ID) 1001 if err != nil { 1002 return err 1003 } 1004 du.ID = &ID 1005 } 1006 case "name": 1007 if v != nil { 1008 var name string 1009 err = json.Unmarshal(*v, &name) 1010 if err != nil { 1011 return err 1012 } 1013 du.Name = &name 1014 } 1015 case "type": 1016 if v != nil { 1017 var typeVar string 1018 err = json.Unmarshal(*v, &typeVar) 1019 if err != nil { 1020 return err 1021 } 1022 du.Type = &typeVar 1023 } 1024 } 1025 } 1026 1027 return nil 1028} 1029 1030// BasicDataConnection class representing an data connection. 1031type BasicDataConnection interface { 1032 AsEventHubDataConnection() (*EventHubDataConnection, bool) 1033 AsEventGridDataConnection() (*EventGridDataConnection, bool) 1034 AsDataConnection() (*DataConnection, bool) 1035} 1036 1037// DataConnection class representing an data connection. 1038type DataConnection struct { 1039 autorest.Response `json:"-"` 1040 // Location - Resource location. 1041 Location *string `json:"location,omitempty"` 1042 // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid' 1043 Kind Kind `json:"kind,omitempty"` 1044 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1045 ID *string `json:"id,omitempty"` 1046 // Name - READ-ONLY; The name of the resource 1047 Name *string `json:"name,omitempty"` 1048 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1049 Type *string `json:"type,omitempty"` 1050} 1051 1052func unmarshalBasicDataConnection(body []byte) (BasicDataConnection, error) { 1053 var m map[string]interface{} 1054 err := json.Unmarshal(body, &m) 1055 if err != nil { 1056 return nil, err 1057 } 1058 1059 switch m["kind"] { 1060 case string(KindEventHub): 1061 var ehdc EventHubDataConnection 1062 err := json.Unmarshal(body, &ehdc) 1063 return ehdc, err 1064 case string(KindEventGrid): 1065 var egdc EventGridDataConnection 1066 err := json.Unmarshal(body, &egdc) 1067 return egdc, err 1068 default: 1069 var dc DataConnection 1070 err := json.Unmarshal(body, &dc) 1071 return dc, err 1072 } 1073} 1074func unmarshalBasicDataConnectionArray(body []byte) ([]BasicDataConnection, error) { 1075 var rawMessages []*json.RawMessage 1076 err := json.Unmarshal(body, &rawMessages) 1077 if err != nil { 1078 return nil, err 1079 } 1080 1081 dcArray := make([]BasicDataConnection, len(rawMessages)) 1082 1083 for index, rawMessage := range rawMessages { 1084 dc, err := unmarshalBasicDataConnection(*rawMessage) 1085 if err != nil { 1086 return nil, err 1087 } 1088 dcArray[index] = dc 1089 } 1090 return dcArray, nil 1091} 1092 1093// MarshalJSON is the custom marshaler for DataConnection. 1094func (dc DataConnection) MarshalJSON() ([]byte, error) { 1095 dc.Kind = KindDataConnection 1096 objectMap := make(map[string]interface{}) 1097 if dc.Location != nil { 1098 objectMap["location"] = dc.Location 1099 } 1100 if dc.Kind != "" { 1101 objectMap["kind"] = dc.Kind 1102 } 1103 return json.Marshal(objectMap) 1104} 1105 1106// AsEventHubDataConnection is the BasicDataConnection implementation for DataConnection. 1107func (dc DataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { 1108 return nil, false 1109} 1110 1111// AsEventGridDataConnection is the BasicDataConnection implementation for DataConnection. 1112func (dc DataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { 1113 return nil, false 1114} 1115 1116// AsDataConnection is the BasicDataConnection implementation for DataConnection. 1117func (dc DataConnection) AsDataConnection() (*DataConnection, bool) { 1118 return &dc, true 1119} 1120 1121// AsBasicDataConnection is the BasicDataConnection implementation for DataConnection. 1122func (dc DataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { 1123 return &dc, true 1124} 1125 1126// DataConnectionCheckNameRequest the result returned from a data connections check name availability 1127// request. 1128type DataConnectionCheckNameRequest struct { 1129 // Name - Data Connection name. 1130 Name *string `json:"name,omitempty"` 1131 // Type - The type of resource, Microsoft.Kusto/clusters/databases/dataConnections. 1132 Type *string `json:"type,omitempty"` 1133} 1134 1135// DataConnectionListResult the list Kusto data connections operation response. 1136type DataConnectionListResult struct { 1137 autorest.Response `json:"-"` 1138 // Value - The list of Kusto data connections. 1139 Value *[]BasicDataConnection `json:"value,omitempty"` 1140} 1141 1142// UnmarshalJSON is the custom unmarshaler for DataConnectionListResult struct. 1143func (dclr *DataConnectionListResult) UnmarshalJSON(body []byte) error { 1144 var m map[string]*json.RawMessage 1145 err := json.Unmarshal(body, &m) 1146 if err != nil { 1147 return err 1148 } 1149 for k, v := range m { 1150 switch k { 1151 case "value": 1152 if v != nil { 1153 value, err := unmarshalBasicDataConnectionArray(*v) 1154 if err != nil { 1155 return err 1156 } 1157 dclr.Value = &value 1158 } 1159 } 1160 } 1161 1162 return nil 1163} 1164 1165// DataConnectionModel ... 1166type DataConnectionModel struct { 1167 autorest.Response `json:"-"` 1168 Value BasicDataConnection `json:"value,omitempty"` 1169} 1170 1171// UnmarshalJSON is the custom unmarshaler for DataConnectionModel struct. 1172func (dcm *DataConnectionModel) UnmarshalJSON(body []byte) error { 1173 dc, err := unmarshalBasicDataConnection(body) 1174 if err != nil { 1175 return err 1176 } 1177 dcm.Value = dc 1178 1179 return nil 1180} 1181 1182// DataConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 1183// long-running operation. 1184type DataConnectionsCreateOrUpdateFuture struct { 1185 azure.Future 1186} 1187 1188// Result returns the result of the asynchronous operation. 1189// If the operation has not completed it will return an error. 1190func (future *DataConnectionsCreateOrUpdateFuture) Result(client DataConnectionsClient) (dcm DataConnectionModel, err error) { 1191 var done bool 1192 done, err = future.DoneWithContext(context.Background(), client) 1193 if err != nil { 1194 err = autorest.NewErrorWithError(err, "kusto.DataConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") 1195 return 1196 } 1197 if !done { 1198 err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsCreateOrUpdateFuture") 1199 return 1200 } 1201 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1202 if dcm.Response.Response, err = future.GetResult(sender); err == nil && dcm.Response.Response.StatusCode != http.StatusNoContent { 1203 dcm, err = client.CreateOrUpdateResponder(dcm.Response.Response) 1204 if err != nil { 1205 err = autorest.NewErrorWithError(err, "kusto.DataConnectionsCreateOrUpdateFuture", "Result", dcm.Response.Response, "Failure responding to request") 1206 } 1207 } 1208 return 1209} 1210 1211// DataConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 1212// operation. 1213type DataConnectionsDeleteFuture struct { 1214 azure.Future 1215} 1216 1217// Result returns the result of the asynchronous operation. 1218// If the operation has not completed it will return an error. 1219func (future *DataConnectionsDeleteFuture) Result(client DataConnectionsClient) (ar autorest.Response, err error) { 1220 var done bool 1221 done, err = future.DoneWithContext(context.Background(), client) 1222 if err != nil { 1223 err = autorest.NewErrorWithError(err, "kusto.DataConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") 1224 return 1225 } 1226 if !done { 1227 err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsDeleteFuture") 1228 return 1229 } 1230 ar.Response = future.Response() 1231 return 1232} 1233 1234// DataConnectionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 1235// operation. 1236type DataConnectionsUpdateFuture struct { 1237 azure.Future 1238} 1239 1240// Result returns the result of the asynchronous operation. 1241// If the operation has not completed it will return an error. 1242func (future *DataConnectionsUpdateFuture) Result(client DataConnectionsClient) (dcm DataConnectionModel, err error) { 1243 var done bool 1244 done, err = future.DoneWithContext(context.Background(), client) 1245 if err != nil { 1246 err = autorest.NewErrorWithError(err, "kusto.DataConnectionsUpdateFuture", "Result", future.Response(), "Polling failure") 1247 return 1248 } 1249 if !done { 1250 err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsUpdateFuture") 1251 return 1252 } 1253 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1254 if dcm.Response.Response, err = future.GetResult(sender); err == nil && dcm.Response.Response.StatusCode != http.StatusNoContent { 1255 dcm, err = client.UpdateResponder(dcm.Response.Response) 1256 if err != nil { 1257 err = autorest.NewErrorWithError(err, "kusto.DataConnectionsUpdateFuture", "Result", dcm.Response.Response, "Failure responding to request") 1258 } 1259 } 1260 return 1261} 1262 1263// DataConnectionValidation class representing an data connection validation. 1264type DataConnectionValidation struct { 1265 // DataConnectionName - The name of the data connection. 1266 DataConnectionName *string `json:"dataConnectionName,omitempty"` 1267 // Properties - The data connection properties to validate. 1268 Properties BasicDataConnection `json:"properties,omitempty"` 1269} 1270 1271// UnmarshalJSON is the custom unmarshaler for DataConnectionValidation struct. 1272func (dcv *DataConnectionValidation) UnmarshalJSON(body []byte) error { 1273 var m map[string]*json.RawMessage 1274 err := json.Unmarshal(body, &m) 1275 if err != nil { 1276 return err 1277 } 1278 for k, v := range m { 1279 switch k { 1280 case "dataConnectionName": 1281 if v != nil { 1282 var dataConnectionName string 1283 err = json.Unmarshal(*v, &dataConnectionName) 1284 if err != nil { 1285 return err 1286 } 1287 dcv.DataConnectionName = &dataConnectionName 1288 } 1289 case "properties": 1290 if v != nil { 1291 properties, err := unmarshalBasicDataConnection(*v) 1292 if err != nil { 1293 return err 1294 } 1295 dcv.Properties = properties 1296 } 1297 } 1298 } 1299 1300 return nil 1301} 1302 1303// DataConnectionValidationListResult the list Kusto data connection validation result. 1304type DataConnectionValidationListResult struct { 1305 autorest.Response `json:"-"` 1306 // Value - The list of Kusto data connection validation errors. 1307 Value *[]DataConnectionValidationResult `json:"value,omitempty"` 1308} 1309 1310// DataConnectionValidationResult the result returned from a data connection validation request. 1311type DataConnectionValidationResult struct { 1312 // ErrorMessage - A message which indicates a problem in data connection validation. 1313 ErrorMessage *string `json:"errorMessage,omitempty"` 1314} 1315 1316// EventGridConnectionProperties class representing the Kusto event grid connection properties. 1317type EventGridConnectionProperties struct { 1318 // StorageAccountResourceID - The resource ID of the storage account where the data resides. 1319 StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` 1320 // EventHubResourceID - The resource ID where the event grid is configured to send events. 1321 EventHubResourceID *string `json:"eventHubResourceId,omitempty"` 1322 // ConsumerGroup - The event hub consumer group. 1323 ConsumerGroup *string `json:"consumerGroup,omitempty"` 1324 // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. 1325 TableName *string `json:"tableName,omitempty"` 1326 // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. 1327 MappingRuleName *string `json:"mappingRuleName,omitempty"` 1328 // 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' 1329 DataFormat DataFormat `json:"dataFormat,omitempty"` 1330} 1331 1332// EventGridDataConnection class representing an Event Grid data connection. 1333type EventGridDataConnection struct { 1334 // EventGridConnectionProperties - The properties of the Event Grid data connection. 1335 *EventGridConnectionProperties `json:"properties,omitempty"` 1336 // Location - Resource location. 1337 Location *string `json:"location,omitempty"` 1338 // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid' 1339 Kind Kind `json:"kind,omitempty"` 1340 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1341 ID *string `json:"id,omitempty"` 1342 // Name - READ-ONLY; The name of the resource 1343 Name *string `json:"name,omitempty"` 1344 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1345 Type *string `json:"type,omitempty"` 1346} 1347 1348// MarshalJSON is the custom marshaler for EventGridDataConnection. 1349func (egdc EventGridDataConnection) MarshalJSON() ([]byte, error) { 1350 egdc.Kind = KindEventGrid 1351 objectMap := make(map[string]interface{}) 1352 if egdc.EventGridConnectionProperties != nil { 1353 objectMap["properties"] = egdc.EventGridConnectionProperties 1354 } 1355 if egdc.Location != nil { 1356 objectMap["location"] = egdc.Location 1357 } 1358 if egdc.Kind != "" { 1359 objectMap["kind"] = egdc.Kind 1360 } 1361 return json.Marshal(objectMap) 1362} 1363 1364// AsEventHubDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 1365func (egdc EventGridDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { 1366 return nil, false 1367} 1368 1369// AsEventGridDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 1370func (egdc EventGridDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { 1371 return &egdc, true 1372} 1373 1374// AsDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 1375func (egdc EventGridDataConnection) AsDataConnection() (*DataConnection, bool) { 1376 return nil, false 1377} 1378 1379// AsBasicDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 1380func (egdc EventGridDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { 1381 return &egdc, true 1382} 1383 1384// UnmarshalJSON is the custom unmarshaler for EventGridDataConnection struct. 1385func (egdc *EventGridDataConnection) UnmarshalJSON(body []byte) error { 1386 var m map[string]*json.RawMessage 1387 err := json.Unmarshal(body, &m) 1388 if err != nil { 1389 return err 1390 } 1391 for k, v := range m { 1392 switch k { 1393 case "properties": 1394 if v != nil { 1395 var eventGridConnectionProperties EventGridConnectionProperties 1396 err = json.Unmarshal(*v, &eventGridConnectionProperties) 1397 if err != nil { 1398 return err 1399 } 1400 egdc.EventGridConnectionProperties = &eventGridConnectionProperties 1401 } 1402 case "location": 1403 if v != nil { 1404 var location string 1405 err = json.Unmarshal(*v, &location) 1406 if err != nil { 1407 return err 1408 } 1409 egdc.Location = &location 1410 } 1411 case "kind": 1412 if v != nil { 1413 var kind Kind 1414 err = json.Unmarshal(*v, &kind) 1415 if err != nil { 1416 return err 1417 } 1418 egdc.Kind = kind 1419 } 1420 case "id": 1421 if v != nil { 1422 var ID string 1423 err = json.Unmarshal(*v, &ID) 1424 if err != nil { 1425 return err 1426 } 1427 egdc.ID = &ID 1428 } 1429 case "name": 1430 if v != nil { 1431 var name string 1432 err = json.Unmarshal(*v, &name) 1433 if err != nil { 1434 return err 1435 } 1436 egdc.Name = &name 1437 } 1438 case "type": 1439 if v != nil { 1440 var typeVar string 1441 err = json.Unmarshal(*v, &typeVar) 1442 if err != nil { 1443 return err 1444 } 1445 egdc.Type = &typeVar 1446 } 1447 } 1448 } 1449 1450 return nil 1451} 1452 1453// EventHubConnectionProperties class representing the Kusto event hub connection properties. 1454type EventHubConnectionProperties struct { 1455 // EventHubResourceID - The resource ID of the event hub to be used to create a data connection. 1456 EventHubResourceID *string `json:"eventHubResourceId,omitempty"` 1457 // ConsumerGroup - The event hub consumer group. 1458 ConsumerGroup *string `json:"consumerGroup,omitempty"` 1459 // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. 1460 TableName *string `json:"tableName,omitempty"` 1461 // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. 1462 MappingRuleName *string `json:"mappingRuleName,omitempty"` 1463 // 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' 1464 DataFormat DataFormat `json:"dataFormat,omitempty"` 1465} 1466 1467// EventHubDataConnection class representing an event hub data connection. 1468type EventHubDataConnection struct { 1469 // EventHubConnectionProperties - The Event Hub data connection properties to validate. 1470 *EventHubConnectionProperties `json:"properties,omitempty"` 1471 // Location - Resource location. 1472 Location *string `json:"location,omitempty"` 1473 // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid' 1474 Kind Kind `json:"kind,omitempty"` 1475 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1476 ID *string `json:"id,omitempty"` 1477 // Name - READ-ONLY; The name of the resource 1478 Name *string `json:"name,omitempty"` 1479 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1480 Type *string `json:"type,omitempty"` 1481} 1482 1483// MarshalJSON is the custom marshaler for EventHubDataConnection. 1484func (ehdc EventHubDataConnection) MarshalJSON() ([]byte, error) { 1485 ehdc.Kind = KindEventHub 1486 objectMap := make(map[string]interface{}) 1487 if ehdc.EventHubConnectionProperties != nil { 1488 objectMap["properties"] = ehdc.EventHubConnectionProperties 1489 } 1490 if ehdc.Location != nil { 1491 objectMap["location"] = ehdc.Location 1492 } 1493 if ehdc.Kind != "" { 1494 objectMap["kind"] = ehdc.Kind 1495 } 1496 return json.Marshal(objectMap) 1497} 1498 1499// AsEventHubDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1500func (ehdc EventHubDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { 1501 return &ehdc, true 1502} 1503 1504// AsEventGridDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1505func (ehdc EventHubDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { 1506 return nil, false 1507} 1508 1509// AsDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1510func (ehdc EventHubDataConnection) AsDataConnection() (*DataConnection, bool) { 1511 return nil, false 1512} 1513 1514// AsBasicDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1515func (ehdc EventHubDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { 1516 return &ehdc, true 1517} 1518 1519// UnmarshalJSON is the custom unmarshaler for EventHubDataConnection struct. 1520func (ehdc *EventHubDataConnection) UnmarshalJSON(body []byte) error { 1521 var m map[string]*json.RawMessage 1522 err := json.Unmarshal(body, &m) 1523 if err != nil { 1524 return err 1525 } 1526 for k, v := range m { 1527 switch k { 1528 case "properties": 1529 if v != nil { 1530 var eventHubConnectionProperties EventHubConnectionProperties 1531 err = json.Unmarshal(*v, &eventHubConnectionProperties) 1532 if err != nil { 1533 return err 1534 } 1535 ehdc.EventHubConnectionProperties = &eventHubConnectionProperties 1536 } 1537 case "location": 1538 if v != nil { 1539 var location string 1540 err = json.Unmarshal(*v, &location) 1541 if err != nil { 1542 return err 1543 } 1544 ehdc.Location = &location 1545 } 1546 case "kind": 1547 if v != nil { 1548 var kind Kind 1549 err = json.Unmarshal(*v, &kind) 1550 if err != nil { 1551 return err 1552 } 1553 ehdc.Kind = kind 1554 } 1555 case "id": 1556 if v != nil { 1557 var ID string 1558 err = json.Unmarshal(*v, &ID) 1559 if err != nil { 1560 return err 1561 } 1562 ehdc.ID = &ID 1563 } 1564 case "name": 1565 if v != nil { 1566 var name string 1567 err = json.Unmarshal(*v, &name) 1568 if err != nil { 1569 return err 1570 } 1571 ehdc.Name = &name 1572 } 1573 case "type": 1574 if v != nil { 1575 var typeVar string 1576 err = json.Unmarshal(*v, &typeVar) 1577 if err != nil { 1578 return err 1579 } 1580 ehdc.Type = &typeVar 1581 } 1582 } 1583 } 1584 1585 return nil 1586} 1587 1588// ListResourceSkusResult list of available SKUs for an existing Kusto Cluster. 1589type ListResourceSkusResult struct { 1590 autorest.Response `json:"-"` 1591 // Value - The collection of available SKUs for an existing resource. 1592 Value *[]AzureResourceSku `json:"value,omitempty"` 1593} 1594 1595// ListSkusResult list of available SKUs for a new Kusto Cluster. 1596type ListSkusResult struct { 1597 autorest.Response `json:"-"` 1598 // Value - The collection of available SKUs for new resources. 1599 Value *[]AzureSku `json:"value,omitempty"` 1600} 1601 1602// Operation ... 1603type Operation struct { 1604 // Name - This is of the format {provider}/{resource}/{operation}. 1605 Name *string `json:"name,omitempty"` 1606 Display *OperationDisplay `json:"display,omitempty"` 1607 Origin *string `json:"origin,omitempty"` 1608 Properties interface{} `json:"properties,omitempty"` 1609} 1610 1611// OperationDisplay ... 1612type OperationDisplay struct { 1613 Provider *string `json:"provider,omitempty"` 1614 // Operation - For example: read, write, delete. 1615 Operation *string `json:"operation,omitempty"` 1616 Resource *string `json:"resource,omitempty"` 1617 Description *string `json:"description,omitempty"` 1618} 1619 1620// OperationListResult ... 1621type OperationListResult struct { 1622 autorest.Response `json:"-"` 1623 Value *[]Operation `json:"value,omitempty"` 1624 NextLink *string `json:"nextLink,omitempty"` 1625} 1626 1627// OperationListResultIterator provides access to a complete listing of Operation values. 1628type OperationListResultIterator struct { 1629 i int 1630 page OperationListResultPage 1631} 1632 1633// NextWithContext advances to the next value. If there was an error making 1634// the request the iterator does not advance and the error is returned. 1635func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1636 if tracing.IsEnabled() { 1637 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 1638 defer func() { 1639 sc := -1 1640 if iter.Response().Response.Response != nil { 1641 sc = iter.Response().Response.Response.StatusCode 1642 } 1643 tracing.EndSpan(ctx, sc, err) 1644 }() 1645 } 1646 iter.i++ 1647 if iter.i < len(iter.page.Values()) { 1648 return nil 1649 } 1650 err = iter.page.NextWithContext(ctx) 1651 if err != nil { 1652 iter.i-- 1653 return err 1654 } 1655 iter.i = 0 1656 return nil 1657} 1658 1659// Next advances to the next value. If there was an error making 1660// the request the iterator does not advance and the error is returned. 1661// Deprecated: Use NextWithContext() instead. 1662func (iter *OperationListResultIterator) Next() error { 1663 return iter.NextWithContext(context.Background()) 1664} 1665 1666// NotDone returns true if the enumeration should be started or is not yet complete. 1667func (iter OperationListResultIterator) NotDone() bool { 1668 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1669} 1670 1671// Response returns the raw server response from the last page request. 1672func (iter OperationListResultIterator) Response() OperationListResult { 1673 return iter.page.Response() 1674} 1675 1676// Value returns the current value or a zero-initialized value if the 1677// iterator has advanced beyond the end of the collection. 1678func (iter OperationListResultIterator) Value() Operation { 1679 if !iter.page.NotDone() { 1680 return Operation{} 1681 } 1682 return iter.page.Values()[iter.i] 1683} 1684 1685// Creates a new instance of the OperationListResultIterator type. 1686func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 1687 return OperationListResultIterator{page: page} 1688} 1689 1690// IsEmpty returns true if the ListResult contains no values. 1691func (olr OperationListResult) IsEmpty() bool { 1692 return olr.Value == nil || len(*olr.Value) == 0 1693} 1694 1695// operationListResultPreparer prepares a request to retrieve the next set of results. 1696// It returns nil if no more results exist. 1697func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 1698 if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { 1699 return nil, nil 1700 } 1701 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1702 autorest.AsJSON(), 1703 autorest.AsGet(), 1704 autorest.WithBaseURL(to.String(olr.NextLink))) 1705} 1706 1707// OperationListResultPage contains a page of Operation values. 1708type OperationListResultPage struct { 1709 fn func(context.Context, OperationListResult) (OperationListResult, error) 1710 olr OperationListResult 1711} 1712 1713// NextWithContext advances to the next page of values. If there was an error making 1714// the request the page does not advance and the error is returned. 1715func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 1716 if tracing.IsEnabled() { 1717 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 1718 defer func() { 1719 sc := -1 1720 if page.Response().Response.Response != nil { 1721 sc = page.Response().Response.Response.StatusCode 1722 } 1723 tracing.EndSpan(ctx, sc, err) 1724 }() 1725 } 1726 next, err := page.fn(ctx, page.olr) 1727 if err != nil { 1728 return err 1729 } 1730 page.olr = next 1731 return nil 1732} 1733 1734// Next advances to the next page of values. If there was an error making 1735// the request the page does not advance and the error is returned. 1736// Deprecated: Use NextWithContext() instead. 1737func (page *OperationListResultPage) Next() error { 1738 return page.NextWithContext(context.Background()) 1739} 1740 1741// NotDone returns true if the page enumeration should be started or is not yet complete. 1742func (page OperationListResultPage) NotDone() bool { 1743 return !page.olr.IsEmpty() 1744} 1745 1746// Response returns the raw server response from the last page request. 1747func (page OperationListResultPage) Response() OperationListResult { 1748 return page.olr 1749} 1750 1751// Values returns the slice of values for the current page or nil if there are no values. 1752func (page OperationListResultPage) Values() []Operation { 1753 if page.olr.IsEmpty() { 1754 return nil 1755 } 1756 return *page.olr.Value 1757} 1758 1759// Creates a new instance of the OperationListResultPage type. 1760func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 1761 return OperationListResultPage{fn: getNextPage} 1762} 1763 1764// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than 1765// required location and tags 1766type ProxyResource struct { 1767 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1768 ID *string `json:"id,omitempty"` 1769 // Name - READ-ONLY; The name of the resource 1770 Name *string `json:"name,omitempty"` 1771 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1772 Type *string `json:"type,omitempty"` 1773} 1774 1775// Resource ... 1776type Resource struct { 1777 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1778 ID *string `json:"id,omitempty"` 1779 // Name - READ-ONLY; The name of the resource 1780 Name *string `json:"name,omitempty"` 1781 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1782 Type *string `json:"type,omitempty"` 1783} 1784 1785// TrackedResource the resource model definition for a ARM tracked top level resource 1786type TrackedResource struct { 1787 // Tags - Resource tags. 1788 Tags map[string]*string `json:"tags"` 1789 // Location - The geo-location where the resource lives 1790 Location *string `json:"location,omitempty"` 1791 // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1792 ID *string `json:"id,omitempty"` 1793 // Name - READ-ONLY; The name of the resource 1794 Name *string `json:"name,omitempty"` 1795 // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. 1796 Type *string `json:"type,omitempty"` 1797} 1798 1799// MarshalJSON is the custom marshaler for TrackedResource. 1800func (tr TrackedResource) MarshalJSON() ([]byte, error) { 1801 objectMap := make(map[string]interface{}) 1802 if tr.Tags != nil { 1803 objectMap["tags"] = tr.Tags 1804 } 1805 if tr.Location != nil { 1806 objectMap["location"] = tr.Location 1807 } 1808 return json.Marshal(objectMap) 1809} 1810 1811// TrustedExternalTenant represents a tenant ID that is trusted by the cluster. 1812type TrustedExternalTenant struct { 1813 // Value - GUID representing an external tenant. 1814 Value *string `json:"value,omitempty"` 1815} 1816