Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions azure-mgmt-kusto/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
recursive-include tests *.py *.yaml
include *.rst
include azure/__init__.py
include azure/mgmt/__init__.py
Expand Down
5 changes: 5 additions & 0 deletions azure-mgmt-kusto/azure/mgmt/kusto/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from .data_connection_validation_list_result_py3 import DataConnectionValidationListResult
from .cluster_check_name_request_py3 import ClusterCheckNameRequest
from .database_check_name_request_py3 import DatabaseCheckNameRequest
from .data_connection_check_name_request_py3 import DataConnectionCheckNameRequest
from .check_name_result_py3 import CheckNameResult
from .operation_display_py3 import OperationDisplay
from .operation_py3 import Operation
Expand Down Expand Up @@ -58,6 +59,7 @@
from .data_connection_validation_list_result import DataConnectionValidationListResult
from .cluster_check_name_request import ClusterCheckNameRequest
from .database_check_name_request import DatabaseCheckNameRequest
from .data_connection_check_name_request import DataConnectionCheckNameRequest
from .check_name_result import CheckNameResult
from .operation_display import OperationDisplay
from .operation import Operation
Expand All @@ -80,6 +82,7 @@
DataFormat,
DatabasePrincipalRole,
DatabasePrincipalType,
Reason,
)

__all__ = [
Expand All @@ -103,6 +106,7 @@
'DataConnectionValidationListResult',
'ClusterCheckNameRequest',
'DatabaseCheckNameRequest',
'DataConnectionCheckNameRequest',
'CheckNameResult',
'OperationDisplay',
'Operation',
Expand All @@ -124,4 +128,5 @@
'DataFormat',
'DatabasePrincipalRole',
'DatabasePrincipalType',
'Reason',
]
5 changes: 5 additions & 0 deletions azure-mgmt-kusto/azure/mgmt/kusto/models/check_name_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,21 @@ class CheckNameResult(Model):
:param message: Message indicating an unavailable name due to a conflict,
or a description of the naming rules that are violated.
:type message: str
:param reason: Message providing the reason why the given name is invalid.
Possible values include: 'Invalid', 'AlreadyExists'
:type reason: str or ~azure.mgmt.kusto.models.Reason
"""

_attribute_map = {
'name_available': {'key': 'nameAvailable', 'type': 'bool'},
'name': {'key': 'name', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
'reason': {'key': 'reason', 'type': 'str'},
}

def __init__(self, **kwargs):
super(CheckNameResult, self).__init__(**kwargs)
self.name_available = kwargs.get('name_available', None)
self.name = kwargs.get('name', None)
self.message = kwargs.get('message', None)
self.reason = kwargs.get('reason', None)
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,21 @@ class CheckNameResult(Model):
:param message: Message indicating an unavailable name due to a conflict,
or a description of the naming rules that are violated.
:type message: str
:param reason: Message providing the reason why the given name is invalid.
Possible values include: 'Invalid', 'AlreadyExists'
:type reason: str or ~azure.mgmt.kusto.models.Reason
"""

_attribute_map = {
'name_available': {'key': 'nameAvailable', 'type': 'bool'},
'name': {'key': 'name', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
'reason': {'key': 'reason', 'type': 'str'},
}

def __init__(self, *, name_available: bool=None, name: str=None, message: str=None, **kwargs) -> None:
def __init__(self, *, name_available: bool=None, name: str=None, message: str=None, reason=None, **kwargs) -> None:
super(CheckNameResult, self).__init__(**kwargs)
self.name_available = name_available
self.name = name
self.message = message
self.reason = reason
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class DataConnectionCheckNameRequest(Model):
"""The result returned from a data connections 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. Data Connection name.
:type name: str
:ivar type: Required. The type of resource,
Microsoft.Kusto/clusters/databases/dataConnections. Default value:
"Microsoft.Kusto/clusters/databases/dataConnections" .
:vartype type: str
"""

_validation = {
'name': {'required': True},
'type': {'required': True, 'constant': True},
}

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}

type = "Microsoft.Kusto/clusters/databases/dataConnections"

def __init__(self, **kwargs):
super(DataConnectionCheckNameRequest, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class DataConnectionCheckNameRequest(Model):
"""The result returned from a data connections 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. Data Connection name.
:type name: str
:ivar type: Required. The type of resource,
Microsoft.Kusto/clusters/databases/dataConnections. Default value:
"Microsoft.Kusto/clusters/databases/dataConnections" .
:vartype type: str
"""

_validation = {
'name': {'required': True},
'type': {'required': True, 'constant': True},
}

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}

type = "Microsoft.Kusto/clusters/databases/dataConnections"

def __init__(self, *, name: str, **kwargs) -> None:
super(DataConnectionCheckNameRequest, self).__init__(**kwargs)
self.name = name
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,9 @@ class DatabasePrincipalType(str, Enum):
app = "App"
group = "Group"
user = "User"


class Reason(str, Enum):

invalid = "Invalid"
already_exists = "AlreadyExists"
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,81 @@ def data_connection_validation_method(
return deserialized
data_connection_validation_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnectionValidation'}

def check_name_availability(
self, resource_group_name, cluster_name, database_name, name, custom_headers=None, raw=False, **operation_config):
"""Checks that the data connection name is valid and is not already in
use.

: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 database_name: The name of the database in the Kusto cluster.
:type database_name: str
:param name: Data Connection name.
:type 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<msrest:optionsforoperations>`.
:return: CheckNameResult or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.kusto.models.CheckNameResult or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
data_connection_name = models.DataConnectionCheckNameRequest(name=name)

# Construct URL
url = self.check_name_availability.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'),
'databaseName': self._serialize.url("database_name", database_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(data_connection_name, 'DataConnectionCheckNameRequest')

# 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]:
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('CheckNameResult', response)

if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response

return deserialized
check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkNameAvailability'}

def get(
self, resource_group_name, cluster_name, database_name, data_connection_name, custom_headers=None, raw=False, **operation_config):
"""Returns a data connection.
Expand Down
2 changes: 1 addition & 1 deletion azure-mgmt-kusto/azure/mgmt/kusto/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
# regenerated.
# --------------------------------------------------------------------------

VERSION = "0.3.0"
VERSION = "0.1.0"

1 change: 1 addition & 0 deletions azure-mgmt-kusto/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
version=version,
description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME),
long_description=readme + '\n\n' + history,
long_description_content_type='text/x-rst',
license='MIT License',
author='Microsoft Corporation',
author_email='[email protected]',
Expand Down