From 03049b33fa418bd306a7f4fda0ca32b3fc4027e5 Mon Sep 17 00:00:00 2001 From: Yun Liu Date: Fri, 17 Feb 2023 15:40:30 +0800 Subject: [PATCH 1/2] Convert to pandora sdk --- internal/services/kusto/client/client.go | 41 +- internal/services/kusto/identity.go | 10 +- ...ttached_database_configuration_resource.go | 97 +- ...ed_database_configuration_resource_test.go | 15 +- ...o_cluster_customer_managed_key_resource.go | 99 +- ...kusto_cluster_customer_managed_key_test.go | 12 +- .../kusto/kusto_cluster_data_source.go | 34 +- ...uster_managed_private_endpoint_resource.go | 69 +- ..._managed_private_endpoint_resource_test.go | 17 +- ...o_cluster_principal_assignment_resource.go | 115 +- ...ster_principal_assignment_resource_test.go | 14 +- .../services/kusto/kusto_cluster_resource.go | 395 +- .../kusto/kusto_cluster_resource_test.go | 15 +- .../kusto/kusto_data_connection_import.go | 29 +- .../kusto/kusto_database_data_source.go | 19 +- ..._database_principal_assignment_resource.go | 108 +- ...base_principal_assignment_resource_test.go | 11 +- .../services/kusto/kusto_database_resource.go | 57 +- .../kusto/kusto_database_resource_test.go | 23 +- .../kusto/kusto_database_script_resource.go | 71 +- .../kusto_database_script_resource_test.go | 21 +- ...usto_eventgrid_data_connection_resource.go | 131 +- ...eventgrid_data_connection_resource_test.go | 23 +- ...kusto_eventhub_data_connection_resource.go | 153 +- ..._eventhub_data_connection_resource_test.go | 21 +- .../kusto_iothub_data_connection_resource.go | 124 +- ...to_iothub_data_connection_resource_test.go | 21 +- .../kusto/mgmt/2022-02-01/kusto/CHANGELOG.md | 2 - .../kusto/mgmt/2022-02-01/kusto/_meta.json | 11 - .../kusto/attacheddatabaseconfigurations.go | 449 -- .../kusto/mgmt/2022-02-01/kusto/client.go | 44 - .../kusto/clusterprincipalassignments.go | 446 -- .../kusto/mgmt/2022-02-01/kusto/clusters.go | 1525 ------ .../kusto/databaseprincipalassignments.go | 456 -- .../kusto/mgmt/2022-02-01/kusto/databases.go | 761 --- .../mgmt/2022-02-01/kusto/dataconnections.go | 618 --- .../kusto/mgmt/2022-02-01/kusto/enums.go | 668 --- .../kusto/managedprivateendpoints.go | 534 -- .../kusto/mgmt/2022-02-01/kusto/models.go | 4819 ----------------- .../kusto/mgmt/2022-02-01/kusto/operations.go | 142 - .../2022-02-01/kusto/operationsresults.go | 110 - .../kusto/operationsresultslocation.go | 109 - .../kusto/privateendpointconnections.go | 360 -- .../2022-02-01/kusto/privatelinkresources.go | 188 - .../kusto/mgmt/2022-02-01/kusto/scripts.go | 536 -- .../kusto/mgmt/2022-02-01/kusto/version.go | 19 - .../attacheddatabaseconfigurations/README.md | 102 + .../attacheddatabaseconfigurations/client.go | 18 + .../constants.go | 130 + .../id_attacheddatabaseconfiguration.go | 137 + .../id_cluster.go | 124 + .../method_checknameavailability_autorest.go | 70 + .../method_createorupdate_autorest.go | 79 + .../method_delete_autorest.go | 78 + .../method_get_autorest.go | 68 + .../method_listbycluster_autorest.go | 69 + .../model_attacheddatabaseconfiguration.go | 12 + ...attacheddatabaseconfigurationlistresult.go | 8 + ...attacheddatabaseconfigurationproperties.go | 13 + ...ddatabaseconfigurationschecknamerequest.go | 9 + .../model_checknameresult.go | 11 + .../model_tablelevelsharingproperties.go | 13 + .../attacheddatabaseconfigurations/version.go | 12 + .../clusterprincipalassignments/README.md | 102 + .../clusterprincipalassignments/client.go | 18 + .../clusterprincipalassignments/constants.go | 158 + .../clusterprincipalassignments/id_cluster.go | 124 + .../id_principalassignment.go | 137 + .../method_checknameavailability_autorest.go | 70 + .../method_createorupdate_autorest.go | 79 + .../method_delete_autorest.go | 78 + .../method_get_autorest.go | 68 + .../method_list_autorest.go | 69 + .../model_checknameresult.go | 11 + .../model_clusterprincipalassignment.go | 11 + ...sterprincipalassignmentchecknamerequest.go | 9 + ...el_clusterprincipalassignmentlistresult.go | 8 + .../model_clusterprincipalproperties.go | 15 + .../clusterprincipalassignments/version.go | 12 + .../kusto/2022-02-01/clusters/README.md | 270 + .../kusto/2022-02-01/clusters/client.go | 18 + .../kusto/2022-02-01/clusters/constants.go | 501 ++ .../kusto/2022-02-01/clusters/id_cluster.go | 124 + .../kusto/2022-02-01/clusters/id_location.go | 111 + .../method_addlanguageextensions_autorest.go | 79 + .../method_checknameavailability_autorest.go | 70 + .../method_createorupdate_autorest.go | 113 + .../clusters/method_delete_autorest.go | 78 + ...method_detachfollowerdatabases_autorest.go | 79 + .../method_diagnosevirtualnetwork_autorest.go | 78 + .../clusters/method_get_autorest.go | 68 + .../clusters/method_list_autorest.go | 70 + .../method_listbyresourcegroup_autorest.go | 70 + .../method_listfollowerdatabases_autorest.go | 69 + .../method_listlanguageextensions_autorest.go | 69 + .../method_listskusbyresource_autorest.go | 69 + ...ethod_removelanguageextensions_autorest.go | 79 + .../clusters/method_start_autorest.go | 78 + .../clusters/method_stop_autorest.go | 78 + .../clusters/method_update_autorest.go | 108 + .../clusters/model_acceptedaudiences.go | 8 + .../clusters/model_azurecapacity.go | 11 + .../clusters/model_azureresourcesku.go | 10 + .../2022-02-01/clusters/model_azuresku.go | 10 + .../clusters/model_checknameresult.go | 11 + .../2022-02-01/clusters/model_cluster.go | 24 + .../clusters/model_clusterchecknamerequest.go | 9 + .../clusters/model_clusterlistresult.go | 8 + .../clusters/model_clusterproperties.go | 31 + .../clusters/model_clusterupdate.go | 19 + .../model_diagnosevirtualnetworkresult.go | 8 + .../model_followerdatabasedefinition.go | 10 + .../model_followerdatabaselistresult.go | 8 + .../clusters/model_keyvaultproperties.go | 11 + .../clusters/model_languageextension.go | 8 + .../clusters/model_languageextensionslist.go | 8 + .../clusters/model_listresourceskusresult.go | 8 + .../clusters/model_optimizedautoscale.go | 11 + .../model_privateendpointconnection.go | 16 + ...del_privateendpointconnectionproperties.go | 11 + .../clusters/model_privateendpointproperty.go | 8 + ...ivatelinkserviceconnectionstateproperty.go | 10 + .../clusters/model_trustedexternaltenant.go | 8 + .../model_virtualnetworkconfiguration.go | 10 + .../kusto/2022-02-01/clusters/version.go | 12 + .../databaseprincipalassignments/README.md | 102 + .../databaseprincipalassignments/client.go | 18 + .../databaseprincipalassignments/constants.go | 170 + .../id_database.go | 137 + .../id_databaseprincipalassignment.go | 150 + .../method_checknameavailability_autorest.go | 70 + .../method_createorupdate_autorest.go | 79 + .../method_delete_autorest.go | 78 + .../method_get_autorest.go | 68 + .../method_list_autorest.go | 69 + .../model_checknameresult.go | 11 + .../model_databaseprincipalassignment.go | 11 + ...baseprincipalassignmentchecknamerequest.go | 9 + ...l_databaseprincipalassignmentlistresult.go | 8 + .../model_databaseprincipalproperties.go | 15 + .../databaseprincipalassignments/version.go | 12 + .../kusto/2022-02-01/databases/README.md | 177 + .../kusto/2022-02-01/databases/client.go | 18 + .../kusto/2022-02-01/databases/constants.go | 232 + .../kusto/2022-02-01/databases/id_cluster.go | 124 + .../kusto/2022-02-01/databases/id_database.go | 137 + .../method_addprincipals_autorest.go | 70 + .../method_checknameavailability_autorest.go | 70 + .../method_createorupdate_autorest.go | 79 + .../databases/method_delete_autorest.go | 78 + .../databases/method_get_autorest.go | 74 + .../method_listbycluster_autorest.go | 69 + .../method_listprincipals_autorest.go | 69 + .../method_removeprincipals_autorest.go | 70 + .../databases/method_update_autorest.go | 79 + .../databases/model_checknamerequest.go | 9 + .../databases/model_checknameresult.go | 11 + .../2022-02-01/databases/model_database.go | 56 + .../databases/model_databaselistresult.go | 41 + .../databases/model_databaseprincipal.go | 14 + .../model_databaseprincipallistrequest.go | 8 + .../model_databaseprincipallistresult.go | 8 + .../databases/model_databasestatistics.go | 8 + .../model_readonlyfollowingdatabase.go | 45 + ...del_readonlyfollowingdatabaseproperties.go | 14 + .../databases/model_readwritedatabase.go | 45 + .../model_readwritedatabaseproperties.go | 12 + .../kusto/2022-02-01/databases/version.go | 12 + .../2022-02-01/dataconnections/README.md | 136 + .../2022-02-01/dataconnections/client.go | 18 + .../2022-02-01/dataconnections/constants.go | 424 ++ .../2022-02-01/dataconnections/id_database.go | 137 + .../dataconnections/id_dataconnection.go | 150 + .../method_checknameavailability_autorest.go | 70 + .../method_createorupdate_autorest.go | 79 + ...ethod_dataconnectionvalidation_autorest.go | 79 + .../dataconnections/method_delete_autorest.go | 78 + .../dataconnections/method_get_autorest.go | 74 + .../method_listbydatabase_autorest.go | 69 + .../dataconnections/method_update_autorest.go | 79 + .../dataconnections/model_checknameresult.go | 11 + .../dataconnections/model_dataconnection.go | 64 + .../model_dataconnectionchecknamerequest.go | 9 + .../model_dataconnectionlistresult.go | 41 + .../model_dataconnectionvalidation.go | 40 + ...odel_dataconnectionvalidationlistresult.go | 8 + .../model_dataconnectionvalidationresult.go | 8 + .../model_eventgridconnectionproperties.go | 20 + .../model_eventgriddataconnection.go | 45 + .../model_eventhubconnectionproperties.go | 18 + .../model_eventhubdataconnection.go | 45 + .../model_iothubconnectionproperties.go | 16 + .../model_iothubdataconnection.go | 45 + .../2022-02-01/dataconnections/version.go | 12 + .../managedprivateendpoints/README.md | 119 + .../managedprivateendpoints/client.go | 18 + .../managedprivateendpoints/constants.go | 99 + .../managedprivateendpoints/id_cluster.go | 124 + .../id_managedprivateendpoint.go | 137 + .../method_checknameavailability_autorest.go | 70 + .../method_createorupdate_autorest.go | 79 + .../method_delete_autorest.go | 78 + .../method_get_autorest.go | 68 + .../method_list_autorest.go | 69 + .../method_update_autorest.go | 79 + .../model_checknameresult.go | 11 + .../model_managedprivateendpoint.go | 16 + .../model_managedprivateendpointlistresult.go | 8 + .../model_managedprivateendpointproperties.go | 12 + ...managedprivateendpointschecknamerequest.go | 9 + .../managedprivateendpoints/version.go | 12 + .../kusto/2022-02-01/scripts/README.md | 119 + .../kusto/2022-02-01/scripts/client.go | 18 + .../kusto/2022-02-01/scripts/constants.go | 99 + .../kusto/2022-02-01/scripts/id_database.go | 137 + .../kusto/2022-02-01/scripts/id_script.go | 150 + .../method_checknameavailability_autorest.go | 70 + .../scripts/method_createorupdate_autorest.go | 79 + .../scripts/method_delete_autorest.go | 78 + .../2022-02-01/scripts/method_get_autorest.go | 68 + .../scripts/method_listbydatabase_autorest.go | 69 + .../scripts/method_update_autorest.go | 79 + .../scripts/model_checknameresult.go | 11 + .../kusto/2022-02-01/scripts/model_script.go | 16 + .../scripts/model_scriptchecknamerequest.go | 9 + .../scripts/model_scriptlistresult.go | 8 + .../scripts/model_scriptproperties.go | 13 + .../kusto/2022-02-01/scripts/version.go | 12 + vendor/modules.txt | 9 +- 229 files changed, 11755 insertions(+), 12739 deletions(-) delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/CHANGELOG.md delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/_meta.json delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/attacheddatabaseconfigurations.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/client.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusterprincipalassignments.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusters.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/databaseprincipalassignments.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/databases.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/dataconnections.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/enums.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/managedprivateendpoints.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/models.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operations.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresults.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresultslocation.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privateendpointconnections.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privatelinkresources.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/scripts.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/id_attacheddatabaseconfiguration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/id_cluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_checknameavailability_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_listbycluster_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfiguration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfigurationlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfigurationproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfigurationschecknamerequest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_checknameresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_tablelevelsharingproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/id_cluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/id_principalassignment.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_checknameavailability_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_checknameresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalassignment.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalassignmentchecknamerequest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalassignmentlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/id_cluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/id_location.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_addlanguageextensions_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_checknameavailability_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_detachfollowerdatabases_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_diagnosevirtualnetwork_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listbyresourcegroup_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listfollowerdatabases_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listlanguageextensions_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listskusbyresource_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_removelanguageextensions_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_start_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_stop_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_acceptedaudiences.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_azurecapacity.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_azureresourcesku.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_azuresku.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_checknameresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_cluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterchecknamerequest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_diagnosevirtualnetworkresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_followerdatabasedefinition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_followerdatabaselistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_keyvaultproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_languageextension.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_languageextensionslist.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_listresourceskusresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_optimizedautoscale.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privateendpointconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privateendpointconnectionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privateendpointproperty.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privatelinkserviceconnectionstateproperty.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_trustedexternaltenant.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_virtualnetworkconfiguration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/id_database.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/id_databaseprincipalassignment.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_checknameavailability_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_checknameresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalassignment.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalassignmentchecknamerequest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalassignmentlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/id_cluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/id_database.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_addprincipals_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_checknameavailability_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_listbycluster_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_listprincipals_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_removeprincipals_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_checknamerequest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_checknameresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_database.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaselistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaseprincipal.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaseprincipallistrequest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaseprincipallistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databasestatistics.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readonlyfollowingdatabase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readonlyfollowingdatabaseproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readwritedatabase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readwritedatabaseproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/id_database.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/id_dataconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_checknameavailability_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_dataconnectionvalidation_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_listbydatabase_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_checknameresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionchecknamerequest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionvalidation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionvalidationlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionvalidationresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventgridconnectionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventgriddataconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventhubconnectionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventhubdataconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_iothubconnectionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_iothubdataconnection.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/id_cluster.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/id_managedprivateendpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_checknameavailability_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_checknameresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpointlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpointproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpointschecknamerequest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/id_database.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/id_script.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_checknameavailability_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_listbydatabase_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_update_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_checknameresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_script.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_scriptchecknamerequest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_scriptlistresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_scriptproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/version.go diff --git a/internal/services/kusto/client/client.go b/internal/services/kusto/client/client.go index 4fd6a741d4e8..8c39b6b3f489 100644 --- a/internal/services/kusto/client/client.go +++ b/internal/services/kusto/client/client.go @@ -1,44 +1,51 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - AttachedDatabaseConfigurationsClient *kusto.AttachedDatabaseConfigurationsClient - ClustersClient *kusto.ClustersClient - ClusterManagedPrivateEndpointClient *kusto.ManagedPrivateEndpointsClient - ClusterPrincipalAssignmentsClient *kusto.ClusterPrincipalAssignmentsClient - DatabasesClient *kusto.DatabasesClient - DataConnectionsClient *kusto.DataConnectionsClient - DatabasePrincipalAssignmentsClient *kusto.DatabasePrincipalAssignmentsClient - ScriptsClient *kusto.ScriptsClient + AttachedDatabaseConfigurationsClient *attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient + ClustersClient *clusters.ClustersClient + ClusterManagedPrivateEndpointClient *managedprivateendpoints.ManagedPrivateEndpointsClient + ClusterPrincipalAssignmentsClient *clusterprincipalassignments.ClusterPrincipalAssignmentsClient + DatabasesClient *databases.DatabasesClient + DataConnectionsClient *dataconnections.DataConnectionsClient + DatabasePrincipalAssignmentsClient *databaseprincipalassignments.DatabasePrincipalAssignmentsClient + ScriptsClient *scripts.ScriptsClient } func NewClient(o *common.ClientOptions) *Client { - ClustersClient := kusto.NewClustersClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + ClustersClient := clusters.NewClustersClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&ClustersClient.Client, o.ResourceManagerAuthorizer) - ClusterManagedPrivateEndpointClient := kusto.NewManagedPrivateEndpointsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + ClusterManagedPrivateEndpointClient := managedprivateendpoints.NewManagedPrivateEndpointsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&ClusterManagedPrivateEndpointClient.Client, o.ResourceManagerAuthorizer) - ClusterPrincipalAssignmentsClient := kusto.NewClusterPrincipalAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + ClusterPrincipalAssignmentsClient := clusterprincipalassignments.NewClusterPrincipalAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&ClusterPrincipalAssignmentsClient.Client, o.ResourceManagerAuthorizer) - DatabasesClient := kusto.NewDatabasesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + DatabasesClient := databases.NewDatabasesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&DatabasesClient.Client, o.ResourceManagerAuthorizer) - DatabasePrincipalAssignmentsClient := kusto.NewDatabasePrincipalAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + DatabasePrincipalAssignmentsClient := databaseprincipalassignments.NewDatabasePrincipalAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&DatabasePrincipalAssignmentsClient.Client, o.ResourceManagerAuthorizer) - DataConnectionsClient := kusto.NewDataConnectionsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + DataConnectionsClient := dataconnections.NewDataConnectionsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&DataConnectionsClient.Client, o.ResourceManagerAuthorizer) - AttachedDatabaseConfigurationsClient := kusto.NewAttachedDatabaseConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + AttachedDatabaseConfigurationsClient := attacheddatabaseconfigurations.NewAttachedDatabaseConfigurationsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&AttachedDatabaseConfigurationsClient.Client, o.ResourceManagerAuthorizer) - ScriptsClient := kusto.NewScriptsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + ScriptsClient := scripts.NewScriptsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&ScriptsClient.Client, o.ResourceManagerAuthorizer) return &Client{ AttachedDatabaseConfigurationsClient: &AttachedDatabaseConfigurationsClient, diff --git a/internal/services/kusto/identity.go b/internal/services/kusto/identity.go index 58ad3b3e20db..dc4983f4a729 100644 --- a/internal/services/kusto/identity.go +++ b/internal/services/kusto/identity.go @@ -1,15 +1,15 @@ package kusto import ( - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/utils" ) -func expandTrustedExternalTenants(input []interface{}) *[]kusto.TrustedExternalTenant { - output := make([]kusto.TrustedExternalTenant, 0) +func expandTrustedExternalTenants(input []interface{}) *[]clusters.TrustedExternalTenant { + output := make([]clusters.TrustedExternalTenant, 0) for _, v := range input { - output = append(output, kusto.TrustedExternalTenant{ + output = append(output, clusters.TrustedExternalTenant{ Value: utils.String(v.(string)), }) } @@ -17,7 +17,7 @@ func expandTrustedExternalTenants(input []interface{}) *[]kusto.TrustedExternalT return &output } -func flattenTrustedExternalTenants(input *[]kusto.TrustedExternalTenant) []interface{} { +func flattenTrustedExternalTenants(input *[]clusters.TrustedExternalTenant) []interface{} { if input == nil { return []interface{}{} } diff --git a/internal/services/kusto/kusto_attached_database_configuration_resource.go b/internal/services/kusto/kusto_attached_database_configuration_resource.go index 77c16048b405..6070e3c6e35d 100644 --- a/internal/services/kusto/kusto_attached_database_configuration_resource.go +++ b/internal/services/kusto/kusto_attached_database_configuration_resource.go @@ -4,14 +4,16 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -32,7 +34,7 @@ func resourceKustoAttachedDatabaseConfiguration() *pluginsdk.Resource { }), Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.AttachedDatabaseConfigurationID(id) + _, err := attacheddatabaseconfigurations.ParseAttachedDatabaseConfigurationID(id) return err }), @@ -85,14 +87,10 @@ func resourceKustoAttachedDatabaseConfiguration() *pluginsdk.Resource { }, "default_principal_modification_kind": { - Type: pluginsdk.TypeString, - Optional: true, - Default: kusto.DefaultPrincipalsModificationKindNone, - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.DefaultPrincipalsModificationKindNone), - string(kusto.DefaultPrincipalsModificationKindReplace), - string(kusto.DefaultPrincipalsModificationKindUnion), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + Default: attacheddatabaseconfigurations.DefaultPrincipalsModificationKindNone, + ValidateFunc: validation.StringInSlice(attacheddatabaseconfigurations.PossibleValuesForDefaultPrincipalsModificationKind(), false), }, "sharing": { @@ -161,33 +159,30 @@ func resourceKustoAttachedDatabaseConfigurationCreateUpdate(d *pluginsdk.Resourc ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAttachedDatabaseConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("name").(string)) + id := attacheddatabaseconfigurations.NewAttachedDatabaseConfigurationID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("name").(string)) if d.IsNewResource() { - resp, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return tf.ImportAsExistsError("azurerm_kusto_attached_database_configuration", id.ID()) } } configurationProperties := expandKustoAttachedDatabaseConfigurationProperties(d) - configurationRequest := kusto.AttachedDatabaseConfiguration{ - Location: utils.String(location.Normalize(d.Get("location").(string))), - AttachedDatabaseConfigurationProperties: configurationProperties, + configurationRequest := attacheddatabaseconfigurations.AttachedDatabaseConfiguration{ + Location: utils.String(location.Normalize(d.Get("location").(string))), + Properties: configurationProperties, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.Name, configurationRequest) + err := client.CreateOrUpdateThenPoll(ctx, id, configurationRequest) if err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) - } d.SetId(id.ID()) return resourceKustoAttachedDatabaseConfigurationRead(d, meta) @@ -198,14 +193,14 @@ func resourceKustoAttachedDatabaseConfigurationRead(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AttachedDatabaseConfigurationID(d.Id()) + id, err := attacheddatabaseconfigurations.ParseAttachedDatabaseConfigurationID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -213,18 +208,24 @@ func resourceKustoAttachedDatabaseConfigurationRead(d *pluginsdk.ResourceData, m return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.AttachedDatabaseConfigurationName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("cluster_name", id.ClusterName) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) - if props := resp.AttachedDatabaseConfigurationProperties; props != nil { - d.Set("cluster_resource_id", props.ClusterResourceID) - d.Set("database_name", props.DatabaseName) - d.Set("default_principal_modification_kind", props.DefaultPrincipalsModificationKind) - d.Set("attached_database_names", props.AttachedDatabaseNames) - d.Set("sharing", flattenAttachedDatabaseConfigurationTableLevelSharingProperties(props.TableLevelSharingProperties)) + if props := model.Properties; props != nil { + clusterResourceId, parseErr := clusters.ParseClusterIDInsensitively(props.ClusterResourceId) + if parseErr != nil { + return parseErr + } + d.Set("cluster_resource_id", clusterResourceId.ID()) + d.Set("database_name", props.DatabaseName) + d.Set("default_principal_modification_kind", props.DefaultPrincipalsModificationKind) + d.Set("attached_database_names", props.AttachedDatabaseNames) + d.Set("sharing", flattenAttachedDatabaseConfigurationTableLevelSharingProperties(props.TableLevelSharingProperties)) + } } return nil @@ -235,36 +236,36 @@ func resourceKustoAttachedDatabaseConfigurationDelete(d *pluginsdk.ResourceData, ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AttachedDatabaseConfigurationID(d.Id()) + id, err := attacheddatabaseconfigurations.ParseAttachedDatabaseConfigurationID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ClusterName, id.Name) + // DELETE operation for attached configuration does not support running concurrently at cluster level + locks.ByName(id.ClusterName, "azurerm_kusto_cluster") + defer locks.UnlockByName(id.ClusterName, "azurerm_kusto_cluster") + + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", id, err) - } - return nil } -func expandKustoAttachedDatabaseConfigurationProperties(d *pluginsdk.ResourceData) *kusto.AttachedDatabaseConfigurationProperties { - AttachedDatabaseConfigurationProperties := &kusto.AttachedDatabaseConfigurationProperties{} +func expandKustoAttachedDatabaseConfigurationProperties(d *pluginsdk.ResourceData) *attacheddatabaseconfigurations.AttachedDatabaseConfigurationProperties { + AttachedDatabaseConfigurationProperties := &attacheddatabaseconfigurations.AttachedDatabaseConfigurationProperties{} if clusterResourceID, ok := d.GetOk("cluster_resource_id"); ok { - AttachedDatabaseConfigurationProperties.ClusterResourceID = utils.String(clusterResourceID.(string)) + AttachedDatabaseConfigurationProperties.ClusterResourceId = clusterResourceID.(string) } if databaseName, ok := d.GetOk("database_name"); ok { - AttachedDatabaseConfigurationProperties.DatabaseName = utils.String(databaseName.(string)) + AttachedDatabaseConfigurationProperties.DatabaseName = databaseName.(string) } if defaultPrincipalModificationKind, ok := d.GetOk("default_principal_modification_kind"); ok { - AttachedDatabaseConfigurationProperties.DefaultPrincipalsModificationKind = kusto.DefaultPrincipalsModificationKind(defaultPrincipalModificationKind.(string)) + AttachedDatabaseConfigurationProperties.DefaultPrincipalsModificationKind = attacheddatabaseconfigurations.DefaultPrincipalsModificationKind(defaultPrincipalModificationKind.(string)) } AttachedDatabaseConfigurationProperties.TableLevelSharingProperties = expandAttachedDatabaseConfigurationTableLevelSharingProperties(d.Get("sharing").([]interface{})) @@ -272,12 +273,12 @@ func expandKustoAttachedDatabaseConfigurationProperties(d *pluginsdk.ResourceDat return AttachedDatabaseConfigurationProperties } -func expandAttachedDatabaseConfigurationTableLevelSharingProperties(input []interface{}) *kusto.TableLevelSharingProperties { +func expandAttachedDatabaseConfigurationTableLevelSharingProperties(input []interface{}) *attacheddatabaseconfigurations.TableLevelSharingProperties { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - return &kusto.TableLevelSharingProperties{ + return &attacheddatabaseconfigurations.TableLevelSharingProperties{ TablesToInclude: utils.ExpandStringSlice(v["tables_to_include"].(*pluginsdk.Set).List()), TablesToExclude: utils.ExpandStringSlice(v["tables_to_exclude"].(*pluginsdk.Set).List()), ExternalTablesToInclude: utils.ExpandStringSlice(v["external_tables_to_include"].(*pluginsdk.Set).List()), @@ -287,7 +288,7 @@ func expandAttachedDatabaseConfigurationTableLevelSharingProperties(input []inte } } -func flattenAttachedDatabaseConfigurationTableLevelSharingProperties(input *kusto.TableLevelSharingProperties) []interface{} { +func flattenAttachedDatabaseConfigurationTableLevelSharingProperties(input *attacheddatabaseconfigurations.TableLevelSharingProperties) []interface{} { if input == nil { return make([]interface{}, 0) } diff --git a/internal/services/kusto/kusto_attached_database_configuration_resource_test.go b/internal/services/kusto/kusto_attached_database_configuration_resource_test.go index c87f2bec4ee4..0b8cea51c1bb 100644 --- a/internal/services/kusto/kusto_attached_database_configuration_resource_test.go +++ b/internal/services/kusto/kusto_attached_database_configuration_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type KustoAttachedDatabaseConfigurationResource struct{} @@ -31,17 +30,23 @@ func TestAccKustoAttachedDatabaseConfiguration_basic(t *testing.T) { } func (KustoAttachedDatabaseConfigurationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.AttachedDatabaseConfigurationID(state.ID) + id, err := attacheddatabaseconfigurations.ParseAttachedDatabaseConfigurationID(state.ID) if err != nil { return nil, err } - resp, err := clients.Kusto.AttachedDatabaseConfigurationsClient.Get(ctx, id.ResourceGroup, id.ClusterName, id.Name) + resp, err := clients.Kusto.AttachedDatabaseConfigurationsClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", id.String(), err) } - return utils.Bool(resp.AttachedDatabaseConfigurationProperties != nil), nil + if resp.Model == nil { + return nil, fmt.Errorf("response model is empty") + } + + exists := resp.Model.Properties != nil + + return &exists, nil } func (KustoAttachedDatabaseConfigurationResource) basic(data acceptance.TestData) string { diff --git a/internal/services/kusto/kusto_cluster_customer_managed_key_resource.go b/internal/services/kusto/kusto_cluster_customer_managed_key_resource.go index f7addfcd9de3..a451e71851ca 100644 --- a/internal/services/kusto/kusto_cluster_customer_managed_key_resource.go +++ b/internal/services/kusto/kusto_cluster_customer_managed_key_resource.go @@ -5,15 +5,14 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" keyVaultParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse" keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -28,7 +27,7 @@ func resourceKustoClusterCustomerManagedKey() *pluginsdk.Resource { Delete: resourceKustoClusterCustomerManagedKeyDelete, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ClusterID(id) + _, err := clusters.ParseClusterID(id) return err }), @@ -44,7 +43,7 @@ func resourceKustoClusterCustomerManagedKey() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.ClusterID, + ValidateFunc: clusters.ValidateClusterID, }, "key_vault_id": { @@ -82,20 +81,20 @@ func resourceKustoClusterCustomerManagedKeyCreateUpdate(d *pluginsdk.ResourceDat defer cancel() clusterIDRaw := d.Get("cluster_id").(string) - clusterID, err := parse.ClusterID(clusterIDRaw) + clusterID, err := clusters.ParseClusterID(clusterIDRaw) if err != nil { return err } - locks.ByName(clusterID.Name, "azurerm_kusto_cluster") - defer locks.UnlockByName(clusterID.Name, "azurerm_kusto_cluster") + locks.ByName(clusterID.ClusterName, "azurerm_kusto_cluster") + defer locks.UnlockByName(clusterID.ClusterName, "azurerm_kusto_cluster") - cluster, err := clusterClient.Get(ctx, clusterID.ResourceGroup, clusterID.Name) + cluster, err := clusterClient.Get(ctx, *clusterID) if err != nil { - return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): %+v", clusterID.Name, clusterID.ResourceGroup, err) + return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): %+v", clusterID.ClusterName, clusterID.ResourceGroupName, err) } - if cluster.ClusterProperties == nil { - return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): `ClusterProperties` was nil", clusterID.Name, clusterID.ResourceGroup) + if cluster.Model.Properties == nil { + return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): `ClusterProperties` was nil", clusterID.ClusterName, clusterID.ResourceGroupName) } // since we're mutating the kusto cluster here, we can use that as the ID @@ -104,7 +103,7 @@ func resourceKustoClusterCustomerManagedKeyCreateUpdate(d *pluginsdk.ResourceDat if d.IsNewResource() { // whilst this looks superflurious given encryption is enabled by default, due to the way // the Azure API works this technically can be nil - if cluster.ClusterProperties.KeyVaultProperties != nil { + if cluster.Model.Properties.KeyVaultProperties != nil { return tf.ImportAsExistsError("azurerm_kusto_cluster_customer_managed_key", resourceID) } } @@ -141,26 +140,23 @@ func resourceKustoClusterCustomerManagedKeyCreateUpdate(d *pluginsdk.ResourceDat keyName := d.Get("key_name").(string) keyVersion := d.Get("key_version").(string) - props := kusto.ClusterUpdate{ - ClusterProperties: &kusto.ClusterProperties{ - KeyVaultProperties: &kusto.KeyVaultProperties{ + props := clusters.ClusterUpdate{ + Properties: &clusters.ClusterProperties{ + KeyVaultProperties: &clusters.KeyVaultProperties{ KeyName: utils.String(keyName), KeyVersion: utils.String(keyVersion), - KeyVaultURI: utils.String(*keyVaultBaseURL), + KeyVaultUri: utils.String(*keyVaultBaseURL), }, }, } if v, ok := d.GetOk("user_identity"); ok { - props.ClusterProperties.KeyVaultProperties.UserIdentity = utils.String(v.(string)) + props.Properties.KeyVaultProperties.UserIdentity = utils.String(v.(string)) } - future, err := clusterClient.Update(ctx, clusterID.ResourceGroup, clusterID.Name, props, "") + err = clusterClient.UpdateThenPoll(ctx, *clusterID, props, clusters.UpdateOperationOptions{}) if err != nil { - return fmt.Errorf("updating Customer Managed Key for Kusto Cluster %q (Resource Group %q): %+v", clusterID.Name, clusterID.ResourceGroup, err) - } - if err = future.WaitForCompletionRef(ctx, clusterClient.Client); err != nil { - return fmt.Errorf("waiting for completion of Kusto Cluster Update %q (Resource Group %q): %+v", clusterID.Name, clusterID.ResourceGroup, err) + return fmt.Errorf("updating Customer Managed Key for Kusto Cluster %q (Resource Group %q): %+v", clusterID.ClusterName, clusterID.ResourceGroupName, err) } d.SetId(resourceID) @@ -175,31 +171,31 @@ func resourceKustoClusterCustomerManagedKeyRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - clusterID, err := parse.ClusterID(d.Id()) + clusterID, err := clusters.ParseClusterID(d.Id()) if err != nil { return err } - cluster, err := clusterClient.Get(ctx, clusterID.ResourceGroup, clusterID.Name) + cluster, err := clusterClient.Get(ctx, *clusterID) if err != nil { - if utils.ResponseWasNotFound(cluster.Response) { - log.Printf("[DEBUG] Kusto Cluster %q could not be found in Resource Group %q - removing from state!", clusterID.Name, clusterID.ResourceGroup) + if !response.WasNotFound(cluster.HttpResponse) { + log.Printf("[DEBUG] Kusto Cluster %q could not be found in Resource Group %q - removing from state!", clusterID.ClusterName, clusterID.ResourceGroupName) d.SetId("") return nil } - return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): %+v", clusterID.Name, clusterID.ResourceGroup, err) + return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): %+v", clusterID.ClusterName, clusterID.ResourceGroupName, err) } - if cluster.ClusterProperties == nil { - return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): `ClusterProperties` was nil", clusterID.Name, clusterID.ResourceGroup) + if cluster.Model == nil || cluster.Model.Properties == nil { + return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): `ClusterProperties` was nil", clusterID.ClusterName, clusterID.ResourceGroupName) } - if cluster.ClusterProperties.KeyVaultProperties == nil { - log.Printf("[DEBUG] Customer Managed Key was not defined for Kusto Cluster %q (Resource Group %q) - removing from state!", clusterID.Name, clusterID.ResourceGroup) + if cluster.Model.Properties.KeyVaultProperties == nil { + log.Printf("[DEBUG] Customer Managed Key was not defined for Kusto Cluster %q (Resource Group %q) - removing from state!", clusterID.ClusterName, clusterID.ResourceGroupName) d.SetId("") return nil } - props := cluster.ClusterProperties.KeyVaultProperties + props := cluster.Model.Properties.KeyVaultProperties keyName := "" keyVaultURI := "" @@ -209,8 +205,8 @@ func resourceKustoClusterCustomerManagedKeyRead(d *pluginsdk.ResourceData, meta if props.KeyName != nil { keyName = *props.KeyName } - if props.KeyVaultURI != nil { - keyVaultURI = *props.KeyVaultURI + if props.KeyVaultUri != nil { + keyVaultURI = *props.KeyVaultUri } if props.KeyVersion != nil { keyVersion = *props.KeyVersion @@ -221,7 +217,7 @@ func resourceKustoClusterCustomerManagedKeyRead(d *pluginsdk.ResourceData, meta } if keyVaultURI == "" { - return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): `properties.keyVaultProperties.keyVaultUri` was nil", clusterID.Name, clusterID.ResourceGroup) + return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): `properties.keyVaultProperties.keyVaultUri` was nil", clusterID.ClusterName, clusterID.ResourceGroupName) } // now we have the key vault uri we can look up the ID @@ -243,40 +239,41 @@ func resourceKustoClusterCustomerManagedKeyDelete(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - clusterID, err := parse.ClusterID(d.Id()) + clusterID, err := clusters.ParseClusterID(d.Id()) if err != nil { return err } - locks.ByName(clusterID.Name, "azurerm_kusto_cluster") - defer locks.UnlockByName(clusterID.Name, "azurerm_kusto_cluster") + locks.ByName(clusterID.ClusterName, "azurerm_kusto_cluster") + defer locks.UnlockByName(clusterID.ClusterName, "azurerm_kusto_cluster") // confirm it still exists prior to trying to update it, else we'll get an error - cluster, err := client.Get(ctx, clusterID.ResourceGroup, clusterID.Name) + cluster, err := client.Get(ctx, *clusterID) if err != nil { - if utils.ResponseWasNotFound(cluster.Response) { + if response.WasNotFound(cluster.HttpResponse) { return nil } - return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): %+v", clusterID.Name, clusterID.ResourceGroup, err) + return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): %+v", clusterID.ClusterName, clusterID.ResourceGroupName, err) } // Since this isn't a real object, just modifying an existing object // "Delete" doesn't really make sense it should really be a "Revert to Default" // So instead of the Delete func actually deleting the Kusto Cluster I am // making it reset the Kusto cluster to its default state - props := kusto.ClusterUpdate{ - ClusterProperties: &kusto.ClusterProperties{ - KeyVaultProperties: &kusto.KeyVaultProperties{}, - }, + props := cluster.Model + if props == nil { + return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): cluster.Model is nil", clusterID.ClusterName, clusterID.ResourceGroupName) } - future, err := client.Update(ctx, clusterID.ResourceGroup, clusterID.Name, props, "") - if err != nil { - return fmt.Errorf("removing Customer Managed Key for Kusto Cluster %q (Resource Group %q): %+v", clusterID.Name, clusterID.ResourceGroup, err) + if props.Properties != nil && props.Properties.KeyVaultProperties != nil { + props.Properties.KeyVaultProperties = &clusters.KeyVaultProperties{} } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for completion of Kusto Cluster Update %q (Resource Group %q): %+v", clusterID.Name, clusterID.ResourceGroup, err) + + // Using PUT since PATCH is not supported and will return Internal Server Error. + err = client.CreateOrUpdateThenPoll(ctx, *clusterID, *props, clusters.CreateOrUpdateOperationOptions{}) + if err != nil { + return fmt.Errorf("removing Customer Managed Key for Kusto Cluster %q (Resource Group %q): %+v", clusterID.ClusterName, clusterID.ResourceGroupName, err) } return nil diff --git a/internal/services/kusto/kusto_cluster_customer_managed_key_test.go b/internal/services/kusto/kusto_cluster_customer_managed_key_test.go index 9367c1b92e14..84317f27a901 100644 --- a/internal/services/kusto/kusto_cluster_customer_managed_key_test.go +++ b/internal/services/kusto/kusto_cluster_customer_managed_key_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -101,17 +101,21 @@ func TestAccKustoClusterCustomerManagedKey_userIdentity(t *testing.T) { } func (KustoClusterCustomerManagedKeyResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ClusterID(state.ID) + id, err := clusters.ParseClusterID(state.ID) if err != nil { return nil, err } - resp, err := clients.Kusto.ClustersClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.Kusto.ClustersClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", id.String(), err) } - if resp.ClusterProperties == nil || resp.ClusterProperties.KeyVaultProperties == nil { + if resp.Model == nil { + return nil, fmt.Errorf("response model is empty") + } + + if resp.Model.Properties == nil || resp.Model.Properties.KeyVaultProperties == nil { return utils.Bool(false), nil } diff --git a/internal/services/kusto/kusto_cluster_data_source.go b/internal/services/kusto/kusto_cluster_data_source.go index db6a52138d29..b0a713543bb6 100644 --- a/internal/services/kusto/kusto_cluster_data_source.go +++ b/internal/services/kusto/kusto_cluster_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceKustoCluster() *pluginsdk.Resource { @@ -44,7 +44,7 @@ func dataSourceKustoCluster() *pluginsdk.Resource { Computed: true, }, - "tags": tags.SchemaDataSource(), + "tags": commonschema.TagsDataSource(), }, } } @@ -55,10 +55,10 @@ func dataSourceKustoClusterRead(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewClusterID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + id := clusters.NewClusterID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s does not exist", id) } @@ -67,14 +67,20 @@ func dataSourceKustoClusterRead(d *pluginsdk.ResourceData, meta interface{}) err d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("location", location.NormalizeNilable(resp.Location)) + d.Set("name", id.ClusterName) + d.Set("resource_group_name", id.ResourceGroupName) - if clusterProperties := resp.ClusterProperties; clusterProperties != nil { - d.Set("uri", clusterProperties.URI) - d.Set("data_ingestion_uri", clusterProperties.DataIngestionURI) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&resp.Model.Location)) + + if clusterProperties := model.Properties; clusterProperties != nil { + d.Set("uri", clusterProperties.Uri) + d.Set("data_ingestion_uri", clusterProperties.DataIngestionUri) + } + if err := tags.FlattenAndSet(d, resp.Model.Tags); err != nil { + return fmt.Errorf("setting `tags`: %s", err) + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } diff --git a/internal/services/kusto/kusto_cluster_managed_private_endpoint_resource.go b/internal/services/kusto/kusto_cluster_managed_private_endpoint_resource.go index 6d37eefdbaac..09e5283c398f 100644 --- a/internal/services/kusto/kusto_cluster_managed_private_endpoint_resource.go +++ b/internal/services/kusto/kusto_cluster_managed_private_endpoint_resource.go @@ -4,14 +4,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -32,7 +32,7 @@ func resourceKustoClusterManagedPrivateEndpoint() *pluginsdk.Resource { }), Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ManagedPrivateEndpointsID(id) + _, err := managedprivateendpoints.ParseManagedPrivateEndpointID(id) return err }), @@ -96,44 +96,40 @@ func resourceKustoClusterManagedPrivateEndpointCreateUpdate(d *schema.ResourceDa ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewManagedPrivateEndpointsID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("name").(string)) + id := managedprivateendpoints.NewManagedPrivateEndpointID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("name").(string)) if d.IsNewResource() { - managedPrivateEndpoint, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.ManagedPrivateEndpointName) + managedPrivateEndpoint, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(managedPrivateEndpoint.Response) { + if !response.WasNotFound(managedPrivateEndpoint.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(managedPrivateEndpoint.Response) { + if !response.WasNotFound(managedPrivateEndpoint.HttpResponse) { return tf.ImportAsExistsError("azurerm_kusto_cluster_managed_private_endpoint", id.ID()) } } - managedPrivateEndpoint := kusto.ManagedPrivateEndpoint{ - ManagedPrivateEndpointProperties: &kusto.ManagedPrivateEndpointProperties{ - PrivateLinkResourceID: utils.String(d.Get("private_link_resource_id").(string)), - GroupID: utils.String(d.Get("group_id").(string)), + managedPrivateEndpoint := managedprivateendpoints.ManagedPrivateEndpoint{ + Properties: &managedprivateendpoints.ManagedPrivateEndpointProperties{ + PrivateLinkResourceId: d.Get("private_link_resource_id").(string), + GroupId: d.Get("group_id").(string), }, } if v, ok := d.GetOk("private_link_resource_region"); ok { - managedPrivateEndpoint.PrivateLinkResourceRegion = utils.String(v.(string)) + managedPrivateEndpoint.Properties.PrivateLinkResourceRegion = utils.String(v.(string)) } if v, ok := d.GetOk("request_message"); ok { - managedPrivateEndpoint.RequestMessage = utils.String(v.(string)) + managedPrivateEndpoint.Properties.RequestMessage = utils.String(v.(string)) } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.ManagedPrivateEndpointName, managedPrivateEndpoint) + err := client.CreateOrUpdateThenPoll(ctx, id, managedPrivateEndpoint) if err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceKustoClusterManagedPrivateEndpointRead(d, meta) } @@ -143,14 +139,14 @@ func resourceKustoClusterManagedPrivateEndpointRead(d *schema.ResourceData, meta ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ManagedPrivateEndpointsID(d.Id()) + id, err := managedprivateendpoints.ParseManagedPrivateEndpointID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.ManagedPrivateEndpointName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -159,16 +155,22 @@ func resourceKustoClusterManagedPrivateEndpointRead(d *schema.ResourceData, meta d.Set("name", id.ManagedPrivateEndpointName) d.Set("cluster_name", id.ClusterName) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("private_link_resource_id", resp.PrivateLinkResourceID) - d.Set("group_id", resp.GroupID) + d.Set("resource_group_name", id.ResourceGroupName) - if resp.PrivateLinkResourceRegion != nil { - d.Set("private_link_resource_region", resp.PrivateLinkResourceRegion) - } + if resp.Model != nil { + props := resp.Model.Properties + if props != nil { + d.Set("private_link_resource_id", props.PrivateLinkResourceId) + d.Set("group_id", props.GroupId) + + if props.PrivateLinkResourceRegion != nil { + d.Set("private_link_resource_region", props.PrivateLinkResourceRegion) + } - if resp.RequestMessage != nil { - d.Set("request_message", resp.RequestMessage) + if props.RequestMessage != nil { + d.Set("request_message", props.RequestMessage) + } + } } return nil @@ -179,20 +181,15 @@ func resourceKustoClusterManagedPrivateEndpointDelete(d *schema.ResourceData, me ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ManagedPrivateEndpointsID(d.Id()) + id, err := managedprivateendpoints.ParseManagedPrivateEndpointID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ClusterName, id.ManagedPrivateEndpointName) - + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - return nil } diff --git a/internal/services/kusto/kusto_cluster_managed_private_endpoint_resource_test.go b/internal/services/kusto/kusto_cluster_managed_private_endpoint_resource_test.go index e94fc67f55d8..d84e077567c3 100644 --- a/internal/services/kusto/kusto_cluster_managed_private_endpoint_resource_test.go +++ b/internal/services/kusto/kusto_cluster_managed_private_endpoint_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -27,7 +27,8 @@ func TestAccKustoClusterManagedPrivateEndpoint_basic(t *testing.T) { check.That(data.ResourceName).Key("group_id").HasValue("blob"), ), }, - data.ImportStep()}, + data.ImportStep(), + }, ) } @@ -44,22 +45,26 @@ func TestAccKustoClusterManagedPrivateEndpoint_complete(t *testing.T) { check.That(data.ResourceName).Key("request_message").HasValue("Please Approve"), ), }, - data.ImportStep()}, + data.ImportStep(), + }, ) } func (KustoClusterManagedPrivateEndpointResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ManagedPrivateEndpointsID(state.ID) + id, err := managedprivateendpoints.ParseManagedPrivateEndpointID(state.ID) if err != nil { return nil, err } - resp, err := clients.Kusto.ClusterManagedPrivateEndpointClient.Get(ctx, id.ResourceGroup, id.ClusterName, id.ManagedPrivateEndpointName) + resp, err := clients.Kusto.ClusterManagedPrivateEndpointClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", id.String(), err) } - return utils.Bool(resp.ManagedPrivateEndpointProperties != nil), nil + if resp.Model == nil { + return nil, fmt.Errorf("response model is empty") + } + return utils.Bool(resp.Model.Properties != nil), nil } func (r KustoClusterManagedPrivateEndpointResource) basic(data acceptance.TestData) string { diff --git a/internal/services/kusto/kusto_cluster_principal_assignment_resource.go b/internal/services/kusto/kusto_cluster_principal_assignment_resource.go index f4a8bd6dcc42..0977f4cbdd40 100644 --- a/internal/services/kusto/kusto_cluster_principal_assignment_resource.go +++ b/internal/services/kusto/kusto_cluster_principal_assignment_resource.go @@ -4,12 +4,12 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -29,7 +29,7 @@ func resourceKustoClusterPrincipalAssignment() *pluginsdk.Resource { }), Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ClusterPrincipalAssignmentID(id) + _, err := clusterprincipalassignments.ParsePrincipalAssignmentID(id) return err }), @@ -82,24 +82,17 @@ func resourceKustoClusterPrincipalAssignment() *pluginsdk.Resource { }, "principal_type": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.PrincipalTypeApp), - string(kusto.PrincipalTypeGroup), - string(kusto.PrincipalTypeUser), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(clusterprincipalassignments.PossibleValuesForPrincipalType(), false), }, "role": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.ClusterPrincipalRoleAllDatabasesAdmin), - string(kusto.ClusterPrincipalRoleAllDatabasesViewer), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(clusterprincipalassignments.PossibleValuesForClusterPrincipalRole(), false), }, }, } @@ -111,16 +104,16 @@ func resourceKustoClusterPrincipalAssignmentCreateUpdate(d *pluginsdk.ResourceDa ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewClusterPrincipalAssignmentID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("name").(string)) + id := clusterprincipalassignments.NewPrincipalAssignmentID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("name").(string)) if d.IsNewResource() { - principalAssignment, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.PrincipalAssignmentName) + principalAssignment, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(principalAssignment.Response) { + if !response.WasNotFound(principalAssignment.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(principalAssignment.Response) { + if !response.WasNotFound(principalAssignment.HttpResponse) { return tf.ImportAsExistsError("azurerm_kusto_cluster_principal_assignment", id.ID()) } } @@ -130,24 +123,20 @@ func resourceKustoClusterPrincipalAssignmentCreateUpdate(d *pluginsdk.ResourceDa principalType := d.Get("principal_type").(string) role := d.Get("role").(string) - principalAssignment := kusto.ClusterPrincipalAssignment{ - ClusterPrincipalProperties: &kusto.ClusterPrincipalProperties{ - TenantID: utils.String(tenantID), - PrincipalID: utils.String(principalID), - PrincipalType: kusto.PrincipalType(principalType), - Role: kusto.ClusterPrincipalRole(role), + principalAssignment := clusterprincipalassignments.ClusterPrincipalAssignment{ + Properties: &clusterprincipalassignments.ClusterPrincipalProperties{ + TenantId: utils.String(tenantID), + PrincipalId: principalID, + PrincipalType: clusterprincipalassignments.PrincipalType(principalType), + Role: clusterprincipalassignments.ClusterPrincipalRole(role), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.PrincipalAssignmentName, principalAssignment) + err := client.CreateOrUpdateThenPoll(ctx, id, principalAssignment) if err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceKustoClusterPrincipalAssignmentRead(d, meta) } @@ -157,14 +146,14 @@ func resourceKustoClusterPrincipalAssignmentRead(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ClusterPrincipalAssignmentID(d.Id()) + id, err := clusterprincipalassignments.ParsePrincipalAssignmentID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.PrincipalAssignmentName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } @@ -173,34 +162,36 @@ func resourceKustoClusterPrincipalAssignmentRead(d *pluginsdk.ResourceData, meta d.Set("name", id.PrincipalAssignmentName) d.Set("cluster_name", id.ClusterName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) - principalID := "" - if resp.PrincipalID != nil { - principalID = *resp.PrincipalID - } - d.Set("principal_id", principalID) + if resp.Model != nil { + props := resp.Model.Properties - principalName := "" - if resp.PrincipalName != nil { - principalName = *resp.PrincipalName - } - d.Set("principal_name", principalName) + if props != nil { + d.Set("principal_id", props.PrincipalId) - d.Set("principal_type", string(resp.PrincipalType)) - d.Set("role", string(resp.Role)) + principalName := "" + if props.PrincipalName != nil { + principalName = *props.PrincipalName + } + d.Set("principal_name", principalName) - tenantID := "" - if resp.TenantID != nil { - tenantID = *resp.TenantID - } - d.Set("tenant_id", tenantID) + d.Set("principal_type", string(props.PrincipalType)) + d.Set("role", string(props.Role)) + + tenantID := "" + if props.TenantId != nil { + tenantID = *props.TenantId + } + d.Set("tenant_id", tenantID) - tenantName := "" - if resp.TenantName != nil { - tenantName = *resp.TenantName + tenantName := "" + if props.TenantName != nil { + tenantName = *props.TenantName + } + d.Set("tenant_name", tenantName) + } } - d.Set("tenant_name", tenantName) return nil } @@ -210,19 +201,15 @@ func resourceKustoClusterPrincipalAssignmentDelete(d *pluginsdk.ResourceData, me ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ClusterPrincipalAssignmentID(d.Id()) + id, err := clusterprincipalassignments.ParsePrincipalAssignmentID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ClusterName, id.PrincipalAssignmentName) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - return nil } diff --git a/internal/services/kusto/kusto_cluster_principal_assignment_resource_test.go b/internal/services/kusto/kusto_cluster_principal_assignment_resource_test.go index dab46267e1c1..9e82022f4212 100644 --- a/internal/services/kusto/kusto_cluster_principal_assignment_resource_test.go +++ b/internal/services/kusto/kusto_cluster_principal_assignment_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type KustoClusterPrincipalAssignmentResource struct{} @@ -31,17 +30,22 @@ func TestAccKustoClusterPrincipalAssignment_basic(t *testing.T) { } func (KustoClusterPrincipalAssignmentResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ClusterPrincipalAssignmentID(state.ID) + id, err := clusterprincipalassignments.ParsePrincipalAssignmentID(state.ID) if err != nil { return nil, err } - resp, err := clients.Kusto.ClusterPrincipalAssignmentsClient.Get(ctx, id.ResourceGroup, id.ClusterName, id.PrincipalAssignmentName) + resp, err := clients.Kusto.ClusterPrincipalAssignmentsClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", id.String(), err) } - return utils.Bool(resp.ClusterPrincipalProperties != nil), nil + if resp.Model == nil { + return nil, fmt.Errorf("response model is empty") + } + + exists := resp.Model.Properties != nil + return &exists, nil } func (KustoClusterPrincipalAssignmentResource) basic(data acceptance.TestData) string { diff --git a/internal/services/kusto/kusto_cluster_resource.go b/internal/services/kusto/kusto_cluster_resource.go index eaf4da4eca5f..75fa2a40e98d 100644 --- a/internal/services/kusto/kusto_cluster_resource.go +++ b/internal/services/kusto/kusto_cluster_resource.go @@ -6,12 +6,14 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" - "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-07-07/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters" + newCluster "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-07-07/clusters" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" @@ -19,9 +21,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -41,7 +41,7 @@ func resourceKustoCluster() *pluginsdk.Resource { }), Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ClusterID(id) + _, err := clusters.ParseClusterID(id) return err }), @@ -75,7 +75,9 @@ func resourceKustoCluster() *pluginsdk.Resource { "name": { Type: pluginsdk.TypeString, Required: true, - ValidateFunc: validation.StringInSlice(clusters.PossibleValuesForAzureSkuName(), + // using API version later than 2022-07-07 to unblock user access to latest skus. + // next PR will to API version upgrade to version 2022-12-10 and align the api version in kusto. + ValidateFunc: validation.StringInSlice(newCluster.PossibleValuesForAzureSkuName(), false), }, @@ -168,22 +170,16 @@ func resourceKustoCluster() *pluginsdk.Resource { Type: pluginsdk.TypeList, Optional: true, Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.LanguageExtensionNamePYTHON), - string(kusto.LanguageExtensionNameR), - }, false), + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringInSlice(clusters.PossibleValuesForLanguageExtensionName(), false), }, }, "engine": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.EngineTypeV2), - string(kusto.EngineTypeV3), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(clusters.PossibleValuesForEngineType(), false), }, "uri": { @@ -197,13 +193,10 @@ func resourceKustoCluster() *pluginsdk.Resource { }, "public_ip_type": { - Type: pluginsdk.TypeString, - Optional: true, - Default: string(kusto.PublicIPTypeIPv4), - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.PublicIPTypeIPv4), - string(kusto.PublicIPTypeDualStack), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + Default: string(clusters.PublicIPTypeIPvFour), + ValidateFunc: validation.StringInSlice(clusters.PossibleValuesForPublicIPType(), false), }, "public_network_access_enabled": { @@ -250,14 +243,14 @@ func resourceKustoCluster() *pluginsdk.Resource { "zones": commonschema.ZonesMultipleOptionalForceNew(), - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } if features.FourPointOhBeta() { - s.Schema["engine"].Default = string(kusto.EngineTypeV3) + s.Schema["engine"].Default = string(clusters.EngineTypeVThree) } else { - s.Schema["engine"].Default = string(kusto.EngineTypeV2) + s.Schema["engine"].Default = string(clusters.EngineTypeVTwo) } return s @@ -271,22 +264,20 @@ func resourceKustoClusterCreateUpdate(d *pluginsdk.ResourceData, meta interface{ log.Printf("[INFO] preparing arguments for Azure Kusto Cluster creation.") - id := parse.NewClusterID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := clusters.NewClusterID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - server, err := client.Get(ctx, id.ResourceGroup, id.Name) - if err != nil { - if !utils.ResponseWasNotFound(server.Response) { - return fmt.Errorf("checking for presence of existing %s: %+v", id, err) - } + existing, err := client.Get(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for existing %s: %+v", id, err) } - if !utils.ResponseWasNotFound(server.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_kusto_cluster", id.ID()) } } - locks.ByID(id.Name) - defer locks.UnlockByID(id.Name) + locks.ByName(id.ClusterName, "azurerm_kusto_cluster") + defer locks.UnlockByName(id.ClusterName, "azurerm_kusto_cluster") sku, err := expandKustoClusterSku(d.Get("sku").([]interface{})) if err != nil { @@ -295,13 +286,16 @@ func resourceKustoClusterCreateUpdate(d *pluginsdk.ResourceData, meta interface{ optimizedAutoScale := expandOptimizedAutoScale(d.Get("optimized_auto_scale").([]interface{})) - if optimizedAutoScale != nil && *optimizedAutoScale.IsEnabled { + if optimizedAutoScale != nil && optimizedAutoScale.IsEnabled { + if sku.Capacity == nil { + return fmt.Errorf("sku.capacity could not be empty") + } // Ensure that requested Capcity is always between min and max to support updating to not overlapping autoscale ranges - if *sku.Capacity < *optimizedAutoScale.Minimum { - sku.Capacity = utils.Int32(*optimizedAutoScale.Minimum) + if *sku.Capacity < optimizedAutoScale.Minimum { + sku.Capacity = utils.Int64(optimizedAutoScale.Minimum) } - if *sku.Capacity > *optimizedAutoScale.Maximum { - sku.Capacity = utils.Int32(*optimizedAutoScale.Maximum) + if *sku.Capacity > optimizedAutoScale.Maximum { + sku.Capacity = utils.Int64(optimizedAutoScale.Maximum) } // Capacity must be set for the initial creation when using OptimizedAutoScaling but cannot be updated @@ -309,28 +303,30 @@ func resourceKustoClusterCreateUpdate(d *pluginsdk.ResourceData, meta interface{ return fmt.Errorf("cannot change `sku.capacity` when `optimized_auto_scaling.enabled` is set to `true`") } - if *optimizedAutoScale.Minimum > *optimizedAutoScale.Maximum { + if optimizedAutoScale.Minimum > optimizedAutoScale.Maximum { return fmt.Errorf("`optimized_auto_scaling.maximum_instances` must be >= `optimized_auto_scaling.minimum_instances`") } } - engine := kusto.EngineType(d.Get("engine").(string)) + engine := clusters.EngineType(d.Get("engine").(string)) - publicNetworkAccess := kusto.PublicNetworkAccessEnabled + publicNetworkAccess := clusters.PublicNetworkAccessEnabled if !d.Get("public_network_access_enabled").(bool) { - publicNetworkAccess = kusto.PublicNetworkAccessDisabled + publicNetworkAccess = clusters.PublicNetworkAccessDisabled } - clusterProperties := kusto.ClusterProperties{ + publicIPType := clusters.PublicIPType(d.Get("public_ip_type").(string)) + + clusterProperties := clusters.ClusterProperties{ OptimizedAutoscale: optimizedAutoScale, EnableAutoStop: utils.Bool(d.Get("auto_stop_enabled").(bool)), EnableDiskEncryption: utils.Bool(d.Get("disk_encryption_enabled").(bool)), EnableDoubleEncryption: utils.Bool(d.Get("double_encryption_enabled").(bool)), EnableStreamingIngest: utils.Bool(d.Get("streaming_ingestion_enabled").(bool)), EnablePurge: utils.Bool(d.Get("purge_enabled").(bool)), - EngineType: engine, - PublicNetworkAccess: publicNetworkAccess, - PublicIPType: kusto.PublicIPType(d.Get("public_ip_type").(string)), + EngineType: &engine, + PublicNetworkAccess: &publicNetworkAccess, + PublicIPType: &publicIPType, TrustedExternalTenants: expandTrustedExternalTenants(d.Get("trusted_external_tenants").([]interface{})), } @@ -347,25 +343,26 @@ func resourceKustoClusterCreateUpdate(d *pluginsdk.ResourceData, meta interface{ clusterProperties.AllowedIPRangeList, _ = expandKustoListString(v.([]interface{})) } - clusterProperties.RestrictOutboundNetworkAccess = kusto.ClusterNetworkAccessFlagDisabled + restrictOutboundNetworkAccess := clusters.ClusterNetworkAccessFlagDisabled if v, ok := d.GetOk("outbound_network_access_restricted"); ok { if v.(bool) { - clusterProperties.RestrictOutboundNetworkAccess = kusto.ClusterNetworkAccessFlagEnabled + restrictOutboundNetworkAccess = clusters.ClusterNetworkAccessFlagEnabled } } + clusterProperties.RestrictOutboundNetworkAccess = &restrictOutboundNetworkAccess - expandedIdentity, err := expandClusterIdentity(d.Get("identity").([]interface{})) + expandedIdentity, err := identity.ExpandSystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) } - kustoCluster := kusto.Cluster{ - Name: utils.String(id.Name), - Location: utils.String(location.Normalize(d.Get("location").(string))), - Identity: expandedIdentity, - Sku: sku, - ClusterProperties: &clusterProperties, - Tags: tags.Expand(d.Get("tags").(map[string]interface{})), + kustoCluster := clusters.Cluster{ + Name: utils.String(id.ClusterName), + Location: location.Normalize(d.Get("location").(string)), + Identity: expandedIdentity, + Sku: *sku, + Properties: &clusterProperties, + Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } zones := zones.ExpandUntyped(d.Get("zones").(*schema.Set).List()) @@ -373,52 +370,46 @@ func resourceKustoClusterCreateUpdate(d *pluginsdk.ResourceData, meta interface{ kustoCluster.Zones = &zones } - ifMatch := "" - ifNoneMatch := "" - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.Name, kustoCluster, ifMatch, ifNoneMatch) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, kustoCluster, clusters.CreateOrUpdateOperationOptions{}); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for create/update of %s: %+v", id, err) - } d.SetId(id.ID()) if v, ok := d.GetOk("language_extensions"); ok { languageExtensions := expandKustoClusterLanguageExtensions(v.([]interface{})) - currentLanguageExtensions, err := client.ListLanguageExtensions(ctx, id.ResourceGroup, id.Name) + currentLanguageExtensions, err := client.ListLanguageExtensions(ctx, id) if err != nil { return fmt.Errorf("retrieving the language extensions on %s: %+v", id, err) } - languageExtensionsToAdd := diffLanguageExtensions(*languageExtensions.Value, *currentLanguageExtensions.Value) + languageExtensionsToAdd := diffLanguageExtensions(*languageExtensions.Value, *currentLanguageExtensions.Model.Value) if len(languageExtensionsToAdd) > 0 { - languageExtensionsListToAdd := kusto.LanguageExtensionsList{ + languageExtensionsListToAdd := clusters.LanguageExtensionsList{ Value: &languageExtensionsToAdd, } - future, err := client.AddLanguageExtensions(ctx, id.ResourceGroup, id.Name, languageExtensionsListToAdd) + resp, err := client.AddLanguageExtensions(ctx, id, languageExtensionsListToAdd) if err != nil { return fmt.Errorf("adding language extensions to %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { + if err = resp.Poller.PollUntilDone(); err != nil { return fmt.Errorf("waiting for the addition of language extensions on %s: %+v", id, err) } } - languageExtensionsToRemove := diffLanguageExtensions(*currentLanguageExtensions.Value, *languageExtensions.Value) + languageExtensionsToRemove := diffLanguageExtensions(*currentLanguageExtensions.Model.Value, *languageExtensions.Value) if len(languageExtensionsToRemove) > 0 { - languageExtensionsListToRemove := kusto.LanguageExtensionsList{ + languageExtensionsListToRemove := clusters.LanguageExtensionsList{ Value: &languageExtensionsToRemove, } - removeLanguageExtensionsFuture, err := client.RemoveLanguageExtensions(ctx, id.ResourceGroup, id.Name, languageExtensionsListToRemove) + removeLanguageExtensionsFuture, err := client.RemoveLanguageExtensions(ctx, id, languageExtensionsListToRemove) if err != nil { return fmt.Errorf("removing language extensions from %s: %+v", id, err) } - if err = removeLanguageExtensionsFuture.WaitForCompletionRef(ctx, client.Client); err != nil { + if err = removeLanguageExtensionsFuture.Poller.PollUntilDone(); err != nil { return fmt.Errorf("waiting for the removal of language extensions from %s: %+v", id, err) } } @@ -432,63 +423,74 @@ func resourceKustoClusterRead(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ClusterID(d.Id()) + id, err := clusters.ParseClusterID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.ClusterName) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("location", location.NormalizeNilable(resp.Location)) - d.Set("zones", zones.FlattenUntyped(resp.Zones)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) + d.Set("zones", zones.FlattenUntyped(model.Zones)) - d.Set("public_network_access_enabled", resp.PublicNetworkAccess == kusto.PublicNetworkAccessEnabled) + identity, err := identity.FlattenSystemAndUserAssignedMap(model.Identity) + if err != nil { + return fmt.Errorf("flattening `identity`: %+v", err) + } + if err := d.Set("identity", identity); err != nil { + return fmt.Errorf("setting `identity`: %s", err) + } - identity, err := flattenClusterIdentity(resp.Identity) - if err != nil { - return fmt.Errorf("flattening `identity`: %+v", err) - } - if err := d.Set("identity", identity); err != nil { - return fmt.Errorf("setting `identity`: %s", err) - } + if err := d.Set("sku", flattenKustoClusterSku(&model.Sku)); err != nil { + return fmt.Errorf("setting `sku`: %+v", err) + } - if err := d.Set("sku", flattenKustoClusterSku(resp.Sku)); err != nil { - return fmt.Errorf("setting `sku`: %+v", err) - } + if props := model.Properties; props != nil { + if props.PublicNetworkAccess != nil { + d.Set("public_network_access_enabled", *props.PublicNetworkAccess == clusters.PublicNetworkAccessEnabled) + } - if err := d.Set("optimized_auto_scale", flattenOptimizedAutoScale(resp.OptimizedAutoscale)); err != nil { - return fmt.Errorf("setting `optimized_auto_scale`: %+v", err) - } + if props.RestrictOutboundNetworkAccess != nil { + d.Set("outbound_network_access_restricted", *props.RestrictOutboundNetworkAccess == clusters.ClusterNetworkAccessFlagEnabled) + } - if props := resp.ClusterProperties; props != nil { - d.Set("allowed_fqdns", props.AllowedFqdnList) - d.Set("allowed_ip_ranges", props.AllowedIPRangeList) - d.Set("double_encryption_enabled", props.EnableDoubleEncryption) - d.Set("trusted_external_tenants", flattenTrustedExternalTenants(props.TrustedExternalTenants)) - d.Set("auto_stop_enabled", props.EnableAutoStop) - d.Set("disk_encryption_enabled", props.EnableDiskEncryption) - d.Set("streaming_ingestion_enabled", props.EnableStreamingIngest) - d.Set("purge_enabled", props.EnablePurge) - d.Set("virtual_network_configuration", flattenKustoClusterVNET(props.VirtualNetworkConfiguration)) - d.Set("language_extensions", flattenKustoClusterLanguageExtensions(props.LanguageExtensions)) - d.Set("uri", props.URI) - d.Set("data_ingestion_uri", props.DataIngestionURI) - d.Set("engine", props.EngineType) - d.Set("public_ip_type", props.PublicIPType) - d.Set("outbound_network_access_restricted", props.RestrictOutboundNetworkAccess == kusto.ClusterNetworkAccessFlagEnabled) + if err := d.Set("optimized_auto_scale", flattenOptimizedAutoScale(props.OptimizedAutoscale)); err != nil { + return fmt.Errorf("setting `optimized_auto_scale`: %+v", err) + } + d.Set("allowed_fqdns", props.AllowedFqdnList) + d.Set("allowed_ip_ranges", props.AllowedIPRangeList) + d.Set("double_encryption_enabled", props.EnableDoubleEncryption) + d.Set("trusted_external_tenants", flattenTrustedExternalTenants(props.TrustedExternalTenants)) + d.Set("auto_stop_enabled", props.EnableAutoStop) + d.Set("disk_encryption_enabled", props.EnableDiskEncryption) + d.Set("streaming_ingestion_enabled", props.EnableStreamingIngest) + d.Set("purge_enabled", props.EnablePurge) + d.Set("virtual_network_configuration", flattenKustoClusterVNET(props.VirtualNetworkConfiguration)) + d.Set("language_extensions", flattenKustoClusterLanguageExtensions(props.LanguageExtensions)) + d.Set("uri", props.Uri) + d.Set("data_ingestion_uri", props.DataIngestionUri) + d.Set("engine", props.EngineType) + d.Set("public_ip_type", props.PublicIPType) + + } + + if err := tags.FlattenAndSet(d, model.Tags); err != nil { + return err + } } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceKustoClusterDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -496,58 +498,43 @@ func resourceKustoClusterDelete(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ClusterID(d.Id()) + id, err := clusters.ParseClusterID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.Name) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) - } - return nil } -func expandOptimizedAutoScale(input []interface{}) *kusto.OptimizedAutoscale { +func expandOptimizedAutoScale(input []interface{}) *clusters.OptimizedAutoscale { if len(input) == 0 || input[0] == nil { return nil } config := input[0].(map[string]interface{}) - optimizedAutoScale := &kusto.OptimizedAutoscale{ - Version: utils.Int32(1), - IsEnabled: utils.Bool(true), - Minimum: utils.Int32(int32(config["minimum_instances"].(int))), - Maximum: utils.Int32(int32(config["maximum_instances"].(int))), + optimizedAutoScale := &clusters.OptimizedAutoscale{ + Version: 1, + IsEnabled: true, + Minimum: int64(config["minimum_instances"].(int)), + Maximum: int64(config["maximum_instances"].(int)), } return optimizedAutoScale } -func flattenOptimizedAutoScale(optimizedAutoScale *kusto.OptimizedAutoscale) []interface{} { +func flattenOptimizedAutoScale(optimizedAutoScale *clusters.OptimizedAutoscale) []interface{} { if optimizedAutoScale == nil { return []interface{}{} } - maxInstances := 0 - if optimizedAutoScale.Maximum != nil { - maxInstances = int(*optimizedAutoScale.Maximum) - } - - minInstances := 0 - if optimizedAutoScale.Minimum != nil { - minInstances = int(*optimizedAutoScale.Minimum) - } - return []interface{}{ map[string]interface{}{ - "maximum_instances": maxInstances, - "minimum_instances": minInstances, + "maximum_instances": int(optimizedAutoScale.Maximum), + "minimum_instances": int(optimizedAutoScale.Minimum), }, } } @@ -566,7 +553,7 @@ func expandKustoListString(input []interface{}) (*[]string, error) { return &result, nil } -func expandKustoClusterSku(input []interface{}) (*kusto.AzureSku, error) { +func expandKustoClusterSku(input []interface{}) (*clusters.AzureSku, error) { sku := input[0].(map[string]interface{}) name := sku["name"].(string) @@ -582,16 +569,16 @@ func expandKustoClusterSku(input []interface{}) (*kusto.AzureSku, error) { } capacity := sku["capacity"].(int) - azureSku := &kusto.AzureSku{ - Name: kusto.AzureSkuName(name), - Tier: kusto.AzureSkuTier(tier), - Capacity: utils.Int32(int32(capacity)), + azureSku := clusters.AzureSku{ + Name: clusters.AzureSkuName(name), + Tier: clusters.AzureSkuTier(tier), + Capacity: utils.Int64(int64(capacity)), } - return azureSku, nil + return &azureSku, nil } -func expandKustoClusterVNET(input []interface{}) *kusto.VirtualNetworkConfiguration { +func expandKustoClusterVNET(input []interface{}) *clusters.VirtualNetworkConfiguration { if len(input) == 0 || input[0] == nil { return nil } @@ -601,80 +588,33 @@ func expandKustoClusterVNET(input []interface{}) *kusto.VirtualNetworkConfigurat enginePublicIPID := vnet["engine_public_ip_id"].(string) dataManagementPublicIPID := vnet["data_management_public_ip_id"].(string) - return &kusto.VirtualNetworkConfiguration{ - SubnetID: &subnetID, - EnginePublicIPID: &enginePublicIPID, - DataManagementPublicIPID: &dataManagementPublicIPID, + return &clusters.VirtualNetworkConfiguration{ + SubnetId: subnetID, + EnginePublicIPId: enginePublicIPID, + DataManagementPublicIPId: dataManagementPublicIPID, } } -func expandKustoClusterLanguageExtensions(input []interface{}) *kusto.LanguageExtensionsList { +func expandKustoClusterLanguageExtensions(input []interface{}) *clusters.LanguageExtensionsList { if len(input) == 0 { return nil } - extensions := make([]kusto.LanguageExtension, 0) + extensions := make([]clusters.LanguageExtension, 0) for _, language := range input { - v := kusto.LanguageExtension{ - LanguageExtensionName: kusto.LanguageExtensionName(language.(string)), + name := clusters.LanguageExtensionName(language.(string)) + v := clusters.LanguageExtension{ + LanguageExtensionName: &name, } extensions = append(extensions, v) } - return &kusto.LanguageExtensionsList{ + return &clusters.LanguageExtensionsList{ Value: &extensions, } } -func expandClusterIdentity(input []interface{}) (*kusto.Identity, error) { - expanded, err := identity.ExpandSystemAndUserAssignedMap(input) - if err != nil { - return nil, err - } - - out := kusto.Identity{ - Type: kusto.IdentityType(string(expanded.Type)), - } - - if expanded.Type == identity.TypeUserAssigned || expanded.Type == identity.TypeSystemAssignedUserAssigned { - out.UserAssignedIdentities = make(map[string]*kusto.IdentityUserAssignedIdentitiesValue) - for k := range expanded.IdentityIds { - out.UserAssignedIdentities[k] = &kusto.IdentityUserAssignedIdentitiesValue{ - // intentionally empty - } - } - } - return &out, nil -} - -func flattenClusterIdentity(input *kusto.Identity) (*[]interface{}, error) { - var transform *identity.SystemAndUserAssignedMap - - if input != nil { - transform = &identity.SystemAndUserAssignedMap{ - Type: identity.Type(string(input.Type)), - IdentityIds: make(map[string]identity.UserAssignedIdentityDetails), - } - if input.PrincipalID != nil { - transform.PrincipalId = *input.PrincipalID - } - if input.TenantID != nil { - transform.TenantId = *input.TenantID - } - if input.UserAssignedIdentities != nil { - for k, v := range input.UserAssignedIdentities { - transform.IdentityIds[k] = identity.UserAssignedIdentityDetails{ - ClientId: v.ClientID, - PrincipalId: v.PrincipalID, - } - } - } - } - - return identity.FlattenSystemAndUserAssignedMap(transform) -} - -func flattenKustoClusterSku(sku *kusto.AzureSku) []interface{} { +func flattenKustoClusterSku(sku *clusters.AzureSku) []interface{} { if sku == nil { return []interface{}{} } @@ -690,58 +630,49 @@ func flattenKustoClusterSku(sku *kusto.AzureSku) []interface{} { return []interface{}{s} } -func flattenKustoClusterVNET(vnet *kusto.VirtualNetworkConfiguration) []interface{} { +func flattenKustoClusterVNET(vnet *clusters.VirtualNetworkConfiguration) []interface{} { if vnet == nil { return []interface{}{} } - subnetID := "" - if vnet.SubnetID != nil { - subnetID = *vnet.SubnetID - } - - enginePublicIPID := "" - if vnet.EnginePublicIPID != nil { - enginePublicIPID = *vnet.EnginePublicIPID - } - - dataManagementPublicIPID := "" - if vnet.DataManagementPublicIPID != nil { - dataManagementPublicIPID = *vnet.DataManagementPublicIPID - } - output := map[string]interface{}{ - "subnet_id": subnetID, - "engine_public_ip_id": enginePublicIPID, - "data_management_public_ip_id": dataManagementPublicIPID, + "subnet_id": vnet.SubnetId, + "engine_public_ip_id": vnet.EnginePublicIPId, + "data_management_public_ip_id": vnet.DataManagementPublicIPId, } return []interface{}{output} } -func flattenKustoClusterLanguageExtensions(extensions *kusto.LanguageExtensionsList) []interface{} { +func flattenKustoClusterLanguageExtensions(extensions *clusters.LanguageExtensionsList) []interface{} { if extensions == nil { return []interface{}{} } output := make([]interface{}, 0) - for _, v := range *extensions.Value { - output = append(output, v.LanguageExtensionName) + if extensions.Value != nil { + for _, v := range *extensions.Value { + output = append(output, v.LanguageExtensionName) + } } return output } -func diffLanguageExtensions(a, b []kusto.LanguageExtension) []kusto.LanguageExtension { +func diffLanguageExtensions(a, b []clusters.LanguageExtension) []clusters.LanguageExtension { target := make(map[string]bool) for _, x := range b { - target[string(x.LanguageExtensionName)] = true + if x.LanguageExtensionName != nil { + target[string(*x.LanguageExtensionName)] = true + } } - diff := make([]kusto.LanguageExtension, 0) + diff := make([]clusters.LanguageExtension, 0) for _, x := range a { - if _, ok := target[string(x.LanguageExtensionName)]; !ok { - diff = append(diff, x) + if x.LanguageExtensionName != nil { + if _, ok := target[string(*x.LanguageExtensionName)]; !ok { + diff = append(diff, x) + } } } diff --git a/internal/services/kusto/kusto_cluster_resource_test.go b/internal/services/kusto/kusto_cluster_resource_test.go index 224eb5c4b333..fcc52f3c10ae 100644 --- a/internal/services/kusto/kusto_cluster_resource_test.go +++ b/internal/services/kusto/kusto_cluster_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type KustoClusterResource struct{} @@ -377,17 +376,23 @@ func TestAccKustoCluster_newSkus(t *testing.T) { } func (KustoClusterResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ClusterID(state.ID) + id, err := clusters.ParseClusterID(state.ID) if err != nil { return nil, err } - resp, err := clients.Kusto.ClustersClient.Get(ctx, id.ResourceGroup, id.Name) + resp, err := clients.Kusto.ClustersClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", id.String(), err) } - return utils.Bool(resp.ClusterProperties != nil), nil + if resp.Model == nil { + return nil, fmt.Errorf("response model is empty") + } + + exists := resp.Model.Properties != nil + + return &exists, nil } func (KustoClusterResource) basic(data acceptance.TestData) string { diff --git a/internal/services/kusto/kusto_data_connection_import.go b/internal/services/kusto/kusto_data_connection_import.go index 8cdc9b6dc47a..bda9cabf880c 100644 --- a/internal/services/kusto/kusto_data_connection_import.go +++ b/internal/services/kusto/kusto_data_connection_import.go @@ -4,35 +4,36 @@ import ( "context" "fmt" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections" // nolint: staticcheck "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" ) -func importDataConnection(kind kusto.KindBasicDataConnection) pluginsdk.ImporterFunc { +func importDataConnection(kind string) pluginsdk.ImporterFunc { return func(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) (data []*pluginsdk.ResourceData, err error) { - id, err := parse.DataConnectionID(d.Id()) + id, err := dataconnections.ParseDataConnectionID(d.Id()) if err != nil { return []*pluginsdk.ResourceData{}, err } client := meta.(*clients.Client).Kusto.DataConnectionsClient - dataConnection, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + dataConnection, err := client.Get(ctx, *id) if err != nil { - return []*pluginsdk.ResourceData{}, fmt.Errorf("retrieving Kusto Data Connection %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return []*pluginsdk.ResourceData{}, fmt.Errorf("retrieving Kusto Data Connection %q (Resource Group %q): %+v", id.DataConnectionName, id.ResourceGroupName, err) } - if _, ok := dataConnection.Value.AsEventHubDataConnection(); ok && kind != kusto.KindBasicDataConnectionKindEventHub { - return nil, fmt.Errorf(`kusto data connection "kind" mismatch, expected "%s", got "%s"`, kind, kusto.KindBasicDataConnectionKindEventHub) - } + if dataConnection.Model != nil { + if dataCon, ok := (*dataConnection.Model).(dataconnections.EventHubDataConnection); ok && kind != "EventHub" { + return nil, fmt.Errorf(`kusto data connection "kind" mismatch, expected "%T", got "%T"`, kind, dataCon) + } - if _, ok := dataConnection.Value.AsIotHubDataConnection(); ok && kind != kusto.KindBasicDataConnectionKindIotHub { - return nil, fmt.Errorf(`kusto data connection "kind" mismatch, expected "%s", got "%s"`, kind, kusto.KindBasicDataConnectionKindIotHub) - } + if dataCon, ok := (*dataConnection.Model).(dataconnections.IotHubDataConnection); ok && kind != "IotHub" { + return nil, fmt.Errorf(`kusto data connection "kind" mismatch, expected "%T", got "%T"`, kind, dataCon) + } - if _, ok := dataConnection.Value.AsEventGridDataConnection(); ok && kind != kusto.KindBasicDataConnectionKindEventGrid { - return nil, fmt.Errorf(`kusto data connection "kind" mismatch, expected "%s", got "%s"`, kind, kusto.KindBasicDataConnectionKindEventGrid) + if dataCon, ok := (*dataConnection.Model).(dataconnections.EventGridDataConnection); ok && kind != "EventGrid" { + return nil, fmt.Errorf(`kusto data connection "kind" mismatch, expected "%T", got "%T"`, kind, dataCon) + } } return []*pluginsdk.ResourceData{d}, nil diff --git a/internal/services/kusto/kusto_database_data_source.go b/internal/services/kusto/kusto_database_data_source.go index 1469f6e6a33d..bd7d0dfb9489 100644 --- a/internal/services/kusto/kusto_database_data_source.go +++ b/internal/services/kusto/kusto_database_data_source.go @@ -4,14 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" kustoValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceKustoDatabase() *pluginsdk.Resource { @@ -68,34 +69,34 @@ func dataSourceKustoDatabaseRead(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDatabaseID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("name").(string)) + id := databases.NewDatabaseID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s does not exist", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } - if resp.Value == nil { + if resp.Model == nil { return fmt.Errorf("retrieving %s: response was nil", id) } - database, ok := resp.Value.AsReadWriteDatabase() + database, ok := (*resp.Model).(databases.ReadWriteDatabase) if !ok { return fmt.Errorf("%s was not a Read/Write Database", id) } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.DatabaseName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("cluster_name", id.ClusterName) d.Set("location", location.NormalizeNilable(database.Location)) - if props := database.ReadWriteDatabaseProperties; props != nil { + if props := database.Properties; props != nil { d.Set("hot_cache_period", props.HotCachePeriod) d.Set("soft_delete_period", props.SoftDeletePeriod) diff --git a/internal/services/kusto/kusto_database_principal_assignment_resource.go b/internal/services/kusto/kusto_database_principal_assignment_resource.go index 85bca06a12fb..165206140e14 100644 --- a/internal/services/kusto/kusto_database_principal_assignment_resource.go +++ b/internal/services/kusto/kusto_database_principal_assignment_resource.go @@ -4,12 +4,12 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -29,7 +29,7 @@ func resourceKustoDatabasePrincipalAssignment() *pluginsdk.Resource { }), Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DatabasePrincipalAssignmentID(id) + _, err := databaseprincipalassignments.ParseDatabasePrincipalAssignmentID(id) return err }), @@ -88,28 +88,17 @@ func resourceKustoDatabasePrincipalAssignment() *pluginsdk.Resource { }, "principal_type": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.PrincipalTypeApp), - string(kusto.PrincipalTypeGroup), - string(kusto.PrincipalTypeUser), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(databaseprincipalassignments.PossibleValuesForPrincipalType(), false), }, "role": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.DatabasePrincipalRoleAdmin), - string(kusto.DatabasePrincipalRoleIngestor), - string(kusto.DatabasePrincipalRoleMonitor), - string(kusto.DatabasePrincipalRoleUser), - string(kusto.DatabasePrincipalRoleUnrestrictedViewer), - string(kusto.DatabasePrincipalRoleViewer), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(databaseprincipalassignments.PossibleValuesForDatabasePrincipalRole(), false), }, }, } @@ -121,36 +110,32 @@ func resourceKustoDatabasePrincipalAssignmentCreate(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDatabasePrincipalAssignmentID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("database_name").(string), d.Get("name").(string)) - existing, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.PrincipalAssignmentName) + id := databaseprincipalassignments.NewDatabasePrincipalAssignmentID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("database_name").(string), d.Get("name").(string)) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_kusto_database_principal_assignment", id.ID()) } - principalAssignment := kusto.DatabasePrincipalAssignment{ - DatabasePrincipalProperties: &kusto.DatabasePrincipalProperties{ - TenantID: utils.String(d.Get("tenant_id").(string)), - PrincipalID: utils.String(d.Get("principal_id").(string)), - PrincipalType: kusto.PrincipalType(d.Get("principal_type").(string)), - Role: kusto.DatabasePrincipalRole(d.Get("role").(string)), + principalAssignment := databaseprincipalassignments.DatabasePrincipalAssignment{ + Properties: &databaseprincipalassignments.DatabasePrincipalProperties{ + TenantId: utils.String(d.Get("tenant_id").(string)), + PrincipalId: d.Get("principal_id").(string), + PrincipalType: databaseprincipalassignments.PrincipalType(d.Get("principal_type").(string)), + Role: databaseprincipalassignments.DatabasePrincipalRole(d.Get("role").(string)), }, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.PrincipalAssignmentName, principalAssignment) + err = client.CreateOrUpdateThenPoll(ctx, id, principalAssignment) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceKustoDatabasePrincipalAssignmentRead(d, meta) } @@ -160,50 +145,37 @@ func resourceKustoDatabasePrincipalAssignmentRead(d *pluginsdk.ResourceData, met ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatabasePrincipalAssignmentID(d.Id()) + id, err := databaseprincipalassignments.ParseDatabasePrincipalAssignmentID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.PrincipalAssignmentName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("resource_group_name", id.ResourceGroup) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("cluster_name", id.ClusterName) d.Set("database_name", id.DatabaseName) d.Set("name", id.PrincipalAssignmentName) - principalID := "" - if resp.PrincipalID != nil { - principalID = *resp.PrincipalID - } - d.Set("principal_id", principalID) + model := resp.Model - principalName := "" - if resp.PrincipalName != nil { - principalName = *resp.PrincipalName - } - d.Set("principal_name", principalName) - d.Set("principal_type", string(resp.PrincipalType)) - d.Set("role", string(resp.Role)) - - tenantID := "" - if resp.TenantID != nil { - tenantID = *resp.TenantID - } - d.Set("tenant_id", tenantID) - - tenantName := "" - if resp.TenantName != nil { - tenantName = *resp.TenantName + if model != nil { + if props := model.Properties; props != nil { + d.Set("principal_id", props.PrincipalId) + d.Set("principal_name", props.PrincipalName) + d.Set("principal_type", string(props.PrincipalType)) + d.Set("role", string(props.Role)) + d.Set("tenant_id", props.TenantId) + d.Set("tenant_name", props.TenantName) + } } - d.Set("tenant_name", tenantName) return nil } @@ -213,19 +185,15 @@ func resourceKustoDatabasePrincipalAssignmentDelete(d *pluginsdk.ResourceData, m ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatabasePrincipalAssignmentID(d.Id()) + id, err := databaseprincipalassignments.ParseDatabasePrincipalAssignmentID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.PrincipalAssignmentName) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } - return nil } diff --git a/internal/services/kusto/kusto_database_principal_assignment_resource_test.go b/internal/services/kusto/kusto_database_principal_assignment_resource_test.go index 7d136e63d980..2d0986e611de 100644 --- a/internal/services/kusto/kusto_database_principal_assignment_resource_test.go +++ b/internal/services/kusto/kusto_database_principal_assignment_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type KustoDatabasePrincipalAssignmentResource struct{} @@ -46,17 +45,19 @@ func TestAccKustoDatabasePrincipalAssignment_requiresImport(t *testing.T) { } func (KustoDatabasePrincipalAssignmentResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DatabasePrincipalAssignmentID(state.ID) + id, err := databaseprincipalassignments.ParseDatabasePrincipalAssignmentID(state.ID) if err != nil { return nil, err } - resp, err := clients.Kusto.DatabasePrincipalAssignmentsClient.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.PrincipalAssignmentName) + resp, err := clients.Kusto.DatabasePrincipalAssignmentsClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", id.String(), err) } - return utils.Bool(resp.DatabasePrincipalProperties != nil), nil + exists := resp.Model != nil + + return &exists, nil } func (KustoDatabasePrincipalAssignmentResource) basic(data acceptance.TestData) string { diff --git a/internal/services/kusto/kusto_database_resource.go b/internal/services/kusto/kusto_database_resource.go index 101310dcb162..1edc29e7fcda 100644 --- a/internal/services/kusto/kusto_database_resource.go +++ b/internal/services/kusto/kusto_database_resource.go @@ -4,14 +4,14 @@ import ( "fmt" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" kustoValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -31,7 +31,7 @@ func resourceKustoDatabase() *pluginsdk.Resource { }), Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DatabaseID(id) + _, err := databases.ParseDatabaseID(id) return err }), @@ -87,37 +87,33 @@ func resourceKustoDatabaseCreateUpdate(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewDatabaseID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("name").(string)) + id := databases.NewDatabaseID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_kusto_database", id.ID()) } } databaseProperties := expandKustoDatabaseProperties(d) - readWriteDatabase := kusto.ReadWriteDatabase{ - Name: utils.String(id.Name), - Location: utils.String(location.Normalize(d.Get("location").(string))), - ReadWriteDatabaseProperties: databaseProperties, + readWriteDatabase := databases.ReadWriteDatabase{ + Name: utils.String(id.DatabaseName), + Location: utils.String(location.Normalize(d.Get("location").(string))), + Properties: databaseProperties, } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.Name, readWriteDatabase) + err := client.CreateOrUpdateThenPoll(ctx, id, readWriteDatabase) if err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceKustoDatabaseRead(d, meta) } @@ -127,36 +123,35 @@ func resourceKustoDatabaseRead(d *pluginsdk.ResourceData, meta interface{}) erro ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatabaseID(d.Id()) + id, err := databases.ParseDatabaseID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", *id, err) } - if resp.Value == nil { + if resp.Model == nil { return fmt.Errorf("retrieving %s: response was nil", *id) } - database, ok := resp.Value.AsReadWriteDatabase() + database, ok := (*resp.Model).(databases.ReadWriteDatabase) if !ok { return fmt.Errorf("%s was not a Read/Write Database", *id) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.DatabaseName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("cluster_name", id.ClusterName) - d.Set("location", location.NormalizeNilable(database.Location)) - if props := database.ReadWriteDatabaseProperties; props != nil { + if props := database.Properties; props != nil { d.Set("hot_cache_period", props.HotCachePeriod) d.Set("soft_delete_period", props.SoftDeletePeriod) @@ -173,25 +168,21 @@ func resourceKustoDatabaseDelete(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DatabaseID(d.Id()) + id, err := databases.ParseDatabaseID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ClusterName, id.Name) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", id, err) - } - return nil } -func expandKustoDatabaseProperties(d *pluginsdk.ResourceData) *kusto.ReadWriteDatabaseProperties { - databaseProperties := &kusto.ReadWriteDatabaseProperties{} +func expandKustoDatabaseProperties(d *pluginsdk.ResourceData) *databases.ReadWriteDatabaseProperties { + databaseProperties := &databases.ReadWriteDatabaseProperties{} if softDeletePeriod, ok := d.GetOk("soft_delete_period"); ok { databaseProperties.SoftDeletePeriod = utils.String(softDeletePeriod.(string)) diff --git a/internal/services/kusto/kusto_database_resource_test.go b/internal/services/kusto/kusto_database_resource_test.go index 55528fec41a8..239603095433 100644 --- a/internal/services/kusto/kusto_database_resource_test.go +++ b/internal/services/kusto/kusto_database_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type KustoDatabaseResource struct{} @@ -332,20 +331,26 @@ resource "azurerm_kusto_database" "test" { } func (KustoDatabaseResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DatabaseID(state.ID) + id, err := databases.ParseDatabaseID(state.ID) if err != nil { return nil, err } - resp, err := clients.Kusto.DatabasesClient.Get(ctx, id.ResourceGroup, id.ClusterName, id.Name) + resp, err := clients.Kusto.DatabasesClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", id.String(), err) } - value, ok := resp.Value.AsReadWriteDatabase() - if !ok { - return nil, fmt.Errorf("%s is not a ReadWriteDatabase", id.String()) - } + if resp.Model != nil { + value, ok := (*resp.Model).(databases.ReadWriteDatabase) + if !ok { + return nil, fmt.Errorf("%s is not a ReadWriteDatabase", id.String()) + } + + exists := value.Properties != nil - return utils.Bool(value.ReadWriteDatabaseProperties != nil), nil + return &exists, nil + } else { + return nil, fmt.Errorf("response model is empty") + } } diff --git a/internal/services/kusto/kusto_database_script_resource.go b/internal/services/kusto/kusto_database_script_resource.go index dbe54196a311..c86cdc412243 100644 --- a/internal/services/kusto/kusto_database_script_resource.go +++ b/internal/services/kusto/kusto_database_script_resource.go @@ -5,14 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts" // nolint: staticcheck "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -39,7 +40,7 @@ func resourceKustoDatabaseScript() *pluginsdk.Resource { }), Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.ScriptID(id) + _, err := scripts.ParseScriptID(id) return err }), @@ -54,7 +55,7 @@ func resourceKustoDatabaseScript() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.DatabaseID, + ValidateFunc: databases.ValidateDatabaseID, }, "continue_on_errors_enabled": { @@ -104,21 +105,21 @@ func resourceKustoDatabaseScriptCreateUpdate(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - databaseId, _ := parse.DatabaseID(d.Get("database_id").(string)) - id := parse.NewScriptID(databaseId.SubscriptionId, databaseId.ResourceGroup, databaseId.ClusterName, databaseId.Name, d.Get("name").(string)) + databaseId, _ := databases.ParseDatabaseID(d.Get("database_id").(string)) + id := scripts.NewScriptID(databaseId.SubscriptionId, databaseId.ResourceGroupName, databaseId.ClusterName, databaseId.DatabaseName, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for existing %q: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_kusto_script", id.ID()) } } - clusterId := parse.NewClusterID(databaseId.SubscriptionId, databaseId.ResourceGroup, databaseId.ClusterName) + clusterId := clusters.NewClusterID(databaseId.SubscriptionId, databaseId.ResourceGroupName, databaseId.ClusterName) locks.ByID(clusterId.ID()) defer locks.UnlockByID(clusterId.ID()) @@ -127,34 +128,30 @@ func resourceKustoDatabaseScriptCreateUpdate(d *pluginsdk.ResourceData, meta int forceUpdateTag, _ = uuid.GenerateUUID() } - parameters := kusto.Script{ - ScriptProperties: &kusto.ScriptProperties{ + parameters := scripts.Script{ + Properties: &scripts.ScriptProperties{ ContinueOnErrors: utils.Bool(d.Get("continue_on_errors_enabled").(bool)), ForceUpdateTag: utils.String(forceUpdateTag), }, } if scriptURL, ok := d.GetOk("url"); ok { - parameters.ScriptURL = utils.String(scriptURL.(string)) + parameters.Properties.ScriptUrl = utils.String(scriptURL.(string)) } if scriptURLSasToken, ok := d.GetOk("sas_token"); ok { - parameters.ScriptURLSasToken = utils.String(scriptURLSasToken.(string)) + parameters.Properties.ScriptUrlSasToken = utils.String(scriptURLSasToken.(string)) } if scriptContent, ok := d.GetOk("script_content"); ok { - parameters.ScriptContent = utils.String(scriptContent.(string)) + parameters.Properties.ScriptContent = utils.String(scriptContent.(string)) } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name, parameters) + err := client.CreateOrUpdateThenPoll(ctx, id, parameters) if err != nil { return fmt.Errorf("creating %q: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %q: %+v", id, err) - } - d.SetId(id.ID()) return resourceKustoDatabaseScriptRead(d, meta) } @@ -164,26 +161,29 @@ func resourceKustoDatabaseScriptRead(d *pluginsdk.ResourceData, meta interface{} ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ScriptID(d.Id()) + id, err := scripts.ParseScriptID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("database_id", parse.NewDatabaseID(id.SubscriptionId, id.ResourceGroup, id.ClusterName, id.DatabaseName).ID()) - if props := resp.ScriptProperties; props != nil { - d.Set("continue_on_errors_enabled", props.ContinueOnErrors) - d.Set("force_an_update_when_value_changed", props.ForceUpdateTag) - d.Set("url", props.ScriptURL) + d.Set("name", id.ScriptName) + d.Set("database_id", databases.NewDatabaseID(id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.DatabaseName).ID()) + + if resp.Model != nil { + if props := resp.Model.Properties; props != nil { + d.Set("continue_on_errors_enabled", props.ContinueOnErrors) + d.Set("force_an_update_when_value_changed", props.ForceUpdateTag) + d.Set("url", props.ScriptUrl) + } } return nil } @@ -193,18 +193,19 @@ func resourceKustoDatabaseScriptDelete(d *pluginsdk.ResourceData, meta interface ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.ScriptID(d.Id()) + id, err := scripts.ParseScriptID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + // DELETE operation for script does not support running concurrently at cluster level + locks.ByName(id.ClusterName, "azurerm_kusto_cluster") + defer locks.UnlockByName(id.ClusterName, "azurerm_kusto_cluster") + + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %q: %+v", id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %q: %+v", id, err) - } return nil } diff --git a/internal/services/kusto/kusto_database_script_resource_test.go b/internal/services/kusto/kusto_database_script_resource_test.go index 00d58c25d7e1..cf0a8227b256 100644 --- a/internal/services/kusto/kusto_database_script_resource_test.go +++ b/internal/services/kusto/kusto_database_script_resource_test.go @@ -5,12 +5,12 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type KustoScriptResource struct{} @@ -117,18 +117,23 @@ func TestAccKustoScript_scriptContent(t *testing.T) { } func (r KustoScriptResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.ScriptID(state.ID) + id, err := scripts.ParseScriptID(state.ID) if err != nil { return nil, err } - resp, err := client.Kusto.ScriptsClient.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + + resp, err := client.Kusto.ScriptsClient.Get(ctx, *id) + exists := true + if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - return utils.Bool(false), nil + if response.WasNotFound(resp.HttpResponse) { + exists = false + } else { + return nil, fmt.Errorf("retrieving %q: %+v", id, err) } - return nil, fmt.Errorf("retrieving %q: %+v", id, err) } - return utils.Bool(true), nil + + return &exists, nil } func (r KustoScriptResource) template(data acceptance.TestData) string { diff --git a/internal/services/kusto/kusto_eventgrid_data_connection_resource.go b/internal/services/kusto/kusto_eventgrid_data_connection_resource.go index c5cbd413f76d..bbac0130d351 100644 --- a/internal/services/kusto/kusto_eventgrid_data_connection_resource.go +++ b/internal/services/kusto/kusto_eventgrid_data_connection_resource.go @@ -5,17 +5,18 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" eventhubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -37,9 +38,9 @@ func resourceKustoEventGridDataConnection() *pluginsdk.Resource { }), Importer: pluginsdk.ImporterValidatingResourceIdThen(func(id string) error { - _, err := parse.DataConnectionID(id) + _, err := dataconnections.ParseDataConnectionID(id) return err - }, importDataConnection(kusto.KindBasicDataConnectionKindEventGrid)), + }, importDataConnection("EventGrid")), Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(60 * time.Minute), @@ -96,13 +97,10 @@ func resourceKustoEventGridDataConnection() *pluginsdk.Resource { }, "blob_storage_event_type": { - Type: pluginsdk.TypeString, - Optional: true, - Default: string(kusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), - string(kusto.BlobStorageEventTypeMicrosoftStorageBlobRenamed), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + Default: string(dataconnections.BlobStorageEventTypeMicrosoftPointStoragePointBlobCreated), + ValidateFunc: validation.StringInSlice(dataconnections.PossibleValuesForBlobStorageEventType(), false), }, "skip_first_record": { @@ -124,37 +122,17 @@ func resourceKustoEventGridDataConnection() *pluginsdk.Resource { }, "data_format": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.EventGridDataFormatAPACHEAVRO), - string(kusto.EventGridDataFormatAVRO), - string(kusto.EventGridDataFormatCSV), - string(kusto.EventGridDataFormatJSON), - string(kusto.EventGridDataFormatMULTIJSON), - string(kusto.EventGridDataFormatORC), - string(kusto.EventGridDataFormatPARQUET), - string(kusto.EventGridDataFormatPSV), - string(kusto.EventGridDataFormatRAW), - string(kusto.EventGridDataFormatSCSV), - string(kusto.EventGridDataFormatSINGLEJSON), - string(kusto.EventGridDataFormatSOHSV), - string(kusto.EventGridDataFormatTSV), - string(kusto.EventGridDataFormatTSVE), - string(kusto.EventGridDataFormatTXT), - string(kusto.EventGridDataFormatW3CLOGFILE), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice(dataconnections.PossibleValuesForEventGridDataFormat(), false), }, "database_routing_type": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - Default: string(kusto.DatabaseRoutingSingle), - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.DatabaseRoutingSingle), - string(kusto.DatabaseRoutingMulti), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Default: string(dataconnections.DatabaseRoutingSingle), + ValidateFunc: validation.StringInSlice(dataconnections.PossibleValuesForDatabaseRouting(), false), }, "eventgrid_resource_id": { @@ -168,7 +146,7 @@ func resourceKustoEventGridDataConnection() *pluginsdk.Resource { Optional: true, ValidateFunc: validation.Any( validation.StringIsEmpty, - validate.ClusterID, + clusters.ValidateClusterID, commonids.ValidateUserAssignedIdentityID, ), }, @@ -184,64 +162,64 @@ func resourceKustoEventGridDataConnectionCreateUpdate(d *pluginsdk.ResourceData, log.Printf("[INFO] preparing arguments for Azure Kusto Event Grid Data Connection creation.") - id := parse.NewDataConnectionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("database_name").(string), d.Get("name").(string)) + id := dataconnections.NewDataConnectionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("database_name").(string), d.Get("name").(string)) if d.IsNewResource() { - resp, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return tf.ImportAsExistsError("azurerm_kusto_eventgrid_data_connection", id.ID()) } } - dataConnection := kusto.EventGridDataConnection{ + dataConnection := dataconnections.EventGridDataConnection{ Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))), - EventGridConnectionProperties: &kusto.EventGridConnectionProperties{ - StorageAccountResourceID: utils.String(d.Get("storage_account_id").(string)), - EventHubResourceID: utils.String(d.Get("eventhub_id").(string)), - ConsumerGroup: utils.String(d.Get("eventhub_consumer_group_name").(string)), + Properties: &dataconnections.EventGridConnectionProperties{ + StorageAccountResourceId: d.Get("storage_account_id").(string), + EventHubResourceId: d.Get("eventhub_id").(string), + ConsumerGroup: d.Get("eventhub_consumer_group_name").(string), IgnoreFirstRecord: utils.Bool(d.Get("skip_first_record").(bool)), - BlobStorageEventType: kusto.BlobStorageEventType(d.Get("blob_storage_event_type").(string)), }, } + blobStorageEventType := dataconnections.BlobStorageEventType(d.Get("blob_storage_event_type").(string)) + dataConnection.Properties.BlobStorageEventType = &blobStorageEventType + if tableName, ok := d.GetOk("table_name"); ok { - dataConnection.EventGridConnectionProperties.TableName = utils.String(tableName.(string)) + dataConnection.Properties.TableName = utils.String(tableName.(string)) } if mappingRuleName, ok := d.GetOk("mapping_rule_name"); ok { - dataConnection.EventGridConnectionProperties.MappingRuleName = utils.String(mappingRuleName.(string)) + dataConnection.Properties.MappingRuleName = utils.String(mappingRuleName.(string)) } if df, ok := d.GetOk("data_format"); ok { - dataConnection.EventGridConnectionProperties.DataFormat = kusto.EventGridDataFormat(df.(string)) + dataFormat := dataconnections.EventGridDataFormat(df.(string)) + dataConnection.Properties.DataFormat = &dataFormat } if databaseRouting, ok := d.GetOk("database_routing_type"); ok { - dataConnection.DatabaseRouting = kusto.DatabaseRouting(databaseRouting.(string)) + databaseRoutingType := dataconnections.DatabaseRouting(databaseRouting.(string)) + dataConnection.Properties.DatabaseRouting = &databaseRoutingType } if eventGridRID, ok := d.GetOk("eventgrid_resource_id"); ok { - dataConnection.EventGridConnectionProperties.EventGridResourceID = utils.String(eventGridRID.(string)) + dataConnection.Properties.EventGridResourceId = utils.String(eventGridRID.(string)) } if managedIdentityRID, ok := d.GetOk("managed_identity_resource_id"); ok { - dataConnection.EventGridConnectionProperties.ManagedIdentityResourceID = utils.String(managedIdentityRID.(string)) + dataConnection.Properties.ManagedIdentityResourceId = utils.String(managedIdentityRID.(string)) } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name, dataConnection) + err := client.CreateOrUpdateThenPoll(ctx, id, dataConnection) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for completion of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceKustoEventGridDataConnectionRead(d, meta) @@ -252,30 +230,31 @@ func resourceKustoEventGridDataConnectionRead(d *pluginsdk.ResourceData, meta in ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataConnectionID(d.Id()) + id, err := dataconnections.ParseDataConnectionID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.DataConnectionName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("cluster_name", id.ClusterName) d.Set("database_name", id.DatabaseName) - if dataConnection, ok := resp.Value.(kusto.EventGridDataConnection); ok { + if resp.Model != nil { + dataConnection := (*resp.Model).(dataconnections.EventGridDataConnection) d.Set("location", location.NormalizeNilable(dataConnection.Location)) - if props := dataConnection.EventGridConnectionProperties; props != nil { - d.Set("storage_account_id", props.StorageAccountResourceID) - d.Set("eventhub_id", props.EventHubResourceID) + if props := dataConnection.Properties; props != nil { + d.Set("storage_account_id", props.StorageAccountResourceId) + d.Set("eventhub_id", props.EventHubResourceId) d.Set("eventhub_consumer_group_name", props.ConsumerGroup) d.Set("skip_first_record", props.IgnoreFirstRecord) d.Set("blob_storage_event_type", props.BlobStorageEventType) @@ -283,8 +262,8 @@ func resourceKustoEventGridDataConnectionRead(d *pluginsdk.ResourceData, meta in d.Set("mapping_rule_name", props.MappingRuleName) d.Set("data_format", props.DataFormat) d.Set("database_routing_type", props.DatabaseRouting) - d.Set("eventgrid_resource_id", props.EventGridResourceID) - d.Set("managed_identity_resource_id", props.ManagedIdentityResourceID) + d.Set("eventgrid_resource_id", props.EventGridResourceId) + d.Set("managed_identity_resource_id", props.ManagedIdentityResourceId) } } @@ -296,19 +275,15 @@ func resourceKustoEventGridDataConnectionDelete(d *pluginsdk.ResourceData, meta ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataConnectionID(d.Id()) + id, err := dataconnections.ParseDataConnectionID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", id, err) - } - return nil } diff --git a/internal/services/kusto/kusto_eventgrid_data_connection_resource_test.go b/internal/services/kusto/kusto_eventgrid_data_connection_resource_test.go index 6593d320a898..72930482dc81 100644 --- a/internal/services/kusto/kusto_eventgrid_data_connection_resource_test.go +++ b/internal/services/kusto/kusto_eventgrid_data_connection_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type KustoEventGridDataConnectionResource struct{} @@ -136,22 +135,28 @@ func TestAccKustoEventGridDataConnection_update(t *testing.T) { } func (KustoEventGridDataConnectionResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DataConnectionID(state.ID) + id, err := dataconnections.ParseDataConnectionID(state.ID) if err != nil { return nil, err } - resp, err := clients.Kusto.DataConnectionsClient.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + resp, err := clients.Kusto.DataConnectionsClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", id.String(), err) } - value, ok := resp.Value.AsEventGridDataConnection() - if !ok { - return nil, fmt.Errorf("%s is not an Event Grid Data Connection", id.String()) - } + if resp.Model != nil { + value, ok := (*resp.Model).(dataconnections.EventGridDataConnection) + if !ok { + return nil, fmt.Errorf("%s is not an Event Grid Data Connection", id.String()) + } + + exists := value.Properties != nil - return utils.Bool(value.EventGridConnectionProperties != nil), nil + return &exists, nil + } else { + return nil, fmt.Errorf("response model is empty") + } } func (r KustoEventGridDataConnectionResource) basic(data acceptance.TestData) string { diff --git a/internal/services/kusto/kusto_eventhub_data_connection_resource.go b/internal/services/kusto/kusto_eventhub_data_connection_resource.go index 4edc70fb89af..e537840a1e65 100644 --- a/internal/services/kusto/kusto_eventhub_data_connection_resource.go +++ b/internal/services/kusto/kusto_eventhub_data_connection_resource.go @@ -5,16 +5,17 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" // nolint: staticcheck "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/eventhubs" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" eventhubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/eventhub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -35,9 +36,9 @@ func resourceKustoEventHubDataConnection() *pluginsdk.Resource { }), Importer: pluginsdk.ImporterValidatingResourceIdThen(func(id string) error { - _, err := parse.DataConnectionID(id) + _, err := dataconnections.ParseDataConnectionID(id) return err - }, importDataConnection(kusto.KindBasicDataConnectionKindEventHub)), + }, importDataConnection("EventHub")), Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(60 * time.Minute), @@ -66,14 +67,11 @@ func resourceKustoEventHubDataConnection() *pluginsdk.Resource { }, "compression": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - Default: kusto.CompressionNone, - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.CompressionGZip), - string(kusto.CompressionNone), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Default: dataconnections.CompressionNone, + ValidateFunc: validation.StringInSlice(dataconnections.PossibleValuesForCompression(), false), }, "database_name": { @@ -119,7 +117,7 @@ func resourceKustoEventHubDataConnection() *pluginsdk.Resource { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.Any( - validate.ClusterID, + clusters.ValidateClusterID, commonids.ValidateUserAssignedIdentityID, ), }, @@ -131,33 +129,17 @@ func resourceKustoEventHubDataConnection() *pluginsdk.Resource { }, "data_format": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.EventHubDataFormatAPACHEAVRO), - string(kusto.EventHubDataFormatAVRO), - string(kusto.EventHubDataFormatCSV), - string(kusto.EventHubDataFormatJSON), - string(kusto.EventHubDataFormatMULTIJSON), - string(kusto.EventHubDataFormatPSV), - string(kusto.EventHubDataFormatRAW), - string(kusto.EventHubDataFormatSCSV), - string(kusto.EventHubDataFormatSINGLEJSON), - string(kusto.EventHubDataFormatSOHSV), - string(kusto.EventHubDataFormatTSV), - string(kusto.EventHubDataFormatTXT), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice(dataconnections.PossibleValuesForEventHubDataFormat(), false), }, "database_routing_type": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - Default: string(kusto.DatabaseRoutingSingle), - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.DatabaseRoutingSingle), - string(kusto.DatabaseRoutingMulti), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Default: string(dataconnections.DatabaseRoutingSingle), + ValidateFunc: validation.StringInSlice(dataconnections.PossibleValuesForDatabaseRouting(), false), }, }, } @@ -171,19 +153,19 @@ func resourceKustoEventHubDataConnectionCreateUpdate(d *pluginsdk.ResourceData, log.Printf("[INFO] preparing arguments for Azure Kusto Event Hub Data Connection creation.") - id := parse.NewDataConnectionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("database_name").(string), d.Get("name").(string)) + id := dataconnections.NewDataConnectionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("database_name").(string), d.Get("name").(string)) if d.IsNewResource() { - connectionModel, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + connectionModel, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(connectionModel.Response) { + if !response.WasNotFound(connectionModel.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if dataConnection, ok := connectionModel.Value.(kusto.EventHubDataConnection); ok { - if dataConnection.ID != nil && *dataConnection.ID != "" { - return tf.ImportAsExistsError("azurerm_kusto_eventhub_data_connection", *dataConnection.ID) + if dataConnection, ok := (*connectionModel.Model).(dataconnections.EventHubDataConnection); ok { + if dataConnection.Id != nil && *dataConnection.Id != "" { + return tf.ImportAsExistsError("azurerm_kusto_eventhub_data_connection", *dataConnection.Id) } } } @@ -192,25 +174,22 @@ func resourceKustoEventHubDataConnectionCreateUpdate(d *pluginsdk.ResourceData, eventHubDataConnectionProperties := expandKustoEventHubDataConnectionProperties(d) - dataConnection1 := kusto.EventHubDataConnection{ - Name: &id.Name, - Location: &location, - EventHubConnectionProperties: eventHubDataConnectionProperties, + dataConnection1 := dataconnections.EventHubDataConnection{ + Name: &id.DataConnectionName, + Location: &location, + Properties: eventHubDataConnectionProperties, } if databaseRouting, ok := d.GetOk("database_routing_type"); ok { - dataConnection1.DatabaseRouting = kusto.DatabaseRouting(databaseRouting.(string)) + dbRouting := dataconnections.DatabaseRouting(databaseRouting.(string)) + dataConnection1.Properties.DatabaseRouting = &dbRouting } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name, dataConnection1) + err := client.CreateOrUpdateThenPoll(ctx, id, dataConnection1) if err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for completion of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceKustoEventHubDataConnectionRead(d, meta) @@ -221,40 +200,42 @@ func resourceKustoEventHubDataConnectionRead(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataConnectionID(d.Id()) + id, err := dataconnections.ParseDataConnectionID(d.Id()) if err != nil { return err } - connectionModel, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(connectionModel.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } - return fmt.Errorf("retrieving Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %+v", id.Name, id.ResourceGroup, id.ClusterName, id.DatabaseName, err) + return fmt.Errorf("retrieving Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %+v", id.DataConnectionName, id.ResourceGroupName, id.ClusterName, id.DatabaseName, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.DataConnectionName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("cluster_name", id.ClusterName) d.Set("database_name", id.DatabaseName) - if dataConnection, ok := connectionModel.Value.(kusto.EventHubDataConnection); ok { - if location := dataConnection.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } + if resp.Model != nil { + if dataConnection, ok := (*resp.Model).(dataconnections.EventHubDataConnection); ok { + if location := dataConnection.Location; location != nil { + d.Set("location", azure.NormalizeLocation(*location)) + } - if props := dataConnection.EventHubConnectionProperties; props != nil { - d.Set("eventhub_id", props.EventHubResourceID) - d.Set("consumer_group", props.ConsumerGroup) - d.Set("table_name", props.TableName) - d.Set("mapping_rule_name", props.MappingRuleName) - d.Set("data_format", props.DataFormat) - d.Set("database_routing_type", props.DatabaseRouting) - d.Set("compression", props.Compression) - d.Set("event_system_properties", props.EventSystemProperties) - d.Set("identity_id", props.ManagedIdentityResourceID) + if props := dataConnection.Properties; props != nil { + d.Set("eventhub_id", props.EventHubResourceId) + d.Set("consumer_group", props.ConsumerGroup) + d.Set("table_name", props.TableName) + d.Set("mapping_rule_name", props.MappingRuleName) + d.Set("data_format", props.DataFormat) + d.Set("database_routing_type", props.DatabaseRouting) + d.Set("compression", props.Compression) + d.Set("event_system_properties", props.EventSystemProperties) + d.Set("identity_id", props.ManagedIdentityResourceId) + } } } @@ -266,32 +247,28 @@ func resourceKustoEventHubDataConnectionDelete(d *pluginsdk.ResourceData, meta i ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataConnectionID(d.Id()) + id, err := dataconnections.ParseDataConnectionID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + err = client.DeleteThenPoll(ctx, *id) if err != nil { - return fmt.Errorf("deleting Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %+v", id.Name, id.ResourceGroup, id.ClusterName, id.DatabaseName, err) - } - - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %+v", id.Name, id.ResourceGroup, id.ClusterName, id.DatabaseName, err) + return fmt.Errorf("deleting Kusto Event Hub Data Connection %q (Resource Group %q, Cluster %q, Database %q): %+v", id.DataConnectionName, id.ResourceGroupName, id.ClusterName, id.DatabaseName, err) } return nil } -func expandKustoEventHubDataConnectionProperties(d *pluginsdk.ResourceData) *kusto.EventHubConnectionProperties { - eventHubConnectionProperties := &kusto.EventHubConnectionProperties{} +func expandKustoEventHubDataConnectionProperties(d *pluginsdk.ResourceData) *dataconnections.EventHubConnectionProperties { + eventHubConnectionProperties := &dataconnections.EventHubConnectionProperties{} if eventhubResourceID, ok := d.GetOk("eventhub_id"); ok { - eventHubConnectionProperties.EventHubResourceID = utils.String(eventhubResourceID.(string)) + eventHubConnectionProperties.EventHubResourceId = eventhubResourceID.(string) } if consumerGroup, ok := d.GetOk("consumer_group"); ok { - eventHubConnectionProperties.ConsumerGroup = utils.String(consumerGroup.(string)) + eventHubConnectionProperties.ConsumerGroup = consumerGroup.(string) } if tableName, ok := d.GetOk("table_name"); ok { @@ -303,11 +280,13 @@ func expandKustoEventHubDataConnectionProperties(d *pluginsdk.ResourceData) *kus } if df, ok := d.GetOk("data_format"); ok { - eventHubConnectionProperties.DataFormat = kusto.EventHubDataFormat(df.(string)) + dataFormat := dataconnections.EventHubDataFormat(df.(string)) + eventHubConnectionProperties.DataFormat = &dataFormat } if compression, ok := d.GetOk("compression"); ok { - eventHubConnectionProperties.Compression = kusto.Compression(compression.(string)) + comp := dataconnections.Compression(compression.(string)) + eventHubConnectionProperties.Compression = &comp } if eventSystemProperties, ok := d.GetOk("event_system_properties"); ok { @@ -319,7 +298,7 @@ func expandKustoEventHubDataConnectionProperties(d *pluginsdk.ResourceData) *kus } if identityId, ok := d.GetOk("identity_id"); ok { - eventHubConnectionProperties.ManagedIdentityResourceID = utils.String(identityId.(string)) + eventHubConnectionProperties.ManagedIdentityResourceId = utils.String(identityId.(string)) } return eventHubConnectionProperties diff --git a/internal/services/kusto/kusto_eventhub_data_connection_resource_test.go b/internal/services/kusto/kusto_eventhub_data_connection_resource_test.go index e35cace00520..c3c7bfd91f4f 100644 --- a/internal/services/kusto/kusto_eventhub_data_connection_resource_test.go +++ b/internal/services/kusto/kusto_eventhub_data_connection_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type KustoEventHubDataConnectionResource struct{} @@ -122,22 +121,26 @@ func TestAccKustoEventHubDataConnection_databaseRoutingType(t *testing.T) { } func (KustoEventHubDataConnectionResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DataConnectionID(state.ID) + id, err := dataconnections.ParseDataConnectionID(state.ID) if err != nil { return nil, err } - resp, err := clients.Kusto.DataConnectionsClient.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + resp, err := clients.Kusto.DataConnectionsClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", id.String(), err) } - value, ok := resp.Value.AsEventHubDataConnection() - if !ok { - return nil, fmt.Errorf("%s is not an EventHubDataConnection", id.String()) + if resp.Model != nil { + value, ok := (*resp.Model).(dataconnections.EventHubDataConnection) + if !ok { + return nil, fmt.Errorf("%s is not an EventHubDataConnection", id.String()) + } + exists := value.Properties != nil + return &exists, nil + } else { + return nil, fmt.Errorf("response model is empty") } - - return utils.Bool(value.EventHubConnectionProperties != nil), nil } func (r KustoEventHubDataConnectionResource) basic(data acceptance.TestData) string { diff --git a/internal/services/kusto/kusto_iothub_data_connection_resource.go b/internal/services/kusto/kusto_iothub_data_connection_resource.go index 83017f75c219..02f207f8b93a 100644 --- a/internal/services/kusto/kusto_iothub_data_connection_resource.go +++ b/internal/services/kusto/kusto_iothub_data_connection_resource.go @@ -5,15 +5,15 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" iothubValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/iothub/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/migration" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -33,9 +33,9 @@ func resourceKustoIotHubDataConnection() *pluginsdk.Resource { }), Importer: pluginsdk.ImporterValidatingResourceIdThen(func(id string) error { - _, err := parse.DataConnectionID(id) + _, err := dataconnections.ParseDataConnectionID(id) return err - }, importDataConnection(kusto.KindBasicDataConnectionKindIotHub)), + }, importDataConnection("IotHub")), Timeouts: &pluginsdk.ResourceTimeout{ Create: pluginsdk.DefaultTimeout(60 * time.Minute), @@ -105,38 +105,18 @@ func resourceKustoIotHubDataConnection() *pluginsdk.Resource { }, "data_format": { - Type: pluginsdk.TypeString, - ForceNew: true, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.IotHubDataFormatAPACHEAVRO), - string(kusto.IotHubDataFormatAVRO), - string(kusto.IotHubDataFormatCSV), - string(kusto.IotHubDataFormatJSON), - string(kusto.IotHubDataFormatMULTIJSON), - string(kusto.IotHubDataFormatORC), - string(kusto.IotHubDataFormatPARQUET), - string(kusto.IotHubDataFormatPSV), - string(kusto.IotHubDataFormatRAW), - string(kusto.IotHubDataFormatSCSV), - string(kusto.IotHubDataFormatSINGLEJSON), - string(kusto.IotHubDataFormatSOHSV), - string(kusto.IotHubDataFormatTSV), - string(kusto.IotHubDataFormatTSVE), - string(kusto.IotHubDataFormatTXT), - string(kusto.IotHubDataFormatW3CLOGFILE), - }, false), + Type: pluginsdk.TypeString, + ForceNew: true, + Optional: true, + ValidateFunc: validation.StringInSlice(dataconnections.PossibleValuesForIotHubDataFormat(), false), }, "database_routing_type": { - Type: pluginsdk.TypeString, - Optional: true, - ForceNew: true, - Default: string(kusto.DatabaseRoutingSingle), - ValidateFunc: validation.StringInSlice([]string{ - string(kusto.DatabaseRoutingSingle), - string(kusto.DatabaseRoutingMulti), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Default: string(dataconnections.DatabaseRoutingSingle), + ValidateFunc: validation.StringInSlice(dataconnections.PossibleValuesForDatabaseRouting(), false), }, "event_system_properties": { @@ -172,38 +152,35 @@ func resourceKustoIotHubDataConnectionCreate(d *pluginsdk.ResourceData, meta int log.Printf("[INFO] preparing arguments for Azure Kusto Iot Hub Data Connection creation.") - id := parse.NewDataConnectionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("database_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + id := dataconnections.NewDataConnectionID(subscriptionId, d.Get("resource_group_name").(string), d.Get("cluster_name").(string), d.Get("database_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %s", id, err) } } - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return tf.ImportAsExistsError("azurerm_kusto_iothub_data_connection", id.ID()) } iotHubDataConnectionProperties := expandKustoIotHubDataConnectionProperties(d) - dataConnection := kusto.IotHubDataConnection{ - Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))), - IotHubConnectionProperties: iotHubDataConnectionProperties, + dataConnection := dataconnections.IotHubDataConnection{ + Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))), + Properties: iotHubDataConnectionProperties, } if databaseRouting, ok := d.GetOk("database_routing_type"); ok { - dataConnection.DatabaseRouting = kusto.DatabaseRouting(databaseRouting.(string)) + dbRoutingType := dataconnections.DatabaseRouting(databaseRouting.(string)) + dataConnection.Properties.DatabaseRouting = &dbRoutingType } - future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name, dataConnection) + err = client.CreateOrUpdateThenPoll(ctx, id, dataConnection) if err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for completion of %s: %+v", id, err) - } - d.SetId(id.ID()) return resourceKustoIotHubDataConnectionRead(d, meta) } @@ -213,36 +190,38 @@ func resourceKustoIotHubDataConnectionRead(d *pluginsdk.ResourceData, meta inter ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataConnectionID(d.Id()) + id, err := dataconnections.ParseDataConnectionID(d.Id()) if err != nil { return err } - connectionModel, err := client.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(connectionModel.Response) { + if response.WasNotFound(resp.HttpResponse) { d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.DataConnectionName) + d.Set("resource_group_name", id.ResourceGroupName) d.Set("cluster_name", id.ClusterName) d.Set("database_name", id.DatabaseName) - if dataConnection, ok := connectionModel.Value.(kusto.IotHubDataConnection); ok { - d.Set("location", location.NormalizeNilable(dataConnection.Location)) - if props := dataConnection.IotHubConnectionProperties; props != nil { - d.Set("iothub_id", props.IotHubResourceID) - d.Set("consumer_group", props.ConsumerGroup) - d.Set("table_name", props.TableName) - d.Set("mapping_rule_name", props.MappingRuleName) - d.Set("data_format", props.DataFormat) - d.Set("database_routing_type", props.DatabaseRouting) - d.Set("shared_access_policy_name", props.SharedAccessPolicyName) - d.Set("event_system_properties", utils.FlattenStringSlice(props.EventSystemProperties)) + if resp.Model != nil { + if dataConnection, ok := (*resp.Model).(dataconnections.IotHubDataConnection); ok { + d.Set("location", location.NormalizeNilable(dataConnection.Location)) + if props := dataConnection.Properties; props != nil { + d.Set("iothub_id", props.IotHubResourceId) + d.Set("consumer_group", props.ConsumerGroup) + d.Set("table_name", props.TableName) + d.Set("mapping_rule_name", props.MappingRuleName) + d.Set("data_format", props.DataFormat) + d.Set("database_routing_type", props.DatabaseRouting) + d.Set("shared_access_policy_name", props.SharedAccessPolicyName) + d.Set("event_system_properties", utils.FlattenStringSlice(props.EventSystemProperties)) + } } } @@ -254,28 +233,24 @@ func resourceKustoIotHubDataConnectionDelete(d *pluginsdk.ResourceData, meta int ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.DataConnectionID(d.Id()) + id, err := dataconnections.ParseDataConnectionID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + err = client.DeleteThenPoll(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", id, err) - } - return nil } -func expandKustoIotHubDataConnectionProperties(d *pluginsdk.ResourceData) *kusto.IotHubConnectionProperties { - iotHubDataConnectionProperties := &kusto.IotHubConnectionProperties{ - IotHubResourceID: utils.String(d.Get("iothub_id").(string)), - ConsumerGroup: utils.String(d.Get("consumer_group").(string)), - SharedAccessPolicyName: utils.String(d.Get("shared_access_policy_name").(string)), +func expandKustoIotHubDataConnectionProperties(d *pluginsdk.ResourceData) *dataconnections.IotHubConnectionProperties { + iotHubDataConnectionProperties := &dataconnections.IotHubConnectionProperties{ + IotHubResourceId: d.Get("iothub_id").(string), + ConsumerGroup: d.Get("consumer_group").(string), + SharedAccessPolicyName: d.Get("shared_access_policy_name").(string), } if tableName, ok := d.GetOk("table_name"); ok { @@ -287,7 +262,8 @@ func expandKustoIotHubDataConnectionProperties(d *pluginsdk.ResourceData) *kusto } if df, ok := d.GetOk("data_format"); ok { - iotHubDataConnectionProperties.DataFormat = kusto.IotHubDataFormat(df.(string)) + dataFormat := dataconnections.IotHubDataFormat(df.(string)) + iotHubDataConnectionProperties.DataFormat = &dataFormat } if eventSystemProperties, ok := d.GetOk("event_system_properties"); ok { diff --git a/internal/services/kusto/kusto_iothub_data_connection_resource_test.go b/internal/services/kusto/kusto_iothub_data_connection_resource_test.go index 0a72cef65ead..3be626565316 100644 --- a/internal/services/kusto/kusto_iothub_data_connection_resource_test.go +++ b/internal/services/kusto/kusto_iothub_data_connection_resource_test.go @@ -5,12 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type KustoIotHubDataConnectionResource struct{} @@ -47,22 +46,26 @@ func TestAccKustoIotHubDataConnection_complete(t *testing.T) { } func (KustoIotHubDataConnectionResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.DataConnectionID(state.ID) + id, err := dataconnections.ParseDataConnectionID(state.ID) if err != nil { return nil, err } - resp, err := clients.Kusto.DataConnectionsClient.Get(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name) + resp, err := clients.Kusto.DataConnectionsClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving %s: %v", id.String(), err) } - value, ok := resp.Value.AsIotHubDataConnection() - if !ok { - return nil, fmt.Errorf("%s is not an IotHub Data Connection", id.String()) + if resp.Model != nil { + value, ok := (*resp.Model).(dataconnections.IotHubDataConnection) + if !ok { + return nil, fmt.Errorf("%s is not an IotHub Data Connection", id.String()) + } + exists := value.Properties != nil + return &exists, nil + } else { + return nil, fmt.Errorf("response model is empty") } - - return utils.Bool(value.IotHubConnectionProperties != nil), nil } func (r KustoIotHubDataConnectionResource) basic(data acceptance.TestData) string { diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/_meta.json deleted file mode 100644 index e28978dd44bc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "bb4175d29020cfff55f1d9087c2a5a89765067dc", - "readme": "/_/azure-rest-api-specs/specification/azure-kusto/resource-manager/readme.md", - "tag": "package-2022-02", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-02 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/azure-kusto/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/attacheddatabaseconfigurations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/attacheddatabaseconfigurations.go deleted file mode 100644 index 68745276e272..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/attacheddatabaseconfigurations.go +++ /dev/null @@ -1,449 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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)} -} - -// CheckNameAvailability checks that the attached database configuration resource 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. -// resourceName - the name of the resource. -func (client AttachedDatabaseConfigurationsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, resourceName AttachedDatabaseConfigurationsCheckNameRequest) (result CheckNameResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AttachedDatabaseConfigurationsClient.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: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "resourceName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("kusto.AttachedDatabaseConfigurationsClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "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.AttachedDatabaseConfigurationsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client AttachedDatabaseConfigurationsClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, resourceName AttachedDatabaseConfigurationsCheckNameRequest) (*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 = "2022-02-01" - 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}/attachedDatabaseConfigurationCheckNameAvailability", pathParameters), - autorest.WithJSON(resourceName), - 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 AttachedDatabaseConfigurationsClient) 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 AttachedDatabaseConfigurationsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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 = "2022-02-01" - 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 - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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 = "2022-02-01" - 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 - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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 - } - - 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 = "2022-02-01" - 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, - 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 - } - - 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 = "2022-02-01" - 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, - 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/2022-02-01/kusto/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/client.go deleted file mode 100644 index 985be9091c0b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/client.go +++ /dev/null @@ -1,44 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package kusto implements the Azure ARM Kusto service API version 2022-02-01. -// -// 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. -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Kusto - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Kusto. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient 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 NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusterprincipalassignments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusterprincipalassignments.go deleted file mode 100644 index e50bc79d604c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusterprincipalassignments.go +++ /dev/null @@ -1,446 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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 - } - - 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 = "2022-02-01" - 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, - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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 = "2022-02-01" - 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 - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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 = "2022-02-01" - 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 - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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 - } - - 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 = "2022-02-01" - 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, - 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 - } - - 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 = "2022-02-01" - 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, - 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/2022-02-01/kusto/clusters.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusters.go deleted file mode 100644 index 6dcc304845cc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/clusters.go +++ /dev/null @@ -1,1525 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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" -) - -// ClustersClient 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 ClustersClient struct { - BaseClient -} - -// NewClustersClient creates an instance of the ClustersClient client. -func NewClustersClient(subscriptionID string) ClustersClient { - return NewClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewClustersClientWithBaseURI creates an instance of the ClustersClient 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 NewClustersClientWithBaseURI(baseURI string, subscriptionID string) ClustersClient { - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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 = "2022-02-01" - 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 - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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 (region) name. -// clusterName - the name of the cluster. -func (client ClustersClient) CheckNameAvailability(ctx context.Context, location string, clusterName ClusterCheckNameRequest) (result CheckNameResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.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: clusterName, - Constraints: []validation.Constraint{{Target: "clusterName.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "clusterName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("kusto.ClustersClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, location, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "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.ClustersClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ClustersClient) CheckNameAvailabilityPreparer(ctx context.Context, location string, clusterName ClusterCheckNameRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability", pathParameters), - autorest.WithJSON(clusterName), - 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 ClustersClient) 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 ClustersClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate create or update a Kusto cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// parameters - the Kusto cluster parameters supplied to the CreateOrUpdate operation. -// ifMatch - the ETag of the cluster. Omit this value to always overwrite the current cluster. Specify the -// last-seen ETag value to prevent accidentally overwriting concurrent changes. -// ifNoneMatch - set to '*' to allow a new cluster to be created, but to prevent updating an existing cluster. -// Other values will result in a 412 Pre-condition Failed response. -func (client ClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, ifMatch string, ifNoneMatch string) (result ClustersCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.OptimizedAutoscale", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.OptimizedAutoscale.Version", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.OptimizedAutoscale.IsEnabled", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.OptimizedAutoscale.Minimum", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.OptimizedAutoscale.Maximum", Name: validation.Null, Rule: true, Chain: nil}, - }}, - {Target: "parameters.ClusterProperties.VirtualNetworkConfiguration", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.VirtualNetworkConfiguration.SubnetID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.VirtualNetworkConfiguration.EnginePublicIPID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ClusterProperties.VirtualNetworkConfiguration.DataManagementPublicIPID", Name: validation.Null, Rule: true, Chain: nil}, - }}, - }}}}}); err != nil { - return result, validation.NewError("kusto.ClustersClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, parameters, ifMatch, ifNoneMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, ifMatch string, ifNoneMatch 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 = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - parameters.Etag = nil - 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}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - if len(ifNoneMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch))) - } - 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 ClustersClient) CreateOrUpdateSender(req *http.Request) (future ClustersCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ClustersClient) CreateOrUpdateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a Kusto cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ClustersClient) DeletePreparer(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 = "2022-02-01" - 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}", 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 ClustersClient) DeleteSender(req *http.Request) (future ClustersDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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 = "2022-02-01" - 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 - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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 = "2022-02-01" - 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 - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string) (result Cluster, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "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.ClustersClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ClustersClient) GetPreparer(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 = "2022-02-01" - 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}", 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 ClustersClient) 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 ClustersClient) GetResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List lists all Kusto clusters within a subscription. -func (client ClustersClient) List(ctx context.Context) (result ClusterListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "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.ClustersClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters", 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 ClustersClient) 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 ClustersClient) ListResponder(resp *http.Response) (result ClusterListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup lists all Kusto clusters within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -func (client ClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ClusterListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ClusterListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - 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 - } - - 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 = "2022-02-01" - 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, - 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 - } - - 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 = "2022-02-01" - 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, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListOutboundNetworkDependenciesEndpoints gets the network endpoints of all outbound dependencies of a Kusto cluster -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, clusterName string) (result OutboundNetworkDependenciesEndpointListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListOutboundNetworkDependenciesEndpoints") - defer func() { - sc := -1 - if result.ondelr.Response.Response != nil { - sc = result.ondelr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listOutboundNetworkDependenciesEndpointsNextResults - req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") - return - } - - resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) - if err != nil { - result.ondelr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") - return - } - - result.ondelr, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") - return - } - if result.ondelr.hasNextLink() && result.ondelr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. -func (client ClustersClient) ListOutboundNetworkDependenciesEndpointsPreparer(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 = "2022-02-01" - 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}/outboundNetworkDependenciesEndpoints", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListOutboundNetworkDependenciesEndpointsSender sends the ListOutboundNetworkDependenciesEndpoints request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListOutboundNetworkDependenciesEndpointsResponder handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result OutboundNetworkDependenciesEndpointListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listOutboundNetworkDependenciesEndpointsNextResults retrieves the next set of results, if any. -func (client ClustersClient) listOutboundNetworkDependenciesEndpointsNextResults(ctx context.Context, lastResults OutboundNetworkDependenciesEndpointListResult) (result OutboundNetworkDependenciesEndpointListResult, err error) { - req, err := lastResults.outboundNetworkDependenciesEndpointListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "kusto.ClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "kusto.ClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure sending next results request") - } - result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListOutboundNetworkDependenciesEndpointsComplete enumerates all values, automatically crossing page boundaries as required. -func (client ClustersClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, clusterName string) (result OutboundNetworkDependenciesEndpointListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListOutboundNetworkDependenciesEndpoints") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListOutboundNetworkDependenciesEndpoints(ctx, resourceGroupName, clusterName) - return -} - -// ListSkus lists eligible SKUs for Kusto resource provider. -func (client ClustersClient) ListSkus(ctx context.Context) (result SkuDescriptionList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListSkus") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSkusPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkus", nil, "Failure preparing request") - return - } - - resp, err := client.ListSkusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkus", resp, "Failure sending request") - return - } - - result, err = client.ListSkusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkus", resp, "Failure responding to request") - return - } - - return -} - -// ListSkusPreparer prepares the ListSkus request. -func (client ClustersClient) ListSkusPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSkusSender sends the ListSkus request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListSkusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSkusResponder handles the response to the ListSkus request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListSkusResponder(resp *http.Response) (result SkuDescriptionList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListSkusByResource returns the SKUs available for the provided resource. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) ListSkusByResource(ctx context.Context, resourceGroupName string, clusterName string) (result ListResourceSkusResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListSkusByResource") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListSkusByResourcePreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkusByResource", nil, "Failure preparing request") - return - } - - resp, err := client.ListSkusByResourceSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkusByResource", resp, "Failure sending request") - return - } - - result, err = client.ListSkusByResourceResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListSkusByResource", resp, "Failure responding to request") - return - } - - return -} - -// ListSkusByResourcePreparer prepares the ListSkusByResource request. -func (client ClustersClient) ListSkusByResourcePreparer(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 = "2022-02-01" - 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}/skus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSkusByResourceSender sends the ListSkusByResource request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) ListSkusByResourceSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListSkusByResourceResponder handles the response to the ListSkusByResource request. The method always -// closes the http.Response Body. -func (client ClustersClient) ListSkusByResourceResponder(resp *http.Response) (result ListResourceSkusResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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 = "2022-02-01" - 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 - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) Start(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersStartFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Start") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StartPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Start", nil, "Failure preparing request") - return - } - - result, err = client.StartSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Start", result.Response(), "Failure sending request") - return - } - - return -} - -// StartPreparer prepares the Start request. -func (client ClustersClient) StartPreparer(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 = "2022-02-01" - 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}/start", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StartSender sends the Start request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) StartSender(req *http.Request) (future ClustersStartFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StartResponder handles the response to the Start request. The method always -// closes the http.Response Body. -func (client ClustersClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Stop stops a Kusto cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ClustersClient) Stop(ctx context.Context, resourceGroupName string, clusterName string) (result ClustersStopFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Stop") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.StopPreparer(ctx, resourceGroupName, clusterName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Stop", nil, "Failure preparing request") - return - } - - result, err = client.StopSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Stop", result.Response(), "Failure sending request") - return - } - - return -} - -// StopPreparer prepares the Stop request. -func (client ClustersClient) StopPreparer(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 = "2022-02-01" - 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}/stop", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// StopSender sends the Stop request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) StopSender(req *http.Request) (future ClustersStopFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// StopResponder handles the response to the Stop request. The method always -// closes the http.Response Body. -func (client ClustersClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update update a Kusto cluster. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// parameters - the Kusto cluster parameters supplied to the Update operation. -// ifMatch - the ETag of the cluster. Omit this value to always overwrite the current cluster. Specify the -// last-seen ETag value to prevent accidentally overwriting concurrent changes. -func (client ClustersClient) Update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, ifMatch string) (result ClustersUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, parameters, ifMatch) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, ifMatch 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 = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - if len(ifMatch) > 0 { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithHeader("If-Match", autorest.String(ifMatch))) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ClustersClient) UpdateSender(req *http.Request) (future ClustersUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ClustersClient) UpdateResponder(resp *http.Response) (result Cluster, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - 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/2022-02-01/kusto/databaseprincipalassignments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/databaseprincipalassignments.go deleted file mode 100644 index c0dffb18354a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/databaseprincipalassignments.go +++ /dev/null @@ -1,456 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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 - } - - 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 = "2022-02-01" - 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, - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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 = "2022-02-01" - 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 - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.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 = "2022-02-01" - 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 - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - 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, - 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 - } - - 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 = "2022-02-01" - 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, - 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 - } - - 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 = "2022-02-01" - 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, - 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/2022-02-01/kusto/databases.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/databases.go deleted file mode 100644 index c4aea5947106..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/databases.go +++ /dev/null @@ -1,761 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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" -) - -// DatabasesClient 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 DatabasesClient struct { - BaseClient -} - -// NewDatabasesClient creates an instance of the DatabasesClient client. -func NewDatabasesClient(subscriptionID string) DatabasesClient { - return NewDatabasesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDatabasesClientWithBaseURI creates an instance of the DatabasesClient 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 NewDatabasesClientWithBaseURI(baseURI string, subscriptionID string) DatabasesClient { - return DatabasesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// AddPrincipals add Database principals permissions. -// 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. -// databasePrincipalsToAdd - list of database principals to add. -func (client DatabasesClient) AddPrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToAdd DatabasePrincipalListRequest) (result DatabasePrincipalListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.AddPrincipals") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.AddPrincipalsPreparer(ctx, resourceGroupName, clusterName, databaseName, databasePrincipalsToAdd) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "AddPrincipals", nil, "Failure preparing request") - return - } - - resp, err := client.AddPrincipalsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "AddPrincipals", resp, "Failure sending request") - return - } - - result, err = client.AddPrincipalsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "AddPrincipals", resp, "Failure responding to request") - return - } - - return -} - -// AddPrincipalsPreparer prepares the AddPrincipals request. -func (client DatabasesClient) AddPrincipalsPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToAdd DatabasePrincipalListRequest) (*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 = "2022-02-01" - 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}/addPrincipals", pathParameters), - autorest.WithJSON(databasePrincipalsToAdd), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AddPrincipalsSender sends the AddPrincipals request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) AddPrincipalsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AddPrincipalsResponder handles the response to the AddPrincipals request. The method always -// closes the http.Response Body. -func (client DatabasesClient) AddPrincipalsResponder(resp *http.Response) (result DatabasePrincipalListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CheckNameAvailability checks that the databases resource 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. -// 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() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {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, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "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.DatabasesClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -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 = "2022-02-01" - 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}/checkNameAvailability", pathParameters), - autorest.WithJSON(resourceName), - 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 DatabasesClient) 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 DatabasesClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a database. -// 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. -// parameters - the database parameters supplied to the CreateOrUpdate operation. -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() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -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), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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}", 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 DatabasesClient) CreateOrUpdateSender(req *http.Request) (future DatabasesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the database with the given name. -// 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 DatabasesClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabasesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DatabasesClient) DeletePreparer(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 = "2022-02-01" - 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}", 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 DatabasesClient) DeleteSender(req *http.Request) (future DatabasesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns a database. -// 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 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() { - 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) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "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.DatabasesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DatabasesClient) GetPreparer(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 = "2022-02-01" - 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}", 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 DatabasesClient) 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 DatabasesClient) GetResponder(resp *http.Response) (result DatabaseModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByCluster returns the list of databases 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 DatabasesClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result DatabaseListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.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.DatabasesClient", "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.DatabasesClient", "ListByCluster", resp, "Failure sending request") - return - } - - result, err = client.ListByClusterResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListByCluster", resp, "Failure responding to request") - return - } - - return -} - -// ListByClusterPreparer prepares the ListByCluster request. -func (client DatabasesClient) 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 = "2022-02-01" - 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", 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 DatabasesClient) 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 DatabasesClient) ListByClusterResponder(resp *http.Response) (result DatabaseListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListPrincipals returns a list of database principals of the given Kusto cluster and database. -// 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 DatabasesClient) ListPrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabasePrincipalListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.ListPrincipals") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPrincipalsPreparer(ctx, resourceGroupName, clusterName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListPrincipals", nil, "Failure preparing request") - return - } - - resp, err := client.ListPrincipalsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListPrincipals", resp, "Failure sending request") - return - } - - result, err = client.ListPrincipalsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "ListPrincipals", resp, "Failure responding to request") - return - } - - return -} - -// ListPrincipalsPreparer prepares the ListPrincipals request. -func (client DatabasesClient) ListPrincipalsPreparer(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 = "2022-02-01" - 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}/databases/{databaseName}/listPrincipals", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListPrincipalsSender sends the ListPrincipals request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) ListPrincipalsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListPrincipalsResponder handles the response to the ListPrincipals request. The method always -// closes the http.Response Body. -func (client DatabasesClient) ListPrincipalsResponder(resp *http.Response) (result DatabasePrincipalListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RemovePrincipals remove Database principals permissions. -// 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. -// databasePrincipalsToRemove - list of database principals to remove. -func (client DatabasesClient) RemovePrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToRemove DatabasePrincipalListRequest) (result DatabasePrincipalListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.RemovePrincipals") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.RemovePrincipalsPreparer(ctx, resourceGroupName, clusterName, databaseName, databasePrincipalsToRemove) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "RemovePrincipals", nil, "Failure preparing request") - return - } - - resp, err := client.RemovePrincipalsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "RemovePrincipals", resp, "Failure sending request") - return - } - - result, err = client.RemovePrincipalsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "RemovePrincipals", resp, "Failure responding to request") - return - } - - return -} - -// RemovePrincipalsPreparer prepares the RemovePrincipals request. -func (client DatabasesClient) RemovePrincipalsPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToRemove DatabasePrincipalListRequest) (*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 = "2022-02-01" - 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}/removePrincipals", pathParameters), - autorest.WithJSON(databasePrincipalsToRemove), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RemovePrincipalsSender sends the RemovePrincipals request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) RemovePrincipalsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// RemovePrincipalsResponder handles the response to the RemovePrincipals request. The method always -// closes the http.Response Body. -func (client DatabasesClient) RemovePrincipalsResponder(resp *http.Response) (result DatabasePrincipalListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a database. -// 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. -// parameters - the database parameters supplied to the Update operation. -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() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -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), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DatabasesClient) UpdateSender(req *http.Request) (future DatabasesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DatabasesClient) UpdateResponder(resp *http.Response) (result DatabaseModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/dataconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/dataconnections.go deleted file mode 100644 index eb2f1a06795b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/dataconnections.go +++ /dev/null @@ -1,618 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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" -) - -// DataConnectionsClient 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 DataConnectionsClient struct { - BaseClient -} - -// NewDataConnectionsClient creates an instance of the DataConnectionsClient client. -func NewDataConnectionsClient(subscriptionID string) DataConnectionsClient { - return NewDataConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDataConnectionsClientWithBaseURI creates an instance of the DataConnectionsClient 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 NewDataConnectionsClientWithBaseURI(baseURI string, subscriptionID string) DataConnectionsClient { - return DataConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks that the data connection 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. -// databaseName - the name of the database in the Kusto cluster. -// dataConnectionName - the name of the data connection. -func (client DataConnectionsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName DataConnectionCheckNameRequest) (result CheckNameResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectionsClient.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: dataConnectionName, - Constraints: []validation.Constraint{{Target: "dataConnectionName.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "dataConnectionName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("kusto.DataConnectionsClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, databaseName, dataConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "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.DataConnectionsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client DataConnectionsClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName DataConnectionCheckNameRequest) (*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 = "2022-02-01" - 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}/checkNameAvailability", pathParameters), - autorest.WithJSON(dataConnectionName), - 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 DataConnectionsClient) 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 DataConnectionsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates or updates a data connection. -// 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. -// dataConnectionName - the name of the data connection. -// parameters - the data connection parameters supplied to the CreateOrUpdate operation. -func (client DataConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, parameters BasicDataConnection) (result DataConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, dataConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DataConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, parameters BasicDataConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "dataConnectionName": autorest.Encode("path", dataConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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}/dataConnections/{dataConnectionName}", 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 DataConnectionsClient) CreateOrUpdateSender(req *http.Request) (future DataConnectionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client DataConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result DataConnectionModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// DataConnectionValidationMethod checks that the data connection parameters are valid. -// 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. -// parameters - the data connection parameters supplied to the CreateOrUpdate operation. -func (client DataConnectionsClient) DataConnectionValidationMethod(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DataConnectionValidation) (result DataConnectionsDataConnectionValidationMethodFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectionsClient.DataConnectionValidationMethod") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DataConnectionValidationMethodPreparer(ctx, resourceGroupName, clusterName, databaseName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "DataConnectionValidationMethod", nil, "Failure preparing request") - return - } - - result, err = client.DataConnectionValidationMethodSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "DataConnectionValidationMethod", result.Response(), "Failure sending request") - return - } - - return -} - -// DataConnectionValidationMethodPreparer prepares the DataConnectionValidationMethod request. -func (client DataConnectionsClient) DataConnectionValidationMethodPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DataConnectionValidation) (*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 = "2022-02-01" - 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}/dataConnectionValidation", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DataConnectionValidationMethodSender sends the DataConnectionValidationMethod request. The method will close the -// http.Response Body if it receives an error. -func (client DataConnectionsClient) DataConnectionValidationMethodSender(req *http.Request) (future DataConnectionsDataConnectionValidationMethodFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DataConnectionValidationMethodResponder handles the response to the DataConnectionValidationMethod request. The method always -// closes the http.Response Body. -func (client DataConnectionsClient) DataConnectionValidationMethodResponder(resp *http.Response) (result DataConnectionValidationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes the data connection with the given name. -// 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. -// dataConnectionName - the name of the data connection. -func (client DataConnectionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string) (result DataConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, databaseName, dataConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client DataConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "dataConnectionName": autorest.Encode("path", dataConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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}/dataConnections/{dataConnectionName}", 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 DataConnectionsClient) DeleteSender(req *http.Request) (future DataConnectionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client DataConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns a data connection. -// 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. -// dataConnectionName - the name of the data connection. -func (client DataConnectionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string) (result DataConnectionModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectionsClient.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, dataConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "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.DataConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client DataConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "dataConnectionName": autorest.Encode("path", dataConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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}/dataConnections/{dataConnectionName}", 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 DataConnectionsClient) 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 DataConnectionsClient) GetResponder(resp *http.Response) (result DataConnectionModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase returns the list of data connections of the given Kusto database. -// 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 DataConnectionsClient) ListByDatabase(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DataConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectionsClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, clusterName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client DataConnectionsClient) ListByDatabasePreparer(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 = "2022-02-01" - 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}/dataConnections", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client DataConnectionsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client DataConnectionsClient) ListByDatabaseResponder(resp *http.Response) (result DataConnectionListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a data connection. -// 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. -// dataConnectionName - the name of the data connection. -// parameters - the data connection parameters supplied to the Update operation. -func (client DataConnectionsClient) Update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, parameters BasicDataConnection) (result DataConnectionsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DataConnectionsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, dataConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client DataConnectionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, parameters BasicDataConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "dataConnectionName": autorest.Encode("path", dataConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client DataConnectionsClient) UpdateSender(req *http.Request) (future DataConnectionsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client DataConnectionsClient) UpdateResponder(resp *http.Response) (result DataConnectionModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/enums.go deleted file mode 100644 index f746200224e3..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/enums.go +++ /dev/null @@ -1,668 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// AzureScaleType enumerates the values for azure scale type. -type AzureScaleType string - -const ( - // AzureScaleTypeAutomatic ... - AzureScaleTypeAutomatic AzureScaleType = "automatic" - // AzureScaleTypeManual ... - AzureScaleTypeManual AzureScaleType = "manual" - // AzureScaleTypeNone ... - AzureScaleTypeNone AzureScaleType = "none" -) - -// PossibleAzureScaleTypeValues returns an array of possible values for the AzureScaleType const type. -func PossibleAzureScaleTypeValues() []AzureScaleType { - return []AzureScaleType{AzureScaleTypeAutomatic, AzureScaleTypeManual, AzureScaleTypeNone} -} - -// AzureSkuName enumerates the values for azure sku name. -type AzureSkuName string - -const ( - // AzureSkuNameDevNoSLAStandardD11V2 ... - AzureSkuNameDevNoSLAStandardD11V2 AzureSkuName = "Dev(No SLA)_Standard_D11_v2" - // AzureSkuNameDevNoSLAStandardE2aV4 ... - AzureSkuNameDevNoSLAStandardE2aV4 AzureSkuName = "Dev(No SLA)_Standard_E2a_v4" - // AzureSkuNameStandardD11V2 ... - AzureSkuNameStandardD11V2 AzureSkuName = "Standard_D11_v2" - // AzureSkuNameStandardD12V2 ... - AzureSkuNameStandardD12V2 AzureSkuName = "Standard_D12_v2" - // AzureSkuNameStandardD13V2 ... - AzureSkuNameStandardD13V2 AzureSkuName = "Standard_D13_v2" - // AzureSkuNameStandardD14V2 ... - AzureSkuNameStandardD14V2 AzureSkuName = "Standard_D14_v2" - // AzureSkuNameStandardD16dV5 ... - AzureSkuNameStandardD16dV5 AzureSkuName = "Standard_D16d_v5" - // AzureSkuNameStandardD32dV4 ... - AzureSkuNameStandardD32dV4 AzureSkuName = "Standard_D32d_v4" - // AzureSkuNameStandardD32dV5 ... - AzureSkuNameStandardD32dV5 AzureSkuName = "Standard_D32d_v5" - // AzureSkuNameStandardDS13V21TBPS ... - AzureSkuNameStandardDS13V21TBPS AzureSkuName = "Standard_DS13_v2+1TB_PS" - // AzureSkuNameStandardDS13V22TBPS ... - AzureSkuNameStandardDS13V22TBPS AzureSkuName = "Standard_DS13_v2+2TB_PS" - // AzureSkuNameStandardDS14V23TBPS ... - AzureSkuNameStandardDS14V23TBPS AzureSkuName = "Standard_DS14_v2+3TB_PS" - // AzureSkuNameStandardDS14V24TBPS ... - AzureSkuNameStandardDS14V24TBPS AzureSkuName = "Standard_DS14_v2+4TB_PS" - // AzureSkuNameStandardE16adsV5 ... - AzureSkuNameStandardE16adsV5 AzureSkuName = "Standard_E16ads_v5" - // AzureSkuNameStandardE16asV43TBPS ... - AzureSkuNameStandardE16asV43TBPS AzureSkuName = "Standard_E16as_v4+3TB_PS" - // AzureSkuNameStandardE16asV44TBPS ... - AzureSkuNameStandardE16asV44TBPS AzureSkuName = "Standard_E16as_v4+4TB_PS" - // AzureSkuNameStandardE16asV53TBPS ... - AzureSkuNameStandardE16asV53TBPS AzureSkuName = "Standard_E16as_v5+3TB_PS" - // AzureSkuNameStandardE16asV54TBPS ... - AzureSkuNameStandardE16asV54TBPS AzureSkuName = "Standard_E16as_v5+4TB_PS" - // AzureSkuNameStandardE16aV4 ... - AzureSkuNameStandardE16aV4 AzureSkuName = "Standard_E16a_v4" - // AzureSkuNameStandardE16sV43TBPS ... - AzureSkuNameStandardE16sV43TBPS AzureSkuName = "Standard_E16s_v4+3TB_PS" - // AzureSkuNameStandardE16sV44TBPS ... - AzureSkuNameStandardE16sV44TBPS AzureSkuName = "Standard_E16s_v4+4TB_PS" - // AzureSkuNameStandardE16sV53TBPS ... - AzureSkuNameStandardE16sV53TBPS AzureSkuName = "Standard_E16s_v5+3TB_PS" - // AzureSkuNameStandardE16sV54TBPS ... - AzureSkuNameStandardE16sV54TBPS AzureSkuName = "Standard_E16s_v5+4TB_PS" - // AzureSkuNameStandardE2adsV5 ... - AzureSkuNameStandardE2adsV5 AzureSkuName = "Standard_E2ads_v5" - // AzureSkuNameStandardE2aV4 ... - AzureSkuNameStandardE2aV4 AzureSkuName = "Standard_E2a_v4" - // AzureSkuNameStandardE4adsV5 ... - AzureSkuNameStandardE4adsV5 AzureSkuName = "Standard_E4ads_v5" - // AzureSkuNameStandardE4aV4 ... - AzureSkuNameStandardE4aV4 AzureSkuName = "Standard_E4a_v4" - // AzureSkuNameStandardE64iV3 ... - AzureSkuNameStandardE64iV3 AzureSkuName = "Standard_E64i_v3" - // AzureSkuNameStandardE80idsV4 ... - AzureSkuNameStandardE80idsV4 AzureSkuName = "Standard_E80ids_v4" - // AzureSkuNameStandardE8adsV5 ... - AzureSkuNameStandardE8adsV5 AzureSkuName = "Standard_E8ads_v5" - // AzureSkuNameStandardE8asV41TBPS ... - AzureSkuNameStandardE8asV41TBPS AzureSkuName = "Standard_E8as_v4+1TB_PS" - // AzureSkuNameStandardE8asV42TBPS ... - AzureSkuNameStandardE8asV42TBPS AzureSkuName = "Standard_E8as_v4+2TB_PS" - // AzureSkuNameStandardE8asV51TBPS ... - AzureSkuNameStandardE8asV51TBPS AzureSkuName = "Standard_E8as_v5+1TB_PS" - // AzureSkuNameStandardE8asV52TBPS ... - AzureSkuNameStandardE8asV52TBPS AzureSkuName = "Standard_E8as_v5+2TB_PS" - // AzureSkuNameStandardE8aV4 ... - AzureSkuNameStandardE8aV4 AzureSkuName = "Standard_E8a_v4" - // AzureSkuNameStandardE8sV41TBPS ... - AzureSkuNameStandardE8sV41TBPS AzureSkuName = "Standard_E8s_v4+1TB_PS" - // AzureSkuNameStandardE8sV42TBPS ... - AzureSkuNameStandardE8sV42TBPS AzureSkuName = "Standard_E8s_v4+2TB_PS" - // AzureSkuNameStandardE8sV51TBPS ... - AzureSkuNameStandardE8sV51TBPS AzureSkuName = "Standard_E8s_v5+1TB_PS" - // AzureSkuNameStandardE8sV52TBPS ... - AzureSkuNameStandardE8sV52TBPS AzureSkuName = "Standard_E8s_v5+2TB_PS" - // AzureSkuNameStandardL16s ... - AzureSkuNameStandardL16s AzureSkuName = "Standard_L16s" - // AzureSkuNameStandardL16sV2 ... - AzureSkuNameStandardL16sV2 AzureSkuName = "Standard_L16s_v2" - // AzureSkuNameStandardL4s ... - AzureSkuNameStandardL4s AzureSkuName = "Standard_L4s" - // AzureSkuNameStandardL8s ... - AzureSkuNameStandardL8s AzureSkuName = "Standard_L8s" - // AzureSkuNameStandardL8sV2 ... - AzureSkuNameStandardL8sV2 AzureSkuName = "Standard_L8s_v2" -) - -// PossibleAzureSkuNameValues returns an array of possible values for the AzureSkuName const type. -func PossibleAzureSkuNameValues() []AzureSkuName { - return []AzureSkuName{AzureSkuNameDevNoSLAStandardD11V2, AzureSkuNameDevNoSLAStandardE2aV4, AzureSkuNameStandardD11V2, AzureSkuNameStandardD12V2, AzureSkuNameStandardD13V2, AzureSkuNameStandardD14V2, AzureSkuNameStandardD16dV5, AzureSkuNameStandardD32dV4, AzureSkuNameStandardD32dV5, AzureSkuNameStandardDS13V21TBPS, AzureSkuNameStandardDS13V22TBPS, AzureSkuNameStandardDS14V23TBPS, AzureSkuNameStandardDS14V24TBPS, AzureSkuNameStandardE16adsV5, AzureSkuNameStandardE16asV43TBPS, AzureSkuNameStandardE16asV44TBPS, AzureSkuNameStandardE16asV53TBPS, AzureSkuNameStandardE16asV54TBPS, AzureSkuNameStandardE16aV4, AzureSkuNameStandardE16sV43TBPS, AzureSkuNameStandardE16sV44TBPS, AzureSkuNameStandardE16sV53TBPS, AzureSkuNameStandardE16sV54TBPS, AzureSkuNameStandardE2adsV5, AzureSkuNameStandardE2aV4, AzureSkuNameStandardE4adsV5, AzureSkuNameStandardE4aV4, AzureSkuNameStandardE64iV3, AzureSkuNameStandardE80idsV4, AzureSkuNameStandardE8adsV5, AzureSkuNameStandardE8asV41TBPS, AzureSkuNameStandardE8asV42TBPS, AzureSkuNameStandardE8asV51TBPS, AzureSkuNameStandardE8asV52TBPS, AzureSkuNameStandardE8aV4, AzureSkuNameStandardE8sV41TBPS, AzureSkuNameStandardE8sV42TBPS, AzureSkuNameStandardE8sV51TBPS, AzureSkuNameStandardE8sV52TBPS, AzureSkuNameStandardL16s, AzureSkuNameStandardL16sV2, AzureSkuNameStandardL4s, AzureSkuNameStandardL8s, AzureSkuNameStandardL8sV2} -} - -// AzureSkuTier enumerates the values for azure sku tier. -type AzureSkuTier string - -const ( - // AzureSkuTierBasic ... - AzureSkuTierBasic AzureSkuTier = "Basic" - // AzureSkuTierStandard ... - AzureSkuTierStandard AzureSkuTier = "Standard" -) - -// PossibleAzureSkuTierValues returns an array of possible values for the AzureSkuTier const type. -func PossibleAzureSkuTierValues() []AzureSkuTier { - return []AzureSkuTier{AzureSkuTierBasic, AzureSkuTierStandard} -} - -// BlobStorageEventType enumerates the values for blob storage event type. -type BlobStorageEventType string - -const ( - // BlobStorageEventTypeMicrosoftStorageBlobCreated ... - BlobStorageEventTypeMicrosoftStorageBlobCreated BlobStorageEventType = "Microsoft.Storage.BlobCreated" - // BlobStorageEventTypeMicrosoftStorageBlobRenamed ... - BlobStorageEventTypeMicrosoftStorageBlobRenamed BlobStorageEventType = "Microsoft.Storage.BlobRenamed" -) - -// PossibleBlobStorageEventTypeValues returns an array of possible values for the BlobStorageEventType const type. -func PossibleBlobStorageEventTypeValues() []BlobStorageEventType { - return []BlobStorageEventType{BlobStorageEventTypeMicrosoftStorageBlobCreated, BlobStorageEventTypeMicrosoftStorageBlobRenamed} -} - -// ClusterNetworkAccessFlag enumerates the values for cluster network access flag. -type ClusterNetworkAccessFlag string - -const ( - // ClusterNetworkAccessFlagDisabled ... - ClusterNetworkAccessFlagDisabled ClusterNetworkAccessFlag = "Disabled" - // ClusterNetworkAccessFlagEnabled ... - ClusterNetworkAccessFlagEnabled ClusterNetworkAccessFlag = "Enabled" -) - -// PossibleClusterNetworkAccessFlagValues returns an array of possible values for the ClusterNetworkAccessFlag const type. -func PossibleClusterNetworkAccessFlagValues() []ClusterNetworkAccessFlag { - return []ClusterNetworkAccessFlag{ClusterNetworkAccessFlagDisabled, ClusterNetworkAccessFlagEnabled} -} - -// ClusterPrincipalRole enumerates the values for cluster principal role. -type ClusterPrincipalRole string - -const ( - // ClusterPrincipalRoleAllDatabasesAdmin ... - ClusterPrincipalRoleAllDatabasesAdmin ClusterPrincipalRole = "AllDatabasesAdmin" - // ClusterPrincipalRoleAllDatabasesViewer ... - ClusterPrincipalRoleAllDatabasesViewer ClusterPrincipalRole = "AllDatabasesViewer" -) - -// PossibleClusterPrincipalRoleValues returns an array of possible values for the ClusterPrincipalRole const type. -func PossibleClusterPrincipalRoleValues() []ClusterPrincipalRole { - return []ClusterPrincipalRole{ClusterPrincipalRoleAllDatabasesAdmin, ClusterPrincipalRoleAllDatabasesViewer} -} - -// 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} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// DatabasePrincipalRole enumerates the values for database principal role. -type DatabasePrincipalRole string - -const ( - // DatabasePrincipalRoleAdmin ... - DatabasePrincipalRoleAdmin DatabasePrincipalRole = "Admin" - // DatabasePrincipalRoleIngestor ... - DatabasePrincipalRoleIngestor DatabasePrincipalRole = "Ingestor" - // DatabasePrincipalRoleMonitor ... - DatabasePrincipalRoleMonitor DatabasePrincipalRole = "Monitor" - // DatabasePrincipalRoleUnrestrictedViewer ... - DatabasePrincipalRoleUnrestrictedViewer DatabasePrincipalRole = "UnrestrictedViewer" - // DatabasePrincipalRoleUser ... - DatabasePrincipalRoleUser DatabasePrincipalRole = "User" - // DatabasePrincipalRoleViewer ... - DatabasePrincipalRoleViewer DatabasePrincipalRole = "Viewer" -) - -// PossibleDatabasePrincipalRoleValues returns an array of possible values for the DatabasePrincipalRole const type. -func PossibleDatabasePrincipalRoleValues() []DatabasePrincipalRole { - return []DatabasePrincipalRole{DatabasePrincipalRoleAdmin, DatabasePrincipalRoleIngestor, DatabasePrincipalRoleMonitor, DatabasePrincipalRoleUnrestrictedViewer, DatabasePrincipalRoleUser, DatabasePrincipalRoleViewer} -} - -// DatabasePrincipalType enumerates the values for database principal type. -type DatabasePrincipalType string - -const ( - // DatabasePrincipalTypeApp ... - DatabasePrincipalTypeApp DatabasePrincipalType = "App" - // DatabasePrincipalTypeGroup ... - DatabasePrincipalTypeGroup DatabasePrincipalType = "Group" - // DatabasePrincipalTypeUser ... - DatabasePrincipalTypeUser DatabasePrincipalType = "User" -) - -// PossibleDatabasePrincipalTypeValues returns an array of possible values for the DatabasePrincipalType const type. -func PossibleDatabasePrincipalTypeValues() []DatabasePrincipalType { - return []DatabasePrincipalType{DatabasePrincipalTypeApp, DatabasePrincipalTypeGroup, DatabasePrincipalTypeUser} -} - -// DatabaseRouting enumerates the values for database routing. -type DatabaseRouting string - -const ( - // DatabaseRoutingMulti ... - DatabaseRoutingMulti DatabaseRouting = "Multi" - // DatabaseRoutingSingle ... - DatabaseRoutingSingle DatabaseRouting = "Single" -) - -// PossibleDatabaseRoutingValues returns an array of possible values for the DatabaseRouting const type. -func PossibleDatabaseRoutingValues() []DatabaseRouting { - return []DatabaseRouting{DatabaseRoutingMulti, DatabaseRoutingSingle} -} - -// 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} -} - -// EngineType enumerates the values for engine type. -type EngineType string - -const ( - // EngineTypeV2 ... - EngineTypeV2 EngineType = "V2" - // EngineTypeV3 ... - EngineTypeV3 EngineType = "V3" -) - -// PossibleEngineTypeValues returns an array of possible values for the EngineType const type. -func PossibleEngineTypeValues() []EngineType { - return []EngineType{EngineTypeV2, EngineTypeV3} -} - -// EventGridDataFormat enumerates the values for event grid data format. -type EventGridDataFormat string - -const ( - // EventGridDataFormatAPACHEAVRO ... - EventGridDataFormatAPACHEAVRO EventGridDataFormat = "APACHEAVRO" - // EventGridDataFormatAVRO ... - EventGridDataFormatAVRO EventGridDataFormat = "AVRO" - // EventGridDataFormatCSV ... - EventGridDataFormatCSV EventGridDataFormat = "CSV" - // EventGridDataFormatJSON ... - EventGridDataFormatJSON EventGridDataFormat = "JSON" - // EventGridDataFormatMULTIJSON ... - EventGridDataFormatMULTIJSON EventGridDataFormat = "MULTIJSON" - // EventGridDataFormatORC ... - EventGridDataFormatORC EventGridDataFormat = "ORC" - // EventGridDataFormatPARQUET ... - EventGridDataFormatPARQUET EventGridDataFormat = "PARQUET" - // EventGridDataFormatPSV ... - EventGridDataFormatPSV EventGridDataFormat = "PSV" - // EventGridDataFormatRAW ... - EventGridDataFormatRAW EventGridDataFormat = "RAW" - // EventGridDataFormatSCSV ... - EventGridDataFormatSCSV EventGridDataFormat = "SCSV" - // EventGridDataFormatSINGLEJSON ... - EventGridDataFormatSINGLEJSON EventGridDataFormat = "SINGLEJSON" - // EventGridDataFormatSOHSV ... - EventGridDataFormatSOHSV EventGridDataFormat = "SOHSV" - // EventGridDataFormatTSV ... - EventGridDataFormatTSV EventGridDataFormat = "TSV" - // EventGridDataFormatTSVE ... - EventGridDataFormatTSVE EventGridDataFormat = "TSVE" - // EventGridDataFormatTXT ... - EventGridDataFormatTXT EventGridDataFormat = "TXT" - // EventGridDataFormatW3CLOGFILE ... - EventGridDataFormatW3CLOGFILE EventGridDataFormat = "W3CLOGFILE" -) - -// PossibleEventGridDataFormatValues returns an array of possible values for the EventGridDataFormat const type. -func PossibleEventGridDataFormatValues() []EventGridDataFormat { - return []EventGridDataFormat{EventGridDataFormatAPACHEAVRO, EventGridDataFormatAVRO, EventGridDataFormatCSV, EventGridDataFormatJSON, EventGridDataFormatMULTIJSON, EventGridDataFormatORC, EventGridDataFormatPARQUET, EventGridDataFormatPSV, EventGridDataFormatRAW, EventGridDataFormatSCSV, EventGridDataFormatSINGLEJSON, EventGridDataFormatSOHSV, EventGridDataFormatTSV, EventGridDataFormatTSVE, EventGridDataFormatTXT, EventGridDataFormatW3CLOGFILE} -} - -// EventHubDataFormat enumerates the values for event hub data format. -type EventHubDataFormat string - -const ( - // EventHubDataFormatAPACHEAVRO ... - EventHubDataFormatAPACHEAVRO EventHubDataFormat = "APACHEAVRO" - // 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" - // EventHubDataFormatW3CLOGFILE ... - EventHubDataFormatW3CLOGFILE EventHubDataFormat = "W3CLOGFILE" -) - -// PossibleEventHubDataFormatValues returns an array of possible values for the EventHubDataFormat const type. -func PossibleEventHubDataFormatValues() []EventHubDataFormat { - return []EventHubDataFormat{EventHubDataFormatAPACHEAVRO, EventHubDataFormatAVRO, EventHubDataFormatCSV, EventHubDataFormatJSON, EventHubDataFormatMULTIJSON, EventHubDataFormatORC, EventHubDataFormatPARQUET, EventHubDataFormatPSV, EventHubDataFormatRAW, EventHubDataFormatSCSV, EventHubDataFormatSINGLEJSON, EventHubDataFormatSOHSV, EventHubDataFormatTSV, EventHubDataFormatTSVE, EventHubDataFormatTXT, EventHubDataFormatW3CLOGFILE} -} - -// IdentityType enumerates the values for identity type. -type IdentityType string - -const ( - // IdentityTypeNone ... - IdentityTypeNone IdentityType = "None" - // IdentityTypeSystemAssigned ... - IdentityTypeSystemAssigned IdentityType = "SystemAssigned" - // IdentityTypeSystemAssignedUserAssigned ... - IdentityTypeSystemAssignedUserAssigned IdentityType = "SystemAssigned, UserAssigned" - // IdentityTypeUserAssigned ... - IdentityTypeUserAssigned IdentityType = "UserAssigned" -) - -// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. -func PossibleIdentityTypeValues() []IdentityType { - return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned, IdentityTypeSystemAssignedUserAssigned, IdentityTypeUserAssigned} -} - -// IotHubDataFormat enumerates the values for iot hub data format. -type IotHubDataFormat string - -const ( - // IotHubDataFormatAPACHEAVRO ... - IotHubDataFormatAPACHEAVRO IotHubDataFormat = "APACHEAVRO" - // 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" - // IotHubDataFormatW3CLOGFILE ... - IotHubDataFormatW3CLOGFILE IotHubDataFormat = "W3CLOGFILE" -) - -// PossibleIotHubDataFormatValues returns an array of possible values for the IotHubDataFormat const type. -func PossibleIotHubDataFormatValues() []IotHubDataFormat { - return []IotHubDataFormat{IotHubDataFormatAPACHEAVRO, IotHubDataFormatAVRO, IotHubDataFormatCSV, IotHubDataFormatJSON, IotHubDataFormatMULTIJSON, IotHubDataFormatORC, IotHubDataFormatPARQUET, IotHubDataFormatPSV, IotHubDataFormatRAW, IotHubDataFormatSCSV, IotHubDataFormatSINGLEJSON, IotHubDataFormatSOHSV, IotHubDataFormatTSV, IotHubDataFormatTSVE, IotHubDataFormatTXT, IotHubDataFormatW3CLOGFILE} -} - -// 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 ( - // KindBasicDataConnectionKindDataConnection ... - KindBasicDataConnectionKindDataConnection KindBasicDataConnection = "DataConnection" - // KindBasicDataConnectionKindEventGrid ... - KindBasicDataConnectionKindEventGrid KindBasicDataConnection = "EventGrid" - // KindBasicDataConnectionKindEventHub ... - KindBasicDataConnectionKindEventHub KindBasicDataConnection = "EventHub" - // KindBasicDataConnectionKindIotHub ... - KindBasicDataConnectionKindIotHub KindBasicDataConnection = "IotHub" -) - -// PossibleKindBasicDataConnectionValues returns an array of possible values for the KindBasicDataConnection const type. -func PossibleKindBasicDataConnectionValues() []KindBasicDataConnection { - return []KindBasicDataConnection{KindBasicDataConnectionKindDataConnection, KindBasicDataConnectionKindEventGrid, KindBasicDataConnectionKindEventHub, KindBasicDataConnectionKindIotHub} -} - -// LanguageExtensionName enumerates the values for language extension name. -type LanguageExtensionName string - -const ( - // LanguageExtensionNamePYTHON ... - LanguageExtensionNamePYTHON LanguageExtensionName = "PYTHON" - // LanguageExtensionNameR ... - LanguageExtensionNameR LanguageExtensionName = "R" -) - -// PossibleLanguageExtensionNameValues returns an array of possible values for the LanguageExtensionName const type. -func PossibleLanguageExtensionNameValues() []LanguageExtensionName { - return []LanguageExtensionName{LanguageExtensionNamePYTHON, LanguageExtensionNameR} -} - -// 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. -type ProvisioningState string - -const ( - // ProvisioningStateCreating ... - ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting ... - ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateMoving ... - ProvisioningStateMoving ProvisioningState = "Moving" - // ProvisioningStateRunning ... - ProvisioningStateRunning ProvisioningState = "Running" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoving, ProvisioningStateRunning, ProvisioningStateSucceeded} -} - -// PublicIPType enumerates the values for public ip type. -type PublicIPType string - -const ( - // PublicIPTypeDualStack ... - PublicIPTypeDualStack PublicIPType = "DualStack" - // PublicIPTypeIPv4 ... - PublicIPTypeIPv4 PublicIPType = "IPv4" -) - -// PossiblePublicIPTypeValues returns an array of possible values for the PublicIPType const type. -func PossiblePublicIPTypeValues() []PublicIPType { - return []PublicIPType{PublicIPTypeDualStack, PublicIPTypeIPv4} -} - -// PublicNetworkAccess enumerates the values for public network access. -type PublicNetworkAccess string - -const ( - // PublicNetworkAccessDisabled ... - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - // PublicNetworkAccessEnabled ... - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" -) - -// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} -} - -// Reason enumerates the values for reason. -type Reason string - -const ( - // ReasonAlreadyExists ... - ReasonAlreadyExists Reason = "AlreadyExists" - // ReasonInvalid ... - ReasonInvalid Reason = "Invalid" -) - -// PossibleReasonValues returns an array of possible values for the Reason const type. -func PossibleReasonValues() []Reason { - return []Reason{ReasonAlreadyExists, ReasonInvalid} -} - -// State enumerates the values for state. -type State string - -const ( - // StateCreating ... - StateCreating State = "Creating" - // StateDeleted ... - StateDeleted State = "Deleted" - // StateDeleting ... - StateDeleting State = "Deleting" - // StateRunning ... - StateRunning State = "Running" - // StateStarting ... - StateStarting State = "Starting" - // StateStopped ... - StateStopped State = "Stopped" - // StateStopping ... - StateStopping State = "Stopping" - // StateUnavailable ... - StateUnavailable State = "Unavailable" - // StateUpdating ... - StateUpdating State = "Updating" -) - -// PossibleStateValues returns an array of possible values for the State const type. -func PossibleStateValues() []State { - return []State{StateCreating, StateDeleted, StateDeleting, StateRunning, StateStarting, StateStopped, StateStopping, StateUnavailable, StateUpdating} -} - -// Status enumerates the values for status. -type Status string - -const ( - // StatusCanceled ... - StatusCanceled Status = "Canceled" - // StatusFailed ... - StatusFailed Status = "Failed" - // StatusRunning ... - StatusRunning Status = "Running" - // StatusSucceeded ... - StatusSucceeded Status = "Succeeded" -) - -// PossibleStatusValues returns an array of possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{StatusCanceled, StatusFailed, StatusRunning, StatusSucceeded} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeMicrosoftKustoclustersattachedDatabaseConfigurations ... - TypeMicrosoftKustoclustersattachedDatabaseConfigurations Type = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" - // TypeMicrosoftKustoclustersdatabases ... - TypeMicrosoftKustoclustersdatabases Type = "Microsoft.Kusto/clusters/databases" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeMicrosoftKustoclustersattachedDatabaseConfigurations, TypeMicrosoftKustoclustersdatabases} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/managedprivateendpoints.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/managedprivateendpoints.go deleted file mode 100644 index e86c8b183786..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/managedprivateendpoints.go +++ /dev/null @@ -1,534 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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" -) - -// ManagedPrivateEndpointsClient 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 ManagedPrivateEndpointsClient struct { - BaseClient -} - -// NewManagedPrivateEndpointsClient creates an instance of the ManagedPrivateEndpointsClient client. -func NewManagedPrivateEndpointsClient(subscriptionID string) ManagedPrivateEndpointsClient { - return NewManagedPrivateEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewManagedPrivateEndpointsClientWithBaseURI creates an instance of the ManagedPrivateEndpointsClient 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 NewManagedPrivateEndpointsClientWithBaseURI(baseURI string, subscriptionID string) ManagedPrivateEndpointsClient { - return ManagedPrivateEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks that the managed private endpoints resource 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. -// resourceName - the name of the resource. -func (client ManagedPrivateEndpointsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, resourceName ManagedPrivateEndpointsCheckNameRequest) (result CheckNameResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointsClient.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: resourceName, - Constraints: []validation.Constraint{{Target: "resourceName.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "resourceName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("kusto.ManagedPrivateEndpointsClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsClient", "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.ManagedPrivateEndpointsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ManagedPrivateEndpointsClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, resourceName ManagedPrivateEndpointsCheckNameRequest) (*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 = "2022-02-01" - 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}/managedPrivateEndpointsCheckNameAvailability", pathParameters), - autorest.WithJSON(resourceName), - 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 ManagedPrivateEndpointsClient) 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 ManagedPrivateEndpointsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates a managed private endpoint. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// managedPrivateEndpointName - the name of the managed private endpoint. -// parameters - the managed private endpoint parameters. -func (client ManagedPrivateEndpointsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint) (result ManagedPrivateEndpointsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.ManagedPrivateEndpointProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.ManagedPrivateEndpointProperties.PrivateLinkResourceID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "parameters.ManagedPrivateEndpointProperties.GroupID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("kusto.ManagedPrivateEndpointsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, managedPrivateEndpointName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ManagedPrivateEndpointsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "managedPrivateEndpointName": autorest.Encode("path", managedPrivateEndpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - 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}/managedPrivateEndpoints/{managedPrivateEndpointName}", 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 ManagedPrivateEndpointsClient) CreateOrUpdateSender(req *http.Request) (future ManagedPrivateEndpointsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ManagedPrivateEndpointsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedPrivateEndpoint, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a managed private endpoint. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// managedPrivateEndpointName - the name of the managed private endpoint. -func (client ManagedPrivateEndpointsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string) (result ManagedPrivateEndpointsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, managedPrivateEndpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ManagedPrivateEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "managedPrivateEndpointName": autorest.Encode("path", managedPrivateEndpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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}/managedPrivateEndpoints/{managedPrivateEndpointName}", 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 ManagedPrivateEndpointsClient) DeleteSender(req *http.Request) (future ManagedPrivateEndpointsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ManagedPrivateEndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a managed private endpoint. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// managedPrivateEndpointName - the name of the managed private endpoint. -func (client ManagedPrivateEndpointsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string) (result ManagedPrivateEndpoint, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointsClient.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, managedPrivateEndpointName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsClient", "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.ManagedPrivateEndpointsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ManagedPrivateEndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "managedPrivateEndpointName": autorest.Encode("path", managedPrivateEndpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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}/managedPrivateEndpoints/{managedPrivateEndpointName}", 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 ManagedPrivateEndpointsClient) 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 ManagedPrivateEndpointsClient) GetResponder(resp *http.Response) (result ManagedPrivateEndpoint, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns the list of managed private endpoints. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client ManagedPrivateEndpointsClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result ManagedPrivateEndpointListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointsClient.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.ManagedPrivateEndpointsClient", "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.ManagedPrivateEndpointsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ManagedPrivateEndpointsClient) 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 = "2022-02-01" - 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}/managedPrivateEndpoints", 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 ManagedPrivateEndpointsClient) 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 ManagedPrivateEndpointsClient) ListResponder(resp *http.Response) (result ManagedPrivateEndpointListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a managed private endpoint. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// managedPrivateEndpointName - the name of the managed private endpoint. -// parameters - the managed private endpoint parameters. -func (client ManagedPrivateEndpointsClient) Update(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint) (result ManagedPrivateEndpointsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ManagedPrivateEndpointsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, managedPrivateEndpointName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ManagedPrivateEndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "managedPrivateEndpointName": autorest.Encode("path", managedPrivateEndpointName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ManagedPrivateEndpointsClient) UpdateSender(req *http.Request) (future ManagedPrivateEndpointsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ManagedPrivateEndpointsClient) UpdateResponder(resp *http.Response) (result ManagedPrivateEndpoint, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - 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/2022-02-01/kusto/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/models.go deleted file mode 100644 index 10de556bd41c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/models.go +++ /dev/null @@ -1,4819 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto" - -// AcceptedAudiences represents an accepted audience trusted by the cluster. -type AcceptedAudiences struct { - // Value - GUID or valid URL representing an accepted audience. - Value *string `json:"value,omitempty"` -} - -// 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. E.g. "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: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - 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"` - // TableLevelSharingProperties - Table level sharing specifications - TableLevelSharingProperties *TableLevelSharingProperties `json:"tableLevelSharingProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AttachedDatabaseConfigurationProperties. -func (adcp AttachedDatabaseConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if adcp.DatabaseName != nil { - objectMap["databaseName"] = adcp.DatabaseName - } - if adcp.ClusterResourceID != nil { - objectMap["clusterResourceId"] = adcp.ClusterResourceID - } - if adcp.DefaultPrincipalsModificationKind != "" { - objectMap["defaultPrincipalsModificationKind"] = adcp.DefaultPrincipalsModificationKind - } - if adcp.TableLevelSharingProperties != nil { - objectMap["tableLevelSharingProperties"] = adcp.TableLevelSharingProperties - } - return json.Marshal(objectMap) -} - -// AttachedDatabaseConfigurationsCheckNameRequest the result returned from a AttachedDatabaseConfigurations -// check name availability request. -type AttachedDatabaseConfigurationsCheckNameRequest struct { - // Name - Attached database resource name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, for instance Microsoft.Kusto/clusters/attachedDatabaseConfigurations. - Type *string `json:"type,omitempty"` -} - -// AttachedDatabaseConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type AttachedDatabaseConfigurationsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AttachedDatabaseConfigurationsClient) (AttachedDatabaseConfiguration, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AttachedDatabaseConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AttachedDatabaseConfigurationsCreateOrUpdateFuture.Result. -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 { - adc.Response.Response = future.Response() - 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.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AttachedDatabaseConfigurationsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AttachedDatabaseConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AttachedDatabaseConfigurationsDeleteFuture.Result. -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 { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.AttachedDatabaseConfigurationsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AzureCapacity azure capacity definition. -type AzureCapacity struct { - // ScaleType - Scale type. Possible values include: 'AzureScaleTypeAutomatic', 'AzureScaleTypeManual', 'AzureScaleTypeNone' - ScaleType AzureScaleType `json:"scaleType,omitempty"` - // Minimum - Minimum allowed capacity. - Minimum *int32 `json:"minimum,omitempty"` - // Maximum - Maximum allowed capacity. - Maximum *int32 `json:"maximum,omitempty"` - // Default - The default capacity that would be used. - Default *int32 `json:"default,omitempty"` -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AzureResourceSku azure resource SKU definition. -type AzureResourceSku struct { - // ResourceType - Resource Namespace and Type. - ResourceType *string `json:"resourceType,omitempty"` - // Sku - The SKU details. - Sku *AzureSku `json:"sku,omitempty"` - // Capacity - The number of instances of the cluster. - Capacity *AzureCapacity `json:"capacity,omitempty"` -} - -// AzureSku azure SKU definition. -type AzureSku struct { - // Name - SKU name. Possible values include: 'AzureSkuNameDevNoSLAStandardD11V2', 'AzureSkuNameDevNoSLAStandardE2aV4', 'AzureSkuNameStandardD11V2', 'AzureSkuNameStandardD12V2', 'AzureSkuNameStandardD13V2', 'AzureSkuNameStandardD14V2', 'AzureSkuNameStandardD32dV4', 'AzureSkuNameStandardD16dV5', 'AzureSkuNameStandardD32dV5', 'AzureSkuNameStandardDS13V21TBPS', 'AzureSkuNameStandardDS13V22TBPS', 'AzureSkuNameStandardDS14V23TBPS', 'AzureSkuNameStandardDS14V24TBPS', 'AzureSkuNameStandardL4s', 'AzureSkuNameStandardL8s', 'AzureSkuNameStandardL16s', 'AzureSkuNameStandardL8sV2', 'AzureSkuNameStandardL16sV2', 'AzureSkuNameStandardE64iV3', 'AzureSkuNameStandardE80idsV4', 'AzureSkuNameStandardE2aV4', 'AzureSkuNameStandardE4aV4', 'AzureSkuNameStandardE8aV4', 'AzureSkuNameStandardE16aV4', 'AzureSkuNameStandardE8asV41TBPS', 'AzureSkuNameStandardE8asV42TBPS', 'AzureSkuNameStandardE16asV43TBPS', 'AzureSkuNameStandardE16asV44TBPS', 'AzureSkuNameStandardE8asV51TBPS', 'AzureSkuNameStandardE8asV52TBPS', 'AzureSkuNameStandardE16asV53TBPS', 'AzureSkuNameStandardE16asV54TBPS', 'AzureSkuNameStandardE2adsV5', 'AzureSkuNameStandardE4adsV5', 'AzureSkuNameStandardE8adsV5', 'AzureSkuNameStandardE16adsV5', 'AzureSkuNameStandardE8sV41TBPS', 'AzureSkuNameStandardE8sV42TBPS', 'AzureSkuNameStandardE16sV43TBPS', 'AzureSkuNameStandardE16sV44TBPS', 'AzureSkuNameStandardE8sV51TBPS', 'AzureSkuNameStandardE8sV52TBPS', 'AzureSkuNameStandardE16sV53TBPS', 'AzureSkuNameStandardE16sV54TBPS' - Name AzureSkuName `json:"name,omitempty"` - // Capacity - The number of instances of the cluster. - Capacity *int32 `json:"capacity,omitempty"` - // Tier - SKU tier. Possible values include: 'AzureSkuTierBasic', 'AzureSkuTierStandard' - 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: 'TypeMicrosoftKustoclustersdatabases', 'TypeMicrosoftKustoclustersattachedDatabaseConfigurations' - Type Type `json:"type,omitempty"` -} - -// CheckNameResult the result returned from a check name availability request. -type CheckNameResult struct { - autorest.Response `json:"-"` - // NameAvailable - Specifies a Boolean value that indicates if the name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - // Name - The name that was checked. - Name *string `json:"name,omitempty"` - // Message - Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. - Message *string `json:"message,omitempty"` - // Reason - Message providing the reason why the given name is invalid. Possible values include: 'ReasonInvalid', 'ReasonAlreadyExists' - Reason Reason `json:"reason,omitempty"` -} - -// CloudError an error response from Kusto. -type CloudError struct { - // Error - An error response from Kusto. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from Kusto. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for displaying in a user interface. - Message *string `json:"message,omitempty"` - // Target - The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` - // Details - A list of additional details about the error. - Details *[]CloudErrorBody `json:"details,omitempty"` -} - -// Cluster class representing a Kusto cluster. -type Cluster struct { - autorest.Response `json:"-"` - // Sku - The SKU of the cluster. - Sku *AzureSku `json:"sku,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,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"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Cluster. -func (c Cluster) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if c.Sku != nil { - objectMap["sku"] = c.Sku - } - if c.Zones != nil { - objectMap["zones"] = c.Zones - } - if c.Identity != nil { - objectMap["identity"] = c.Identity - } - if c.ClusterProperties != nil { - objectMap["properties"] = c.ClusterProperties - } - if c.Tags != nil { - objectMap["tags"] = c.Tags - } - if c.Location != nil { - objectMap["location"] = c.Location - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Cluster struct. -func (c *Cluster) 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 "sku": - if v != nil { - var sku AzureSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - c.Sku = &sku - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - c.SystemData = &systemData - } - case "zones": - if v != nil { - var zones []string - err = json.Unmarshal(*v, &zones) - if err != nil { - return err - } - 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 - err = json.Unmarshal(*v, &clusterProperties) - if err != nil { - return err - } - c.ClusterProperties = &clusterProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - c.Etag = &etag - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - c.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - c.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - c.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - c.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - c.Type = &typeVar - } - } - } - - return nil -} - -// ClusterCheckNameRequest the result returned from a cluster check name availability request. -type ClusterCheckNameRequest struct { - // Name - Cluster name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, Microsoft.Kusto/clusters. - Type *string `json:"type,omitempty"` -} - -// ClusterListResult the list Kusto clusters operation response. -type ClusterListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto clusters. - Value *[]Cluster `json:"value,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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// 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) -} - -// 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 { - return err - } - 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.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClusterPrincipalAssignmentsClient) (ClusterPrincipalAssignment, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClusterPrincipalAssignmentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClusterPrincipalAssignmentsCreateOrUpdateFuture.Result. -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 { - cpa.Response.Response = future.Response() - 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.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClusterPrincipalAssignmentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClusterPrincipalAssignmentsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClusterPrincipalAssignmentsDeleteFuture.Result. -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 { - ar.Response = future.Response() - 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: 'ClusterPrincipalRoleAllDatabasesAdmin', 'ClusterPrincipalRoleAllDatabasesViewer' - 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: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // AadObjectID - READ-ONLY; The service principal object id in AAD (Azure active directory) - AadObjectID *string `json:"aadObjectId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterPrincipalProperties. -func (cpp ClusterPrincipalProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cpp.PrincipalID != nil { - objectMap["principalId"] = cpp.PrincipalID - } - if cpp.Role != "" { - objectMap["role"] = cpp.Role - } - if cpp.TenantID != nil { - objectMap["tenantId"] = cpp.TenantID - } - if cpp.PrincipalType != "" { - objectMap["principalType"] = cpp.PrincipalType - } - return json.Marshal(objectMap) -} - -// 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: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - 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 - READ-ONLY; List of the cluster's language extensions. - LanguageExtensions *LanguageExtensionsList `json:"languageExtensions,omitempty"` - // EnableDoubleEncryption - A boolean value that indicates if double encryption is enabled. - EnableDoubleEncryption *bool `json:"enableDoubleEncryption,omitempty"` - // PublicNetworkAccess - Public network access to the cluster is enabled by default. When disabled, only private endpoint connection to the cluster is allowed. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' - PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // AllowedIPRangeList - The list of ips in the format of CIDR allowed to connect to the cluster. - AllowedIPRangeList *[]string `json:"allowedIpRangeList,omitempty"` - // EngineType - The engine type. Possible values include: 'EngineTypeV2', 'EngineTypeV3' - EngineType EngineType `json:"engineType,omitempty"` - // AcceptedAudiences - The cluster's accepted audiences. - AcceptedAudiences *[]AcceptedAudiences `json:"acceptedAudiences,omitempty"` - // EnableAutoStop - A boolean value that indicates if the cluster could be automatically stopped (due to lack of data or no activity for many days). - EnableAutoStop *bool `json:"enableAutoStop,omitempty"` - // RestrictOutboundNetworkAccess - Whether or not to restrict outbound network access. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: 'ClusterNetworkAccessFlagEnabled', 'ClusterNetworkAccessFlagDisabled' - RestrictOutboundNetworkAccess ClusterNetworkAccessFlag `json:"restrictOutboundNetworkAccess,omitempty"` - // AllowedFqdnList - List of allowed FQDNs(Fully Qualified Domain Name) for egress from Cluster. - AllowedFqdnList *[]string `json:"allowedFqdnList,omitempty"` - // PublicIPType - Indicates what public IP type to create - IPv4 (default), or DualStack (both IPv4 and IPv6). Possible values include: 'PublicIPTypeIPv4', 'PublicIPTypeDualStack' - PublicIPType PublicIPType `json:"publicIPType,omitempty"` - // VirtualClusterGraduationProperties - Virtual Cluster graduation properties - VirtualClusterGraduationProperties *string `json:"virtualClusterGraduationProperties,omitempty"` - // PrivateEndpointConnections - READ-ONLY; A list of private endpoint connections. - PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterProperties. -func (cp ClusterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.TrustedExternalTenants != nil { - objectMap["trustedExternalTenants"] = cp.TrustedExternalTenants - } - if cp.OptimizedAutoscale != nil { - objectMap["optimizedAutoscale"] = cp.OptimizedAutoscale - } - if cp.EnableDiskEncryption != nil { - objectMap["enableDiskEncryption"] = cp.EnableDiskEncryption - } - if cp.EnableStreamingIngest != nil { - objectMap["enableStreamingIngest"] = cp.EnableStreamingIngest - } - if cp.VirtualNetworkConfiguration != nil { - objectMap["virtualNetworkConfiguration"] = cp.VirtualNetworkConfiguration - } - if cp.KeyVaultProperties != nil { - objectMap["keyVaultProperties"] = cp.KeyVaultProperties - } - if cp.EnablePurge != nil { - objectMap["enablePurge"] = cp.EnablePurge - } - if cp.EnableDoubleEncryption != nil { - objectMap["enableDoubleEncryption"] = cp.EnableDoubleEncryption - } - if cp.PublicNetworkAccess != "" { - objectMap["publicNetworkAccess"] = cp.PublicNetworkAccess - } - if cp.AllowedIPRangeList != nil { - objectMap["allowedIpRangeList"] = cp.AllowedIPRangeList - } - if cp.EngineType != "" { - objectMap["engineType"] = cp.EngineType - } - if cp.AcceptedAudiences != nil { - objectMap["acceptedAudiences"] = cp.AcceptedAudiences - } - if cp.EnableAutoStop != nil { - objectMap["enableAutoStop"] = cp.EnableAutoStop - } - if cp.RestrictOutboundNetworkAccess != "" { - objectMap["restrictOutboundNetworkAccess"] = cp.RestrictOutboundNetworkAccess - } - if cp.AllowedFqdnList != nil { - objectMap["allowedFqdnList"] = cp.AllowedFqdnList - } - if cp.PublicIPType != "" { - objectMap["publicIPType"] = cp.PublicIPType - } - if cp.VirtualClusterGraduationProperties != nil { - objectMap["virtualClusterGraduationProperties"] = cp.VirtualClusterGraduationProperties - } - return json.Marshal(objectMap) -} - -// ClustersAddLanguageExtensionsFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ClustersAddLanguageExtensionsFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersAddLanguageExtensionsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersAddLanguageExtensionsFuture.Result. -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 { - ar.Response = future.Response() - 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.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (Cluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersCreateOrUpdateFuture.Result. -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 { - c.Response.Response = future.Response() - 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.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersDeleteFuture.Result. -func (future *ClustersDeleteFuture) 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.ClustersDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ClustersDetachFollowerDatabasesFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ClustersDetachFollowerDatabasesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersDetachFollowerDatabasesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersDetachFollowerDatabasesFuture.Result. -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 { - ar.Response = future.Response() - 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.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (DiagnoseVirtualNetworkResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersDiagnoseVirtualNetworkFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersDiagnoseVirtualNetworkFuture.Result. -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 { - dvnr.Response.Response = future.Response() - 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.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersRemoveLanguageExtensionsFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersRemoveLanguageExtensionsFuture.Result. -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 { - ar.Response = future.Response() - 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 { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersStartFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersStartFuture.Result. -func (future *ClustersStartFuture) 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.ClustersStartFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersStartFuture") - return - } - ar.Response = future.Response() - return -} - -// ClustersStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type ClustersStopFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersStopFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersStopFuture.Result. -func (future *ClustersStopFuture) 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.ClustersStopFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersStopFuture") - return - } - ar.Response = future.Response() - return -} - -// ClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ClustersUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ClustersClient) (Cluster, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ClustersUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ClustersUpdateFuture.Result. -func (future *ClustersUpdateFuture) 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.ClustersUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - c.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ClustersUpdateFuture") - 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.UpdateResponder(c.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ClustersUpdateFuture", "Result", c.Response.Response, "Failure responding to request") - } - } - return -} - -// ClusterUpdate class representing an update to a Kusto cluster. -type ClusterUpdate struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - Resource location. - 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} - 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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ClusterUpdate. -func (cu ClusterUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cu.Tags != nil { - objectMap["tags"] = cu.Tags - } - if cu.Location != nil { - objectMap["location"] = cu.Location - } - if cu.Sku != nil { - objectMap["sku"] = cu.Sku - } - if cu.Identity != nil { - objectMap["identity"] = cu.Identity - } - if cu.ClusterProperties != nil { - objectMap["properties"] = cu.ClusterProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ClusterUpdate struct. -func (cu *ClusterUpdate) 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 "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cu.Tags = tags - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cu.Location = &location - } - case "sku": - if v != nil { - var sku AzureSku - err = json.Unmarshal(*v, &sku) - if err != nil { - return err - } - 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 - err = json.Unmarshal(*v, &clusterProperties) - if err != nil { - return err - } - cu.ClusterProperties = &clusterProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cu.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cu.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cu.Type = &typeVar - } - } - } - - 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"` - // 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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - 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.Kind != "" { - objectMap["kind"] = d.Kind - } - return json.Marshal(objectMap) -} - -// 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 { - return err - } - for k, v := range m { - switch k { - case "value": - if v != nil { - value, err := unmarshalBasicDatabaseArray(*v) - if err != nil { - return err - } - 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: 'DatabasePrincipalRoleAdmin', 'DatabasePrincipalRoleIngestor', 'DatabasePrincipalRoleMonitor', 'DatabasePrincipalRoleUser', 'DatabasePrincipalRoleUnrestrictedViewer', 'DatabasePrincipalRoleViewer' - 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"` -} - -// MarshalJSON is the custom marshaler for DatabasePrincipal. -func (dp DatabasePrincipal) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dp.Role != "" { - objectMap["role"] = dp.Role - } - if dp.Name != nil { - objectMap["name"] = dp.Name - } - if dp.Type != "" { - objectMap["type"] = dp.Type - } - if dp.Fqn != nil { - objectMap["fqn"] = dp.Fqn - } - if dp.Email != nil { - objectMap["email"] = dp.Email - } - if dp.AppID != nil { - objectMap["appId"] = dp.AppID - } - return json.Marshal(objectMap) -} - -// 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. E.g. "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 databasePrincipalProperties DatabasePrincipalProperties - err = json.Unmarshal(*v, &databasePrincipalProperties) - if err != nil { - return err - } - dpa.DatabasePrincipalProperties = &databasePrincipalProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - dpa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - dpa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - dpa.Type = &typeVar - } - } - } - - return nil -} - -// 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/principalAssignments. - Type *string `json:"type,omitempty"` -} - -// DatabasePrincipalAssignmentListResult the list Kusto database principal assignments operation response. -type DatabasePrincipalAssignmentListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto database principal assignments. - Value *[]DatabasePrincipalAssignment `json:"value,omitempty"` -} - -// DatabasePrincipalAssignmentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type DatabasePrincipalAssignmentsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasePrincipalAssignmentsClient) (DatabasePrincipalAssignment, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasePrincipalAssignmentsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasePrincipalAssignmentsCreateOrUpdateFuture.Result. -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.DatabasePrincipalAssignmentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dpa.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DatabasePrincipalAssignmentsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - 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.DatabasePrincipalAssignmentsCreateOrUpdateFuture", "Result", dpa.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasePrincipalAssignmentsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DatabasePrincipalAssignmentsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasePrincipalAssignmentsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasePrincipalAssignmentsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasePrincipalAssignmentsDeleteFuture.Result. -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.DatabasePrincipalAssignmentsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DatabasePrincipalAssignmentsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// 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"` -} - -// 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: 'DatabasePrincipalRoleAdmin', 'DatabasePrincipalRoleIngestor', 'DatabasePrincipalRoleMonitor', 'DatabasePrincipalRoleUser', 'DatabasePrincipalRoleUnrestrictedViewer', 'DatabasePrincipalRoleViewer' - 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: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // AadObjectID - READ-ONLY; The service principal object id in AAD (Azure active directory) - AadObjectID *string `json:"aadObjectId,omitempty"` -} - -// MarshalJSON is the custom marshaler for DatabasePrincipalProperties. -func (dpp DatabasePrincipalProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if dpp.PrincipalID != nil { - objectMap["principalId"] = dpp.PrincipalID - } - if dpp.Role != "" { - objectMap["role"] = dpp.Role - } - if dpp.TenantID != nil { - objectMap["tenantId"] = dpp.TenantID - } - if dpp.PrincipalType != "" { - objectMap["principalType"] = dpp.PrincipalType - } - return json.Marshal(objectMap) -} - -// DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (DatabaseModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesCreateOrUpdateFuture.Result. -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.DatabasesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DatabasesCreateOrUpdateFuture") - 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.CreateOrUpdateResponder(dm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", dm.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabasesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesDeleteFuture.Result. -func (future *DatabasesDeleteFuture) result(client DatabasesClient) (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") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DatabasesDeleteFuture") - 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"` -} - -// DatabasesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DatabasesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DatabasesClient) (DatabaseModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DatabasesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DatabasesUpdateFuture.Result. -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 { - dm.Response.Response = future.Response() - 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. -type BasicDataConnection interface { - AsEventHubDataConnection() (*EventHubDataConnection, bool) - AsIotHubDataConnection() (*IotHubDataConnection, bool) - AsEventGridDataConnection() (*EventGridDataConnection, bool) - AsDataConnection() (*DataConnection, bool) -} - -// DataConnection class representing an data connection. -type DataConnection struct { - autorest.Response `json:"-"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindBasicDataConnectionKindDataConnection', 'KindBasicDataConnectionKindEventHub', 'KindBasicDataConnectionKindIotHub', 'KindBasicDataConnectionKindEventGrid' - 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 - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -func unmarshalBasicDataConnection(body []byte) (BasicDataConnection, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err - } - - switch m["kind"] { - case string(KindBasicDataConnectionKindEventHub): - var ehdc EventHubDataConnection - err := json.Unmarshal(body, &ehdc) - return ehdc, err - case string(KindBasicDataConnectionKindIotHub): - var ihdc IotHubDataConnection - err := json.Unmarshal(body, &ihdc) - return ihdc, err - case string(KindBasicDataConnectionKindEventGrid): - var egdc EventGridDataConnection - err := json.Unmarshal(body, &egdc) - return egdc, err - default: - var dc DataConnection - err := json.Unmarshal(body, &dc) - return dc, err - } -} -func unmarshalBasicDataConnectionArray(body []byte) ([]BasicDataConnection, error) { - var rawMessages []*json.RawMessage - err := json.Unmarshal(body, &rawMessages) - if err != nil { - return nil, err - } - - dcArray := make([]BasicDataConnection, len(rawMessages)) - - for index, rawMessage := range rawMessages { - dc, err := unmarshalBasicDataConnection(*rawMessage) - if err != nil { - return nil, err - } - dcArray[index] = dc - } - return dcArray, nil -} - -// MarshalJSON is the custom marshaler for DataConnection. -func (dc DataConnection) MarshalJSON() ([]byte, error) { - dc.Kind = KindBasicDataConnectionKindDataConnection - objectMap := make(map[string]interface{}) - if dc.Location != nil { - objectMap["location"] = dc.Location - } - if dc.Kind != "" { - objectMap["kind"] = dc.Kind - } - return json.Marshal(objectMap) -} - -// AsEventHubDataConnection is the BasicDataConnection implementation for DataConnection. -func (dc DataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { - return nil, false -} - -// AsIotHubDataConnection is the BasicDataConnection implementation for DataConnection. -func (dc DataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { - return nil, false -} - -// AsEventGridDataConnection is the BasicDataConnection implementation for DataConnection. -func (dc DataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { - return nil, false -} - -// AsDataConnection is the BasicDataConnection implementation for DataConnection. -func (dc DataConnection) AsDataConnection() (*DataConnection, bool) { - return &dc, true -} - -// AsBasicDataConnection is the BasicDataConnection implementation for DataConnection. -func (dc DataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { - return &dc, true -} - -// DataConnectionCheckNameRequest a data connection check name availability request. -type DataConnectionCheckNameRequest struct { - // Name - Data Connection name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, Microsoft.Kusto/clusters/databases/dataConnections. - Type *string `json:"type,omitempty"` -} - -// DataConnectionListResult the list Kusto data connections operation response. -type DataConnectionListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto data connections. - Value *[]BasicDataConnection `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DataConnectionListResult struct. -func (dclr *DataConnectionListResult) 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 "value": - if v != nil { - value, err := unmarshalBasicDataConnectionArray(*v) - if err != nil { - return err - } - dclr.Value = &value - } - } - } - - return nil -} - -// DataConnectionModel ... -type DataConnectionModel struct { - autorest.Response `json:"-"` - Value BasicDataConnection `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DataConnectionModel struct. -func (dcm *DataConnectionModel) UnmarshalJSON(body []byte) error { - dc, err := unmarshalBasicDataConnection(body) - if err != nil { - return err - } - dcm.Value = dc - - return nil -} - -// DataConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type DataConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DataConnectionsClient) (DataConnectionModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DataConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DataConnectionsCreateOrUpdateFuture.Result. -func (future *DataConnectionsCreateOrUpdateFuture) result(client DataConnectionsClient) (dcm DataConnectionModel, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dcm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dcm.Response.Response, err = future.GetResult(sender); err == nil && dcm.Response.Response.StatusCode != http.StatusNoContent { - dcm, err = client.CreateOrUpdateResponder(dcm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsCreateOrUpdateFuture", "Result", dcm.Response.Response, "Failure responding to request") - } - } - return -} - -// DataConnectionsDataConnectionValidationMethodFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type DataConnectionsDataConnectionValidationMethodFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DataConnectionsClient) (DataConnectionValidationListResult, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DataConnectionsDataConnectionValidationMethodFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DataConnectionsDataConnectionValidationMethodFuture.Result. -func (future *DataConnectionsDataConnectionValidationMethodFuture) result(client DataConnectionsClient) (dcvlr DataConnectionValidationListResult, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsDataConnectionValidationMethodFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dcvlr.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsDataConnectionValidationMethodFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dcvlr.Response.Response, err = future.GetResult(sender); err == nil && dcvlr.Response.Response.StatusCode != http.StatusNoContent { - dcvlr, err = client.DataConnectionValidationMethodResponder(dcvlr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsDataConnectionValidationMethodFuture", "Result", dcvlr.Response.Response, "Failure responding to request") - } - } - return -} - -// DataConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DataConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DataConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DataConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DataConnectionsDeleteFuture.Result. -func (future *DataConnectionsDeleteFuture) result(client DataConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// DataConnectionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type DataConnectionsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(DataConnectionsClient) (DataConnectionModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *DataConnectionsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for DataConnectionsUpdateFuture.Result. -func (future *DataConnectionsUpdateFuture) result(client DataConnectionsClient) (dcm DataConnectionModel, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - dcm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.DataConnectionsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if dcm.Response.Response, err = future.GetResult(sender); err == nil && dcm.Response.Response.StatusCode != http.StatusNoContent { - dcm, err = client.UpdateResponder(dcm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DataConnectionsUpdateFuture", "Result", dcm.Response.Response, "Failure responding to request") - } - } - return -} - -// DataConnectionValidation class representing an data connection validation. -type DataConnectionValidation struct { - // DataConnectionName - The name of the data connection. - DataConnectionName *string `json:"dataConnectionName,omitempty"` - // Properties - The data connection properties to validate. - Properties BasicDataConnection `json:"properties,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for DataConnectionValidation struct. -func (dcv *DataConnectionValidation) 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 "dataConnectionName": - if v != nil { - var dataConnectionName string - err = json.Unmarshal(*v, &dataConnectionName) - if err != nil { - return err - } - dcv.DataConnectionName = &dataConnectionName - } - case "properties": - if v != nil { - properties, err := unmarshalBasicDataConnection(*v) - if err != nil { - return err - } - dcv.Properties = properties - } - } - } - - return nil -} - -// DataConnectionValidationListResult the list Kusto data connection validation result. -type DataConnectionValidationListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto data connection validation errors. - Value *[]DataConnectionValidationResult `json:"value,omitempty"` -} - -// DataConnectionValidationResult the result returned from a data connection validation request. -type DataConnectionValidationResult struct { - // ErrorMessage - A message which indicates a problem in data connection validation. - 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"` -} - -// EndpointDependency a domain name that a service is reached at, including details of the current -// connection status. -type EndpointDependency struct { - // DomainName - The domain name of the dependency. - DomainName *string `json:"domainName,omitempty"` - // EndpointDetails - The ports used when connecting to DomainName. - EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` -} - -// EndpointDetail current TCP connectivity information from the Kusto cluster to a single endpoint. -type EndpointDetail struct { - // Port - The port an endpoint is connected to. - Port *int32 `json:"port,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. - StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` - // EventGridResourceID - The resource ID of the event grid that is subscribed to the storage account events. - EventGridResourceID *string `json:"eventGridResourceId,omitempty"` - // EventHubResourceID - The resource ID where the event grid is configured to send events. - EventHubResourceID *string `json:"eventHubResourceId,omitempty"` - // ConsumerGroup - The event hub consumer group. - ConsumerGroup *string `json:"consumerGroup,omitempty"` - // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. - 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: 'EventGridDataFormatMULTIJSON', 'EventGridDataFormatJSON', 'EventGridDataFormatCSV', 'EventGridDataFormatTSV', 'EventGridDataFormatSCSV', 'EventGridDataFormatSOHSV', 'EventGridDataFormatPSV', 'EventGridDataFormatTXT', 'EventGridDataFormatRAW', 'EventGridDataFormatSINGLEJSON', 'EventGridDataFormatAVRO', 'EventGridDataFormatTSVE', 'EventGridDataFormatPARQUET', 'EventGridDataFormatORC', 'EventGridDataFormatAPACHEAVRO', 'EventGridDataFormatW3CLOGFILE' - DataFormat EventGridDataFormat `json:"dataFormat,omitempty"` - // IgnoreFirstRecord - A Boolean value that, if set to true, indicates that ingestion should ignore the first record of every file - IgnoreFirstRecord *bool `json:"ignoreFirstRecord,omitempty"` - // BlobStorageEventType - The name of blob storage event type to process. Possible values include: 'BlobStorageEventTypeMicrosoftStorageBlobCreated', 'BlobStorageEventTypeMicrosoftStorageBlobRenamed' - BlobStorageEventType BlobStorageEventType `json:"blobStorageEventType,omitempty"` - // ManagedIdentityResourceID - The resource ID of a managed identity (system or user assigned) to be used to authenticate with event hub and storage account. - ManagedIdentityResourceID *string `json:"managedIdentityResourceId,omitempty"` - // ManagedIdentityObjectID - READ-ONLY; The object ID of managedIdentityResourceId - ManagedIdentityObjectID *string `json:"managedIdentityObjectId,omitempty"` - // DatabaseRouting - Indication for database routing information from the data connection, by default only database routing information is allowed. Possible values include: 'DatabaseRoutingSingle', 'DatabaseRoutingMulti' - DatabaseRouting DatabaseRouting `json:"databaseRouting,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventGridConnectionProperties. -func (egcp EventGridConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if egcp.StorageAccountResourceID != nil { - objectMap["storageAccountResourceId"] = egcp.StorageAccountResourceID - } - if egcp.EventGridResourceID != nil { - objectMap["eventGridResourceId"] = egcp.EventGridResourceID - } - if egcp.EventHubResourceID != nil { - objectMap["eventHubResourceId"] = egcp.EventHubResourceID - } - if egcp.ConsumerGroup != nil { - objectMap["consumerGroup"] = egcp.ConsumerGroup - } - if egcp.TableName != nil { - objectMap["tableName"] = egcp.TableName - } - if egcp.MappingRuleName != nil { - objectMap["mappingRuleName"] = egcp.MappingRuleName - } - if egcp.DataFormat != "" { - objectMap["dataFormat"] = egcp.DataFormat - } - if egcp.IgnoreFirstRecord != nil { - objectMap["ignoreFirstRecord"] = egcp.IgnoreFirstRecord - } - if egcp.BlobStorageEventType != "" { - objectMap["blobStorageEventType"] = egcp.BlobStorageEventType - } - if egcp.ManagedIdentityResourceID != nil { - objectMap["managedIdentityResourceId"] = egcp.ManagedIdentityResourceID - } - if egcp.DatabaseRouting != "" { - objectMap["databaseRouting"] = egcp.DatabaseRouting - } - return json.Marshal(objectMap) -} - -// EventGridDataConnection class representing an Event Grid data connection. -type EventGridDataConnection struct { - // EventGridConnectionProperties - The properties of the Event Grid data connection. - *EventGridConnectionProperties `json:"properties,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindBasicDataConnectionKindDataConnection', 'KindBasicDataConnectionKindEventHub', 'KindBasicDataConnectionKindIotHub', 'KindBasicDataConnectionKindEventGrid' - 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 - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventGridDataConnection. -func (egdc EventGridDataConnection) MarshalJSON() ([]byte, error) { - egdc.Kind = KindBasicDataConnectionKindEventGrid - objectMap := make(map[string]interface{}) - if egdc.EventGridConnectionProperties != nil { - objectMap["properties"] = egdc.EventGridConnectionProperties - } - if egdc.Location != nil { - objectMap["location"] = egdc.Location - } - if egdc.Kind != "" { - objectMap["kind"] = egdc.Kind - } - return json.Marshal(objectMap) -} - -// AsEventHubDataConnection is the BasicDataConnection implementation for EventGridDataConnection. -func (egdc EventGridDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { - return nil, false -} - -// AsIotHubDataConnection is the BasicDataConnection implementation for EventGridDataConnection. -func (egdc EventGridDataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { - return nil, false -} - -// AsEventGridDataConnection is the BasicDataConnection implementation for EventGridDataConnection. -func (egdc EventGridDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { - return &egdc, true -} - -// AsDataConnection is the BasicDataConnection implementation for EventGridDataConnection. -func (egdc EventGridDataConnection) AsDataConnection() (*DataConnection, bool) { - return nil, false -} - -// AsBasicDataConnection is the BasicDataConnection implementation for EventGridDataConnection. -func (egdc EventGridDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { - return &egdc, true -} - -// UnmarshalJSON is the custom unmarshaler for EventGridDataConnection struct. -func (egdc *EventGridDataConnection) 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 eventGridConnectionProperties EventGridConnectionProperties - err = json.Unmarshal(*v, &eventGridConnectionProperties) - if err != nil { - return err - } - egdc.EventGridConnectionProperties = &eventGridConnectionProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - egdc.Location = &location - } - case "kind": - if v != nil { - var kind KindBasicDataConnection - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - egdc.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - egdc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - egdc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - egdc.Type = &typeVar - } - } - } - - return nil -} - -// EventHubConnectionProperties class representing the Kusto event hub connection properties. -type EventHubConnectionProperties struct { - // EventHubResourceID - The resource ID of the event hub to be used to create a data connection. - EventHubResourceID *string `json:"eventHubResourceId,omitempty"` - // ConsumerGroup - The event hub consumer group. - ConsumerGroup *string `json:"consumerGroup,omitempty"` - // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. - 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: 'EventHubDataFormatMULTIJSON', 'EventHubDataFormatJSON', 'EventHubDataFormatCSV', 'EventHubDataFormatTSV', 'EventHubDataFormatSCSV', 'EventHubDataFormatSOHSV', 'EventHubDataFormatPSV', 'EventHubDataFormatTXT', 'EventHubDataFormatRAW', 'EventHubDataFormatSINGLEJSON', 'EventHubDataFormatAVRO', 'EventHubDataFormatTSVE', 'EventHubDataFormatPARQUET', 'EventHubDataFormatORC', 'EventHubDataFormatAPACHEAVRO', 'EventHubDataFormatW3CLOGFILE' - 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"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // ManagedIdentityResourceID - Empty for non-managed identity based data connection. For system assigned identity, provide cluster resource Id. For user assigned identity (UAI) provide the UAI resource Id. - ManagedIdentityResourceID *string `json:"managedIdentityResourceId,omitempty"` - // ManagedIdentityObjectID - READ-ONLY; The object ID of the managedIdentityResourceId - ManagedIdentityObjectID *string `json:"managedIdentityObjectId,omitempty"` - // DatabaseRouting - Indication for database routing information from the data connection, by default only database routing information is allowed. Possible values include: 'DatabaseRoutingSingle', 'DatabaseRoutingMulti' - DatabaseRouting DatabaseRouting `json:"databaseRouting,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHubConnectionProperties. -func (ehcp EventHubConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ehcp.EventHubResourceID != nil { - objectMap["eventHubResourceId"] = ehcp.EventHubResourceID - } - if ehcp.ConsumerGroup != nil { - objectMap["consumerGroup"] = ehcp.ConsumerGroup - } - if ehcp.TableName != nil { - objectMap["tableName"] = ehcp.TableName - } - if ehcp.MappingRuleName != nil { - objectMap["mappingRuleName"] = ehcp.MappingRuleName - } - if ehcp.DataFormat != "" { - objectMap["dataFormat"] = ehcp.DataFormat - } - if ehcp.EventSystemProperties != nil { - objectMap["eventSystemProperties"] = ehcp.EventSystemProperties - } - if ehcp.Compression != "" { - objectMap["compression"] = ehcp.Compression - } - if ehcp.ManagedIdentityResourceID != nil { - objectMap["managedIdentityResourceId"] = ehcp.ManagedIdentityResourceID - } - if ehcp.DatabaseRouting != "" { - objectMap["databaseRouting"] = ehcp.DatabaseRouting - } - return json.Marshal(objectMap) -} - -// EventHubDataConnection class representing an event hub data connection. -type EventHubDataConnection struct { - // EventHubConnectionProperties - The Event Hub data connection properties to validate. - *EventHubConnectionProperties `json:"properties,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindBasicDataConnectionKindDataConnection', 'KindBasicDataConnectionKindEventHub', 'KindBasicDataConnectionKindIotHub', 'KindBasicDataConnectionKindEventGrid' - 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 - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for EventHubDataConnection. -func (ehdc EventHubDataConnection) MarshalJSON() ([]byte, error) { - ehdc.Kind = KindBasicDataConnectionKindEventHub - objectMap := make(map[string]interface{}) - if ehdc.EventHubConnectionProperties != nil { - objectMap["properties"] = ehdc.EventHubConnectionProperties - } - if ehdc.Location != nil { - objectMap["location"] = ehdc.Location - } - if ehdc.Kind != "" { - objectMap["kind"] = ehdc.Kind - } - return json.Marshal(objectMap) -} - -// AsEventHubDataConnection is the BasicDataConnection implementation for EventHubDataConnection. -func (ehdc EventHubDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { - return &ehdc, true -} - -// AsIotHubDataConnection is the BasicDataConnection implementation for EventHubDataConnection. -func (ehdc EventHubDataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { - return nil, false -} - -// AsEventGridDataConnection is the BasicDataConnection implementation for EventHubDataConnection. -func (ehdc EventHubDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { - return nil, false -} - -// AsDataConnection is the BasicDataConnection implementation for EventHubDataConnection. -func (ehdc EventHubDataConnection) AsDataConnection() (*DataConnection, bool) { - return nil, false -} - -// AsBasicDataConnection is the BasicDataConnection implementation for EventHubDataConnection. -func (ehdc EventHubDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { - return &ehdc, true -} - -// UnmarshalJSON is the custom unmarshaler for EventHubDataConnection struct. -func (ehdc *EventHubDataConnection) 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 eventHubConnectionProperties EventHubConnectionProperties - err = json.Unmarshal(*v, &eventHubConnectionProperties) - if err != nil { - return err - } - ehdc.EventHubConnectionProperties = &eventHubConnectionProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ehdc.Location = &location - } - case "kind": - if v != nil { - var kind KindBasicDataConnection - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ehdc.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ehdc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ehdc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ehdc.Type = &typeVar - } - } - } - - return nil -} - -// 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"` -} - -// MarshalJSON is the custom marshaler for FollowerDatabaseDefinition. -func (fdd FollowerDatabaseDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if fdd.ClusterResourceID != nil { - objectMap["clusterResourceId"] = fdd.ClusterResourceID - } - if fdd.AttachedDatabaseConfigurationName != nil { - objectMap["attachedDatabaseConfigurationName"] = fdd.AttachedDatabaseConfigurationName - } - return json.Marshal(objectMap) -} - -// 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 type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove all identities. Possible values include: 'IdentityTypeNone', 'IdentityTypeSystemAssigned', 'IdentityTypeUserAssigned', 'IdentityTypeSystemAssignedUserAssigned' - 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"` -} - -// MarshalJSON is the custom marshaler for IdentityUserAssignedIdentitiesValue. -func (iAiv IdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// 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"` - // ConsumerGroup - The iot hub consumer group. - ConsumerGroup *string `json:"consumerGroup,omitempty"` - // TableName - The table where the data should be ingested. Optionally the table information can be added to each message. - 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: 'IotHubDataFormatMULTIJSON', 'IotHubDataFormatJSON', 'IotHubDataFormatCSV', 'IotHubDataFormatTSV', 'IotHubDataFormatSCSV', 'IotHubDataFormatSOHSV', 'IotHubDataFormatPSV', 'IotHubDataFormatTXT', 'IotHubDataFormatRAW', 'IotHubDataFormatSINGLEJSON', 'IotHubDataFormatAVRO', 'IotHubDataFormatTSVE', 'IotHubDataFormatPARQUET', 'IotHubDataFormatORC', 'IotHubDataFormatAPACHEAVRO', 'IotHubDataFormatW3CLOGFILE' - 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 - SharedAccessPolicyName *string `json:"sharedAccessPolicyName,omitempty"` - // DatabaseRouting - Indication for database routing information from the data connection, by default only database routing information is allowed. Possible values include: 'DatabaseRoutingSingle', 'DatabaseRoutingMulti' - DatabaseRouting DatabaseRouting `json:"databaseRouting,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for IotHubConnectionProperties. -func (ihcp IotHubConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ihcp.IotHubResourceID != nil { - objectMap["iotHubResourceId"] = ihcp.IotHubResourceID - } - if ihcp.ConsumerGroup != nil { - objectMap["consumerGroup"] = ihcp.ConsumerGroup - } - if ihcp.TableName != nil { - objectMap["tableName"] = ihcp.TableName - } - if ihcp.MappingRuleName != nil { - objectMap["mappingRuleName"] = ihcp.MappingRuleName - } - if ihcp.DataFormat != "" { - objectMap["dataFormat"] = ihcp.DataFormat - } - if ihcp.EventSystemProperties != nil { - objectMap["eventSystemProperties"] = ihcp.EventSystemProperties - } - if ihcp.SharedAccessPolicyName != nil { - objectMap["sharedAccessPolicyName"] = ihcp.SharedAccessPolicyName - } - if ihcp.DatabaseRouting != "" { - objectMap["databaseRouting"] = ihcp.DatabaseRouting - } - return json.Marshal(objectMap) -} - -// IotHubDataConnection class representing an iot hub data connection. -type IotHubDataConnection struct { - // IotHubConnectionProperties - The Iot Hub data connection properties. - *IotHubConnectionProperties `json:"properties,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindBasicDataConnectionKindDataConnection', 'KindBasicDataConnectionKindEventHub', 'KindBasicDataConnectionKindIotHub', 'KindBasicDataConnectionKindEventGrid' - 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 - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IotHubDataConnection. -func (ihdc IotHubDataConnection) MarshalJSON() ([]byte, error) { - ihdc.Kind = KindBasicDataConnectionKindIotHub - objectMap := make(map[string]interface{}) - if ihdc.IotHubConnectionProperties != nil { - objectMap["properties"] = ihdc.IotHubConnectionProperties - } - if ihdc.Location != nil { - objectMap["location"] = ihdc.Location - } - if ihdc.Kind != "" { - objectMap["kind"] = ihdc.Kind - } - return json.Marshal(objectMap) -} - -// AsEventHubDataConnection is the BasicDataConnection implementation for IotHubDataConnection. -func (ihdc IotHubDataConnection) AsEventHubDataConnection() (*EventHubDataConnection, bool) { - return nil, false -} - -// AsIotHubDataConnection is the BasicDataConnection implementation for IotHubDataConnection. -func (ihdc IotHubDataConnection) AsIotHubDataConnection() (*IotHubDataConnection, bool) { - return &ihdc, true -} - -// AsEventGridDataConnection is the BasicDataConnection implementation for IotHubDataConnection. -func (ihdc IotHubDataConnection) AsEventGridDataConnection() (*EventGridDataConnection, bool) { - return nil, false -} - -// AsDataConnection is the BasicDataConnection implementation for IotHubDataConnection. -func (ihdc IotHubDataConnection) AsDataConnection() (*DataConnection, bool) { - return nil, false -} - -// AsBasicDataConnection is the BasicDataConnection implementation for IotHubDataConnection. -func (ihdc IotHubDataConnection) AsBasicDataConnection() (BasicDataConnection, bool) { - return &ihdc, true -} - -// UnmarshalJSON is the custom unmarshaler for IotHubDataConnection struct. -func (ihdc *IotHubDataConnection) 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 iotHubConnectionProperties IotHubConnectionProperties - err = json.Unmarshal(*v, &iotHubConnectionProperties) - if err != nil { - return err - } - ihdc.IotHubConnectionProperties = &iotHubConnectionProperties - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ihdc.Location = &location - } - case "kind": - if v != nil { - var kind KindBasicDataConnection - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - ihdc.Kind = kind - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ihdc.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ihdc.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ihdc.Type = &typeVar - } - } - } - - 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"` - // UserIdentity - The user assigned identity (ARM resource id) that has access to the key. - UserIdentity *string `json:"userIdentity,omitempty"` -} - -// LanguageExtension the language extension object. -type LanguageExtension struct { - // LanguageExtensionName - The language extension name. Possible values include: 'LanguageExtensionNamePYTHON', 'LanguageExtensionNameR' - 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:"-"` - // Value - The collection of available SKUs for an existing resource. - Value *[]AzureResourceSku `json:"value,omitempty"` -} - -// ManagedPrivateEndpoint class representing a managed private endpoint. -type ManagedPrivateEndpoint struct { - autorest.Response `json:"-"` - // ManagedPrivateEndpointProperties - A managed private endpoint. - *ManagedPrivateEndpointProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedPrivateEndpoint. -func (mpe ManagedPrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mpe.ManagedPrivateEndpointProperties != nil { - objectMap["properties"] = mpe.ManagedPrivateEndpointProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ManagedPrivateEndpoint struct. -func (mpe *ManagedPrivateEndpoint) 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 managedPrivateEndpointProperties ManagedPrivateEndpointProperties - err = json.Unmarshal(*v, &managedPrivateEndpointProperties) - if err != nil { - return err - } - mpe.ManagedPrivateEndpointProperties = &managedPrivateEndpointProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - mpe.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mpe.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mpe.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mpe.Type = &typeVar - } - } - } - - return nil -} - -// ManagedPrivateEndpointListResult the list managed private endpoints operation response. -type ManagedPrivateEndpointListResult struct { - autorest.Response `json:"-"` - // Value - The list of managed private endpoints. - Value *[]ManagedPrivateEndpoint `json:"value,omitempty"` -} - -// ManagedPrivateEndpointProperties a class representing the properties of a managed private endpoint -// object. -type ManagedPrivateEndpointProperties struct { - // PrivateLinkResourceID - The ARM resource ID of the resource for which the managed private endpoint is created. - PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` - // PrivateLinkResourceRegion - The region of the resource to which the managed private endpoint is created. - PrivateLinkResourceRegion *string `json:"privateLinkResourceRegion,omitempty"` - // GroupID - The groupId in which the managed private endpoint is created. - GroupID *string `json:"groupId,omitempty"` - // RequestMessage - The user request message. - RequestMessage *string `json:"requestMessage,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ManagedPrivateEndpointProperties. -func (mpep ManagedPrivateEndpointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mpep.PrivateLinkResourceID != nil { - objectMap["privateLinkResourceId"] = mpep.PrivateLinkResourceID - } - if mpep.PrivateLinkResourceRegion != nil { - objectMap["privateLinkResourceRegion"] = mpep.PrivateLinkResourceRegion - } - if mpep.GroupID != nil { - objectMap["groupId"] = mpep.GroupID - } - if mpep.RequestMessage != nil { - objectMap["requestMessage"] = mpep.RequestMessage - } - return json.Marshal(objectMap) -} - -// ManagedPrivateEndpointsCheckNameRequest the result returned from a managedPrivateEndpoints check name -// availability request. -type ManagedPrivateEndpointsCheckNameRequest struct { - // Name - Managed private endpoint resource name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, for instance Microsoft.Kusto/clusters/managedPrivateEndpoints. - Type *string `json:"type,omitempty"` -} - -// ManagedPrivateEndpointsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of -// a long-running operation. -type ManagedPrivateEndpointsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedPrivateEndpointsClient) (ManagedPrivateEndpoint, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedPrivateEndpointsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedPrivateEndpointsCreateOrUpdateFuture.Result. -func (future *ManagedPrivateEndpointsCreateOrUpdateFuture) result(client ManagedPrivateEndpointsClient) (mpe ManagedPrivateEndpoint, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mpe.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ManagedPrivateEndpointsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mpe.Response.Response, err = future.GetResult(sender); err == nil && mpe.Response.Response.StatusCode != http.StatusNoContent { - mpe, err = client.CreateOrUpdateResponder(mpe.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsCreateOrUpdateFuture", "Result", mpe.Response.Response, "Failure responding to request") - } - } - return -} - -// ManagedPrivateEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedPrivateEndpointsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedPrivateEndpointsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedPrivateEndpointsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedPrivateEndpointsDeleteFuture.Result. -func (future *ManagedPrivateEndpointsDeleteFuture) result(client ManagedPrivateEndpointsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ManagedPrivateEndpointsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ManagedPrivateEndpointsUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ManagedPrivateEndpointsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ManagedPrivateEndpointsClient) (ManagedPrivateEndpoint, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ManagedPrivateEndpointsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ManagedPrivateEndpointsUpdateFuture.Result. -func (future *ManagedPrivateEndpointsUpdateFuture) result(client ManagedPrivateEndpointsClient) (mpe ManagedPrivateEndpoint, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - mpe.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ManagedPrivateEndpointsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if mpe.Response.Response, err = future.GetResult(sender); err == nil && mpe.Response.Response.StatusCode != http.StatusNoContent { - mpe, err = client.UpdateResponder(mpe.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ManagedPrivateEndpointsUpdateFuture", "Result", mpe.Response.Response, "Failure responding to request") - } - } - return -} - -// Operation ... -type Operation struct { - // Name - This is of the format {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty"` - Display *OperationDisplay `json:"display,omitempty"` - Origin *string `json:"origin,omitempty"` - Properties interface{} `json:"properties,omitempty"` -} - -// OperationDisplay ... -type OperationDisplay struct { - Provider *string `json:"provider,omitempty"` - // Operation - For example: read, write, delete. - Operation *string `json:"operation,omitempty"` - Resource *string `json:"resource,omitempty"` - Description *string `json:"description,omitempty"` -} - -// OperationListResult ... -type OperationListResult struct { - autorest.Response `json:"-"` - Value *[]Operation `json:"value,omitempty"` - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// OperationResult operation Result Entity. -type OperationResult struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; ID of the resource. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Name of the resource. - Name *string `json:"name,omitempty"` - // Status - status of the Operation result. Possible values include: 'StatusSucceeded', 'StatusCanceled', 'StatusFailed', 'StatusRunning' - Status Status `json:"status,omitempty"` - // StartTime - The operation start time - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - The operation end time - EndTime *date.Time `json:"endTime,omitempty"` - // PercentComplete - Percentage completed. - PercentComplete *float64 `json:"percentComplete,omitempty"` - // OperationResultProperties - Properties of the operation results - *OperationResultProperties `json:"properties,omitempty"` - // OperationResultErrorProperties - Object that contains the error code and message if the operation failed. - *OperationResultErrorProperties `json:"error,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationResult. -func (or OperationResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if or.Status != "" { - objectMap["status"] = or.Status - } - if or.StartTime != nil { - objectMap["startTime"] = or.StartTime - } - if or.EndTime != nil { - objectMap["endTime"] = or.EndTime - } - if or.PercentComplete != nil { - objectMap["percentComplete"] = or.PercentComplete - } - if or.OperationResultProperties != nil { - objectMap["properties"] = or.OperationResultProperties - } - if or.OperationResultErrorProperties != nil { - objectMap["error"] = or.OperationResultErrorProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OperationResult struct. -func (or *OperationResult) 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 "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - or.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - or.Name = &name - } - case "status": - if v != nil { - var status Status - err = json.Unmarshal(*v, &status) - if err != nil { - return err - } - or.Status = status - } - case "startTime": - if v != nil { - var startTime date.Time - err = json.Unmarshal(*v, &startTime) - if err != nil { - return err - } - or.StartTime = &startTime - } - case "endTime": - if v != nil { - var endTime date.Time - err = json.Unmarshal(*v, &endTime) - if err != nil { - return err - } - or.EndTime = &endTime - } - case "percentComplete": - if v != nil { - var percentComplete float64 - err = json.Unmarshal(*v, &percentComplete) - if err != nil { - return err - } - or.PercentComplete = &percentComplete - } - case "properties": - if v != nil { - var operationResultProperties OperationResultProperties - err = json.Unmarshal(*v, &operationResultProperties) - if err != nil { - return err - } - or.OperationResultProperties = &operationResultProperties - } - case "error": - if v != nil { - var operationResultErrorProperties OperationResultErrorProperties - err = json.Unmarshal(*v, &operationResultErrorProperties) - if err != nil { - return err - } - or.OperationResultErrorProperties = &operationResultErrorProperties - } - } - } - - return nil -} - -// OperationResultErrorProperties operation result error properties -type OperationResultErrorProperties struct { - // Code - The code of the error. - Code *string `json:"code,omitempty"` - // Message - The error message. - Message *string `json:"message,omitempty"` -} - -// OperationResultProperties operation result properties -type OperationResultProperties struct { - // OperationKind - The kind of the operation. - OperationKind *string `json:"operationKind,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // OperationState - The state of the operation. - OperationState *string `json:"operationState,omitempty"` -} - -// MarshalJSON is the custom marshaler for OperationResultProperties. -func (orp OperationResultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if orp.OperationKind != nil { - objectMap["operationKind"] = orp.OperationKind - } - if orp.OperationState != nil { - objectMap["operationState"] = orp.OperationState - } - return json.Marshal(objectMap) -} - -// OptimizedAutoscale a class that contains the optimized auto scale definition. -type OptimizedAutoscale struct { - // Version - The version of the template defined, for instance 1. - Version *int32 `json:"version,omitempty"` - // IsEnabled - A boolean value that indicate if the optimized autoscale feature is enabled or not. - IsEnabled *bool `json:"isEnabled,omitempty"` - // Minimum - Minimum allowed instances count. - Minimum *int32 `json:"minimum,omitempty"` - // Maximum - Maximum allowed instances count. - Maximum *int32 `json:"maximum,omitempty"` -} - -// OutboundNetworkDependenciesEndpoint endpoints accessed for a common purpose that the Kusto Service -// Environment requires outbound network access to. -type OutboundNetworkDependenciesEndpoint struct { - // OutboundNetworkDependenciesEndpointProperties - The outbound environment endpoint properties. - *OutboundNetworkDependenciesEndpointProperties `json:"properties,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundNetworkDependenciesEndpoint. -func (onde OutboundNetworkDependenciesEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if onde.OutboundNetworkDependenciesEndpointProperties != nil { - objectMap["properties"] = onde.OutboundNetworkDependenciesEndpointProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for OutboundNetworkDependenciesEndpoint struct. -func (onde *OutboundNetworkDependenciesEndpoint) 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 outboundNetworkDependenciesEndpointProperties OutboundNetworkDependenciesEndpointProperties - err = json.Unmarshal(*v, &outboundNetworkDependenciesEndpointProperties) - if err != nil { - return err - } - onde.OutboundNetworkDependenciesEndpointProperties = &outboundNetworkDependenciesEndpointProperties - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - onde.Etag = &etag - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - onde.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - onde.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - onde.Type = &typeVar - } - } - } - - return nil -} - -// OutboundNetworkDependenciesEndpointListResult collection of Outbound Environment Endpoints -type OutboundNetworkDependenciesEndpointListResult struct { - autorest.Response `json:"-"` - // Value - Collection of resources. - Value *[]OutboundNetworkDependenciesEndpoint `json:"value,omitempty"` - // NextLink - READ-ONLY; Link to next page of resources. - NextLink *string `json:"nextLink,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundNetworkDependenciesEndpointListResult. -func (ondelr OutboundNetworkDependenciesEndpointListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ondelr.Value != nil { - objectMap["value"] = ondelr.Value - } - return json.Marshal(objectMap) -} - -// OutboundNetworkDependenciesEndpointListResultIterator provides access to a complete listing of -// OutboundNetworkDependenciesEndpoint values. -type OutboundNetworkDependenciesEndpointListResultIterator struct { - i int - page OutboundNetworkDependenciesEndpointListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OutboundNetworkDependenciesEndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OutboundNetworkDependenciesEndpointListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OutboundNetworkDependenciesEndpointListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OutboundNetworkDependenciesEndpointListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OutboundNetworkDependenciesEndpointListResultIterator) Response() OutboundNetworkDependenciesEndpointListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OutboundNetworkDependenciesEndpointListResultIterator) Value() OutboundNetworkDependenciesEndpoint { - if !iter.page.NotDone() { - return OutboundNetworkDependenciesEndpoint{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OutboundNetworkDependenciesEndpointListResultIterator type. -func NewOutboundNetworkDependenciesEndpointListResultIterator(page OutboundNetworkDependenciesEndpointListResultPage) OutboundNetworkDependenciesEndpointListResultIterator { - return OutboundNetworkDependenciesEndpointListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (ondelr OutboundNetworkDependenciesEndpointListResult) IsEmpty() bool { - return ondelr.Value == nil || len(*ondelr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ondelr OutboundNetworkDependenciesEndpointListResult) hasNextLink() bool { - return ondelr.NextLink != nil && len(*ondelr.NextLink) != 0 -} - -// outboundNetworkDependenciesEndpointListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ondelr OutboundNetworkDependenciesEndpointListResult) outboundNetworkDependenciesEndpointListResultPreparer(ctx context.Context) (*http.Request, error) { - if !ondelr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ondelr.NextLink))) -} - -// OutboundNetworkDependenciesEndpointListResultPage contains a page of OutboundNetworkDependenciesEndpoint -// values. -type OutboundNetworkDependenciesEndpointListResultPage struct { - fn func(context.Context, OutboundNetworkDependenciesEndpointListResult) (OutboundNetworkDependenciesEndpointListResult, error) - ondelr OutboundNetworkDependenciesEndpointListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OutboundNetworkDependenciesEndpointListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OutboundNetworkDependenciesEndpointListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.ondelr) - if err != nil { - return err - } - page.ondelr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OutboundNetworkDependenciesEndpointListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OutboundNetworkDependenciesEndpointListResultPage) NotDone() bool { - return !page.ondelr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OutboundNetworkDependenciesEndpointListResultPage) Response() OutboundNetworkDependenciesEndpointListResult { - return page.ondelr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OutboundNetworkDependenciesEndpointListResultPage) Values() []OutboundNetworkDependenciesEndpoint { - if page.ondelr.IsEmpty() { - return nil - } - return *page.ondelr.Value -} - -// Creates a new instance of the OutboundNetworkDependenciesEndpointListResultPage type. -func NewOutboundNetworkDependenciesEndpointListResultPage(cur OutboundNetworkDependenciesEndpointListResult, getNextPage func(context.Context, OutboundNetworkDependenciesEndpointListResult) (OutboundNetworkDependenciesEndpointListResult, error)) OutboundNetworkDependenciesEndpointListResultPage { - return OutboundNetworkDependenciesEndpointListResultPage{ - fn: getNextPage, - ondelr: cur, - } -} - -// OutboundNetworkDependenciesEndpointProperties endpoints accessed for a common purpose that the Kusto -// Service Environment requires outbound network access to. -type OutboundNetworkDependenciesEndpointProperties struct { - // Category - The type of service accessed by the Kusto Service Environment, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory. - Category *string `json:"category,omitempty"` - // Endpoints - The endpoints that the Kusto Service Environment reaches the service at. - Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for OutboundNetworkDependenciesEndpointProperties. -func (ondep OutboundNetworkDependenciesEndpointProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ondep.Category != nil { - objectMap["category"] = ondep.Category - } - if ondep.Endpoints != nil { - objectMap["endpoints"] = ondep.Endpoints - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnection a private endpoint connection -type PrivateEndpointConnection struct { - autorest.Response `json:"-"` - // PrivateEndpointConnectionProperties - Resource properties. - *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnection. -func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pec.PrivateEndpointConnectionProperties != nil { - objectMap["properties"] = pec.PrivateEndpointConnectionProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. -func (pec *PrivateEndpointConnection) 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 privateEndpointConnectionProperties PrivateEndpointConnectionProperties - err = json.Unmarshal(*v, &privateEndpointConnectionProperties) - if err != nil { - return err - } - pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - pec.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - pec.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - pec.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - pec.Type = &typeVar - } - } - } - - return nil -} - -// PrivateEndpointConnectionListResult a list of private endpoint connections -type PrivateEndpointConnectionListResult struct { - autorest.Response `json:"-"` - // Value - Array of private endpoint connections - Value *[]PrivateEndpointConnection `json:"value,omitempty"` -} - -// PrivateEndpointConnectionProperties properties of a private endpoint connection. -type PrivateEndpointConnectionProperties struct { - // PrivateEndpoint - READ-ONLY; Private endpoint which the connection belongs to. - PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` - // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` - // GroupID - READ-ONLY; Group id of the private endpoint. - GroupID *string `json:"groupId,omitempty"` - // ProvisioningState - READ-ONLY; Provisioning state of the private endpoint. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. -func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pecp.PrivateLinkServiceConnectionState != nil { - objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState - } - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results -// of a long-running operation. -type PrivateEndpointConnectionsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. -func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - pec.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.PrivateEndpointConnectionsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { - pec, err = client.CreateOrUpdateResponder(pec.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") - } - } - return -} - -// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type PrivateEndpointConnectionsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. -func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.PrivateEndpointConnectionsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PrivateEndpointProperty private endpoint which the connection belongs to. -type PrivateEndpointProperty struct { - // ID - READ-ONLY; Resource id of the private endpoint. - ID *string `json:"id,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateEndpointProperty. -func (pep PrivateEndpointProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkResource a private link resource -type PrivateLinkResource struct { - autorest.Response `json:"-"` - // PrivateLinkResourceProperties - Resource properties. - *PrivateLinkResourceProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResource. -func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plr.PrivateLinkResourceProperties != nil { - objectMap["properties"] = plr.PrivateLinkResourceProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. -func (plr *PrivateLinkResource) 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 privateLinkResourceProperties PrivateLinkResourceProperties - err = json.Unmarshal(*v, &privateLinkResourceProperties) - if err != nil { - return err - } - plr.PrivateLinkResourceProperties = &privateLinkResourceProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - plr.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - plr.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - plr.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - plr.Type = &typeVar - } - } - } - - return nil -} - -// PrivateLinkResourceListResult a list of private link resources -type PrivateLinkResourceListResult struct { - autorest.Response `json:"-"` - // Value - Array of private link resources - Value *[]PrivateLinkResource `json:"value,omitempty"` -} - -// PrivateLinkResourceProperties properties of a private link resource. -type PrivateLinkResourceProperties struct { - // GroupID - READ-ONLY; The private link resource group id. - GroupID *string `json:"groupId,omitempty"` - // RequiredMembers - READ-ONLY; The private link resource required member names. - RequiredMembers *[]string `json:"requiredMembers,omitempty"` - // RequiredZoneNames - READ-ONLY; The private link resource required zone names. - RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. -func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. -type PrivateLinkServiceConnectionStateProperty struct { - // Status - The private link service connection status. - Status *string `json:"status,omitempty"` - // Description - The private link service connection description. - Description *string `json:"description,omitempty"` - // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) - ActionsRequired *string `json:"actionsRequired,omitempty"` -} - -// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. -func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if plscsp.Status != nil { - objectMap["status"] = plscsp.Status - } - if plscsp.Description != nil { - objectMap["description"] = plscsp.Description - } - return json.Marshal(objectMap) -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // 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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// 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. E.g. "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: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - 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 - READ-ONLY; 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"` -} - -// MarshalJSON is the custom marshaler for ReadOnlyFollowingDatabaseProperties. -func (rofdp ReadOnlyFollowingDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rofdp.HotCachePeriod != nil { - objectMap["hotCachePeriod"] = rofdp.HotCachePeriod - } - return json.Marshal(objectMap) -} - -// 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. E.g. "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: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - 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 - READ-ONLY; The statistics of the database. - Statistics *DatabaseStatistics `json:"statistics,omitempty"` - // IsFollowed - READ-ONLY; Indicates whether the database is followed. - IsFollowed *bool `json:"isFollowed,omitempty"` -} - -// MarshalJSON is the custom marshaler for ReadWriteDatabaseProperties. -func (rwdp ReadWriteDatabaseProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rwdp.SoftDeletePeriod != nil { - objectMap["softDeletePeriod"] = rwdp.SoftDeletePeriod - } - if rwdp.HotCachePeriod != nil { - objectMap["hotCachePeriod"] = rwdp.HotCachePeriod - } - return json.Marshal(objectMap) -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // 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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Script class representing a database script. -type Script struct { - autorest.Response `json:"-"` - // ScriptProperties - The database script. - *ScriptProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY - SystemData *SystemData `json:"systemData,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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Script. -func (s Script) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.ScriptProperties != nil { - objectMap["properties"] = s.ScriptProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Script struct. -func (s *Script) 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 scriptProperties ScriptProperties - err = json.Unmarshal(*v, &scriptProperties) - if err != nil { - return err - } - s.ScriptProperties = &scriptProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - s.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - } - } - - return nil -} - -// ScriptCheckNameRequest a script name availability request. -type ScriptCheckNameRequest struct { - // Name - Script name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, Microsoft.Kusto/clusters/databases/scripts. - Type *string `json:"type,omitempty"` -} - -// ScriptListResult the list Kusto database script operation response. -type ScriptListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto scripts. - Value *[]Script `json:"value,omitempty"` -} - -// ScriptProperties a class representing database script property. -type ScriptProperties struct { - // ScriptURL - The url to the KQL script blob file. Must not be used together with scriptContent property - ScriptURL *string `json:"scriptUrl,omitempty"` - // ScriptURLSasToken - The SaS token that provide read access to the file which contain the script. Must be provided when using scriptUrl property. - ScriptURLSasToken *string `json:"scriptUrlSasToken,omitempty"` - // ScriptContent - The script content. This property should be used when the script is provide inline and not through file in a SA. Must not be used together with scriptUrl and scriptUrlSasToken properties. - ScriptContent *string `json:"scriptContent,omitempty"` - // ForceUpdateTag - A unique string. If changed the script will be applied again. - ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` - // ContinueOnErrors - Flag that indicates whether to continue if one of the command fails. - ContinueOnErrors *bool `json:"continueOnErrors,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'ProvisioningStateRunning', 'ProvisioningStateCreating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for ScriptProperties. -func (sp ScriptProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.ScriptURL != nil { - objectMap["scriptUrl"] = sp.ScriptURL - } - if sp.ScriptURLSasToken != nil { - objectMap["scriptUrlSasToken"] = sp.ScriptURLSasToken - } - if sp.ScriptContent != nil { - objectMap["scriptContent"] = sp.ScriptContent - } - if sp.ForceUpdateTag != nil { - objectMap["forceUpdateTag"] = sp.ForceUpdateTag - } - if sp.ContinueOnErrors != nil { - objectMap["continueOnErrors"] = sp.ContinueOnErrors - } - return json.Marshal(objectMap) -} - -// ScriptsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScriptsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScriptsClient) (Script, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScriptsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ScriptsCreateOrUpdateFuture.Result. -func (future *ScriptsCreateOrUpdateFuture) result(client ScriptsClient) (s Script, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ScriptsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.CreateOrUpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// ScriptsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScriptsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScriptsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScriptsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ScriptsDeleteFuture.Result. -func (future *ScriptsDeleteFuture) result(client ScriptsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ScriptsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// ScriptsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ScriptsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(ScriptsClient) (Script, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *ScriptsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for ScriptsUpdateFuture.Result. -func (future *ScriptsUpdateFuture) result(client ScriptsClient) (s Script, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("kusto.ScriptsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.UpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// SkuDescription the Kusto SKU description of given resource type -type SkuDescription struct { - // ResourceType - READ-ONLY; The resource type - ResourceType *string `json:"resourceType,omitempty"` - // Name - READ-ONLY; The name of the SKU - Name *string `json:"name,omitempty"` - // Tier - READ-ONLY; The tier of the SKU - Tier *string `json:"tier,omitempty"` - // Locations - READ-ONLY; The set of locations that the SKU is available - Locations *[]string `json:"locations,omitempty"` - // LocationInfo - READ-ONLY; Locations and zones - LocationInfo *[]SkuLocationInfoItem `json:"locationInfo,omitempty"` - // Restrictions - READ-ONLY; The restrictions because of which SKU cannot be used - Restrictions *[]interface{} `json:"restrictions,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuDescription. -func (sd SkuDescription) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SkuDescriptionList the list of the EngagementFabric SKU descriptions -type SkuDescriptionList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; SKU descriptions - Value *[]SkuDescription `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for SkuDescriptionList. -func (sdl SkuDescriptionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SkuLocationInfoItem the locations and zones info for SKU. -type SkuLocationInfoItem struct { - // Location - The available location of the SKU. - Location *string `json:"location,omitempty"` - // Zones - The available zone of the SKU. - Zones *[]string `json:"zones,omitempty"` -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TableLevelSharingProperties tables that will be included and excluded in the follower database -type TableLevelSharingProperties struct { - // TablesToInclude - List of tables to include in the follower database - TablesToInclude *[]string `json:"tablesToInclude,omitempty"` - // TablesToExclude - List of tables to exclude from the follower database - TablesToExclude *[]string `json:"tablesToExclude,omitempty"` - // ExternalTablesToInclude - List of external tables to include in the follower database - ExternalTablesToInclude *[]string `json:"externalTablesToInclude,omitempty"` - // ExternalTablesToExclude - List of external tables exclude from the follower database - ExternalTablesToExclude *[]string `json:"externalTablesToExclude,omitempty"` - // MaterializedViewsToInclude - List of materialized views to include in the follower database - MaterializedViewsToInclude *[]string `json:"materializedViewsToInclude,omitempty"` - // MaterializedViewsToExclude - List of materialized views exclude from the follower database - MaterializedViewsToExclude *[]string `json:"materializedViewsToExclude,omitempty"` -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,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. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// TrustedExternalTenant represents a tenant ID that is trusted by the cluster. -type TrustedExternalTenant struct { - // Value - GUID representing an external tenant. - Value *string `json:"value,omitempty"` -} - -// VirtualNetworkConfiguration a class that contains virtual network definition. -type VirtualNetworkConfiguration struct { - // SubnetID - The subnet resource id. - SubnetID *string `json:"subnetId,omitempty"` - // EnginePublicIPID - Engine service's public IP address resource id. - EnginePublicIPID *string `json:"enginePublicIpId,omitempty"` - // DataManagementPublicIPID - Data management's service public IP address resource id. - DataManagementPublicIPID *string `json:"dataManagementPublicIpId,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operations.go deleted file mode 100644 index 5b278fc19145..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operations.go +++ /dev/null @@ -1,142 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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/tracing" - "net/http" -) - -// OperationsClient 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 OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient 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 NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists available operations for the Microsoft.Kusto provider. -func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.olr.Response.Response != nil { - sc = result.olr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.OperationsClient", "List", resp, "Failure sending request") - return - } - - result.olr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.OperationsClient", "List", resp, "Failure responding to request") - return - } - if result.olr.hasNextLink() && result.olr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Kusto/operations"), - 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 OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { - req, err := lastResults.operationListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "kusto.OperationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "kusto.OperationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.OperationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresults.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresults.go deleted file mode 100644 index 7c02aa4dfe59..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresults.go +++ /dev/null @@ -1,110 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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/tracing" - "net/http" -) - -// OperationsResultsClient 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 OperationsResultsClient struct { - BaseClient -} - -// NewOperationsResultsClient creates an instance of the OperationsResultsClient client. -func NewOperationsResultsClient(subscriptionID string) OperationsResultsClient { - return NewOperationsResultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsResultsClientWithBaseURI creates an instance of the OperationsResultsClient 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 NewOperationsResultsClientWithBaseURI(baseURI string, subscriptionID string) OperationsResultsClient { - return OperationsResultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get returns operation results. -// Parameters: -// location - azure location (region) name. -// operationID - the Guid of the operation ID -func (client OperationsResultsClient) Get(ctx context.Context, location string, operationID string) (result OperationResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsResultsClient.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, location, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.OperationsResultsClient", "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.OperationsResultsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.OperationsResultsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OperationsResultsClient) GetPreparer(ctx context.Context, location string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "operationId": autorest.Encode("path", operationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/operationResults/{operationId}", 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 OperationsResultsClient) 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 OperationsResultsClient) GetResponder(resp *http.Response) (result OperationResult, err error) { - err = autorest.Respond( - resp, - 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/2022-02-01/kusto/operationsresultslocation.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresultslocation.go deleted file mode 100644 index 5e116cbeb48b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/operationsresultslocation.go +++ /dev/null @@ -1,109 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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/tracing" - "net/http" -) - -// OperationsResultsLocationClient 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 OperationsResultsLocationClient struct { - BaseClient -} - -// NewOperationsResultsLocationClient creates an instance of the OperationsResultsLocationClient client. -func NewOperationsResultsLocationClient(subscriptionID string) OperationsResultsLocationClient { - return NewOperationsResultsLocationClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsResultsLocationClientWithBaseURI creates an instance of the OperationsResultsLocationClient 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 NewOperationsResultsLocationClientWithBaseURI(baseURI string, subscriptionID string) OperationsResultsLocationClient { - return OperationsResultsLocationClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get returns operation results. -// Parameters: -// location - azure location (region) name. -// operationID - the Guid of the operation ID -func (client OperationsResultsLocationClient) Get(ctx context.Context, location string, operationID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsResultsLocationClient.Get") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.GetPreparer(ctx, location, operationID) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.OperationsResultsLocationClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "kusto.OperationsResultsLocationClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.OperationsResultsLocationClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client OperationsResultsLocationClient) GetPreparer(ctx context.Context, location string, operationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "operationId": autorest.Encode("path", operationID), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/operationResults/{operationId}", 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 OperationsResultsLocationClient) 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 OperationsResultsLocationClient) GetResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privateendpointconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privateendpointconnections.go deleted file mode 100644 index 33f54414b236..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privateendpointconnections.go +++ /dev/null @@ -1,360 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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" -) - -// PrivateEndpointConnectionsClient 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 PrivateEndpointConnectionsClient struct { - BaseClient -} - -// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. -func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { - return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { - return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate approve or reject a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { - return result, validation.NewError("kusto.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - 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}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes a private endpoint connection with a given name. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a private endpoint connection. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// privateEndpointConnectionName - the name of the private endpoint connection. -func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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, privateEndpointConnectionName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "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.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns the list of private endpoint connections. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result PrivateEndpointConnectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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.PrivateEndpointConnectionsClient", "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.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateEndpointConnectionsClient) 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 = "2022-02-01" - 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}/privateEndpointConnections", 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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { - err = autorest.Respond( - resp, - 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/2022-02-01/kusto/privatelinkresources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privatelinkresources.go deleted file mode 100644 index d964b03a46c4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/privatelinkresources.go +++ /dev/null @@ -1,188 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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/tracing" - "net/http" -) - -// PrivateLinkResourcesClient 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 PrivateLinkResourcesClient struct { - BaseClient -} - -// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. -func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { - return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { - return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets a private link resource. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -// privateLinkResourceName - the name of the private link resource. -func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateLinkResourceName string) (result PrivateLinkResource, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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, privateLinkResourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "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.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, privateLinkResourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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}/privateLinkResources/{privateLinkResourceName}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result PrivateLinkResource, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List returns the list of private link resources. -// Parameters: -// resourceGroupName - the name of the resource group containing the Kusto cluster. -// clusterName - the name of the Kusto cluster. -func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, clusterName string) (result PrivateLinkResourceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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.PrivateLinkResourcesClient", "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.PrivateLinkResourcesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PrivateLinkResourcesClient) 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 = "2022-02-01" - 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}/privateLinkResources", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { - err = autorest.Respond( - resp, - 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/2022-02-01/kusto/scripts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/scripts.go deleted file mode 100644 index d9589145b4b7..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/scripts.go +++ /dev/null @@ -1,536 +0,0 @@ -package kusto - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// 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" -) - -// ScriptsClient 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 ScriptsClient struct { - BaseClient -} - -// NewScriptsClient creates an instance of the ScriptsClient client. -func NewScriptsClient(subscriptionID string) ScriptsClient { - return NewScriptsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewScriptsClientWithBaseURI creates an instance of the ScriptsClient 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 NewScriptsClientWithBaseURI(baseURI string, subscriptionID string) ScriptsClient { - return ScriptsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CheckNameAvailability checks that the script 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. -// databaseName - the name of the database in the Kusto cluster. -// scriptName - the name of the script. -func (client ScriptsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName ScriptCheckNameRequest) (result CheckNameResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScriptsClient.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: scriptName, - Constraints: []validation.Constraint{{Target: "scriptName.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "scriptName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("kusto.ScriptsClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, databaseName, scriptName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "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.ScriptsClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client ScriptsClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName ScriptCheckNameRequest) (*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 = "2022-02-01" - 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}/scriptsCheckNameAvailability", pathParameters), - autorest.WithJSON(scriptName), - 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 ScriptsClient) 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 ScriptsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CreateOrUpdate creates a Kusto database script. -// 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. -// scriptName - the name of the Kusto database script. -// parameters - the Kusto Script parameters contains the KQL to run. -func (client ScriptsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, parameters Script) (result ScriptsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScriptsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, scriptName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ScriptsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, parameters Script) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scriptName": autorest.Encode("path", scriptName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - 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}/scripts/{scriptName}", 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 ScriptsClient) CreateOrUpdateSender(req *http.Request) (future ScriptsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client ScriptsClient) CreateOrUpdateResponder(resp *http.Response) (result Script, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - 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. -// scriptName - the name of the Kusto database script. -func (client ScriptsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string) (result ScriptsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScriptsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, databaseName, scriptName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ScriptsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scriptName": autorest.Encode("path", scriptName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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}/scripts/{scriptName}", 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 ScriptsClient) DeleteSender(req *http.Request) (future ScriptsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client ScriptsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a Kusto cluster database script. -// 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. -// scriptName - the name of the Kusto database script. -func (client ScriptsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string) (result Script, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScriptsClient.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, scriptName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "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.ScriptsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ScriptsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scriptName": autorest.Encode("path", scriptName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - 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}/scripts/{scriptName}", 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 ScriptsClient) 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 ScriptsClient) GetResponder(resp *http.Response) (result Script, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByDatabase returns the list of database scripts for given database. -// 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 ScriptsClient) ListByDatabase(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result ScriptListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScriptsClient.ListByDatabase") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListByDatabasePreparer(ctx, resourceGroupName, clusterName, databaseName) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "ListByDatabase", nil, "Failure preparing request") - return - } - - resp, err := client.ListByDatabaseSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "ListByDatabase", resp, "Failure sending request") - return - } - - result, err = client.ListByDatabaseResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "ListByDatabase", resp, "Failure responding to request") - return - } - - return -} - -// ListByDatabasePreparer prepares the ListByDatabase request. -func (client ScriptsClient) ListByDatabasePreparer(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 = "2022-02-01" - 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}/scripts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByDatabaseSender sends the ListByDatabase request. The method will close the -// http.Response Body if it receives an error. -func (client ScriptsClient) ListByDatabaseSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByDatabaseResponder handles the response to the ListByDatabase request. The method always -// closes the http.Response Body. -func (client ScriptsClient) ListByDatabaseResponder(resp *http.Response) (result ScriptListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a database script. -// 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. -// scriptName - the name of the Kusto database script. -// parameters - the Kusto Script parameters contains to the KQL to run. -func (client ScriptsClient) Update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, parameters Script) (result ScriptsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ScriptsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterName, databaseName, scriptName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "kusto.ScriptsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ScriptsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, parameters Script) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "clusterName": autorest.Encode("path", clusterName), - "databaseName": autorest.Encode("path", databaseName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "scriptName": autorest.Encode("path", scriptName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2022-02-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - parameters.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ScriptsClient) UpdateSender(req *http.Request) (future ScriptsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ScriptsClient) UpdateResponder(resp *http.Response) (result Script, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - 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/2022-02-01/kusto/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/version.go deleted file mode 100644 index a436f90cb245..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package kusto - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " kusto/2022-02-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/README.md new file mode 100644 index 000000000000..8f38d74fcd92 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/README.md @@ -0,0 +1,102 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations` Documentation + +The `attacheddatabaseconfigurations` SDK allows for interaction with the Azure Resource Manager Service `kusto` (API Version `2022-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations" +``` + + +### Client Initialization + +```go +client := attacheddatabaseconfigurations.NewAttachedDatabaseConfigurationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AttachedDatabaseConfigurationsClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := attacheddatabaseconfigurations.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := attacheddatabaseconfigurations.AttachedDatabaseConfigurationsCheckNameRequest{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AttachedDatabaseConfigurationsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := attacheddatabaseconfigurations.NewAttachedDatabaseConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "attachedDatabaseConfigurationValue") + +payload := attacheddatabaseconfigurations.AttachedDatabaseConfiguration{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AttachedDatabaseConfigurationsClient.Delete` + +```go +ctx := context.TODO() +id := attacheddatabaseconfigurations.NewAttachedDatabaseConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "attachedDatabaseConfigurationValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AttachedDatabaseConfigurationsClient.Get` + +```go +ctx := context.TODO() +id := attacheddatabaseconfigurations.NewAttachedDatabaseConfigurationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "attachedDatabaseConfigurationValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AttachedDatabaseConfigurationsClient.ListByCluster` + +```go +ctx := context.TODO() +id := attacheddatabaseconfigurations.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.ListByCluster(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/client.go new file mode 100644 index 000000000000..60062fbe9c4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/client.go @@ -0,0 +1,18 @@ +package attacheddatabaseconfigurations + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttachedDatabaseConfigurationsClient struct { + Client autorest.Client + baseUri string +} + +func NewAttachedDatabaseConfigurationsClientWithBaseURI(endpoint string) AttachedDatabaseConfigurationsClient { + return AttachedDatabaseConfigurationsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/constants.go new file mode 100644 index 000000000000..d877a5cadf69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/constants.go @@ -0,0 +1,130 @@ +package attacheddatabaseconfigurations + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttachedDatabaseType string + +const ( + AttachedDatabaseTypeMicrosoftPointKustoClustersAttachedDatabaseConfigurations AttachedDatabaseType = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" +) + +func PossibleValuesForAttachedDatabaseType() []string { + return []string{ + string(AttachedDatabaseTypeMicrosoftPointKustoClustersAttachedDatabaseConfigurations), + } +} + +func parseAttachedDatabaseType(input string) (*AttachedDatabaseType, error) { + vals := map[string]AttachedDatabaseType{ + "microsoft.kusto/clusters/attacheddatabaseconfigurations": AttachedDatabaseTypeMicrosoftPointKustoClustersAttachedDatabaseConfigurations, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AttachedDatabaseType(input) + return &out, nil +} + +type DefaultPrincipalsModificationKind string + +const ( + DefaultPrincipalsModificationKindNone DefaultPrincipalsModificationKind = "None" + DefaultPrincipalsModificationKindReplace DefaultPrincipalsModificationKind = "Replace" + DefaultPrincipalsModificationKindUnion DefaultPrincipalsModificationKind = "Union" +) + +func PossibleValuesForDefaultPrincipalsModificationKind() []string { + return []string{ + string(DefaultPrincipalsModificationKindNone), + string(DefaultPrincipalsModificationKindReplace), + string(DefaultPrincipalsModificationKindUnion), + } +} + +func parseDefaultPrincipalsModificationKind(input string) (*DefaultPrincipalsModificationKind, error) { + vals := map[string]DefaultPrincipalsModificationKind{ + "none": DefaultPrincipalsModificationKindNone, + "replace": DefaultPrincipalsModificationKindReplace, + "union": DefaultPrincipalsModificationKindUnion, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DefaultPrincipalsModificationKind(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type Reason string + +const ( + ReasonAlreadyExists Reason = "AlreadyExists" + ReasonInvalid Reason = "Invalid" +) + +func PossibleValuesForReason() []string { + return []string{ + string(ReasonAlreadyExists), + string(ReasonInvalid), + } +} + +func parseReason(input string) (*Reason, error) { + vals := map[string]Reason{ + "alreadyexists": ReasonAlreadyExists, + "invalid": ReasonInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Reason(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/id_attacheddatabaseconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/id_attacheddatabaseconfiguration.go new file mode 100644 index 000000000000..ac0899013791 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/id_attacheddatabaseconfiguration.go @@ -0,0 +1,137 @@ +package attacheddatabaseconfigurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = AttachedDatabaseConfigurationId{} + +// AttachedDatabaseConfigurationId is a struct representing the Resource ID for a Attached Database Configuration +type AttachedDatabaseConfigurationId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + AttachedDatabaseConfigurationName string +} + +// NewAttachedDatabaseConfigurationID returns a new AttachedDatabaseConfigurationId struct +func NewAttachedDatabaseConfigurationID(subscriptionId string, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string) AttachedDatabaseConfigurationId { + return AttachedDatabaseConfigurationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + AttachedDatabaseConfigurationName: attachedDatabaseConfigurationName, + } +} + +// ParseAttachedDatabaseConfigurationID parses 'input' into a AttachedDatabaseConfigurationId +func ParseAttachedDatabaseConfigurationID(input string) (*AttachedDatabaseConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(AttachedDatabaseConfigurationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AttachedDatabaseConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.AttachedDatabaseConfigurationName, ok = parsed.Parsed["attachedDatabaseConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'attachedDatabaseConfigurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAttachedDatabaseConfigurationIDInsensitively parses 'input' case-insensitively into a AttachedDatabaseConfigurationId +// note: this method should only be used for API response data and not user input +func ParseAttachedDatabaseConfigurationIDInsensitively(input string) (*AttachedDatabaseConfigurationId, error) { + parser := resourceids.NewParserFromResourceIdType(AttachedDatabaseConfigurationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AttachedDatabaseConfigurationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.AttachedDatabaseConfigurationName, ok = parsed.Parsed["attachedDatabaseConfigurationName"]; !ok { + return nil, fmt.Errorf("the segment 'attachedDatabaseConfigurationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAttachedDatabaseConfigurationID checks that 'input' can be parsed as a Attached Database Configuration ID +func ValidateAttachedDatabaseConfigurationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAttachedDatabaseConfigurationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Attached Database Configuration ID +func (id AttachedDatabaseConfigurationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s/attachedDatabaseConfigurations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.AttachedDatabaseConfigurationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Attached Database Configuration ID +func (id AttachedDatabaseConfigurationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticAttachedDatabaseConfigurations", "attachedDatabaseConfigurations", "attachedDatabaseConfigurations"), + resourceids.UserSpecifiedSegment("attachedDatabaseConfigurationName", "attachedDatabaseConfigurationValue"), + } +} + +// String returns a human-readable description of this Attached Database Configuration ID +func (id AttachedDatabaseConfigurationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Attached Database Configuration Name: %q", id.AttachedDatabaseConfigurationName), + } + return fmt.Sprintf("Attached Database Configuration (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/id_cluster.go new file mode 100644 index 000000000000..961d936a813a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/id_cluster.go @@ -0,0 +1,124 @@ +package attacheddatabaseconfigurations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_checknameavailability_autorest.go new file mode 100644 index 000000000000..86109f857437 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package attacheddatabaseconfigurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c AttachedDatabaseConfigurationsClient) CheckNameAvailability(ctx context.Context, id ClusterId, input AttachedDatabaseConfigurationsCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c AttachedDatabaseConfigurationsClient) preparerForCheckNameAvailability(ctx context.Context, id ClusterId, input AttachedDatabaseConfigurationsCheckNameRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/attachedDatabaseConfigurationCheckNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c AttachedDatabaseConfigurationsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_createorupdate_autorest.go new file mode 100644 index 000000000000..ad625764008e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package attacheddatabaseconfigurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c AttachedDatabaseConfigurationsClient) CreateOrUpdate(ctx context.Context, id AttachedDatabaseConfigurationId, input AttachedDatabaseConfiguration) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c AttachedDatabaseConfigurationsClient) CreateOrUpdateThenPoll(ctx context.Context, id AttachedDatabaseConfigurationId, input AttachedDatabaseConfiguration) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c AttachedDatabaseConfigurationsClient) preparerForCreateOrUpdate(ctx context.Context, id AttachedDatabaseConfigurationId, input AttachedDatabaseConfiguration) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c AttachedDatabaseConfigurationsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_delete_autorest.go new file mode 100644 index 000000000000..554b338d451c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_delete_autorest.go @@ -0,0 +1,78 @@ +package attacheddatabaseconfigurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c AttachedDatabaseConfigurationsClient) Delete(ctx context.Context, id AttachedDatabaseConfigurationId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AttachedDatabaseConfigurationsClient) DeleteThenPoll(ctx context.Context, id AttachedDatabaseConfigurationId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c AttachedDatabaseConfigurationsClient) preparerForDelete(ctx context.Context, id AttachedDatabaseConfigurationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c AttachedDatabaseConfigurationsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_get_autorest.go new file mode 100644 index 000000000000..229079c049df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_get_autorest.go @@ -0,0 +1,68 @@ +package attacheddatabaseconfigurations + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *AttachedDatabaseConfiguration +} + +// Get ... +func (c AttachedDatabaseConfigurationsClient) Get(ctx context.Context, id AttachedDatabaseConfigurationId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c AttachedDatabaseConfigurationsClient) preparerForGet(ctx context.Context, id AttachedDatabaseConfigurationId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c AttachedDatabaseConfigurationsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_listbycluster_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_listbycluster_autorest.go new file mode 100644 index 000000000000..c116a66babc0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/method_listbycluster_autorest.go @@ -0,0 +1,69 @@ +package attacheddatabaseconfigurations + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByClusterOperationResponse struct { + HttpResponse *http.Response + Model *AttachedDatabaseConfigurationListResult +} + +// ListByCluster ... +func (c AttachedDatabaseConfigurationsClient) ListByCluster(ctx context.Context, id ClusterId) (result ListByClusterOperationResponse, err error) { + req, err := c.preparerForListByCluster(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "ListByCluster", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "ListByCluster", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByCluster(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "attacheddatabaseconfigurations.AttachedDatabaseConfigurationsClient", "ListByCluster", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByCluster prepares the ListByCluster request. +func (c AttachedDatabaseConfigurationsClient) preparerForListByCluster(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/attachedDatabaseConfigurations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByCluster handles the response to the ListByCluster request. The method always +// closes the http.Response Body. +func (c AttachedDatabaseConfigurationsClient) responderForListByCluster(resp *http.Response) (result ListByClusterOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfiguration.go new file mode 100644 index 000000000000..e08fd890d7b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfiguration.go @@ -0,0 +1,12 @@ +package attacheddatabaseconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttachedDatabaseConfiguration struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AttachedDatabaseConfigurationProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfigurationlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfigurationlistresult.go new file mode 100644 index 000000000000..2a426671eee2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfigurationlistresult.go @@ -0,0 +1,8 @@ +package attacheddatabaseconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttachedDatabaseConfigurationListResult struct { + Value *[]AttachedDatabaseConfiguration `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfigurationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfigurationproperties.go new file mode 100644 index 000000000000..7cac0caf0de1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfigurationproperties.go @@ -0,0 +1,13 @@ +package attacheddatabaseconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttachedDatabaseConfigurationProperties struct { + AttachedDatabaseNames *[]string `json:"attachedDatabaseNames,omitempty"` + ClusterResourceId string `json:"clusterResourceId"` + DatabaseName string `json:"databaseName"` + DefaultPrincipalsModificationKind DefaultPrincipalsModificationKind `json:"defaultPrincipalsModificationKind"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + TableLevelSharingProperties *TableLevelSharingProperties `json:"tableLevelSharingProperties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfigurationschecknamerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfigurationschecknamerequest.go new file mode 100644 index 000000000000..66a281fb3522 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_attacheddatabaseconfigurationschecknamerequest.go @@ -0,0 +1,9 @@ +package attacheddatabaseconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttachedDatabaseConfigurationsCheckNameRequest struct { + Name string `json:"name"` + Type AttachedDatabaseType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_checknameresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_checknameresult.go new file mode 100644 index 000000000000..7398e6a9f009 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_checknameresult.go @@ -0,0 +1,11 @@ +package attacheddatabaseconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameResult struct { + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *Reason `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_tablelevelsharingproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_tablelevelsharingproperties.go new file mode 100644 index 000000000000..8b5f8f85bdf2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/model_tablelevelsharingproperties.go @@ -0,0 +1,13 @@ +package attacheddatabaseconfigurations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TableLevelSharingProperties struct { + ExternalTablesToExclude *[]string `json:"externalTablesToExclude,omitempty"` + ExternalTablesToInclude *[]string `json:"externalTablesToInclude,omitempty"` + MaterializedViewsToExclude *[]string `json:"materializedViewsToExclude,omitempty"` + MaterializedViewsToInclude *[]string `json:"materializedViewsToInclude,omitempty"` + TablesToExclude *[]string `json:"tablesToExclude,omitempty"` + TablesToInclude *[]string `json:"tablesToInclude,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/version.go new file mode 100644 index 000000000000..a1f848f4da18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations/version.go @@ -0,0 +1,12 @@ +package attacheddatabaseconfigurations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/attacheddatabaseconfigurations/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/README.md new file mode 100644 index 000000000000..af30b0ef4286 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/README.md @@ -0,0 +1,102 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments` Documentation + +The `clusterprincipalassignments` SDK allows for interaction with the Azure Resource Manager Service `kusto` (API Version `2022-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments" +``` + + +### Client Initialization + +```go +client := clusterprincipalassignments.NewClusterPrincipalAssignmentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ClusterPrincipalAssignmentsClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := clusterprincipalassignments.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := clusterprincipalassignments.ClusterPrincipalAssignmentCheckNameRequest{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClusterPrincipalAssignmentsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := clusterprincipalassignments.NewPrincipalAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "principalAssignmentValue") + +payload := clusterprincipalassignments.ClusterPrincipalAssignment{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClusterPrincipalAssignmentsClient.Delete` + +```go +ctx := context.TODO() +id := clusterprincipalassignments.NewPrincipalAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "principalAssignmentValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClusterPrincipalAssignmentsClient.Get` + +```go +ctx := context.TODO() +id := clusterprincipalassignments.NewPrincipalAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "principalAssignmentValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClusterPrincipalAssignmentsClient.List` + +```go +ctx := context.TODO() +id := clusterprincipalassignments.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/client.go new file mode 100644 index 000000000000..6c90bacce61d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/client.go @@ -0,0 +1,18 @@ +package clusterprincipalassignments + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterPrincipalAssignmentsClient struct { + Client autorest.Client + baseUri string +} + +func NewClusterPrincipalAssignmentsClientWithBaseURI(endpoint string) ClusterPrincipalAssignmentsClient { + return ClusterPrincipalAssignmentsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/constants.go new file mode 100644 index 000000000000..17af46d8e9f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/constants.go @@ -0,0 +1,158 @@ +package clusterprincipalassignments + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterPrincipalRole string + +const ( + ClusterPrincipalRoleAllDatabasesAdmin ClusterPrincipalRole = "AllDatabasesAdmin" + ClusterPrincipalRoleAllDatabasesViewer ClusterPrincipalRole = "AllDatabasesViewer" +) + +func PossibleValuesForClusterPrincipalRole() []string { + return []string{ + string(ClusterPrincipalRoleAllDatabasesAdmin), + string(ClusterPrincipalRoleAllDatabasesViewer), + } +} + +func parseClusterPrincipalRole(input string) (*ClusterPrincipalRole, error) { + vals := map[string]ClusterPrincipalRole{ + "alldatabasesadmin": ClusterPrincipalRoleAllDatabasesAdmin, + "alldatabasesviewer": ClusterPrincipalRoleAllDatabasesViewer, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterPrincipalRole(input) + return &out, nil +} + +type PrincipalAssignmentType string + +const ( + PrincipalAssignmentTypeMicrosoftPointKustoClustersPrincipalAssignments PrincipalAssignmentType = "Microsoft.Kusto/clusters/principalAssignments" +) + +func PossibleValuesForPrincipalAssignmentType() []string { + return []string{ + string(PrincipalAssignmentTypeMicrosoftPointKustoClustersPrincipalAssignments), + } +} + +func parsePrincipalAssignmentType(input string) (*PrincipalAssignmentType, error) { + vals := map[string]PrincipalAssignmentType{ + "microsoft.kusto/clusters/principalassignments": PrincipalAssignmentTypeMicrosoftPointKustoClustersPrincipalAssignments, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrincipalAssignmentType(input) + return &out, nil +} + +type PrincipalType string + +const ( + PrincipalTypeApp PrincipalType = "App" + PrincipalTypeGroup PrincipalType = "Group" + PrincipalTypeUser PrincipalType = "User" +) + +func PossibleValuesForPrincipalType() []string { + return []string{ + string(PrincipalTypeApp), + string(PrincipalTypeGroup), + string(PrincipalTypeUser), + } +} + +func parsePrincipalType(input string) (*PrincipalType, error) { + vals := map[string]PrincipalType{ + "app": PrincipalTypeApp, + "group": PrincipalTypeGroup, + "user": PrincipalTypeUser, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrincipalType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type Reason string + +const ( + ReasonAlreadyExists Reason = "AlreadyExists" + ReasonInvalid Reason = "Invalid" +) + +func PossibleValuesForReason() []string { + return []string{ + string(ReasonAlreadyExists), + string(ReasonInvalid), + } +} + +func parseReason(input string) (*Reason, error) { + vals := map[string]Reason{ + "alreadyexists": ReasonAlreadyExists, + "invalid": ReasonInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Reason(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/id_cluster.go new file mode 100644 index 000000000000..efba98c69f5b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/id_cluster.go @@ -0,0 +1,124 @@ +package clusterprincipalassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/id_principalassignment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/id_principalassignment.go new file mode 100644 index 000000000000..054a67ee4fd9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/id_principalassignment.go @@ -0,0 +1,137 @@ +package clusterprincipalassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = PrincipalAssignmentId{} + +// PrincipalAssignmentId is a struct representing the Resource ID for a Principal Assignment +type PrincipalAssignmentId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + PrincipalAssignmentName string +} + +// NewPrincipalAssignmentID returns a new PrincipalAssignmentId struct +func NewPrincipalAssignmentID(subscriptionId string, resourceGroupName string, clusterName string, principalAssignmentName string) PrincipalAssignmentId { + return PrincipalAssignmentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + PrincipalAssignmentName: principalAssignmentName, + } +} + +// ParsePrincipalAssignmentID parses 'input' into a PrincipalAssignmentId +func ParsePrincipalAssignmentID(input string) (*PrincipalAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(PrincipalAssignmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrincipalAssignmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.PrincipalAssignmentName, ok = parsed.Parsed["principalAssignmentName"]; !ok { + return nil, fmt.Errorf("the segment 'principalAssignmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParsePrincipalAssignmentIDInsensitively parses 'input' case-insensitively into a PrincipalAssignmentId +// note: this method should only be used for API response data and not user input +func ParsePrincipalAssignmentIDInsensitively(input string) (*PrincipalAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(PrincipalAssignmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := PrincipalAssignmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.PrincipalAssignmentName, ok = parsed.Parsed["principalAssignmentName"]; !ok { + return nil, fmt.Errorf("the segment 'principalAssignmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidatePrincipalAssignmentID checks that 'input' can be parsed as a Principal Assignment ID +func ValidatePrincipalAssignmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePrincipalAssignmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Principal Assignment ID +func (id PrincipalAssignmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s/principalAssignments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.PrincipalAssignmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Principal Assignment ID +func (id PrincipalAssignmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticPrincipalAssignments", "principalAssignments", "principalAssignments"), + resourceids.UserSpecifiedSegment("principalAssignmentName", "principalAssignmentValue"), + } +} + +// String returns a human-readable description of this Principal Assignment ID +func (id PrincipalAssignmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Principal Assignment Name: %q", id.PrincipalAssignmentName), + } + return fmt.Sprintf("Principal Assignment (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_checknameavailability_autorest.go new file mode 100644 index 000000000000..bfd6f89bbe52 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package clusterprincipalassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c ClusterPrincipalAssignmentsClient) CheckNameAvailability(ctx context.Context, id ClusterId, input ClusterPrincipalAssignmentCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c ClusterPrincipalAssignmentsClient) preparerForCheckNameAvailability(ctx context.Context, id ClusterId, input ClusterPrincipalAssignmentCheckNameRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkPrincipalAssignmentNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c ClusterPrincipalAssignmentsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_createorupdate_autorest.go new file mode 100644 index 000000000000..2e03cfb69e06 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package clusterprincipalassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ClusterPrincipalAssignmentsClient) CreateOrUpdate(ctx context.Context, id PrincipalAssignmentId, input ClusterPrincipalAssignment) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ClusterPrincipalAssignmentsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrincipalAssignmentId, input ClusterPrincipalAssignment) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ClusterPrincipalAssignmentsClient) preparerForCreateOrUpdate(ctx context.Context, id PrincipalAssignmentId, input ClusterPrincipalAssignment) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ClusterPrincipalAssignmentsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_delete_autorest.go new file mode 100644 index 000000000000..276677a3b05d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_delete_autorest.go @@ -0,0 +1,78 @@ +package clusterprincipalassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ClusterPrincipalAssignmentsClient) Delete(ctx context.Context, id PrincipalAssignmentId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ClusterPrincipalAssignmentsClient) DeleteThenPoll(ctx context.Context, id PrincipalAssignmentId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ClusterPrincipalAssignmentsClient) preparerForDelete(ctx context.Context, id PrincipalAssignmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ClusterPrincipalAssignmentsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_get_autorest.go new file mode 100644 index 000000000000..1aa40590ce5b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_get_autorest.go @@ -0,0 +1,68 @@ +package clusterprincipalassignments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ClusterPrincipalAssignment +} + +// Get ... +func (c ClusterPrincipalAssignmentsClient) Get(ctx context.Context, id PrincipalAssignmentId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ClusterPrincipalAssignmentsClient) preparerForGet(ctx context.Context, id PrincipalAssignmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ClusterPrincipalAssignmentsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_list_autorest.go new file mode 100644 index 000000000000..102745eb598a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/method_list_autorest.go @@ -0,0 +1,69 @@ +package clusterprincipalassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ClusterPrincipalAssignmentListResult +} + +// List ... +func (c ClusterPrincipalAssignmentsClient) List(ctx context.Context, id ClusterId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusterprincipalassignments.ClusterPrincipalAssignmentsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ClusterPrincipalAssignmentsClient) preparerForList(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/principalAssignments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ClusterPrincipalAssignmentsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_checknameresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_checknameresult.go new file mode 100644 index 000000000000..49e899dfb6b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_checknameresult.go @@ -0,0 +1,11 @@ +package clusterprincipalassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameResult struct { + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *Reason `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalassignment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalassignment.go new file mode 100644 index 000000000000..6630e52de5e0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalassignment.go @@ -0,0 +1,11 @@ +package clusterprincipalassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterPrincipalAssignment struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ClusterPrincipalProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalassignmentchecknamerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalassignmentchecknamerequest.go new file mode 100644 index 000000000000..7c33df37d9ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalassignmentchecknamerequest.go @@ -0,0 +1,9 @@ +package clusterprincipalassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterPrincipalAssignmentCheckNameRequest struct { + Name string `json:"name"` + Type PrincipalAssignmentType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalassignmentlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalassignmentlistresult.go new file mode 100644 index 000000000000..32653049bbfe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalassignmentlistresult.go @@ -0,0 +1,8 @@ +package clusterprincipalassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterPrincipalAssignmentListResult struct { + Value *[]ClusterPrincipalAssignment `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalproperties.go new file mode 100644 index 000000000000..cd7e4eddc8e5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/model_clusterprincipalproperties.go @@ -0,0 +1,15 @@ +package clusterprincipalassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterPrincipalProperties struct { + AadObjectId *string `json:"aadObjectId,omitempty"` + PrincipalId string `json:"principalId"` + PrincipalName *string `json:"principalName,omitempty"` + PrincipalType PrincipalType `json:"principalType"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Role ClusterPrincipalRole `json:"role"` + TenantId *string `json:"tenantId,omitempty"` + TenantName *string `json:"tenantName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/version.go new file mode 100644 index 000000000000..dbae7e576853 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments/version.go @@ -0,0 +1,12 @@ +package clusterprincipalassignments + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/clusterprincipalassignments/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/README.md new file mode 100644 index 000000000000..00128fd1ce6f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/README.md @@ -0,0 +1,270 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters` Documentation + +The `clusters` SDK allows for interaction with the Azure Resource Manager Service `kusto` (API Version `2022-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters" +``` + + +### Client Initialization + +```go +client := clusters.NewClustersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ClustersClient.AddLanguageExtensions` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := clusters.LanguageExtensionsList{ + // ... +} + + +if err := client.AddLanguageExtensionsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClustersClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := clusters.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") + +payload := clusters.ClusterCheckNameRequest{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := clusters.Cluster{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, clusters.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClustersClient.Delete` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClustersClient.DetachFollowerDatabases` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := clusters.FollowerDatabaseDefinition{ + // ... +} + + +if err := client.DetachFollowerDatabasesThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClustersClient.DiagnoseVirtualNetwork` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +if err := client.DiagnoseVirtualNetworkThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClustersClient.Get` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.List` + +```go +ctx := context.TODO() +id := clusters.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := clusters.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.ListByResourceGroup(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.ListFollowerDatabases` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.ListFollowerDatabases(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.ListLanguageExtensions` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.ListLanguageExtensions(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.ListSkusByResource` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.ListSkusByResource(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ClustersClient.RemoveLanguageExtensions` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := clusters.LanguageExtensionsList{ + // ... +} + + +if err := client.RemoveLanguageExtensionsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClustersClient.Start` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +if err := client.StartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClustersClient.Stop` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +if err := client.StopThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ClustersClient.Update` + +```go +ctx := context.TODO() +id := clusters.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := clusters.ClusterUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, clusters.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/client.go new file mode 100644 index 000000000000..1e6fabf8cbaa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/client.go @@ -0,0 +1,18 @@ +package clusters + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClustersClient struct { + Client autorest.Client + baseUri string +} + +func NewClustersClientWithBaseURI(endpoint string) ClustersClient { + return ClustersClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/constants.go new file mode 100644 index 000000000000..45fdbd738fcf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/constants.go @@ -0,0 +1,501 @@ +package clusters + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureScaleType string + +const ( + AzureScaleTypeAutomatic AzureScaleType = "automatic" + AzureScaleTypeManual AzureScaleType = "manual" + AzureScaleTypeNone AzureScaleType = "none" +) + +func PossibleValuesForAzureScaleType() []string { + return []string{ + string(AzureScaleTypeAutomatic), + string(AzureScaleTypeManual), + string(AzureScaleTypeNone), + } +} + +func parseAzureScaleType(input string) (*AzureScaleType, error) { + vals := map[string]AzureScaleType{ + "automatic": AzureScaleTypeAutomatic, + "manual": AzureScaleTypeManual, + "none": AzureScaleTypeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureScaleType(input) + return &out, nil +} + +type AzureSkuName string + +const ( + AzureSkuNameDevNoSLAStandardDOneOneVTwo AzureSkuName = "Dev(No SLA)_Standard_D11_v2" + AzureSkuNameDevNoSLAStandardETwoaVFour AzureSkuName = "Dev(No SLA)_Standard_E2a_v4" + AzureSkuNameStandardDOneFourVTwo AzureSkuName = "Standard_D14_v2" + AzureSkuNameStandardDOneOneVTwo AzureSkuName = "Standard_D11_v2" + AzureSkuNameStandardDOneSixdVFive AzureSkuName = "Standard_D16d_v5" + AzureSkuNameStandardDOneThreeVTwo AzureSkuName = "Standard_D13_v2" + AzureSkuNameStandardDOneTwoVTwo AzureSkuName = "Standard_D12_v2" + AzureSkuNameStandardDSOneFourVTwoPositiveFourTBPS AzureSkuName = "Standard_DS14_v2+4TB_PS" + AzureSkuNameStandardDSOneFourVTwoPositiveThreeTBPS AzureSkuName = "Standard_DS14_v2+3TB_PS" + AzureSkuNameStandardDSOneThreeVTwoPositiveOneTBPS AzureSkuName = "Standard_DS13_v2+1TB_PS" + AzureSkuNameStandardDSOneThreeVTwoPositiveTwoTBPS AzureSkuName = "Standard_DS13_v2+2TB_PS" + AzureSkuNameStandardDThreeTwodVFive AzureSkuName = "Standard_D32d_v5" + AzureSkuNameStandardDThreeTwodVFour AzureSkuName = "Standard_D32d_v4" + AzureSkuNameStandardEEightZeroidsVFour AzureSkuName = "Standard_E80ids_v4" + AzureSkuNameStandardEEightaVFour AzureSkuName = "Standard_E8a_v4" + AzureSkuNameStandardEEightadsVFive AzureSkuName = "Standard_E8ads_v5" + AzureSkuNameStandardEEightasVFivePositiveOneTBPS AzureSkuName = "Standard_E8as_v5+1TB_PS" + AzureSkuNameStandardEEightasVFivePositiveTwoTBPS AzureSkuName = "Standard_E8as_v5+2TB_PS" + AzureSkuNameStandardEEightasVFourPositiveOneTBPS AzureSkuName = "Standard_E8as_v4+1TB_PS" + AzureSkuNameStandardEEightasVFourPositiveTwoTBPS AzureSkuName = "Standard_E8as_v4+2TB_PS" + AzureSkuNameStandardEEightsVFivePositiveOneTBPS AzureSkuName = "Standard_E8s_v5+1TB_PS" + AzureSkuNameStandardEEightsVFivePositiveTwoTBPS AzureSkuName = "Standard_E8s_v5+2TB_PS" + AzureSkuNameStandardEEightsVFourPositiveOneTBPS AzureSkuName = "Standard_E8s_v4+1TB_PS" + AzureSkuNameStandardEEightsVFourPositiveTwoTBPS AzureSkuName = "Standard_E8s_v4+2TB_PS" + AzureSkuNameStandardEFouraVFour AzureSkuName = "Standard_E4a_v4" + AzureSkuNameStandardEFouradsVFive AzureSkuName = "Standard_E4ads_v5" + AzureSkuNameStandardEOneSixaVFour AzureSkuName = "Standard_E16a_v4" + AzureSkuNameStandardEOneSixadsVFive AzureSkuName = "Standard_E16ads_v5" + AzureSkuNameStandardEOneSixasVFivePositiveFourTBPS AzureSkuName = "Standard_E16as_v5+4TB_PS" + AzureSkuNameStandardEOneSixasVFivePositiveThreeTBPS AzureSkuName = "Standard_E16as_v5+3TB_PS" + AzureSkuNameStandardEOneSixasVFourPositiveFourTBPS AzureSkuName = "Standard_E16as_v4+4TB_PS" + AzureSkuNameStandardEOneSixasVFourPositiveThreeTBPS AzureSkuName = "Standard_E16as_v4+3TB_PS" + AzureSkuNameStandardEOneSixsVFivePositiveFourTBPS AzureSkuName = "Standard_E16s_v5+4TB_PS" + AzureSkuNameStandardEOneSixsVFivePositiveThreeTBPS AzureSkuName = "Standard_E16s_v5+3TB_PS" + AzureSkuNameStandardEOneSixsVFourPositiveFourTBPS AzureSkuName = "Standard_E16s_v4+4TB_PS" + AzureSkuNameStandardEOneSixsVFourPositiveThreeTBPS AzureSkuName = "Standard_E16s_v4+3TB_PS" + AzureSkuNameStandardESixFouriVThree AzureSkuName = "Standard_E64i_v3" + AzureSkuNameStandardETwoaVFour AzureSkuName = "Standard_E2a_v4" + AzureSkuNameStandardETwoadsVFive AzureSkuName = "Standard_E2ads_v5" + AzureSkuNameStandardLEights AzureSkuName = "Standard_L8s" + AzureSkuNameStandardLEightsVTwo AzureSkuName = "Standard_L8s_v2" + AzureSkuNameStandardLFours AzureSkuName = "Standard_L4s" + AzureSkuNameStandardLOneSixs AzureSkuName = "Standard_L16s" + AzureSkuNameStandardLOneSixsVTwo AzureSkuName = "Standard_L16s_v2" +) + +func PossibleValuesForAzureSkuName() []string { + return []string{ + string(AzureSkuNameDevNoSLAStandardDOneOneVTwo), + string(AzureSkuNameDevNoSLAStandardETwoaVFour), + string(AzureSkuNameStandardDOneFourVTwo), + string(AzureSkuNameStandardDOneOneVTwo), + string(AzureSkuNameStandardDOneSixdVFive), + string(AzureSkuNameStandardDOneThreeVTwo), + string(AzureSkuNameStandardDOneTwoVTwo), + string(AzureSkuNameStandardDSOneFourVTwoPositiveFourTBPS), + string(AzureSkuNameStandardDSOneFourVTwoPositiveThreeTBPS), + string(AzureSkuNameStandardDSOneThreeVTwoPositiveOneTBPS), + string(AzureSkuNameStandardDSOneThreeVTwoPositiveTwoTBPS), + string(AzureSkuNameStandardDThreeTwodVFive), + string(AzureSkuNameStandardDThreeTwodVFour), + string(AzureSkuNameStandardEEightZeroidsVFour), + string(AzureSkuNameStandardEEightaVFour), + string(AzureSkuNameStandardEEightadsVFive), + string(AzureSkuNameStandardEEightasVFivePositiveOneTBPS), + string(AzureSkuNameStandardEEightasVFivePositiveTwoTBPS), + string(AzureSkuNameStandardEEightasVFourPositiveOneTBPS), + string(AzureSkuNameStandardEEightasVFourPositiveTwoTBPS), + string(AzureSkuNameStandardEEightsVFivePositiveOneTBPS), + string(AzureSkuNameStandardEEightsVFivePositiveTwoTBPS), + string(AzureSkuNameStandardEEightsVFourPositiveOneTBPS), + string(AzureSkuNameStandardEEightsVFourPositiveTwoTBPS), + string(AzureSkuNameStandardEFouraVFour), + string(AzureSkuNameStandardEFouradsVFive), + string(AzureSkuNameStandardEOneSixaVFour), + string(AzureSkuNameStandardEOneSixadsVFive), + string(AzureSkuNameStandardEOneSixasVFivePositiveFourTBPS), + string(AzureSkuNameStandardEOneSixasVFivePositiveThreeTBPS), + string(AzureSkuNameStandardEOneSixasVFourPositiveFourTBPS), + string(AzureSkuNameStandardEOneSixasVFourPositiveThreeTBPS), + string(AzureSkuNameStandardEOneSixsVFivePositiveFourTBPS), + string(AzureSkuNameStandardEOneSixsVFivePositiveThreeTBPS), + string(AzureSkuNameStandardEOneSixsVFourPositiveFourTBPS), + string(AzureSkuNameStandardEOneSixsVFourPositiveThreeTBPS), + string(AzureSkuNameStandardESixFouriVThree), + string(AzureSkuNameStandardETwoaVFour), + string(AzureSkuNameStandardETwoadsVFive), + string(AzureSkuNameStandardLEights), + string(AzureSkuNameStandardLEightsVTwo), + string(AzureSkuNameStandardLFours), + string(AzureSkuNameStandardLOneSixs), + string(AzureSkuNameStandardLOneSixsVTwo), + } +} + +func parseAzureSkuName(input string) (*AzureSkuName, error) { + vals := map[string]AzureSkuName{ + "dev(no sla)_standard_d11_v2": AzureSkuNameDevNoSLAStandardDOneOneVTwo, + "dev(no sla)_standard_e2a_v4": AzureSkuNameDevNoSLAStandardETwoaVFour, + "standard_d14_v2": AzureSkuNameStandardDOneFourVTwo, + "standard_d11_v2": AzureSkuNameStandardDOneOneVTwo, + "standard_d16d_v5": AzureSkuNameStandardDOneSixdVFive, + "standard_d13_v2": AzureSkuNameStandardDOneThreeVTwo, + "standard_d12_v2": AzureSkuNameStandardDOneTwoVTwo, + "standard_ds14_v2+4tb_ps": AzureSkuNameStandardDSOneFourVTwoPositiveFourTBPS, + "standard_ds14_v2+3tb_ps": AzureSkuNameStandardDSOneFourVTwoPositiveThreeTBPS, + "standard_ds13_v2+1tb_ps": AzureSkuNameStandardDSOneThreeVTwoPositiveOneTBPS, + "standard_ds13_v2+2tb_ps": AzureSkuNameStandardDSOneThreeVTwoPositiveTwoTBPS, + "standard_d32d_v5": AzureSkuNameStandardDThreeTwodVFive, + "standard_d32d_v4": AzureSkuNameStandardDThreeTwodVFour, + "standard_e80ids_v4": AzureSkuNameStandardEEightZeroidsVFour, + "standard_e8a_v4": AzureSkuNameStandardEEightaVFour, + "standard_e8ads_v5": AzureSkuNameStandardEEightadsVFive, + "standard_e8as_v5+1tb_ps": AzureSkuNameStandardEEightasVFivePositiveOneTBPS, + "standard_e8as_v5+2tb_ps": AzureSkuNameStandardEEightasVFivePositiveTwoTBPS, + "standard_e8as_v4+1tb_ps": AzureSkuNameStandardEEightasVFourPositiveOneTBPS, + "standard_e8as_v4+2tb_ps": AzureSkuNameStandardEEightasVFourPositiveTwoTBPS, + "standard_e8s_v5+1tb_ps": AzureSkuNameStandardEEightsVFivePositiveOneTBPS, + "standard_e8s_v5+2tb_ps": AzureSkuNameStandardEEightsVFivePositiveTwoTBPS, + "standard_e8s_v4+1tb_ps": AzureSkuNameStandardEEightsVFourPositiveOneTBPS, + "standard_e8s_v4+2tb_ps": AzureSkuNameStandardEEightsVFourPositiveTwoTBPS, + "standard_e4a_v4": AzureSkuNameStandardEFouraVFour, + "standard_e4ads_v5": AzureSkuNameStandardEFouradsVFive, + "standard_e16a_v4": AzureSkuNameStandardEOneSixaVFour, + "standard_e16ads_v5": AzureSkuNameStandardEOneSixadsVFive, + "standard_e16as_v5+4tb_ps": AzureSkuNameStandardEOneSixasVFivePositiveFourTBPS, + "standard_e16as_v5+3tb_ps": AzureSkuNameStandardEOneSixasVFivePositiveThreeTBPS, + "standard_e16as_v4+4tb_ps": AzureSkuNameStandardEOneSixasVFourPositiveFourTBPS, + "standard_e16as_v4+3tb_ps": AzureSkuNameStandardEOneSixasVFourPositiveThreeTBPS, + "standard_e16s_v5+4tb_ps": AzureSkuNameStandardEOneSixsVFivePositiveFourTBPS, + "standard_e16s_v5+3tb_ps": AzureSkuNameStandardEOneSixsVFivePositiveThreeTBPS, + "standard_e16s_v4+4tb_ps": AzureSkuNameStandardEOneSixsVFourPositiveFourTBPS, + "standard_e16s_v4+3tb_ps": AzureSkuNameStandardEOneSixsVFourPositiveThreeTBPS, + "standard_e64i_v3": AzureSkuNameStandardESixFouriVThree, + "standard_e2a_v4": AzureSkuNameStandardETwoaVFour, + "standard_e2ads_v5": AzureSkuNameStandardETwoadsVFive, + "standard_l8s": AzureSkuNameStandardLEights, + "standard_l8s_v2": AzureSkuNameStandardLEightsVTwo, + "standard_l4s": AzureSkuNameStandardLFours, + "standard_l16s": AzureSkuNameStandardLOneSixs, + "standard_l16s_v2": AzureSkuNameStandardLOneSixsVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureSkuName(input) + return &out, nil +} + +type AzureSkuTier string + +const ( + AzureSkuTierBasic AzureSkuTier = "Basic" + AzureSkuTierStandard AzureSkuTier = "Standard" +) + +func PossibleValuesForAzureSkuTier() []string { + return []string{ + string(AzureSkuTierBasic), + string(AzureSkuTierStandard), + } +} + +func parseAzureSkuTier(input string) (*AzureSkuTier, error) { + vals := map[string]AzureSkuTier{ + "basic": AzureSkuTierBasic, + "standard": AzureSkuTierStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureSkuTier(input) + return &out, nil +} + +type ClusterNetworkAccessFlag string + +const ( + ClusterNetworkAccessFlagDisabled ClusterNetworkAccessFlag = "Disabled" + ClusterNetworkAccessFlagEnabled ClusterNetworkAccessFlag = "Enabled" +) + +func PossibleValuesForClusterNetworkAccessFlag() []string { + return []string{ + string(ClusterNetworkAccessFlagDisabled), + string(ClusterNetworkAccessFlagEnabled), + } +} + +func parseClusterNetworkAccessFlag(input string) (*ClusterNetworkAccessFlag, error) { + vals := map[string]ClusterNetworkAccessFlag{ + "disabled": ClusterNetworkAccessFlagDisabled, + "enabled": ClusterNetworkAccessFlagEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterNetworkAccessFlag(input) + return &out, nil +} + +type ClusterType string + +const ( + ClusterTypeMicrosoftPointKustoClusters ClusterType = "Microsoft.Kusto/clusters" +) + +func PossibleValuesForClusterType() []string { + return []string{ + string(ClusterTypeMicrosoftPointKustoClusters), + } +} + +func parseClusterType(input string) (*ClusterType, error) { + vals := map[string]ClusterType{ + "microsoft.kusto/clusters": ClusterTypeMicrosoftPointKustoClusters, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusterType(input) + return &out, nil +} + +type EngineType string + +const ( + EngineTypeVThree EngineType = "V3" + EngineTypeVTwo EngineType = "V2" +) + +func PossibleValuesForEngineType() []string { + return []string{ + string(EngineTypeVThree), + string(EngineTypeVTwo), + } +} + +func parseEngineType(input string) (*EngineType, error) { + vals := map[string]EngineType{ + "v3": EngineTypeVThree, + "v2": EngineTypeVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EngineType(input) + return &out, nil +} + +type LanguageExtensionName string + +const ( + LanguageExtensionNamePYTHON LanguageExtensionName = "PYTHON" + LanguageExtensionNameR LanguageExtensionName = "R" +) + +func PossibleValuesForLanguageExtensionName() []string { + return []string{ + string(LanguageExtensionNamePYTHON), + string(LanguageExtensionNameR), + } +} + +func parseLanguageExtensionName(input string) (*LanguageExtensionName, error) { + vals := map[string]LanguageExtensionName{ + "python": LanguageExtensionNamePYTHON, + "r": LanguageExtensionNameR, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LanguageExtensionName(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicIPType string + +const ( + PublicIPTypeDualStack PublicIPType = "DualStack" + PublicIPTypeIPvFour PublicIPType = "IPv4" +) + +func PossibleValuesForPublicIPType() []string { + return []string{ + string(PublicIPTypeDualStack), + string(PublicIPTypeIPvFour), + } +} + +func parsePublicIPType(input string) (*PublicIPType, error) { + vals := map[string]PublicIPType{ + "dualstack": PublicIPTypeDualStack, + "ipv4": PublicIPTypeIPvFour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPType(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type Reason string + +const ( + ReasonAlreadyExists Reason = "AlreadyExists" + ReasonInvalid Reason = "Invalid" +) + +func PossibleValuesForReason() []string { + return []string{ + string(ReasonAlreadyExists), + string(ReasonInvalid), + } +} + +func parseReason(input string) (*Reason, error) { + vals := map[string]Reason{ + "alreadyexists": ReasonAlreadyExists, + "invalid": ReasonInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Reason(input) + return &out, nil +} + +type State string + +const ( + StateCreating State = "Creating" + StateDeleted State = "Deleted" + StateDeleting State = "Deleting" + StateRunning State = "Running" + StateStarting State = "Starting" + StateStopped State = "Stopped" + StateStopping State = "Stopping" + StateUnavailable State = "Unavailable" + StateUpdating State = "Updating" +) + +func PossibleValuesForState() []string { + return []string{ + string(StateCreating), + string(StateDeleted), + string(StateDeleting), + string(StateRunning), + string(StateStarting), + string(StateStopped), + string(StateStopping), + string(StateUnavailable), + string(StateUpdating), + } +} + +func parseState(input string) (*State, error) { + vals := map[string]State{ + "creating": StateCreating, + "deleted": StateDeleted, + "deleting": StateDeleting, + "running": StateRunning, + "starting": StateStarting, + "stopped": StateStopped, + "stopping": StateStopping, + "unavailable": StateUnavailable, + "updating": StateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := State(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/id_cluster.go new file mode 100644 index 000000000000..a9a6f407351c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/id_cluster.go @@ -0,0 +1,124 @@ +package clusters + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/id_location.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/id_location.go new file mode 100644 index 000000000000..ae3cfc43d228 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/id_location.go @@ -0,0 +1,111 @@ +package clusters + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = LocationId{} + +// LocationId is a struct representing the Resource ID for a Location +type LocationId struct { + SubscriptionId string + LocationName string +} + +// NewLocationID returns a new LocationId struct +func NewLocationID(subscriptionId string, locationName string) LocationId { + return LocationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + } +} + +// ParseLocationID parses 'input' into a LocationId +func ParseLocationID(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId +// note: this method should only be used for API response data and not user input +func ParseLocationIDInsensitively(input string) (*LocationId, error) { + parser := resourceids.NewParserFromResourceIdType(LocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := LocationId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { + return nil, fmt.Errorf("the segment 'locationName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateLocationID checks that 'input' can be parsed as a Location ID +func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Location ID +func (id LocationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Kusto/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Location ID +func (id LocationId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationValue"), + } +} + +// String returns a human-readable description of this Location ID +func (id LocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_addlanguageextensions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_addlanguageextensions_autorest.go new file mode 100644 index 000000000000..333636752378 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_addlanguageextensions_autorest.go @@ -0,0 +1,79 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddLanguageExtensionsOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// AddLanguageExtensions ... +func (c ClustersClient) AddLanguageExtensions(ctx context.Context, id ClusterId, input LanguageExtensionsList) (result AddLanguageExtensionsOperationResponse, err error) { + req, err := c.preparerForAddLanguageExtensions(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "AddLanguageExtensions", nil, "Failure preparing request") + return + } + + result, err = c.senderForAddLanguageExtensions(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "AddLanguageExtensions", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// AddLanguageExtensionsThenPoll performs AddLanguageExtensions then polls until it's completed +func (c ClustersClient) AddLanguageExtensionsThenPoll(ctx context.Context, id ClusterId, input LanguageExtensionsList) error { + result, err := c.AddLanguageExtensions(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AddLanguageExtensions: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after AddLanguageExtensions: %+v", err) + } + + return nil +} + +// preparerForAddLanguageExtensions prepares the AddLanguageExtensions request. +func (c ClustersClient) preparerForAddLanguageExtensions(ctx context.Context, id ClusterId, input LanguageExtensionsList) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/addLanguageExtensions", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForAddLanguageExtensions sends the AddLanguageExtensions request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForAddLanguageExtensions(ctx context.Context, req *http.Request) (future AddLanguageExtensionsOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_checknameavailability_autorest.go new file mode 100644 index 000000000000..f2852ec723fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c ClustersClient) CheckNameAvailability(ctx context.Context, id LocationId, input ClusterCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c ClustersClient) preparerForCheckNameAvailability(ctx context.Context, id LocationId, input ClusterCheckNameRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_createorupdate_autorest.go new file mode 100644 index 000000000000..5b138fdffab7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_createorupdate_autorest.go @@ -0,0 +1,113 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + if o.IfNoneMatch != nil { + out["If-None-Match"] = *o.IfNoneMatch + } + + return out +} + +func (o CreateOrUpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// CreateOrUpdate ... +func (c ClustersClient) CreateOrUpdate(ctx context.Context, id ClusterId, input Cluster, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ClustersClient) CreateOrUpdateThenPoll(ctx context.Context, id ClusterId, input Cluster, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ClustersClient) preparerForCreateOrUpdate(ctx context.Context, id ClusterId, input Cluster, options CreateOrUpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_delete_autorest.go new file mode 100644 index 000000000000..285ecf817e5b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_delete_autorest.go @@ -0,0 +1,78 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ClustersClient) Delete(ctx context.Context, id ClusterId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ClustersClient) DeleteThenPoll(ctx context.Context, id ClusterId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ClustersClient) preparerForDelete(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_detachfollowerdatabases_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_detachfollowerdatabases_autorest.go new file mode 100644 index 000000000000..192373e1bc6d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_detachfollowerdatabases_autorest.go @@ -0,0 +1,79 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DetachFollowerDatabasesOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DetachFollowerDatabases ... +func (c ClustersClient) DetachFollowerDatabases(ctx context.Context, id ClusterId, input FollowerDatabaseDefinition) (result DetachFollowerDatabasesOperationResponse, err error) { + req, err := c.preparerForDetachFollowerDatabases(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "DetachFollowerDatabases", nil, "Failure preparing request") + return + } + + result, err = c.senderForDetachFollowerDatabases(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "DetachFollowerDatabases", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DetachFollowerDatabasesThenPoll performs DetachFollowerDatabases then polls until it's completed +func (c ClustersClient) DetachFollowerDatabasesThenPoll(ctx context.Context, id ClusterId, input FollowerDatabaseDefinition) error { + result, err := c.DetachFollowerDatabases(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DetachFollowerDatabases: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DetachFollowerDatabases: %+v", err) + } + + return nil +} + +// preparerForDetachFollowerDatabases prepares the DetachFollowerDatabases request. +func (c ClustersClient) preparerForDetachFollowerDatabases(ctx context.Context, id ClusterId, input FollowerDatabaseDefinition) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/detachFollowerDatabases", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDetachFollowerDatabases sends the DetachFollowerDatabases request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForDetachFollowerDatabases(ctx context.Context, req *http.Request) (future DetachFollowerDatabasesOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_diagnosevirtualnetwork_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_diagnosevirtualnetwork_autorest.go new file mode 100644 index 000000000000..a26ec7120436 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_diagnosevirtualnetwork_autorest.go @@ -0,0 +1,78 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnoseVirtualNetworkOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DiagnoseVirtualNetwork ... +func (c ClustersClient) DiagnoseVirtualNetwork(ctx context.Context, id ClusterId) (result DiagnoseVirtualNetworkOperationResponse, err error) { + req, err := c.preparerForDiagnoseVirtualNetwork(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "DiagnoseVirtualNetwork", nil, "Failure preparing request") + return + } + + result, err = c.senderForDiagnoseVirtualNetwork(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "DiagnoseVirtualNetwork", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DiagnoseVirtualNetworkThenPoll performs DiagnoseVirtualNetwork then polls until it's completed +func (c ClustersClient) DiagnoseVirtualNetworkThenPoll(ctx context.Context, id ClusterId) error { + result, err := c.DiagnoseVirtualNetwork(ctx, id) + if err != nil { + return fmt.Errorf("performing DiagnoseVirtualNetwork: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DiagnoseVirtualNetwork: %+v", err) + } + + return nil +} + +// preparerForDiagnoseVirtualNetwork prepares the DiagnoseVirtualNetwork request. +func (c ClustersClient) preparerForDiagnoseVirtualNetwork(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/diagnoseVirtualNetwork", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDiagnoseVirtualNetwork sends the DiagnoseVirtualNetwork request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForDiagnoseVirtualNetwork(ctx context.Context, req *http.Request) (future DiagnoseVirtualNetworkOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_get_autorest.go new file mode 100644 index 000000000000..2957d3dd8de8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_get_autorest.go @@ -0,0 +1,68 @@ +package clusters + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Cluster +} + +// Get ... +func (c ClustersClient) Get(ctx context.Context, id ClusterId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ClustersClient) preparerForGet(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_list_autorest.go new file mode 100644 index 000000000000..5f7f90cf9eae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_list_autorest.go @@ -0,0 +1,70 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ClusterListResult +} + +// List ... +func (c ClustersClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ClustersClient) preparerForList(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Kusto/clusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listbyresourcegroup_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listbyresourcegroup_autorest.go new file mode 100644 index 000000000000..6af1d374af18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listbyresourcegroup_autorest.go @@ -0,0 +1,70 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + Model *ClusterListResult +} + +// ListByResourceGroup ... +func (c ClustersClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + req, err := c.preparerForListByResourceGroup(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListByResourceGroup", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByResourceGroup(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListByResourceGroup", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByResourceGroup prepares the ListByResourceGroup request. +func (c ClustersClient) preparerForListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.Kusto/clusters", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByResourceGroup handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForListByResourceGroup(resp *http.Response) (result ListByResourceGroupOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listfollowerdatabases_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listfollowerdatabases_autorest.go new file mode 100644 index 000000000000..537aa6adf2d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listfollowerdatabases_autorest.go @@ -0,0 +1,69 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListFollowerDatabasesOperationResponse struct { + HttpResponse *http.Response + Model *FollowerDatabaseListResult +} + +// ListFollowerDatabases ... +func (c ClustersClient) ListFollowerDatabases(ctx context.Context, id ClusterId) (result ListFollowerDatabasesOperationResponse, err error) { + req, err := c.preparerForListFollowerDatabases(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListFollowerDatabases", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListFollowerDatabases", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListFollowerDatabases(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListFollowerDatabases", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListFollowerDatabases prepares the ListFollowerDatabases request. +func (c ClustersClient) preparerForListFollowerDatabases(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listFollowerDatabases", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListFollowerDatabases handles the response to the ListFollowerDatabases request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForListFollowerDatabases(resp *http.Response) (result ListFollowerDatabasesOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listlanguageextensions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listlanguageextensions_autorest.go new file mode 100644 index 000000000000..56c9ec608e9f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listlanguageextensions_autorest.go @@ -0,0 +1,69 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListLanguageExtensionsOperationResponse struct { + HttpResponse *http.Response + Model *LanguageExtensionsList +} + +// ListLanguageExtensions ... +func (c ClustersClient) ListLanguageExtensions(ctx context.Context, id ClusterId) (result ListLanguageExtensionsOperationResponse, err error) { + req, err := c.preparerForListLanguageExtensions(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListLanguageExtensions", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListLanguageExtensions", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListLanguageExtensions(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListLanguageExtensions", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListLanguageExtensions prepares the ListLanguageExtensions request. +func (c ClustersClient) preparerForListLanguageExtensions(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listLanguageExtensions", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListLanguageExtensions handles the response to the ListLanguageExtensions request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForListLanguageExtensions(resp *http.Response) (result ListLanguageExtensionsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listskusbyresource_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listskusbyresource_autorest.go new file mode 100644 index 000000000000..d5bc106385fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_listskusbyresource_autorest.go @@ -0,0 +1,69 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSkusByResourceOperationResponse struct { + HttpResponse *http.Response + Model *ListResourceSkusResult +} + +// ListSkusByResource ... +func (c ClustersClient) ListSkusByResource(ctx context.Context, id ClusterId) (result ListSkusByResourceOperationResponse, err error) { + req, err := c.preparerForListSkusByResource(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListSkusByResource", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListSkusByResource", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListSkusByResource(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "ListSkusByResource", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListSkusByResource prepares the ListSkusByResource request. +func (c ClustersClient) preparerForListSkusByResource(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/skus", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListSkusByResource handles the response to the ListSkusByResource request. The method always +// closes the http.Response Body. +func (c ClustersClient) responderForListSkusByResource(resp *http.Response) (result ListSkusByResourceOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_removelanguageextensions_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_removelanguageextensions_autorest.go new file mode 100644 index 000000000000..f775026ed20c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_removelanguageextensions_autorest.go @@ -0,0 +1,79 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemoveLanguageExtensionsOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// RemoveLanguageExtensions ... +func (c ClustersClient) RemoveLanguageExtensions(ctx context.Context, id ClusterId, input LanguageExtensionsList) (result RemoveLanguageExtensionsOperationResponse, err error) { + req, err := c.preparerForRemoveLanguageExtensions(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "RemoveLanguageExtensions", nil, "Failure preparing request") + return + } + + result, err = c.senderForRemoveLanguageExtensions(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "RemoveLanguageExtensions", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RemoveLanguageExtensionsThenPoll performs RemoveLanguageExtensions then polls until it's completed +func (c ClustersClient) RemoveLanguageExtensionsThenPoll(ctx context.Context, id ClusterId, input LanguageExtensionsList) error { + result, err := c.RemoveLanguageExtensions(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RemoveLanguageExtensions: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after RemoveLanguageExtensions: %+v", err) + } + + return nil +} + +// preparerForRemoveLanguageExtensions prepares the RemoveLanguageExtensions request. +func (c ClustersClient) preparerForRemoveLanguageExtensions(ctx context.Context, id ClusterId, input LanguageExtensionsList) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/removeLanguageExtensions", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRemoveLanguageExtensions sends the RemoveLanguageExtensions request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForRemoveLanguageExtensions(ctx context.Context, req *http.Request) (future RemoveLanguageExtensionsOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_start_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_start_autorest.go new file mode 100644 index 000000000000..251d420e16be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_start_autorest.go @@ -0,0 +1,78 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StartOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Start ... +func (c ClustersClient) Start(ctx context.Context, id ClusterId) (result StartOperationResponse, err error) { + req, err := c.preparerForStart(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Start", nil, "Failure preparing request") + return + } + + result, err = c.senderForStart(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Start", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// StartThenPoll performs Start then polls until it's completed +func (c ClustersClient) StartThenPoll(ctx context.Context, id ClusterId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} + +// preparerForStart prepares the Start request. +func (c ClustersClient) preparerForStart(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/start", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForStart sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForStart(ctx context.Context, req *http.Request) (future StartOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_stop_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_stop_autorest.go new file mode 100644 index 000000000000..5eb506e67913 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_stop_autorest.go @@ -0,0 +1,78 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Stop ... +func (c ClustersClient) Stop(ctx context.Context, id ClusterId) (result StopOperationResponse, err error) { + req, err := c.preparerForStop(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = c.senderForStop(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Stop", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// StopThenPoll performs Stop then polls until it's completed +func (c ClustersClient) StopThenPoll(ctx context.Context, id ClusterId) error { + result, err := c.Stop(ctx, id) + if err != nil { + return fmt.Errorf("performing Stop: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Stop: %+v", err) + } + + return nil +} + +// preparerForStop prepares the Stop request. +func (c ClustersClient) preparerForStop(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/stop", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForStop sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForStop(ctx context.Context, req *http.Request) (future StopOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_update_autorest.go new file mode 100644 index 000000000000..2709f525adae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/method_update_autorest.go @@ -0,0 +1,108 @@ +package clusters + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type UpdateOperationOptions struct { + IfMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + if o.IfMatch != nil { + out["If-Match"] = *o.IfMatch + } + + return out +} + +func (o UpdateOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +// Update ... +func (c ClustersClient) Update(ctx context.Context, id ClusterId, input ClusterUpdate, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input, options) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "clusters.ClustersClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ClustersClient) UpdateThenPoll(ctx context.Context, id ClusterId, input ClusterUpdate, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ClustersClient) preparerForUpdate(ctx context.Context, id ClusterId, input ClusterUpdate, options UpdateOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ClustersClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_acceptedaudiences.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_acceptedaudiences.go new file mode 100644 index 000000000000..380c1812f402 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_acceptedaudiences.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AcceptedAudiences struct { + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_azurecapacity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_azurecapacity.go new file mode 100644 index 000000000000..45346d20b10b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_azurecapacity.go @@ -0,0 +1,11 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureCapacity struct { + Default int64 `json:"default"` + Maximum int64 `json:"maximum"` + Minimum int64 `json:"minimum"` + ScaleType AzureScaleType `json:"scaleType"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_azureresourcesku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_azureresourcesku.go new file mode 100644 index 000000000000..502d4ff7bef7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_azureresourcesku.go @@ -0,0 +1,10 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourceSku struct { + Capacity *AzureCapacity `json:"capacity,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + Sku *AzureSku `json:"sku,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_azuresku.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_azuresku.go new file mode 100644 index 000000000000..ec5553a4bd44 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_azuresku.go @@ -0,0 +1,10 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureSku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name AzureSkuName `json:"name"` + Tier AzureSkuTier `json:"tier"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_checknameresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_checknameresult.go new file mode 100644 index 000000000000..a8e7037cce2a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_checknameresult.go @@ -0,0 +1,11 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameResult struct { + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *Reason `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_cluster.go new file mode 100644 index 000000000000..a214c6249dee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_cluster.go @@ -0,0 +1,24 @@ +package clusters + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Cluster struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ClusterProperties `json:"properties,omitempty"` + Sku AzureSku `json:"sku"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterchecknamerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterchecknamerequest.go new file mode 100644 index 000000000000..2c588e8314d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterchecknamerequest.go @@ -0,0 +1,9 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterCheckNameRequest struct { + Name string `json:"name"` + Type ClusterType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterlistresult.go new file mode 100644 index 000000000000..b556dcab107f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterlistresult.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterListResult struct { + Value *[]Cluster `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterproperties.go new file mode 100644 index 000000000000..4780f3c64cac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterproperties.go @@ -0,0 +1,31 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterProperties struct { + AcceptedAudiences *[]AcceptedAudiences `json:"acceptedAudiences,omitempty"` + AllowedFqdnList *[]string `json:"allowedFqdnList,omitempty"` + AllowedIPRangeList *[]string `json:"allowedIpRangeList,omitempty"` + DataIngestionUri *string `json:"dataIngestionUri,omitempty"` + EnableAutoStop *bool `json:"enableAutoStop,omitempty"` + EnableDiskEncryption *bool `json:"enableDiskEncryption,omitempty"` + EnableDoubleEncryption *bool `json:"enableDoubleEncryption,omitempty"` + EnablePurge *bool `json:"enablePurge,omitempty"` + EnableStreamingIngest *bool `json:"enableStreamingIngest,omitempty"` + EngineType *EngineType `json:"engineType,omitempty"` + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` + LanguageExtensions *LanguageExtensionsList `json:"languageExtensions,omitempty"` + OptimizedAutoscale *OptimizedAutoscale `json:"optimizedAutoscale,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicIPType *PublicIPType `json:"publicIPType,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RestrictOutboundNetworkAccess *ClusterNetworkAccessFlag `json:"restrictOutboundNetworkAccess,omitempty"` + State *State `json:"state,omitempty"` + StateReason *string `json:"stateReason,omitempty"` + TrustedExternalTenants *[]TrustedExternalTenant `json:"trustedExternalTenants,omitempty"` + Uri *string `json:"uri,omitempty"` + VirtualClusterGraduationProperties *string `json:"virtualClusterGraduationProperties,omitempty"` + VirtualNetworkConfiguration *VirtualNetworkConfiguration `json:"virtualNetworkConfiguration,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterupdate.go new file mode 100644 index 000000000000..f35b3e1de9f0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_clusterupdate.go @@ -0,0 +1,19 @@ +package clusters + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpdate struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ClusterProperties `json:"properties,omitempty"` + Sku *AzureSku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_diagnosevirtualnetworkresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_diagnosevirtualnetworkresult.go new file mode 100644 index 000000000000..8cbb2a101185 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_diagnosevirtualnetworkresult.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnoseVirtualNetworkResult struct { + Findings *[]string `json:"findings,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_followerdatabasedefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_followerdatabasedefinition.go new file mode 100644 index 000000000000..220cb7d31742 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_followerdatabasedefinition.go @@ -0,0 +1,10 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FollowerDatabaseDefinition struct { + AttachedDatabaseConfigurationName string `json:"attachedDatabaseConfigurationName"` + ClusterResourceId string `json:"clusterResourceId"` + DatabaseName *string `json:"databaseName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_followerdatabaselistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_followerdatabaselistresult.go new file mode 100644 index 000000000000..21440cb4c913 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_followerdatabaselistresult.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FollowerDatabaseListResult struct { + Value *[]FollowerDatabaseDefinition `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_keyvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_keyvaultproperties.go new file mode 100644 index 000000000000..1585ac057714 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_keyvaultproperties.go @@ -0,0 +1,11 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultProperties struct { + KeyName *string `json:"keyName,omitempty"` + KeyVaultUri *string `json:"keyVaultUri,omitempty"` + KeyVersion *string `json:"keyVersion,omitempty"` + UserIdentity *string `json:"userIdentity,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_languageextension.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_languageextension.go new file mode 100644 index 000000000000..9c7269792078 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_languageextension.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LanguageExtension struct { + LanguageExtensionName *LanguageExtensionName `json:"languageExtensionName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_languageextensionslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_languageextensionslist.go new file mode 100644 index 000000000000..be274ec2cf0e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_languageextensionslist.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LanguageExtensionsList struct { + Value *[]LanguageExtension `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_listresourceskusresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_listresourceskusresult.go new file mode 100644 index 000000000000..2cf5909b9d5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_listresourceskusresult.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListResourceSkusResult struct { + Value *[]AzureResourceSku `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_optimizedautoscale.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_optimizedautoscale.go new file mode 100644 index 000000000000..341a31384811 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_optimizedautoscale.go @@ -0,0 +1,11 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OptimizedAutoscale struct { + IsEnabled bool `json:"isEnabled"` + Maximum int64 `json:"maximum"` + Minimum int64 `json:"minimum"` + Version int64 `json:"version"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privateendpointconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privateendpointconnection.go new file mode 100644 index 000000000000..87e04718600f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privateendpointconnection.go @@ -0,0 +1,16 @@ +package clusters + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privateendpointconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privateendpointconnectionproperties.go new file mode 100644 index 000000000000..3c959462977e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privateendpointconnectionproperties.go @@ -0,0 +1,11 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupId *string `json:"groupId,omitempty"` + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privateendpointproperty.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privateendpointproperty.go new file mode 100644 index 000000000000..5da9b341454c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privateendpointproperty.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointProperty struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privatelinkserviceconnectionstateproperty.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privatelinkserviceconnectionstateproperty.go new file mode 100644 index 000000000000..e4b579946280 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_privatelinkserviceconnectionstateproperty.go @@ -0,0 +1,10 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionStateProperty struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_trustedexternaltenant.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_trustedexternaltenant.go new file mode 100644 index 000000000000..e589152aa78b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_trustedexternaltenant.go @@ -0,0 +1,8 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TrustedExternalTenant struct { + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_virtualnetworkconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_virtualnetworkconfiguration.go new file mode 100644 index 000000000000..1269f4947899 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/model_virtualnetworkconfiguration.go @@ -0,0 +1,10 @@ +package clusters + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkConfiguration struct { + DataManagementPublicIPId string `json:"dataManagementPublicIpId"` + EnginePublicIPId string `json:"enginePublicIpId"` + SubnetId string `json:"subnetId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/version.go new file mode 100644 index 000000000000..2634f3cd4df8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters/version.go @@ -0,0 +1,12 @@ +package clusters + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/clusters/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/README.md new file mode 100644 index 000000000000..d06c17e44461 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/README.md @@ -0,0 +1,102 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments` Documentation + +The `databaseprincipalassignments` SDK allows for interaction with the Azure Resource Manager Service `kusto` (API Version `2022-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments" +``` + + +### Client Initialization + +```go +client := databaseprincipalassignments.NewDatabasePrincipalAssignmentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DatabasePrincipalAssignmentsClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := databaseprincipalassignments.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := databaseprincipalassignments.DatabasePrincipalAssignmentCheckNameRequest{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasePrincipalAssignmentsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := databaseprincipalassignments.NewDatabasePrincipalAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue", "principalAssignmentValue") + +payload := databaseprincipalassignments.DatabasePrincipalAssignment{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasePrincipalAssignmentsClient.Delete` + +```go +ctx := context.TODO() +id := databaseprincipalassignments.NewDatabasePrincipalAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue", "principalAssignmentValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasePrincipalAssignmentsClient.Get` + +```go +ctx := context.TODO() +id := databaseprincipalassignments.NewDatabasePrincipalAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue", "principalAssignmentValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasePrincipalAssignmentsClient.List` + +```go +ctx := context.TODO() +id := databaseprincipalassignments.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/client.go new file mode 100644 index 000000000000..c8a03f9a28fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/client.go @@ -0,0 +1,18 @@ +package databaseprincipalassignments + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasePrincipalAssignmentsClient struct { + Client autorest.Client + baseUri string +} + +func NewDatabasePrincipalAssignmentsClientWithBaseURI(endpoint string) DatabasePrincipalAssignmentsClient { + return DatabasePrincipalAssignmentsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/constants.go new file mode 100644 index 000000000000..6721f6b98d6e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/constants.go @@ -0,0 +1,170 @@ +package databaseprincipalassignments + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasePrincipalAssignmentType string + +const ( + DatabasePrincipalAssignmentTypeMicrosoftPointKustoClustersDatabasesPrincipalAssignments DatabasePrincipalAssignmentType = "Microsoft.Kusto/clusters/databases/principalAssignments" +) + +func PossibleValuesForDatabasePrincipalAssignmentType() []string { + return []string{ + string(DatabasePrincipalAssignmentTypeMicrosoftPointKustoClustersDatabasesPrincipalAssignments), + } +} + +func parseDatabasePrincipalAssignmentType(input string) (*DatabasePrincipalAssignmentType, error) { + vals := map[string]DatabasePrincipalAssignmentType{ + "microsoft.kusto/clusters/databases/principalassignments": DatabasePrincipalAssignmentTypeMicrosoftPointKustoClustersDatabasesPrincipalAssignments, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DatabasePrincipalAssignmentType(input) + return &out, nil +} + +type DatabasePrincipalRole string + +const ( + DatabasePrincipalRoleAdmin DatabasePrincipalRole = "Admin" + DatabasePrincipalRoleIngestor DatabasePrincipalRole = "Ingestor" + DatabasePrincipalRoleMonitor DatabasePrincipalRole = "Monitor" + DatabasePrincipalRoleUnrestrictedViewer DatabasePrincipalRole = "UnrestrictedViewer" + DatabasePrincipalRoleUser DatabasePrincipalRole = "User" + DatabasePrincipalRoleViewer DatabasePrincipalRole = "Viewer" +) + +func PossibleValuesForDatabasePrincipalRole() []string { + return []string{ + string(DatabasePrincipalRoleAdmin), + string(DatabasePrincipalRoleIngestor), + string(DatabasePrincipalRoleMonitor), + string(DatabasePrincipalRoleUnrestrictedViewer), + string(DatabasePrincipalRoleUser), + string(DatabasePrincipalRoleViewer), + } +} + +func parseDatabasePrincipalRole(input string) (*DatabasePrincipalRole, error) { + vals := map[string]DatabasePrincipalRole{ + "admin": DatabasePrincipalRoleAdmin, + "ingestor": DatabasePrincipalRoleIngestor, + "monitor": DatabasePrincipalRoleMonitor, + "unrestrictedviewer": DatabasePrincipalRoleUnrestrictedViewer, + "user": DatabasePrincipalRoleUser, + "viewer": DatabasePrincipalRoleViewer, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DatabasePrincipalRole(input) + return &out, nil +} + +type PrincipalType string + +const ( + PrincipalTypeApp PrincipalType = "App" + PrincipalTypeGroup PrincipalType = "Group" + PrincipalTypeUser PrincipalType = "User" +) + +func PossibleValuesForPrincipalType() []string { + return []string{ + string(PrincipalTypeApp), + string(PrincipalTypeGroup), + string(PrincipalTypeUser), + } +} + +func parsePrincipalType(input string) (*PrincipalType, error) { + vals := map[string]PrincipalType{ + "app": PrincipalTypeApp, + "group": PrincipalTypeGroup, + "user": PrincipalTypeUser, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrincipalType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type Reason string + +const ( + ReasonAlreadyExists Reason = "AlreadyExists" + ReasonInvalid Reason = "Invalid" +) + +func PossibleValuesForReason() []string { + return []string{ + string(ReasonAlreadyExists), + string(ReasonInvalid), + } +} + +func parseReason(input string) (*Reason, error) { + vals := map[string]Reason{ + "alreadyexists": ReasonAlreadyExists, + "invalid": ReasonInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Reason(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/id_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/id_database.go new file mode 100644 index 000000000000..c2063783c9a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/id_database.go @@ -0,0 +1,137 @@ +package databaseprincipalassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DatabaseId{} + +// DatabaseId is a struct representing the Resource ID for a Database +type DatabaseId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + DatabaseName string +} + +// NewDatabaseID returns a new DatabaseId struct +func NewDatabaseID(subscriptionId string, resourceGroupName string, clusterName string, databaseName string) DatabaseId { + return DatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + DatabaseName: databaseName, + } +} + +// ParseDatabaseID parses 'input' into a DatabaseId +func ParseDatabaseID(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDatabaseIDInsensitively parses 'input' case-insensitively into a DatabaseId +// note: this method should only be used for API response data and not user input +func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDatabaseID checks that 'input' can be parsed as a Database ID +func ValidateDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database ID +func (id DatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database ID +func (id DatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + } +} + +// String returns a human-readable description of this Database ID +func (id DatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/id_databaseprincipalassignment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/id_databaseprincipalassignment.go new file mode 100644 index 000000000000..f14b5658d941 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/id_databaseprincipalassignment.go @@ -0,0 +1,150 @@ +package databaseprincipalassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DatabasePrincipalAssignmentId{} + +// DatabasePrincipalAssignmentId is a struct representing the Resource ID for a Database Principal Assignment +type DatabasePrincipalAssignmentId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + DatabaseName string + PrincipalAssignmentName string +} + +// NewDatabasePrincipalAssignmentID returns a new DatabasePrincipalAssignmentId struct +func NewDatabasePrincipalAssignmentID(subscriptionId string, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string) DatabasePrincipalAssignmentId { + return DatabasePrincipalAssignmentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + DatabaseName: databaseName, + PrincipalAssignmentName: principalAssignmentName, + } +} + +// ParseDatabasePrincipalAssignmentID parses 'input' into a DatabasePrincipalAssignmentId +func ParseDatabasePrincipalAssignmentID(input string) (*DatabasePrincipalAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabasePrincipalAssignmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabasePrincipalAssignmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + if id.PrincipalAssignmentName, ok = parsed.Parsed["principalAssignmentName"]; !ok { + return nil, fmt.Errorf("the segment 'principalAssignmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDatabasePrincipalAssignmentIDInsensitively parses 'input' case-insensitively into a DatabasePrincipalAssignmentId +// note: this method should only be used for API response data and not user input +func ParseDatabasePrincipalAssignmentIDInsensitively(input string) (*DatabasePrincipalAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabasePrincipalAssignmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabasePrincipalAssignmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + if id.PrincipalAssignmentName, ok = parsed.Parsed["principalAssignmentName"]; !ok { + return nil, fmt.Errorf("the segment 'principalAssignmentName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDatabasePrincipalAssignmentID checks that 'input' can be parsed as a Database Principal Assignment ID +func ValidateDatabasePrincipalAssignmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDatabasePrincipalAssignmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database Principal Assignment ID +func (id DatabasePrincipalAssignmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s/databases/%s/principalAssignments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.DatabaseName, id.PrincipalAssignmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database Principal Assignment ID +func (id DatabasePrincipalAssignmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + resourceids.StaticSegment("staticPrincipalAssignments", "principalAssignments", "principalAssignments"), + resourceids.UserSpecifiedSegment("principalAssignmentName", "principalAssignmentValue"), + } +} + +// String returns a human-readable description of this Database Principal Assignment ID +func (id DatabasePrincipalAssignmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Principal Assignment Name: %q", id.PrincipalAssignmentName), + } + return fmt.Sprintf("Database Principal Assignment (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_checknameavailability_autorest.go new file mode 100644 index 000000000000..2d64fb4b3cd9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package databaseprincipalassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c DatabasePrincipalAssignmentsClient) CheckNameAvailability(ctx context.Context, id DatabaseId, input DatabasePrincipalAssignmentCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c DatabasePrincipalAssignmentsClient) preparerForCheckNameAvailability(ctx context.Context, id DatabaseId, input DatabasePrincipalAssignmentCheckNameRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkPrincipalAssignmentNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c DatabasePrincipalAssignmentsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_createorupdate_autorest.go new file mode 100644 index 000000000000..fccbbee585c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package databaseprincipalassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c DatabasePrincipalAssignmentsClient) CreateOrUpdate(ctx context.Context, id DatabasePrincipalAssignmentId, input DatabasePrincipalAssignment) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c DatabasePrincipalAssignmentsClient) CreateOrUpdateThenPoll(ctx context.Context, id DatabasePrincipalAssignmentId, input DatabasePrincipalAssignment) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DatabasePrincipalAssignmentsClient) preparerForCreateOrUpdate(ctx context.Context, id DatabasePrincipalAssignmentId, input DatabasePrincipalAssignment) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasePrincipalAssignmentsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_delete_autorest.go new file mode 100644 index 000000000000..37d3f2214f77 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_delete_autorest.go @@ -0,0 +1,78 @@ +package databaseprincipalassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c DatabasePrincipalAssignmentsClient) Delete(ctx context.Context, id DatabasePrincipalAssignmentId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DatabasePrincipalAssignmentsClient) DeleteThenPoll(ctx context.Context, id DatabasePrincipalAssignmentId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c DatabasePrincipalAssignmentsClient) preparerForDelete(ctx context.Context, id DatabasePrincipalAssignmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasePrincipalAssignmentsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_get_autorest.go new file mode 100644 index 000000000000..6ebfe16a3fd4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_get_autorest.go @@ -0,0 +1,68 @@ +package databaseprincipalassignments + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *DatabasePrincipalAssignment +} + +// Get ... +func (c DatabasePrincipalAssignmentsClient) Get(ctx context.Context, id DatabasePrincipalAssignmentId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DatabasePrincipalAssignmentsClient) preparerForGet(ctx context.Context, id DatabasePrincipalAssignmentId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DatabasePrincipalAssignmentsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_list_autorest.go new file mode 100644 index 000000000000..3ae698abf17b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/method_list_autorest.go @@ -0,0 +1,69 @@ +package databaseprincipalassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *DatabasePrincipalAssignmentListResult +} + +// List ... +func (c DatabasePrincipalAssignmentsClient) List(ctx context.Context, id DatabaseId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databaseprincipalassignments.DatabasePrincipalAssignmentsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c DatabasePrincipalAssignmentsClient) preparerForList(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/principalAssignments", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c DatabasePrincipalAssignmentsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_checknameresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_checknameresult.go new file mode 100644 index 000000000000..bb574281c04e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_checknameresult.go @@ -0,0 +1,11 @@ +package databaseprincipalassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameResult struct { + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *Reason `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalassignment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalassignment.go new file mode 100644 index 000000000000..190c9a56a2d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalassignment.go @@ -0,0 +1,11 @@ +package databaseprincipalassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasePrincipalAssignment struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DatabasePrincipalProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalassignmentchecknamerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalassignmentchecknamerequest.go new file mode 100644 index 000000000000..b6d7aca4027e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalassignmentchecknamerequest.go @@ -0,0 +1,9 @@ +package databaseprincipalassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasePrincipalAssignmentCheckNameRequest struct { + Name string `json:"name"` + Type DatabasePrincipalAssignmentType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalassignmentlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalassignmentlistresult.go new file mode 100644 index 000000000000..da1331a2ccb2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalassignmentlistresult.go @@ -0,0 +1,8 @@ +package databaseprincipalassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasePrincipalAssignmentListResult struct { + Value *[]DatabasePrincipalAssignment `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalproperties.go new file mode 100644 index 000000000000..c183996eb069 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/model_databaseprincipalproperties.go @@ -0,0 +1,15 @@ +package databaseprincipalassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasePrincipalProperties struct { + AadObjectId *string `json:"aadObjectId,omitempty"` + PrincipalId string `json:"principalId"` + PrincipalName *string `json:"principalName,omitempty"` + PrincipalType PrincipalType `json:"principalType"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Role DatabasePrincipalRole `json:"role"` + TenantId *string `json:"tenantId,omitempty"` + TenantName *string `json:"tenantName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/version.go new file mode 100644 index 000000000000..dd6f9ae9147e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments/version.go @@ -0,0 +1,12 @@ +package databaseprincipalassignments + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/databaseprincipalassignments/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/README.md new file mode 100644 index 000000000000..1845f4bf27a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/README.md @@ -0,0 +1,177 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases` Documentation + +The `databases` SDK allows for interaction with the Azure Resource Manager Service `kusto` (API Version `2022-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases" +``` + + +### Client Initialization + +```go +client := databases.NewDatabasesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DatabasesClient.AddPrincipals` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := databases.DatabasePrincipalListRequest{ + // ... +} + + +read, err := client.AddPrincipals(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := databases.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := databases.CheckNameRequest{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := databases.Database{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Delete` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Get` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.ListByCluster` + +```go +ctx := context.TODO() +id := databases.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.ListByCluster(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.ListPrincipals` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +read, err := client.ListPrincipals(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.RemovePrincipals` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := databases.DatabasePrincipalListRequest{ + // ... +} + + +read, err := client.RemovePrincipals(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.Update` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := databases.Database{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/client.go new file mode 100644 index 000000000000..5305d65eb6c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/client.go @@ -0,0 +1,18 @@ +package databases + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesClient struct { + Client autorest.Client + baseUri string +} + +func NewDatabasesClientWithBaseURI(endpoint string) DatabasesClient { + return DatabasesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/constants.go new file mode 100644 index 000000000000..446bac5e9024 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/constants.go @@ -0,0 +1,232 @@ +package databases + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasePrincipalRole string + +const ( + DatabasePrincipalRoleAdmin DatabasePrincipalRole = "Admin" + DatabasePrincipalRoleIngestor DatabasePrincipalRole = "Ingestor" + DatabasePrincipalRoleMonitor DatabasePrincipalRole = "Monitor" + DatabasePrincipalRoleUnrestrictedViewer DatabasePrincipalRole = "UnrestrictedViewer" + DatabasePrincipalRoleUser DatabasePrincipalRole = "User" + DatabasePrincipalRoleViewer DatabasePrincipalRole = "Viewer" +) + +func PossibleValuesForDatabasePrincipalRole() []string { + return []string{ + string(DatabasePrincipalRoleAdmin), + string(DatabasePrincipalRoleIngestor), + string(DatabasePrincipalRoleMonitor), + string(DatabasePrincipalRoleUnrestrictedViewer), + string(DatabasePrincipalRoleUser), + string(DatabasePrincipalRoleViewer), + } +} + +func parseDatabasePrincipalRole(input string) (*DatabasePrincipalRole, error) { + vals := map[string]DatabasePrincipalRole{ + "admin": DatabasePrincipalRoleAdmin, + "ingestor": DatabasePrincipalRoleIngestor, + "monitor": DatabasePrincipalRoleMonitor, + "unrestrictedviewer": DatabasePrincipalRoleUnrestrictedViewer, + "user": DatabasePrincipalRoleUser, + "viewer": DatabasePrincipalRoleViewer, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DatabasePrincipalRole(input) + return &out, nil +} + +type DatabasePrincipalType string + +const ( + DatabasePrincipalTypeApp DatabasePrincipalType = "App" + DatabasePrincipalTypeGroup DatabasePrincipalType = "Group" + DatabasePrincipalTypeUser DatabasePrincipalType = "User" +) + +func PossibleValuesForDatabasePrincipalType() []string { + return []string{ + string(DatabasePrincipalTypeApp), + string(DatabasePrincipalTypeGroup), + string(DatabasePrincipalTypeUser), + } +} + +func parseDatabasePrincipalType(input string) (*DatabasePrincipalType, error) { + vals := map[string]DatabasePrincipalType{ + "app": DatabasePrincipalTypeApp, + "group": DatabasePrincipalTypeGroup, + "user": DatabasePrincipalTypeUser, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DatabasePrincipalType(input) + return &out, nil +} + +type Kind string + +const ( + KindReadOnlyFollowing Kind = "ReadOnlyFollowing" + KindReadWrite Kind = "ReadWrite" +) + +func PossibleValuesForKind() []string { + return []string{ + string(KindReadOnlyFollowing), + string(KindReadWrite), + } +} + +func parseKind(input string) (*Kind, error) { + vals := map[string]Kind{ + "readonlyfollowing": KindReadOnlyFollowing, + "readwrite": KindReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Kind(input) + return &out, nil +} + +type PrincipalsModificationKind string + +const ( + PrincipalsModificationKindNone PrincipalsModificationKind = "None" + PrincipalsModificationKindReplace PrincipalsModificationKind = "Replace" + PrincipalsModificationKindUnion PrincipalsModificationKind = "Union" +) + +func PossibleValuesForPrincipalsModificationKind() []string { + return []string{ + string(PrincipalsModificationKindNone), + string(PrincipalsModificationKindReplace), + string(PrincipalsModificationKindUnion), + } +} + +func parsePrincipalsModificationKind(input string) (*PrincipalsModificationKind, error) { + vals := map[string]PrincipalsModificationKind{ + "none": PrincipalsModificationKindNone, + "replace": PrincipalsModificationKindReplace, + "union": PrincipalsModificationKindUnion, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrincipalsModificationKind(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type Reason string + +const ( + ReasonAlreadyExists Reason = "AlreadyExists" + ReasonInvalid Reason = "Invalid" +) + +func PossibleValuesForReason() []string { + return []string{ + string(ReasonAlreadyExists), + string(ReasonInvalid), + } +} + +func parseReason(input string) (*Reason, error) { + vals := map[string]Reason{ + "alreadyexists": ReasonAlreadyExists, + "invalid": ReasonInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Reason(input) + return &out, nil +} + +type Type string + +const ( + TypeMicrosoftPointKustoClustersAttachedDatabaseConfigurations Type = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" + TypeMicrosoftPointKustoClustersDatabases Type = "Microsoft.Kusto/clusters/databases" +) + +func PossibleValuesForType() []string { + return []string{ + string(TypeMicrosoftPointKustoClustersAttachedDatabaseConfigurations), + string(TypeMicrosoftPointKustoClustersDatabases), + } +} + +func parseType(input string) (*Type, error) { + vals := map[string]Type{ + "microsoft.kusto/clusters/attacheddatabaseconfigurations": TypeMicrosoftPointKustoClustersAttachedDatabaseConfigurations, + "microsoft.kusto/clusters/databases": TypeMicrosoftPointKustoClustersDatabases, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Type(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/id_cluster.go new file mode 100644 index 000000000000..81e7720d5241 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/id_cluster.go @@ -0,0 +1,124 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/id_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/id_database.go new file mode 100644 index 000000000000..2ecf928fc1d9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/id_database.go @@ -0,0 +1,137 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DatabaseId{} + +// DatabaseId is a struct representing the Resource ID for a Database +type DatabaseId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + DatabaseName string +} + +// NewDatabaseID returns a new DatabaseId struct +func NewDatabaseID(subscriptionId string, resourceGroupName string, clusterName string, databaseName string) DatabaseId { + return DatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + DatabaseName: databaseName, + } +} + +// ParseDatabaseID parses 'input' into a DatabaseId +func ParseDatabaseID(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDatabaseIDInsensitively parses 'input' case-insensitively into a DatabaseId +// note: this method should only be used for API response data and not user input +func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDatabaseID checks that 'input' can be parsed as a Database ID +func ValidateDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database ID +func (id DatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database ID +func (id DatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + } +} + +// String returns a human-readable description of this Database ID +func (id DatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_addprincipals_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_addprincipals_autorest.go new file mode 100644 index 000000000000..6d3b04ac3353 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_addprincipals_autorest.go @@ -0,0 +1,70 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AddPrincipalsOperationResponse struct { + HttpResponse *http.Response + Model *DatabasePrincipalListResult +} + +// AddPrincipals ... +func (c DatabasesClient) AddPrincipals(ctx context.Context, id DatabaseId, input DatabasePrincipalListRequest) (result AddPrincipalsOperationResponse, err error) { + req, err := c.preparerForAddPrincipals(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "AddPrincipals", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "AddPrincipals", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForAddPrincipals(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "AddPrincipals", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForAddPrincipals prepares the AddPrincipals request. +func (c DatabasesClient) preparerForAddPrincipals(ctx context.Context, id DatabaseId, input DatabasePrincipalListRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/addPrincipals", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForAddPrincipals handles the response to the AddPrincipals request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForAddPrincipals(resp *http.Response) (result AddPrincipalsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_checknameavailability_autorest.go new file mode 100644 index 000000000000..80e7dffd7273 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c DatabasesClient) CheckNameAvailability(ctx context.Context, id ClusterId, input CheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c DatabasesClient) preparerForCheckNameAvailability(ctx context.Context, id ClusterId, input CheckNameRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_createorupdate_autorest.go new file mode 100644 index 000000000000..8046543297da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c DatabasesClient) CreateOrUpdate(ctx context.Context, id DatabaseId, input Database) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c DatabasesClient) CreateOrUpdateThenPoll(ctx context.Context, id DatabaseId, input Database) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DatabasesClient) preparerForCreateOrUpdate(ctx context.Context, id DatabaseId, input Database) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_delete_autorest.go new file mode 100644 index 000000000000..13221da85a68 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_delete_autorest.go @@ -0,0 +1,78 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c DatabasesClient) Delete(ctx context.Context, id DatabaseId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DatabasesClient) DeleteThenPoll(ctx context.Context, id DatabaseId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c DatabasesClient) preparerForDelete(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_get_autorest.go new file mode 100644 index 000000000000..2a7f936df478 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_get_autorest.go @@ -0,0 +1,74 @@ +package databases + +import ( + "context" + "encoding/json" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Database +} + +// Get ... +func (c DatabasesClient) Get(ctx context.Context, id DatabaseId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DatabasesClient) preparerForGet(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + var respObj json.RawMessage + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + model, err := unmarshalDatabaseImplementation(respObj) + if err != nil { + return + } + result.Model = &model + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_listbycluster_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_listbycluster_autorest.go new file mode 100644 index 000000000000..5398539d7166 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_listbycluster_autorest.go @@ -0,0 +1,69 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByClusterOperationResponse struct { + HttpResponse *http.Response + Model *DatabaseListResult +} + +// ListByCluster ... +func (c DatabasesClient) ListByCluster(ctx context.Context, id ClusterId) (result ListByClusterOperationResponse, err error) { + req, err := c.preparerForListByCluster(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByCluster", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByCluster", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByCluster(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListByCluster", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByCluster prepares the ListByCluster request. +func (c DatabasesClient) preparerForListByCluster(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/databases", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByCluster handles the response to the ListByCluster request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForListByCluster(resp *http.Response) (result ListByClusterOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_listprincipals_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_listprincipals_autorest.go new file mode 100644 index 000000000000..9e383796e736 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_listprincipals_autorest.go @@ -0,0 +1,69 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListPrincipalsOperationResponse struct { + HttpResponse *http.Response + Model *DatabasePrincipalListResult +} + +// ListPrincipals ... +func (c DatabasesClient) ListPrincipals(ctx context.Context, id DatabaseId) (result ListPrincipalsOperationResponse, err error) { + req, err := c.preparerForListPrincipals(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListPrincipals", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListPrincipals", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListPrincipals(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "ListPrincipals", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListPrincipals prepares the ListPrincipals request. +func (c DatabasesClient) preparerForListPrincipals(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listPrincipals", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListPrincipals handles the response to the ListPrincipals request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForListPrincipals(resp *http.Response) (result ListPrincipalsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_removeprincipals_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_removeprincipals_autorest.go new file mode 100644 index 000000000000..85ff4300f051 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_removeprincipals_autorest.go @@ -0,0 +1,70 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RemovePrincipalsOperationResponse struct { + HttpResponse *http.Response + Model *DatabasePrincipalListResult +} + +// RemovePrincipals ... +func (c DatabasesClient) RemovePrincipals(ctx context.Context, id DatabaseId, input DatabasePrincipalListRequest) (result RemovePrincipalsOperationResponse, err error) { + req, err := c.preparerForRemovePrincipals(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "RemovePrincipals", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "RemovePrincipals", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForRemovePrincipals(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "RemovePrincipals", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForRemovePrincipals prepares the RemovePrincipals request. +func (c DatabasesClient) preparerForRemovePrincipals(ctx context.Context, id DatabaseId, input DatabasePrincipalListRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/removePrincipals", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForRemovePrincipals handles the response to the RemovePrincipals request. The method always +// closes the http.Response Body. +func (c DatabasesClient) responderForRemovePrincipals(resp *http.Response) (result RemovePrincipalsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_update_autorest.go new file mode 100644 index 000000000000..74bb5eedc909 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/method_update_autorest.go @@ -0,0 +1,79 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c DatabasesClient) Update(ctx context.Context, id DatabaseId, input Database) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "databases.DatabasesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c DatabasesClient) UpdateThenPoll(ctx context.Context, id DatabaseId, input Database) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c DatabasesClient) preparerForUpdate(ctx context.Context, id DatabaseId, input Database) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c DatabasesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_checknamerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_checknamerequest.go new file mode 100644 index 000000000000..105535ee5366 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_checknamerequest.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameRequest struct { + Name string `json:"name"` + Type Type `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_checknameresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_checknameresult.go new file mode 100644 index 000000000000..2939f2274a56 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_checknameresult.go @@ -0,0 +1,11 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameResult struct { + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *Reason `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_database.go new file mode 100644 index 000000000000..4ce3de9e11f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_database.go @@ -0,0 +1,56 @@ +package databases + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Database interface { +} + +func unmarshalDatabaseImplementation(input []byte) (Database, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling Database into map[string]interface: %+v", err) + } + + value, ok := temp["kind"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "ReadOnlyFollowing") { + var out ReadOnlyFollowingDatabase + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ReadOnlyFollowingDatabase: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ReadWrite") { + var out ReadWriteDatabase + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ReadWriteDatabase: %+v", err) + } + return out, nil + } + + type RawDatabaseImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawDatabaseImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaselistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaselistresult.go new file mode 100644 index 000000000000..51d0e5c8156b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaselistresult.go @@ -0,0 +1,41 @@ +package databases + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseListResult struct { + Value *[]Database `json:"value,omitempty"` +} + +var _ json.Unmarshaler = &DatabaseListResult{} + +func (s *DatabaseListResult) UnmarshalJSON(bytes []byte) error { + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling DatabaseListResult into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["value"]; ok { + var listTemp []json.RawMessage + if err := json.Unmarshal(v, &listTemp); err != nil { + return fmt.Errorf("unmarshaling Value into list []json.RawMessage: %+v", err) + } + + output := make([]Database, 0) + for i, val := range listTemp { + impl, err := unmarshalDatabaseImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'Value' for 'DatabaseListResult': %+v", i, err) + } + output = append(output, impl) + } + s.Value = &output + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaseprincipal.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaseprincipal.go new file mode 100644 index 000000000000..221f188d7c47 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaseprincipal.go @@ -0,0 +1,14 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasePrincipal struct { + AppId *string `json:"appId,omitempty"` + Email *string `json:"email,omitempty"` + Fqn *string `json:"fqn,omitempty"` + Name string `json:"name"` + Role DatabasePrincipalRole `json:"role"` + TenantName *string `json:"tenantName,omitempty"` + Type DatabasePrincipalType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaseprincipallistrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaseprincipallistrequest.go new file mode 100644 index 000000000000..c640d6f914b8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaseprincipallistrequest.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasePrincipalListRequest struct { + Value *[]DatabasePrincipal `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaseprincipallistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaseprincipallistresult.go new file mode 100644 index 000000000000..65247b9f69a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databaseprincipallistresult.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasePrincipalListResult struct { + Value *[]DatabasePrincipal `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databasestatistics.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databasestatistics.go new file mode 100644 index 000000000000..8cda1deb8e97 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_databasestatistics.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseStatistics struct { + Size *float64 `json:"size,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readonlyfollowingdatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readonlyfollowingdatabase.go new file mode 100644 index 000000000000..c31d685b6a22 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readonlyfollowingdatabase.go @@ -0,0 +1,45 @@ +package databases + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ Database = ReadOnlyFollowingDatabase{} + +type ReadOnlyFollowingDatabase struct { + Properties *ReadOnlyFollowingDatabaseProperties `json:"properties,omitempty"` + + // Fields inherited from Database + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = ReadOnlyFollowingDatabase{} + +func (s ReadOnlyFollowingDatabase) MarshalJSON() ([]byte, error) { + type wrapper ReadOnlyFollowingDatabase + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ReadOnlyFollowingDatabase: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ReadOnlyFollowingDatabase: %+v", err) + } + decoded["kind"] = "ReadOnlyFollowing" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ReadOnlyFollowingDatabase: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readonlyfollowingdatabaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readonlyfollowingdatabaseproperties.go new file mode 100644 index 000000000000..00ce51e07b6a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readonlyfollowingdatabaseproperties.go @@ -0,0 +1,14 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReadOnlyFollowingDatabaseProperties struct { + AttachedDatabaseConfigurationName *string `json:"attachedDatabaseConfigurationName,omitempty"` + HotCachePeriod *string `json:"hotCachePeriod,omitempty"` + LeaderClusterResourceId *string `json:"leaderClusterResourceId,omitempty"` + PrincipalsModificationKind *PrincipalsModificationKind `json:"principalsModificationKind,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` + Statistics *DatabaseStatistics `json:"statistics,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readwritedatabase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readwritedatabase.go new file mode 100644 index 000000000000..24aa831e2ef0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readwritedatabase.go @@ -0,0 +1,45 @@ +package databases + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ Database = ReadWriteDatabase{} + +type ReadWriteDatabase struct { + Properties *ReadWriteDatabaseProperties `json:"properties,omitempty"` + + // Fields inherited from Database + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = ReadWriteDatabase{} + +func (s ReadWriteDatabase) MarshalJSON() ([]byte, error) { + type wrapper ReadWriteDatabase + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ReadWriteDatabase: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ReadWriteDatabase: %+v", err) + } + decoded["kind"] = "ReadWrite" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ReadWriteDatabase: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readwritedatabaseproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readwritedatabaseproperties.go new file mode 100644 index 000000000000..a48f00898774 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/model_readwritedatabaseproperties.go @@ -0,0 +1,12 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReadWriteDatabaseProperties struct { + HotCachePeriod *string `json:"hotCachePeriod,omitempty"` + IsFollowed *bool `json:"isFollowed,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` + Statistics *DatabaseStatistics `json:"statistics,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/version.go new file mode 100644 index 000000000000..7c0d1ef5e1f4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases/version.go @@ -0,0 +1,12 @@ +package databases + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/databases/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/README.md new file mode 100644 index 000000000000..e3909bb0c22b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/README.md @@ -0,0 +1,136 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections` Documentation + +The `dataconnections` SDK allows for interaction with the Azure Resource Manager Service `kusto` (API Version `2022-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections" +``` + + +### Client Initialization + +```go +client := dataconnections.NewDataConnectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DataConnectionsClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := dataconnections.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := dataconnections.DataConnectionCheckNameRequest{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DataConnectionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := dataconnections.NewDataConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue", "dataConnectionValue") + +payload := dataconnections.DataConnection{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DataConnectionsClient.DataConnectionValidation` + +```go +ctx := context.TODO() +id := dataconnections.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := dataconnections.DataConnectionValidation{ + // ... +} + + +if err := client.DataConnectionValidationThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DataConnectionsClient.Delete` + +```go +ctx := context.TODO() +id := dataconnections.NewDataConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue", "dataConnectionValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DataConnectionsClient.Get` + +```go +ctx := context.TODO() +id := dataconnections.NewDataConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue", "dataConnectionValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DataConnectionsClient.ListByDatabase` + +```go +ctx := context.TODO() +id := dataconnections.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +read, err := client.ListByDatabase(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DataConnectionsClient.Update` + +```go +ctx := context.TODO() +id := dataconnections.NewDataConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue", "dataConnectionValue") + +payload := dataconnections.DataConnection{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/client.go new file mode 100644 index 000000000000..4eb423e42af3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/client.go @@ -0,0 +1,18 @@ +package dataconnections + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataConnectionsClient struct { + Client autorest.Client + baseUri string +} + +func NewDataConnectionsClientWithBaseURI(endpoint string) DataConnectionsClient { + return DataConnectionsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/constants.go new file mode 100644 index 000000000000..f8302a9f12db --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/constants.go @@ -0,0 +1,424 @@ +package dataconnections + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BlobStorageEventType string + +const ( + BlobStorageEventTypeMicrosoftPointStoragePointBlobCreated BlobStorageEventType = "Microsoft.Storage.BlobCreated" + BlobStorageEventTypeMicrosoftPointStoragePointBlobRenamed BlobStorageEventType = "Microsoft.Storage.BlobRenamed" +) + +func PossibleValuesForBlobStorageEventType() []string { + return []string{ + string(BlobStorageEventTypeMicrosoftPointStoragePointBlobCreated), + string(BlobStorageEventTypeMicrosoftPointStoragePointBlobRenamed), + } +} + +func parseBlobStorageEventType(input string) (*BlobStorageEventType, error) { + vals := map[string]BlobStorageEventType{ + "microsoft.storage.blobcreated": BlobStorageEventTypeMicrosoftPointStoragePointBlobCreated, + "microsoft.storage.blobrenamed": BlobStorageEventTypeMicrosoftPointStoragePointBlobRenamed, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BlobStorageEventType(input) + return &out, nil +} + +type Compression string + +const ( + CompressionGZip Compression = "GZip" + CompressionNone Compression = "None" +) + +func PossibleValuesForCompression() []string { + return []string{ + string(CompressionGZip), + string(CompressionNone), + } +} + +func parseCompression(input string) (*Compression, error) { + vals := map[string]Compression{ + "gzip": CompressionGZip, + "none": CompressionNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Compression(input) + return &out, nil +} + +type DataConnectionKind string + +const ( + DataConnectionKindEventGrid DataConnectionKind = "EventGrid" + DataConnectionKindEventHub DataConnectionKind = "EventHub" + DataConnectionKindIotHub DataConnectionKind = "IotHub" +) + +func PossibleValuesForDataConnectionKind() []string { + return []string{ + string(DataConnectionKindEventGrid), + string(DataConnectionKindEventHub), + string(DataConnectionKindIotHub), + } +} + +func parseDataConnectionKind(input string) (*DataConnectionKind, error) { + vals := map[string]DataConnectionKind{ + "eventgrid": DataConnectionKindEventGrid, + "eventhub": DataConnectionKindEventHub, + "iothub": DataConnectionKindIotHub, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataConnectionKind(input) + return &out, nil +} + +type DataConnectionType string + +const ( + DataConnectionTypeMicrosoftPointKustoClustersDatabasesDataConnections DataConnectionType = "Microsoft.Kusto/clusters/databases/dataConnections" +) + +func PossibleValuesForDataConnectionType() []string { + return []string{ + string(DataConnectionTypeMicrosoftPointKustoClustersDatabasesDataConnections), + } +} + +func parseDataConnectionType(input string) (*DataConnectionType, error) { + vals := map[string]DataConnectionType{ + "microsoft.kusto/clusters/databases/dataconnections": DataConnectionTypeMicrosoftPointKustoClustersDatabasesDataConnections, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DataConnectionType(input) + return &out, nil +} + +type DatabaseRouting string + +const ( + DatabaseRoutingMulti DatabaseRouting = "Multi" + DatabaseRoutingSingle DatabaseRouting = "Single" +) + +func PossibleValuesForDatabaseRouting() []string { + return []string{ + string(DatabaseRoutingMulti), + string(DatabaseRoutingSingle), + } +} + +func parseDatabaseRouting(input string) (*DatabaseRouting, error) { + vals := map[string]DatabaseRouting{ + "multi": DatabaseRoutingMulti, + "single": DatabaseRoutingSingle, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DatabaseRouting(input) + return &out, nil +} + +type EventGridDataFormat string + +const ( + EventGridDataFormatAPACHEAVRO EventGridDataFormat = "APACHEAVRO" + EventGridDataFormatAVRO EventGridDataFormat = "AVRO" + EventGridDataFormatCSV EventGridDataFormat = "CSV" + EventGridDataFormatJSON EventGridDataFormat = "JSON" + EventGridDataFormatMULTIJSON EventGridDataFormat = "MULTIJSON" + EventGridDataFormatORC EventGridDataFormat = "ORC" + EventGridDataFormatPARQUET EventGridDataFormat = "PARQUET" + EventGridDataFormatPSV EventGridDataFormat = "PSV" + EventGridDataFormatRAW EventGridDataFormat = "RAW" + EventGridDataFormatSCSV EventGridDataFormat = "SCSV" + EventGridDataFormatSINGLEJSON EventGridDataFormat = "SINGLEJSON" + EventGridDataFormatSOHSV EventGridDataFormat = "SOHSV" + EventGridDataFormatTSV EventGridDataFormat = "TSV" + EventGridDataFormatTSVE EventGridDataFormat = "TSVE" + EventGridDataFormatTXT EventGridDataFormat = "TXT" + EventGridDataFormatWThreeCLOGFILE EventGridDataFormat = "W3CLOGFILE" +) + +func PossibleValuesForEventGridDataFormat() []string { + return []string{ + string(EventGridDataFormatAPACHEAVRO), + string(EventGridDataFormatAVRO), + string(EventGridDataFormatCSV), + string(EventGridDataFormatJSON), + string(EventGridDataFormatMULTIJSON), + string(EventGridDataFormatORC), + string(EventGridDataFormatPARQUET), + string(EventGridDataFormatPSV), + string(EventGridDataFormatRAW), + string(EventGridDataFormatSCSV), + string(EventGridDataFormatSINGLEJSON), + string(EventGridDataFormatSOHSV), + string(EventGridDataFormatTSV), + string(EventGridDataFormatTSVE), + string(EventGridDataFormatTXT), + string(EventGridDataFormatWThreeCLOGFILE), + } +} + +func parseEventGridDataFormat(input string) (*EventGridDataFormat, error) { + vals := map[string]EventGridDataFormat{ + "apacheavro": EventGridDataFormatAPACHEAVRO, + "avro": EventGridDataFormatAVRO, + "csv": EventGridDataFormatCSV, + "json": EventGridDataFormatJSON, + "multijson": EventGridDataFormatMULTIJSON, + "orc": EventGridDataFormatORC, + "parquet": EventGridDataFormatPARQUET, + "psv": EventGridDataFormatPSV, + "raw": EventGridDataFormatRAW, + "scsv": EventGridDataFormatSCSV, + "singlejson": EventGridDataFormatSINGLEJSON, + "sohsv": EventGridDataFormatSOHSV, + "tsv": EventGridDataFormatTSV, + "tsve": EventGridDataFormatTSVE, + "txt": EventGridDataFormatTXT, + "w3clogfile": EventGridDataFormatWThreeCLOGFILE, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EventGridDataFormat(input) + return &out, nil +} + +type EventHubDataFormat string + +const ( + EventHubDataFormatAPACHEAVRO EventHubDataFormat = "APACHEAVRO" + EventHubDataFormatAVRO EventHubDataFormat = "AVRO" + EventHubDataFormatCSV EventHubDataFormat = "CSV" + EventHubDataFormatJSON EventHubDataFormat = "JSON" + EventHubDataFormatMULTIJSON EventHubDataFormat = "MULTIJSON" + EventHubDataFormatORC EventHubDataFormat = "ORC" + EventHubDataFormatPARQUET EventHubDataFormat = "PARQUET" + EventHubDataFormatPSV EventHubDataFormat = "PSV" + EventHubDataFormatRAW EventHubDataFormat = "RAW" + EventHubDataFormatSCSV EventHubDataFormat = "SCSV" + EventHubDataFormatSINGLEJSON EventHubDataFormat = "SINGLEJSON" + EventHubDataFormatSOHSV EventHubDataFormat = "SOHSV" + EventHubDataFormatTSV EventHubDataFormat = "TSV" + EventHubDataFormatTSVE EventHubDataFormat = "TSVE" + EventHubDataFormatTXT EventHubDataFormat = "TXT" + EventHubDataFormatWThreeCLOGFILE EventHubDataFormat = "W3CLOGFILE" +) + +func PossibleValuesForEventHubDataFormat() []string { + return []string{ + string(EventHubDataFormatAPACHEAVRO), + string(EventHubDataFormatAVRO), + string(EventHubDataFormatCSV), + string(EventHubDataFormatJSON), + string(EventHubDataFormatMULTIJSON), + string(EventHubDataFormatORC), + string(EventHubDataFormatPARQUET), + string(EventHubDataFormatPSV), + string(EventHubDataFormatRAW), + string(EventHubDataFormatSCSV), + string(EventHubDataFormatSINGLEJSON), + string(EventHubDataFormatSOHSV), + string(EventHubDataFormatTSV), + string(EventHubDataFormatTSVE), + string(EventHubDataFormatTXT), + string(EventHubDataFormatWThreeCLOGFILE), + } +} + +func parseEventHubDataFormat(input string) (*EventHubDataFormat, error) { + vals := map[string]EventHubDataFormat{ + "apacheavro": EventHubDataFormatAPACHEAVRO, + "avro": EventHubDataFormatAVRO, + "csv": EventHubDataFormatCSV, + "json": EventHubDataFormatJSON, + "multijson": EventHubDataFormatMULTIJSON, + "orc": EventHubDataFormatORC, + "parquet": EventHubDataFormatPARQUET, + "psv": EventHubDataFormatPSV, + "raw": EventHubDataFormatRAW, + "scsv": EventHubDataFormatSCSV, + "singlejson": EventHubDataFormatSINGLEJSON, + "sohsv": EventHubDataFormatSOHSV, + "tsv": EventHubDataFormatTSV, + "tsve": EventHubDataFormatTSVE, + "txt": EventHubDataFormatTXT, + "w3clogfile": EventHubDataFormatWThreeCLOGFILE, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EventHubDataFormat(input) + return &out, nil +} + +type IotHubDataFormat string + +const ( + IotHubDataFormatAPACHEAVRO IotHubDataFormat = "APACHEAVRO" + IotHubDataFormatAVRO IotHubDataFormat = "AVRO" + IotHubDataFormatCSV IotHubDataFormat = "CSV" + IotHubDataFormatJSON IotHubDataFormat = "JSON" + IotHubDataFormatMULTIJSON IotHubDataFormat = "MULTIJSON" + IotHubDataFormatORC IotHubDataFormat = "ORC" + IotHubDataFormatPARQUET IotHubDataFormat = "PARQUET" + IotHubDataFormatPSV IotHubDataFormat = "PSV" + IotHubDataFormatRAW IotHubDataFormat = "RAW" + IotHubDataFormatSCSV IotHubDataFormat = "SCSV" + IotHubDataFormatSINGLEJSON IotHubDataFormat = "SINGLEJSON" + IotHubDataFormatSOHSV IotHubDataFormat = "SOHSV" + IotHubDataFormatTSV IotHubDataFormat = "TSV" + IotHubDataFormatTSVE IotHubDataFormat = "TSVE" + IotHubDataFormatTXT IotHubDataFormat = "TXT" + IotHubDataFormatWThreeCLOGFILE IotHubDataFormat = "W3CLOGFILE" +) + +func PossibleValuesForIotHubDataFormat() []string { + return []string{ + string(IotHubDataFormatAPACHEAVRO), + string(IotHubDataFormatAVRO), + string(IotHubDataFormatCSV), + string(IotHubDataFormatJSON), + string(IotHubDataFormatMULTIJSON), + string(IotHubDataFormatORC), + string(IotHubDataFormatPARQUET), + string(IotHubDataFormatPSV), + string(IotHubDataFormatRAW), + string(IotHubDataFormatSCSV), + string(IotHubDataFormatSINGLEJSON), + string(IotHubDataFormatSOHSV), + string(IotHubDataFormatTSV), + string(IotHubDataFormatTSVE), + string(IotHubDataFormatTXT), + string(IotHubDataFormatWThreeCLOGFILE), + } +} + +func parseIotHubDataFormat(input string) (*IotHubDataFormat, error) { + vals := map[string]IotHubDataFormat{ + "apacheavro": IotHubDataFormatAPACHEAVRO, + "avro": IotHubDataFormatAVRO, + "csv": IotHubDataFormatCSV, + "json": IotHubDataFormatJSON, + "multijson": IotHubDataFormatMULTIJSON, + "orc": IotHubDataFormatORC, + "parquet": IotHubDataFormatPARQUET, + "psv": IotHubDataFormatPSV, + "raw": IotHubDataFormatRAW, + "scsv": IotHubDataFormatSCSV, + "singlejson": IotHubDataFormatSINGLEJSON, + "sohsv": IotHubDataFormatSOHSV, + "tsv": IotHubDataFormatTSV, + "tsve": IotHubDataFormatTSVE, + "txt": IotHubDataFormatTXT, + "w3clogfile": IotHubDataFormatWThreeCLOGFILE, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IotHubDataFormat(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type Reason string + +const ( + ReasonAlreadyExists Reason = "AlreadyExists" + ReasonInvalid Reason = "Invalid" +) + +func PossibleValuesForReason() []string { + return []string{ + string(ReasonAlreadyExists), + string(ReasonInvalid), + } +} + +func parseReason(input string) (*Reason, error) { + vals := map[string]Reason{ + "alreadyexists": ReasonAlreadyExists, + "invalid": ReasonInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Reason(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/id_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/id_database.go new file mode 100644 index 000000000000..3c4698c1ea67 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/id_database.go @@ -0,0 +1,137 @@ +package dataconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DatabaseId{} + +// DatabaseId is a struct representing the Resource ID for a Database +type DatabaseId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + DatabaseName string +} + +// NewDatabaseID returns a new DatabaseId struct +func NewDatabaseID(subscriptionId string, resourceGroupName string, clusterName string, databaseName string) DatabaseId { + return DatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + DatabaseName: databaseName, + } +} + +// ParseDatabaseID parses 'input' into a DatabaseId +func ParseDatabaseID(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDatabaseIDInsensitively parses 'input' case-insensitively into a DatabaseId +// note: this method should only be used for API response data and not user input +func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDatabaseID checks that 'input' can be parsed as a Database ID +func ValidateDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database ID +func (id DatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database ID +func (id DatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + } +} + +// String returns a human-readable description of this Database ID +func (id DatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/id_dataconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/id_dataconnection.go new file mode 100644 index 000000000000..c3c10693d1ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/id_dataconnection.go @@ -0,0 +1,150 @@ +package dataconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DataConnectionId{} + +// DataConnectionId is a struct representing the Resource ID for a Data Connection +type DataConnectionId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + DatabaseName string + DataConnectionName string +} + +// NewDataConnectionID returns a new DataConnectionId struct +func NewDataConnectionID(subscriptionId string, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string) DataConnectionId { + return DataConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + DatabaseName: databaseName, + DataConnectionName: dataConnectionName, + } +} + +// ParseDataConnectionID parses 'input' into a DataConnectionId +func ParseDataConnectionID(input string) (*DataConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(DataConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DataConnectionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + if id.DataConnectionName, ok = parsed.Parsed["dataConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'dataConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDataConnectionIDInsensitively parses 'input' case-insensitively into a DataConnectionId +// note: this method should only be used for API response data and not user input +func ParseDataConnectionIDInsensitively(input string) (*DataConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(DataConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DataConnectionId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + if id.DataConnectionName, ok = parsed.Parsed["dataConnectionName"]; !ok { + return nil, fmt.Errorf("the segment 'dataConnectionName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDataConnectionID checks that 'input' can be parsed as a Data Connection ID +func ValidateDataConnectionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDataConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Data Connection ID +func (id DataConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s/databases/%s/dataConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.DatabaseName, id.DataConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Data Connection ID +func (id DataConnectionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + resourceids.StaticSegment("staticDataConnections", "dataConnections", "dataConnections"), + resourceids.UserSpecifiedSegment("dataConnectionName", "dataConnectionValue"), + } +} + +// String returns a human-readable description of this Data Connection ID +func (id DataConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Data Connection Name: %q", id.DataConnectionName), + } + return fmt.Sprintf("Data Connection (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_checknameavailability_autorest.go new file mode 100644 index 000000000000..9546891519b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package dataconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c DataConnectionsClient) CheckNameAvailability(ctx context.Context, id DatabaseId, input DataConnectionCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c DataConnectionsClient) preparerForCheckNameAvailability(ctx context.Context, id DatabaseId, input DataConnectionCheckNameRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/checkNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c DataConnectionsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_createorupdate_autorest.go new file mode 100644 index 000000000000..62b72e6ac351 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package dataconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c DataConnectionsClient) CreateOrUpdate(ctx context.Context, id DataConnectionId, input DataConnection) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c DataConnectionsClient) CreateOrUpdateThenPoll(ctx context.Context, id DataConnectionId, input DataConnection) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c DataConnectionsClient) preparerForCreateOrUpdate(ctx context.Context, id DataConnectionId, input DataConnection) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c DataConnectionsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_dataconnectionvalidation_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_dataconnectionvalidation_autorest.go new file mode 100644 index 000000000000..0cc76ed7492e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_dataconnectionvalidation_autorest.go @@ -0,0 +1,79 @@ +package dataconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataConnectionValidationOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// DataConnectionValidation ... +func (c DataConnectionsClient) DataConnectionValidation(ctx context.Context, id DatabaseId, input DataConnectionValidation) (result DataConnectionValidationOperationResponse, err error) { + req, err := c.preparerForDataConnectionValidation(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "DataConnectionValidation", nil, "Failure preparing request") + return + } + + result, err = c.senderForDataConnectionValidation(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "DataConnectionValidation", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DataConnectionValidationThenPoll performs DataConnectionValidation then polls until it's completed +func (c DataConnectionsClient) DataConnectionValidationThenPoll(ctx context.Context, id DatabaseId, input DataConnectionValidation) error { + result, err := c.DataConnectionValidation(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DataConnectionValidation: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after DataConnectionValidation: %+v", err) + } + + return nil +} + +// preparerForDataConnectionValidation prepares the DataConnectionValidation request. +func (c DataConnectionsClient) preparerForDataConnectionValidation(ctx context.Context, id DatabaseId, input DataConnectionValidation) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/dataConnectionValidation", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDataConnectionValidation sends the DataConnectionValidation request. The method will close the +// http.Response Body if it receives an error. +func (c DataConnectionsClient) senderForDataConnectionValidation(ctx context.Context, req *http.Request) (future DataConnectionValidationOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_delete_autorest.go new file mode 100644 index 000000000000..db400eaac4a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_delete_autorest.go @@ -0,0 +1,78 @@ +package dataconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c DataConnectionsClient) Delete(ctx context.Context, id DataConnectionId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DataConnectionsClient) DeleteThenPoll(ctx context.Context, id DataConnectionId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c DataConnectionsClient) preparerForDelete(ctx context.Context, id DataConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c DataConnectionsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_get_autorest.go new file mode 100644 index 000000000000..47d2d1c86b27 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_get_autorest.go @@ -0,0 +1,74 @@ +package dataconnections + +import ( + "context" + "encoding/json" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *DataConnection +} + +// Get ... +func (c DataConnectionsClient) Get(ctx context.Context, id DataConnectionId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c DataConnectionsClient) preparerForGet(ctx context.Context, id DataConnectionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c DataConnectionsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + var respObj json.RawMessage + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + model, err := unmarshalDataConnectionImplementation(respObj) + if err != nil { + return + } + result.Model = &model + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_listbydatabase_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_listbydatabase_autorest.go new file mode 100644 index 000000000000..7bbb4800b1e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_listbydatabase_autorest.go @@ -0,0 +1,69 @@ +package dataconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByDatabaseOperationResponse struct { + HttpResponse *http.Response + Model *DataConnectionListResult +} + +// ListByDatabase ... +func (c DataConnectionsClient) ListByDatabase(ctx context.Context, id DatabaseId) (result ListByDatabaseOperationResponse, err error) { + req, err := c.preparerForListByDatabase(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "ListByDatabase", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByDatabase(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "ListByDatabase", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByDatabase prepares the ListByDatabase request. +func (c DataConnectionsClient) preparerForListByDatabase(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/dataConnections", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByDatabase handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (c DataConnectionsClient) responderForListByDatabase(resp *http.Response) (result ListByDatabaseOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_update_autorest.go new file mode 100644 index 000000000000..0557133cd50f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/method_update_autorest.go @@ -0,0 +1,79 @@ +package dataconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c DataConnectionsClient) Update(ctx context.Context, id DataConnectionId, input DataConnection) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "dataconnections.DataConnectionsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c DataConnectionsClient) UpdateThenPoll(ctx context.Context, id DataConnectionId, input DataConnection) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c DataConnectionsClient) preparerForUpdate(ctx context.Context, id DataConnectionId, input DataConnection) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c DataConnectionsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_checknameresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_checknameresult.go new file mode 100644 index 000000000000..68ee492fcf1c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_checknameresult.go @@ -0,0 +1,11 @@ +package dataconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameResult struct { + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *Reason `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnection.go new file mode 100644 index 000000000000..d1fe61d37ae7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnection.go @@ -0,0 +1,64 @@ +package dataconnections + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataConnection interface { +} + +func unmarshalDataConnectionImplementation(input []byte) (DataConnection, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling DataConnection into map[string]interface: %+v", err) + } + + value, ok := temp["kind"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "EventGrid") { + var out EventGridDataConnection + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into EventGridDataConnection: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "EventHub") { + var out EventHubDataConnection + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into EventHubDataConnection: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "IotHub") { + var out IotHubDataConnection + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into IotHubDataConnection: %+v", err) + } + return out, nil + } + + type RawDataConnectionImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawDataConnectionImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionchecknamerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionchecknamerequest.go new file mode 100644 index 000000000000..10c0c2b2f435 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionchecknamerequest.go @@ -0,0 +1,9 @@ +package dataconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataConnectionCheckNameRequest struct { + Name string `json:"name"` + Type DataConnectionType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionlistresult.go new file mode 100644 index 000000000000..2997428d1ce8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionlistresult.go @@ -0,0 +1,41 @@ +package dataconnections + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataConnectionListResult struct { + Value *[]DataConnection `json:"value,omitempty"` +} + +var _ json.Unmarshaler = &DataConnectionListResult{} + +func (s *DataConnectionListResult) UnmarshalJSON(bytes []byte) error { + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling DataConnectionListResult into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["value"]; ok { + var listTemp []json.RawMessage + if err := json.Unmarshal(v, &listTemp); err != nil { + return fmt.Errorf("unmarshaling Value into list []json.RawMessage: %+v", err) + } + + output := make([]DataConnection, 0) + for i, val := range listTemp { + impl, err := unmarshalDataConnectionImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'Value' for 'DataConnectionListResult': %+v", i, err) + } + output = append(output, impl) + } + s.Value = &output + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionvalidation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionvalidation.go new file mode 100644 index 000000000000..b9c4dba68f10 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionvalidation.go @@ -0,0 +1,40 @@ +package dataconnections + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataConnectionValidation struct { + DataConnectionName *string `json:"dataConnectionName,omitempty"` + Properties DataConnection `json:"properties"` +} + +var _ json.Unmarshaler = &DataConnectionValidation{} + +func (s *DataConnectionValidation) UnmarshalJSON(bytes []byte) error { + type alias DataConnectionValidation + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into DataConnectionValidation: %+v", err) + } + + s.DataConnectionName = decoded.DataConnectionName + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling DataConnectionValidation into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := unmarshalDataConnectionImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'DataConnectionValidation': %+v", err) + } + s.Properties = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionvalidationlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionvalidationlistresult.go new file mode 100644 index 000000000000..f73b6da6cd4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionvalidationlistresult.go @@ -0,0 +1,8 @@ +package dataconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataConnectionValidationListResult struct { + Value *[]DataConnectionValidationResult `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionvalidationresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionvalidationresult.go new file mode 100644 index 000000000000..df19e8199eff --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_dataconnectionvalidationresult.go @@ -0,0 +1,8 @@ +package dataconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataConnectionValidationResult struct { + ErrorMessage *string `json:"errorMessage,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventgridconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventgridconnectionproperties.go new file mode 100644 index 000000000000..d489ab01307f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventgridconnectionproperties.go @@ -0,0 +1,20 @@ +package dataconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventGridConnectionProperties struct { + BlobStorageEventType *BlobStorageEventType `json:"blobStorageEventType,omitempty"` + ConsumerGroup string `json:"consumerGroup"` + DataFormat *EventGridDataFormat `json:"dataFormat,omitempty"` + DatabaseRouting *DatabaseRouting `json:"databaseRouting,omitempty"` + EventGridResourceId *string `json:"eventGridResourceId,omitempty"` + EventHubResourceId string `json:"eventHubResourceId"` + IgnoreFirstRecord *bool `json:"ignoreFirstRecord,omitempty"` + ManagedIdentityObjectId *string `json:"managedIdentityObjectId,omitempty"` + ManagedIdentityResourceId *string `json:"managedIdentityResourceId,omitempty"` + MappingRuleName *string `json:"mappingRuleName,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + StorageAccountResourceId string `json:"storageAccountResourceId"` + TableName *string `json:"tableName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventgriddataconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventgriddataconnection.go new file mode 100644 index 000000000000..5e5399dfe1bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventgriddataconnection.go @@ -0,0 +1,45 @@ +package dataconnections + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataConnection = EventGridDataConnection{} + +type EventGridDataConnection struct { + Properties *EventGridConnectionProperties `json:"properties,omitempty"` + + // Fields inherited from DataConnection + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = EventGridDataConnection{} + +func (s EventGridDataConnection) MarshalJSON() ([]byte, error) { + type wrapper EventGridDataConnection + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling EventGridDataConnection: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling EventGridDataConnection: %+v", err) + } + decoded["kind"] = "EventGrid" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling EventGridDataConnection: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventhubconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventhubconnectionproperties.go new file mode 100644 index 000000000000..0a860f2e09ee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventhubconnectionproperties.go @@ -0,0 +1,18 @@ +package dataconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventHubConnectionProperties struct { + Compression *Compression `json:"compression,omitempty"` + ConsumerGroup string `json:"consumerGroup"` + DataFormat *EventHubDataFormat `json:"dataFormat,omitempty"` + DatabaseRouting *DatabaseRouting `json:"databaseRouting,omitempty"` + EventHubResourceId string `json:"eventHubResourceId"` + EventSystemProperties *[]string `json:"eventSystemProperties,omitempty"` + ManagedIdentityObjectId *string `json:"managedIdentityObjectId,omitempty"` + ManagedIdentityResourceId *string `json:"managedIdentityResourceId,omitempty"` + MappingRuleName *string `json:"mappingRuleName,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + TableName *string `json:"tableName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventhubdataconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventhubdataconnection.go new file mode 100644 index 000000000000..c92e8ef4900b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_eventhubdataconnection.go @@ -0,0 +1,45 @@ +package dataconnections + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataConnection = EventHubDataConnection{} + +type EventHubDataConnection struct { + Properties *EventHubConnectionProperties `json:"properties,omitempty"` + + // Fields inherited from DataConnection + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = EventHubDataConnection{} + +func (s EventHubDataConnection) MarshalJSON() ([]byte, error) { + type wrapper EventHubDataConnection + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling EventHubDataConnection: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling EventHubDataConnection: %+v", err) + } + decoded["kind"] = "EventHub" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling EventHubDataConnection: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_iothubconnectionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_iothubconnectionproperties.go new file mode 100644 index 000000000000..7c8e11e6179b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_iothubconnectionproperties.go @@ -0,0 +1,16 @@ +package dataconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IotHubConnectionProperties struct { + ConsumerGroup string `json:"consumerGroup"` + DataFormat *IotHubDataFormat `json:"dataFormat,omitempty"` + DatabaseRouting *DatabaseRouting `json:"databaseRouting,omitempty"` + EventSystemProperties *[]string `json:"eventSystemProperties,omitempty"` + IotHubResourceId string `json:"iotHubResourceId"` + MappingRuleName *string `json:"mappingRuleName,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + SharedAccessPolicyName string `json:"sharedAccessPolicyName"` + TableName *string `json:"tableName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_iothubdataconnection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_iothubdataconnection.go new file mode 100644 index 000000000000..9935922b66cb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/model_iothubdataconnection.go @@ -0,0 +1,45 @@ +package dataconnections + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ DataConnection = IotHubDataConnection{} + +type IotHubDataConnection struct { + Properties *IotHubConnectionProperties `json:"properties,omitempty"` + + // Fields inherited from DataConnection + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Marshaler = IotHubDataConnection{} + +func (s IotHubDataConnection) MarshalJSON() ([]byte, error) { + type wrapper IotHubDataConnection + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling IotHubDataConnection: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling IotHubDataConnection: %+v", err) + } + decoded["kind"] = "IotHub" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling IotHubDataConnection: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/version.go new file mode 100644 index 000000000000..5f892c96f0fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections/version.go @@ -0,0 +1,12 @@ +package dataconnections + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/dataconnections/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/README.md new file mode 100644 index 000000000000..ddfc07d3cc41 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/README.md @@ -0,0 +1,119 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints` Documentation + +The `managedprivateendpoints` SDK allows for interaction with the Azure Resource Manager Service `kusto` (API Version `2022-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints" +``` + + +### Client Initialization + +```go +client := managedprivateendpoints.NewManagedPrivateEndpointsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ManagedPrivateEndpointsClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := managedprivateendpoints.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +payload := managedprivateendpoints.ManagedPrivateEndpointsCheckNameRequest{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedPrivateEndpointsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := managedprivateendpoints.NewManagedPrivateEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "managedPrivateEndpointValue") + +payload := managedprivateendpoints.ManagedPrivateEndpoint{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ManagedPrivateEndpointsClient.Delete` + +```go +ctx := context.TODO() +id := managedprivateendpoints.NewManagedPrivateEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "managedPrivateEndpointValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ManagedPrivateEndpointsClient.Get` + +```go +ctx := context.TODO() +id := managedprivateendpoints.NewManagedPrivateEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "managedPrivateEndpointValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedPrivateEndpointsClient.List` + +```go +ctx := context.TODO() +id := managedprivateendpoints.NewClusterID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ManagedPrivateEndpointsClient.Update` + +```go +ctx := context.TODO() +id := managedprivateendpoints.NewManagedPrivateEndpointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "managedPrivateEndpointValue") + +payload := managedprivateendpoints.ManagedPrivateEndpoint{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/client.go new file mode 100644 index 000000000000..1c18122fab33 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/client.go @@ -0,0 +1,18 @@ +package managedprivateendpoints + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedPrivateEndpointsClient struct { + Client autorest.Client + baseUri string +} + +func NewManagedPrivateEndpointsClientWithBaseURI(endpoint string) ManagedPrivateEndpointsClient { + return ManagedPrivateEndpointsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/constants.go new file mode 100644 index 000000000000..f7fc54bef737 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/constants.go @@ -0,0 +1,99 @@ +package managedprivateendpoints + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedPrivateEndpointsType string + +const ( + ManagedPrivateEndpointsTypeMicrosoftPointKustoClustersManagedPrivateEndpoints ManagedPrivateEndpointsType = "Microsoft.Kusto/clusters/managedPrivateEndpoints" +) + +func PossibleValuesForManagedPrivateEndpointsType() []string { + return []string{ + string(ManagedPrivateEndpointsTypeMicrosoftPointKustoClustersManagedPrivateEndpoints), + } +} + +func parseManagedPrivateEndpointsType(input string) (*ManagedPrivateEndpointsType, error) { + vals := map[string]ManagedPrivateEndpointsType{ + "microsoft.kusto/clusters/managedprivateendpoints": ManagedPrivateEndpointsTypeMicrosoftPointKustoClustersManagedPrivateEndpoints, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ManagedPrivateEndpointsType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type Reason string + +const ( + ReasonAlreadyExists Reason = "AlreadyExists" + ReasonInvalid Reason = "Invalid" +) + +func PossibleValuesForReason() []string { + return []string{ + string(ReasonAlreadyExists), + string(ReasonInvalid), + } +} + +func parseReason(input string) (*Reason, error) { + vals := map[string]Reason{ + "alreadyexists": ReasonAlreadyExists, + "invalid": ReasonInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Reason(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/id_cluster.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/id_cluster.go new file mode 100644 index 000000000000..8b2c3cb88a2c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/id_cluster.go @@ -0,0 +1,124 @@ +package managedprivateendpoints + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ClusterId{} + +// ClusterId is a struct representing the Resource ID for a Cluster +type ClusterId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string +} + +// NewClusterID returns a new ClusterId struct +func NewClusterID(subscriptionId string, resourceGroupName string, clusterName string) ClusterId { + return ClusterId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + } +} + +// ParseClusterID parses 'input' into a ClusterId +func ParseClusterID(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseClusterIDInsensitively parses 'input' case-insensitively into a ClusterId +// note: this method should only be used for API response data and not user input +func ParseClusterIDInsensitively(input string) (*ClusterId, error) { + parser := resourceids.NewParserFromResourceIdType(ClusterId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ClusterId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateClusterID checks that 'input' can be parsed as a Cluster ID +func ValidateClusterID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseClusterID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cluster ID +func (id ClusterId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cluster ID +func (id ClusterId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + } +} + +// String returns a human-readable description of this Cluster ID +func (id ClusterId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + } + return fmt.Sprintf("Cluster (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/id_managedprivateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/id_managedprivateendpoint.go new file mode 100644 index 000000000000..578f3d6542a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/id_managedprivateendpoint.go @@ -0,0 +1,137 @@ +package managedprivateendpoints + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ManagedPrivateEndpointId{} + +// ManagedPrivateEndpointId is a struct representing the Resource ID for a Managed Private Endpoint +type ManagedPrivateEndpointId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + ManagedPrivateEndpointName string +} + +// NewManagedPrivateEndpointID returns a new ManagedPrivateEndpointId struct +func NewManagedPrivateEndpointID(subscriptionId string, resourceGroupName string, clusterName string, managedPrivateEndpointName string) ManagedPrivateEndpointId { + return ManagedPrivateEndpointId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + ManagedPrivateEndpointName: managedPrivateEndpointName, + } +} + +// ParseManagedPrivateEndpointID parses 'input' into a ManagedPrivateEndpointId +func ParseManagedPrivateEndpointID(input string) (*ManagedPrivateEndpointId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedPrivateEndpointId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedPrivateEndpointId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.ManagedPrivateEndpointName, ok = parsed.Parsed["managedPrivateEndpointName"]; !ok { + return nil, fmt.Errorf("the segment 'managedPrivateEndpointName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseManagedPrivateEndpointIDInsensitively parses 'input' case-insensitively into a ManagedPrivateEndpointId +// note: this method should only be used for API response data and not user input +func ParseManagedPrivateEndpointIDInsensitively(input string) (*ManagedPrivateEndpointId, error) { + parser := resourceids.NewParserFromResourceIdType(ManagedPrivateEndpointId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ManagedPrivateEndpointId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.ManagedPrivateEndpointName, ok = parsed.Parsed["managedPrivateEndpointName"]; !ok { + return nil, fmt.Errorf("the segment 'managedPrivateEndpointName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateManagedPrivateEndpointID checks that 'input' can be parsed as a Managed Private Endpoint ID +func ValidateManagedPrivateEndpointID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseManagedPrivateEndpointID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Managed Private Endpoint ID +func (id ManagedPrivateEndpointId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s/managedPrivateEndpoints/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.ManagedPrivateEndpointName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Managed Private Endpoint ID +func (id ManagedPrivateEndpointId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticManagedPrivateEndpoints", "managedPrivateEndpoints", "managedPrivateEndpoints"), + resourceids.UserSpecifiedSegment("managedPrivateEndpointName", "managedPrivateEndpointValue"), + } +} + +// String returns a human-readable description of this Managed Private Endpoint ID +func (id ManagedPrivateEndpointId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Managed Private Endpoint Name: %q", id.ManagedPrivateEndpointName), + } + return fmt.Sprintf("Managed Private Endpoint (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_checknameavailability_autorest.go new file mode 100644 index 000000000000..abee5161dd5e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package managedprivateendpoints + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c ManagedPrivateEndpointsClient) CheckNameAvailability(ctx context.Context, id ClusterId, input ManagedPrivateEndpointsCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c ManagedPrivateEndpointsClient) preparerForCheckNameAvailability(ctx context.Context, id ClusterId, input ManagedPrivateEndpointsCheckNameRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/managedPrivateEndpointsCheckNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c ManagedPrivateEndpointsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_createorupdate_autorest.go new file mode 100644 index 000000000000..9ca910404f17 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package managedprivateendpoints + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ManagedPrivateEndpointsClient) CreateOrUpdate(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ManagedPrivateEndpointsClient) CreateOrUpdateThenPoll(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ManagedPrivateEndpointsClient) preparerForCreateOrUpdate(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ManagedPrivateEndpointsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_delete_autorest.go new file mode 100644 index 000000000000..aa9e0477433d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_delete_autorest.go @@ -0,0 +1,78 @@ +package managedprivateendpoints + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ManagedPrivateEndpointsClient) Delete(ctx context.Context, id ManagedPrivateEndpointId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ManagedPrivateEndpointsClient) DeleteThenPoll(ctx context.Context, id ManagedPrivateEndpointId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ManagedPrivateEndpointsClient) preparerForDelete(ctx context.Context, id ManagedPrivateEndpointId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ManagedPrivateEndpointsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_get_autorest.go new file mode 100644 index 000000000000..a322aa21710b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_get_autorest.go @@ -0,0 +1,68 @@ +package managedprivateendpoints + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *ManagedPrivateEndpoint +} + +// Get ... +func (c ManagedPrivateEndpointsClient) Get(ctx context.Context, id ManagedPrivateEndpointId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ManagedPrivateEndpointsClient) preparerForGet(ctx context.Context, id ManagedPrivateEndpointId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ManagedPrivateEndpointsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_list_autorest.go new file mode 100644 index 000000000000..b1559bb330a3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_list_autorest.go @@ -0,0 +1,69 @@ +package managedprivateendpoints + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *ManagedPrivateEndpointListResult +} + +// List ... +func (c ManagedPrivateEndpointsClient) List(ctx context.Context, id ClusterId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c ManagedPrivateEndpointsClient) preparerForList(ctx context.Context, id ClusterId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/managedPrivateEndpoints", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c ManagedPrivateEndpointsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_update_autorest.go new file mode 100644 index 000000000000..96a472d57c99 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/method_update_autorest.go @@ -0,0 +1,79 @@ +package managedprivateendpoints + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ManagedPrivateEndpointsClient) Update(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "managedprivateendpoints.ManagedPrivateEndpointsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ManagedPrivateEndpointsClient) UpdateThenPoll(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ManagedPrivateEndpointsClient) preparerForUpdate(ctx context.Context, id ManagedPrivateEndpointId, input ManagedPrivateEndpoint) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ManagedPrivateEndpointsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_checknameresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_checknameresult.go new file mode 100644 index 000000000000..59c1ab235d27 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_checknameresult.go @@ -0,0 +1,11 @@ +package managedprivateendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameResult struct { + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *Reason `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpoint.go new file mode 100644 index 000000000000..90b630e3170d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpoint.go @@ -0,0 +1,16 @@ +package managedprivateendpoints + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedPrivateEndpoint struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ManagedPrivateEndpointProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpointlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpointlistresult.go new file mode 100644 index 000000000000..f5116adfade5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpointlistresult.go @@ -0,0 +1,8 @@ +package managedprivateendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedPrivateEndpointListResult struct { + Value *[]ManagedPrivateEndpoint `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpointproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpointproperties.go new file mode 100644 index 000000000000..2af4568de557 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpointproperties.go @@ -0,0 +1,12 @@ +package managedprivateendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedPrivateEndpointProperties struct { + GroupId string `json:"groupId"` + PrivateLinkResourceId string `json:"privateLinkResourceId"` + PrivateLinkResourceRegion *string `json:"privateLinkResourceRegion,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RequestMessage *string `json:"requestMessage,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpointschecknamerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpointschecknamerequest.go new file mode 100644 index 000000000000..fe3a38bb88cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/model_managedprivateendpointschecknamerequest.go @@ -0,0 +1,9 @@ +package managedprivateendpoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedPrivateEndpointsCheckNameRequest struct { + Name string `json:"name"` + Type ManagedPrivateEndpointsType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/version.go new file mode 100644 index 000000000000..b6479d054eb7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints/version.go @@ -0,0 +1,12 @@ +package managedprivateendpoints + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/managedprivateendpoints/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/README.md new file mode 100644 index 000000000000..cfe25329d40c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/README.md @@ -0,0 +1,119 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts` Documentation + +The `scripts` SDK allows for interaction with the Azure Resource Manager Service `kusto` (API Version `2022-02-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts" +``` + + +### Client Initialization + +```go +client := scripts.NewScriptsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ScriptsClient.CheckNameAvailability` + +```go +ctx := context.TODO() +id := scripts.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +payload := scripts.ScriptCheckNameRequest{ + // ... +} + + +read, err := client.CheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ScriptsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := scripts.NewScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue", "scriptValue") + +payload := scripts.Script{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ScriptsClient.Delete` + +```go +ctx := context.TODO() +id := scripts.NewScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue", "scriptValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ScriptsClient.Get` + +```go +ctx := context.TODO() +id := scripts.NewScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue", "scriptValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ScriptsClient.ListByDatabase` + +```go +ctx := context.TODO() +id := scripts.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue") + +read, err := client.ListByDatabase(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ScriptsClient.Update` + +```go +ctx := context.TODO() +id := scripts.NewScriptID("12345678-1234-9876-4563-123456789012", "example-resource-group", "clusterValue", "databaseValue", "scriptValue") + +payload := scripts.Script{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/client.go new file mode 100644 index 000000000000..5d4ca209622f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/client.go @@ -0,0 +1,18 @@ +package scripts + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScriptsClient struct { + Client autorest.Client + baseUri string +} + +func NewScriptsClientWithBaseURI(endpoint string) ScriptsClient { + return ScriptsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/constants.go new file mode 100644 index 000000000000..1d7cf31947dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/constants.go @@ -0,0 +1,99 @@ +package scripts + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateRunning ProvisioningState = "Running" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateMoving), + string(ProvisioningStateRunning), + string(ProvisioningStateSucceeded), + } +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "moving": ProvisioningStateMoving, + "running": ProvisioningStateRunning, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type Reason string + +const ( + ReasonAlreadyExists Reason = "AlreadyExists" + ReasonInvalid Reason = "Invalid" +) + +func PossibleValuesForReason() []string { + return []string{ + string(ReasonAlreadyExists), + string(ReasonInvalid), + } +} + +func parseReason(input string) (*Reason, error) { + vals := map[string]Reason{ + "alreadyexists": ReasonAlreadyExists, + "invalid": ReasonInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Reason(input) + return &out, nil +} + +type ScriptType string + +const ( + ScriptTypeMicrosoftPointKustoClustersDatabasesScripts ScriptType = "Microsoft.Kusto/clusters/databases/scripts" +) + +func PossibleValuesForScriptType() []string { + return []string{ + string(ScriptTypeMicrosoftPointKustoClustersDatabasesScripts), + } +} + +func parseScriptType(input string) (*ScriptType, error) { + vals := map[string]ScriptType{ + "microsoft.kusto/clusters/databases/scripts": ScriptTypeMicrosoftPointKustoClustersDatabasesScripts, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ScriptType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/id_database.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/id_database.go new file mode 100644 index 000000000000..9e72fae81c1a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/id_database.go @@ -0,0 +1,137 @@ +package scripts + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = DatabaseId{} + +// DatabaseId is a struct representing the Resource ID for a Database +type DatabaseId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + DatabaseName string +} + +// NewDatabaseID returns a new DatabaseId struct +func NewDatabaseID(subscriptionId string, resourceGroupName string, clusterName string, databaseName string) DatabaseId { + return DatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + DatabaseName: databaseName, + } +} + +// ParseDatabaseID parses 'input' into a DatabaseId +func ParseDatabaseID(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseDatabaseIDInsensitively parses 'input' case-insensitively into a DatabaseId +// note: this method should only be used for API response data and not user input +func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(DatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := DatabaseId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateDatabaseID checks that 'input' can be parsed as a Database ID +func ValidateDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database ID +func (id DatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database ID +func (id DatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + } +} + +// String returns a human-readable description of this Database ID +func (id DatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/id_script.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/id_script.go new file mode 100644 index 000000000000..53f561d48c64 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/id_script.go @@ -0,0 +1,150 @@ +package scripts + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScriptId{} + +// ScriptId is a struct representing the Resource ID for a Script +type ScriptId struct { + SubscriptionId string + ResourceGroupName string + ClusterName string + DatabaseName string + ScriptName string +} + +// NewScriptID returns a new ScriptId struct +func NewScriptID(subscriptionId string, resourceGroupName string, clusterName string, databaseName string, scriptName string) ScriptId { + return ScriptId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ClusterName: clusterName, + DatabaseName: databaseName, + ScriptName: scriptName, + } +} + +// ParseScriptID parses 'input' into a ScriptId +func ParseScriptID(input string) (*ScriptId, error) { + parser := resourceids.NewParserFromResourceIdType(ScriptId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScriptId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + if id.ScriptName, ok = parsed.Parsed["scriptName"]; !ok { + return nil, fmt.Errorf("the segment 'scriptName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScriptIDInsensitively parses 'input' case-insensitively into a ScriptId +// note: this method should only be used for API response data and not user input +func ParseScriptIDInsensitively(input string) (*ScriptId, error) { + parser := resourceids.NewParserFromResourceIdType(ScriptId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScriptId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { + return nil, fmt.Errorf("the segment 'clusterName' was not found in the resource id %q", input) + } + + if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { + return nil, fmt.Errorf("the segment 'databaseName' was not found in the resource id %q", input) + } + + if id.ScriptName, ok = parsed.Parsed["scriptName"]; !ok { + return nil, fmt.Errorf("the segment 'scriptName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScriptID checks that 'input' can be parsed as a Script ID +func ValidateScriptID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScriptID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Script ID +func (id ScriptId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Kusto/clusters/%s/databases/%s/scripts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ClusterName, id.DatabaseName, id.ScriptName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Script ID +func (id ScriptId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftKusto", "Microsoft.Kusto", "Microsoft.Kusto"), + resourceids.StaticSegment("staticClusters", "clusters", "clusters"), + resourceids.UserSpecifiedSegment("clusterName", "clusterValue"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseValue"), + resourceids.StaticSegment("staticScripts", "scripts", "scripts"), + resourceids.UserSpecifiedSegment("scriptName", "scriptValue"), + } +} + +// String returns a human-readable description of this Script ID +func (id ScriptId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cluster Name: %q", id.ClusterName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Script Name: %q", id.ScriptName), + } + return fmt.Sprintf("Script (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_checknameavailability_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_checknameavailability_autorest.go new file mode 100644 index 000000000000..5c53c0dcb287 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_checknameavailability_autorest.go @@ -0,0 +1,70 @@ +package scripts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + Model *CheckNameResult +} + +// CheckNameAvailability ... +func (c ScriptsClient) CheckNameAvailability(ctx context.Context, id DatabaseId, input ScriptCheckNameRequest) (result CheckNameAvailabilityOperationResponse, err error) { + req, err := c.preparerForCheckNameAvailability(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "CheckNameAvailability", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCheckNameAvailability(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "CheckNameAvailability", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCheckNameAvailability prepares the CheckNameAvailability request. +func (c ScriptsClient) preparerForCheckNameAvailability(ctx context.Context, id DatabaseId, input ScriptCheckNameRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/scriptsCheckNameAvailability", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCheckNameAvailability handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (c ScriptsClient) responderForCheckNameAvailability(resp *http.Response) (result CheckNameAvailabilityOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_createorupdate_autorest.go new file mode 100644 index 000000000000..1313d11653bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package scripts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c ScriptsClient) CreateOrUpdate(ctx context.Context, id ScriptId, input Script) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c ScriptsClient) CreateOrUpdateThenPoll(ctx context.Context, id ScriptId, input Script) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c ScriptsClient) preparerForCreateOrUpdate(ctx context.Context, id ScriptId, input Script) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ScriptsClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_delete_autorest.go new file mode 100644 index 000000000000..628884654aaa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_delete_autorest.go @@ -0,0 +1,78 @@ +package scripts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c ScriptsClient) Delete(ctx context.Context, id ScriptId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c ScriptsClient) DeleteThenPoll(ctx context.Context, id ScriptId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c ScriptsClient) preparerForDelete(ctx context.Context, id ScriptId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c ScriptsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_get_autorest.go new file mode 100644 index 000000000000..2c58e075a2fb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_get_autorest.go @@ -0,0 +1,68 @@ +package scripts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Script +} + +// Get ... +func (c ScriptsClient) Get(ctx context.Context, id ScriptId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c ScriptsClient) preparerForGet(ctx context.Context, id ScriptId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c ScriptsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_listbydatabase_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_listbydatabase_autorest.go new file mode 100644 index 000000000000..f6194702a46a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_listbydatabase_autorest.go @@ -0,0 +1,69 @@ +package scripts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByDatabaseOperationResponse struct { + HttpResponse *http.Response + Model *ScriptListResult +} + +// ListByDatabase ... +func (c ScriptsClient) ListByDatabase(ctx context.Context, id DatabaseId) (result ListByDatabaseOperationResponse, err error) { + req, err := c.preparerForListByDatabase(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "ListByDatabase", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "ListByDatabase", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForListByDatabase(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "ListByDatabase", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForListByDatabase prepares the ListByDatabase request. +func (c ScriptsClient) preparerForListByDatabase(ctx context.Context, id DatabaseId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/scripts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForListByDatabase handles the response to the ListByDatabase request. The method always +// closes the http.Response Body. +func (c ScriptsClient) responderForListByDatabase(resp *http.Response) (result ListByDatabaseOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_update_autorest.go new file mode 100644 index 000000000000..d797971176c9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/method_update_autorest.go @@ -0,0 +1,79 @@ +package scripts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c ScriptsClient) Update(ctx context.Context, id ScriptId, input Script) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "scripts.ScriptsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c ScriptsClient) UpdateThenPoll(ctx context.Context, id ScriptId, input Script) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c ScriptsClient) preparerForUpdate(ctx context.Context, id ScriptId, input Script) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c ScriptsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_checknameresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_checknameresult.go new file mode 100644 index 000000000000..f6390a72d51b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_checknameresult.go @@ -0,0 +1,11 @@ +package scripts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameResult struct { + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *Reason `json:"reason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_script.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_script.go new file mode 100644 index 000000000000..904bee616776 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_script.go @@ -0,0 +1,16 @@ +package scripts + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Script struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *ScriptProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_scriptchecknamerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_scriptchecknamerequest.go new file mode 100644 index 000000000000..7fa462b41d79 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_scriptchecknamerequest.go @@ -0,0 +1,9 @@ +package scripts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScriptCheckNameRequest struct { + Name string `json:"name"` + Type ScriptType `json:"type"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_scriptlistresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_scriptlistresult.go new file mode 100644 index 000000000000..caa95ca23244 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_scriptlistresult.go @@ -0,0 +1,8 @@ +package scripts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScriptListResult struct { + Value *[]Script `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_scriptproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_scriptproperties.go new file mode 100644 index 000000000000..c7494a45fd3f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/model_scriptproperties.go @@ -0,0 +1,13 @@ +package scripts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScriptProperties struct { + ContinueOnErrors *bool `json:"continueOnErrors,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ScriptContent *string `json:"scriptContent,omitempty"` + ScriptUrl *string `json:"scriptUrl,omitempty"` + ScriptUrlSasToken *string `json:"scriptUrlSasToken,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/version.go new file mode 100644 index 000000000000..047c79f2c18b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts/version.go @@ -0,0 +1,12 @@ +package scripts + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-02-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/scripts/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index af727a7ac4a0..d225bbc773d4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -20,7 +20,6 @@ github.com/Azure/azure-sdk-for-go/services/healthbot/mgmt/2020-12-08/healthbot github.com/Azure/azure-sdk-for-go/services/healthcareapis/mgmt/2021-11-01/healthcareapis github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault github.com/Azure/azure-sdk-for-go/services/keyvault/v7.1/keyvault -github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2022-02-01/kusto github.com/Azure/azure-sdk-for-go/services/logz/mgmt/2020-10-01/logz github.com/Azure/azure-sdk-for-go/services/marketplaceordering/mgmt/2015-06-01/marketplaceordering github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2020-10-01/insights @@ -324,6 +323,14 @@ github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/d github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories github.com/hashicorp/go-azure-sdk/resource-manager/insights/2021-08-01/scheduledqueryrules github.com/hashicorp/go-azure-sdk/resource-manager/iotcentral/2021-11-01-preview/apps +github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/attacheddatabaseconfigurations +github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusterprincipalassignments +github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/clusters +github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databaseprincipalassignments +github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/databases +github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/dataconnections +github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/managedprivateendpoints +github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-02-01/scripts github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2022-07-07/clusters github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/lab github.com/hashicorp/go-azure-sdk/resource-manager/labservices/2022-08-01/labplan From 83be536cdb46e64438f856deb093953dcff001aa Mon Sep 17 00:00:00 2001 From: Yun Liu Date: Fri, 17 Feb 2023 17:11:34 +0800 Subject: [PATCH 2/2] Fix TestAccKustoClusterCustomerManagedKey_basic --- .../kusto_cluster_customer_managed_key_resource.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/internal/services/kusto/kusto_cluster_customer_managed_key_resource.go b/internal/services/kusto/kusto_cluster_customer_managed_key_resource.go index a451e71851ca..c62a68396d16 100644 --- a/internal/services/kusto/kusto_cluster_customer_managed_key_resource.go +++ b/internal/services/kusto/kusto_cluster_customer_managed_key_resource.go @@ -261,17 +261,13 @@ func resourceKustoClusterCustomerManagedKeyDelete(d *pluginsdk.ResourceData, met // "Delete" doesn't really make sense it should really be a "Revert to Default" // So instead of the Delete func actually deleting the Kusto Cluster I am // making it reset the Kusto cluster to its default state - props := cluster.Model - if props == nil { - return fmt.Errorf("retrieving Kusto Cluster %q (Resource Group %q): cluster.Model is nil", clusterID.ClusterName, clusterID.ResourceGroupName) - } - - if props.Properties != nil && props.Properties.KeyVaultProperties != nil { - props.Properties.KeyVaultProperties = &clusters.KeyVaultProperties{} + props := clusters.ClusterUpdate{ + Properties: &clusters.ClusterProperties{ + KeyVaultProperties: &clusters.KeyVaultProperties{}, + }, } - // Using PUT since PATCH is not supported and will return Internal Server Error. - err = client.CreateOrUpdateThenPoll(ctx, *clusterID, *props, clusters.CreateOrUpdateOperationOptions{}) + err = client.UpdateThenPoll(ctx, *clusterID, props, clusters.UpdateOperationOptions{}) if err != nil { return fmt.Errorf("removing Customer Managed Key for Kusto Cluster %q (Resource Group %q): %+v", clusterID.ClusterName, clusterID.ResourceGroupName, err) }