зеркало из
1
0
Форкнуть 0

Release azure mgmt hybridkubernetes (#11483)

* Generated from 3e3c09cb2ebcd9b902007bc0a344c3b71a10afe8

updated name

* initial release

* initial release

* Packaging update of azure-mgmt-hybridkubernetes

* Update version.py

Co-authored-by: SDK Automation <sdkautomation@microsoft.com>
Co-authored-by: Azure SDK Bot <aspysdk2@microsoft.com>
Co-authored-by: Zim Kalinowski <zikalino@microsoft.com>
This commit is contained in:
Wei Dong 2020-05-18 17:36:42 +08:00 коммит произвёл GitHub
Родитель a5e144795e
Коммит 4e48ee5871
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
22 изменённых файлов: 2177 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,5 @@
# Release History
## 0.1.0 (2020-05-18)
* Initial Release

Просмотреть файл

@ -0,0 +1,5 @@
recursive-include tests *.py *.yaml
include *.md
include azure/__init__.py
include azure/mgmt/__init__.py

Просмотреть файл

@ -0,0 +1,21 @@
# Microsoft Azure SDK for Python
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 [Github repo](https://github.com/Azure/azure-sdk-for-python/)
# 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
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-hybridkubernetes%2FREADME.png)

Просмотреть файл

@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

Просмотреть файл

@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)

Просмотреть файл

@ -0,0 +1,19 @@
# 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 ._configuration import ConnectedKubernetesClientConfiguration
from ._connected_kubernetes_client import ConnectedKubernetesClient
__all__ = ['ConnectedKubernetesClient', 'ConnectedKubernetesClientConfiguration']
from .version import VERSION
__version__ = VERSION

Просмотреть файл

@ -0,0 +1,48 @@
# 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 msrestazure import AzureConfiguration
from .version import VERSION
class ConnectedKubernetesClientConfiguration(AzureConfiguration):
"""Configuration for ConnectedKubernetesClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'
super(ConnectedKubernetesClientConfiguration, self).__init__(base_url)
# Starting Autorest.Python 4.0.64, make connection pool activated by default
self.keep_alive = True
self.add_user_agent('azure-mgmt-hybridkubernetes/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')
self.credentials = credentials
self.subscription_id = subscription_id

Просмотреть файл

@ -0,0 +1,54 @@
# 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.service_client import SDKClient
from msrest import Serializer, Deserializer
from ._configuration import ConnectedKubernetesClientConfiguration
from .operations import ConnectedClusterOperations
from .operations import Operations
from . import models
class ConnectedKubernetesClient(SDKClient):
"""Azure Connected Cluster Resource Provider API for adopting any Kubernetes Cluster
:ivar config: Configuration for client.
:vartype config: ConnectedKubernetesClientConfiguration
:ivar connected_cluster: ConnectedCluster operations
:vartype connected_cluster: azure.mgmt.hybridkubernetes.operations.ConnectedClusterOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.hybridkubernetes.operations.Operations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = ConnectedKubernetesClientConfiguration(credentials, subscription_id, base_url)
super(ConnectedKubernetesClient, self).__init__(self.config.credentials, self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2020-01-01-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.connected_cluster = ConnectedClusterOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)

Просмотреть файл

@ -0,0 +1,68 @@
# 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.
# --------------------------------------------------------------------------
try:
from ._models_py3 import AzureEntityResource
from ._models_py3 import ConnectedCluster
from ._models_py3 import ConnectedClusterAADProfile
from ._models_py3 import ConnectedClusterIdentity
from ._models_py3 import ConnectedClusterPatch
from ._models_py3 import CredentialResult
from ._models_py3 import CredentialResults
from ._models_py3 import ErrorDetails
from ._models_py3 import ErrorResponse, ErrorResponseException
from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import ProxyResource
from ._models_py3 import Resource
from ._models_py3 import TrackedResource
except (SyntaxError, ImportError):
from ._models import AzureEntityResource
from ._models import ConnectedCluster
from ._models import ConnectedClusterAADProfile
from ._models import ConnectedClusterIdentity
from ._models import ConnectedClusterPatch
from ._models import CredentialResult
from ._models import CredentialResults
from ._models import ErrorDetails
from ._models import ErrorResponse, ErrorResponseException
from ._models import Operation
from ._models import OperationDisplay
from ._models import ProxyResource
from ._models import Resource
from ._models import TrackedResource
from ._paged_models import ConnectedClusterPaged
from ._paged_models import OperationPaged
from ._connected_kubernetes_client_enums import (
ResourceIdentityType,
ProvisioningState,
)
__all__ = [
'AzureEntityResource',
'ConnectedCluster',
'ConnectedClusterAADProfile',
'ConnectedClusterIdentity',
'ConnectedClusterPatch',
'CredentialResult',
'CredentialResults',
'ErrorDetails',
'ErrorResponse', 'ErrorResponseException',
'Operation',
'OperationDisplay',
'ProxyResource',
'Resource',
'TrackedResource',
'ConnectedClusterPaged',
'OperationPaged',
'ResourceIdentityType',
'ProvisioningState',
]

