diff --git a/azurerm/internal/services/kusto/client/client.go b/azurerm/internal/services/kusto/client/client.go index 7b88d4787e47d..7d48fb8ba1a26 100644 --- a/azurerm/internal/services/kusto/client/client.go +++ b/azurerm/internal/services/kusto/client/client.go @@ -1,7 +1,7 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common" ) diff --git a/azurerm/internal/services/kusto/kusto_cluster_resource.go b/azurerm/internal/services/kusto/kusto_cluster_resource.go index 956f7f28bfd2b..4fe236344b78e 100644 --- a/azurerm/internal/services/kusto/kusto_cluster_resource.go +++ b/azurerm/internal/services/kusto/kusto_cluster_resource.go @@ -7,13 +7,14 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/kusto/parse" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" @@ -181,26 +182,23 @@ func resourceArmKustoClusterRead(d *schema.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := azure.ParseAzureResourceID(d.Id()) + id, err := parse.KustoClusterID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - name := id.Path["Clusters"] - - clusterResponse, err := client.Get(ctx, resourceGroup, name) + clusterResponse, err := client.Get(ctx, id.ResourceGroup, id.Name) if err != nil { if utils.ResponseWasNotFound(clusterResponse.Response) { d.SetId("") return nil } - return fmt.Errorf("Error retrieving Kusto Cluster %q (Resource Group %q): %+v", name, resourceGroup, err) + return fmt.Errorf("Error retrieving Kusto Cluster %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) } - d.Set("name", name) - d.Set("resource_group_name", resourceGroup) + d.Set("name", id.Name) + d.Set("resource_group_name", id.ResourceGroup) if location := clusterResponse.Location; location != nil { d.Set("location", azure.NormalizeLocation(*location)) @@ -225,21 +223,18 @@ func resourceArmKustoClusterDelete(d *schema.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := azure.ParseAzureResourceID(d.Id()) + id, err := parse.KustoClusterID(d.Id()) if err != nil { return err } - resGroup := id.ResourceGroup - name := id.Path["Clusters"] - - future, err := client.Delete(ctx, resGroup, name) + future, err := client.Delete(ctx, id.ResourceGroup, id.Name) if err != nil { - return fmt.Errorf("Error deleting Kusto Cluster %q (Resource Group %q): %+v", name, resGroup, err) + return fmt.Errorf("Error deleting Kusto Cluster %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) } if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("Error waiting for deletion of Kusto Cluster %q (Resource Group %q): %+v", name, resGroup, err) + return fmt.Errorf("Error waiting for deletion of Kusto Cluster %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) } return nil diff --git a/azurerm/internal/services/kusto/kusto_database_principal_resource.go b/azurerm/internal/services/kusto/kusto_database_principal_resource.go index a92a84a2eb7ef..2673648256aeb 100644 --- a/azurerm/internal/services/kusto/kusto_database_principal_resource.go +++ b/azurerm/internal/services/kusto/kusto_database_principal_resource.go @@ -6,13 +6,14 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/kusto/parse" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -141,15 +142,21 @@ func resourceArmKustoDatabasePrincipalCreate(d *schema.ResourceData, meta interf fqn = fmt.Sprintf("aadapp=%s;%s", objectID, clientID) } - database, err := client.Get(ctx, resourceGroup, clusterName, databaseName) + databaseModel, err := client.Get(ctx, resourceGroup, clusterName, databaseName) if err != nil { - if utils.ResponseWasNotFound(database.Response) { + if utils.ResponseWasNotFound(databaseModel.Response) { return fmt.Errorf("Kusto Database %q (Resource Group %q) was not found", databaseName, resourceGroup) } return fmt.Errorf("Error loading Kusto Database %q (Resource Group %q): %+v", databaseName, resourceGroup, err) } - resourceId := fmt.Sprintf("%s/Role/%s/FQN/%s", *database.ID, role, fqn) + + if databaseModel.Value == nil { + return fmt.Errorf("Kusto Database %q was not found ", databaseName) + } + + database, _ := databaseModel.Value.AsDatabase() + resourceID := fmt.Sprintf("%s/Role/%s/FQN/%s", *database.ID, role, fqn) if features.ShouldResourcesBeImported() && d.IsNewResource() { resp, err := client.ListPrincipals(ctx, resourceGroup, clusterName, databaseName) @@ -163,7 +170,7 @@ func resourceArmKustoDatabasePrincipalCreate(d *schema.ResourceData, meta interf for _, principal := range *principals { // kusto database principals are unique when looked at with name and role if string(principal.Role) == role && principal.Fqn != nil && *principal.Fqn == fqn { - return tf.ImportAsExistsError("azurerm_kusto_database_principal", resourceId) + return tf.ImportAsExistsError("azurerm_kusto_database_principal", resourceID) } } } @@ -189,14 +196,14 @@ func resourceArmKustoDatabasePrincipalCreate(d *schema.ResourceData, meta interf return fmt.Errorf("Error creating Kusto Database Principal (Resource Group %q, Cluster %q): %+v", resourceGroup, clusterName, err) } - resp, err := client.ListPrincipals(ctx, resourceGroup, clusterName, databaseName) + principalsResp, err := client.ListPrincipals(ctx, resourceGroup, clusterName, databaseName) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !utils.ResponseWasNotFound(principalsResp.Response) { return fmt.Errorf("Error checking for presence of existing Kusto Database Principals (Resource Group %q, Cluster %q): %s", resourceGroup, clusterName, err) } } - d.SetId(resourceId) + d.SetId(resourceID) return resourceArmKustoDatabasePrincipalRead(d, meta) } @@ -206,39 +213,33 @@ func resourceArmKustoDatabasePrincipalRead(d *schema.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := azure.ParseAzureResourceID(d.Id()) + id, err := parse.KustoDatabasePrincipalID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - clusterName := id.Path["Clusters"] - databaseName := id.Path["Databases"] - role := id.Path["Role"] - fqn := id.Path["FQN"] - - databaseResponse, err := client.Get(ctx, resourceGroup, clusterName, databaseName) + databaseModel, err := client.Get(ctx, id.ResourceGroup, id.Cluster, id.Database) if err != nil { - if utils.ResponseWasNotFound(databaseResponse.Response) { + if utils.ResponseWasNotFound(databaseModel.Response) { d.SetId("") return nil } - return fmt.Errorf("Error retrieving Kusto Database %q (Resource Group %q, Cluster %q): %+v", databaseName, resourceGroup, clusterName, err) + return fmt.Errorf("Error retrieving Kusto Database %q (Resource Group %q, Cluster %q): %+v", id.Database, id.ResourceGroup, id.Cluster, err) } - resp, err := client.ListPrincipals(ctx, resourceGroup, clusterName, databaseName) + databasePrincipals, err := client.ListPrincipals(ctx, id.ResourceGroup, id.Cluster, id.Database) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { - return fmt.Errorf("Error checking for presence of existing Kusto Database Principals %q (Resource Group %q, Cluster %q): %s", id, resourceGroup, clusterName, err) + if !utils.ResponseWasNotFound(databasePrincipals.Response) { + return fmt.Errorf("Error checking for presence of existing Kusto Database Principals %q (Resource Group %q, Cluster %q): %s", id, id.ResourceGroup, id.Cluster, err) } } principal := kusto.DatabasePrincipal{} found := false - if principals := resp.Value; principals != nil { + if principals := databasePrincipals.Value; principals != nil { for _, currPrincipal := range *principals { // kusto database principals are unique when looked at with fqn and role - if string(currPrincipal.Role) == role && currPrincipal.Fqn != nil && *currPrincipal.Fqn == fqn { + if string(currPrincipal.Role) == id.Role && currPrincipal.Fqn != nil && *currPrincipal.Fqn == id.Name { principal = currPrincipal found = true break @@ -252,9 +253,9 @@ func resourceArmKustoDatabasePrincipalRead(d *schema.ResourceData, meta interfac return nil } - d.Set("resource_group_name", resourceGroup) - d.Set("cluster_name", clusterName) - d.Set("database_name", databaseName) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("cluster_name", id.Cluster) + d.Set("database_name", id.Database) d.Set("role", string(principal.Role)) d.Set("type", string(principal.Type)) @@ -271,13 +272,13 @@ func resourceArmKustoDatabasePrincipalRead(d *schema.ResourceData, meta interfac d.Set("name", principal.Name) } - splitFQN := strings.Split(fqn, "=") + splitFQN := strings.Split(id.Name, "=") if len(splitFQN) != 2 { - return fmt.Errorf("Expected `fqn` to be in the format aadtype=objectid:clientid but got: %q", fqn) + return fmt.Errorf("Expected `fqn` to be in the format aadtype=objectid:clientid but got: %q", id.Name) } splitIDs := strings.Split(splitFQN[1], ";") if len(splitIDs) != 2 { - return fmt.Errorf("Expected `fqn` to be in the format aadtype=objectid:clientid but got: %q", fqn) + return fmt.Errorf("Expected `fqn` to be in the format aadtype=objectid:clientid but got: %q", id.Name) } d.Set("object_id", splitIDs[0]) d.Set("client_id", splitIDs[1]) @@ -290,20 +291,14 @@ func resourceArmKustoDatabasePrincipalDelete(d *schema.ResourceData, meta interf ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := azure.ParseAzureResourceID(d.Id()) + id, err := parse.KustoDatabasePrincipalID(d.Id()) if err != nil { return err } - resGroup := id.ResourceGroup - clusterName := id.Path["Clusters"] - databaseName := id.Path["Databases"] - role := id.Path["Role"] - fqn := id.Path["FQN"] - kustoPrincipal := kusto.DatabasePrincipal{ - Role: kusto.DatabasePrincipalRole(role), - Fqn: utils.String(fqn), + Role: kusto.DatabasePrincipalRole(id.Role), + Fqn: utils.String(id.Name), Type: kusto.DatabasePrincipalType(d.Get("type").(string)), // These three must be specified or the api returns `The request is invalid.` // For more info: https://github.com/Azure/azure-sdk-for-go/issues/6547 @@ -317,8 +312,8 @@ func resourceArmKustoDatabasePrincipalDelete(d *schema.ResourceData, meta interf Value: &principals, } - if _, err = client.RemovePrincipals(ctx, resGroup, clusterName, databaseName, request); err != nil { - return fmt.Errorf("Error deleting Kusto Database Principal %q (Resource Group %q, Cluster %q, Database %q): %+v", id, resGroup, clusterName, databaseName, err) + if _, err = client.RemovePrincipals(ctx, id.ResourceGroup, id.Cluster, id.Database, request); err != nil { + return fmt.Errorf("Error deleting Kusto Database Principal %q (Resource Group %q, Cluster %q, Database %q): %+v", id, id.ResourceGroup, id.Cluster, id.Database, err) } return nil diff --git a/azurerm/internal/services/kusto/kusto_database_resource.go b/azurerm/internal/services/kusto/kusto_database_resource.go index c6b47aaf8cff9..18e13237e60f8 100644 --- a/azurerm/internal/services/kusto/kusto_database_resource.go +++ b/azurerm/internal/services/kusto/kusto_database_resource.go @@ -6,13 +6,14 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/kusto/parse" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -86,15 +87,18 @@ func resourceArmKustoDatabaseCreateUpdate(d *schema.ResourceData, meta interface clusterName := d.Get("cluster_name").(string) if features.ShouldResourcesBeImported() && d.IsNewResource() { - server, err := client.Get(ctx, resourceGroup, clusterName, name) + resp, err := client.Get(ctx, resourceGroup, clusterName, name) if err != nil { - if !utils.ResponseWasNotFound(server.Response) { + if !utils.ResponseWasNotFound(resp.Response) { return fmt.Errorf("Error checking for presence of existing Kusto Database %q (Resource Group %q, Cluster %q): %s", name, resourceGroup, clusterName, err) } } - if server.ID != nil && *server.ID != "" { - return tf.ImportAsExistsError("azurerm_kusto_database", *server.ID) + if resp.Value != nil { + database, _ := resp.Value.AsDatabase() + if database.ID != nil && *database.ID != "" { + return tf.ImportAsExistsError("azurerm_kusto_database", *database.ID) + } } } @@ -102,31 +106,32 @@ func resourceArmKustoDatabaseCreateUpdate(d *schema.ResourceData, meta interface databaseProperties := expandKustoDatabaseProperties(d) - kustoDatabase := kusto.Database{ - Name: &name, - Location: &location, - DatabaseProperties: databaseProperties, + kustoDatabase := kusto.ReadWriteDatabase{ + Name: &name, + Location: &location, + ReadWriteDatabaseProperties: databaseProperties, } future, err := client.CreateOrUpdate(ctx, resourceGroup, clusterName, name, kustoDatabase) if err != nil { - return fmt.Errorf("Error creating or updating Kusto Cluster %q (Resource Group %q, Cluster %q): %+v", name, resourceGroup, clusterName, err) + return fmt.Errorf("Error creating or updating Kusto Database %q (Resource Group %q, Cluster %q): %+v", name, resourceGroup, clusterName, err) } if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("Error waiting for completion of Kusto Cluster %q (Resource Group %q, Cluster %q): %+v", name, resourceGroup, clusterName, err) + return fmt.Errorf("Error waiting for completion of Kusto Database %q (Resource Group %q, Cluster %q): %+v", name, resourceGroup, clusterName, err) } - resp, getDetailsErr := client.Get(ctx, resourceGroup, clusterName, name) - if getDetailsErr != nil { - return fmt.Errorf("Error retrieving Kusto Cluster %q (Resource Group %q, Cluster %q): %+v", name, resourceGroup, clusterName, err) + resp, err := client.Get(ctx, resourceGroup, clusterName, name) + if err != nil { + return fmt.Errorf("Error retrieving Kusto Database %q (Resource Group %q, Cluster %q): %+v", name, resourceGroup, clusterName, err) } - if resp.ID == nil { - return fmt.Errorf("Cannot read ID for Kusto Cluster %q (Resource Group %q, Cluster %q)", name, resourceGroup, clusterName) + database, _ := resp.Value.AsDatabase() + if database.ID == nil { + return fmt.Errorf("Cannot read ID for Kusto Database %q (Resource Group %q, Cluster %q)", name, resourceGroup, clusterName) } - d.SetId(*resp.ID) + d.SetId(*database.ID) return resourceArmKustoDatabaseRead(d, meta) } @@ -136,34 +141,31 @@ func resourceArmKustoDatabaseRead(d *schema.ResourceData, meta interface{}) erro ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := azure.ParseAzureResourceID(d.Id()) + id, err := parse.KustoDatabaseID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - clusterName := id.Path["Clusters"] - name := id.Path["Databases"] - - databaseResponse, err := client.Get(ctx, resourceGroup, clusterName, name) + databaseModel, err := client.Get(ctx, id.ResourceGroup, id.Cluster, id.Name) if err != nil { - if utils.ResponseWasNotFound(databaseResponse.Response) { + if utils.ResponseWasNotFound(databaseModel.Response) { d.SetId("") return nil } - return fmt.Errorf("Error retrieving Kusto Database %q (Resource Group %q, Cluster %q): %+v", name, resourceGroup, clusterName, err) + return fmt.Errorf("Error retrieving Kusto Database %q (Resource Group %q, Cluster %q): %+v", id.Name, id.ResourceGroup, id.Cluster, err) } - d.Set("name", name) - d.Set("resource_group_name", resourceGroup) - d.Set("cluster_name", clusterName) + d.Set("name", id.Name) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("cluster_name", id.Cluster) - if location := databaseResponse.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) + if location := databaseModel.Location; location != nil { + d.Set("location", azure.NormalizeLocation(location)) } - if props := databaseResponse.DatabaseProperties; props != nil { + database, _ := databaseModel.Value.AsReadWriteDatabase() + if props := database.ReadWriteDatabaseProperties; props != nil { d.Set("hot_cache_period", props.HotCachePeriod) d.Set("soft_delete_period", props.SoftDeletePeriod) @@ -219,8 +221,8 @@ func validateAzureRMKustoDatabaseName(v interface{}, k string) (warnings []strin return warnings, errors } -func expandKustoDatabaseProperties(d *schema.ResourceData) *kusto.DatabaseProperties { - databaseProperties := &kusto.DatabaseProperties{} +func expandKustoDatabaseProperties(d *schema.ResourceData) *kusto.ReadWriteDatabaseProperties { + databaseProperties := &kusto.ReadWriteDatabaseProperties{} if softDeletePeriod, ok := d.GetOk("soft_delete_period"); ok { databaseProperties.SoftDeletePeriod = utils.String(softDeletePeriod.(string)) diff --git a/azurerm/internal/services/kusto/kusto_eventhub_data_connection_resource.go b/azurerm/internal/services/kusto/kusto_eventhub_data_connection_resource.go index 9fd9932d87271..a50fb519b2214 100644 --- a/azurerm/internal/services/kusto/kusto_eventhub_data_connection_resource.go +++ b/azurerm/internal/services/kusto/kusto_eventhub_data_connection_resource.go @@ -6,13 +6,14 @@ import ( "regexp" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto" + "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/kusto/parse" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) @@ -111,7 +112,7 @@ func resourceArmKustoEventHubDataConnection() *schema.Resource { _, hasMappingRuleName := d.GetOk("mapping_rule_name") _, hasDataFormat := d.GetOk("data_format") - if !(AllEquals(hasTableName, hasMappingRuleName, hasDataFormat)) { + if !(utils.AllEquals(hasTableName, hasMappingRuleName, hasDataFormat)) { return fmt.Errorf("if one of the target table properties `table_name`, `mapping_rule_name` or `data_format` are set, the other values must also be defined") } @@ -120,24 +121,12 @@ func resourceArmKustoEventHubDataConnection() *schema.Resource { } } -func AllEquals(v ...interface{}) bool { - if len(v) > 1 { - a := v[0] - for _, s := range v { - if a != s { - return false - } - } - } - return true -} - func resourceArmKustoEventHubDataConnectionCreateUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*clients.Client).Kusto.DataConnectionsClient ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - log.Printf("[INFO] preparing arguments for Azure Kusto EventHub Data Connection creation.") + log.Printf("[INFO] preparing arguments for Azure Kusto Event Hub Data Connection creation.") name := d.Get("name").(string) resourceGroup := d.Get("resource_group_name").(string) @@ -148,7 +137,7 @@ func resourceArmKustoEventHubDataConnectionCreateUpdate(d *schema.ResourceData, connectionModel, err := client.Get(ctx, resourceGroup, clusterName, databaseName, name) if err != nil { if !utils.ResponseWasNotFound(connectionModel.Response) { - return fmt.Errorf("Error checking for presence of existing Kusto EventHub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %s", name, resourceGroup, clusterName, databaseName, err) + return fmt.Errorf("Error checking for presence of existing Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %s", name, resourceGroup, clusterName, databaseName, err) } } @@ -171,22 +160,22 @@ func resourceArmKustoEventHubDataConnectionCreateUpdate(d *schema.ResourceData, future, err := client.CreateOrUpdate(ctx, resourceGroup, clusterName, databaseName, name, dataConnection1) if err != nil { - return fmt.Errorf("Error creating or updating Kusto EventHub Data Connection %q (Resource Group %q, Cluster %q, Database: %q): %+v", name, resourceGroup, clusterName, databaseName, err) + return fmt.Errorf("Error creating or updating Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database: %q): %+v", name, resourceGroup, clusterName, databaseName, err) } if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("Error waiting for completion of Kusto EventHub Data Connection %q (Resource Group %q, Cluster %q, Database: %q): %+v", name, resourceGroup, clusterName, databaseName, err) + return fmt.Errorf("Error waiting for completion of Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database: %q): %+v", name, resourceGroup, clusterName, databaseName, err) } connectionModel, getDetailsErr := client.Get(ctx, resourceGroup, clusterName, databaseName, name) if getDetailsErr != nil { - return fmt.Errorf("Error retrieving Kusto EventHub Data Connection %q (Resource Group %q, Cluster %q, Database: %q): %+v", name, resourceGroup, clusterName, databaseName, err) + return fmt.Errorf("Error retrieving Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database: %q): %+v", name, resourceGroup, clusterName, databaseName, err) } if dataConnection, ok := connectionModel.Value.(kusto.EventHubDataConnection); ok { if dataConnection.ID == nil { - return fmt.Errorf("Cannot read ID for Kusto EventHub Data Connection %q (Resource Group %q, Cluster %q, Database: %q): %+v", name, resourceGroup, clusterName, databaseName, err) + return fmt.Errorf("Cannot read ID for Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database: %q): %+v", name, resourceGroup, clusterName, databaseName, err) } d.SetId(*dataConnection.ID) @@ -200,30 +189,25 @@ func resourceArmKustoEventHubDataConnectionRead(d *schema.ResourceData, meta int ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := azure.ParseAzureResourceID(d.Id()) + id, err := parse.KustoEventHubDataConnectionID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - clusterName := id.Path["Clusters"] - databaseName := id.Path["Databases"] - name := id.Path["DataConnections"] - - connectionModel, err := client.Get(ctx, resourceGroup, clusterName, databaseName, name) + connectionModel, err := client.Get(ctx, id.ResourceGroup, id.Cluster, id.Database, id.Name) if err != nil { if utils.ResponseWasNotFound(connectionModel.Response) { d.SetId("") return nil } - return fmt.Errorf("Error retrieving Kusto EventHub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %+v", name, resourceGroup, clusterName, databaseName, err) + return fmt.Errorf("Error retrieving Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %+v", id.Name, id.ResourceGroup, id.Cluster, id.Database, err) } - d.Set("name", name) - d.Set("resource_group_name", resourceGroup) - d.Set("cluster_name", clusterName) - d.Set("database_name", databaseName) + d.Set("name", id.Name) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("cluster_name", id.Cluster) + d.Set("database_name", id.Database) if dataConnection, ok := connectionModel.Value.(kusto.EventHubDataConnection); ok { if location := dataConnection.Location; location != nil { @@ -247,23 +231,18 @@ func resourceArmKustoEventHubDataConnectionDelete(d *schema.ResourceData, meta i ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := azure.ParseAzureResourceID(d.Id()) + id, err := parse.KustoEventHubDataConnectionID(d.Id()) if err != nil { return err } - resourceGroup := id.ResourceGroup - clusterName := id.Path["Clusters"] - databaseName := id.Path["Databases"] - name := id.Path["DataConnections"] - - future, err := client.Delete(ctx, resourceGroup, clusterName, databaseName, name) + future, err := client.Delete(ctx, id.ResourceGroup, id.Cluster, id.Database, id.Name) if err != nil { - return fmt.Errorf("Error deleting Kusto EventHub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %+v", name, resourceGroup, clusterName, databaseName, err) + return fmt.Errorf("Error deleting Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %+v", id.Name, id.ResourceGroup, id.Cluster, id.Database, err) } if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("Error waiting for deletion of Kusto EventHub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %+v", name, resourceGroup, clusterName, databaseName, err) + return fmt.Errorf("Error waiting for deletion of Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %+v", id.Name, id.ResourceGroup, id.Cluster, id.Database, err) } return nil @@ -308,8 +287,8 @@ func validateAzureRMKustoEntityName(v interface{}, k string) (warnings []string, func expandKustoEventHubDataConnectionProperties(d *schema.ResourceData) *kusto.EventHubConnectionProperties { eventHubConnectionProperties := &kusto.EventHubConnectionProperties{} - if eventhubResourceId, ok := d.GetOk("eventhub_id"); ok { - eventHubConnectionProperties.EventHubResourceID = utils.String(eventhubResourceId.(string)) + if eventhubResourceID, ok := d.GetOk("eventhub_id"); ok { + eventHubConnectionProperties.EventHubResourceID = utils.String(eventhubResourceID.(string)) } if consumerGroup, ok := d.GetOk("consumer_group"); ok { @@ -325,7 +304,7 @@ func expandKustoEventHubDataConnectionProperties(d *schema.ResourceData) *kusto. } if df, ok := d.GetOk("data_format"); ok { - eventHubConnectionProperties.DataFormat = kusto.DataFormat(df.(string)) + eventHubConnectionProperties.DataFormat = kusto.EventHubDataFormat(df.(string)) } return eventHubConnectionProperties diff --git a/azurerm/internal/services/kusto/parse/kusto_cluster.go b/azurerm/internal/services/kusto/parse/kusto_cluster.go new file mode 100644 index 0000000000000..b52c7b6d05425 --- /dev/null +++ b/azurerm/internal/services/kusto/parse/kusto_cluster.go @@ -0,0 +1,33 @@ +package parse + +import ( + "fmt" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" +) + +type KustoClusterId struct { + ResourceGroup string + Name string +} + +func KustoClusterID(input string) (*KustoClusterId, error) { + id, err := azure.ParseAzureResourceID(input) + if err != nil { + return nil, fmt.Errorf("[ERROR] Unable to parse Kusto Cluster ID %q: %+v", input, err) + } + + cluster := KustoClusterId{ + ResourceGroup: id.ResourceGroup, + } + + if cluster.Name, err = id.PopSegment("Clusters"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &cluster, nil +} diff --git a/azurerm/internal/services/kusto/parse/kusto_database.go b/azurerm/internal/services/kusto/parse/kusto_database.go new file mode 100644 index 0000000000000..4cd6ad80db947 --- /dev/null +++ b/azurerm/internal/services/kusto/parse/kusto_database.go @@ -0,0 +1,38 @@ +package parse + +import ( + "fmt" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" +) + +type KustoDatabaseId struct { + ResourceGroup string + Cluster string + Name string +} + +func KustoDatabaseID(input string) (*KustoDatabaseId, error) { + id, err := azure.ParseAzureResourceID(input) + if err != nil { + return nil, fmt.Errorf("[ERROR] Unable to parse Kusto Database ID %q: %+v", input, err) + } + + database := KustoDatabaseId{ + ResourceGroup: id.ResourceGroup, + } + + if database.Cluster, err = id.PopSegment("Clusters"); err != nil { + return nil, err + } + + if database.Name, err = id.PopSegment("Databases"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &database, nil +} diff --git a/azurerm/internal/services/kusto/parse/kusto_database_principal.go b/azurerm/internal/services/kusto/parse/kusto_database_principal.go new file mode 100644 index 0000000000000..b4209829006f4 --- /dev/null +++ b/azurerm/internal/services/kusto/parse/kusto_database_principal.go @@ -0,0 +1,48 @@ +package parse + +import ( + "fmt" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" +) + +type KustoDatabasePrincipalId struct { + ResourceGroup string + Cluster string + Database string + Role string + Name string +} + +func KustoDatabasePrincipalID(input string) (*KustoDatabasePrincipalId, error) { + id, err := azure.ParseAzureResourceID(input) + if err != nil { + return nil, fmt.Errorf("[ERROR] Unable to parse Kusto Database Principal ID %q: %+v", input, err) + } + + principal := KustoDatabasePrincipalId{ + ResourceGroup: id.ResourceGroup, + } + + if principal.Cluster, err = id.PopSegment("Clusters"); err != nil { + return nil, err + } + + if principal.Database, err = id.PopSegment("Databases"); err != nil { + return nil, err + } + + if principal.Role, err = id.PopSegment("Role"); err != nil { + return nil, err + } + + if principal.Name, err = id.PopSegment("FQN"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &principal, nil +} diff --git a/azurerm/internal/services/kusto/parse/kusto_eventhub_data_connection.go b/azurerm/internal/services/kusto/parse/kusto_eventhub_data_connection.go new file mode 100644 index 0000000000000..6121c643fc9a2 --- /dev/null +++ b/azurerm/internal/services/kusto/parse/kusto_eventhub_data_connection.go @@ -0,0 +1,43 @@ +package parse + +import ( + "fmt" + + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" +) + +type KustoEventHubDataConnectionId struct { + ResourceGroup string + Cluster string + Database string + Name string +} + +func KustoEventHubDataConnectionID(input string) (*KustoEventHubDataConnectionId, error) { + id, err := azure.ParseAzureResourceID(input) + if err != nil { + return nil, fmt.Errorf("[ERROR] Unable to parse Kusto Event Hub Data Connection ID %q: %+v", input, err) + } + + dataConnection := KustoEventHubDataConnectionId{ + ResourceGroup: id.ResourceGroup, + } + + if dataConnection.Cluster, err = id.PopSegment("Clusters"); err != nil { + return nil, err + } + + if dataConnection.Database, err = id.PopSegment("Databases"); err != nil { + return nil, err + } + + if dataConnection.Name, err = id.PopSegment("DataConnections"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &dataConnection, nil +} diff --git a/azurerm/utils/compare.go b/azurerm/utils/compare.go new file mode 100644 index 0000000000000..145c80c7abb51 --- /dev/null +++ b/azurerm/utils/compare.go @@ -0,0 +1,13 @@ +package utils + +func AllEquals(v ...interface{}) bool { + if len(v) > 1 { + a := v[0] + for _, s := range v { + if a != s { + return false + } + } + } + return true +} diff --git a/go.mod b/go.mod index 9c7f4b79b2482..5b52095d2b649 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,9 @@ require ( github.com/Azure/azure-sdk-for-go v42.1.0+incompatible github.com/Azure/go-autorest/autorest v0.10.0 github.com/Azure/go-autorest/autorest/date v0.2.0 + github.com/Azure/go-autorest/autorest/to v0.3.0 + github.com/Azure/go-autorest/autorest/validation v0.2.0 + github.com/Azure/go-autorest/tracing v0.5.0 github.com/btubbs/datetime v0.1.0 github.com/davecgh/go-spew v1.1.1 github.com/google/uuid v1.1.1 diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/attacheddatabaseconfigurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/attacheddatabaseconfigurations.go new file mode 100644 index 0000000000000..c6d7e0d3d5547 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/attacheddatabaseconfigurations.go @@ -0,0 +1,367 @@ +package kusto + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AttachedDatabaseConfigurationsClient is the the Azure Kusto management API provides a RESTful set of web services +// that interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, +// update, and delete clusters and databases. +type AttachedDatabaseConfigurationsClient struct { + BaseClient +} + +// NewAttachedDatabaseConfigurationsClient creates an instance of the AttachedDatabaseConfigurationsClient client. +func NewAttachedDatabaseConfigurationsClient(subscriptionID string) AttachedDatabaseConfigurationsClient { + return NewAttachedDatabaseConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAttachedDatabaseConfigurationsClientWithBaseURI creates an instance of the AttachedDatabaseConfigurationsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewAttachedDatabaseConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) AttachedDatabaseConfigurationsClient { + return AttachedDatabaseConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an attached database configuration. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// attachedDatabaseConfigurationName - the name of the attached database configuration. +// parameters - the database parameters supplied to the CreateOrUpdate operation. +func (client AttachedDatabaseConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, parameters AttachedDatabaseConfiguration) (result AttachedDatabaseConfigurationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AttachedDatabaseConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AttachedDatabaseConfigurationProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AttachedDatabaseConfigurationProperties.DatabaseName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AttachedDatabaseConfigurationProperties.ClusterResourceID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("kusto.AttachedDatabaseConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, attachedDatabaseConfigurationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AttachedDatabaseConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, parameters AttachedDatabaseConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "attachedDatabaseConfigurationName": autorest.Encode("path", attachedDatabaseConfigurationName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AttachedDatabaseConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future AttachedDatabaseConfigurationsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AttachedDatabaseConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result AttachedDatabaseConfiguration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the attached database configuration with the given name. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// attachedDatabaseConfigurationName - the name of the attached database configuration. +func (client AttachedDatabaseConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string) (result AttachedDatabaseConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AttachedDatabaseConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, attachedDatabaseConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AttachedDatabaseConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "attachedDatabaseConfigurationName": autorest.Encode("path", attachedDatabaseConfigurationName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AttachedDatabaseConfigurationsClient) DeleteSender(req *http.Request) (future AttachedDatabaseConfigurationsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AttachedDatabaseConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns an attached database configuration. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// attachedDatabaseConfigurationName - the name of the attached database configuration. +func (client AttachedDatabaseConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string) (result AttachedDatabaseConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AttachedDatabaseConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, attachedDatabaseConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AttachedDatabaseConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "attachedDatabaseConfigurationName": autorest.Encode("path", attachedDatabaseConfigurationName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AttachedDatabaseConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AttachedDatabaseConfigurationsClient) GetResponder(resp *http.Response) (result AttachedDatabaseConfiguration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByCluster returns the list of attached database configurations of the given Kusto cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client AttachedDatabaseConfigurationsClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result AttachedDatabaseConfigurationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AttachedDatabaseConfigurationsClient.ListByCluster") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByClusterPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "ListByCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListByClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "ListByCluster", resp, "Failure sending request") + return + } + + result, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "ListByCluster", resp, "Failure responding to request") + } + + return +} + +// ListByClusterPreparer prepares the ListByCluster request. +func (client AttachedDatabaseConfigurationsClient) ListByClusterPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByClusterSender sends the ListByCluster request. The method will close the +// http.Response Body if it receives an error. +func (client AttachedDatabaseConfigurationsClient) ListByClusterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByClusterResponder handles the response to the ListByCluster request. The method always +// closes the http.Response Body. +func (client AttachedDatabaseConfigurationsClient) ListByClusterResponder(resp *http.Response) (result AttachedDatabaseConfigurationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/client.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/client.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/client.go index 38114f3525411..957d036572758 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/client.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/client.go @@ -1,4 +1,4 @@ -// Package kusto implements the Azure ARM Kusto service API version 2019-05-15. +// Package kusto implements the Azure ARM Kusto service API version 2020-02-15. // // The Azure Kusto management API provides a RESTful set of web services that interact with Azure Kusto services to // manage your clusters and databases. The API enables you to create, update, and delete clusters and databases. diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/clusterprincipalassignments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/clusterprincipalassignments.go new file mode 100644 index 0000000000000..7ec48eea760ed --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/clusterprincipalassignments.go @@ -0,0 +1,451 @@ +package kusto + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ClusterPrincipalAssignmentsClient is the the Azure Kusto management API provides a RESTful set of web services that +// interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and +// delete clusters and databases. +type ClusterPrincipalAssignmentsClient struct { + BaseClient +} + +// NewClusterPrincipalAssignmentsClient creates an instance of the ClusterPrincipalAssignmentsClient client. +func NewClusterPrincipalAssignmentsClient(subscriptionID string) ClusterPrincipalAssignmentsClient { + return NewClusterPrincipalAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterPrincipalAssignmentsClientWithBaseURI creates an instance of the ClusterPrincipalAssignmentsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewClusterPrincipalAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) ClusterPrincipalAssignmentsClient { + return ClusterPrincipalAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks that the principal assignment name is valid and is not already in use. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// principalAssignmentName - the name of the principal assignment. +func (client ClusterPrincipalAssignmentsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName ClusterPrincipalAssignmentCheckNameRequest) (result CheckNameResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterPrincipalAssignmentsClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: principalAssignmentName, + Constraints: []validation.Constraint{{Target: "principalAssignmentName.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "principalAssignmentName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("kusto.ClusterPrincipalAssignmentsClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, principalAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ClusterPrincipalAssignmentsClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName ClusterPrincipalAssignmentCheckNameRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkPrincipalAssignmentNameAvailability", pathParameters), + autorest.WithJSON(principalAssignmentName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ClusterPrincipalAssignmentsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ClusterPrincipalAssignmentsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create a Kusto cluster principalAssignment. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// principalAssignmentName - the name of the Kusto principalAssignment. +// parameters - the Kusto cluster principalAssignment's parameters supplied for the operation. +func (client ClusterPrincipalAssignmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, parameters ClusterPrincipalAssignment) (result ClusterPrincipalAssignmentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterPrincipalAssignmentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ClusterPrincipalProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterPrincipalProperties.PrincipalID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("kusto.ClusterPrincipalAssignmentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, principalAssignmentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ClusterPrincipalAssignmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, parameters ClusterPrincipalAssignment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "principalAssignmentName": autorest.Encode("path", principalAssignmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ClusterPrincipalAssignmentsClient) CreateOrUpdateSender(req *http.Request) (future ClusterPrincipalAssignmentsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ClusterPrincipalAssignmentsClient) CreateOrUpdateResponder(resp *http.Response) (result ClusterPrincipalAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Kusto cluster principalAssignment. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// principalAssignmentName - the name of the Kusto principalAssignment. +func (client ClusterPrincipalAssignmentsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string) (result ClusterPrincipalAssignmentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterPrincipalAssignmentsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, principalAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ClusterPrincipalAssignmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "principalAssignmentName": autorest.Encode("path", principalAssignmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ClusterPrincipalAssignmentsClient) DeleteSender(req *http.Request) (future ClusterPrincipalAssignmentsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ClusterPrincipalAssignmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a Kusto cluster principalAssignment. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// principalAssignmentName - the name of the Kusto principalAssignment. +func (client ClusterPrincipalAssignmentsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string) (result ClusterPrincipalAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterPrincipalAssignmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, principalAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClusterPrincipalAssignmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "principalAssignmentName": autorest.Encode("path", principalAssignmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ClusterPrincipalAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ClusterPrincipalAssignmentsClient) GetResponder(resp *http.Response) (result ClusterPrincipalAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all Kusto cluster principalAssignments. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClusterPrincipalAssignmentsClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result ClusterPrincipalAssignmentListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterPrincipalAssignmentsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ClusterPrincipalAssignmentsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ClusterPrincipalAssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ClusterPrincipalAssignmentsClient) ListResponder(resp *http.Response) (result ClusterPrincipalAssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/clusters.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/clusters.go similarity index 61% rename from vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/clusters.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/clusters.go index 3ba20649d24e7..09a9ace5e42ac 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/clusters.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/clusters.go @@ -44,6 +44,84 @@ func NewClustersClientWithBaseURI(baseURI string, subscriptionID string) Cluster return ClustersClient{NewWithBaseURI(baseURI, subscriptionID)} } +// AddLanguageExtensions add a list of language extensions that can run within KQL queries. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// languageExtensionsToAdd - the language extensions to add. +func (client ClustersClient) AddLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToAdd LanguageExtensionsList) (result ClustersAddLanguageExtensionsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.AddLanguageExtensions") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddLanguageExtensionsPreparer(ctx, resourceGroupName, clusterName, languageExtensionsToAdd) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "AddLanguageExtensions", nil, "Failure preparing request") + return + } + + result, err = client.AddLanguageExtensionsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "AddLanguageExtensions", result.Response(), "Failure sending request") + return + } + + return +} + +// AddLanguageExtensionsPreparer prepares the AddLanguageExtensions request. +func (client ClustersClient) AddLanguageExtensionsPreparer(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToAdd LanguageExtensionsList) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions", pathParameters), + autorest.WithJSON(languageExtensionsToAdd), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddLanguageExtensionsSender sends the AddLanguageExtensions request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) AddLanguageExtensionsSender(req *http.Request) (future ClustersAddLanguageExtensionsFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// AddLanguageExtensionsResponder handles the response to the AddLanguageExtensions request. The method always +// closes the http.Response Body. +func (client ClustersClient) AddLanguageExtensionsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // CheckNameAvailability checks that the cluster name is valid and is not already in use. // Parameters: // location - azure location. @@ -94,7 +172,7 @@ func (client ClustersClient) CheckNameAvailabilityPreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -159,6 +237,11 @@ func (client ClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupNa {Target: "parameters.ClusterProperties.VirtualNetworkConfiguration.EnginePublicIPID", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.ClusterProperties.VirtualNetworkConfiguration.DataManagementPublicIPID", Name: validation.Null, Rule: true, Chain: nil}, }}, + {Target: "parameters.ClusterProperties.KeyVaultProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.KeyVaultProperties.KeyName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.KeyVaultProperties.KeyVersion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.KeyVaultProperties.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}, + }}, }}}}}); err != nil { return result, validation.NewError("kusto.ClustersClient", "CreateOrUpdate", err.Error()) } @@ -186,7 +269,7 @@ func (client ClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -264,7 +347,7 @@ func (client ClustersClient) DeletePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -301,6 +384,169 @@ func (client ClustersClient) DeleteResponder(resp *http.Response) (result autore return } +// DetachFollowerDatabases detaches all followers of a database owned by this cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// followerDatabaseToRemove - the follower databases properties to remove. +func (client ClustersClient) DetachFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition) (result ClustersDetachFollowerDatabasesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.DetachFollowerDatabases") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: followerDatabaseToRemove, + Constraints: []validation.Constraint{{Target: "followerDatabaseToRemove.ClusterResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "followerDatabaseToRemove.AttachedDatabaseConfigurationName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("kusto.ClustersClient", "DetachFollowerDatabases", err.Error()) + } + + req, err := client.DetachFollowerDatabasesPreparer(ctx, resourceGroupName, clusterName, followerDatabaseToRemove) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DetachFollowerDatabases", nil, "Failure preparing request") + return + } + + result, err = client.DetachFollowerDatabasesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DetachFollowerDatabases", result.Response(), "Failure sending request") + return + } + + return +} + +// DetachFollowerDatabasesPreparer prepares the DetachFollowerDatabases request. +func (client ClustersClient) DetachFollowerDatabasesPreparer(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + followerDatabaseToRemove.DatabaseName = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases", pathParameters), + autorest.WithJSON(followerDatabaseToRemove), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetachFollowerDatabasesSender sends the DetachFollowerDatabases request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) DetachFollowerDatabasesSender(req *http.Request) (future ClustersDetachFollowerDatabasesFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DetachFollowerDatabasesResponder handles the response to the DetachFollowerDatabases request. The method always +// closes the http.Response Body. +func (client ClustersClient) DetachFollowerDatabasesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DiagnoseVirtualNetwork diagnoses network connectivity status for external resources on which the service is +// dependent on. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) DiagnoseVirtualNetwork(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersDiagnoseVirtualNetworkFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.DiagnoseVirtualNetwork") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DiagnoseVirtualNetworkPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DiagnoseVirtualNetwork", nil, "Failure preparing request") + return + } + + result, err = client.DiagnoseVirtualNetworkSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DiagnoseVirtualNetwork", result.Response(), "Failure sending request") + return + } + + return +} + +// DiagnoseVirtualNetworkPreparer prepares the DiagnoseVirtualNetwork request. +func (client ClustersClient) DiagnoseVirtualNetworkPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/diagnoseVirtualNetwork", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DiagnoseVirtualNetworkSender sends the DiagnoseVirtualNetwork request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) DiagnoseVirtualNetworkSender(req *http.Request) (future ClustersDiagnoseVirtualNetworkFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DiagnoseVirtualNetworkResponder handles the response to the DiagnoseVirtualNetwork request. The method always +// closes the http.Response Body. +func (client ClustersClient) DiagnoseVirtualNetworkResponder(resp *http.Response) (result DiagnoseVirtualNetworkResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Get gets a Kusto cluster. // Parameters: // resourceGroupName - the name of the resource group containing the Kusto cluster. @@ -345,7 +591,7 @@ func (client ClustersClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -416,7 +662,7 @@ func (client ClustersClient) ListPreparer(ctx context.Context) (*http.Request, e "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -490,7 +736,7 @@ func (client ClustersClient) ListByResourceGroupPreparer(ctx context.Context, re "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -522,6 +768,159 @@ func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) ( return } +// ListFollowerDatabases returns a list of databases that are owned by this cluster and were followed by another +// cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) ListFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string) (result FollowerDatabaseListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListFollowerDatabases") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListFollowerDatabasesPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListFollowerDatabases", nil, "Failure preparing request") + return + } + + resp, err := client.ListFollowerDatabasesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListFollowerDatabases", resp, "Failure sending request") + return + } + + result, err = client.ListFollowerDatabasesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListFollowerDatabases", resp, "Failure responding to request") + } + + return +} + +// ListFollowerDatabasesPreparer prepares the ListFollowerDatabases request. +func (client ClustersClient) ListFollowerDatabasesPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listFollowerDatabases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListFollowerDatabasesSender sends the ListFollowerDatabases request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListFollowerDatabasesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListFollowerDatabasesResponder handles the response to the ListFollowerDatabases request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListFollowerDatabasesResponder(resp *http.Response) (result FollowerDatabaseListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListLanguageExtensions returns a list of language extensions that can run within KQL queries. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) ListLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string) (result LanguageExtensionsList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListLanguageExtensions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListLanguageExtensionsPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListLanguageExtensions", nil, "Failure preparing request") + return + } + + resp, err := client.ListLanguageExtensionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListLanguageExtensions", resp, "Failure sending request") + return + } + + result, err = client.ListLanguageExtensionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListLanguageExtensions", resp, "Failure responding to request") + } + + return +} + +// ListLanguageExtensionsPreparer prepares the ListLanguageExtensions request. +func (client ClustersClient) ListLanguageExtensionsPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listLanguageExtensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListLanguageExtensionsSender sends the ListLanguageExtensions request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListLanguageExtensionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListLanguageExtensionsResponder handles the response to the ListLanguageExtensions request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListLanguageExtensionsResponder(resp *http.Response) (result LanguageExtensionsList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // ListSkus lists eligible SKUs for Kusto resource provider. func (client ClustersClient) ListSkus(ctx context.Context) (result SkuDescriptionList, err error) { if tracing.IsEnabled() { @@ -561,7 +960,7 @@ func (client ClustersClient) ListSkusPreparer(ctx context.Context) (*http.Reques "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -637,7 +1036,7 @@ func (client ClustersClient) ListSkusByResourcePreparer(ctx context.Context, res "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -669,6 +1068,84 @@ func (client ClustersClient) ListSkusByResourceResponder(resp *http.Response) (r return } +// RemoveLanguageExtensions remove a list of language extensions that can run within KQL queries. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// languageExtensionsToRemove - the language extensions to remove. +func (client ClustersClient) RemoveLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToRemove LanguageExtensionsList) (result ClustersRemoveLanguageExtensionsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.RemoveLanguageExtensions") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RemoveLanguageExtensionsPreparer(ctx, resourceGroupName, clusterName, languageExtensionsToRemove) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "RemoveLanguageExtensions", nil, "Failure preparing request") + return + } + + result, err = client.RemoveLanguageExtensionsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "RemoveLanguageExtensions", result.Response(), "Failure sending request") + return + } + + return +} + +// RemoveLanguageExtensionsPreparer prepares the RemoveLanguageExtensions request. +func (client ClustersClient) RemoveLanguageExtensionsPreparer(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToRemove LanguageExtensionsList) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions", pathParameters), + autorest.WithJSON(languageExtensionsToRemove), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RemoveLanguageExtensionsSender sends the RemoveLanguageExtensions request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) RemoveLanguageExtensionsSender(req *http.Request) (future ClustersRemoveLanguageExtensionsFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// RemoveLanguageExtensionsResponder handles the response to the RemoveLanguageExtensions request. The method always +// closes the http.Response Body. +func (client ClustersClient) RemoveLanguageExtensionsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // Start starts a Kusto cluster. // Parameters: // resourceGroupName - the name of the resource group containing the Kusto cluster. @@ -707,7 +1184,7 @@ func (client ClustersClient) StartPreparer(ctx context.Context, resourceGroupNam "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -782,7 +1259,7 @@ func (client ClustersClient) StopPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -858,7 +1335,7 @@ func (client ClustersClient) UpdatePreparer(ctx context.Context, resourceGroupNa "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -891,7 +1368,7 @@ func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluste err = autorest.Respond( resp, client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/databaseprincipalassignments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/databaseprincipalassignments.go new file mode 100644 index 0000000000000..5f639588d1240 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/databaseprincipalassignments.go @@ -0,0 +1,461 @@ +package kusto + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DatabasePrincipalAssignmentsClient is the the Azure Kusto management API provides a RESTful set of web services that +// interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and +// delete clusters and databases. +type DatabasePrincipalAssignmentsClient struct { + BaseClient +} + +// NewDatabasePrincipalAssignmentsClient creates an instance of the DatabasePrincipalAssignmentsClient client. +func NewDatabasePrincipalAssignmentsClient(subscriptionID string) DatabasePrincipalAssignmentsClient { + return NewDatabasePrincipalAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDatabasePrincipalAssignmentsClientWithBaseURI creates an instance of the DatabasePrincipalAssignmentsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewDatabasePrincipalAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) DatabasePrincipalAssignmentsClient { + return DatabasePrincipalAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks that the database principal assignment is valid and is not already in use. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// databaseName - the name of the database in the Kusto cluster. +// principalAssignmentName - the name of the resource. +func (client DatabasePrincipalAssignmentsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName DatabasePrincipalAssignmentCheckNameRequest) (result CheckNameResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasePrincipalAssignmentsClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: principalAssignmentName, + Constraints: []validation.Constraint{{Target: "principalAssignmentName.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "principalAssignmentName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("kusto.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client DatabasePrincipalAssignmentsClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName DatabasePrincipalAssignmentCheckNameRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkPrincipalAssignmentNameAvailability", pathParameters), + autorest.WithJSON(principalAssignmentName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasePrincipalAssignmentsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client DatabasePrincipalAssignmentsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates a Kusto cluster database principalAssignment. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// databaseName - the name of the database in the Kusto cluster. +// principalAssignmentName - the name of the Kusto principalAssignment. +// parameters - the Kusto principalAssignments parameters supplied for the operation. +func (client DatabasePrincipalAssignmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, parameters DatabasePrincipalAssignment) (result DatabasePrincipalAssignmentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasePrincipalAssignmentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.DatabasePrincipalProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.DatabasePrincipalProperties.PrincipalID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("kusto.DatabasePrincipalAssignmentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DatabasePrincipalAssignmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, parameters DatabasePrincipalAssignment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "databaseName": autorest.Encode("path", databaseName), + "principalAssignmentName": autorest.Encode("path", principalAssignmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasePrincipalAssignmentsClient) CreateOrUpdateSender(req *http.Request) (future DatabasePrincipalAssignmentsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DatabasePrincipalAssignmentsClient) CreateOrUpdateResponder(resp *http.Response) (result DatabasePrincipalAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a Kusto principalAssignment. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// databaseName - the name of the database in the Kusto cluster. +// principalAssignmentName - the name of the Kusto principalAssignment. +func (client DatabasePrincipalAssignmentsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string) (result DatabasePrincipalAssignmentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasePrincipalAssignmentsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DatabasePrincipalAssignmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "databaseName": autorest.Encode("path", databaseName), + "principalAssignmentName": autorest.Encode("path", principalAssignmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasePrincipalAssignmentsClient) DeleteSender(req *http.Request) (future DatabasePrincipalAssignmentsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DatabasePrincipalAssignmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a Kusto cluster database principalAssignment. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// databaseName - the name of the database in the Kusto cluster. +// principalAssignmentName - the name of the Kusto principalAssignment. +func (client DatabasePrincipalAssignmentsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string) (result DatabasePrincipalAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasePrincipalAssignmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DatabasePrincipalAssignmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "databaseName": autorest.Encode("path", databaseName), + "principalAssignmentName": autorest.Encode("path", principalAssignmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasePrincipalAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DatabasePrincipalAssignmentsClient) GetResponder(resp *http.Response) (result DatabasePrincipalAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all Kusto cluster database principalAssignments. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// databaseName - the name of the database in the Kusto cluster. +func (client DatabasePrincipalAssignmentsClient) List(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabasePrincipalAssignmentListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DatabasePrincipalAssignmentsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, clusterName, databaseName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DatabasePrincipalAssignmentsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "databaseName": autorest.Encode("path", databaseName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-02-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DatabasePrincipalAssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DatabasePrincipalAssignmentsClient) ListResponder(resp *http.Response) (result DatabasePrincipalAssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/databases.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/databases.go similarity index 95% rename from vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/databases.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/databases.go index 328b8daa447f8..2773416086e63 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/databases.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/databases.go @@ -91,7 +91,7 @@ func (client DatabasesClient) AddPrincipalsPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -129,8 +129,8 @@ func (client DatabasesClient) AddPrincipalsResponder(resp *http.Response) (resul // Parameters: // resourceGroupName - the name of the resource group containing the Kusto cluster. // clusterName - the name of the Kusto cluster. -// databaseName - the name of the database. -func (client DatabasesClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, databaseName DatabaseCheckNameRequest) (result CheckNameResult, err error) { +// resourceName - the name of the resource. +func (client DatabasesClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, resourceName CheckNameRequest) (result CheckNameResult, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CheckNameAvailability") defer func() { @@ -142,13 +142,12 @@ func (client DatabasesClient) CheckNameAvailability(ctx context.Context, resourc }() } if err := validation.Validate([]validation.Validation{ - {TargetValue: databaseName, - Constraints: []validation.Constraint{{Target: "databaseName.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "databaseName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("kusto.DatabasesClient", "CheckNameAvailability", err.Error()) } - req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, databaseName) + req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, resourceName) if err != nil { err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CheckNameAvailability", nil, "Failure preparing request") return @@ -170,14 +169,14 @@ func (client DatabasesClient) CheckNameAvailability(ctx context.Context, resourc } // CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client DatabasesClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName DatabaseCheckNameRequest) (*http.Request, error) { +func (client DatabasesClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, resourceName CheckNameRequest) (*http.Request, error) { pathParameters := map[string]interface{}{ "clusterName": autorest.Encode("path", clusterName), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -187,7 +186,7 @@ func (client DatabasesClient) CheckNameAvailabilityPreparer(ctx context.Context, autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkNameAvailability", pathParameters), - autorest.WithJSON(databaseName), + autorest.WithJSON(resourceName), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -217,7 +216,7 @@ func (client DatabasesClient) CheckNameAvailabilityResponder(resp *http.Response // clusterName - the name of the Kusto cluster. // databaseName - the name of the database in the Kusto cluster. // parameters - the database parameters supplied to the CreateOrUpdate operation. -func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters Database) (result DatabasesCreateOrUpdateFuture, err error) { +func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (result DatabasesCreateOrUpdateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CreateOrUpdate") defer func() { @@ -244,7 +243,7 @@ func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupN } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters Database) (*http.Request, error) { +func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (*http.Request, error) { pathParameters := map[string]interface{}{ "clusterName": autorest.Encode("path", clusterName), "databaseName": autorest.Encode("path", databaseName), @@ -252,7 +251,7 @@ func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -281,7 +280,7 @@ func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (future Da // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result Database, err error) { +func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseModel, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -332,7 +331,7 @@ func (client DatabasesClient) DeletePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -374,7 +373,7 @@ func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autor // resourceGroupName - the name of the resource group containing the Kusto cluster. // clusterName - the name of the Kusto cluster. // databaseName - the name of the database in the Kusto cluster. -func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result Database, err error) { +func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabaseModel, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Get") defer func() { @@ -415,7 +414,7 @@ func (client DatabasesClient) GetPreparer(ctx context.Context, resourceGroupName "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -436,7 +435,7 @@ func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, erro // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { +func (client DatabasesClient) GetResponder(resp *http.Response) (result DatabaseModel, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -491,7 +490,7 @@ func (client DatabasesClient) ListByClusterPreparer(ctx context.Context, resourc "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -569,7 +568,7 @@ func (client DatabasesClient) ListPrincipalsPreparer(ctx context.Context, resour "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -648,7 +647,7 @@ func (client DatabasesClient) RemovePrincipalsPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -688,7 +687,7 @@ func (client DatabasesClient) RemovePrincipalsResponder(resp *http.Response) (re // clusterName - the name of the Kusto cluster. // databaseName - the name of the database in the Kusto cluster. // parameters - the database parameters supplied to the Update operation. -func (client DatabasesClient) Update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseUpdate) (result DatabasesUpdateFuture, err error) { +func (client DatabasesClient) Update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (result DatabasesUpdateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Update") defer func() { @@ -715,7 +714,7 @@ func (client DatabasesClient) Update(ctx context.Context, resourceGroupName stri } // UpdatePreparer prepares the Update request. -func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseUpdate) (*http.Request, error) { +func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (*http.Request, error) { pathParameters := map[string]interface{}{ "clusterName": autorest.Encode("path", clusterName), "databaseName": autorest.Encode("path", databaseName), @@ -723,7 +722,7 @@ func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupN "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -752,7 +751,7 @@ func (client DatabasesClient) UpdateSender(req *http.Request) (future DatabasesU // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client DatabasesClient) UpdateResponder(resp *http.Response) (result Database, err error) { +func (client DatabasesClient) UpdateResponder(resp *http.Response) (result DatabaseModel, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/dataconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/dataconnections.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/dataconnections.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/dataconnections.go index 7eb86ff682c0d..c12b196c0fab3 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/dataconnections.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/dataconnections.go @@ -98,7 +98,7 @@ func (client DataConnectionsClient) CheckNameAvailabilityPreparer(ctx context.Co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -175,7 +175,7 @@ func (client DataConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -262,7 +262,7 @@ func (client DataConnectionsClient) DataConnectionValidationMethodPreparer(ctx c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -338,7 +338,7 @@ func (client DataConnectionsClient) DeletePreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -423,7 +423,7 @@ func (client DataConnectionsClient) GetPreparer(ctx context.Context, resourceGro "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -501,7 +501,7 @@ func (client DataConnectionsClient) ListByDatabasePreparer(ctx context.Context, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -576,7 +576,7 @@ func (client DataConnectionsClient) UpdatePreparer(ctx context.Context, resource "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/models.go similarity index 56% rename from vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/models.go index 013aac2aa2293..5ab08d809ed6d 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/models.go @@ -28,7 +28,7 @@ import ( ) // The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto" +const fqdn = "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto" // AzureScaleType enumerates the values for azure scale type. type AzureScaleType string @@ -53,6 +53,8 @@ type AzureSkuName string const ( // DevNoSLAStandardD11V2 ... DevNoSLAStandardD11V2 AzureSkuName = "Dev(No SLA)_Standard_D11_v2" + // DevNoSLAStandardE2aV4 ... + DevNoSLAStandardE2aV4 AzureSkuName = "Dev(No SLA)_Standard_E2a_v4" // StandardD11V2 ... StandardD11V2 AzureSkuName = "Standard_D11_v2" // StandardD12V2 ... @@ -69,6 +71,22 @@ const ( StandardDS14V23TBPS AzureSkuName = "Standard_DS14_v2+3TB_PS" // StandardDS14V24TBPS ... StandardDS14V24TBPS AzureSkuName = "Standard_DS14_v2+4TB_PS" + // StandardE16asV43TBPS ... + StandardE16asV43TBPS AzureSkuName = "Standard_E16as_v4+3TB_PS" + // StandardE16asV44TBPS ... + StandardE16asV44TBPS AzureSkuName = "Standard_E16as_v4+4TB_PS" + // StandardE16aV4 ... + StandardE16aV4 AzureSkuName = "Standard_E16a_v4" + // StandardE2aV4 ... + StandardE2aV4 AzureSkuName = "Standard_E2a_v4" + // StandardE4aV4 ... + StandardE4aV4 AzureSkuName = "Standard_E4a_v4" + // StandardE8asV41TBPS ... + StandardE8asV41TBPS AzureSkuName = "Standard_E8as_v4+1TB_PS" + // StandardE8asV42TBPS ... + StandardE8asV42TBPS AzureSkuName = "Standard_E8as_v4+2TB_PS" + // StandardE8aV4 ... + StandardE8aV4 AzureSkuName = "Standard_E8a_v4" // StandardL16s ... StandardL16s AzureSkuName = "Standard_L16s" // StandardL4s ... @@ -79,7 +97,7 @@ const ( // PossibleAzureSkuNameValues returns an array of possible values for the AzureSkuName const type. func PossibleAzureSkuNameValues() []AzureSkuName { - return []AzureSkuName{DevNoSLAStandardD11V2, StandardD11V2, StandardD12V2, StandardD13V2, StandardD14V2, StandardDS13V21TBPS, StandardDS13V22TBPS, StandardDS14V23TBPS, StandardDS14V24TBPS, StandardL16s, StandardL4s, StandardL8s} + return []AzureSkuName{DevNoSLAStandardD11V2, DevNoSLAStandardE2aV4, StandardD11V2, StandardD12V2, StandardD13V2, StandardD14V2, StandardDS13V21TBPS, StandardDS13V22TBPS, StandardDS14V23TBPS, StandardDS14V24TBPS, StandardE16asV43TBPS, StandardE16asV44TBPS, StandardE16aV4, StandardE2aV4, StandardE4aV4, StandardE8asV41TBPS, StandardE8asV42TBPS, StandardE8aV4, StandardL16s, StandardL4s, StandardL8s} } // AzureSkuTier enumerates the values for azure sku tier. @@ -97,6 +115,36 @@ func PossibleAzureSkuTierValues() []AzureSkuTier { return []AzureSkuTier{Basic, Standard} } +// ClusterPrincipalRole enumerates the values for cluster principal role. +type ClusterPrincipalRole string + +const ( + // AllDatabasesAdmin ... + AllDatabasesAdmin ClusterPrincipalRole = "AllDatabasesAdmin" + // AllDatabasesViewer ... + AllDatabasesViewer ClusterPrincipalRole = "AllDatabasesViewer" +) + +// PossibleClusterPrincipalRoleValues returns an array of possible values for the ClusterPrincipalRole const type. +func PossibleClusterPrincipalRoleValues() []ClusterPrincipalRole { + return []ClusterPrincipalRole{AllDatabasesAdmin, AllDatabasesViewer} +} + +// Compression enumerates the values for compression. +type Compression string + +const ( + // CompressionGZip ... + CompressionGZip Compression = "GZip" + // CompressionNone ... + CompressionNone Compression = "None" +) + +// PossibleCompressionValues returns an array of possible values for the Compression const type. +func PossibleCompressionValues() []Compression { + return []Compression{CompressionGZip, CompressionNone} +} + // DatabasePrincipalRole enumerates the values for database principal role. type DatabasePrincipalRole string @@ -137,58 +185,238 @@ func PossibleDatabasePrincipalTypeValues() []DatabasePrincipalType { return []DatabasePrincipalType{DatabasePrincipalTypeApp, DatabasePrincipalTypeGroup, DatabasePrincipalTypeUser} } -// DataFormat enumerates the values for data format. -type DataFormat string +// DefaultPrincipalsModificationKind enumerates the values for default principals modification kind. +type DefaultPrincipalsModificationKind string + +const ( + // DefaultPrincipalsModificationKindNone ... + DefaultPrincipalsModificationKindNone DefaultPrincipalsModificationKind = "None" + // DefaultPrincipalsModificationKindReplace ... + DefaultPrincipalsModificationKindReplace DefaultPrincipalsModificationKind = "Replace" + // DefaultPrincipalsModificationKindUnion ... + DefaultPrincipalsModificationKindUnion DefaultPrincipalsModificationKind = "Union" +) + +// PossibleDefaultPrincipalsModificationKindValues returns an array of possible values for the DefaultPrincipalsModificationKind const type. +func PossibleDefaultPrincipalsModificationKindValues() []DefaultPrincipalsModificationKind { + return []DefaultPrincipalsModificationKind{DefaultPrincipalsModificationKindNone, DefaultPrincipalsModificationKindReplace, DefaultPrincipalsModificationKindUnion} +} + +// EventGridDataFormat enumerates the values for event grid data format. +type EventGridDataFormat string const ( // AVRO ... - AVRO DataFormat = "AVRO" + AVRO EventGridDataFormat = "AVRO" // CSV ... - CSV DataFormat = "CSV" + CSV EventGridDataFormat = "CSV" // JSON ... - JSON DataFormat = "JSON" + JSON EventGridDataFormat = "JSON" // MULTIJSON ... - MULTIJSON DataFormat = "MULTIJSON" + MULTIJSON EventGridDataFormat = "MULTIJSON" + // ORC ... + ORC EventGridDataFormat = "ORC" + // PARQUET ... + PARQUET EventGridDataFormat = "PARQUET" // PSV ... - PSV DataFormat = "PSV" + PSV EventGridDataFormat = "PSV" // RAW ... - RAW DataFormat = "RAW" + RAW EventGridDataFormat = "RAW" // SCSV ... - SCSV DataFormat = "SCSV" + SCSV EventGridDataFormat = "SCSV" // SINGLEJSON ... - SINGLEJSON DataFormat = "SINGLEJSON" + SINGLEJSON EventGridDataFormat = "SINGLEJSON" // SOHSV ... - SOHSV DataFormat = "SOHSV" + SOHSV EventGridDataFormat = "SOHSV" // TSV ... - TSV DataFormat = "TSV" + TSV EventGridDataFormat = "TSV" // TSVE ... - TSVE DataFormat = "TSVE" + TSVE EventGridDataFormat = "TSVE" // TXT ... - TXT DataFormat = "TXT" + TXT EventGridDataFormat = "TXT" +) + +// PossibleEventGridDataFormatValues returns an array of possible values for the EventGridDataFormat const type. +func PossibleEventGridDataFormatValues() []EventGridDataFormat { + return []EventGridDataFormat{AVRO, CSV, JSON, MULTIJSON, ORC, PARQUET, PSV, RAW, SCSV, SINGLEJSON, SOHSV, TSV, TSVE, TXT} +} + +// EventHubDataFormat enumerates the values for event hub data format. +type EventHubDataFormat string + +const ( + // EventHubDataFormatAVRO ... + EventHubDataFormatAVRO EventHubDataFormat = "AVRO" + // EventHubDataFormatCSV ... + EventHubDataFormatCSV EventHubDataFormat = "CSV" + // EventHubDataFormatJSON ... + EventHubDataFormatJSON EventHubDataFormat = "JSON" + // EventHubDataFormatMULTIJSON ... + EventHubDataFormatMULTIJSON EventHubDataFormat = "MULTIJSON" + // EventHubDataFormatORC ... + EventHubDataFormatORC EventHubDataFormat = "ORC" + // EventHubDataFormatPARQUET ... + EventHubDataFormatPARQUET EventHubDataFormat = "PARQUET" + // EventHubDataFormatPSV ... + EventHubDataFormatPSV EventHubDataFormat = "PSV" + // EventHubDataFormatRAW ... + EventHubDataFormatRAW EventHubDataFormat = "RAW" + // EventHubDataFormatSCSV ... + EventHubDataFormatSCSV EventHubDataFormat = "SCSV" + // EventHubDataFormatSINGLEJSON ... + EventHubDataFormatSINGLEJSON EventHubDataFormat = "SINGLEJSON" + // EventHubDataFormatSOHSV ... + EventHubDataFormatSOHSV EventHubDataFormat = "SOHSV" + // EventHubDataFormatTSV ... + EventHubDataFormatTSV EventHubDataFormat = "TSV" + // EventHubDataFormatTSVE ... + EventHubDataFormatTSVE EventHubDataFormat = "TSVE" + // EventHubDataFormatTXT ... + EventHubDataFormatTXT EventHubDataFormat = "TXT" +) + +// PossibleEventHubDataFormatValues returns an array of possible values for the EventHubDataFormat const type. +func PossibleEventHubDataFormatValues() []EventHubDataFormat { + return []EventHubDataFormat{EventHubDataFormatAVRO, EventHubDataFormatCSV, EventHubDataFormatJSON, EventHubDataFormatMULTIJSON, EventHubDataFormatORC, EventHubDataFormatPARQUET, EventHubDataFormatPSV, EventHubDataFormatRAW, EventHubDataFormatSCSV, EventHubDataFormatSINGLEJSON, EventHubDataFormatSOHSV, EventHubDataFormatTSV, EventHubDataFormatTSVE, EventHubDataFormatTXT} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // IdentityTypeNone ... + IdentityTypeNone IdentityType = "None" + // IdentityTypeSystemAssigned ... + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned} +} + +// IotHubDataFormat enumerates the values for iot hub data format. +type IotHubDataFormat string + +const ( + // IotHubDataFormatAVRO ... + IotHubDataFormatAVRO IotHubDataFormat = "AVRO" + // IotHubDataFormatCSV ... + IotHubDataFormatCSV IotHubDataFormat = "CSV" + // IotHubDataFormatJSON ... + IotHubDataFormatJSON IotHubDataFormat = "JSON" + // IotHubDataFormatMULTIJSON ... + IotHubDataFormatMULTIJSON IotHubDataFormat = "MULTIJSON" + // IotHubDataFormatORC ... + IotHubDataFormatORC IotHubDataFormat = "ORC" + // IotHubDataFormatPARQUET ... + IotHubDataFormatPARQUET IotHubDataFormat = "PARQUET" + // IotHubDataFormatPSV ... + IotHubDataFormatPSV IotHubDataFormat = "PSV" + // IotHubDataFormatRAW ... + IotHubDataFormatRAW IotHubDataFormat = "RAW" + // IotHubDataFormatSCSV ... + IotHubDataFormatSCSV IotHubDataFormat = "SCSV" + // IotHubDataFormatSINGLEJSON ... + IotHubDataFormatSINGLEJSON IotHubDataFormat = "SINGLEJSON" + // IotHubDataFormatSOHSV ... + IotHubDataFormatSOHSV IotHubDataFormat = "SOHSV" + // IotHubDataFormatTSV ... + IotHubDataFormatTSV IotHubDataFormat = "TSV" + // IotHubDataFormatTSVE ... + IotHubDataFormatTSVE IotHubDataFormat = "TSVE" + // IotHubDataFormatTXT ... + IotHubDataFormatTXT IotHubDataFormat = "TXT" ) -// PossibleDataFormatValues returns an array of possible values for the DataFormat const type. -func PossibleDataFormatValues() []DataFormat { - return []DataFormat{AVRO, CSV, JSON, MULTIJSON, PSV, RAW, SCSV, SINGLEJSON, SOHSV, TSV, TSVE, TXT} +// PossibleIotHubDataFormatValues returns an array of possible values for the IotHubDataFormat const type. +func PossibleIotHubDataFormatValues() []IotHubDataFormat { + return []IotHubDataFormat{IotHubDataFormatAVRO, IotHubDataFormatCSV, IotHubDataFormatJSON, IotHubDataFormatMULTIJSON, IotHubDataFormatORC, IotHubDataFormatPARQUET, IotHubDataFormatPSV, IotHubDataFormatRAW, IotHubDataFormatSCSV, IotHubDataFormatSINGLEJSON, IotHubDataFormatSOHSV, IotHubDataFormatTSV, IotHubDataFormatTSVE, IotHubDataFormatTXT} } // Kind enumerates the values for kind. type Kind string +const ( + // KindDatabase ... + KindDatabase Kind = "Database" + // KindReadOnlyFollowing ... + KindReadOnlyFollowing Kind = "ReadOnlyFollowing" + // KindReadWrite ... + KindReadWrite Kind = "ReadWrite" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{KindDatabase, KindReadOnlyFollowing, KindReadWrite} +} + +// KindBasicDataConnection enumerates the values for kind basic data connection. +type KindBasicDataConnection string + const ( // KindDataConnection ... - KindDataConnection Kind = "DataConnection" + KindDataConnection KindBasicDataConnection = "DataConnection" // KindEventGrid ... - KindEventGrid Kind = "EventGrid" + KindEventGrid KindBasicDataConnection = "EventGrid" // KindEventHub ... - KindEventHub Kind = "EventHub" + KindEventHub KindBasicDataConnection = "EventHub" // KindIotHub ... - KindIotHub Kind = "IotHub" + KindIotHub KindBasicDataConnection = "IotHub" ) -// PossibleKindValues returns an array of possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{KindDataConnection, KindEventGrid, KindEventHub, KindIotHub} +// PossibleKindBasicDataConnectionValues returns an array of possible values for the KindBasicDataConnection const type. +func PossibleKindBasicDataConnectionValues() []KindBasicDataConnection { + return []KindBasicDataConnection{KindDataConnection, KindEventGrid, KindEventHub, KindIotHub} +} + +// LanguageExtensionName enumerates the values for language extension name. +type LanguageExtensionName string + +const ( + // PYTHON ... + PYTHON LanguageExtensionName = "PYTHON" + // R ... + R LanguageExtensionName = "R" +) + +// PossibleLanguageExtensionNameValues returns an array of possible values for the LanguageExtensionName const type. +func PossibleLanguageExtensionNameValues() []LanguageExtensionName { + return []LanguageExtensionName{PYTHON, R} +} + +// PrincipalsModificationKind enumerates the values for principals modification kind. +type PrincipalsModificationKind string + +const ( + // PrincipalsModificationKindNone ... + PrincipalsModificationKindNone PrincipalsModificationKind = "None" + // PrincipalsModificationKindReplace ... + PrincipalsModificationKindReplace PrincipalsModificationKind = "Replace" + // PrincipalsModificationKindUnion ... + PrincipalsModificationKindUnion PrincipalsModificationKind = "Union" +) + +// PossiblePrincipalsModificationKindValues returns an array of possible values for the PrincipalsModificationKind const type. +func PossiblePrincipalsModificationKindValues() []PrincipalsModificationKind { + return []PrincipalsModificationKind{PrincipalsModificationKindNone, PrincipalsModificationKindReplace, PrincipalsModificationKindUnion} +} + +// PrincipalType enumerates the values for principal type. +type PrincipalType string + +const ( + // PrincipalTypeApp ... + PrincipalTypeApp PrincipalType = "App" + // PrincipalTypeGroup ... + PrincipalTypeGroup PrincipalType = "Group" + // PrincipalTypeUser ... + PrincipalTypeUser PrincipalType = "User" +) + +// PossiblePrincipalTypeValues returns an array of possible values for the PrincipalType const type. +func PossiblePrincipalTypeValues() []PrincipalType { + return []PrincipalType{PrincipalTypeApp, PrincipalTypeGroup, PrincipalTypeUser} } // ProvisioningState enumerates the values for provisioning state. @@ -258,6 +486,182 @@ func PossibleStateValues() []State { return []State{StateCreating, StateDeleted, StateDeleting, StateRunning, StateStarting, StateStopped, StateStopping, StateUnavailable, StateUpdating} } +// Type enumerates the values for type. +type Type string + +const ( + // MicrosoftKustoclustersattachedDatabaseConfigurations ... + MicrosoftKustoclustersattachedDatabaseConfigurations Type = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" + // MicrosoftKustoclustersdatabases ... + MicrosoftKustoclustersdatabases Type = "Microsoft.Kusto/clusters/databases" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{MicrosoftKustoclustersattachedDatabaseConfigurations, MicrosoftKustoclustersdatabases} +} + +// AttachedDatabaseConfiguration class representing an attached database configuration. +type AttachedDatabaseConfiguration struct { + autorest.Response `json:"-"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // AttachedDatabaseConfigurationProperties - The properties of the attached database configuration. + *AttachedDatabaseConfigurationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AttachedDatabaseConfiguration. +func (adc AttachedDatabaseConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adc.Location != nil { + objectMap["location"] = adc.Location + } + if adc.AttachedDatabaseConfigurationProperties != nil { + objectMap["properties"] = adc.AttachedDatabaseConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AttachedDatabaseConfiguration struct. +func (adc *AttachedDatabaseConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + adc.Location = &location + } + case "properties": + if v != nil { + var attachedDatabaseConfigurationProperties AttachedDatabaseConfigurationProperties + err = json.Unmarshal(*v, &attachedDatabaseConfigurationProperties) + if err != nil { + return err + } + adc.AttachedDatabaseConfigurationProperties = &attachedDatabaseConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + adc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + adc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + adc.Type = &typeVar + } + } + } + + return nil +} + +// AttachedDatabaseConfigurationListResult the list attached database configurations operation response. +type AttachedDatabaseConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - The list of attached database configurations. + Value *[]AttachedDatabaseConfiguration `json:"value,omitempty"` +} + +// AttachedDatabaseConfigurationProperties class representing the an attached database configuration +// properties of kind specific. +type AttachedDatabaseConfigurationProperties struct { + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // DatabaseName - The name of the database which you would like to attach, use * if you want to follow all current and future databases. + DatabaseName *string `json:"databaseName,omitempty"` + // ClusterResourceID - The resource id of the cluster where the databases you would like to attach reside. + ClusterResourceID *string `json:"clusterResourceId,omitempty"` + // AttachedDatabaseNames - READ-ONLY; The list of databases from the clusterResourceId which are currently attached to the cluster. + AttachedDatabaseNames *[]string `json:"attachedDatabaseNames,omitempty"` + // DefaultPrincipalsModificationKind - The default principals modification kind. Possible values include: 'DefaultPrincipalsModificationKindUnion', 'DefaultPrincipalsModificationKindReplace', 'DefaultPrincipalsModificationKindNone' + DefaultPrincipalsModificationKind DefaultPrincipalsModificationKind `json:"defaultPrincipalsModificationKind,omitempty"` +} + +// AttachedDatabaseConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type AttachedDatabaseConfigurationsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *AttachedDatabaseConfigurationsCreateOrUpdateFuture) Result(client AttachedDatabaseConfigurationsClient) (adc AttachedDatabaseConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if adc.Response.Response, err = future.GetResult(sender); err == nil && adc.Response.Response.StatusCode != http.StatusNoContent { + adc, err = client.CreateOrUpdateResponder(adc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture", "Result", adc.Response.Response, "Failure responding to request") + } + } + return +} + +// AttachedDatabaseConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AttachedDatabaseConfigurationsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *AttachedDatabaseConfigurationsDeleteFuture) Result(client AttachedDatabaseConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.AttachedDatabaseConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + // AzureCapacity azure capacity definition. type AzureCapacity struct { // ScaleType - Scale type. Possible values include: 'Automatic', 'Manual', 'None' @@ -294,7 +698,7 @@ type AzureResourceSku struct { // AzureSku azure SKU definition. type AzureSku struct { - // Name - SKU name. Possible values include: 'StandardDS13V21TBPS', 'StandardDS13V22TBPS', 'StandardDS14V23TBPS', 'StandardDS14V24TBPS', 'StandardD13V2', 'StandardD14V2', 'StandardL8s', 'StandardL16s', 'StandardD11V2', 'StandardD12V2', 'StandardL4s', 'DevNoSLAStandardD11V2' + // Name - SKU name. Possible values include: 'StandardDS13V21TBPS', 'StandardDS13V22TBPS', 'StandardDS14V23TBPS', 'StandardDS14V24TBPS', 'StandardD13V2', 'StandardD14V2', 'StandardL8s', 'StandardL16s', 'StandardD11V2', 'StandardD12V2', 'StandardL4s', 'DevNoSLAStandardD11V2', 'StandardE2aV4', 'StandardE4aV4', 'StandardE8aV4', 'StandardE16aV4', 'StandardE8asV41TBPS', 'StandardE8asV42TBPS', 'StandardE16asV43TBPS', 'StandardE16asV44TBPS', 'DevNoSLAStandardE2aV4' Name AzureSkuName `json:"name,omitempty"` // Capacity - The number of instances of the cluster. Capacity *int32 `json:"capacity,omitempty"` @@ -302,6 +706,14 @@ type AzureSku struct { Tier AzureSkuTier `json:"tier,omitempty"` } +// CheckNameRequest the result returned from a database check name availability request. +type CheckNameRequest struct { + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, for instance Microsoft.Kusto/clusters/databases. Possible values include: 'MicrosoftKustoclustersdatabases', 'MicrosoftKustoclustersattachedDatabaseConfigurations' + Type Type `json:"type,omitempty"` +} + // CheckNameResult the result returned from a check name availability request. type CheckNameResult struct { autorest.Response `json:"-"` @@ -340,6 +752,8 @@ type Cluster struct { Sku *AzureSku `json:"sku,omitempty"` // Zones - The availability zones of the cluster. Zones *[]string `json:"zones,omitempty"` + // Identity - The identity of the cluster, if configured. + Identity *Identity `json:"identity,omitempty"` // ClusterProperties - The cluster properties. *ClusterProperties `json:"properties,omitempty"` // Tags - Resource tags. @@ -363,6 +777,9 @@ func (c Cluster) MarshalJSON() ([]byte, error) { if c.Zones != nil { objectMap["zones"] = c.Zones } + if c.Identity != nil { + objectMap["identity"] = c.Identity + } if c.ClusterProperties != nil { objectMap["properties"] = c.ClusterProperties } @@ -402,6 +819,15 @@ func (c *Cluster) UnmarshalJSON(body []byte) error { } c.Zones = &zones } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + c.Identity = &identity + } case "properties": if v != nil { var clusterProperties ClusterProperties @@ -477,65 +903,254 @@ type ClusterListResult struct { Value *[]Cluster `json:"value,omitempty"` } -// ClusterProperties class representing the Kusto cluster properties. -type ClusterProperties struct { - // State - READ-ONLY; The state of the resource. Possible values include: 'StateCreating', 'StateUnavailable', 'StateRunning', 'StateDeleting', 'StateDeleted', 'StateStopping', 'StateStopped', 'StateStarting', 'StateUpdating' - State State `json:"state,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // URI - READ-ONLY; The cluster URI. - URI *string `json:"uri,omitempty"` - // DataIngestionURI - READ-ONLY; The cluster data ingestion URI. - DataIngestionURI *string `json:"dataIngestionUri,omitempty"` - // TrustedExternalTenants - The cluster's external tenants. - TrustedExternalTenants *[]TrustedExternalTenant `json:"trustedExternalTenants,omitempty"` - // OptimizedAutoscale - Optimized auto scale definition. - OptimizedAutoscale *OptimizedAutoscale `json:"optimizedAutoscale,omitempty"` - // EnableDiskEncryption - A boolean value that indicates if the cluster's disks are encrypted. - EnableDiskEncryption *bool `json:"enableDiskEncryption,omitempty"` - // EnableStreamingIngest - A boolean value that indicates if the streaming ingest is enabled. - EnableStreamingIngest *bool `json:"enableStreamingIngest,omitempty"` - // VirtualNetworkConfiguration - Virtual network definition. - VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` +// ClusterPrincipalAssignment class representing a cluster principal assignment. +type ClusterPrincipalAssignment struct { + autorest.Response `json:"-"` + // ClusterPrincipalProperties - The cluster principal. + *ClusterPrincipalProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` } -// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ClustersCreateOrUpdateFuture struct { - azure.Future +// MarshalJSON is the custom marshaler for ClusterPrincipalAssignment. +func (cpa ClusterPrincipalAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cpa.ClusterPrincipalProperties != nil { + objectMap["properties"] = cpa.ClusterPrincipalProperties + } + return json.Marshal(objectMap) } -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *ClustersCreateOrUpdateFuture) Result(client ClustersClient) (c Cluster, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) +// UnmarshalJSON is the custom unmarshaler for ClusterPrincipalAssignment struct. +func (cpa *ClusterPrincipalAssignment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("kusto.ClustersCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { - c, err = client.CreateOrUpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } + return err } - return -} - -// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ClustersDeleteFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. + for k, v := range m { + switch k { + case "properties": + if v != nil { + var clusterPrincipalProperties ClusterPrincipalProperties + err = json.Unmarshal(*v, &clusterPrincipalProperties) + if err != nil { + return err + } + cpa.ClusterPrincipalProperties = &clusterPrincipalProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cpa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cpa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cpa.Type = &typeVar + } + } + } + + return nil +} + +// ClusterPrincipalAssignmentCheckNameRequest a principal assignment check name availability request. +type ClusterPrincipalAssignmentCheckNameRequest struct { + // Name - Principal Assignment resource name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, Microsoft.Kusto/clusters/principalAssignments. + Type *string `json:"type,omitempty"` +} + +// ClusterPrincipalAssignmentListResult the list Kusto cluster principal assignments operation response. +type ClusterPrincipalAssignmentListResult struct { + autorest.Response `json:"-"` + // Value - The list of Kusto cluster principal assignments. + Value *[]ClusterPrincipalAssignment `json:"value,omitempty"` +} + +// ClusterPrincipalAssignmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ClusterPrincipalAssignmentsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClusterPrincipalAssignmentsCreateOrUpdateFuture) Result(client ClusterPrincipalAssignmentsClient) (cpa ClusterPrincipalAssignment, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.ClusterPrincipalAssignmentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cpa.Response.Response, err = future.GetResult(sender); err == nil && cpa.Response.Response.StatusCode != http.StatusNoContent { + cpa, err = client.CreateOrUpdateResponder(cpa.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsCreateOrUpdateFuture", "Result", cpa.Response.Response, "Failure responding to request") + } + } + return +} + +// ClusterPrincipalAssignmentsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClusterPrincipalAssignmentsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClusterPrincipalAssignmentsDeleteFuture) Result(client ClusterPrincipalAssignmentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClusterPrincipalAssignmentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.ClusterPrincipalAssignmentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ClusterPrincipalProperties a class representing cluster principal property. +type ClusterPrincipalProperties struct { + // PrincipalID - The principal ID assigned to the cluster principal. It can be a user email, application ID, or security group name. + PrincipalID *string `json:"principalId,omitempty"` + // Role - Cluster principal role. Possible values include: 'AllDatabasesAdmin', 'AllDatabasesViewer' + Role ClusterPrincipalRole `json:"role,omitempty"` + // TenantID - The tenant id of the principal + TenantID *string `json:"tenantId,omitempty"` + // PrincipalType - Principal type. Possible values include: 'PrincipalTypeApp', 'PrincipalTypeGroup', 'PrincipalTypeUser' + PrincipalType PrincipalType `json:"principalType,omitempty"` + // TenantName - READ-ONLY; The tenant name of the principal + TenantName *string `json:"tenantName,omitempty"` + // PrincipalName - READ-ONLY; The principal name + PrincipalName *string `json:"principalName,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// ClusterProperties class representing the Kusto cluster properties. +type ClusterProperties struct { + // State - READ-ONLY; The state of the resource. Possible values include: 'StateCreating', 'StateUnavailable', 'StateRunning', 'StateDeleting', 'StateDeleted', 'StateStopping', 'StateStopped', 'StateStarting', 'StateUpdating' + State State `json:"state,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // URI - READ-ONLY; The cluster URI. + URI *string `json:"uri,omitempty"` + // DataIngestionURI - READ-ONLY; The cluster data ingestion URI. + DataIngestionURI *string `json:"dataIngestionUri,omitempty"` + // StateReason - READ-ONLY; The reason for the cluster's current state. + StateReason *string `json:"stateReason,omitempty"` + // TrustedExternalTenants - The cluster's external tenants. + TrustedExternalTenants *[]TrustedExternalTenant `json:"trustedExternalTenants,omitempty"` + // OptimizedAutoscale - Optimized auto scale definition. + OptimizedAutoscale *OptimizedAutoscale `json:"optimizedAutoscale,omitempty"` + // EnableDiskEncryption - A boolean value that indicates if the cluster's disks are encrypted. + EnableDiskEncryption *bool `json:"enableDiskEncryption,omitempty"` + // EnableStreamingIngest - A boolean value that indicates if the streaming ingest is enabled. + EnableStreamingIngest *bool `json:"enableStreamingIngest,omitempty"` + // VirtualNetworkConfiguration - Virtual network definition. + VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` + // KeyVaultProperties - KeyVault properties for the cluster encryption. + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` + // EnablePurge - A boolean value that indicates if the purge operations are enabled. + EnablePurge *bool `json:"enablePurge,omitempty"` + // LanguageExtensions - List of the cluster's language extensions. + LanguageExtensions *LanguageExtensionsList `json:"languageExtensions,omitempty"` +} + +// ClustersAddLanguageExtensionsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersAddLanguageExtensionsFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersAddLanguageExtensionsFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersAddLanguageExtensionsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.ClustersAddLanguageExtensionsFuture") + return + } + ar.Response = future.Response() + return +} + +// ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ClustersCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersCreateOrUpdateFuture) Result(client ClustersClient) (c Cluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.ClustersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { + c, err = client.CreateOrUpdateResponder(c.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") + } + } + return +} + +// ClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ClustersDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. func (future *ClustersDeleteFuture) Result(client ClustersClient) (ar autorest.Response, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) @@ -551,6 +1166,81 @@ func (future *ClustersDeleteFuture) Result(client ClustersClient) (ar autorest.R return } +// ClustersDetachFollowerDatabasesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersDetachFollowerDatabasesFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersDetachFollowerDatabasesFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersDetachFollowerDatabasesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.ClustersDetachFollowerDatabasesFuture") + return + } + ar.Response = future.Response() + return +} + +// ClustersDiagnoseVirtualNetworkFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersDiagnoseVirtualNetworkFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersDiagnoseVirtualNetworkFuture) Result(client ClustersClient) (dvnr DiagnoseVirtualNetworkResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersDiagnoseVirtualNetworkFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.ClustersDiagnoseVirtualNetworkFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dvnr.Response.Response, err = future.GetResult(sender); err == nil && dvnr.Response.Response.StatusCode != http.StatusNoContent { + dvnr, err = client.DiagnoseVirtualNetworkResponder(dvnr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersDiagnoseVirtualNetworkFuture", "Result", dvnr.Response.Response, "Failure responding to request") + } + } + return +} + +// ClustersRemoveLanguageExtensionsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersRemoveLanguageExtensionsFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersRemoveLanguageExtensionsFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersRemoveLanguageExtensionsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.ClustersRemoveLanguageExtensionsFuture") + return + } + ar.Response = future.Response() + return +} + // ClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type ClustersStartFuture struct { @@ -633,6 +1323,8 @@ type ClusterUpdate struct { Location *string `json:"location,omitempty"` // Sku - The SKU of the cluster. Sku *AzureSku `json:"sku,omitempty"` + // Identity - The identity of the cluster, if configured. + Identity *Identity `json:"identity,omitempty"` // ClusterProperties - The cluster properties. *ClusterProperties `json:"properties,omitempty"` // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -655,6 +1347,9 @@ func (cu ClusterUpdate) MarshalJSON() ([]byte, error) { if cu.Sku != nil { objectMap["sku"] = cu.Sku } + if cu.Identity != nil { + objectMap["identity"] = cu.Identity + } if cu.ClusterProperties != nil { objectMap["properties"] = cu.ClusterProperties } @@ -697,6 +1392,15 @@ func (cu *ClusterUpdate) UnmarshalJSON(body []byte) error { } cu.Sku = &sku } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + cu.Identity = &identity + } case "properties": if v != nil { var clusterProperties ClusterProperties @@ -739,13 +1443,20 @@ func (cu *ClusterUpdate) UnmarshalJSON(body []byte) error { return nil } +// BasicDatabase class representing a Kusto database. +type BasicDatabase interface { + AsReadWriteDatabase() (*ReadWriteDatabase, bool) + AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) + AsDatabase() (*Database, bool) +} + // Database class representing a Kusto database. type Database struct { autorest.Response `json:"-"` // Location - Resource location. Location *string `json:"location,omitempty"` - // DatabaseProperties - The database properties. - *DatabaseProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' + Kind Kind `json:"kind,omitempty"` // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty"` // Name - READ-ONLY; The name of the resource @@ -754,20 +1465,89 @@ type Database struct { Type *string `json:"type,omitempty"` } +func unmarshalBasicDatabase(body []byte) (BasicDatabase, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindReadWrite): + var rwd ReadWriteDatabase + err := json.Unmarshal(body, &rwd) + return rwd, err + case string(KindReadOnlyFollowing): + var rofd ReadOnlyFollowingDatabase + err := json.Unmarshal(body, &rofd) + return rofd, err + default: + var d Database + err := json.Unmarshal(body, &d) + return d, err + } +} +func unmarshalBasicDatabaseArray(body []byte) ([]BasicDatabase, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dArray := make([]BasicDatabase, len(rawMessages)) + + for index, rawMessage := range rawMessages { + d, err := unmarshalBasicDatabase(*rawMessage) + if err != nil { + return nil, err + } + dArray[index] = d + } + return dArray, nil +} + // MarshalJSON is the custom marshaler for Database. func (d Database) MarshalJSON() ([]byte, error) { + d.Kind = KindDatabase objectMap := make(map[string]interface{}) if d.Location != nil { objectMap["location"] = d.Location } - if d.DatabaseProperties != nil { - objectMap["properties"] = d.DatabaseProperties + if d.Kind != "" { + objectMap["kind"] = d.Kind } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for Database struct. -func (d *Database) UnmarshalJSON(body []byte) error { +// AsReadWriteDatabase is the BasicDatabase implementation for Database. +func (d Database) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { + return nil, false +} + +// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for Database. +func (d Database) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { + return nil, false +} + +// AsDatabase is the BasicDatabase implementation for Database. +func (d Database) AsDatabase() (*Database, bool) { + return &d, true +} + +// AsBasicDatabase is the BasicDatabase implementation for Database. +func (d Database) AsBasicDatabase() (BasicDatabase, bool) { + return &d, true +} + +// DatabaseListResult the list Kusto databases operation response. +type DatabaseListResult struct { + autorest.Response `json:"-"` + // Value - The list of Kusto databases. + Value *[]BasicDatabase `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DatabaseListResult struct. +func (dlr *DatabaseListResult) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -775,23 +1555,94 @@ func (d *Database) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "location": + case "value": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + value, err := unmarshalBasicDatabaseArray(*v) if err != nil { return err } - d.Location = &location + dlr.Value = &value } + } + } + + return nil +} + +// DatabaseModel ... +type DatabaseModel struct { + autorest.Response `json:"-"` + Value BasicDatabase `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DatabaseModel struct. +func (dm *DatabaseModel) UnmarshalJSON(body []byte) error { + d, err := unmarshalBasicDatabase(body) + if err != nil { + return err + } + dm.Value = d + + return nil +} + +// DatabasePrincipal a class representing database principal entity. +type DatabasePrincipal struct { + // Role - Database principal role. Possible values include: 'Admin', 'Ingestor', 'Monitor', 'User', 'UnrestrictedViewers', 'Viewer' + Role DatabasePrincipalRole `json:"role,omitempty"` + // Name - Database principal name. + Name *string `json:"name,omitempty"` + // Type - Database principal type. Possible values include: 'DatabasePrincipalTypeApp', 'DatabasePrincipalTypeGroup', 'DatabasePrincipalTypeUser' + Type DatabasePrincipalType `json:"type,omitempty"` + // Fqn - Database principal fully qualified name. + Fqn *string `json:"fqn,omitempty"` + // Email - Database principal email if exists. + Email *string `json:"email,omitempty"` + // AppID - Application id - relevant only for application principal type. + AppID *string `json:"appId,omitempty"` + // TenantName - READ-ONLY; The tenant name of the principal + TenantName *string `json:"tenantName,omitempty"` +} + +// DatabasePrincipalAssignment class representing a database principal assignment. +type DatabasePrincipalAssignment struct { + autorest.Response `json:"-"` + // DatabasePrincipalProperties - The database principal. + *DatabasePrincipalProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DatabasePrincipalAssignment. +func (dpa DatabasePrincipalAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpa.DatabasePrincipalProperties != nil { + objectMap["properties"] = dpa.DatabasePrincipalProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DatabasePrincipalAssignment struct. +func (dpa *DatabasePrincipalAssignment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { case "properties": if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) + var databasePrincipalProperties DatabasePrincipalProperties + err = json.Unmarshal(*v, &databasePrincipalProperties) if err != nil { return err } - d.DatabaseProperties = &databaseProperties + dpa.DatabasePrincipalProperties = &databasePrincipalProperties } case "id": if v != nil { @@ -800,7 +1651,7 @@ func (d *Database) UnmarshalJSON(body []byte) error { if err != nil { return err } - d.ID = &ID + dpa.ID = &ID } case "name": if v != nil { @@ -809,7 +1660,7 @@ func (d *Database) UnmarshalJSON(body []byte) error { if err != nil { return err } - d.Name = &name + dpa.Name = &name } case "type": if v != nil { @@ -818,7 +1669,7 @@ func (d *Database) UnmarshalJSON(body []byte) error { if err != nil { return err } - d.Type = &typeVar + dpa.Type = &typeVar } } } @@ -826,235 +1677,189 @@ func (d *Database) UnmarshalJSON(body []byte) error { return nil } -// DatabaseCheckNameRequest the result returned from a database check name availability request. -type DatabaseCheckNameRequest struct { - // Name - Database name. +// DatabasePrincipalAssignmentCheckNameRequest a principal assignment check name availability request. +type DatabasePrincipalAssignmentCheckNameRequest struct { + // Name - Principal Assignment resource name. Name *string `json:"name,omitempty"` - // Type - The type of resource, Microsoft.Kusto/clusters/databases. + // Type - The type of resource, Microsoft.Kusto/clusters/databases/principalAssignments. Type *string `json:"type,omitempty"` } -// DatabaseListResult the list Kusto databases operation response. -type DatabaseListResult struct { +// DatabasePrincipalAssignmentListResult the list Kusto database principal assignments operation response. +type DatabasePrincipalAssignmentListResult struct { autorest.Response `json:"-"` - // Value - The list of Kusto databases. - Value *[]Database `json:"value,omitempty"` + // Value - The list of Kusto database principal assignments. + Value *[]DatabasePrincipalAssignment `json:"value,omitempty"` } -// DatabasePrincipal a class representing database principal entity. -type DatabasePrincipal struct { - // Role - Database principal role. Possible values include: 'Admin', 'Ingestor', 'Monitor', 'User', 'UnrestrictedViewers', 'Viewer' - Role DatabasePrincipalRole `json:"role,omitempty"` - // Name - Database principal name. - Name *string `json:"name,omitempty"` - // Type - Database principal type. Possible values include: 'DatabasePrincipalTypeApp', 'DatabasePrincipalTypeGroup', 'DatabasePrincipalTypeUser' - Type DatabasePrincipalType `json:"type,omitempty"` - // Fqn - Database principal fully qualified name. - Fqn *string `json:"fqn,omitempty"` - // Email - Database principal email if exists. - Email *string `json:"email,omitempty"` - // AppID - Application id - relevant only for application principal type. - AppID *string `json:"appId,omitempty"` - // TenantName - READ-ONLY; The tenant name of the principal - TenantName *string `json:"tenantName,omitempty"` -} - -// DatabasePrincipalListRequest the list Kusto database principals operation request. -type DatabasePrincipalListRequest struct { - // Value - The list of Kusto database principals. - Value *[]DatabasePrincipal `json:"value,omitempty"` -} - -// DatabasePrincipalListResult the list Kusto database principals operation response. -type DatabasePrincipalListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto database principals. - Value *[]DatabasePrincipal `json:"value,omitempty"` -} - -// DatabaseProperties class representing the Kusto database properties. -type DatabaseProperties struct { - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // SoftDeletePeriod - The time the data should be kept before it stops being accessible to queries in TimeSpan. - SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` - // HotCachePeriod - The time the data should be kept in cache for fast queries in TimeSpan. - HotCachePeriod *string `json:"hotCachePeriod,omitempty"` - // Statistics - The statistics of the database. - Statistics *DatabaseStatistics `json:"statistics,omitempty"` -} - -// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesCreateOrUpdateFuture struct { +// DatabasePrincipalAssignmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type DatabasePrincipalAssignmentsCreateOrUpdateFuture struct { azure.Future } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) { +func (future *DatabasePrincipalAssignmentsCreateOrUpdateFuture) Result(client DatabasePrincipalAssignmentsClient) (dpa DatabasePrincipalAssignment, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - err = azure.NewAsyncOpIncompleteError("kusto.DatabasesCreateOrUpdateFuture") + err = azure.NewAsyncOpIncompleteError("kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) + if dpa.Response.Response, err = future.GetResult(sender); err == nil && dpa.Response.Response.StatusCode != http.StatusNoContent { + dpa, err = client.CreateOrUpdateResponder(dpa.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture", "Result", dpa.Response.Response, "Failure responding to request") } } return } -// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesDeleteFuture struct { +// DatabasePrincipalAssignmentsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DatabasePrincipalAssignmentsDeleteFuture struct { azure.Future } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *DatabasesDeleteFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { +func (future *DatabasePrincipalAssignmentsDeleteFuture) Result(client DatabasePrincipalAssignmentsClient) (ar autorest.Response, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "kusto.DatabasePrincipalAssignmentsDeleteFuture", "Result", future.Response(), "Polling failure") return } if !done { - err = azure.NewAsyncOpIncompleteError("kusto.DatabasesDeleteFuture") + err = azure.NewAsyncOpIncompleteError("kusto.DatabasePrincipalAssignmentsDeleteFuture") return } ar.Response = future.Response() return } -// DatabaseStatistics a class that contains database statistics information. -type DatabaseStatistics struct { - // Size - The database size - the total size of compressed data and index in bytes. - Size *float64 `json:"size,omitempty"` +// DatabasePrincipalListRequest the list Kusto database principals operation request. +type DatabasePrincipalListRequest struct { + // Value - The list of Kusto database principals. + Value *[]DatabasePrincipal `json:"value,omitempty"` } -// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// DatabasePrincipalListResult the list Kusto database principals operation response. +type DatabasePrincipalListResult struct { + autorest.Response `json:"-"` + // Value - The list of Kusto database principals. + Value *[]DatabasePrincipal `json:"value,omitempty"` +} + +// DatabasePrincipalProperties a class representing database principal property. +type DatabasePrincipalProperties struct { + // PrincipalID - The principal ID assigned to the database principal. It can be a user email, application ID, or security group name. + PrincipalID *string `json:"principalId,omitempty"` + // Role - Database principal role. Possible values include: 'Admin', 'Ingestor', 'Monitor', 'User', 'UnrestrictedViewers', 'Viewer' + Role DatabasePrincipalRole `json:"role,omitempty"` + // TenantID - The tenant id of the principal + TenantID *string `json:"tenantId,omitempty"` + // PrincipalType - Principal type. Possible values include: 'PrincipalTypeApp', 'PrincipalTypeGroup', 'PrincipalTypeUser' + PrincipalType PrincipalType `json:"principalType,omitempty"` + // TenantName - READ-ONLY; The tenant name of the principal + TenantName *string `json:"tenantName,omitempty"` + // PrincipalName - READ-ONLY; The principal name + PrincipalName *string `json:"principalName,omitempty"` + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. -type DatabasesUpdateFuture struct { +type DatabasesCreateOrUpdateFuture struct { azure.Future } // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *DatabasesUpdateFuture) Result(client DatabasesClient) (d Database, err error) { +func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (dm DatabaseModel, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") + err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") return } if !done { - err = azure.NewAsyncOpIncompleteError("kusto.DatabasesUpdateFuture") + err = azure.NewAsyncOpIncompleteError("kusto.DatabasesCreateOrUpdateFuture") return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) + if dm.Response.Response, err = future.GetResult(sender); err == nil && dm.Response.Response.StatusCode != http.StatusNoContent { + dm, err = client.CreateOrUpdateResponder(dm.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", dm.Response.Response, "Failure responding to request") } } return } -// DatabaseUpdate class representing an update to a Kusto database. -type DatabaseUpdate struct { - // Location - Resource location. - Location *string `json:"location,omitempty"` - // DatabaseProperties - The properties of the updated database. - *DatabaseProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabaseUpdate. -func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if du.Location != nil { - objectMap["location"] = du.Location - } - if du.DatabaseProperties != nil { - objectMap["properties"] = du.DatabaseProperties - } - return json.Marshal(objectMap) +// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabasesDeleteFuture struct { + azure.Future } -// UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct. -func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DatabasesDeleteFuture) Result(client DatabasesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) if err != nil { - return err + err = autorest.NewErrorWithError(err, "kusto.DatabasesDeleteFuture", "Result", future.Response(), "Polling failure") + return } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - du.Location = &location - } - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - du.DatabaseProperties = &databaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - du.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - du.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - du.Type = &typeVar - } - } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.DatabasesDeleteFuture") + return } + ar.Response = future.Response() + return +} - return nil +// DatabaseStatistics a class that contains database statistics information. +type DatabaseStatistics struct { + // Size - The database size - the total size of compressed data and index in bytes. + Size *float64 `json:"size,omitempty"` +} + +// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DatabasesUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DatabasesUpdateFuture) Result(client DatabasesClient) (dm DatabaseModel, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.DatabasesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dm.Response.Response, err = future.GetResult(sender); err == nil && dm.Response.Response.StatusCode != http.StatusNoContent { + dm, err = client.UpdateResponder(dm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", dm.Response.Response, "Failure responding to request") + } + } + return } // BasicDataConnection class representing an data connection. @@ -1071,7 +1876,7 @@ type DataConnection struct { // Location - Resource location. Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindIotHub', 'KindEventGrid' - Kind Kind `json:"kind,omitempty"` + Kind KindBasicDataConnection `json:"kind,omitempty"` // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty"` // Name - READ-ONLY; The name of the resource @@ -1163,8 +1968,7 @@ func (dc DataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { return &dc, true } -// DataConnectionCheckNameRequest the result returned from a data connections check name availability -// request. +// DataConnectionCheckNameRequest a data connection check name availability request. type DataConnectionCheckNameRequest struct { // Name - Data Connection name. Name *string `json:"name,omitempty"` @@ -1353,6 +2157,13 @@ type DataConnectionValidationResult struct { ErrorMessage *string `json:"errorMessage,omitempty"` } +// DiagnoseVirtualNetworkResult ... +type DiagnoseVirtualNetworkResult struct { + autorest.Response `json:"-"` + // Findings - The list of network connectivity diagnostic finding + Findings *[]string `json:"findings,omitempty"` +} + // EventGridConnectionProperties class representing the Kusto event grid connection properties. type EventGridConnectionProperties struct { // StorageAccountResourceID - The resource ID of the storage account where the data resides. @@ -1365,8 +2176,8 @@ type EventGridConnectionProperties struct { TableName *string `json:"tableName,omitempty"` // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. MappingRuleName *string `json:"mappingRuleName,omitempty"` - // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE' - DataFormat DataFormat `json:"dataFormat,omitempty"` + // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC' + DataFormat EventGridDataFormat `json:"dataFormat,omitempty"` } // EventGridDataConnection class representing an Event Grid data connection. @@ -1376,7 +2187,7 @@ type EventGridDataConnection struct { // Location - Resource location. Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindIotHub', 'KindEventGrid' - Kind Kind `json:"kind,omitempty"` + Kind KindBasicDataConnection `json:"kind,omitempty"` // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty"` // Name - READ-ONLY; The name of the resource @@ -1455,7 +2266,7 @@ func (egdc *EventGridDataConnection) UnmarshalJSON(body []byte) error { } case "kind": if v != nil { - var kind Kind + var kind KindBasicDataConnection err = json.Unmarshal(*v, &kind) if err != nil { return err @@ -1505,10 +2316,12 @@ type EventHubConnectionProperties struct { TableName *string `json:"tableName,omitempty"` // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. MappingRuleName *string `json:"mappingRuleName,omitempty"` - // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE' - DataFormat DataFormat `json:"dataFormat,omitempty"` + // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'EventHubDataFormatMULTIJSON', 'EventHubDataFormatJSON', 'EventHubDataFormatCSV', 'EventHubDataFormatTSV', 'EventHubDataFormatSCSV', 'EventHubDataFormatSOHSV', 'EventHubDataFormatPSV', 'EventHubDataFormatTXT', 'EventHubDataFormatRAW', 'EventHubDataFormatSINGLEJSON', 'EventHubDataFormatAVRO', 'EventHubDataFormatTSVE', 'EventHubDataFormatPARQUET', 'EventHubDataFormatORC' + DataFormat EventHubDataFormat `json:"dataFormat,omitempty"` // EventSystemProperties - System properties of the event hub EventSystemProperties *[]string `json:"eventSystemProperties,omitempty"` + // Compression - The event hub messages compression type. Possible values include: 'CompressionNone', 'CompressionGZip' + Compression Compression `json:"compression,omitempty"` } // EventHubDataConnection class representing an event hub data connection. @@ -1518,7 +2331,7 @@ type EventHubDataConnection struct { // Location - Resource location. Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindIotHub', 'KindEventGrid' - Kind Kind `json:"kind,omitempty"` + Kind KindBasicDataConnection `json:"kind,omitempty"` // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty"` // Name - READ-ONLY; The name of the resource @@ -1597,7 +2410,7 @@ func (ehdc *EventHubDataConnection) UnmarshalJSON(body []byte) error { } case "kind": if v != nil { - var kind Kind + var kind KindBasicDataConnection err = json.Unmarshal(*v, &kind) if err != nil { return err @@ -1637,7 +2450,56 @@ func (ehdc *EventHubDataConnection) UnmarshalJSON(body []byte) error { return nil } -// IotHubConnectionProperties class representing the Kusto iot hub connection properties. +// FollowerDatabaseDefinition a class representing follower database request. +type FollowerDatabaseDefinition struct { + // ClusterResourceID - Resource id of the cluster that follows a database owned by this cluster. + ClusterResourceID *string `json:"clusterResourceId,omitempty"` + // AttachedDatabaseConfigurationName - Resource name of the attached database configuration in the follower cluster. + AttachedDatabaseConfigurationName *string `json:"attachedDatabaseConfigurationName,omitempty"` + // DatabaseName - READ-ONLY; The database name owned by this cluster that was followed. * in case following all databases. + DatabaseName *string `json:"databaseName,omitempty"` +} + +// FollowerDatabaseListResult the list Kusto database principals operation response. +type FollowerDatabaseListResult struct { + autorest.Response `json:"-"` + // Value - The list of follower database result. + Value *[]FollowerDatabaseDefinition `json:"value,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'IdentityTypeNone', 'IdentityTypeSystemAssigned' + Type IdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the Kusto cluster. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*IdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + if i.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = i.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// IdentityUserAssignedIdentitiesValue ... +type IdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// IotHubConnectionProperties class representing the Kusto Iot hub connection properties. type IotHubConnectionProperties struct { // IotHubResourceID - The resource ID of the Iot hub to be used to create a data connection. IotHubResourceID *string `json:"iotHubResourceId,omitempty"` @@ -1647,11 +2509,11 @@ type IotHubConnectionProperties struct { TableName *string `json:"tableName,omitempty"` // MappingRuleName - The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. MappingRuleName *string `json:"mappingRuleName,omitempty"` - // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE' - DataFormat DataFormat `json:"dataFormat,omitempty"` + // DataFormat - The data format of the message. Optionally the data format can be added to each message. Possible values include: 'IotHubDataFormatMULTIJSON', 'IotHubDataFormatJSON', 'IotHubDataFormatCSV', 'IotHubDataFormatTSV', 'IotHubDataFormatSCSV', 'IotHubDataFormatSOHSV', 'IotHubDataFormatPSV', 'IotHubDataFormatTXT', 'IotHubDataFormatRAW', 'IotHubDataFormatSINGLEJSON', 'IotHubDataFormatAVRO', 'IotHubDataFormatTSVE', 'IotHubDataFormatPARQUET', 'IotHubDataFormatORC' + DataFormat IotHubDataFormat `json:"dataFormat,omitempty"` // EventSystemProperties - System properties of the iot hub EventSystemProperties *[]string `json:"eventSystemProperties,omitempty"` - // SharedAccessPolicyName - The name of the share access policy name + // SharedAccessPolicyName - The name of the share access policy SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` } @@ -1662,7 +2524,7 @@ type IotHubDataConnection struct { // Location - Resource location. Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindIotHub', 'KindEventGrid' - Kind Kind `json:"kind,omitempty"` + Kind KindBasicDataConnection `json:"kind,omitempty"` // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty"` // Name - READ-ONLY; The name of the resource @@ -1741,7 +2603,7 @@ func (ihdc *IotHubDataConnection) UnmarshalJSON(body []byte) error { } case "kind": if v != nil { - var kind Kind + var kind KindBasicDataConnection err = json.Unmarshal(*v, &kind) if err != nil { return err @@ -1781,6 +2643,29 @@ func (ihdc *IotHubDataConnection) UnmarshalJSON(body []byte) error { return nil } +// KeyVaultProperties properties of the key vault. +type KeyVaultProperties struct { + // KeyName - The name of the key vault key. + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - The version of the key vault key. + KeyVersion *string `json:"keyVersion,omitempty"` + // KeyVaultURI - The Uri of the key vault. + KeyVaultURI *string `json:"keyVaultUri,omitempty"` +} + +// LanguageExtension the language extension object. +type LanguageExtension struct { + // LanguageExtensionName - The language extension name. Possible values include: 'PYTHON', 'R' + LanguageExtensionName LanguageExtensionName `json:"languageExtensionName,omitempty"` +} + +// LanguageExtensionsList the list of language extension objects. +type LanguageExtensionsList struct { + autorest.Response `json:"-"` + // Value - The list of language extensions. + Value *[]LanguageExtension `json:"value,omitempty"` +} + // ListResourceSkusResult list of available SKUs for a Kusto Cluster. type ListResourceSkusResult struct { autorest.Response `json:"-"` @@ -1973,6 +2858,280 @@ type ProxyResource struct { Type *string `json:"type,omitempty"` } +// ReadOnlyFollowingDatabase class representing a read only following database. +type ReadOnlyFollowingDatabase struct { + // ReadOnlyFollowingDatabaseProperties - The database properties. + *ReadOnlyFollowingDatabaseProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' + Kind Kind `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) MarshalJSON() ([]byte, error) { + rofd.Kind = KindReadOnlyFollowing + objectMap := make(map[string]interface{}) + if rofd.ReadOnlyFollowingDatabaseProperties != nil { + objectMap["properties"] = rofd.ReadOnlyFollowingDatabaseProperties + } + if rofd.Location != nil { + objectMap["location"] = rofd.Location + } + if rofd.Kind != "" { + objectMap["kind"] = rofd.Kind + } + return json.Marshal(objectMap) +} + +// AsReadWriteDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { + return nil, false +} + +// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { + return &rofd, true +} + +// AsDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) AsDatabase() (*Database, bool) { + return nil, false +} + +// AsBasicDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) AsBasicDatabase() (BasicDatabase, bool) { + return &rofd, true +} + +// UnmarshalJSON is the custom unmarshaler for ReadOnlyFollowingDatabase struct. +func (rofd *ReadOnlyFollowingDatabase) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var readOnlyFollowingDatabaseProperties ReadOnlyFollowingDatabaseProperties + err = json.Unmarshal(*v, &readOnlyFollowingDatabaseProperties) + if err != nil { + return err + } + rofd.ReadOnlyFollowingDatabaseProperties = &readOnlyFollowingDatabaseProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rofd.Location = &location + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rofd.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rofd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rofd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rofd.Type = &typeVar + } + } + } + + return nil +} + +// ReadOnlyFollowingDatabaseProperties class representing the Kusto database properties. +type ReadOnlyFollowingDatabaseProperties struct { + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // SoftDeletePeriod - READ-ONLY; The time the data should be kept before it stops being accessible to queries in TimeSpan. + SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` + // HotCachePeriod - The time the data should be kept in cache for fast queries in TimeSpan. + HotCachePeriod *string `json:"hotCachePeriod,omitempty"` + // Statistics - The statistics of the database. + Statistics *DatabaseStatistics `json:"statistics,omitempty"` + // LeaderClusterResourceID - READ-ONLY; The name of the leader cluster + LeaderClusterResourceID *string `json:"leaderClusterResourceId,omitempty"` + // AttachedDatabaseConfigurationName - READ-ONLY; The name of the attached database configuration cluster + AttachedDatabaseConfigurationName *string `json:"attachedDatabaseConfigurationName,omitempty"` + // PrincipalsModificationKind - READ-ONLY; The principals modification kind of the database. Possible values include: 'PrincipalsModificationKindUnion', 'PrincipalsModificationKindReplace', 'PrincipalsModificationKindNone' + PrincipalsModificationKind PrincipalsModificationKind `json:"principalsModificationKind,omitempty"` +} + +// ReadWriteDatabase class representing a read write database. +type ReadWriteDatabase struct { + // ReadWriteDatabaseProperties - The database properties. + *ReadWriteDatabaseProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' + Kind Kind `json:"kind,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ReadWriteDatabase. +func (rwd ReadWriteDatabase) MarshalJSON() ([]byte, error) { + rwd.Kind = KindReadWrite + objectMap := make(map[string]interface{}) + if rwd.ReadWriteDatabaseProperties != nil { + objectMap["properties"] = rwd.ReadWriteDatabaseProperties + } + if rwd.Location != nil { + objectMap["location"] = rwd.Location + } + if rwd.Kind != "" { + objectMap["kind"] = rwd.Kind + } + return json.Marshal(objectMap) +} + +// AsReadWriteDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { + return &rwd, true +} + +// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { + return nil, false +} + +// AsDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsDatabase() (*Database, bool) { + return nil, false +} + +// AsBasicDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsBasicDatabase() (BasicDatabase, bool) { + return &rwd, true +} + +// UnmarshalJSON is the custom unmarshaler for ReadWriteDatabase struct. +func (rwd *ReadWriteDatabase) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var readWriteDatabaseProperties ReadWriteDatabaseProperties + err = json.Unmarshal(*v, &readWriteDatabaseProperties) + if err != nil { + return err + } + rwd.ReadWriteDatabaseProperties = &readWriteDatabaseProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rwd.Location = &location + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rwd.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rwd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rwd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rwd.Type = &typeVar + } + } + } + + return nil +} + +// ReadWriteDatabaseProperties class representing the Kusto database properties. +type ReadWriteDatabaseProperties struct { + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // SoftDeletePeriod - The time the data should be kept before it stops being accessible to queries in TimeSpan. + SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` + // HotCachePeriod - The time the data should be kept in cache for fast queries in TimeSpan. + HotCachePeriod *string `json:"hotCachePeriod,omitempty"` + // Statistics - The statistics of the database. + Statistics *DatabaseStatistics `json:"statistics,omitempty"` + // IsFollowed - READ-ONLY; Indicates whether the database is followed. + IsFollowed *string `json:"isFollowed,omitempty"` +} + // Resource ... type Resource struct { // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/operations.go similarity index 99% rename from vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/operations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/operations.go index 74881654324ed..c6d7822a1b64b 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/operations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/operations.go @@ -79,7 +79,7 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2019-05-15" + const APIVersion = "2020-02-15" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/version.go similarity index 94% rename from vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/version.go index 4bb5a611775ad..4f32f49d7c15e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " kusto/2019-05-15" + return "Azure-SDK-For-Go/" + Version() + " kusto/2020-02-15" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/vendor/modules.txt b/vendor/modules.txt index af7dbaadc6866..f3fe81b8f2f94 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -39,7 +39,7 @@ github.com/Azure/azure-sdk-for-go/services/healthcareapis/mgmt/2019-09-16/health github.com/Azure/azure-sdk-for-go/services/iotcentral/mgmt/2018-09-01/iotcentral github.com/Azure/azure-sdk-for-go/services/keyvault/2016-10-01/keyvault github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2018-02-14/keyvault -github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-05-15/kusto +github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2020-02-15/kusto github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2019-05-01/logic github.com/Azure/azure-sdk-for-go/services/machinelearningservices/mgmt/2019-11-01/machinelearningservices github.com/Azure/azure-sdk-for-go/services/maps/mgmt/2018-05-01/maps