diff --git a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py index ebe9457d0b32..9015ffbf96eb 100644 --- a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py +++ b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py @@ -15,6 +15,7 @@ from ._configuration import KustoManagementClientConfiguration from .operations import ClustersOperations from .operations import DatabasesOperations +from .operations import AttachedDatabaseConfigurationsOperations from .operations import DataConnectionsOperations from .operations import Operations from . import models @@ -30,6 +31,8 @@ class KustoManagementClient(SDKClient): :vartype clusters: azure.mgmt.kusto.operations.ClustersOperations :ivar databases: Databases operations :vartype databases: azure.mgmt.kusto.operations.DatabasesOperations + :ivar attached_database_configurations: AttachedDatabaseConfigurations operations + :vartype attached_database_configurations: azure.mgmt.kusto.operations.AttachedDatabaseConfigurationsOperations :ivar data_connections: DataConnections operations :vartype data_connections: azure.mgmt.kusto.operations.DataConnectionsOperations :ivar operations: Operations operations @@ -60,6 +63,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.databases = DatabasesOperations( self._client, self.config, self._serialize, self._deserialize) + self.attached_database_configurations = AttachedDatabaseConfigurationsOperations( + self._client, self.config, self._serialize, self._deserialize) self.data_connections = DataConnectionsOperations( self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( diff --git a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/__init__.py b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/__init__.py index 99ea6d04764b..8bb2947d1ab8 100644 --- a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/__init__.py +++ b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/__init__.py @@ -10,21 +10,21 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import AttachedDatabaseConfiguration from ._models_py3 import AzureCapacity from ._models_py3 import AzureEntityResource from ._models_py3 import AzureResourceSku from ._models_py3 import AzureSku + from ._models_py3 import CheckNameRequest from ._models_py3 import CheckNameResult from ._models_py3 import Cluster from ._models_py3 import ClusterCheckNameRequest from ._models_py3 import ClusterUpdate from ._models_py3 import Database - from ._models_py3 import DatabaseCheckNameRequest from ._models_py3 import DatabasePrincipal from ._models_py3 import DatabasePrincipalListRequest from ._models_py3 import DatabasePrincipalListResult from ._models_py3 import DatabaseStatistics - from ._models_py3 import DatabaseUpdate from ._models_py3 import DataConnection from ._models_py3 import DataConnectionCheckNameRequest from ._models_py3 import DataConnectionValidation @@ -32,6 +32,7 @@ from ._models_py3 import DataConnectionValidationResult from ._models_py3 import EventGridDataConnection from ._models_py3 import EventHubDataConnection + from ._models_py3 import FollowerDatabaseDefinition from ._models_py3 import Identity from ._models_py3 import IdentityUserAssignedIdentitiesValue from ._models_py3 import IotHubDataConnection @@ -40,6 +41,8 @@ from ._models_py3 import OperationDisplay from ._models_py3 import OptimizedAutoscale from ._models_py3 import ProxyResource + from ._models_py3 import ReadOnlyFollowingDatabase + from ._models_py3 import ReadWriteDatabase from ._models_py3 import Resource from ._models_py3 import SkuDescription from ._models_py3 import SkuLocationInfoItem @@ -47,21 +50,21 @@ from ._models_py3 import TrustedExternalTenant from ._models_py3 import VirtualNetworkConfiguration except (SyntaxError, ImportError): + from ._models import AttachedDatabaseConfiguration from ._models import AzureCapacity from ._models import AzureEntityResource from ._models import AzureResourceSku from ._models import AzureSku + from ._models import CheckNameRequest from ._models import CheckNameResult from ._models import Cluster from ._models import ClusterCheckNameRequest from ._models import ClusterUpdate from ._models import Database - from ._models import DatabaseCheckNameRequest from ._models import DatabasePrincipal from ._models import DatabasePrincipalListRequest from ._models import DatabasePrincipalListResult from ._models import DatabaseStatistics - from ._models import DatabaseUpdate from ._models import DataConnection from ._models import DataConnectionCheckNameRequest from ._models import DataConnectionValidation @@ -69,6 +72,7 @@ from ._models import DataConnectionValidationResult from ._models import EventGridDataConnection from ._models import EventHubDataConnection + from ._models import FollowerDatabaseDefinition from ._models import Identity from ._models import IdentityUserAssignedIdentitiesValue from ._models import IotHubDataConnection @@ -77,17 +81,21 @@ from ._models import OperationDisplay from ._models import OptimizedAutoscale from ._models import ProxyResource + from ._models import ReadOnlyFollowingDatabase + from ._models import ReadWriteDatabase from ._models import Resource from ._models import SkuDescription from ._models import SkuLocationInfoItem from ._models import TrackedResource from ._models import TrustedExternalTenant from ._models import VirtualNetworkConfiguration +from ._paged_models import AttachedDatabaseConfigurationPaged from ._paged_models import AzureResourceSkuPaged from ._paged_models import ClusterPaged from ._paged_models import DatabasePaged from ._paged_models import DatabasePrincipalPaged from ._paged_models import DataConnectionPaged +from ._paged_models import FollowerDatabaseDefinitionPaged from ._paged_models import OperationPaged from ._paged_models import SkuDescriptionPaged from ._kusto_management_client_enums import ( @@ -96,29 +104,32 @@ AzureSkuName, AzureSkuTier, AzureScaleType, + DefaultPrincipalsModificationKind, + PrincipalsModificationKind, DataFormat, IdentityType, DatabasePrincipalRole, DatabasePrincipalType, + Type, Reason, ) __all__ = [ + 'AttachedDatabaseConfiguration', 'AzureCapacity', 'AzureEntityResource', 'AzureResourceSku', 'AzureSku', + 'CheckNameRequest', 'CheckNameResult', 'Cluster', 'ClusterCheckNameRequest', 'ClusterUpdate', 'Database', - 'DatabaseCheckNameRequest', 'DatabasePrincipal', 'DatabasePrincipalListRequest', 'DatabasePrincipalListResult', 'DatabaseStatistics', - 'DatabaseUpdate', 'DataConnection', 'DataConnectionCheckNameRequest', 'DataConnectionValidation', @@ -126,6 +137,7 @@ 'DataConnectionValidationResult', 'EventGridDataConnection', 'EventHubDataConnection', + 'FollowerDatabaseDefinition', 'Identity', 'IdentityUserAssignedIdentitiesValue', 'IotHubDataConnection', @@ -134,17 +146,21 @@ 'OperationDisplay', 'OptimizedAutoscale', 'ProxyResource', + 'ReadOnlyFollowingDatabase', + 'ReadWriteDatabase', 'Resource', 'SkuDescription', 'SkuLocationInfoItem', 'TrackedResource', 'TrustedExternalTenant', 'VirtualNetworkConfiguration', + 'FollowerDatabaseDefinitionPaged', 'ClusterPaged', 'SkuDescriptionPaged', 'AzureResourceSkuPaged', 'DatabasePaged', 'DatabasePrincipalPaged', + 'AttachedDatabaseConfigurationPaged', 'DataConnectionPaged', 'OperationPaged', 'State', @@ -152,9 +168,12 @@ 'AzureSkuName', 'AzureSkuTier', 'AzureScaleType', + 'DefaultPrincipalsModificationKind', + 'PrincipalsModificationKind', 'DataFormat', 'IdentityType', 'DatabasePrincipalRole', 'DatabasePrincipalType', + 'Type', 'Reason', ] diff --git a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_kusto_management_client_enums.py b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_kusto_management_client_enums.py index 1c5be660520d..8f34ce88248b 100644 --- a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_kusto_management_client_enums.py +++ b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_kusto_management_client_enums.py @@ -64,6 +64,20 @@ class AzureScaleType(str, Enum): none = "none" +class DefaultPrincipalsModificationKind(str, Enum): + + union = "Union" + replace = "Replace" + none = "None" + + +class PrincipalsModificationKind(str, Enum): + + union = "Union" + replace = "Replace" + none = "None" + + class DataFormat(str, Enum): multijson = "MULTIJSON" @@ -103,6 +117,12 @@ class DatabasePrincipalType(str, Enum): user = "User" +class Type(str, Enum): + + microsoft_kustoclustersdatabases = "Microsoft.Kusto/clusters/databases" + microsoft_kustoclustersattached_database_configurations = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" + + class Reason(str, Enum): invalid = "Invalid" diff --git a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_models.py b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_models.py index 2aa67d414e2d..22690e034688 100644 --- a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_models.py +++ b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_models.py @@ -13,46 +13,44 @@ from msrest.exceptions import HttpOperationError -class AzureCapacity(Model): - """Azure capacity definition. +class Resource(Model): + """Resource. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when + sending a request. - :param scale_type: Required. Scale type. Possible values include: - 'automatic', 'manual', 'none' - :type scale_type: str or ~azure.mgmt.kusto.models.AzureScaleType - :param minimum: Required. Minimum allowed capacity. - :type minimum: int - :param maximum: Required. Maximum allowed capacity. - :type maximum: int - :param default: Required. The default capacity that would be used. - :type default: int + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str """ _validation = { - 'scale_type': {'required': True}, - 'minimum': {'required': True}, - 'maximum': {'required': True}, - 'default': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { - 'scale_type': {'key': 'scaleType', 'type': 'str'}, - 'minimum': {'key': 'minimum', 'type': 'int'}, - 'maximum': {'key': 'maximum', 'type': 'int'}, - 'default': {'key': 'default', 'type': 'int'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } def __init__(self, **kwargs): - super(AzureCapacity, self).__init__(**kwargs) - self.scale_type = kwargs.get('scale_type', None) - self.minimum = kwargs.get('minimum', None) - self.maximum = kwargs.get('maximum', None) - self.default = kwargs.get('default', None) + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class Resource(Model): - """Resource. +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. Variables are only populated by the server, and will be ignored when sending a request. @@ -80,10 +78,118 @@ class Resource(Model): } def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None + super(ProxyResource, self).__init__(**kwargs) + + +class AttachedDatabaseConfiguration(ProxyResource): + """Class representing an attached database configuration. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :ivar provisioning_state: The provisioned state of the resource. Possible + values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + 'Moving' + :vartype provisioning_state: str or + ~azure.mgmt.kusto.models.ProvisioningState + :param database_name: Required. The name of the database which you would + like to attach, use * if you want to follow all current and future + databases. + :type database_name: str + :param cluster_resource_id: Required. The resource id of the cluster where + the databases you would like to attach reside. + :type cluster_resource_id: str + :ivar attached_database_names: The list of databases from the + clusterResourceId which are currently attached to the cluster. + :vartype attached_database_names: list[str] + :param default_principals_modification_kind: Required. The default + principals modification kind. Possible values include: 'Union', 'Replace', + 'None' + :type default_principals_modification_kind: str or + ~azure.mgmt.kusto.models.DefaultPrincipalsModificationKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'database_name': {'required': True}, + 'cluster_resource_id': {'required': True}, + 'attached_database_names': {'readonly': True}, + 'default_principals_modification_kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, + 'cluster_resource_id': {'key': 'properties.clusterResourceId', 'type': 'str'}, + 'attached_database_names': {'key': 'properties.attachedDatabaseNames', 'type': '[str]'}, + 'default_principals_modification_kind': {'key': 'properties.defaultPrincipalsModificationKind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AttachedDatabaseConfiguration, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.provisioning_state = None + self.database_name = kwargs.get('database_name', None) + self.cluster_resource_id = kwargs.get('cluster_resource_id', None) + self.attached_database_names = None + self.default_principals_modification_kind = kwargs.get('default_principals_modification_kind', None) + + +class AzureCapacity(Model): + """Azure capacity definition. + + All required parameters must be populated in order to send to Azure. + + :param scale_type: Required. Scale type. Possible values include: + 'automatic', 'manual', 'none' + :type scale_type: str or ~azure.mgmt.kusto.models.AzureScaleType + :param minimum: Required. Minimum allowed capacity. + :type minimum: int + :param maximum: Required. Maximum allowed capacity. + :type maximum: int + :param default: Required. The default capacity that would be used. + :type default: int + """ + + _validation = { + 'scale_type': {'required': True}, + 'minimum': {'required': True}, + 'maximum': {'required': True}, + 'default': {'required': True}, + } + + _attribute_map = { + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(AzureCapacity, self).__init__(**kwargs) + self.scale_type = kwargs.get('scale_type', None) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + self.default = kwargs.get('default', None) class AzureEntityResource(Resource): @@ -184,6 +290,36 @@ def __init__(self, **kwargs): self.tier = kwargs.get('tier', None) +class CheckNameRequest(Model): + """The result returned from a database check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Resource name. + :type name: str + :param type: Required. The type of resource, for instance + Microsoft.Kusto/clusters/databases. Possible values include: + 'Microsoft.Kusto/clusters/databases', + 'Microsoft.Kusto/clusters/attachedDatabaseConfigurations' + :type type: str or ~azure.mgmt.kusto.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'Type'}, + } + + def __init__(self, **kwargs): + super(CheckNameRequest, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + class CheckNameResult(Model): """The result returned from a check name availability request. @@ -559,45 +695,17 @@ def __init__(self, **kwargs): self.key_vault_properties = kwargs.get('key_vault_properties', None) -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ProxyResource, self).__init__(**kwargs) - - class Database(ProxyResource): """Class representing a Kusto database. + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ReadWriteDatabase, ReadOnlyFollowingDatabase + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} :vartype id: str @@ -608,26 +716,15 @@ class Database(ProxyResource): :vartype type: str :param location: Resource location. :type location: str - :ivar provisioning_state: The provisioned state of the resource. Possible - values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', - 'Moving' - :vartype provisioning_state: str or - ~azure.mgmt.kusto.models.ProvisioningState - :param soft_delete_period: The time the data should be kept before it - stops being accessible to queries in TimeSpan. - :type soft_delete_period: timedelta - :param hot_cache_period: The time the data should be kept in cache for - fast queries in TimeSpan. - :type hot_cache_period: timedelta - :param statistics: The statistics of the database. - :type statistics: ~azure.mgmt.kusto.models.DatabaseStatistics + :param kind: Required. Constant filled by server. + :type kind: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + 'kind': {'required': True}, } _attribute_map = { @@ -635,52 +732,18 @@ class Database(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, - 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, - 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, - } - - def __init__(self, **kwargs): - super(Database, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.provisioning_state = None - self.soft_delete_period = kwargs.get('soft_delete_period', None) - self.hot_cache_period = kwargs.get('hot_cache_period', None) - self.statistics = kwargs.get('statistics', None) - - -class DatabaseCheckNameRequest(Model): - """The result returned from a database check name availability request. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Database name. - :type name: str - :ivar type: Required. The type of resource, - Microsoft.Kusto/clusters/databases. Default value: - "Microsoft.Kusto/clusters/databases" . - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, + 'kind': {'key': 'kind', 'type': 'str'}, } - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + _subtype_map = { + 'kind': {'ReadWrite': 'ReadWriteDatabase', 'ReadOnlyFollowing': 'ReadOnlyFollowingDatabase'} } - type = "Microsoft.Kusto/clusters/databases" - def __init__(self, **kwargs): - super(DatabaseCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + super(Database, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.kind = None + self.kind = 'Database' class DatabasePrincipal(Model): @@ -787,64 +850,6 @@ def __init__(self, **kwargs): self.size = kwargs.get('size', None) -class DatabaseUpdate(Resource): - """Class representing an update to a Kusto database. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - :param location: Resource location. - :type location: str - :ivar provisioning_state: The provisioned state of the resource. Possible - values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', - 'Moving' - :vartype provisioning_state: str or - ~azure.mgmt.kusto.models.ProvisioningState - :param soft_delete_period: The time the data should be kept before it - stops being accessible to queries in TimeSpan. - :type soft_delete_period: timedelta - :param hot_cache_period: The time the data should be kept in cache for - fast queries in TimeSpan. - :type hot_cache_period: timedelta - :param statistics: The statistics of the database. - :type statistics: ~azure.mgmt.kusto.models.DatabaseStatistics - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, - 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, - 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, - } - - def __init__(self, **kwargs): - super(DatabaseUpdate, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.provisioning_state = None - self.soft_delete_period = kwargs.get('soft_delete_period', None) - self.hot_cache_period = kwargs.get('hot_cache_period', None) - self.statistics = kwargs.get('statistics', None) - - class DataConnection(ProxyResource): """Class representing an data connection. @@ -1136,6 +1141,44 @@ def __init__(self, **kwargs): self.kind = 'EventHub' +class FollowerDatabaseDefinition(Model): + """A class representing follower database request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param cluster_resource_id: Required. Resource id of the cluster that + follows a database owned by this cluster. + :type cluster_resource_id: str + :param attached_database_configuration_name: Required. Resource name of + the attached database configuration in the follower cluster. + :type attached_database_configuration_name: str + :ivar database_name: The database name owned by this cluster that was + followed. * in case following all databases. + :vartype database_name: str + """ + + _validation = { + 'cluster_resource_id': {'required': True}, + 'attached_database_configuration_name': {'required': True}, + 'database_name': {'readonly': True}, + } + + _attribute_map = { + 'cluster_resource_id': {'key': 'clusterResourceId', 'type': 'str'}, + 'attached_database_configuration_name': {'key': 'attachedDatabaseConfigurationName', 'type': 'str'}, + 'database_name': {'key': 'databaseName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(FollowerDatabaseDefinition, self).__init__(**kwargs) + self.cluster_resource_id = kwargs.get('cluster_resource_id', None) + self.attached_database_configuration_name = kwargs.get('attached_database_configuration_name', None) + self.database_name = None + + class Identity(Model): """Identity for the resource. @@ -1416,6 +1459,153 @@ def __init__(self, **kwargs): self.maximum = kwargs.get('maximum', None) +class ReadOnlyFollowingDatabase(Database): + """Class representing a read only following database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Constant filled by server. + :type kind: str + :ivar provisioning_state: The provisioned state of the resource. Possible + values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + 'Moving' + :vartype provisioning_state: str or + ~azure.mgmt.kusto.models.ProvisioningState + :ivar soft_delete_period: The time the data should be kept before it stops + being accessible to queries in TimeSpan. + :vartype soft_delete_period: timedelta + :param hot_cache_period: The time the data should be kept in cache for + fast queries in TimeSpan. + :type hot_cache_period: timedelta + :param statistics: The statistics of the database. + :type statistics: ~azure.mgmt.kusto.models.DatabaseStatistics + :ivar leader_cluster_resource_id: The name of the leader cluster + :vartype leader_cluster_resource_id: str + :ivar attached_database_configuration_name: The name of the attached + database configuration cluster + :vartype attached_database_configuration_name: str + :ivar principals_modification_kind: The principals modification kind of + the database. Possible values include: 'Union', 'Replace', 'None' + :vartype principals_modification_kind: str or + ~azure.mgmt.kusto.models.PrincipalsModificationKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'soft_delete_period': {'readonly': True}, + 'leader_cluster_resource_id': {'readonly': True}, + 'attached_database_configuration_name': {'readonly': True}, + 'principals_modification_kind': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, + 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, + 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, + 'leader_cluster_resource_id': {'key': 'properties.leaderClusterResourceId', 'type': 'str'}, + 'attached_database_configuration_name': {'key': 'properties.attachedDatabaseConfigurationName', 'type': 'str'}, + 'principals_modification_kind': {'key': 'properties.principalsModificationKind', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ReadOnlyFollowingDatabase, self).__init__(**kwargs) + self.provisioning_state = None + self.soft_delete_period = None + self.hot_cache_period = kwargs.get('hot_cache_period', None) + self.statistics = kwargs.get('statistics', None) + self.leader_cluster_resource_id = None + self.attached_database_configuration_name = None + self.principals_modification_kind = None + self.kind = 'ReadOnlyFollowing' + + +class ReadWriteDatabase(Database): + """Class representing a read write database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Constant filled by server. + :type kind: str + :ivar provisioning_state: The provisioned state of the resource. Possible + values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + 'Moving' + :vartype provisioning_state: str or + ~azure.mgmt.kusto.models.ProvisioningState + :param soft_delete_period: The time the data should be kept before it + stops being accessible to queries in TimeSpan. + :type soft_delete_period: timedelta + :param hot_cache_period: The time the data should be kept in cache for + fast queries in TimeSpan. + :type hot_cache_period: timedelta + :param statistics: The statistics of the database. + :type statistics: ~azure.mgmt.kusto.models.DatabaseStatistics + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, + 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, + 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, + } + + def __init__(self, **kwargs): + super(ReadWriteDatabase, self).__init__(**kwargs) + self.provisioning_state = None + self.soft_delete_period = kwargs.get('soft_delete_period', None) + self.hot_cache_period = kwargs.get('hot_cache_period', None) + self.statistics = kwargs.get('statistics', None) + self.kind = 'ReadWrite' + + class SkuDescription(Model): """The Kusto SKU description of given resource type. diff --git a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_models_py3.py b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_models_py3.py index ec6957820c6b..888ba23cc2ed 100644 --- a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_models_py3.py +++ b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_models_py3.py @@ -13,46 +13,44 @@ from msrest.exceptions import HttpOperationError -class AzureCapacity(Model): - """Azure capacity definition. +class Resource(Model): + """Resource. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when + sending a request. - :param scale_type: Required. Scale type. Possible values include: - 'automatic', 'manual', 'none' - :type scale_type: str or ~azure.mgmt.kusto.models.AzureScaleType - :param minimum: Required. Minimum allowed capacity. - :type minimum: int - :param maximum: Required. Maximum allowed capacity. - :type maximum: int - :param default: Required. The default capacity that would be used. - :type default: int + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str """ _validation = { - 'scale_type': {'required': True}, - 'minimum': {'required': True}, - 'maximum': {'required': True}, - 'default': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { - 'scale_type': {'key': 'scaleType', 'type': 'str'}, - 'minimum': {'key': 'minimum', 'type': 'int'}, - 'maximum': {'key': 'maximum', 'type': 'int'}, - 'default': {'key': 'default', 'type': 'int'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, scale_type, minimum: int, maximum: int, default: int, **kwargs) -> None: - super(AzureCapacity, self).__init__(**kwargs) - self.scale_type = scale_type - self.minimum = minimum - self.maximum = maximum - self.default = default + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None -class Resource(Model): - """Resource. +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have + everything other than required location and tags. Variables are only populated by the server, and will be ignored when sending a request. @@ -80,10 +78,118 @@ class Resource(Model): } def __init__(self, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None + super(ProxyResource, self).__init__(**kwargs) + + +class AttachedDatabaseConfiguration(ProxyResource): + """Class representing an attached database configuration. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :ivar provisioning_state: The provisioned state of the resource. Possible + values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + 'Moving' + :vartype provisioning_state: str or + ~azure.mgmt.kusto.models.ProvisioningState + :param database_name: Required. The name of the database which you would + like to attach, use * if you want to follow all current and future + databases. + :type database_name: str + :param cluster_resource_id: Required. The resource id of the cluster where + the databases you would like to attach reside. + :type cluster_resource_id: str + :ivar attached_database_names: The list of databases from the + clusterResourceId which are currently attached to the cluster. + :vartype attached_database_names: list[str] + :param default_principals_modification_kind: Required. The default + principals modification kind. Possible values include: 'Union', 'Replace', + 'None' + :type default_principals_modification_kind: str or + ~azure.mgmt.kusto.models.DefaultPrincipalsModificationKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'database_name': {'required': True}, + 'cluster_resource_id': {'required': True}, + 'attached_database_names': {'readonly': True}, + 'default_principals_modification_kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, + 'cluster_resource_id': {'key': 'properties.clusterResourceId', 'type': 'str'}, + 'attached_database_names': {'key': 'properties.attachedDatabaseNames', 'type': '[str]'}, + 'default_principals_modification_kind': {'key': 'properties.defaultPrincipalsModificationKind', 'type': 'str'}, + } + + def __init__(self, *, database_name: str, cluster_resource_id: str, default_principals_modification_kind, location: str=None, **kwargs) -> None: + super(AttachedDatabaseConfiguration, self).__init__(**kwargs) + self.location = location + self.provisioning_state = None + self.database_name = database_name + self.cluster_resource_id = cluster_resource_id + self.attached_database_names = None + self.default_principals_modification_kind = default_principals_modification_kind + + +class AzureCapacity(Model): + """Azure capacity definition. + + All required parameters must be populated in order to send to Azure. + + :param scale_type: Required. Scale type. Possible values include: + 'automatic', 'manual', 'none' + :type scale_type: str or ~azure.mgmt.kusto.models.AzureScaleType + :param minimum: Required. Minimum allowed capacity. + :type minimum: int + :param maximum: Required. Maximum allowed capacity. + :type maximum: int + :param default: Required. The default capacity that would be used. + :type default: int + """ + + _validation = { + 'scale_type': {'required': True}, + 'minimum': {'required': True}, + 'maximum': {'required': True}, + 'default': {'required': True}, + } + + _attribute_map = { + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + } + + def __init__(self, *, scale_type, minimum: int, maximum: int, default: int, **kwargs) -> None: + super(AzureCapacity, self).__init__(**kwargs) + self.scale_type = scale_type + self.minimum = minimum + self.maximum = maximum + self.default = default class AzureEntityResource(Resource): @@ -184,6 +290,36 @@ def __init__(self, *, name, tier, capacity: int=None, **kwargs) -> None: self.tier = tier +class CheckNameRequest(Model): + """The result returned from a database check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Resource name. + :type name: str + :param type: Required. The type of resource, for instance + Microsoft.Kusto/clusters/databases. Possible values include: + 'Microsoft.Kusto/clusters/databases', + 'Microsoft.Kusto/clusters/attachedDatabaseConfigurations' + :type type: str or ~azure.mgmt.kusto.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'Type'}, + } + + def __init__(self, *, name: str, type, **kwargs) -> None: + super(CheckNameRequest, self).__init__(**kwargs) + self.name = name + self.type = type + + class CheckNameResult(Model): """The result returned from a check name availability request. @@ -559,45 +695,17 @@ def __init__(self, *, tags=None, location: str=None, sku=None, identity=None, tr self.key_vault_properties = key_vault_properties -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(ProxyResource, self).__init__(**kwargs) - - class Database(ProxyResource): """Class representing a Kusto database. + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ReadWriteDatabase, ReadOnlyFollowingDatabase + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} :vartype id: str @@ -608,26 +716,15 @@ class Database(ProxyResource): :vartype type: str :param location: Resource location. :type location: str - :ivar provisioning_state: The provisioned state of the resource. Possible - values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', - 'Moving' - :vartype provisioning_state: str or - ~azure.mgmt.kusto.models.ProvisioningState - :param soft_delete_period: The time the data should be kept before it - stops being accessible to queries in TimeSpan. - :type soft_delete_period: timedelta - :param hot_cache_period: The time the data should be kept in cache for - fast queries in TimeSpan. - :type hot_cache_period: timedelta - :param statistics: The statistics of the database. - :type statistics: ~azure.mgmt.kusto.models.DatabaseStatistics + :param kind: Required. Constant filled by server. + :type kind: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + 'kind': {'required': True}, } _attribute_map = { @@ -635,52 +732,18 @@ class Database(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, - 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, - 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, - } - - def __init__(self, *, location: str=None, soft_delete_period=None, hot_cache_period=None, statistics=None, **kwargs) -> None: - super(Database, self).__init__(**kwargs) - self.location = location - self.provisioning_state = None - self.soft_delete_period = soft_delete_period - self.hot_cache_period = hot_cache_period - self.statistics = statistics - - -class DatabaseCheckNameRequest(Model): - """The result returned from a database check name availability request. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Database name. - :type name: str - :ivar type: Required. The type of resource, - Microsoft.Kusto/clusters/databases. Default value: - "Microsoft.Kusto/clusters/databases" . - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, + 'kind': {'key': 'kind', 'type': 'str'}, } - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + _subtype_map = { + 'kind': {'ReadWrite': 'ReadWriteDatabase', 'ReadOnlyFollowing': 'ReadOnlyFollowingDatabase'} } - type = "Microsoft.Kusto/clusters/databases" - - def __init__(self, *, name: str, **kwargs) -> None: - super(DatabaseCheckNameRequest, self).__init__(**kwargs) - self.name = name + def __init__(self, *, location: str=None, **kwargs) -> None: + super(Database, self).__init__(**kwargs) + self.location = location + self.kind = None + self.kind = 'Database' class DatabasePrincipal(Model): @@ -787,64 +850,6 @@ def __init__(self, *, size: float=None, **kwargs) -> None: self.size = size -class DatabaseUpdate(Resource): - """Class representing an update to a Kusto database. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - :vartype id: str - :ivar name: The name of the resource - :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - :param location: Resource location. - :type location: str - :ivar provisioning_state: The provisioned state of the resource. Possible - values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', - 'Moving' - :vartype provisioning_state: str or - ~azure.mgmt.kusto.models.ProvisioningState - :param soft_delete_period: The time the data should be kept before it - stops being accessible to queries in TimeSpan. - :type soft_delete_period: timedelta - :param hot_cache_period: The time the data should be kept in cache for - fast queries in TimeSpan. - :type hot_cache_period: timedelta - :param statistics: The statistics of the database. - :type statistics: ~azure.mgmt.kusto.models.DatabaseStatistics - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, - 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, - 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, - } - - def __init__(self, *, location: str=None, soft_delete_period=None, hot_cache_period=None, statistics=None, **kwargs) -> None: - super(DatabaseUpdate, self).__init__(**kwargs) - self.location = location - self.provisioning_state = None - self.soft_delete_period = soft_delete_period - self.hot_cache_period = hot_cache_period - self.statistics = statistics - - class DataConnection(ProxyResource): """Class representing an data connection. @@ -1136,6 +1141,44 @@ def __init__(self, *, event_hub_resource_id: str, consumer_group: str, location: self.kind = 'EventHub' +class FollowerDatabaseDefinition(Model): + """A class representing follower database request. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param cluster_resource_id: Required. Resource id of the cluster that + follows a database owned by this cluster. + :type cluster_resource_id: str + :param attached_database_configuration_name: Required. Resource name of + the attached database configuration in the follower cluster. + :type attached_database_configuration_name: str + :ivar database_name: The database name owned by this cluster that was + followed. * in case following all databases. + :vartype database_name: str + """ + + _validation = { + 'cluster_resource_id': {'required': True}, + 'attached_database_configuration_name': {'required': True}, + 'database_name': {'readonly': True}, + } + + _attribute_map = { + 'cluster_resource_id': {'key': 'clusterResourceId', 'type': 'str'}, + 'attached_database_configuration_name': {'key': 'attachedDatabaseConfigurationName', 'type': 'str'}, + 'database_name': {'key': 'databaseName', 'type': 'str'}, + } + + def __init__(self, *, cluster_resource_id: str, attached_database_configuration_name: str, **kwargs) -> None: + super(FollowerDatabaseDefinition, self).__init__(**kwargs) + self.cluster_resource_id = cluster_resource_id + self.attached_database_configuration_name = attached_database_configuration_name + self.database_name = None + + class Identity(Model): """Identity for the resource. @@ -1416,6 +1459,153 @@ def __init__(self, *, version: int, is_enabled: bool, minimum: int, maximum: int self.maximum = maximum +class ReadOnlyFollowingDatabase(Database): + """Class representing a read only following database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Constant filled by server. + :type kind: str + :ivar provisioning_state: The provisioned state of the resource. Possible + values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + 'Moving' + :vartype provisioning_state: str or + ~azure.mgmt.kusto.models.ProvisioningState + :ivar soft_delete_period: The time the data should be kept before it stops + being accessible to queries in TimeSpan. + :vartype soft_delete_period: timedelta + :param hot_cache_period: The time the data should be kept in cache for + fast queries in TimeSpan. + :type hot_cache_period: timedelta + :param statistics: The statistics of the database. + :type statistics: ~azure.mgmt.kusto.models.DatabaseStatistics + :ivar leader_cluster_resource_id: The name of the leader cluster + :vartype leader_cluster_resource_id: str + :ivar attached_database_configuration_name: The name of the attached + database configuration cluster + :vartype attached_database_configuration_name: str + :ivar principals_modification_kind: The principals modification kind of + the database. Possible values include: 'Union', 'Replace', 'None' + :vartype principals_modification_kind: str or + ~azure.mgmt.kusto.models.PrincipalsModificationKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'soft_delete_period': {'readonly': True}, + 'leader_cluster_resource_id': {'readonly': True}, + 'attached_database_configuration_name': {'readonly': True}, + 'principals_modification_kind': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, + 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, + 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, + 'leader_cluster_resource_id': {'key': 'properties.leaderClusterResourceId', 'type': 'str'}, + 'attached_database_configuration_name': {'key': 'properties.attachedDatabaseConfigurationName', 'type': 'str'}, + 'principals_modification_kind': {'key': 'properties.principalsModificationKind', 'type': 'str'}, + } + + def __init__(self, *, location: str=None, hot_cache_period=None, statistics=None, **kwargs) -> None: + super(ReadOnlyFollowingDatabase, self).__init__(location=location, **kwargs) + self.provisioning_state = None + self.soft_delete_period = None + self.hot_cache_period = hot_cache_period + self.statistics = statistics + self.leader_cluster_resource_id = None + self.attached_database_configuration_name = None + self.principals_modification_kind = None + self.kind = 'ReadOnlyFollowing' + + +class ReadWriteDatabase(Database): + """Class representing a read write database. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Constant filled by server. + :type kind: str + :ivar provisioning_state: The provisioned state of the resource. Possible + values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', + 'Moving' + :vartype provisioning_state: str or + ~azure.mgmt.kusto.models.ProvisioningState + :param soft_delete_period: The time the data should be kept before it + stops being accessible to queries in TimeSpan. + :type soft_delete_period: timedelta + :param hot_cache_period: The time the data should be kept in cache for + fast queries in TimeSpan. + :type hot_cache_period: timedelta + :param statistics: The statistics of the database. + :type statistics: ~azure.mgmt.kusto.models.DatabaseStatistics + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, + 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, + 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, + } + + def __init__(self, *, location: str=None, soft_delete_period=None, hot_cache_period=None, statistics=None, **kwargs) -> None: + super(ReadWriteDatabase, self).__init__(location=location, **kwargs) + self.provisioning_state = None + self.soft_delete_period = soft_delete_period + self.hot_cache_period = hot_cache_period + self.statistics = statistics + self.kind = 'ReadWrite' + + class SkuDescription(Model): """The Kusto SKU description of given resource type. diff --git a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_paged_models.py b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_paged_models.py index f906cb2d1de8..326b581fd46b 100644 --- a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_paged_models.py +++ b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/models/_paged_models.py @@ -12,6 +12,19 @@ from msrest.paging import Paged +class FollowerDatabaseDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`FollowerDatabaseDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[FollowerDatabaseDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(FollowerDatabaseDefinitionPaged, self).__init__(*args, **kwargs) class ClusterPaged(Paged): """ A paging container for iterating over a list of :class:`Cluster ` object @@ -77,6 +90,19 @@ class DatabasePrincipalPaged(Paged): def __init__(self, *args, **kwargs): super(DatabasePrincipalPaged, self).__init__(*args, **kwargs) +class AttachedDatabaseConfigurationPaged(Paged): + """ + A paging container for iterating over a list of :class:`AttachedDatabaseConfiguration ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[AttachedDatabaseConfiguration]'} + } + + def __init__(self, *args, **kwargs): + + super(AttachedDatabaseConfigurationPaged, self).__init__(*args, **kwargs) class DataConnectionPaged(Paged): """ A paging container for iterating over a list of :class:`DataConnection ` object diff --git a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/__init__.py b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/__init__.py index d0aeb8c19c4d..9f5475ee05e1 100644 --- a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/__init__.py +++ b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/__init__.py @@ -11,12 +11,14 @@ from ._clusters_operations import ClustersOperations from ._databases_operations import DatabasesOperations +from ._attached_database_configurations_operations import AttachedDatabaseConfigurationsOperations from ._data_connections_operations import DataConnectionsOperations from ._operations import Operations __all__ = [ 'ClustersOperations', 'DatabasesOperations', + 'AttachedDatabaseConfigurationsOperations', 'DataConnectionsOperations', 'Operations', ] diff --git a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/_attached_database_configurations_operations.py b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/_attached_database_configurations_operations.py new file mode 100644 index 000000000000..05ff061d21e3 --- /dev/null +++ b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/_attached_database_configurations_operations.py @@ -0,0 +1,381 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class AttachedDatabaseConfigurationsOperations(object): + """AttachedDatabaseConfigurationsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client API Version. Constant value: "2019-09-07". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-09-07" + + self.config = config + + def list_by_cluster( + self, resource_group_name, cluster_name, custom_headers=None, raw=False, **operation_config): + """Returns the list of attached database configurations of the given Kusto + cluster. + + :param resource_group_name: The name of the resource group containing + the Kusto cluster. + :type resource_group_name: str + :param cluster_name: The name of the Kusto cluster. + :type cluster_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of AttachedDatabaseConfiguration + :rtype: + ~azure.mgmt.kusto.models.AttachedDatabaseConfigurationPaged[~azure.mgmt.kusto.models.AttachedDatabaseConfiguration] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_cluster.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.AttachedDatabaseConfigurationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations'} + + def get( + self, resource_group_name, cluster_name, attached_database_configuration_name, custom_headers=None, raw=False, **operation_config): + """Returns an attached database configuration. + + :param resource_group_name: The name of the resource group containing + the Kusto cluster. + :type resource_group_name: str + :param cluster_name: The name of the Kusto cluster. + :type cluster_name: str + :param attached_database_configuration_name: The name of the attached + database configuration. + :type attached_database_configuration_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AttachedDatabaseConfiguration or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.kusto.models.AttachedDatabaseConfiguration or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('AttachedDatabaseConfiguration', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} + + + def _create_or_update_initial( + self, resource_group_name, cluster_name, attached_database_configuration_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'AttachedDatabaseConfiguration') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AttachedDatabaseConfiguration', response) + if response.status_code == 201: + deserialized = self._deserialize('AttachedDatabaseConfiguration', response) + if response.status_code == 202: + deserialized = self._deserialize('AttachedDatabaseConfiguration', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, cluster_name, attached_database_configuration_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates an attached database configuration. + + :param resource_group_name: The name of the resource group containing + the Kusto cluster. + :type resource_group_name: str + :param cluster_name: The name of the Kusto cluster. + :type cluster_name: str + :param attached_database_configuration_name: The name of the attached + database configuration. + :type attached_database_configuration_name: str + :param parameters: The database parameters supplied to the + CreateOrUpdate operation. + :type parameters: + ~azure.mgmt.kusto.models.AttachedDatabaseConfiguration + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + AttachedDatabaseConfiguration or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.kusto.models.AttachedDatabaseConfiguration] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.kusto.models.AttachedDatabaseConfiguration]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + attached_database_configuration_name=attached_database_configuration_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('AttachedDatabaseConfiguration', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} + + + def _delete_initial( + self, resource_group_name, cluster_name, attached_database_configuration_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, cluster_name, attached_database_configuration_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes the attached database configuration with the given name. + + :param resource_group_name: The name of the resource group containing + the Kusto cluster. + :type resource_group_name: str + :param cluster_name: The name of the Kusto cluster. + :type cluster_name: str + :param attached_database_configuration_name: The name of the attached + database configuration. + :type attached_database_configuration_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + attached_database_configuration_name=attached_database_configuration_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} diff --git a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/_clusters_operations.py b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/_clusters_operations.py index b9b92b0afe19..91f51fd70e45 100644 --- a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/_clusters_operations.py +++ b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/_clusters_operations.py @@ -553,6 +553,174 @@ def get_long_running_output(response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start'} + def list_follower_databases( + self, resource_group_name, cluster_name, custom_headers=None, raw=False, **operation_config): + """Returns a list of databases that are owned by this cluster and were + followed by another cluster. + + :param resource_group_name: The name of the resource group containing + the Kusto cluster. + :type resource_group_name: str + :param cluster_name: The name of the Kusto cluster. + :type cluster_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of FollowerDatabaseDefinition + :rtype: + ~azure.mgmt.kusto.models.FollowerDatabaseDefinitionPaged[~azure.mgmt.kusto.models.FollowerDatabaseDefinition] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_follower_databases.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.FollowerDatabaseDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_follower_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listFollowerDatabases'} + + + def _detach_follower_databases_initial( + self, resource_group_name, cluster_name, cluster_resource_id, attached_database_configuration_name, custom_headers=None, raw=False, **operation_config): + follower_database_to_remove = models.FollowerDatabaseDefinition(cluster_resource_id=cluster_resource_id, attached_database_configuration_name=attached_database_configuration_name) + + # Construct URL + url = self.detach_follower_databases.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(follower_database_to_remove, 'FollowerDatabaseDefinition') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def detach_follower_databases( + self, resource_group_name, cluster_name, cluster_resource_id, attached_database_configuration_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Detaches all followers of a database owned by this cluster. + + :param resource_group_name: The name of the resource group containing + the Kusto cluster. + :type resource_group_name: str + :param cluster_name: The name of the Kusto cluster. + :type cluster_name: str + :param cluster_resource_id: Resource id of the cluster that follows a + database owned by this cluster. + :type cluster_resource_id: str + :param attached_database_configuration_name: Resource name of the + attached database configuration in the follower cluster. + :type attached_database_configuration_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._detach_follower_databases_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cluster_resource_id=cluster_resource_id, + attached_database_configuration_name=attached_database_configuration_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + detach_follower_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases'} + def list_by_resource_group( self, resource_group_name, custom_headers=None, raw=False, **operation_config): """Lists all Kusto clusters within a resource group. diff --git a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/_databases_operations.py b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/_databases_operations.py index 83cce2cef82e..b206b2ec40f5 100644 --- a/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/_databases_operations.py +++ b/sdk/azure-mgmt-kusto/azure/mgmt/kusto/operations/_databases_operations.py @@ -42,7 +42,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def check_name_availability( - self, resource_group_name, cluster_name, name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, cluster_name, name, type, custom_headers=None, raw=False, **operation_config): """Checks that the database name is valid and is not already in use. :param resource_group_name: The name of the resource group containing @@ -50,8 +50,13 @@ def check_name_availability( :type resource_group_name: str :param cluster_name: The name of the Kusto cluster. :type cluster_name: str - :param name: Database name. + :param name: Resource name. :type name: str + :param type: The type of resource, for instance + Microsoft.Kusto/clusters/databases. Possible values include: + 'Microsoft.Kusto/clusters/databases', + 'Microsoft.Kusto/clusters/attachedDatabaseConfigurations' + :type type: str or ~azure.mgmt.kusto.models.Type :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -62,7 +67,7 @@ def check_name_availability( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - database_name = models.DatabaseCheckNameRequest(name=name) + resource_name = models.CheckNameRequest(name=name, type=type) # Construct URL url = self.check_name_availability.metadata['url'] @@ -89,7 +94,7 @@ def check_name_availability( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(database_name, 'DatabaseCheckNameRequest') + body_content = self._serialize.body(resource_name, 'CheckNameRequest') # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) @@ -388,7 +393,7 @@ def _update_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'DatabaseUpdate') + body_content = self._serialize.body(parameters, 'Database') # Construct and send request request = self._client.patch(url, query_parameters, header_parameters, body_content) @@ -427,7 +432,7 @@ def update( :type database_name: str :param parameters: The database parameters supplied to the Update operation. - :type parameters: ~azure.mgmt.kusto.models.DatabaseUpdate + :type parameters: ~azure.mgmt.kusto.models.Database :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response