Просмотреть файл

@ -0,0 +1,29 @@
# 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 enum import Enum
class ResourceIdentityType(str, Enum):
none = "None"
system_assigned = "SystemAssigned"
class ProvisioningState(str, Enum):
succeeded = "Succeeded"
failed = "Failed"
canceled = "Canceled"
provisioning = "Provisioning"
updating = "Updating"
deleting = "Deleting"
accepted = "Accepted"

Просмотреть файл

@ -0,0 +1,516 @@
# 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
from msrest.exceptions import HttpOperationError
class Resource(Model):
"""Resource.
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(Resource, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None
class AzureEntityResource(Resource):
"""The resource model definition for a Azure Resource Manager resource with an
etag.
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
:ivar etag: Resource Etag.
:vartype etag: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'etag': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
}
def __init__(self, **kwargs):
super(AzureEntityResource, self).__init__(**kwargs)
self.etag = None
class CloudError(Model):
"""CloudError.
"""
_attribute_map = {
}
class TrackedResource(Resource):
"""The resource model definition for a ARM tracked top level resource.
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 tags: Resource tags.
:type tags: dict[str, str]
:param location: Required. The geo-location where the resource lives
:type location: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
}
def __init__(self, **kwargs):
super(TrackedResource, self).__init__(**kwargs)
self.tags = kwargs.get('tags', None)
self.location = kwargs.get('location', None)
class ConnectedCluster(TrackedResource):
"""Represents a connected cluster.
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 tags: Resource tags.
:type tags: dict[str, str]
:param location: Required. The geo-location where the resource lives
:type location: str
:param identity: Required. The identity of the connected cluster.
:type identity:
~azure.mgmt.hybridkubernetes.models.ConnectedClusterIdentity
:param agent_public_key_certificate: Required. Base64 encoded public
certificate used by the agent to do the initial handshake to the backend
services in Azure.
:type agent_public_key_certificate: str
:param aad_profile: Required.
:type aad_profile:
~azure.mgmt.hybridkubernetes.models.ConnectedClusterAADProfile
:ivar kubernetes_version: The Kubernetes version of the connected cluster
resource
:vartype kubernetes_version: str
:ivar total_node_count: Number of nodes present in the connected cluster
resource
:vartype total_node_count: int
:ivar agent_version: Version of the agent running on the connected cluster
resource
:vartype agent_version: str
:param provisioning_state: Possible values include: 'Succeeded', 'Failed',
'Canceled', 'Provisioning', 'Updating', 'Deleting', 'Accepted'
:type provisioning_state: str or
~azure.mgmt.hybridkubernetes.models.ProvisioningState
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'identity': {'required': True},
'agent_public_key_certificate': {'required': True},
'aad_profile': {'required': True},
'kubernetes_version': {'readonly': True},
'total_node_count': {'readonly': True},
'agent_version': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'identity': {'key': 'identity', 'type': 'ConnectedClusterIdentity'},
'agent_public_key_certificate': {'key': 'properties.agentPublicKeyCertificate', 'type': 'str'},
'aad_profile': {'key': 'properties.aadProfile', 'type': 'ConnectedClusterAADProfile'},
'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'},
'total_node_count': {'key': 'properties.totalNodeCount', 'type': 'int'},
'agent_version': {'key': 'properties.agentVersion', 'type': 'str'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
}
def __init__(self, **kwargs):
super(ConnectedCluster, self).__init__(**kwargs)
self.identity = kwargs.get('identity', None)
self.agent_public_key_certificate = kwargs.get('agent_public_key_certificate', None)
self.aad_profile = kwargs.get('aad_profile', None)
self.kubernetes_version = None
self.total_node_count = None
self.agent_version = None
self.provisioning_state = kwargs.get('provisioning_state', None)
class ConnectedClusterAADProfile(Model):
"""ConnectedClusterAADProfile.
All required parameters must be populated in order to send to Azure.
:param tenant_id: Required. The aad tenant id which is configured on
target K8s cluster
:type tenant_id: str
:param client_app_id: Required. The client app id configured on target K8
cluster
:type client_app_id: str
:param server_app_id: Required. The server app id to access AD server
:type server_app_id: str
"""
_validation = {
'tenant_id': {'required': True},
'client_app_id': {'required': True},
'server_app_id': {'required': True},
}
_attribute_map = {
'tenant_id': {'key': 'tenantId', 'type': 'str'},
'client_app_id': {'key': 'clientAppId', 'type': 'str'},
'server_app_id': {'key': 'serverAppId', 'type': 'str'},
}
def __init__(self, **kwargs):
super(ConnectedClusterAADProfile, self).__init__(**kwargs)
self.tenant_id = kwargs.get('tenant_id', None)
self.client_app_id = kwargs.get('client_app_id', None)
self.server_app_id = kwargs.get('server_app_id', None)
class ConnectedClusterIdentity(Model):
"""Identity for the connected cluster.
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 principal_id: The principal id of connected cluster identity. This
property will only be provided for a system assigned identity.
:vartype principal_id: str
:ivar tenant_id: The tenant id associated with the connected cluster. This
property will only be provided for a system assigned identity.
:vartype tenant_id: str
:param type: Required. The type of identity used for the connected
cluster. The type 'SystemAssigned, includes a system created identity. The
type 'None' means no identity is assigned to the connected cluster.
Possible values include: 'None', 'SystemAssigned'
:type type: str or
~azure.mgmt.hybridkubernetes.models.ResourceIdentityType
"""
_validation = {
'principal_id': {'readonly': True},
'tenant_id': {'readonly': True},
'type': {'required': True},
}
_attribute_map = {
'principal_id': {'key': 'principalId', 'type': 'str'},
'tenant_id': {'key': 'tenantId', 'type': 'str'},
'type': {'key': 'type', 'type': 'ResourceIdentityType'},
}
def __init__(self, **kwargs):
super(ConnectedClusterIdentity, self).__init__(**kwargs)
self.principal_id = None
self.tenant_id = None
self.type = kwargs.get('type', None)
class ConnectedClusterPatch(Model):
"""Object containing updates for patch operations.
:param tags: Resource tags.
:type tags: dict[str, str]
:param agent_public_key_certificate: Base64 encoded public certificate
used by the agent to do the initial handshake to the backend services in
Azure.
:type agent_public_key_certificate: str
"""
_attribute_map = {
'tags': {'key': 'tags', 'type': '{str}'},
'agent_public_key_certificate': {'key': 'properties.agentPublicKeyCertificate', 'type': 'str'},
}
def __init__(self, **kwargs):
super(ConnectedClusterPatch, self).__init__(**kwargs)
self.tags = kwargs.get('tags', None)
self.agent_public_key_certificate = kwargs.get('agent_public_key_certificate', None)
class CredentialResult(Model):
"""The credential result response.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar name: The name of the credential.
:vartype name: str
:ivar value: Base64-encoded Kubernetes configuration file.
:vartype value: bytearray
"""
_validation = {
'name': {'readonly': True},
'value': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'value': {'key': 'value', 'type': 'bytearray'},
}
def __init__(self, **kwargs):
super(CredentialResult, self).__init__(**kwargs)
self.name = None
self.value = None
class CredentialResults(Model):
"""The list of credential result response.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar kubeconfigs: Base64-encoded Kubernetes configuration file.
:vartype kubeconfigs:
list[~azure.mgmt.hybridkubernetes.models.CredentialResult]
"""
_validation = {
'kubeconfigs': {'readonly': True},
}
_attribute_map = {
'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'},
}
def __init__(self, **kwargs):
super(CredentialResults, self).__init__(**kwargs)
self.kubeconfigs = None
class ErrorDetails(Model):
"""The error response details containing error code and error message.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar code: The error code.
:vartype code: str
:ivar message: The error message.
:vartype message: str
"""
_validation = {
'code': {'readonly': True},
'message': {'readonly': True},
}
_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(self, **kwargs):
super(ErrorDetails, self).__init__(**kwargs)
self.code = None
self.message = None
class ErrorResponse(Model):
"""The error response that indicates why an operation has failed.
:param error:
:type error: ~azure.mgmt.hybridkubernetes.models.ErrorDetails
"""
_attribute_map = {
'error': {'key': 'error', 'type': 'ErrorDetails'},
}
def __init__(self, **kwargs):
super(ErrorResponse, self).__init__(**kwargs)
self.error = kwargs.get('error', None)
class ErrorResponseException(HttpOperationError):
"""Server responsed with exception of type: 'ErrorResponse'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""
def __init__(self, deserialize, response, *args):
super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args)
class Operation(Model):
"""The Connected cluster API operation.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar name: Operation name: {Microsoft.Kubernetes}/{resource}/{operation}
:vartype name: str
:ivar display: The object that represents the operation.
:vartype display: ~azure.mgmt.hybridkubernetes.models.OperationDisplay
"""
_validation = {
'name': {'readonly': True},
'display': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'OperationDisplay'},
}
def __init__(self, **kwargs):
super(Operation, self).__init__(**kwargs)
self.name = None
self.display = None
class OperationDisplay(Model):
"""The object that represents the operation.
:param provider: Service provider: Microsoft.connectedClusters
:type provider: str
:param resource: Connected Cluster Resource on which the operation is
performed
:type resource: str
:param operation: Operation type: Read, write, delete, etc.
:type operation: str
:param description: Description of the operation.
:type description: str
"""
_attribute_map = {
'provider': {'key': 'provider', 'type': 'str'},
'resource': {'key': 'resource', 'type': 'str'},
'operation': {'key': 'operation', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
}
def __init__(self, **kwargs):
super(OperationDisplay, self).__init__(**kwargs)
self.provider = kwargs.get('provider', None)
self.resource = kwargs.get('resource', None)
self.operation = kwargs.get('operation', None)
self.description = kwargs.get('description', 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)

Просмотреть файл

@ -0,0 +1,516 @@
# 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
from msrest.exceptions import HttpOperationError
class Resource(Model):
"""Resource.
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(Resource, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None
class AzureEntityResource(Resource):
"""The resource model definition for a Azure Resource Manager resource with an
etag.
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
:ivar etag: Resource Etag.
:vartype etag: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'etag': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
}
def __init__(self, **kwargs) -> None:
super(AzureEntityResource, self).__init__(**kwargs)
self.etag = None
class CloudError(Model):
"""CloudError.
"""
_attribute_map = {
}
class TrackedResource(Resource):
"""The resource model definition for a ARM tracked top level resource.
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 tags: Resource tags.
:type tags: dict[str, str]
:param location: Required. The geo-location where the resource lives
:type location: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
}
def __init__(self, *, location: str, tags=None, **kwargs) -> None:
super(TrackedResource, self).__init__(**kwargs)
self.tags = tags
self.location = location
class ConnectedCluster(TrackedResource):
"""Represents a connected cluster.
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 tags: Resource tags.
:type tags: dict[str, str]
:param location: Required. The geo-location where the resource lives
:type location: str
:param identity: Required. The identity of the connected cluster.
:type identity:
~azure.mgmt.hybridkubernetes.models.ConnectedClusterIdentity
:param agent_public_key_certificate: Required. Base64 encoded public
certificate used by the agent to do the initial handshake to the backend
services in Azure.
:type agent_public_key_certificate: str
:param aad_profile: Required.
:type aad_profile:
~azure.mgmt.hybridkubernetes.models.ConnectedClusterAADProfile
:ivar kubernetes_version: The Kubernetes version of the connected cluster
resource
:vartype kubernetes_version: str
:ivar total_node_count: Number of nodes present in the connected cluster
resource
:vartype total_node_count: int
:ivar agent_version: Version of the agent running on the connected cluster
resource
:vartype agent_version: str
:param provisioning_state: Possible values include: 'Succeeded', 'Failed',
'Canceled', 'Provisioning', 'Updating', 'Deleting', 'Accepted'
:type provisioning_state: str or
~azure.mgmt.hybridkubernetes.models.ProvisioningState
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'location': {'required': True},
'identity': {'required': True},
'agent_public_key_certificate': {'required': True},
'aad_profile': {'required': True},
'kubernetes_version': {'readonly': True},
'total_node_count': {'readonly': True},
'agent_version': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'identity': {'key': 'identity', 'type': 'ConnectedClusterIdentity'},
'agent_public_key_certificate': {'key': 'properties.agentPublicKeyCertificate', 'type': 'str'},
'aad_profile': {'key': 'properties.aadProfile', 'type': 'ConnectedClusterAADProfile'},
'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'},
'total_node_count': {'key': 'properties.totalNodeCount', 'type': 'int'},
'agent_version': {'key': 'properties.agentVersion', 'type': 'str'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
}
def __init__(self, *, location: str, identity, agent_public_key_certificate: str, aad_profile, tags=None, provisioning_state=None, **kwargs) -> None:
super(ConnectedCluster, self).__init__(tags=tags, location=location, **kwargs)
self.identity = identity
self.agent_public_key_certificate = agent_public_key_certificate
self.aad_profile = aad_profile
self.kubernetes_version = None
self.total_node_count = None
self.agent_version = None
self.provisioning_state = provisioning_state
class ConnectedClusterAADProfile(Model):
"""ConnectedClusterAADProfile.
All required parameters must be populated in order to send to Azure.
:param tenant_id: Required. The aad tenant id which is configured on
target K8s cluster
:type tenant_id: str
:param client_app_id: Required. The client app id configured on target K8
cluster
:type client_app_id: str
:param server_app_id: Required. The server app id to access AD server
:type server_app_id: str
"""
_validation = {
'tenant_id': {'required': True},
'client_app_id': {'required': True},
'server_app_id': {'required': True},
}
_attribute_map = {
'tenant_id': {'key': 'tenantId', 'type': 'str'},
'client_app_id': {'key': 'clientAppId', 'type': 'str'},
'server_app_id': {'key': 'serverAppId', 'type': 'str'},
}
def __init__(self, *, tenant_id: str, client_app_id: str, server_app_id: str, **kwargs) -> None:
super(ConnectedClusterAADProfile, self).__init__(**kwargs)
self.tenant_id = tenant_id
self.client_app_id = client_app_id
self.server_app_id = server_app_id
class ConnectedClusterIdentity(Model):
"""Identity for the connected cluster.
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 principal_id: The principal id of connected cluster identity. This
property will only be provided for a system assigned identity.
:vartype principal_id: str
:ivar tenant_id: The tenant id associated with the connected cluster. This
property will only be provided for a system assigned identity.
:vartype tenant_id: str
:param type: Required. The type of identity used for the connected
cluster. The type 'SystemAssigned, includes a system created identity. The
type 'None' means no identity is assigned to the connected cluster.
Possible values include: 'None', 'SystemAssigned'
:type type: str or
~azure.mgmt.hybridkubernetes.models.ResourceIdentityType
"""
_validation = {
'principal_id': {'readonly': True},
'tenant_id': {'readonly': True},
'type': {'required': True},
}
_attribute_map = {
'principal_id': {'key': 'principalId', 'type': 'str'},
'tenant_id': {'key': 'tenantId', 'type': 'str'},
'type': {'key': 'type', 'type': 'ResourceIdentityType'},
}
def __init__(self, *, type, **kwargs) -> None:
super(ConnectedClusterIdentity, self).__init__(**kwargs)
self.principal_id = None
self.tenant_id = None
self.type = type
class ConnectedClusterPatch(Model):
"""Object containing updates for patch operations.
:param tags: Resource tags.
:type tags: dict[str, str]
:param agent_public_key_certificate: Base64 encoded public certificate
used by the agent to do the initial handshake to the backend services in
Azure.
:type agent_public_key_certificate: str
"""
_attribute_map = {
'tags': {'key': 'tags', 'type': '{str}'},
'agent_public_key_certificate': {'key': 'properties.agentPublicKeyCertificate', 'type': 'str'},
}
def __init__(self, *, tags=None, agent_public_key_certificate: str=None, **kwargs) -> None:
super(ConnectedClusterPatch, self).__init__(**kwargs)
self.tags = tags
self.agent_public_key_certificate = agent_public_key_certificate
class CredentialResult(Model):
"""The credential result response.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar name: The name of the credential.
:vartype name: str
:ivar value: Base64-encoded Kubernetes configuration file.
:vartype value: bytearray
"""
_validation = {
'name': {'readonly': True},
'value': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'value': {'key': 'value', 'type': 'bytearray'},
}
def __init__(self, **kwargs) -> None:
super(CredentialResult, self).__init__(**kwargs)
self.name = None
self.value = None
class CredentialResults(Model):
"""The list of credential result response.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar kubeconfigs: Base64-encoded Kubernetes configuration file.
:vartype kubeconfigs:
list[~azure.mgmt.hybridkubernetes.models.CredentialResult]
"""
_validation = {
'kubeconfigs': {'readonly': True},
}
_attribute_map = {
'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'},
}
def __init__(self, **kwargs) -> None:
super(CredentialResults, self).__init__(**kwargs)
self.kubeconfigs = None
class ErrorDetails(Model):
"""The error response details containing error code and error message.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar code: The error code.
:vartype code: str
:ivar message: The error message.
:vartype message: str
"""
_validation = {
'code': {'readonly': True},
'message': {'readonly': True},
}
_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(self, **kwargs) -> None:
super(ErrorDetails, self).__init__(**kwargs)
self.code = None
self.message = None
class ErrorResponse(Model):
"""The error response that indicates why an operation has failed.
:param error:
:type error: ~azure.mgmt.hybridkubernetes.models.ErrorDetails
"""
_attribute_map = {
'error': {'key': 'error', 'type': 'ErrorDetails'},
}
def __init__(self, *, error=None, **kwargs) -> None:
super(ErrorResponse, self).__init__(**kwargs)
self.error = error
class ErrorResponseException(HttpOperationError):
"""Server responsed with exception of type: 'ErrorResponse'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""
def __init__(self, deserialize, response, *args):
super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args)
class Operation(Model):
"""The Connected cluster API operation.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar name: Operation name: {Microsoft.Kubernetes}/{resource}/{operation}
:vartype name: str
:ivar display: The object that represents the operation.
:vartype display: ~azure.mgmt.hybridkubernetes.models.OperationDisplay
"""
_validation = {
'name': {'readonly': True},
'display': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'OperationDisplay'},
}
def __init__(self, **kwargs) -> None:
super(Operation, self).__init__(**kwargs)
self.name = None
self.display = None
class OperationDisplay(Model):
"""The object that represents the operation.
:param provider: Service provider: Microsoft.connectedClusters
:type provider: str
:param resource: Connected Cluster Resource on which the operation is
performed
:type resource: str
:param operation: Operation type: Read, write, delete, etc.
:type operation: str
:param description: Description of the operation.
:type description: str
"""
_attribute_map = {
'provider': {'key': 'provider', 'type': 'str'},
'resource': {'key': 'resource', 'type': 'str'},
'operation': {'key': 'operation', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
}
def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None:
super(OperationDisplay, self).__init__(**kwargs)
self.provider = provider
self.resource = resource
self.operation = operation
self.description = description
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)

Просмотреть файл

@ -0,0 +1,40 @@
# 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.paging import Paged
class ConnectedClusterPaged(Paged):
"""
A paging container for iterating over a list of :class:`ConnectedCluster <azure.mgmt.hybridkubernetes.models.ConnectedCluster>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[ConnectedCluster]'}
}
def __init__(self, *args, **kwargs):
super(ConnectedClusterPaged, self).__init__(*args, **kwargs)
class OperationPaged(Paged):
"""
A paging container for iterating over a list of :class:`Operation <azure.mgmt.hybridkubernetes.models.Operation>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[Operation]'}
}
def __init__(self, *args, **kwargs):
super(OperationPaged, self).__init__(*args, **kwargs)

Просмотреть файл

@ -0,0 +1,18 @@
# 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 ._connected_cluster_operations import ConnectedClusterOperations
from ._operations import Operations
__all__ = [
'ConnectedClusterOperations',
'Operations',
]

Просмотреть файл

@ -0,0 +1,578 @@
# 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 msrest.polling import LROPoller, NoPolling
from msrestazure.polling.arm_polling import ARMPolling
from .. import models
class ConnectedClusterOperations(object):
"""ConnectedClusterOperations 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: The API version to use for this operation. Constant value: "2020-01-01-preview".
"""
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2020-01-01-preview"
self.config = config
def _create_initial(
self, resource_group_name, cluster_name, connected_cluster, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.create.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'clusterName': self._serialize.url("cluster_name", cluster_name, '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', min_length=1)
# 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(connected_cluster, 'ConnectedCluster')
# 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]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ConnectedCluster', response)
if response.status_code == 201:
deserialized = self._deserialize('ConnectedCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def create(
self, resource_group_name, cluster_name, connected_cluster, custom_headers=None, raw=False, polling=True, **operation_config):
"""Register a new Kubernetes cluster with Azure Resource Manager.
API to register a new Kubernetes cluster and create a tracked resource
in Azure Resource Manager (ARM).
:param resource_group_name: The name of the resource group. The name
is case insensitive.
:type resource_group_name: str
:param cluster_name: The name of the Kubernetes cluster on which get
is called.
:type cluster_name: str
:param connected_cluster: Parameters supplied to Create a Connected
Cluster.
:type connected_cluster:
~azure.mgmt.hybridkubernetes.models.ConnectedCluster
: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 ConnectedCluster or
ClientRawResponse<ConnectedCluster> if raw==True
:rtype:
~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.hybridkubernetes.models.ConnectedCluster]
or
~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.hybridkubernetes.models.ConnectedCluster]]
:raises:
:class:`ErrorResponseException<azure.mgmt.hybridkubernetes.models.ErrorResponseException>`
"""
raw_result = self._create_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_name,
connected_cluster=connected_cluster,
custom_headers=custom_headers,
raw=True,
**operation_config
)
def get_long_running_output(response):
deserialized = self._deserialize('ConnectedCluster', 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}'}
def update(
self, resource_group_name, cluster_name, tags=None, agent_public_key_certificate=None, custom_headers=None, raw=False, **operation_config):
"""Updates a connected cluster.
API to update certain properties of the connected cluster resource.
:param resource_group_name: The name of the resource group. The name
is case insensitive.
:type resource_group_name: str
:param cluster_name: The name of the Kubernetes cluster on which get
is called.
:type cluster_name: str
:param tags: Resource tags.
:type tags: dict[str, str]
:param agent_public_key_certificate: Base64 encoded public certificate
used by the agent to do the initial handshake to the backend services
in Azure.
:type agent_public_key_certificate: 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: ConnectedCluster or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.hybridkubernetes.models.ConnectedCluster or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.hybridkubernetes.models.ErrorResponseException>`
"""
connected_cluster_patch = models.ConnectedClusterPatch(tags=tags, agent_public_key_certificate=agent_public_key_certificate)
# Construct URL
url = self.update.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'clusterName': self._serialize.url("cluster_name", cluster_name, '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', min_length=1)
# 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(connected_cluster_patch, 'ConnectedClusterPatch')
# Construct and send request
request = self._client.patch(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ConnectedCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}'}
def get(
self, resource_group_name, cluster_name, custom_headers=None, raw=False, **operation_config):
"""Get the properties of the specified connected cluster.
Returns the properties of the specified connected cluster, including
name, identity, properties, and additional cluster details.
:param resource_group_name: The name of the resource group. The name
is case insensitive.
:type resource_group_name: str
:param cluster_name: The name of the Kubernetes cluster on which get
is called.
: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<msrest:optionsforoperations>`.
:return: ConnectedCluster or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.hybridkubernetes.models.ConnectedCluster or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.hybridkubernetes.models.ErrorResponseException>`
"""
# Construct URL
url = self.get.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'clusterName': self._serialize.url("cluster_name", cluster_name, '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', min_length=1)
# 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]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('ConnectedCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}'}
def _delete_initial(
self, resource_group_name, cluster_name, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.delete.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'clusterName': self._serialize.url("cluster_name", cluster_name, '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', min_length=1)
# 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]:
raise models.ErrorResponseException(self._deserialize, response)
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
def delete(
self, resource_group_name, cluster_name, custom_headers=None, raw=False, polling=True, **operation_config):
"""Delete a connected cluster.
Delete a connected cluster, removing the tracked resource in Azure
Resource Manager (ARM).
:param resource_group_name: The name of the resource group. The name
is case insensitive.
:type resource_group_name: str
:param cluster_name: The name of the Kubernetes cluster on which get
is called.
:type cluster_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<None> if raw==True
:rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]
:raises:
:class:`ErrorResponseException<azure.mgmt.hybridkubernetes.models.ErrorResponseException>`
"""
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
cluster_name=cluster_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.Kubernetes/connectedClusters/{clusterName}'}
def list_cluster_user_credentials(
self, resource_group_name, cluster_name, 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
resource group and name.
:param resource_group_name: The name of the resource group. The name
is case insensitive.
:type resource_group_name: str
:param cluster_name: The name of the Kubernetes cluster on which get
is called.
: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<msrest:optionsforoperations>`.
:return: CredentialResults or ClientRawResponse if raw=true
:rtype: ~azure.mgmt.hybridkubernetes.models.CredentialResults or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`ErrorResponseException<azure.mgmt.hybridkubernetes.models.ErrorResponseException>`
"""
# Construct URL
url = self.list_cluster_user_credentials.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'),
'clusterName': self._serialize.url("cluster_name", cluster_name, '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', min_length=1)
# 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)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('CredentialResults', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
list_cluster_user_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}/listClusterUserCredentials'}
def list_by_resource_group(
self, resource_group_name, custom_headers=None, raw=False, **operation_config):
"""Lists all connected clusters.
API to enumerate registered connected K8s clusters under a Resource
Group.
:param resource_group_name: The name of the resource group. The name
is case insensitive.
:type resource_group_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: An iterator like instance of ConnectedCluster
:rtype:
~azure.mgmt.hybridkubernetes.models.ConnectedClusterPaged[~azure.mgmt.hybridkubernetes.models.ConnectedCluster]
:raises:
:class:`ErrorResponseException<azure.mgmt.hybridkubernetes.models.ErrorResponseException>`
"""
def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list_by_resource_group.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$')
}
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', min_length=1)
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]:
raise models.ErrorResponseException(self._deserialize, response)
return response
# Deserialize response
header_dict = None
if raw:
header_dict = {}
deserialized = models.ConnectedClusterPaged(internal_paging, self._deserialize.dependencies, header_dict)
return deserialized
list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters'}
def list_by_subscription(
self, custom_headers=None, raw=False, **operation_config):
"""Lists all connected clusters.
API to enumerate registered connected K8s clusters under a
Subscription.
: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: An iterator like instance of ConnectedCluster
:rtype:
~azure.mgmt.hybridkubernetes.models.ConnectedClusterPaged[~azure.mgmt.hybridkubernetes.models.ConnectedCluster]
:raises:
:class:`ErrorResponseException<azure.mgmt.hybridkubernetes.models.ErrorResponseException>`
"""
def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.list_by_subscription.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1)
}
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', min_length=1)
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]:
raise models.ErrorResponseException(self._deserialize, response)
return response
# Deserialize response
header_dict = None
if raw:
header_dict = {}
deserialized = models.ConnectedClusterPaged(internal_paging, self._deserialize.dependencies, header_dict)
return deserialized
list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters'}

Просмотреть файл

@ -0,0 +1,101 @@
# 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 .. import models
class Operations(object):
"""Operations 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: The API version to use for this operation. Constant value: "2020-01-01-preview".
"""
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2020-01-01-preview"
self.config = config
def get(
self, custom_headers=None, raw=False, **operation_config):
"""Lists all of the available API operations for Connected Cluster
resource.
: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: An iterator like instance of Operation
:rtype:
~azure.mgmt.hybridkubernetes.models.OperationPaged[~azure.mgmt.hybridkubernetes.models.Operation]
:raises:
:class:`ErrorResponseException<azure.mgmt.hybridkubernetes.models.ErrorResponseException>`
"""
def prepare_request(next_link=None):
if not next_link:
# Construct URL
url = self.get.metadata['url']
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1)
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]:
raise models.ErrorResponseException(self._deserialize, response)
return response
# Deserialize response
header_dict = None
if raw:
header_dict = {}
deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict)
return deserialized
get.metadata = {'url': '/providers/Microsoft.Kubernetes/operations'}

Просмотреть файл

@ -0,0 +1,13 @@
# 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.
# --------------------------------------------------------------------------
VERSION = "0.1.0"

Просмотреть файл

@ -0,0 +1 @@
-e ../../../tools/azure-sdk-tools

Просмотреть файл

@ -0,0 +1,7 @@
[packaging]
package_name = "azure-mgmt-hybridkubernetes"
package_nspkg = "azure-mgmt-nspkg"
package_pprint_name = "HybridKubernetes Management"
package_doc_id = "hybrid-kubernetes"
is_stable = false
is_arm = true

Просмотреть файл

@ -0,0 +1,2 @@
[bdist_wheel]
universal=1

Просмотреть файл

@ -0,0 +1,90 @@
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
import re
import os.path
from io import open
from setuptools import find_packages, setup
# Change the PACKAGE_NAME only to change folder and different name
PACKAGE_NAME = "azure-mgmt-hybridkubernetes"
PACKAGE_PPRINT_NAME = "HybridKubernetes Management"
# a-b-c => a/b/c
package_folder_path = PACKAGE_NAME.replace('-', '/')
# a-b-c => a.b.c
namespace_name = PACKAGE_NAME.replace('-', '.')
# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
try:
import azure
try:
ver = azure.__version__
raise Exception(
'This package is incompatible with azure=={}. '.format(ver) +
'Uninstall it with "pip uninstall azure".'
)
except AttributeError:
pass
except ImportError:
pass
# Version extraction inspired from 'requests'
with open(os.path.join(package_folder_path, 'version.py')
if os.path.exists(os.path.join(package_folder_path, 'version.py'))
else os.path.join(package_folder_path, '_version.py'), 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
if not version:
raise RuntimeError('Cannot find version information')
with open('README.md', encoding='utf-8') as f:
readme = f.read()
with open('CHANGELOG.md', encoding='utf-8') as f:
changelog = f.read()
setup(
name=PACKAGE_NAME,
version=version,
description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME),
long_description=readme + '\n\n' + changelog,
long_description_content_type='text/markdown',
license='MIT License',
author='Microsoft Corporation',
author_email='azpysdkhelp@microsoft.com',
url='https://github.com/Azure/azure-sdk-for-python',
classifiers=[
'Development Status :: 4 - Beta',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
packages=find_packages(exclude=[
'tests',
# Exclude packages that will be covered by PEP420 or nspkg
'azure',
'azure.mgmt',
]),
install_requires=[
'msrest>=0.5.0',
'msrestazure>=0.4.32,<2.0.0',
'azure-common~=1.1',
],
extras_require={
":python_version<'3.0'": ['azure-mgmt-nspkg'],
}
)

Просмотреть файл

@ -0,0 +1,44 @@
# DO NOT EDIT THIS FILE
# This file is generated automatically and any changes will be lost.
resources:
repositories:
- repository: azure-sdk-tools
type: github
name: Azure/azure-sdk-tools
endpoint: azure
- repository: azure-sdk-build-tools
type: git
name: internal/azure-sdk-build-tools
trigger:
branches:
include:
- master
- hotfix/*
- release/*
- restapi*
paths:
include:
- sdk/hybridkubernetes/
pr:
branches:
include:
- master
- feature/*
- hotfix/*
- release/*
- restapi*
paths:
include:
- sdk/hybridkubernetes/
stages:
- template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: hybridkubernetes
Artifacts:
- name: azure_mgmt_hybridkubernetes
safeName: azuremgmthybridkubernetes