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// AzureCapacity azure capacity definition. 34type AzureCapacity struct { 35 // ScaleType - Scale type. Possible values include: 'Automatic', 'Manual', 'None' 36 ScaleType AzureScaleType `json:"scaleType,omitempty"` 37 // Minimum - Minimum allowed instances count. 38 Minimum *int32 `json:"minimum,omitempty"` 39 // Maximum - Maximum allowed instances count. 40 Maximum *int32 `json:"maximum,omitempty"` 41 // Default - The default capacity that would be used. 42 Default *int32 `json:"default,omitempty"` 43} 44 45// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. 46type AzureEntityResource struct { 47 // Etag - READ-ONLY; Resource Etag. 48 Etag *string `json:"etag,omitempty"` 49 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 50 ID *string `json:"id,omitempty"` 51 // Name - READ-ONLY; The name of the resource 52 Name *string `json:"name,omitempty"` 53 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 54 Type *string `json:"type,omitempty"` 55} 56 57// AzureResourceSku azure resource SKU definition. 58type AzureResourceSku struct { 59 // ResourceType - Resource Namespace and Type. 60 ResourceType *string `json:"resourceType,omitempty"` 61 // Sku - The SKU details. 62 Sku *AzureSku `json:"sku,omitempty"` 63 // Capacity - The number of instances of the cluster. 64 Capacity *AzureCapacity `json:"capacity,omitempty"` 65} 66 67// AzureSku azure SKU definition. 68type AzureSku struct { 69 // Name - SKU name. Possible values include: 'StandardDS13V21TBPS', 'StandardDS13V22TBPS', 'StandardDS14V23TBPS', 'StandardDS14V24TBPS', 'StandardD13V2', 'StandardD14V2', 'StandardL8s', 'StandardL16s', 'StandardD11V2', 'StandardD12V2', 'StandardL4s', 'DevNoSLAStandardD11V2' 70 Name AzureSkuName `json:"name,omitempty"` 71 // Capacity - The number of instances of the cluster. 72 Capacity *int32 `json:"capacity,omitempty"` 73 // Tier - SKU tier. Possible values include: 'Basic', 'Standard' 74 Tier AzureSkuTier `json:"tier,omitempty"` 75} 76 77// CheckNameResult the result returned from a check name availability request. 78type CheckNameResult struct { 79 autorest.Response `json:"-"` 80 // NameAvailable - Specifies a Boolean value that indicates if the name is available. 81 NameAvailable *bool `json:"nameAvailable,omitempty"` 82 // Name - The name that was checked. 83 Name *string `json:"name,omitempty"` 84 // Message - Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. 85 Message *string `json:"message,omitempty"` 86 // Reason - Message providing the reason why the given name is invalid. Possible values include: 'Invalid', 'AlreadyExists' 87 Reason Reason `json:"reason,omitempty"` 88} 89 90// CloudError an error response from Kusto. 91type CloudError struct { 92 // Error - An error response from Kusto. 93 Error *CloudErrorBody `json:"error,omitempty"` 94} 95 96// CloudErrorBody an error response from Kusto. 97type CloudErrorBody struct { 98 // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. 99 Code *string `json:"code,omitempty"` 100 // Message - A message describing the error, intended to be suitable for displaying in a user interface. 101 Message *string `json:"message,omitempty"` 102 // Target - The target of the particular error. For example, the name of the property in error. 103 Target *string `json:"target,omitempty"` 104 // Details - A list of additional details about the error. 105 Details *[]CloudErrorBody `json:"details,omitempty"` 106} 107 108// Cluster class representing a Kusto cluster. 109type Cluster struct { 110 autorest.Response `json:"-"` 111 // Sku - The SKU of the cluster. 112 Sku *AzureSku `json:"sku,omitempty"` 113 // ClusterProperties - The cluster properties. 114 *ClusterProperties `json:"properties,omitempty"` 115 // Tags - Resource tags. 116 Tags map[string]*string `json:"tags"` 117 // Location - The geo-location where the resource lives 118 Location *string `json:"location,omitempty"` 119 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 120 ID *string `json:"id,omitempty"` 121 // Name - READ-ONLY; The name of the resource 122 Name *string `json:"name,omitempty"` 123 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 124 Type *string `json:"type,omitempty"` 125} 126 127// MarshalJSON is the custom marshaler for Cluster. 128func (c Cluster) MarshalJSON() ([]byte, error) { 129 objectMap := make(map[string]interface{}) 130 if c.Sku != nil { 131 objectMap["sku"] = c.Sku 132 } 133 if c.ClusterProperties != nil { 134 objectMap["properties"] = c.ClusterProperties 135 } 136 if c.Tags != nil { 137 objectMap["tags"] = c.Tags 138 } 139 if c.Location != nil { 140 objectMap["location"] = c.Location 141 } 142 return json.Marshal(objectMap) 143} 144 145// UnmarshalJSON is the custom unmarshaler for Cluster struct. 146func (c *Cluster) UnmarshalJSON(body []byte) error { 147 var m map[string]*json.RawMessage 148 err := json.Unmarshal(body, &m) 149 if err != nil { 150 return err 151 } 152 for k, v := range m { 153 switch k { 154 case "sku": 155 if v != nil { 156 var sku AzureSku 157 err = json.Unmarshal(*v, &sku) 158 if err != nil { 159 return err 160 } 161 c.Sku = &sku 162 } 163 case "properties": 164 if v != nil { 165 var clusterProperties ClusterProperties 166 err = json.Unmarshal(*v, &clusterProperties) 167 if err != nil { 168 return err 169 } 170 c.ClusterProperties = &clusterProperties 171 } 172 case "tags": 173 if v != nil { 174 var tags map[string]*string 175 err = json.Unmarshal(*v, &tags) 176 if err != nil { 177 return err 178 } 179 c.Tags = tags 180 } 181 case "location": 182 if v != nil { 183 var location string 184 err = json.Unmarshal(*v, &location) 185 if err != nil { 186 return err 187 } 188 c.Location = &location 189 } 190 case "id": 191 if v != nil { 192 var ID string 193 err = json.Unmarshal(*v, &ID) 194 if err != nil { 195 return err 196 } 197 c.ID = &ID 198 } 199 case "name": 200 if v != nil { 201 var name string 202 err = json.Unmarshal(*v, &name) 203 if err != nil { 204 return err 205 } 206 c.Name = &name 207 } 208 case "type": 209 if v != nil { 210 var typeVar string 211 err = json.Unmarshal(*v, &typeVar) 212 if err != nil { 213 return err 214 } 215 c.Type = &typeVar 216 } 217 } 218 } 219 220 return nil 221} 222 223// ClusterCheckNameRequest the result returned from a cluster check name availability request. 224type ClusterCheckNameRequest struct { 225 // Name - Cluster name. 226 Name *string `json:"name,omitempty"` 227 // Type - The type of resource, Microsoft.Kusto/clusters. 228 Type *string `json:"type,omitempty"` 229} 230 231// ClusterListResult the list Kusto clusters operation response. 232type ClusterListResult struct { 233 autorest.Response `json:"-"` 234 // Value - The list of Kusto clusters. 235 Value *[]Cluster `json:"value,omitempty"` 236} 237 238// ClusterProperties class representing the Kusto cluster properties. 239type ClusterProperties struct { 240 // State - READ-ONLY; The state of the resource. Possible values include: 'StateCreating', 'StateUnavailable', 'StateRunning', 'StateDeleting', 'StateDeleted', 'StateStopping', 'StateStopped', 'StateStarting', 'StateUpdating' 241 State State `json:"state,omitempty"` 242 // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed' 243 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 244 // URI - READ-ONLY; The cluster URI. 245 URI *string `json:"uri,omitempty"` 246 // DataIngestionURI - READ-ONLY; The cluster data ingestion URI. 247 DataIngestionURI *string `json:"dataIngestionUri,omitempty"` 248 // TrustedExternalTenants - The cluster's external tenants. 249 TrustedExternalTenants *[]TrustedExternalTenant `json:"trustedExternalTenants,omitempty"` 250} 251 252// MarshalJSON is the custom marshaler for ClusterProperties. 253func (cp ClusterProperties) MarshalJSON() ([]byte, error) { 254 objectMap := make(map[string]interface{}) 255 if cp.TrustedExternalTenants != nil { 256 objectMap["trustedExternalTenants"] = cp.TrustedExternalTenants 257 } 258 return json.Marshal(objectMap) 259} 260 261// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 262// operation. 263type ClustersCreateOrUpdateFuture struct { 264 azure.FutureAPI 265 // Result returns the result of the asynchronous operation. 266 // If the operation has not completed it will return an error. 267 Result func(ClustersClient) (Cluster, error) 268} 269 270// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 271// operation. 272type ClustersDeleteFuture struct { 273 azure.FutureAPI 274 // Result returns the result of the asynchronous operation. 275 // If the operation has not completed it will return an error. 276 Result func(ClustersClient) (autorest.Response, error) 277} 278 279// ClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running 280// operation. 281type ClustersStartFuture struct { 282 azure.FutureAPI 283 // Result returns the result of the asynchronous operation. 284 // If the operation has not completed it will return an error. 285 Result func(ClustersClient) (autorest.Response, error) 286} 287 288// ClustersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. 289type ClustersStopFuture struct { 290 azure.FutureAPI 291 // Result returns the result of the asynchronous operation. 292 // If the operation has not completed it will return an error. 293 Result func(ClustersClient) (autorest.Response, error) 294} 295 296// ClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 297// operation. 298type ClustersUpdateFuture struct { 299 azure.FutureAPI 300 // Result returns the result of the asynchronous operation. 301 // If the operation has not completed it will return an error. 302 Result func(ClustersClient) (Cluster, error) 303} 304 305// ClusterUpdate class representing an update to a Kusto cluster. 306type ClusterUpdate struct { 307 // Tags - Resource tags. 308 Tags map[string]*string `json:"tags"` 309 // Location - Resource location. 310 Location *string `json:"location,omitempty"` 311 // Sku - The SKU of the cluster. 312 Sku *AzureSku `json:"sku,omitempty"` 313 // ClusterProperties - The cluster properties. 314 *ClusterProperties `json:"properties,omitempty"` 315 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 316 ID *string `json:"id,omitempty"` 317 // Name - READ-ONLY; The name of the resource 318 Name *string `json:"name,omitempty"` 319 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 320 Type *string `json:"type,omitempty"` 321} 322 323// MarshalJSON is the custom marshaler for ClusterUpdate. 324func (cu ClusterUpdate) MarshalJSON() ([]byte, error) { 325 objectMap := make(map[string]interface{}) 326 if cu.Tags != nil { 327 objectMap["tags"] = cu.Tags 328 } 329 if cu.Location != nil { 330 objectMap["location"] = cu.Location 331 } 332 if cu.Sku != nil { 333 objectMap["sku"] = cu.Sku 334 } 335 if cu.ClusterProperties != nil { 336 objectMap["properties"] = cu.ClusterProperties 337 } 338 return json.Marshal(objectMap) 339} 340 341// UnmarshalJSON is the custom unmarshaler for ClusterUpdate struct. 342func (cu *ClusterUpdate) UnmarshalJSON(body []byte) error { 343 var m map[string]*json.RawMessage 344 err := json.Unmarshal(body, &m) 345 if err != nil { 346 return err 347 } 348 for k, v := range m { 349 switch k { 350 case "tags": 351 if v != nil { 352 var tags map[string]*string 353 err = json.Unmarshal(*v, &tags) 354 if err != nil { 355 return err 356 } 357 cu.Tags = tags 358 } 359 case "location": 360 if v != nil { 361 var location string 362 err = json.Unmarshal(*v, &location) 363 if err != nil { 364 return err 365 } 366 cu.Location = &location 367 } 368 case "sku": 369 if v != nil { 370 var sku AzureSku 371 err = json.Unmarshal(*v, &sku) 372 if err != nil { 373 return err 374 } 375 cu.Sku = &sku 376 } 377 case "properties": 378 if v != nil { 379 var clusterProperties ClusterProperties 380 err = json.Unmarshal(*v, &clusterProperties) 381 if err != nil { 382 return err 383 } 384 cu.ClusterProperties = &clusterProperties 385 } 386 case "id": 387 if v != nil { 388 var ID string 389 err = json.Unmarshal(*v, &ID) 390 if err != nil { 391 return err 392 } 393 cu.ID = &ID 394 } 395 case "name": 396 if v != nil { 397 var name string 398 err = json.Unmarshal(*v, &name) 399 if err != nil { 400 return err 401 } 402 cu.Name = &name 403 } 404 case "type": 405 if v != nil { 406 var typeVar string 407 err = json.Unmarshal(*v, &typeVar) 408 if err != nil { 409 return err 410 } 411 cu.Type = &typeVar 412 } 413 } 414 } 415 416 return nil 417} 418 419// Database class representing a Kusto database. 420type Database struct { 421 autorest.Response `json:"-"` 422 // Location - Resource location. 423 Location *string `json:"location,omitempty"` 424 // DatabaseProperties - The database properties. 425 *DatabaseProperties `json:"properties,omitempty"` 426 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 427 ID *string `json:"id,omitempty"` 428 // Name - READ-ONLY; The name of the resource 429 Name *string `json:"name,omitempty"` 430 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 431 Type *string `json:"type,omitempty"` 432} 433 434// MarshalJSON is the custom marshaler for Database. 435func (d Database) MarshalJSON() ([]byte, error) { 436 objectMap := make(map[string]interface{}) 437 if d.Location != nil { 438 objectMap["location"] = d.Location 439 } 440 if d.DatabaseProperties != nil { 441 objectMap["properties"] = d.DatabaseProperties 442 } 443 return json.Marshal(objectMap) 444} 445 446// UnmarshalJSON is the custom unmarshaler for Database struct. 447func (d *Database) UnmarshalJSON(body []byte) error { 448 var m map[string]*json.RawMessage 449 err := json.Unmarshal(body, &m) 450 if err != nil { 451 return err 452 } 453 for k, v := range m { 454 switch k { 455 case "location": 456 if v != nil { 457 var location string 458 err = json.Unmarshal(*v, &location) 459 if err != nil { 460 return err 461 } 462 d.Location = &location 463 } 464 case "properties": 465 if v != nil { 466 var databaseProperties DatabaseProperties 467 err = json.Unmarshal(*v, &databaseProperties) 468 if err != nil { 469 return err 470 } 471 d.DatabaseProperties = &databaseProperties 472 } 473 case "id": 474 if v != nil { 475 var ID string 476 err = json.Unmarshal(*v, &ID) 477 if err != nil { 478 return err 479 } 480 d.ID = &ID 481 } 482 case "name": 483 if v != nil { 484 var name string 485 err = json.Unmarshal(*v, &name) 486 if err != nil { 487 return err 488 } 489 d.Name = &name 490 } 491 case "type": 492 if v != nil { 493 var typeVar string 494 err = json.Unmarshal(*v, &typeVar) 495 if err != nil { 496 return err 497 } 498 d.Type = &typeVar 499 } 500 } 501 } 502 503 return nil 504} 505 506// DatabaseCheckNameRequest the result returned from a database check name availability request. 507type DatabaseCheckNameRequest struct { 508 // Name - Database name. 509 Name *string `json:"name,omitempty"` 510 // Type - The type of resource, Microsoft.Kusto/clusters/databases. 511 Type *string `json:"type,omitempty"` 512} 513 514// DatabaseListResult the list Kusto databases operation response. 515type DatabaseListResult struct { 516 autorest.Response `json:"-"` 517 // Value - The list of Kusto databases. 518 Value *[]Database `json:"value,omitempty"` 519} 520 521// DatabasePrincipal a class representing database principal entity. 522type DatabasePrincipal struct { 523 // Role - Database principal role. Possible values include: 'Admin', 'Ingestor', 'Monitor', 'User', 'UnrestrictedViewers', 'Viewer' 524 Role DatabasePrincipalRole `json:"role,omitempty"` 525 // Name - Database principal name. 526 Name *string `json:"name,omitempty"` 527 // Type - Database principal type. Possible values include: 'DatabasePrincipalTypeApp', 'DatabasePrincipalTypeGroup', 'DatabasePrincipalTypeUser' 528 Type DatabasePrincipalType `json:"type,omitempty"` 529 // Fqn - Database principal fully qualified name. 530 Fqn *string `json:"fqn,omitempty"` 531 // Email - Database principal email if exists. 532 Email *string `json:"email,omitempty"` 533 // AppID - Application id - relevant only for application principal type. 534 AppID *string `json:"appId,omitempty"` 535} 536 537// DatabasePrincipalListRequest the list Kusto database principals operation request. 538type DatabasePrincipalListRequest struct { 539 // Value - The list of Kusto database principals. 540 Value *[]DatabasePrincipal `json:"value,omitempty"` 541} 542 543// DatabasePrincipalListResult the list Kusto database principals operation response. 544type DatabasePrincipalListResult struct { 545 autorest.Response `json:"-"` 546 // Value - The list of Kusto database principals. 547 Value *[]DatabasePrincipal `json:"value,omitempty"` 548} 549 550// DatabaseProperties class representing the Kusto database properties. 551type DatabaseProperties struct { 552 // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed' 553 ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` 554 // SoftDeletePeriod - The time the data should be kept before it stops being accessible to queries in TimeSpan. 555 SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` 556 // HotCachePeriod - The time the data that should be kept in cache for fast queries in TimeSpan. 557 HotCachePeriod *string `json:"hotCachePeriod,omitempty"` 558 // Statistics - The statistics of the database. 559 Statistics *DatabaseStatistics `json:"statistics,omitempty"` 560} 561 562// MarshalJSON is the custom marshaler for DatabaseProperties. 563func (dp DatabaseProperties) MarshalJSON() ([]byte, error) { 564 objectMap := make(map[string]interface{}) 565 if dp.SoftDeletePeriod != nil { 566 objectMap["softDeletePeriod"] = dp.SoftDeletePeriod 567 } 568 if dp.HotCachePeriod != nil { 569 objectMap["hotCachePeriod"] = dp.HotCachePeriod 570 } 571 if dp.Statistics != nil { 572 objectMap["statistics"] = dp.Statistics 573 } 574 return json.Marshal(objectMap) 575} 576 577// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 578// operation. 579type DatabasesCreateOrUpdateFuture struct { 580 azure.FutureAPI 581 // Result returns the result of the asynchronous operation. 582 // If the operation has not completed it will return an error. 583 Result func(DatabasesClient) (Database, error) 584} 585 586// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 587// operation. 588type DatabasesDeleteFuture struct { 589 azure.FutureAPI 590 // Result returns the result of the asynchronous operation. 591 // If the operation has not completed it will return an error. 592 Result func(DatabasesClient) (autorest.Response, error) 593} 594 595// DatabaseStatistics a class that contains database statistics information. 596type DatabaseStatistics struct { 597 // Size - The database size - the total size of compressed data and index in bytes. 598 Size *float64 `json:"size,omitempty"` 599} 600 601// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 602// operation. 603type DatabasesUpdateFuture 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(DatabasesClient) (Database, error) 608} 609 610// DatabaseUpdate class representing an update to a Kusto database. 611type DatabaseUpdate struct { 612 // Location - Resource location. 613 Location *string `json:"location,omitempty"` 614 // DatabaseProperties - The properties of the updated database. 615 *DatabaseProperties `json:"properties,omitempty"` 616 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 617 ID *string `json:"id,omitempty"` 618 // Name - READ-ONLY; The name of the resource 619 Name *string `json:"name,omitempty"` 620 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 621 Type *string `json:"type,omitempty"` 622} 623 624// MarshalJSON is the custom marshaler for DatabaseUpdate. 625func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { 626 objectMap := make(map[string]interface{}) 627 if du.Location != nil { 628 objectMap["location"] = du.Location 629 } 630 if du.DatabaseProperties != nil { 631 objectMap["properties"] = du.DatabaseProperties 632 } 633 return json.Marshal(objectMap) 634} 635 636// UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct. 637func (du *DatabaseUpdate) 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 "location": 646 if v != nil { 647 var location string 648 err = json.Unmarshal(*v, &location) 649 if err != nil { 650 return err 651 } 652 du.Location = &location 653 } 654 case "properties": 655 if v != nil { 656 var databaseProperties DatabaseProperties 657 err = json.Unmarshal(*v, &databaseProperties) 658 if err != nil { 659 return err 660 } 661 du.DatabaseProperties = &databaseProperties 662 } 663 case "id": 664 if v != nil { 665 var ID string 666 err = json.Unmarshal(*v, &ID) 667 if err != nil { 668 return err 669 } 670 du.ID = &ID 671 } 672 case "name": 673 if v != nil { 674 var name string 675 err = json.Unmarshal(*v, &name) 676 if err != nil { 677 return err 678 } 679 du.Name = &name 680 } 681 case "type": 682 if v != nil { 683 var typeVar string 684 err = json.Unmarshal(*v, &typeVar) 685 if err != nil { 686 return err 687 } 688 du.Type = &typeVar 689 } 690 } 691 } 692 693 return nil 694} 695 696// BasicDataConnection class representing an data connection. 697type BasicDataConnection interface { 698 AsEventHubDataConnection() (*EventHubDataConnection, bool) 699 AsEventGridDataConnection() (*EventGridDataConnection, bool) 700 AsDataConnection() (*DataConnection, bool) 701} 702 703// DataConnection class representing an data connection. 704type DataConnection struct { 705 autorest.Response `json:"-"` 706 // Location - Resource location. 707 Location *string `json:"location,omitempty"` 708 // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid' 709 Kind Kind `json:"kind,omitempty"` 710 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 711 ID *string `json:"id,omitempty"` 712 // Name - READ-ONLY; The name of the resource 713 Name *string `json:"name,omitempty"` 714 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 715 Type *string `json:"type,omitempty"` 716} 717 718func unmarshalBasicDataConnection(body []byte) (BasicDataConnection, error) { 719 var m map[string]interface{} 720 err := json.Unmarshal(body, &m) 721 if err != nil { 722 return nil, err 723 } 724 725 switch m["kind"] { 726 case string(KindEventHub): 727 var ehdc EventHubDataConnection 728 err := json.Unmarshal(body, &ehdc) 729 return ehdc, err 730 case string(KindEventGrid): 731 var egdc EventGridDataConnection 732 err := json.Unmarshal(body, &egdc) 733 return egdc, err 734 default: 735 var dc DataConnection 736 err := json.Unmarshal(body, &dc) 737 return dc, err 738 } 739} 740func unmarshalBasicDataConnectionArray(body []byte) ([]BasicDataConnection, error) { 741 var rawMessages []*json.RawMessage 742 err := json.Unmarshal(body, &rawMessages) 743 if err != nil { 744 return nil, err 745 } 746 747 dcArray := make([]BasicDataConnection, len(rawMessages)) 748 749 for index, rawMessage := range rawMessages { 750 dc, err := unmarshalBasicDataConnection(*rawMessage) 751 if err != nil { 752 return nil, err 753 } 754 dcArray[index] = dc 755 } 756 return dcArray, nil 757} 758 759// MarshalJSON is the custom marshaler for DataConnection. 760func (dc DataConnection) MarshalJSON() ([]byte, error) { 761 dc.Kind = KindDataConnection 762 objectMap := make(map[string]interface{}) 763 if dc.Location != nil { 764 objectMap["location"] = dc.Location 765 } 766 if dc.Kind != "" { 767 objectMap["kind"] = dc.Kind 768 } 769 return json.Marshal(objectMap) 770} 771 772// AsEventHubDataConnection is the BasicDataConnection implementation for DataConnection. 773func (dc DataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { 774 return nil, false 775} 776 777// AsEventGridDataConnection is the BasicDataConnection implementation for DataConnection. 778func (dc DataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { 779 return nil, false 780} 781 782// AsDataConnection is the BasicDataConnection implementation for DataConnection. 783func (dc DataConnection) AsDataConnection() (*DataConnection, bool) { 784 return &dc, true 785} 786 787// AsBasicDataConnection is the BasicDataConnection implementation for DataConnection. 788func (dc DataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { 789 return &dc, true 790} 791 792// DataConnectionCheckNameRequest the result returned from a data connections check name availability 793// request. 794type DataConnectionCheckNameRequest struct { 795 // Name - Data Connection name. 796 Name *string `json:"name,omitempty"` 797 // Type - The type of resource, Microsoft.Kusto/clusters/databases/dataConnections. 798 Type *string `json:"type,omitempty"` 799} 800 801// DataConnectionListResult the list Kusto data connections operation response. 802type DataConnectionListResult struct { 803 autorest.Response `json:"-"` 804 // Value - The list of Kusto data connections. 805 Value *[]BasicDataConnection `json:"value,omitempty"` 806} 807 808// UnmarshalJSON is the custom unmarshaler for DataConnectionListResult struct. 809func (dclr *DataConnectionListResult) UnmarshalJSON(body []byte) error { 810 var m map[string]*json.RawMessage 811 err := json.Unmarshal(body, &m) 812 if err != nil { 813 return err 814 } 815 for k, v := range m { 816 switch k { 817 case "value": 818 if v != nil { 819 value, err := unmarshalBasicDataConnectionArray(*v) 820 if err != nil { 821 return err 822 } 823 dclr.Value = &value 824 } 825 } 826 } 827 828 return nil 829} 830 831// DataConnectionModel ... 832type DataConnectionModel struct { 833 autorest.Response `json:"-"` 834 Value BasicDataConnection `json:"value,omitempty"` 835} 836 837// UnmarshalJSON is the custom unmarshaler for DataConnectionModel struct. 838func (dcm *DataConnectionModel) UnmarshalJSON(body []byte) error { 839 dc, err := unmarshalBasicDataConnection(body) 840 if err != nil { 841 return err 842 } 843 dcm.Value = dc 844 845 return nil 846} 847 848// DataConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a 849// long-running operation. 850type DataConnectionsCreateOrUpdateFuture struct { 851 azure.FutureAPI 852 // Result returns the result of the asynchronous operation. 853 // If the operation has not completed it will return an error. 854 Result func(DataConnectionsClient) (DataConnectionModel, error) 855} 856 857// DataConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running 858// operation. 859type DataConnectionsDeleteFuture struct { 860 azure.FutureAPI 861 // Result returns the result of the asynchronous operation. 862 // If the operation has not completed it will return an error. 863 Result func(DataConnectionsClient) (autorest.Response, error) 864} 865 866// DataConnectionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running 867// operation. 868type DataConnectionsUpdateFuture struct { 869 azure.FutureAPI 870 // Result returns the result of the asynchronous operation. 871 // If the operation has not completed it will return an error. 872 Result func(DataConnectionsClient) (DataConnectionModel, error) 873} 874 875// DataConnectionValidation class representing an data connection validation. 876type DataConnectionValidation struct { 877 // DataConnectionName - The name of the data connection. 878 DataConnectionName *string `json:"dataConnectionName,omitempty"` 879 // Properties - The data connection properties to validate. 880 Properties BasicDataConnection `json:"properties,omitempty"` 881} 882 883// UnmarshalJSON is the custom unmarshaler for DataConnectionValidation struct. 884func (dcv *DataConnectionValidation) UnmarshalJSON(body []byte) error { 885 var m map[string]*json.RawMessage 886 err := json.Unmarshal(body, &m) 887 if err != nil { 888 return err 889 } 890 for k, v := range m { 891 switch k { 892 case "dataConnectionName": 893 if v != nil { 894 var dataConnectionName string 895 err = json.Unmarshal(*v, &dataConnectionName) 896 if err != nil { 897 return err 898 } 899 dcv.DataConnectionName = &dataConnectionName 900 } 901 case "properties": 902 if v != nil { 903 properties, err := unmarshalBasicDataConnection(*v) 904 if err != nil { 905 return err 906 } 907 dcv.Properties = properties 908 } 909 } 910 } 911 912 return nil 913} 914 915// DataConnectionValidationListResult the list Kusto data connection validation result. 916type DataConnectionValidationListResult struct { 917 autorest.Response `json:"-"` 918 // Value - The list of Kusto data connection validation errors. 919 Value *[]DataConnectionValidationResult `json:"value,omitempty"` 920} 921 922// DataConnectionValidationResult the result returned from a data connection validation request. 923type DataConnectionValidationResult struct { 924 // ErrorMessage - A message which indicates a problem in data connection validation. 925 ErrorMessage *string `json:"errorMessage,omitempty"` 926} 927 928// EventGridConnectionProperties class representing the Kusto event grid connection properties. 929type EventGridConnectionProperties struct { 930 // StorageAccountResourceID - The resource ID of the storage account where the data resides. 931 StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` 932 // EventHubResourceID - The resource ID where the event grid is configured to send events. 933 EventHubResourceID *string `json:"eventHubResourceId,omitempty"` 934 // ConsumerGroup - The event hub consumer group. 935 ConsumerGroup *string `json:"consumerGroup,omitempty"` 936 // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. 937 TableName *string `json:"tableName,omitempty"` 938 // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. 939 MappingRuleName *string `json:"mappingRuleName,omitempty"` 940 // 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' 941 DataFormat DataFormat `json:"dataFormat,omitempty"` 942} 943 944// EventGridDataConnection class representing an Event Grid data connection. 945type EventGridDataConnection struct { 946 // EventGridConnectionProperties - The properties of the Event Grid data connection. 947 *EventGridConnectionProperties `json:"properties,omitempty"` 948 // Location - Resource location. 949 Location *string `json:"location,omitempty"` 950 // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid' 951 Kind Kind `json:"kind,omitempty"` 952 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 953 ID *string `json:"id,omitempty"` 954 // Name - READ-ONLY; The name of the resource 955 Name *string `json:"name,omitempty"` 956 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 957 Type *string `json:"type,omitempty"` 958} 959 960// MarshalJSON is the custom marshaler for EventGridDataConnection. 961func (egdc EventGridDataConnection) MarshalJSON() ([]byte, error) { 962 egdc.Kind = KindEventGrid 963 objectMap := make(map[string]interface{}) 964 if egdc.EventGridConnectionProperties != nil { 965 objectMap["properties"] = egdc.EventGridConnectionProperties 966 } 967 if egdc.Location != nil { 968 objectMap["location"] = egdc.Location 969 } 970 if egdc.Kind != "" { 971 objectMap["kind"] = egdc.Kind 972 } 973 return json.Marshal(objectMap) 974} 975 976// AsEventHubDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 977func (egdc EventGridDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { 978 return nil, false 979} 980 981// AsEventGridDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 982func (egdc EventGridDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { 983 return &egdc, true 984} 985 986// AsDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 987func (egdc EventGridDataConnection) AsDataConnection() (*DataConnection, bool) { 988 return nil, false 989} 990 991// AsBasicDataConnection is the BasicDataConnection implementation for EventGridDataConnection. 992func (egdc EventGridDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { 993 return &egdc, true 994} 995 996// UnmarshalJSON is the custom unmarshaler for EventGridDataConnection struct. 997func (egdc *EventGridDataConnection) UnmarshalJSON(body []byte) error { 998 var m map[string]*json.RawMessage 999 err := json.Unmarshal(body, &m) 1000 if err != nil { 1001 return err 1002 } 1003 for k, v := range m { 1004 switch k { 1005 case "properties": 1006 if v != nil { 1007 var eventGridConnectionProperties EventGridConnectionProperties 1008 err = json.Unmarshal(*v, &eventGridConnectionProperties) 1009 if err != nil { 1010 return err 1011 } 1012 egdc.EventGridConnectionProperties = &eventGridConnectionProperties 1013 } 1014 case "location": 1015 if v != nil { 1016 var location string 1017 err = json.Unmarshal(*v, &location) 1018 if err != nil { 1019 return err 1020 } 1021 egdc.Location = &location 1022 } 1023 case "kind": 1024 if v != nil { 1025 var kind Kind 1026 err = json.Unmarshal(*v, &kind) 1027 if err != nil { 1028 return err 1029 } 1030 egdc.Kind = kind 1031 } 1032 case "id": 1033 if v != nil { 1034 var ID string 1035 err = json.Unmarshal(*v, &ID) 1036 if err != nil { 1037 return err 1038 } 1039 egdc.ID = &ID 1040 } 1041 case "name": 1042 if v != nil { 1043 var name string 1044 err = json.Unmarshal(*v, &name) 1045 if err != nil { 1046 return err 1047 } 1048 egdc.Name = &name 1049 } 1050 case "type": 1051 if v != nil { 1052 var typeVar string 1053 err = json.Unmarshal(*v, &typeVar) 1054 if err != nil { 1055 return err 1056 } 1057 egdc.Type = &typeVar 1058 } 1059 } 1060 } 1061 1062 return nil 1063} 1064 1065// EventHubConnectionProperties class representing the Kusto event hub connection properties. 1066type EventHubConnectionProperties struct { 1067 // EventHubResourceID - The resource ID of the event hub to be used to create a data connection. 1068 EventHubResourceID *string `json:"eventHubResourceId,omitempty"` 1069 // ConsumerGroup - The event hub consumer group. 1070 ConsumerGroup *string `json:"consumerGroup,omitempty"` 1071 // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. 1072 TableName *string `json:"tableName,omitempty"` 1073 // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. 1074 MappingRuleName *string `json:"mappingRuleName,omitempty"` 1075 // 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' 1076 DataFormat DataFormat `json:"dataFormat,omitempty"` 1077} 1078 1079// EventHubDataConnection class representing an event hub data connection. 1080type EventHubDataConnection struct { 1081 // EventHubConnectionProperties - The Event Hub data connection properties to validate. 1082 *EventHubConnectionProperties `json:"properties,omitempty"` 1083 // Location - Resource location. 1084 Location *string `json:"location,omitempty"` 1085 // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid' 1086 Kind Kind `json:"kind,omitempty"` 1087 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1088 ID *string `json:"id,omitempty"` 1089 // Name - READ-ONLY; The name of the resource 1090 Name *string `json:"name,omitempty"` 1091 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1092 Type *string `json:"type,omitempty"` 1093} 1094 1095// MarshalJSON is the custom marshaler for EventHubDataConnection. 1096func (ehdc EventHubDataConnection) MarshalJSON() ([]byte, error) { 1097 ehdc.Kind = KindEventHub 1098 objectMap := make(map[string]interface{}) 1099 if ehdc.EventHubConnectionProperties != nil { 1100 objectMap["properties"] = ehdc.EventHubConnectionProperties 1101 } 1102 if ehdc.Location != nil { 1103 objectMap["location"] = ehdc.Location 1104 } 1105 if ehdc.Kind != "" { 1106 objectMap["kind"] = ehdc.Kind 1107 } 1108 return json.Marshal(objectMap) 1109} 1110 1111// AsEventHubDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1112func (ehdc EventHubDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { 1113 return &ehdc, true 1114} 1115 1116// AsEventGridDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1117func (ehdc EventHubDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { 1118 return nil, false 1119} 1120 1121// AsDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1122func (ehdc EventHubDataConnection) AsDataConnection() (*DataConnection, bool) { 1123 return nil, false 1124} 1125 1126// AsBasicDataConnection is the BasicDataConnection implementation for EventHubDataConnection. 1127func (ehdc EventHubDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { 1128 return &ehdc, true 1129} 1130 1131// UnmarshalJSON is the custom unmarshaler for EventHubDataConnection struct. 1132func (ehdc *EventHubDataConnection) UnmarshalJSON(body []byte) error { 1133 var m map[string]*json.RawMessage 1134 err := json.Unmarshal(body, &m) 1135 if err != nil { 1136 return err 1137 } 1138 for k, v := range m { 1139 switch k { 1140 case "properties": 1141 if v != nil { 1142 var eventHubConnectionProperties EventHubConnectionProperties 1143 err = json.Unmarshal(*v, &eventHubConnectionProperties) 1144 if err != nil { 1145 return err 1146 } 1147 ehdc.EventHubConnectionProperties = &eventHubConnectionProperties 1148 } 1149 case "location": 1150 if v != nil { 1151 var location string 1152 err = json.Unmarshal(*v, &location) 1153 if err != nil { 1154 return err 1155 } 1156 ehdc.Location = &location 1157 } 1158 case "kind": 1159 if v != nil { 1160 var kind Kind 1161 err = json.Unmarshal(*v, &kind) 1162 if err != nil { 1163 return err 1164 } 1165 ehdc.Kind = kind 1166 } 1167 case "id": 1168 if v != nil { 1169 var ID string 1170 err = json.Unmarshal(*v, &ID) 1171 if err != nil { 1172 return err 1173 } 1174 ehdc.ID = &ID 1175 } 1176 case "name": 1177 if v != nil { 1178 var name string 1179 err = json.Unmarshal(*v, &name) 1180 if err != nil { 1181 return err 1182 } 1183 ehdc.Name = &name 1184 } 1185 case "type": 1186 if v != nil { 1187 var typeVar string 1188 err = json.Unmarshal(*v, &typeVar) 1189 if err != nil { 1190 return err 1191 } 1192 ehdc.Type = &typeVar 1193 } 1194 } 1195 } 1196 1197 return nil 1198} 1199 1200// ListResourceSkusResult list of available SKUs for an existing Kusto Cluster. 1201type ListResourceSkusResult struct { 1202 autorest.Response `json:"-"` 1203 // Value - The collection of available SKUs for an existing resource. 1204 Value *[]AzureResourceSku `json:"value,omitempty"` 1205} 1206 1207// ListSkusResult list of available SKUs for a new Kusto Cluster. 1208type ListSkusResult struct { 1209 autorest.Response `json:"-"` 1210 // Value - The collection of available SKUs for new resources. 1211 Value *[]AzureSku `json:"value,omitempty"` 1212} 1213 1214// Operation ... 1215type Operation struct { 1216 // Name - This is of the format {provider}/{resource}/{operation}. 1217 Name *string `json:"name,omitempty"` 1218 Display *OperationDisplay `json:"display,omitempty"` 1219 Origin *string `json:"origin,omitempty"` 1220 Properties interface{} `json:"properties,omitempty"` 1221} 1222 1223// OperationDisplay ... 1224type OperationDisplay struct { 1225 Provider *string `json:"provider,omitempty"` 1226 // Operation - For example: read, write, delete. 1227 Operation *string `json:"operation,omitempty"` 1228 Resource *string `json:"resource,omitempty"` 1229 Description *string `json:"description,omitempty"` 1230} 1231 1232// OperationListResult ... 1233type OperationListResult struct { 1234 autorest.Response `json:"-"` 1235 Value *[]Operation `json:"value,omitempty"` 1236 NextLink *string `json:"nextLink,omitempty"` 1237} 1238 1239// OperationListResultIterator provides access to a complete listing of Operation values. 1240type OperationListResultIterator struct { 1241 i int 1242 page OperationListResultPage 1243} 1244 1245// NextWithContext advances to the next value. If there was an error making 1246// the request the iterator does not advance and the error is returned. 1247func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { 1248 if tracing.IsEnabled() { 1249 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") 1250 defer func() { 1251 sc := -1 1252 if iter.Response().Response.Response != nil { 1253 sc = iter.Response().Response.Response.StatusCode 1254 } 1255 tracing.EndSpan(ctx, sc, err) 1256 }() 1257 } 1258 iter.i++ 1259 if iter.i < len(iter.page.Values()) { 1260 return nil 1261 } 1262 err = iter.page.NextWithContext(ctx) 1263 if err != nil { 1264 iter.i-- 1265 return err 1266 } 1267 iter.i = 0 1268 return nil 1269} 1270 1271// Next advances to the next value. If there was an error making 1272// the request the iterator does not advance and the error is returned. 1273// Deprecated: Use NextWithContext() instead. 1274func (iter *OperationListResultIterator) Next() error { 1275 return iter.NextWithContext(context.Background()) 1276} 1277 1278// NotDone returns true if the enumeration should be started or is not yet complete. 1279func (iter OperationListResultIterator) NotDone() bool { 1280 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1281} 1282 1283// Response returns the raw server response from the last page request. 1284func (iter OperationListResultIterator) Response() OperationListResult { 1285 return iter.page.Response() 1286} 1287 1288// Value returns the current value or a zero-initialized value if the 1289// iterator has advanced beyond the end of the collection. 1290func (iter OperationListResultIterator) Value() Operation { 1291 if !iter.page.NotDone() { 1292 return Operation{} 1293 } 1294 return iter.page.Values()[iter.i] 1295} 1296 1297// Creates a new instance of the OperationListResultIterator type. 1298func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { 1299 return OperationListResultIterator{page: page} 1300} 1301 1302// IsEmpty returns true if the ListResult contains no values. 1303func (olr OperationListResult) IsEmpty() bool { 1304 return olr.Value == nil || len(*olr.Value) == 0 1305} 1306 1307// hasNextLink returns true if the NextLink is not empty. 1308func (olr OperationListResult) hasNextLink() bool { 1309 return olr.NextLink != nil && len(*olr.NextLink) != 0 1310} 1311 1312// operationListResultPreparer prepares a request to retrieve the next set of results. 1313// It returns nil if no more results exist. 1314func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { 1315 if !olr.hasNextLink() { 1316 return nil, nil 1317 } 1318 return autorest.Prepare((&http.Request{}).WithContext(ctx), 1319 autorest.AsJSON(), 1320 autorest.AsGet(), 1321 autorest.WithBaseURL(to.String(olr.NextLink))) 1322} 1323 1324// OperationListResultPage contains a page of Operation values. 1325type OperationListResultPage struct { 1326 fn func(context.Context, OperationListResult) (OperationListResult, error) 1327 olr OperationListResult 1328} 1329 1330// NextWithContext advances to the next page of values. If there was an error making 1331// the request the page does not advance and the error is returned. 1332func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { 1333 if tracing.IsEnabled() { 1334 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") 1335 defer func() { 1336 sc := -1 1337 if page.Response().Response.Response != nil { 1338 sc = page.Response().Response.Response.StatusCode 1339 } 1340 tracing.EndSpan(ctx, sc, err) 1341 }() 1342 } 1343 for { 1344 next, err := page.fn(ctx, page.olr) 1345 if err != nil { 1346 return err 1347 } 1348 page.olr = next 1349 if !next.hasNextLink() || !next.IsEmpty() { 1350 break 1351 } 1352 } 1353 return nil 1354} 1355 1356// Next advances to the next page of values. If there was an error making 1357// the request the page does not advance and the error is returned. 1358// Deprecated: Use NextWithContext() instead. 1359func (page *OperationListResultPage) Next() error { 1360 return page.NextWithContext(context.Background()) 1361} 1362 1363// NotDone returns true if the page enumeration should be started or is not yet complete. 1364func (page OperationListResultPage) NotDone() bool { 1365 return !page.olr.IsEmpty() 1366} 1367 1368// Response returns the raw server response from the last page request. 1369func (page OperationListResultPage) Response() OperationListResult { 1370 return page.olr 1371} 1372 1373// Values returns the slice of values for the current page or nil if there are no values. 1374func (page OperationListResultPage) Values() []Operation { 1375 if page.olr.IsEmpty() { 1376 return nil 1377 } 1378 return *page.olr.Value 1379} 1380 1381// Creates a new instance of the OperationListResultPage type. 1382func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { 1383 return OperationListResultPage{ 1384 fn: getNextPage, 1385 olr: cur, 1386 } 1387} 1388 1389// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not 1390// have tags and a location 1391type ProxyResource struct { 1392 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1393 ID *string `json:"id,omitempty"` 1394 // Name - READ-ONLY; The name of the resource 1395 Name *string `json:"name,omitempty"` 1396 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1397 Type *string `json:"type,omitempty"` 1398} 1399 1400// Resource common fields that are returned in the response for all Azure Resource Manager resources 1401type Resource struct { 1402 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1403 ID *string `json:"id,omitempty"` 1404 // Name - READ-ONLY; The name of the resource 1405 Name *string `json:"name,omitempty"` 1406 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1407 Type *string `json:"type,omitempty"` 1408} 1409 1410// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource 1411// which has 'tags' and a 'location' 1412type TrackedResource struct { 1413 // Tags - Resource tags. 1414 Tags map[string]*string `json:"tags"` 1415 // Location - The geo-location where the resource lives 1416 Location *string `json:"location,omitempty"` 1417 // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} 1418 ID *string `json:"id,omitempty"` 1419 // Name - READ-ONLY; The name of the resource 1420 Name *string `json:"name,omitempty"` 1421 // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" 1422 Type *string `json:"type,omitempty"` 1423} 1424 1425// MarshalJSON is the custom marshaler for TrackedResource. 1426func (tr TrackedResource) MarshalJSON() ([]byte, error) { 1427 objectMap := make(map[string]interface{}) 1428 if tr.Tags != nil { 1429 objectMap["tags"] = tr.Tags 1430 } 1431 if tr.Location != nil { 1432 objectMap["location"] = tr.Location 1433 } 1434 return json.Marshal(objectMap) 1435} 1436 1437// TrustedExternalTenant represents a tenant ID that is trusted by the cluster. 1438type TrustedExternalTenant struct { 1439 // Value - GUID representing an external tenant. 1440 Value *string `json:"value,omitempty"` 1441} 1442