diff --git a/sdk/azure-mgmt-confluent/CHANGELOG.md b/sdk/azure-mgmt-confluent/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/azure-mgmt-confluent/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/azure-mgmt-confluent/MANIFEST.in b/sdk/azure-mgmt-confluent/MANIFEST.in new file mode 100644 index 000000000000..a3cb07df8765 --- /dev/null +++ b/sdk/azure-mgmt-confluent/MANIFEST.in @@ -0,0 +1,5 @@ +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/azure-mgmt-confluent/README.md b/sdk/azure-mgmt-confluent/README.md new file mode 100644 index 000000000000..83b43b9b78c7 --- /dev/null +++ b/sdk/azure-mgmt-confluent/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService 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 + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/azure-samples/azure-samples-python-management/) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# 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-confluent%2FREADME.png) diff --git a/sdk/azure-mgmt-confluent/azure/__init__.py b/sdk/azure-mgmt-confluent/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/__init__.py b/sdk/azure-mgmt-confluent/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/__init__.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/__init__.py new file mode 100644 index 000000000000..8531fdbc09ad --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/__init__.py @@ -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 ._confluent_management_client import ConfluentManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ConfluentManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/_configuration.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/_configuration.py new file mode 100644 index 000000000000..d9022ac8658e --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/_configuration.py @@ -0,0 +1,71 @@ +# 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 typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class ConfluentManagementClientConfiguration(Configuration): + """Configuration for ConfluentManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Microsoft Azure subscription id. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ConfluentManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-03-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-confluent/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/_confluent_management_client.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/_confluent_management_client.py new file mode 100644 index 000000000000..92d8fbd16e4f --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/_confluent_management_client.py @@ -0,0 +1,74 @@ +# 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 typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import ConfluentManagementClientConfiguration +from .operations import OrganizationOperationsOperations +from .operations import OrganizationOperations +from . import models + + +class ConfluentManagementClient(object): + """ConfluentManagementClient. + + :ivar organization_operations: OrganizationOperationsOperations operations + :vartype organization_operations: azure.mgmt.confluent.operations.OrganizationOperationsOperations + :ivar organization: OrganizationOperations operations + :vartype organization: azure.mgmt.confluent.operations.OrganizationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Microsoft Azure subscription id. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ConfluentManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.organization_operations = OrganizationOperationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.organization = OrganizationOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ConfluentManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/_metadata.json b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/_metadata.json new file mode 100644 index 000000000000..ea69f9316109 --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/_metadata.json @@ -0,0 +1,61 @@ +{ + "chosen_version": "2020-03-01-preview", + "total_api_version_list": ["2020-03-01-preview"], + "client": { + "name": "ConfluentManagementClient", + "filename": "_confluent_management_client", + "description": "ConfluentManagementClient.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Microsoft Azure subscription id.", + "docstring_type": "str", + "required": true + } + }, + "async_method": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "description": "Microsoft Azure subscription id.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null + }, + "operation_groups": { + "organization_operations": "OrganizationOperationsOperations", + "organization": "OrganizationOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/_version.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/_version.py @@ -0,0 +1,9 @@ +# 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 = "1.0.0b1" diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/__init__.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/__init__.py new file mode 100644 index 000000000000..8af95dbcb097 --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._confluent_management_client import ConfluentManagementClient +__all__ = ['ConfluentManagementClient'] diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/_configuration.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/_configuration.py new file mode 100644 index 000000000000..d17bb6d7dbc2 --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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 typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ConfluentManagementClientConfiguration(Configuration): + """Configuration for ConfluentManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Microsoft Azure subscription id. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ConfluentManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-03-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-confluent/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/_confluent_management_client.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/_confluent_management_client.py new file mode 100644 index 000000000000..1ac78363be32 --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/_confluent_management_client.py @@ -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. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import ConfluentManagementClientConfiguration +from .operations import OrganizationOperationsOperations +from .operations import OrganizationOperations +from .. import models + + +class ConfluentManagementClient(object): + """ConfluentManagementClient. + + :ivar organization_operations: OrganizationOperationsOperations operations + :vartype organization_operations: azure.mgmt.confluent.aio.operations.OrganizationOperationsOperations + :ivar organization: OrganizationOperations operations + :vartype organization: azure.mgmt.confluent.aio.operations.OrganizationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Microsoft Azure subscription id. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ConfluentManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.organization_operations = OrganizationOperationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.organization = OrganizationOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ConfluentManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/__init__.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/__init__.py new file mode 100644 index 000000000000..809ded33910c --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/__init__.py @@ -0,0 +1,15 @@ +# 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 ._organization_operations_operations import OrganizationOperationsOperations +from ._organization_operations import OrganizationOperations + +__all__ = [ + 'OrganizationOperationsOperations', + 'OrganizationOperations', +] diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations.py new file mode 100644 index 000000000000..661e3a2620ae --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations.py @@ -0,0 +1,554 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OrganizationOperations: + """OrganizationOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.confluent.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["models.OrganizationResourceListResult"]: + """List all organizations under the specified subscription. + + List all organizations under the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OrganizationResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + '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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OrganizationResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.OrganizationResourceListResult"]: + """List all Organizations under the specified resource group. + + List all Organizations under the specified resource group. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OrganizationResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OrganizationResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations'} # type: ignore + + async def get( + self, + resource_group_name: str, + organization_name: str, + **kwargs + ) -> "models.OrganizationResource": + """Get the properties of a specific Organization resource. + + Get the properties of a specific Organization resource. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param organization_name: Organization resource name. + :type organization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OrganizationResource, or the result of cls(response) + :rtype: ~azure.mgmt.confluent.models.OrganizationResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OrganizationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + organization_name: str, + body: Optional["models.OrganizationResource"] = None, + **kwargs + ) -> "models.OrganizationResource": + cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'OrganizationResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('OrganizationResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('OrganizationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + organization_name: str, + body: Optional["models.OrganizationResource"] = None, + **kwargs + ) -> AsyncLROPoller["models.OrganizationResource"]: + """Create Organization resource. + + Create Organization resource. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param organization_name: Organization resource name. + :type organization_name: str + :param body: Organization resource model. + :type body: ~azure.mgmt.confluent.models.OrganizationResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OrganizationResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.confluent.models.OrganizationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + organization_name=organization_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OrganizationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + organization_name: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.OrganizationResource": + """Update Organization resource. + + Update Organization resource. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param organization_name: Organization resource name. + :type organization_name: str + :param tags: ARM resource tags. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OrganizationResource, or the result of cls(response) + :rtype: ~azure.mgmt.confluent.models.OrganizationResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _body = models.OrganizationResourceUpdate(tags=tags) + api_version = "2020-03-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if _body is not None: + body_content = self._serialize.body(_body, 'OrganizationResourceUpdate') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OrganizationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + organization_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + organization_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete Organization resource. + + Delete Organization resource. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param organization_name: Organization resource name. + :type organization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + organization_name=organization_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations_operations.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations_operations.py new file mode 100644 index 000000000000..fb4dc45eca46 --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations_operations.py @@ -0,0 +1,107 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OrganizationOperationsOperations: + """OrganizationOperationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.confluent.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.OperationListResult"]: + """List all operations provided by Microsoft.Confluent. + + List all operations provided by Microsoft.Confluent. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Confluent/operations'} # type: ignore diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/models/__init__.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/models/__init__.py new file mode 100644 index 000000000000..8eee00d729bd --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/models/__init__.py @@ -0,0 +1,62 @@ +# 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 ErrorResponseBody + from ._models_py3 import OfferDetail + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import OperationResult + from ._models_py3 import OrganizationResource + from ._models_py3 import OrganizationResourceListResult + from ._models_py3 import OrganizationResourceProperties + from ._models_py3 import OrganizationResourcePropertiesAutoGenerated + from ._models_py3 import OrganizationResourcePropertiesOfferDetail + from ._models_py3 import OrganizationResourcePropertiesUserDetail + from ._models_py3 import OrganizationResourceUpdate + from ._models_py3 import ResourceProviderDefaultErrorResponse + from ._models_py3 import UserDetail +except (SyntaxError, ImportError): + from ._models import ErrorResponseBody # type: ignore + from ._models import OfferDetail # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import OperationResult # type: ignore + from ._models import OrganizationResource # type: ignore + from ._models import OrganizationResourceListResult # type: ignore + from ._models import OrganizationResourceProperties # type: ignore + from ._models import OrganizationResourcePropertiesAutoGenerated # type: ignore + from ._models import OrganizationResourcePropertiesOfferDetail # type: ignore + from ._models import OrganizationResourcePropertiesUserDetail # type: ignore + from ._models import OrganizationResourceUpdate # type: ignore + from ._models import ResourceProviderDefaultErrorResponse # type: ignore + from ._models import UserDetail # type: ignore + +from ._confluent_management_client_enums import ( + ProvisionState, + SaaSOfferStatus, +) + +__all__ = [ + 'ErrorResponseBody', + 'OfferDetail', + 'OperationDisplay', + 'OperationListResult', + 'OperationResult', + 'OrganizationResource', + 'OrganizationResourceListResult', + 'OrganizationResourceProperties', + 'OrganizationResourcePropertiesAutoGenerated', + 'OrganizationResourcePropertiesOfferDetail', + 'OrganizationResourcePropertiesUserDetail', + 'OrganizationResourceUpdate', + 'ResourceProviderDefaultErrorResponse', + 'UserDetail', + 'ProvisionState', + 'SaaSOfferStatus', +] diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/models/_confluent_management_client_enums.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/models/_confluent_management_client_enums.py new file mode 100644 index 000000000000..77de969ccd09 --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/models/_confluent_management_client_enums.py @@ -0,0 +1,56 @@ +# 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, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class ProvisionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provision states for confluent RP + """ + + ACCEPTED = "Accepted" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETED = "Deleted" + NOT_SPECIFIED = "NotSpecified" + +class SaaSOfferStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SaaS Offer Status for confluent RP + """ + + STARTED = "Started" + PENDING_FULFILLMENT_START = "PendingFulfillmentStart" + IN_PROGRESS = "InProgress" + SUBSCRIBED = "Subscribed" + SUSPENDED = "Suspended" + REINSTATED = "Reinstated" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + UNSUBSCRIBED = "Unsubscribed" + UPDATING = "Updating" diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/models/_models.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/models/_models.py new file mode 100644 index 000000000000..823a41325143 --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/models/_models.py @@ -0,0 +1,513 @@ +# 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 azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class ErrorResponseBody(msrest.serialization.Model): + """Response body of Error. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message. + :vartype message: str + :ivar target: Error target. + :vartype target: str + :ivar details: Error detail. + :vartype details: list[~azure.mgmt.confluent.models.ErrorResponseBody] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseBody, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + + +class OfferDetail(msrest.serialization.Model): + """Confluent Offer detail. + + :param publisher_id: Publisher Id. + :type publisher_id: str + :param id: Offer Id. + :type id: str + :param plan_id: Offer Plan Id. + :type plan_id: str + :param plan_name: Offer Plan Name. + :type plan_name: str + :param term_unit: Offer Plan Term unit. + :type term_unit: str + :param status: SaaS Offer Status. Possible values include: "Started", + "PendingFulfillmentStart", "InProgress", "Subscribed", "Suspended", "Reinstated", "Succeeded", + "Failed", "Unsubscribed", "Updating". + :type status: str or ~azure.mgmt.confluent.models.SaaSOfferStatus + """ + + _validation = { + 'publisher_id': {'max_length': 50, 'min_length': 0}, + 'id': {'max_length': 50, 'min_length': 0}, + 'plan_id': {'max_length': 50, 'min_length': 0}, + 'plan_name': {'max_length': 50, 'min_length': 0}, + 'term_unit': {'max_length': 25, 'min_length': 0}, + } + + _attribute_map = { + 'publisher_id': {'key': 'publisherId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'plan_id': {'key': 'planId', 'type': 'str'}, + 'plan_name': {'key': 'planName', 'type': 'str'}, + 'term_unit': {'key': 'termUnit', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OfferDetail, self).__init__(**kwargs) + self.publisher_id = kwargs.get('publisher_id', None) + self.id = kwargs.get('id', None) + self.plan_id = kwargs.get('plan_id', None) + self.plan_name = kwargs.get('plan_name', None) + self.term_unit = kwargs.get('term_unit', None) + self.status = kwargs.get('status', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Confluent. + :type provider: str + :param resource: Type on which the operation is performed, e.g., 'clusters'. + :type resource: str + :param operation: Operation type, e.g., read, write, delete, etc. + :type operation: str + :param description: Description of the operation, e.g., 'Write confluent'. + :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 OperationListResult(msrest.serialization.Model): + """Result of GET request to list Confluent operations. + + :param value: List of Confluent operations supported by the Microsoft.Confluent provider. + :type value: list[~azure.mgmt.confluent.models.OperationResult] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationResult]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class OperationResult(msrest.serialization.Model): + """An Confluent REST API operation. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.confluent.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationResult, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + + +class OrganizationResource(msrest.serialization.Model): + """Organization resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param tags: A set of tags. Organization resource tags. + :type tags: dict[str, str] + :param location: Location of Organization resource. + :type location: str + :ivar created_time: The creation time of the resource. + :vartype created_time: ~datetime.datetime + :param provisioning_state: Provision states for confluent RP. Possible values include: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + "NotSpecified". + :type provisioning_state: str or ~azure.mgmt.confluent.models.ProvisionState + :ivar organization_id: Id of the Confluent organization. + :vartype organization_id: str + :ivar sso_url: SSO url for the Confluent organization. + :vartype sso_url: str + :param offer_detail: Confluent offer detail. + :type offer_detail: ~azure.mgmt.confluent.models.OfferDetail + :param user_detail: Subscriber detail. + :type user_detail: ~azure.mgmt.confluent.models.UserDetail + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_time': {'readonly': True}, + 'organization_id': {'readonly': True}, + 'sso_url': {'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'}, + 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'organization_id': {'key': 'properties.organizationId', 'type': 'str'}, + 'sso_url': {'key': 'properties.ssoUrl', 'type': 'str'}, + 'offer_detail': {'key': 'properties.offerDetail', 'type': 'OfferDetail'}, + 'user_detail': {'key': 'properties.userDetail', 'type': 'UserDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(OrganizationResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + self.created_time = None + self.provisioning_state = kwargs.get('provisioning_state', None) + self.organization_id = None + self.sso_url = None + self.offer_detail = kwargs.get('offer_detail', None) + self.user_detail = kwargs.get('user_detail', None) + + +class OrganizationResourceListResult(msrest.serialization.Model): + """The response of a list operation. + + :param value: Result of a list operation. + :type value: list[~azure.mgmt.confluent.models.OrganizationResource] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OrganizationResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OrganizationResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class OrganizationResourceProperties(msrest.serialization.Model): + """Organization resource property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_time: The creation time of the resource. + :vartype created_time: ~datetime.datetime + :param provisioning_state: Provision states for confluent RP. Possible values include: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + "NotSpecified". + :type provisioning_state: str or ~azure.mgmt.confluent.models.ProvisionState + :ivar organization_id: Id of the Confluent organization. + :vartype organization_id: str + :ivar sso_url: SSO url for the Confluent organization. + :vartype sso_url: str + :param offer_detail: Confluent offer detail. + :type offer_detail: ~azure.mgmt.confluent.models.OfferDetail + :param user_detail: Subscriber detail. + :type user_detail: ~azure.mgmt.confluent.models.UserDetail + """ + + _validation = { + 'created_time': {'readonly': True}, + 'organization_id': {'readonly': True}, + 'sso_url': {'readonly': True}, + } + + _attribute_map = { + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'organization_id': {'key': 'organizationId', 'type': 'str'}, + 'sso_url': {'key': 'ssoUrl', 'type': 'str'}, + 'offer_detail': {'key': 'offerDetail', 'type': 'OfferDetail'}, + 'user_detail': {'key': 'userDetail', 'type': 'UserDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(OrganizationResourceProperties, self).__init__(**kwargs) + self.created_time = None + self.provisioning_state = kwargs.get('provisioning_state', None) + self.organization_id = None + self.sso_url = None + self.offer_detail = kwargs.get('offer_detail', None) + self.user_detail = kwargs.get('user_detail', None) + + +class OrganizationResourcePropertiesAutoGenerated(OrganizationResourceProperties): + """Organization resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_time: The creation time of the resource. + :vartype created_time: ~datetime.datetime + :param provisioning_state: Provision states for confluent RP. Possible values include: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + "NotSpecified". + :type provisioning_state: str or ~azure.mgmt.confluent.models.ProvisionState + :ivar organization_id: Id of the Confluent organization. + :vartype organization_id: str + :ivar sso_url: SSO url for the Confluent organization. + :vartype sso_url: str + :param offer_detail: Confluent offer detail. + :type offer_detail: ~azure.mgmt.confluent.models.OfferDetail + :param user_detail: Subscriber detail. + :type user_detail: ~azure.mgmt.confluent.models.UserDetail + """ + + _validation = { + 'created_time': {'readonly': True}, + 'organization_id': {'readonly': True}, + 'sso_url': {'readonly': True}, + } + + _attribute_map = { + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'organization_id': {'key': 'organizationId', 'type': 'str'}, + 'sso_url': {'key': 'ssoUrl', 'type': 'str'}, + 'offer_detail': {'key': 'offerDetail', 'type': 'OfferDetail'}, + 'user_detail': {'key': 'userDetail', 'type': 'UserDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(OrganizationResourcePropertiesAutoGenerated, self).__init__(**kwargs) + + +class OrganizationResourcePropertiesOfferDetail(OfferDetail): + """Confluent offer detail. + + :param publisher_id: Publisher Id. + :type publisher_id: str + :param id: Offer Id. + :type id: str + :param plan_id: Offer Plan Id. + :type plan_id: str + :param plan_name: Offer Plan Name. + :type plan_name: str + :param term_unit: Offer Plan Term unit. + :type term_unit: str + :param status: SaaS Offer Status. Possible values include: "Started", + "PendingFulfillmentStart", "InProgress", "Subscribed", "Suspended", "Reinstated", "Succeeded", + "Failed", "Unsubscribed", "Updating". + :type status: str or ~azure.mgmt.confluent.models.SaaSOfferStatus + """ + + _validation = { + 'publisher_id': {'max_length': 50, 'min_length': 0}, + 'id': {'max_length': 50, 'min_length': 0}, + 'plan_id': {'max_length': 50, 'min_length': 0}, + 'plan_name': {'max_length': 50, 'min_length': 0}, + 'term_unit': {'max_length': 25, 'min_length': 0}, + } + + _attribute_map = { + 'publisher_id': {'key': 'publisherId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'plan_id': {'key': 'planId', 'type': 'str'}, + 'plan_name': {'key': 'planName', 'type': 'str'}, + 'term_unit': {'key': 'termUnit', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OrganizationResourcePropertiesOfferDetail, self).__init__(**kwargs) + + +class UserDetail(msrest.serialization.Model): + """Subscriber detail. + + :param first_name: First name. + :type first_name: str + :param last_name: Last name. + :type last_name: str + :param email_address: Email address. + :type email_address: str + """ + + _validation = { + 'first_name': {'max_length': 50, 'min_length': 0}, + 'last_name': {'max_length': 50, 'min_length': 0}, + 'email_address': {'pattern': r'^\S+@\S+\.\S+$'}, + } + + _attribute_map = { + 'first_name': {'key': 'firstName', 'type': 'str'}, + 'last_name': {'key': 'lastName', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserDetail, self).__init__(**kwargs) + self.first_name = kwargs.get('first_name', None) + self.last_name = kwargs.get('last_name', None) + self.email_address = kwargs.get('email_address', None) + + +class OrganizationResourcePropertiesUserDetail(UserDetail): + """Subscriber detail. + + :param first_name: First name. + :type first_name: str + :param last_name: Last name. + :type last_name: str + :param email_address: Email address. + :type email_address: str + """ + + _validation = { + 'first_name': {'max_length': 50, 'min_length': 0}, + 'last_name': {'max_length': 50, 'min_length': 0}, + 'email_address': {'pattern': r'^\S+@\S+\.\S+$'}, + } + + _attribute_map = { + 'first_name': {'key': 'firstName', 'type': 'str'}, + 'last_name': {'key': 'lastName', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OrganizationResourcePropertiesUserDetail, self).__init__(**kwargs) + + +class OrganizationResourceUpdate(msrest.serialization.Model): + """Organization Resource update. + + :param tags: A set of tags. ARM resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(OrganizationResourceUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class ResourceProviderDefaultErrorResponse(msrest.serialization.Model): + """Default error response for resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: Response body of Error. + :vartype error: ~azure.mgmt.confluent.models.ErrorResponseBody + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderDefaultErrorResponse, self).__init__(**kwargs) + self.error = None diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/models/_models_py3.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/models/_models_py3.py new file mode 100644 index 000000000000..00c083c3fd1a --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/models/_models_py3.py @@ -0,0 +1,569 @@ +# 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 typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._confluent_management_client_enums import * + + +class ErrorResponseBody(msrest.serialization.Model): + """Response body of Error. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message. + :vartype message: str + :ivar target: Error target. + :vartype target: str + :ivar details: Error detail. + :vartype details: list[~azure.mgmt.confluent.models.ErrorResponseBody] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponseBody, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + + +class OfferDetail(msrest.serialization.Model): + """Confluent Offer detail. + + :param publisher_id: Publisher Id. + :type publisher_id: str + :param id: Offer Id. + :type id: str + :param plan_id: Offer Plan Id. + :type plan_id: str + :param plan_name: Offer Plan Name. + :type plan_name: str + :param term_unit: Offer Plan Term unit. + :type term_unit: str + :param status: SaaS Offer Status. Possible values include: "Started", + "PendingFulfillmentStart", "InProgress", "Subscribed", "Suspended", "Reinstated", "Succeeded", + "Failed", "Unsubscribed", "Updating". + :type status: str or ~azure.mgmt.confluent.models.SaaSOfferStatus + """ + + _validation = { + 'publisher_id': {'max_length': 50, 'min_length': 0}, + 'id': {'max_length': 50, 'min_length': 0}, + 'plan_id': {'max_length': 50, 'min_length': 0}, + 'plan_name': {'max_length': 50, 'min_length': 0}, + 'term_unit': {'max_length': 25, 'min_length': 0}, + } + + _attribute_map = { + 'publisher_id': {'key': 'publisherId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'plan_id': {'key': 'planId', 'type': 'str'}, + 'plan_name': {'key': 'planName', 'type': 'str'}, + 'term_unit': {'key': 'termUnit', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + publisher_id: Optional[str] = None, + id: Optional[str] = None, + plan_id: Optional[str] = None, + plan_name: Optional[str] = None, + term_unit: Optional[str] = None, + status: Optional[Union[str, "SaaSOfferStatus"]] = None, + **kwargs + ): + super(OfferDetail, self).__init__(**kwargs) + self.publisher_id = publisher_id + self.id = id + self.plan_id = plan_id + self.plan_name = plan_name + self.term_unit = term_unit + self.status = status + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + :param provider: Service provider: Microsoft.Confluent. + :type provider: str + :param resource: Type on which the operation is performed, e.g., 'clusters'. + :type resource: str + :param operation: Operation type, e.g., read, write, delete, etc. + :type operation: str + :param description: Description of the operation, e.g., 'Write confluent'. + :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: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of GET request to list Confluent operations. + + :param value: List of Confluent operations supported by the Microsoft.Confluent provider. + :type value: list[~azure.mgmt.confluent.models.OperationResult] + :param next_link: URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationResult]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationResult"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OperationResult(msrest.serialization.Model): + """An Confluent REST API operation. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.confluent.models.OperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(OperationResult, self).__init__(**kwargs) + self.name = name + self.display = display + + +class OrganizationResource(msrest.serialization.Model): + """Organization resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM id of the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :param tags: A set of tags. Organization resource tags. + :type tags: dict[str, str] + :param location: Location of Organization resource. + :type location: str + :ivar created_time: The creation time of the resource. + :vartype created_time: ~datetime.datetime + :param provisioning_state: Provision states for confluent RP. Possible values include: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + "NotSpecified". + :type provisioning_state: str or ~azure.mgmt.confluent.models.ProvisionState + :ivar organization_id: Id of the Confluent organization. + :vartype organization_id: str + :ivar sso_url: SSO url for the Confluent organization. + :vartype sso_url: str + :param offer_detail: Confluent offer detail. + :type offer_detail: ~azure.mgmt.confluent.models.OfferDetail + :param user_detail: Subscriber detail. + :type user_detail: ~azure.mgmt.confluent.models.UserDetail + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'created_time': {'readonly': True}, + 'organization_id': {'readonly': True}, + 'sso_url': {'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'}, + 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'organization_id': {'key': 'properties.organizationId', 'type': 'str'}, + 'sso_url': {'key': 'properties.ssoUrl', 'type': 'str'}, + 'offer_detail': {'key': 'properties.offerDetail', 'type': 'OfferDetail'}, + 'user_detail': {'key': 'properties.userDetail', 'type': 'UserDetail'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + provisioning_state: Optional[Union[str, "ProvisionState"]] = None, + offer_detail: Optional["OfferDetail"] = None, + user_detail: Optional["UserDetail"] = None, + **kwargs + ): + super(OrganizationResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.tags = tags + self.location = location + self.created_time = None + self.provisioning_state = provisioning_state + self.organization_id = None + self.sso_url = None + self.offer_detail = offer_detail + self.user_detail = user_detail + + +class OrganizationResourceListResult(msrest.serialization.Model): + """The response of a list operation. + + :param value: Result of a list operation. + :type value: list[~azure.mgmt.confluent.models.OrganizationResource] + :param next_link: Link to the next set of results, if any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OrganizationResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OrganizationResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OrganizationResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OrganizationResourceProperties(msrest.serialization.Model): + """Organization resource property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_time: The creation time of the resource. + :vartype created_time: ~datetime.datetime + :param provisioning_state: Provision states for confluent RP. Possible values include: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + "NotSpecified". + :type provisioning_state: str or ~azure.mgmt.confluent.models.ProvisionState + :ivar organization_id: Id of the Confluent organization. + :vartype organization_id: str + :ivar sso_url: SSO url for the Confluent organization. + :vartype sso_url: str + :param offer_detail: Confluent offer detail. + :type offer_detail: ~azure.mgmt.confluent.models.OfferDetail + :param user_detail: Subscriber detail. + :type user_detail: ~azure.mgmt.confluent.models.UserDetail + """ + + _validation = { + 'created_time': {'readonly': True}, + 'organization_id': {'readonly': True}, + 'sso_url': {'readonly': True}, + } + + _attribute_map = { + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'organization_id': {'key': 'organizationId', 'type': 'str'}, + 'sso_url': {'key': 'ssoUrl', 'type': 'str'}, + 'offer_detail': {'key': 'offerDetail', 'type': 'OfferDetail'}, + 'user_detail': {'key': 'userDetail', 'type': 'UserDetail'}, + } + + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "ProvisionState"]] = None, + offer_detail: Optional["OfferDetail"] = None, + user_detail: Optional["UserDetail"] = None, + **kwargs + ): + super(OrganizationResourceProperties, self).__init__(**kwargs) + self.created_time = None + self.provisioning_state = provisioning_state + self.organization_id = None + self.sso_url = None + self.offer_detail = offer_detail + self.user_detail = user_detail + + +class OrganizationResourcePropertiesAutoGenerated(OrganizationResourceProperties): + """Organization resource properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_time: The creation time of the resource. + :vartype created_time: ~datetime.datetime + :param provisioning_state: Provision states for confluent RP. Possible values include: + "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", + "NotSpecified". + :type provisioning_state: str or ~azure.mgmt.confluent.models.ProvisionState + :ivar organization_id: Id of the Confluent organization. + :vartype organization_id: str + :ivar sso_url: SSO url for the Confluent organization. + :vartype sso_url: str + :param offer_detail: Confluent offer detail. + :type offer_detail: ~azure.mgmt.confluent.models.OfferDetail + :param user_detail: Subscriber detail. + :type user_detail: ~azure.mgmt.confluent.models.UserDetail + """ + + _validation = { + 'created_time': {'readonly': True}, + 'organization_id': {'readonly': True}, + 'sso_url': {'readonly': True}, + } + + _attribute_map = { + 'created_time': {'key': 'createdTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'organization_id': {'key': 'organizationId', 'type': 'str'}, + 'sso_url': {'key': 'ssoUrl', 'type': 'str'}, + 'offer_detail': {'key': 'offerDetail', 'type': 'OfferDetail'}, + 'user_detail': {'key': 'userDetail', 'type': 'UserDetail'}, + } + + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "ProvisionState"]] = None, + offer_detail: Optional["OfferDetail"] = None, + user_detail: Optional["UserDetail"] = None, + **kwargs + ): + super(OrganizationResourcePropertiesAutoGenerated, self).__init__(provisioning_state=provisioning_state, offer_detail=offer_detail, user_detail=user_detail, **kwargs) + + +class OrganizationResourcePropertiesOfferDetail(OfferDetail): + """Confluent offer detail. + + :param publisher_id: Publisher Id. + :type publisher_id: str + :param id: Offer Id. + :type id: str + :param plan_id: Offer Plan Id. + :type plan_id: str + :param plan_name: Offer Plan Name. + :type plan_name: str + :param term_unit: Offer Plan Term unit. + :type term_unit: str + :param status: SaaS Offer Status. Possible values include: "Started", + "PendingFulfillmentStart", "InProgress", "Subscribed", "Suspended", "Reinstated", "Succeeded", + "Failed", "Unsubscribed", "Updating". + :type status: str or ~azure.mgmt.confluent.models.SaaSOfferStatus + """ + + _validation = { + 'publisher_id': {'max_length': 50, 'min_length': 0}, + 'id': {'max_length': 50, 'min_length': 0}, + 'plan_id': {'max_length': 50, 'min_length': 0}, + 'plan_name': {'max_length': 50, 'min_length': 0}, + 'term_unit': {'max_length': 25, 'min_length': 0}, + } + + _attribute_map = { + 'publisher_id': {'key': 'publisherId', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'plan_id': {'key': 'planId', 'type': 'str'}, + 'plan_name': {'key': 'planName', 'type': 'str'}, + 'term_unit': {'key': 'termUnit', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + publisher_id: Optional[str] = None, + id: Optional[str] = None, + plan_id: Optional[str] = None, + plan_name: Optional[str] = None, + term_unit: Optional[str] = None, + status: Optional[Union[str, "SaaSOfferStatus"]] = None, + **kwargs + ): + super(OrganizationResourcePropertiesOfferDetail, self).__init__(publisher_id=publisher_id, id=id, plan_id=plan_id, plan_name=plan_name, term_unit=term_unit, status=status, **kwargs) + + +class UserDetail(msrest.serialization.Model): + """Subscriber detail. + + :param first_name: First name. + :type first_name: str + :param last_name: Last name. + :type last_name: str + :param email_address: Email address. + :type email_address: str + """ + + _validation = { + 'first_name': {'max_length': 50, 'min_length': 0}, + 'last_name': {'max_length': 50, 'min_length': 0}, + 'email_address': {'pattern': r'^\S+@\S+\.\S+$'}, + } + + _attribute_map = { + 'first_name': {'key': 'firstName', 'type': 'str'}, + 'last_name': {'key': 'lastName', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email_address: Optional[str] = None, + **kwargs + ): + super(UserDetail, self).__init__(**kwargs) + self.first_name = first_name + self.last_name = last_name + self.email_address = email_address + + +class OrganizationResourcePropertiesUserDetail(UserDetail): + """Subscriber detail. + + :param first_name: First name. + :type first_name: str + :param last_name: Last name. + :type last_name: str + :param email_address: Email address. + :type email_address: str + """ + + _validation = { + 'first_name': {'max_length': 50, 'min_length': 0}, + 'last_name': {'max_length': 50, 'min_length': 0}, + 'email_address': {'pattern': r'^\S+@\S+\.\S+$'}, + } + + _attribute_map = { + 'first_name': {'key': 'firstName', 'type': 'str'}, + 'last_name': {'key': 'lastName', 'type': 'str'}, + 'email_address': {'key': 'emailAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email_address: Optional[str] = None, + **kwargs + ): + super(OrganizationResourcePropertiesUserDetail, self).__init__(first_name=first_name, last_name=last_name, email_address=email_address, **kwargs) + + +class OrganizationResourceUpdate(msrest.serialization.Model): + """Organization Resource update. + + :param tags: A set of tags. ARM resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(OrganizationResourceUpdate, self).__init__(**kwargs) + self.tags = tags + + +class ResourceProviderDefaultErrorResponse(msrest.serialization.Model): + """Default error response for resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: Response body of Error. + :vartype error: ~azure.mgmt.confluent.models.ErrorResponseBody + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderDefaultErrorResponse, self).__init__(**kwargs) + self.error = None diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/operations/__init__.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/operations/__init__.py new file mode 100644 index 000000000000..809ded33910c --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/operations/__init__.py @@ -0,0 +1,15 @@ +# 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 ._organization_operations_operations import OrganizationOperationsOperations +from ._organization_operations import OrganizationOperations + +__all__ = [ + 'OrganizationOperationsOperations', + 'OrganizationOperations', +] diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations.py new file mode 100644 index 000000000000..61993f309c71 --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations.py @@ -0,0 +1,566 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OrganizationOperations(object): + """OrganizationOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.confluent.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OrganizationResourceListResult"] + """List all organizations under the specified subscription. + + List all organizations under the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OrganizationResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + '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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OrganizationResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OrganizationResourceListResult"] + """List all Organizations under the specified resource group. + + List all Organizations under the specified resource group. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OrganizationResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OrganizationResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations'} # type: ignore + + def get( + self, + resource_group_name, # type: str + organization_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.OrganizationResource" + """Get the properties of a specific Organization resource. + + Get the properties of a specific Organization resource. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param organization_name: Organization resource name. + :type organization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OrganizationResource, or the result of cls(response) + :rtype: ~azure.mgmt.confluent.models.OrganizationResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OrganizationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + organization_name, # type: str + body=None, # type: Optional["models.OrganizationResource"] + **kwargs # type: Any + ): + # type: (...) -> "models.OrganizationResource" + cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if body is not None: + body_content = self._serialize.body(body, 'OrganizationResource') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('OrganizationResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('OrganizationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + organization_name, # type: str + body=None, # type: Optional["models.OrganizationResource"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.OrganizationResource"] + """Create Organization resource. + + Create Organization resource. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param organization_name: Organization resource name. + :type organization_name: str + :param body: Organization resource model. + :type body: ~azure.mgmt.confluent.models.OrganizationResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either OrganizationResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.confluent.models.OrganizationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + organization_name=organization_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OrganizationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + organization_name, # type: str + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.OrganizationResource" + """Update Organization resource. + + Update Organization resource. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param organization_name: Organization resource name. + :type organization_name: str + :param tags: ARM resource tags. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OrganizationResource, or the result of cls(response) + :rtype: ~azure.mgmt.confluent.models.OrganizationResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _body = models.OrganizationResourceUpdate(tags=tags) + api_version = "2020-03-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if _body is not None: + body_content = self._serialize.body(_body, 'OrganizationResourceUpdate') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OrganizationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + organization_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + organization_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete Organization resource. + + Delete Organization resource. + + :param resource_group_name: Resource group name. + :type resource_group_name: str + :param organization_name: Organization resource name. + :type organization_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + organization_name=organization_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations_operations.py b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations_operations.py new file mode 100644 index 000000000000..fc16899213eb --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations_operations.py @@ -0,0 +1,112 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OrganizationOperationsOperations(object): + """OrganizationOperationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.confluent.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationListResult"] + """List all operations provided by Microsoft.Confluent. + + List all operations provided by Microsoft.Confluent. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.confluent.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-03-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Confluent/operations'} # type: ignore diff --git a/sdk/azure-mgmt-confluent/azure/mgmt/confluent/py.typed b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/azure-mgmt-confluent/azure/mgmt/confluent/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/azure-mgmt-confluent/sdk_packaging.toml b/sdk/azure-mgmt-confluent/sdk_packaging.toml new file mode 100644 index 000000000000..dc23d9d97489 --- /dev/null +++ b/sdk/azure-mgmt-confluent/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-mgmt-confluent" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/azure-mgmt-confluent/setup.cfg b/sdk/azure-mgmt-confluent/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/azure-mgmt-confluent/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/azure-mgmt-confluent/setup.py b/sdk/azure-mgmt-confluent/setup.py new file mode 100644 index 000000000000..b48f38c0ca05 --- /dev/null +++ b/sdk/azure-mgmt-confluent/setup.py @@ -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-confluent" +PACKAGE_PPRINT_NAME = "MyService 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'], + } +)