diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/README.md b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/README.md index b8b533f4ba3c..c4de97ec00cc 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/README.md +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/README.md @@ -4,6 +4,13 @@ This is the Microsoft Azure HybridKubernetes Management Client Library. This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +# Usage + +For code examples, see [HybridKubernetes Management](https://docs.microsoft.com/python/api/overview/azure/hybrid-kubernetes) +on docs.microsoft.com. + + # Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/__init__.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/__init__.py index b6b8458a7602..558a6bbeba6c 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/__init__.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/__init__.py @@ -10,6 +10,9 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import AuthenticationCertificateDetails + from ._models_py3 import AuthenticationDetails + from ._models_py3 import AuthenticationDetailsValue from ._models_py3 import AzureEntityResource from ._models_py3 import ConnectedCluster from ._models_py3 import ConnectedClusterAADProfile @@ -25,6 +28,9 @@ from ._models_py3 import Resource from ._models_py3 import TrackedResource except (SyntaxError, ImportError): + from ._models import AuthenticationCertificateDetails + from ._models import AuthenticationDetails + from ._models import AuthenticationDetailsValue from ._models import AzureEntityResource from ._models import ConnectedCluster from ._models import ConnectedClusterAADProfile @@ -44,9 +50,13 @@ from ._connected_kubernetes_client_enums import ( ResourceIdentityType, ProvisioningState, + AuthenticationMethod, ) __all__ = [ + 'AuthenticationCertificateDetails', + 'AuthenticationDetails', + 'AuthenticationDetailsValue', 'AzureEntityResource', 'ConnectedCluster', 'ConnectedClusterAADProfile', @@ -65,4 +75,5 @@ 'OperationPaged', 'ResourceIdentityType', 'ProvisioningState', + 'AuthenticationMethod', ] diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_connected_kubernetes_client_enums.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_connected_kubernetes_client_enums.py index 0f8d53fe2bb1..ab7d26e269e1 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_connected_kubernetes_client_enums.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_connected_kubernetes_client_enums.py @@ -27,3 +27,9 @@ class ProvisioningState(str, Enum): updating = "Updating" deleting = "Deleting" accepted = "Accepted" + + +class AuthenticationMethod(str, Enum): + + token = "Token" + client_certificate = "ClientCertificate" diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_models.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_models.py index 492f353d8bcc..61d0767690d2 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_models.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_models.py @@ -13,6 +13,84 @@ from msrest.exceptions import HttpOperationError +class AuthenticationCertificateDetails(Model): + """AuthenticationCertificateDetails. + + All required parameters must be populated in order to send to Azure. + + :param certificate_data: Required. Base64 encoded client certificate data. + :type certificate_data: str + :param key_data: Required. Base64 encoded key data. + :type key_data: str + """ + + _validation = { + 'certificate_data': {'required': True}, + 'key_data': {'required': True}, + } + + _attribute_map = { + 'certificate_data': {'key': 'certificateData', 'type': 'str'}, + 'key_data': {'key': 'keyData', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AuthenticationCertificateDetails, self).__init__(**kwargs) + self.certificate_data = kwargs.get('certificate_data', None) + self.key_data = kwargs.get('key_data', None) + + +class AuthenticationDetails(Model): + """AuthenticationDetails. + + All required parameters must be populated in order to send to Azure. + + :param authentication_method: Required. The mode of client authentication. + Possible values include: 'Token', 'ClientCertificate' + :type authentication_method: str or + ~azure.mgmt.hybridkubernetes.models.AuthenticationMethod + :param value: Required. + :type value: + ~azure.mgmt.hybridkubernetes.models.AuthenticationDetailsValue + """ + + _validation = { + 'authentication_method': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'authentication_method': {'key': 'authenticationMethod', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'AuthenticationDetailsValue'}, + } + + def __init__(self, **kwargs): + super(AuthenticationDetails, self).__init__(**kwargs) + self.authentication_method = kwargs.get('authentication_method', None) + self.value = kwargs.get('value', None) + + +class AuthenticationDetailsValue(Model): + """AuthenticationDetailsValue. + + :param token: Authentication token. + :type token: str + :param client_certificate: + :type client_certificate: + ~azure.mgmt.hybridkubernetes.models.AuthenticationCertificateDetails + """ + + _attribute_map = { + 'token': {'key': 'token', 'type': 'str'}, + 'client_certificate': {'key': 'clientCertificate', 'type': 'AuthenticationCertificateDetails'}, + } + + def __init__(self, **kwargs): + super(AuthenticationDetailsValue, self).__init__(**kwargs) + self.token = kwargs.get('token', None) + self.client_certificate = kwargs.get('client_certificate', None) + + class Resource(Model): """Resource. diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_models_py3.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_models_py3.py index e31f6f78bae0..29b6d74425f7 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_models_py3.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/models/_models_py3.py @@ -13,6 +13,84 @@ from msrest.exceptions import HttpOperationError +class AuthenticationCertificateDetails(Model): + """AuthenticationCertificateDetails. + + All required parameters must be populated in order to send to Azure. + + :param certificate_data: Required. Base64 encoded client certificate data. + :type certificate_data: str + :param key_data: Required. Base64 encoded key data. + :type key_data: str + """ + + _validation = { + 'certificate_data': {'required': True}, + 'key_data': {'required': True}, + } + + _attribute_map = { + 'certificate_data': {'key': 'certificateData', 'type': 'str'}, + 'key_data': {'key': 'keyData', 'type': 'str'}, + } + + def __init__(self, *, certificate_data: str, key_data: str, **kwargs) -> None: + super(AuthenticationCertificateDetails, self).__init__(**kwargs) + self.certificate_data = certificate_data + self.key_data = key_data + + +class AuthenticationDetails(Model): + """AuthenticationDetails. + + All required parameters must be populated in order to send to Azure. + + :param authentication_method: Required. The mode of client authentication. + Possible values include: 'Token', 'ClientCertificate' + :type authentication_method: str or + ~azure.mgmt.hybridkubernetes.models.AuthenticationMethod + :param value: Required. + :type value: + ~azure.mgmt.hybridkubernetes.models.AuthenticationDetailsValue + """ + + _validation = { + 'authentication_method': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'authentication_method': {'key': 'authenticationMethod', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'AuthenticationDetailsValue'}, + } + + def __init__(self, *, authentication_method, value, **kwargs) -> None: + super(AuthenticationDetails, self).__init__(**kwargs) + self.authentication_method = authentication_method + self.value = value + + +class AuthenticationDetailsValue(Model): + """AuthenticationDetailsValue. + + :param token: Authentication token. + :type token: str + :param client_certificate: + :type client_certificate: + ~azure.mgmt.hybridkubernetes.models.AuthenticationCertificateDetails + """ + + _attribute_map = { + 'token': {'key': 'token', 'type': 'str'}, + 'client_certificate': {'key': 'clientCertificate', 'type': 'AuthenticationCertificateDetails'}, + } + + def __init__(self, *, token: str=None, client_certificate=None, **kwargs) -> None: + super(AuthenticationDetailsValue, self).__init__(**kwargs) + self.token = token + self.client_certificate = client_certificate + + class Resource(Model): """Resource. diff --git a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/_connected_cluster_operations.py b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/_connected_cluster_operations.py index 5629cc7b43ea..ee590d2d12b1 100644 --- a/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/_connected_cluster_operations.py +++ b/sdk/hybridkubernetes/azure-mgmt-hybridkubernetes/azure/mgmt/hybridkubernetes/operations/_connected_cluster_operations.py @@ -373,7 +373,7 @@ def get_long_running_output(response): delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}'} def list_cluster_user_credentials( - self, resource_group_name, cluster_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, cluster_name, authentication_method, value, custom_headers=None, raw=False, **operation_config): """Gets cluster user credentials of a connected cluster. Gets cluster user credentials of the connected cluster with a specified @@ -385,6 +385,13 @@ def list_cluster_user_credentials( :param cluster_name: The name of the Kubernetes cluster on which get is called. :type cluster_name: str + :param authentication_method: The mode of client authentication. + Possible values include: 'Token', 'ClientCertificate' + :type authentication_method: str or + ~azure.mgmt.hybridkubernetes.models.AuthenticationMethod + :param value: + :type value: + ~azure.mgmt.hybridkubernetes.models.AuthenticationDetailsValue :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -396,6 +403,10 @@ def list_cluster_user_credentials( :raises: :class:`ErrorResponseException` """ + client_authentication_details = None + if authentication_method is not None or value is not None: + client_authentication_details = models.AuthenticationDetails(authentication_method=authentication_method, value=value) + # Construct URL url = self.list_cluster_user_credentials.metadata['url'] path_format_arguments = { @@ -412,6 +423,7 @@ def list_cluster_user_credentials( # 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: @@ -419,8 +431,14 @@ def list_cluster_user_credentials( 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 + if client_authentication_details is not None: + body_content = self._serialize.body(client_authentication_details, 'AuthenticationDetails') + else: + body_content = None + # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + 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]: