diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/CHANGELOG.md b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/LICENSE b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/MANIFEST.in b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/MANIFEST.in new file mode 100644 index 000000000000..2c31e8da0cb1 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/README.md b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/README.md new file mode 100644 index 000000000000..224e78f0ad43 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/README.md @@ -0,0 +1,30 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 3.6+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +# 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/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) 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-powerbiprivatelinks%2FREADME.png) diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/_meta.json b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/_meta.json new file mode 100644 index 000000000000..1efe865b1ed6 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "e0249c9945c29948111754f800eaa88f46a79254", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/powerbiprivatelinks/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "specification/powerbiprivatelinks/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/__init__.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/__init__.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/__init__.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/__init__.py new file mode 100644 index 000000000000..d4660ea10001 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._private_link_services_for_power_bi_client import PrivateLinkServicesForPowerBIClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['PrivateLinkServicesForPowerBIClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_configuration.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_configuration.py new file mode 100644 index 000000000000..e37cab17d208 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_configuration.py @@ -0,0 +1,92 @@ +# 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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class PrivateLinkServicesForPowerBIClientConfiguration(Configuration): + """Configuration for PrivateLinkServicesForPowerBIClient. + + 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: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param azure_resource_name: The name of the Azure resource. + :type azure_resource_name: str + :param private_endpoint_name: The name of the private endpoint. + :type private_endpoint_name: str + :param operation_id: The id of Azure async operation. + :type operation_id: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + private_endpoint_name: str, + operation_id: str, + **kwargs: Any + ) -> None: + super(PrivateLinkServicesForPowerBIClientConfiguration, self).__init__(**kwargs) + 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.") + if resource_group_name is None: + raise ValueError("Parameter 'resource_group_name' must not be None.") + if azure_resource_name is None: + raise ValueError("Parameter 'azure_resource_name' must not be None.") + if private_endpoint_name is None: + raise ValueError("Parameter 'private_endpoint_name' must not be None.") + if operation_id is None: + raise ValueError("Parameter 'operation_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.resource_group_name = resource_group_name + self.azure_resource_name = azure_resource_name + self.private_endpoint_name = private_endpoint_name + self.operation_id = operation_id + self.api_version = "2020-06-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-powerbiprivatelinks/{}'.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 = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_metadata.json b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_metadata.json new file mode 100644 index 000000000000..be4c5d042cea --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_metadata.json @@ -0,0 +1,156 @@ +{ + "chosen_version": "2020-06-01", + "total_api_version_list": ["2020-06-01"], + "client": { + "name": "PrivateLinkServicesForPowerBIClient", + "filename": "_private_link_services_for_power_bi_client", + "description": "Client to manage Power BI Private Link Service resources and connection members.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"PrivateLinkServicesForPowerBIClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"PrivateLinkServicesForPowerBIClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + }, + "resource_group_name": { + "signature": "resource_group_name, # type: str", + "description": "The name of the resource group.", + "docstring_type": "str", + "required": true + }, + "azure_resource_name": { + "signature": "azure_resource_name, # type: str", + "description": "The name of the Azure resource.", + "docstring_type": "str", + "required": true + }, + "private_endpoint_name": { + "signature": "private_endpoint_name, # type: str", + "description": "The name of the private endpoint.", + "docstring_type": "str", + "required": true + }, + "operation_id": { + "signature": "operation_id, # type: str", + "description": "The id of Azure async operation.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).", + "docstring_type": "str", + "required": true + }, + "resource_group_name": { + "signature": "resource_group_name: str,", + "description": "The name of the resource group.", + "docstring_type": "str", + "required": true + }, + "azure_resource_name": { + "signature": "azure_resource_name: str,", + "description": "The name of the Azure resource.", + "docstring_type": "str", + "required": true + }, + "private_endpoint_name": { + "signature": "private_endpoint_name: str,", + "description": "The name of the private endpoint.", + "docstring_type": "str", + "required": true + }, + "operation_id": { + "signature": "operation_id: str,", + "description": "The id of Azure async operation.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id, resource_group_name, azure_resource_name, private_endpoint_name, operation_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "private_link_services_for_power_bi": "PrivateLinkServicesForPowerBIOperations", + "private_link_service_resource_operation_results": "PrivateLinkServiceResourceOperationResultsOperations", + "private_link_services": "PrivateLinkServicesOperations", + "power_bi_resources": "PowerBIResourcesOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations" + } +} \ No newline at end of file diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_patch.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_private_link_services_for_power_bi_client.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_private_link_services_for_power_bi_client.py new file mode 100644 index 000000000000..871de725acfb --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_private_link_services_for_power_bi_client.py @@ -0,0 +1,131 @@ +# 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 copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +from . import models +from ._configuration import PrivateLinkServicesForPowerBIClientConfiguration +from .operations import Operations, PowerBIResourcesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, PrivateLinkServiceResourceOperationResultsOperations, PrivateLinkServicesForPowerBIOperations, PrivateLinkServicesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class PrivateLinkServicesForPowerBIClient: + """Client to manage Power BI Private Link Service resources and connection members. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.powerbiprivatelinks.operations.Operations + :ivar private_link_services_for_power_bi: PrivateLinkServicesForPowerBIOperations operations + :vartype private_link_services_for_power_bi: + azure.mgmt.powerbiprivatelinks.operations.PrivateLinkServicesForPowerBIOperations + :ivar private_link_service_resource_operation_results: + PrivateLinkServiceResourceOperationResultsOperations operations + :vartype private_link_service_resource_operation_results: + azure.mgmt.powerbiprivatelinks.operations.PrivateLinkServiceResourceOperationResultsOperations + :ivar private_link_services: PrivateLinkServicesOperations operations + :vartype private_link_services: + azure.mgmt.powerbiprivatelinks.operations.PrivateLinkServicesOperations + :ivar power_bi_resources: PowerBIResourcesOperations operations + :vartype power_bi_resources: + azure.mgmt.powerbiprivatelinks.operations.PowerBIResourcesOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.powerbiprivatelinks.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.powerbiprivatelinks.operations.PrivateEndpointConnectionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param azure_resource_name: The name of the Azure resource. + :type azure_resource_name: str + :param private_endpoint_name: The name of the private endpoint. + :type private_endpoint_name: str + :param operation_id: The id of Azure async operation. + :type operation_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + private_endpoint_name: str, + operation_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = PrivateLinkServicesForPowerBIClientConfiguration(credential=credential, subscription_id=subscription_id, resource_group_name=resource_group_name, azure_resource_name=azure_resource_name, private_endpoint_name=private_endpoint_name, operation_id=operation_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._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_services_for_power_bi = PrivateLinkServicesForPowerBIOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_service_resource_operation_results = PrivateLinkServiceResourceOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_services = PrivateLinkServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.power_bi_resources = PowerBIResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> PrivateLinkServicesForPowerBIClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_vendor.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_version.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/_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/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/__init__.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/__init__.py new file mode 100644 index 000000000000..facbc6d676c9 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/__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 ._private_link_services_for_power_bi_client import PrivateLinkServicesForPowerBIClient +__all__ = ['PrivateLinkServicesForPowerBIClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/_configuration.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/_configuration.py new file mode 100644 index 000000000000..e698076e9024 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/_configuration.py @@ -0,0 +1,91 @@ +# 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, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class PrivateLinkServicesForPowerBIClientConfiguration(Configuration): + """Configuration for PrivateLinkServicesForPowerBIClient. + + 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: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param azure_resource_name: The name of the Azure resource. + :type azure_resource_name: str + :param private_endpoint_name: The name of the private endpoint. + :type private_endpoint_name: str + :param operation_id: The id of Azure async operation. + :type operation_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + private_endpoint_name: str, + operation_id: str, + **kwargs: Any + ) -> None: + super(PrivateLinkServicesForPowerBIClientConfiguration, self).__init__(**kwargs) + 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.") + if resource_group_name is None: + raise ValueError("Parameter 'resource_group_name' must not be None.") + if azure_resource_name is None: + raise ValueError("Parameter 'azure_resource_name' must not be None.") + if private_endpoint_name is None: + raise ValueError("Parameter 'private_endpoint_name' must not be None.") + if operation_id is None: + raise ValueError("Parameter 'operation_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.resource_group_name = resource_group_name + self.azure_resource_name = azure_resource_name + self.private_endpoint_name = private_endpoint_name + self.operation_id = operation_id + self.api_version = "2020-06-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-powerbiprivatelinks/{}'.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 = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/_patch.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/_private_link_services_for_power_bi_client.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/_private_link_services_for_power_bi_client.py new file mode 100644 index 000000000000..6c845ab9a886 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/_private_link_services_for_power_bi_client.py @@ -0,0 +1,128 @@ +# 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 copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from .. import models +from ._configuration import PrivateLinkServicesForPowerBIClientConfiguration +from .operations import Operations, PowerBIResourcesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, PrivateLinkServiceResourceOperationResultsOperations, PrivateLinkServicesForPowerBIOperations, PrivateLinkServicesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class PrivateLinkServicesForPowerBIClient: + """Client to manage Power BI Private Link Service resources and connection members. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.powerbiprivatelinks.aio.operations.Operations + :ivar private_link_services_for_power_bi: PrivateLinkServicesForPowerBIOperations operations + :vartype private_link_services_for_power_bi: + azure.mgmt.powerbiprivatelinks.aio.operations.PrivateLinkServicesForPowerBIOperations + :ivar private_link_service_resource_operation_results: + PrivateLinkServiceResourceOperationResultsOperations operations + :vartype private_link_service_resource_operation_results: + azure.mgmt.powerbiprivatelinks.aio.operations.PrivateLinkServiceResourceOperationResultsOperations + :ivar private_link_services: PrivateLinkServicesOperations operations + :vartype private_link_services: + azure.mgmt.powerbiprivatelinks.aio.operations.PrivateLinkServicesOperations + :ivar power_bi_resources: PowerBIResourcesOperations operations + :vartype power_bi_resources: + azure.mgmt.powerbiprivatelinks.aio.operations.PowerBIResourcesOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.powerbiprivatelinks.aio.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.powerbiprivatelinks.aio.operations.PrivateEndpointConnectionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param azure_resource_name: The name of the Azure resource. + :type azure_resource_name: str + :param private_endpoint_name: The name of the private endpoint. + :type private_endpoint_name: str + :param operation_id: The id of Azure async operation. + :type operation_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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, + resource_group_name: str, + azure_resource_name: str, + private_endpoint_name: str, + operation_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = PrivateLinkServicesForPowerBIClientConfiguration(credential=credential, subscription_id=subscription_id, resource_group_name=resource_group_name, azure_resource_name=azure_resource_name, private_endpoint_name=private_endpoint_name, operation_id=operation_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._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_services_for_power_bi = PrivateLinkServicesForPowerBIOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_service_resource_operation_results = PrivateLinkServiceResourceOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_services = PrivateLinkServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.power_bi_resources = PowerBIResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "PrivateLinkServicesForPowerBIClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/__init__.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/__init__.py new file mode 100644 index 000000000000..83ff07df8cfa --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# 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 ._operations import Operations +from ._private_link_services_for_power_bi_operations import PrivateLinkServicesForPowerBIOperations +from ._private_link_service_resource_operation_results_operations import PrivateLinkServiceResourceOperationResultsOperations +from ._private_link_services_operations import PrivateLinkServicesOperations +from ._power_bi_resources_operations import PowerBIResourcesOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations + +__all__ = [ + 'Operations', + 'PrivateLinkServicesForPowerBIOperations', + 'PrivateLinkServiceResourceOperationResultsOperations', + 'PrivateLinkServicesOperations', + 'PowerBIResourcesOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', +] diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_operations.py new file mode 100644 index 000000000000..a8e7bf5b34fb --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations 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.powerbiprivatelinks.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 + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available Power BI RP operations. + + :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.powerbiprivatelinks.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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.PowerBI/operations'} # type: ignore diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_power_bi_resources_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_power_bi_resources_operations.py new file mode 100644 index 000000000000..f9cffa6f803e --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_power_bi_resources_operations.py @@ -0,0 +1,259 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._power_bi_resources_operations import build_create_request, build_delete_request, build_list_by_resource_name_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PowerBIResourcesOperations: + """PowerBIResourcesOperations 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.powerbiprivatelinks.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 + + @distributed_trace_async + async def list_by_resource_name( + self, + **kwargs: Any + ) -> List["_models.TenantResource"]: + """Gets all the private link resources for the given Azure resource. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of TenantResource, or the result of cls(response) + :rtype: list[~azure.mgmt.powerbiprivatelinks.models.TenantResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.TenantResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_by_resource_name_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + template_url=self.list_by_resource_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[TenantResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_resource_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}'} # type: ignore + + + @distributed_trace_async + async def create( + self, + body: "_models.TenantResource", + client_tenant_id: Optional[str] = None, + **kwargs: Any + ) -> "_models.TenantResource": + """Creates or updates a Private Link Service Resource for Power BI. + + :param body: Tenant resource to be created or updated. + :type body: ~azure.mgmt.powerbiprivatelinks.models.TenantResource + :param client_tenant_id: The client tenant id in header. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). + :type client_tenant_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TenantResource, or the result of cls(response) + :rtype: ~azure.mgmt.powerbiprivatelinks.models.TenantResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'TenantResource') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + content_type=content_type, + json=_json, + client_tenant_id=client_tenant_id, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TenantResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}'} # type: ignore + + + @distributed_trace_async + async def update( + self, + body: "_models.TenantResource", + client_tenant_id: Optional[str] = None, + **kwargs: Any + ) -> "_models.TenantResource": + """Creates or updates a Private Link Service Resource for Power BI. + + :param body: Tenant resource to be created or updated. + :type body: ~azure.mgmt.powerbiprivatelinks.models.TenantResource + :param client_tenant_id: The client tenant id in header. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). + :type client_tenant_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TenantResource, or the result of cls(response) + :rtype: ~azure.mgmt.powerbiprivatelinks.models.TenantResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'TenantResource') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + content_type=content_type, + json=_json, + client_tenant_id=client_tenant_id, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TenantResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + **kwargs: Any + ) -> None: + """Deletes a Private Link Service Resource for Power BI. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}'} # type: ignore + diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_endpoint_connections_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..c40413358f7c --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,333 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_create_request, build_delete_request_initial, build_get_request, build_list_by_resource_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations 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.powerbiprivatelinks.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 + + @distributed_trace + def list_by_resource( + self, + resource_group_name: str, + azure_resource_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + """Lists all private endpoint connections under a resource. + + Gets private endpoint connection for Power BI. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param azure_resource_name: The name of the powerbi resource. + :type azure_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.powerbiprivatelinks.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + azure_resource_name=azure_resource_name, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + azure_resource_name=azure_resource_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections'} # type: ignore + + @distributed_trace_async + async def get( + self, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Get a specific private endpoint connection. + + Get a specific private endpoint connection for Power BI by private endpoint name. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.powerbiprivatelinks.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + private_endpoint_name=self._config.private_endpoint_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}'} # type: ignore + + + @distributed_trace_async + async def create( + self, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Update a specific private endpoint connection. + + Updates the status of Private Endpoint Connection object. Used to approve or reject a + connection. + + :param private_endpoint_connection: Private endpoint connection object to update. + :type private_endpoint_connection: + ~azure.mgmt.powerbiprivatelinks.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.powerbiprivatelinks.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + private_endpoint_name=self._config.private_endpoint_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}'} # type: ignore + + + async def _delete_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + private_endpoint_name=self._config.private_endpoint_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Asynchronous API to delete a private endpoint connection for Power BI by private endpoint name. + + Deletes a private endpoint connection for Power BI by private endpoint name. + + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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': '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_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}'} # type: ignore diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_link_resources_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..a2f2ca365bd4 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,171 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +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 +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_get_request, build_list_by_resource_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations 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.powerbiprivatelinks.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 + + @distributed_trace + def list_by_resource( + self, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResourcesListResult"]: + """List private link Power BI resource. + + List private link resources under a specific Power BI resource. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourcesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.powerbiprivatelinks.models.PrivateLinkResourcesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourcesListResult", 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateLinkResources'} # type: ignore + + @distributed_trace_async + async def get( + self, + private_link_resource_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResource": + """Get a private link resource. + + Get properties of a private link resource. + + :param private_link_resource_name: The name of private link resource. + :type private_link_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.powerbiprivatelinks.models.PrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + private_link_resource_name=private_link_resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_link_service_resource_operation_results_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_link_service_resource_operation_results_operations.py new file mode 100644 index 000000000000..77773de0d6f9 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_link_service_resource_operation_results_operations.py @@ -0,0 +1,145 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_link_service_resource_operation_results_operations import build_get_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkServiceResourceOperationResultsOperations: + """PrivateLinkServiceResourceOperationResultsOperations 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.powerbiprivatelinks.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 + + async def _get_initial( + self, + **kwargs: Any + ) -> "_models.AsyncOperationDetail": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationDetail"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request_initial( + subscription_id=self._config.subscription_id, + operation_id=self._config.operation_id, + template_url=self._get_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AsyncOperationDetail', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AsyncOperationDetail', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/operationResults/{operationId}'} # type: ignore + + + @distributed_trace_async + async def begin_get( + self, + **kwargs: Any + ) -> AsyncLROPoller["_models.AsyncOperationDetail"]: + """Gets operation result of Private Link Service Resources for Power BI. + + :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: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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 AsyncOperationDetail or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.powerbiprivatelinks.models.AsyncOperationDetail] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationDetail"] + 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._get_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AsyncOperationDetail', 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_get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/operationResults/{operationId}'} # type: ignore diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_link_services_for_power_bi_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_link_services_for_power_bi_operations.py new file mode 100644 index 000000000000..fe363cb092d6 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_link_services_for_power_bi_operations.py @@ -0,0 +1,89 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_link_services_for_power_bi_operations import build_list_by_subscription_id_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkServicesForPowerBIOperations: + """PrivateLinkServicesForPowerBIOperations 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.powerbiprivatelinks.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 + + @distributed_trace_async + async def list_by_subscription_id( + self, + **kwargs: Any + ) -> List["_models.TenantResource"]: + """Gets all the private link resources for the given subscription id. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of TenantResource, or the result of cls(response) + :rtype: list[~azure.mgmt.powerbiprivatelinks.models.TenantResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.TenantResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_by_subscription_id_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[TenantResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI'} # type: ignore + diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_link_services_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_link_services_operations.py new file mode 100644 index 000000000000..1b1ba6a3bb4c --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/aio/operations/_private_link_services_operations.py @@ -0,0 +1,90 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_link_services_operations import build_list_by_resource_group_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkServicesOperations: + """PrivateLinkServicesOperations 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.powerbiprivatelinks.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 + + @distributed_trace_async + async def list_by_resource_group( + self, + **kwargs: Any + ) -> List["_models.TenantResource"]: + """Gets all the private link resources for the given resource group. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of TenantResource, or the result of cls(response) + :rtype: list[~azure.mgmt.powerbiprivatelinks.models.TenantResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.TenantResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[TenantResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI'} # type: ignore + diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/models/__init__.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/models/__init__.py new file mode 100644 index 000000000000..4cf7836a1f2d --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/models/__init__.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 ._models_py3 import AsyncOperationDetail +from ._models_py3 import ConnectionState +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import GroupConnectivityInformation +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkConnectionDetail +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourcesListResult +from ._models_py3 import PrivateLinkServiceConnection +from ._models_py3 import PrivateLinkServiceProxy +from ._models_py3 import RemotePrivateEndpointConnection +from ._models_py3 import SystemData +from ._models_py3 import TenantResource + + +from ._private_link_services_for_power_bi_client_enums import ( + ActionType, + ActionsRequired, + CreatedByType, + Origin, + PersistedConnectionStatus, + ResourceProvisioningState, +) + +__all__ = [ + 'AsyncOperationDetail', + 'ConnectionState', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'GroupConnectivityInformation', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkConnectionDetail', + 'PrivateLinkResource', + 'PrivateLinkResourcesListResult', + 'PrivateLinkServiceConnection', + 'PrivateLinkServiceProxy', + 'RemotePrivateEndpointConnection', + 'SystemData', + 'TenantResource', + 'ActionType', + 'ActionsRequired', + 'CreatedByType', + 'Origin', + 'PersistedConnectionStatus', + 'ResourceProvisioningState', +] diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/models/_models_py3.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/models/_models_py3.py new file mode 100644 index 000000000000..cfedd17bbb36 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/models/_models_py3.py @@ -0,0 +1,949 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._private_link_services_for_power_bi_client_enums import * + + +class AsyncOperationDetail(msrest.serialization.Model): + """AsyncOperationDetail. + + :ivar id: The operation id. + :vartype id: str + :ivar name: The operation name. + :vartype name: str + :ivar status: The operation status. + :vartype status: str + :ivar start_time: The operation start time. + :vartype start_time: str + :ivar end_time: The operation end time. + :vartype end_time: str + :ivar error: The error. + :vartype error: ~azure.mgmt.powerbiprivatelinks.models.ErrorDetail + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'end_time': {'key': 'endTime', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + status: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + """ + :keyword id: The operation id. + :paramtype id: str + :keyword name: The operation name. + :paramtype name: str + :keyword status: The operation status. + :paramtype status: str + :keyword start_time: The operation start time. + :paramtype start_time: str + :keyword end_time: The operation end time. + :paramtype end_time: str + :keyword error: The error. + :paramtype error: ~azure.mgmt.powerbiprivatelinks.models.ErrorDetail + """ + super(AsyncOperationDetail, self).__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.start_time = start_time + self.end_time = end_time + self.error = error + + +class ConnectionState(msrest.serialization.Model): + """ConnectionState information. + + :ivar status: Status of the connection. Possible values include: "Pending", "Approved", + "Rejected", "Disconnected". + :vartype status: str or ~azure.mgmt.powerbiprivatelinks.models.PersistedConnectionStatus + :ivar description: Description of the connection state. + :vartype description: str + :ivar actions_required: Actions required (if any). + :vartype actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PersistedConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs + ): + """ + :keyword status: Status of the connection. Possible values include: "Pending", "Approved", + "Rejected", "Disconnected". + :paramtype status: str or ~azure.mgmt.powerbiprivatelinks.models.PersistedConnectionStatus + :keyword description: Description of the connection state. + :paramtype description: str + :keyword actions_required: Actions required (if any). + :paramtype actions_required: str + """ + super(ConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.powerbiprivatelinks.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.powerbiprivatelinks.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.powerbiprivatelinks.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.powerbiprivatelinks.models.ErrorDetail + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class GroupConnectivityInformation(msrest.serialization.Model): + """GroupConnectivityInformation. + + :ivar group_id: Specifies the group id of the group connectivity information. + :vartype group_id: str + :ivar member_name: Specifies the member name of the group connectivity information. + :vartype member_name: str + :ivar internal_fqdn: Specifies the internal FQDN of the group connectivity information. + :vartype internal_fqdn: str + :ivar customer_visible_fqdns: Specifies the customer visible FQDNs of the group connectivity + information. + :vartype customer_visible_fqdns: list[str] + :ivar private_link_service_arm_region: Specifies the ARM region of the group connectivity + information. + :vartype private_link_service_arm_region: str + """ + + _attribute_map = { + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'member_name': {'key': 'memberName', 'type': 'str'}, + 'internal_fqdn': {'key': 'internalFqdn', 'type': 'str'}, + 'customer_visible_fqdns': {'key': 'customerVisibleFqdns', 'type': '[str]'}, + 'private_link_service_arm_region': {'key': 'privateLinkServiceArmRegion', 'type': 'str'}, + } + + def __init__( + self, + *, + group_id: Optional[str] = None, + member_name: Optional[str] = None, + internal_fqdn: Optional[str] = None, + customer_visible_fqdns: Optional[List[str]] = None, + private_link_service_arm_region: Optional[str] = None, + **kwargs + ): + """ + :keyword group_id: Specifies the group id of the group connectivity information. + :paramtype group_id: str + :keyword member_name: Specifies the member name of the group connectivity information. + :paramtype member_name: str + :keyword internal_fqdn: Specifies the internal FQDN of the group connectivity information. + :paramtype internal_fqdn: str + :keyword customer_visible_fqdns: Specifies the customer visible FQDNs of the group connectivity + information. + :paramtype customer_visible_fqdns: list[str] + :keyword private_link_service_arm_region: Specifies the ARM region of the group connectivity + information. + :paramtype private_link_service_arm_region: str + """ + super(GroupConnectivityInformation, self).__init__(**kwargs) + self.group_id = group_id + self.member_name = member_name + self.internal_fqdn = internal_fqdn + self.customer_visible_fqdns = customer_visible_fqdns + self.private_link_service_arm_region = private_link_service_arm_region + + +class Operation(msrest.serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.powerbiprivatelinks.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", + "system", "user,system". + :vartype origin: str or ~azure.mgmt.powerbiprivatelinks.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.powerbiprivatelinks.models.ActionType + """ + + _validation = { + 'name': {'readonly': True}, + 'is_data_action': {'readonly': True}, + 'origin': {'readonly': True}, + 'action_type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.powerbiprivatelinks.models.OperationDisplay + """ + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None + + +class OperationDisplay(msrest.serialization.Model): + """Localized display information for this particular operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _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 = None + self.resource = None + self.operation = None + self.description = None + + +class OperationListResult(msrest.serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.powerbiprivatelinks.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """PrivateEndpoint. + + :ivar id: Specifies the id of private endpoint. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Specifies the id of private endpoint. + :paramtype id: str + """ + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = id + + +class PrivateEndpointConnection(msrest.serialization.Model): + """PrivateEndpointConnection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Specifies the id of the resource. + :vartype id: str + :ivar name: Specifies the name of the resource. + :vartype name: str + :ivar type: Specifies the type of the resource. + :vartype type: str + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.powerbiprivatelinks.models.SystemData + :ivar private_endpoint: Specifies the private endpoint. + :vartype private_endpoint: ~azure.mgmt.powerbiprivatelinks.models.PrivateEndpoint + :ivar private_link_service_connection_state: Specifies the connection state. + :vartype private_link_service_connection_state: + ~azure.mgmt.powerbiprivatelinks.models.ConnectionState + :ivar provisioning_state: Provisioning state of the Private Endpoint Connection. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.powerbiprivatelinks.models.ResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'ConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["ConnectionState"] = None, + provisioning_state: Optional[Union[str, "ResourceProvisioningState"]] = None, + **kwargs + ): + """ + :keyword private_endpoint: Specifies the private endpoint. + :paramtype private_endpoint: ~azure.mgmt.powerbiprivatelinks.models.PrivateEndpoint + :keyword private_link_service_connection_state: Specifies the connection state. + :paramtype private_link_service_connection_state: + ~azure.mgmt.powerbiprivatelinks.models.ConnectionState + :keyword provisioning_state: Provisioning state of the Private Endpoint Connection. Possible + values include: "Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed". + :paramtype provisioning_state: str or + ~azure.mgmt.powerbiprivatelinks.models.ResourceProvisioningState + """ + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connections. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Specifies the name of the private endpoint connection. + :vartype value: list[~azure.mgmt.powerbiprivatelinks.models.PrivateEndpointConnection] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + """ + :keyword value: Specifies the name of the private endpoint connection. + :paramtype value: list[~azure.mgmt.powerbiprivatelinks.models.PrivateEndpointConnection] + """ + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PrivateLinkConnectionDetail(msrest.serialization.Model): + """PrivateLinkConnectionDetail. + + :ivar id: Specifies the type of the connection detail. + :vartype id: str + :ivar member_name: Specifies the member name of the connection detail. + :vartype member_name: str + :ivar private_ip_address: Specifies the private ip address of the connection detail. + :vartype private_ip_address: str + :ivar link_identifier: Specifies the link id of the connection detail. + :vartype link_identifier: str + :ivar group_id: Specifies the group id of the connection detail. + :vartype group_id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'member_name': {'key': 'memberName', 'type': 'str'}, + 'private_ip_address': {'key': 'privateIpAddress', 'type': 'str'}, + 'link_identifier': {'key': 'linkIdentifier', 'type': 'str'}, + 'group_id': {'key': 'groupId', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + member_name: Optional[str] = None, + private_ip_address: Optional[str] = None, + link_identifier: Optional[str] = None, + group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Specifies the type of the connection detail. + :paramtype id: str + :keyword member_name: Specifies the member name of the connection detail. + :paramtype member_name: str + :keyword private_ip_address: Specifies the private ip address of the connection detail. + :paramtype private_ip_address: str + :keyword link_identifier: Specifies the link id of the connection detail. + :paramtype link_identifier: str + :keyword group_id: Specifies the group id of the connection detail. + :paramtype group_id: str + """ + super(PrivateLinkConnectionDetail, self).__init__(**kwargs) + self.id = id + self.member_name = member_name + self.private_ip_address = private_ip_address + self.link_identifier = link_identifier + self.group_id = group_id + + +class PrivateLinkResource(msrest.serialization.Model): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the resource. + :vartype id: str + :ivar name: Name of the resource. + :vartype name: str + :ivar type: Type of the resource. + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] + """ + + _validation = { + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword id: Fully qualified identifier of the resource. + :paramtype id: str + :keyword name: Name of the resource. + :paramtype name: str + :keyword type: Type of the resource. + :paramtype type: str + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ + super(PrivateLinkResource, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourcesListResult(msrest.serialization.Model): + """Specifies list of the private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A collection of private endpoint connection resources. + :vartype value: list[~azure.mgmt.powerbiprivatelinks.models.PrivateLinkResource] + :ivar next_link: URL to get the next set of operation list results (if there are any). + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + **kwargs + ): + """ + :keyword value: A collection of private endpoint connection resources. + :paramtype value: list[~azure.mgmt.powerbiprivatelinks.models.PrivateLinkResource] + """ + super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PrivateLinkServiceConnection(msrest.serialization.Model): + """PrivateLinkServiceConnection. + + :ivar name: Specifies the name of the private link service connection. + :vartype name: str + :ivar group_ids: Specifies the group ids of the private link service connection. + :vartype group_ids: list[str] + :ivar request_message: Specifies the request message of the private link service connection. + :vartype request_message: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'group_ids': {'key': 'groupIds', 'type': '[str]'}, + 'request_message': {'key': 'requestMessage', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + group_ids: Optional[List[str]] = None, + request_message: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Specifies the name of the private link service connection. + :paramtype name: str + :keyword group_ids: Specifies the group ids of the private link service connection. + :paramtype group_ids: list[str] + :keyword request_message: Specifies the request message of the private link service connection. + :paramtype request_message: str + """ + super(PrivateLinkServiceConnection, self).__init__(**kwargs) + self.name = name + self.group_ids = group_ids + self.request_message = request_message + + +class PrivateLinkServiceProxy(msrest.serialization.Model): + """PrivateLinkServiceProxy. + + :ivar id: Specifies the id of the private link service proxy. + :vartype id: str + :ivar group_connectivity_information: Specifies the group connectivity information of the + private link service proxy. + :vartype group_connectivity_information: + list[~azure.mgmt.powerbiprivatelinks.models.GroupConnectivityInformation] + :ivar remote_private_link_service_connection_state: Specifies the connection state of the + private link service proxy. + :vartype remote_private_link_service_connection_state: + ~azure.mgmt.powerbiprivatelinks.models.ConnectionState + :ivar remote_private_endpoint_connection: Specifies the private endpoint connection of the + private link service proxy. + :vartype remote_private_endpoint_connection: + ~azure.mgmt.powerbiprivatelinks.models.RemotePrivateEndpointConnection + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'group_connectivity_information': {'key': 'groupConnectivityInformation', 'type': '[GroupConnectivityInformation]'}, + 'remote_private_link_service_connection_state': {'key': 'remotePrivateLinkServiceConnectionState', 'type': 'ConnectionState'}, + 'remote_private_endpoint_connection': {'key': 'remotePrivateEndpointConnection', 'type': 'RemotePrivateEndpointConnection'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + group_connectivity_information: Optional[List["GroupConnectivityInformation"]] = None, + remote_private_link_service_connection_state: Optional["ConnectionState"] = None, + remote_private_endpoint_connection: Optional["RemotePrivateEndpointConnection"] = None, + **kwargs + ): + """ + :keyword id: Specifies the id of the private link service proxy. + :paramtype id: str + :keyword group_connectivity_information: Specifies the group connectivity information of the + private link service proxy. + :paramtype group_connectivity_information: + list[~azure.mgmt.powerbiprivatelinks.models.GroupConnectivityInformation] + :keyword remote_private_link_service_connection_state: Specifies the connection state of the + private link service proxy. + :paramtype remote_private_link_service_connection_state: + ~azure.mgmt.powerbiprivatelinks.models.ConnectionState + :keyword remote_private_endpoint_connection: Specifies the private endpoint connection of the + private link service proxy. + :paramtype remote_private_endpoint_connection: + ~azure.mgmt.powerbiprivatelinks.models.RemotePrivateEndpointConnection + """ + super(PrivateLinkServiceProxy, self).__init__(**kwargs) + self.id = id + self.group_connectivity_information = group_connectivity_information + self.remote_private_link_service_connection_state = remote_private_link_service_connection_state + self.remote_private_endpoint_connection = remote_private_endpoint_connection + + +class RemotePrivateEndpointConnection(msrest.serialization.Model): + """RemotePrivateEndpointConnection. + + :ivar id: Specifies the id of private endpoint connection. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Specifies the id of private endpoint connection. + :paramtype id: str + """ + super(RemotePrivateEndpointConnection, self).__init__(**kwargs) + self.id = id + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.powerbiprivatelinks.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.powerbiprivatelinks.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.powerbiprivatelinks.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.powerbiprivatelinks.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TenantResource(msrest.serialization.Model): + """TenantResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Specifies the resource identifier of the resource. + :vartype id: str + :ivar name: Specifies the name of the resource. + :vartype name: str + :ivar type: Specifies the type of the resource. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.powerbiprivatelinks.models.SystemData + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar tags: A set of tags. Specifies the tags of the resource. + :vartype tags: dict[str, str] + :ivar tenant_id: Specifies the tenant id of the resource. + :vartype tenant_id: str + :ivar private_endpoint_connections: Specifies the private endpoint connections of the resource. + :vartype private_endpoint_connections: + list[~azure.mgmt.powerbiprivatelinks.models.PrivateEndpointConnection] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + tenant_id: Optional[str] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + """ + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Specifies the tags of the resource. + :paramtype tags: dict[str, str] + :keyword tenant_id: Specifies the tenant id of the resource. + :paramtype tenant_id: str + :keyword private_endpoint_connections: Specifies the private endpoint connections of the + resource. + :paramtype private_endpoint_connections: + list[~azure.mgmt.powerbiprivatelinks.models.PrivateEndpointConnection] + """ + super(TenantResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + self.location = location + self.tags = tags + self.tenant_id = tenant_id + self.private_endpoint_connections = private_endpoint_connections diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/models/_private_link_services_for_power_bi_client_enums.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/models/_private_link_services_for_power_bi_client_enums.py new file mode 100644 index 000000000000..83a1a6279819 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/models/_private_link_services_for_power_bi_client_enums.py @@ -0,0 +1,63 @@ +# 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 +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """ActionsRequired + """ + + NONE = "None" + RECREATE = "Recreate" + +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + + INTERNAL = "Internal" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system" + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + +class PersistedConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Status of the connection. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class ResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Private Endpoint Connection. + """ + + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/__init__.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/__init__.py new file mode 100644 index 000000000000..83ff07df8cfa --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/__init__.py @@ -0,0 +1,25 @@ +# 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 ._operations import Operations +from ._private_link_services_for_power_bi_operations import PrivateLinkServicesForPowerBIOperations +from ._private_link_service_resource_operation_results_operations import PrivateLinkServiceResourceOperationResultsOperations +from ._private_link_services_operations import PrivateLinkServicesOperations +from ._power_bi_resources_operations import PowerBIResourcesOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations + +__all__ = [ + 'Operations', + 'PrivateLinkServicesForPowerBIOperations', + 'PrivateLinkServiceResourceOperationResultsOperations', + 'PrivateLinkServicesOperations', + 'PowerBIResourcesOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', +] diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_operations.py new file mode 100644 index 000000000000..8df05a9b8fcd --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_operations.py @@ -0,0 +1,136 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.PowerBI/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class Operations(object): + """Operations 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.powerbiprivatelinks.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 + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: + """Lists all of the available Power BI RP operations. + + :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.powerbiprivatelinks.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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.PowerBI/operations'} # type: ignore diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_power_bi_resources_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_power_bi_resources_operations.py new file mode 100644 index 000000000000..0eb855a0459c --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_power_bi_resources_operations.py @@ -0,0 +1,426 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_resource_name_request( + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "azureResourceName": _SERIALIZER.url("azure_resource_name", azure_resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + *, + json: JSONType = None, + content: Any = None, + client_tenant_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "azureResourceName": _SERIALIZER.url("azure_resource_name", azure_resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if client_tenant_id is not None: + header_parameters['x-ms-client-tenant-id'] = _SERIALIZER.header("client_tenant_id", client_tenant_id, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + *, + json: JSONType = None, + content: Any = None, + client_tenant_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "azureResourceName": _SERIALIZER.url("azure_resource_name", azure_resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if client_tenant_id is not None: + header_parameters['x-ms-client-tenant-id'] = _SERIALIZER.header("client_tenant_id", client_tenant_id, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "azureResourceName": _SERIALIZER.url("azure_resource_name", azure_resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class PowerBIResourcesOperations(object): + """PowerBIResourcesOperations 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.powerbiprivatelinks.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 + + @distributed_trace + def list_by_resource_name( + self, + **kwargs: Any + ) -> List["_models.TenantResource"]: + """Gets all the private link resources for the given Azure resource. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of TenantResource, or the result of cls(response) + :rtype: list[~azure.mgmt.powerbiprivatelinks.models.TenantResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.TenantResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_by_resource_name_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + template_url=self.list_by_resource_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[TenantResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_resource_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}'} # type: ignore + + + @distributed_trace + def create( + self, + body: "_models.TenantResource", + client_tenant_id: Optional[str] = None, + **kwargs: Any + ) -> "_models.TenantResource": + """Creates or updates a Private Link Service Resource for Power BI. + + :param body: Tenant resource to be created or updated. + :type body: ~azure.mgmt.powerbiprivatelinks.models.TenantResource + :param client_tenant_id: The client tenant id in header. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). + :type client_tenant_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TenantResource, or the result of cls(response) + :rtype: ~azure.mgmt.powerbiprivatelinks.models.TenantResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'TenantResource') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + content_type=content_type, + json=_json, + client_tenant_id=client_tenant_id, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TenantResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}'} # type: ignore + + + @distributed_trace + def update( + self, + body: "_models.TenantResource", + client_tenant_id: Optional[str] = None, + **kwargs: Any + ) -> "_models.TenantResource": + """Creates or updates a Private Link Service Resource for Power BI. + + :param body: Tenant resource to be created or updated. + :type body: ~azure.mgmt.powerbiprivatelinks.models.TenantResource + :param client_tenant_id: The client tenant id in header. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). + :type client_tenant_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TenantResource, or the result of cls(response) + :rtype: ~azure.mgmt.powerbiprivatelinks.models.TenantResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TenantResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'TenantResource') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + content_type=content_type, + json=_json, + client_tenant_id=client_tenant_id, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TenantResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TenantResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}'} # type: ignore + + + @distributed_trace + def delete( + self, + **kwargs: Any + ) -> None: + """Deletes a Private Link Service Resource for Power BI. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}'} # type: ignore + diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_endpoint_connections_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..7ba5ce2da898 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,490 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_resource_request( + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "azureResourceName": _SERIALIZER.url("azure_resource_name", azure_resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + private_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "azureResourceName": _SERIALIZER.url("azure_resource_name", azure_resource_name, 'str'), + "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + private_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "azureResourceName": _SERIALIZER.url("azure_resource_name", azure_resource_name, 'str'), + "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + private_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "azureResourceName": _SERIALIZER.url("azure_resource_name", azure_resource_name, 'str'), + "privateEndpointName": _SERIALIZER.url("private_endpoint_name", private_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations 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.powerbiprivatelinks.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 + + @distributed_trace + def list_by_resource( + self, + resource_group_name: str, + azure_resource_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: + """Lists all private endpoint connections under a resource. + + Gets private endpoint connection for Power BI. + + :param resource_group_name: The name of the resource group within the user's subscription. + :type resource_group_name: str + :param azure_resource_name: The name of the powerbi resource. + :type azure_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.powerbiprivatelinks.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + azure_resource_name=azure_resource_name, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + azure_resource_name=azure_resource_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections'} # type: ignore + + @distributed_trace + def get( + self, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Get a specific private endpoint connection. + + Get a specific private endpoint connection for Power BI by private endpoint name. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.powerbiprivatelinks.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + private_endpoint_name=self._config.private_endpoint_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}'} # type: ignore + + + @distributed_trace + def create( + self, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Update a specific private endpoint connection. + + Updates the status of Private Endpoint Connection object. Used to approve or reject a + connection. + + :param private_endpoint_connection: Private endpoint connection object to update. + :type private_endpoint_connection: + ~azure.mgmt.powerbiprivatelinks.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.powerbiprivatelinks.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + private_endpoint_name=self._config.private_endpoint_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}'} # type: ignore + + + def _delete_initial( + self, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + private_endpoint_name=self._config.private_endpoint_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + **kwargs: Any + ) -> LROPoller[None]: + """Asynchronous API to delete a private endpoint connection for Power BI by private endpoint name. + + Deletes a private endpoint connection for Power BI by private endpoint name. + + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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, azure.core.polling.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( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', 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': '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_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateEndpointConnections/{privateEndpointName}'} # type: ignore diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_link_resources_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..40aea003f48c --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_link_resources_operations.py @@ -0,0 +1,244 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +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 HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_resource_request( + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "azureResourceName": _SERIALIZER.url("azure_resource_name", azure_resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + azure_resource_name: str, + private_link_resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateLinkResources/{privateLinkResourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "azureResourceName": _SERIALIZER.url("azure_resource_name", azure_resource_name, 'str'), + "privateLinkResourceName": _SERIALIZER.url("private_link_resource_name", private_link_resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations 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.powerbiprivatelinks.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 + + @distributed_trace + def list_by_resource( + self, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourcesListResult"]: + """List private link Power BI resource. + + List private link resources under a specific Power BI resource. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourcesListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.powerbiprivatelinks.models.PrivateLinkResourcesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourcesListResult", 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateLinkResources'} # type: ignore + + @distributed_trace + def get( + self, + private_link_resource_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResource": + """Get a private link resource. + + Get properties of a private link resource. + + :param private_link_resource_name: The name of private link resource. + :type private_link_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.powerbiprivatelinks.models.PrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + azure_resource_name=self._config.azure_resource_name, + private_link_resource_name=private_link_resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI/{azureResourceName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_link_service_resource_operation_results_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_link_service_resource_operation_results_operations.py new file mode 100644 index 000000000000..983a0b0bd58f --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_link_service_resource_operation_results_operations.py @@ -0,0 +1,180 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request_initial( + subscription_id: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/operationResults/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class PrivateLinkServiceResourceOperationResultsOperations(object): + """PrivateLinkServiceResourceOperationResultsOperations 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.powerbiprivatelinks.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 _get_initial( + self, + **kwargs: Any + ) -> "_models.AsyncOperationDetail": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationDetail"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request_initial( + subscription_id=self._config.subscription_id, + operation_id=self._config.operation_id, + template_url=self._get_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AsyncOperationDetail', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AsyncOperationDetail', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _get_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/operationResults/{operationId}'} # type: ignore + + + @distributed_trace + def begin_get( + self, + **kwargs: Any + ) -> LROPoller["_models.AsyncOperationDetail"]: + """Gets operation result of Private Link Service Resources for Power BI. + + :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: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a 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 AsyncOperationDetail or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.powerbiprivatelinks.models.AsyncOperationDetail] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationDetail"] + 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._get_initial( + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AsyncOperationDetail', 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_get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/operationResults/{operationId}'} # type: ignore diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_link_services_for_power_bi_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_link_services_for_power_bi_operations.py new file mode 100644 index 000000000000..f653769bd6e2 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_link_services_for_power_bi_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_id_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class PrivateLinkServicesForPowerBIOperations(object): + """PrivateLinkServicesForPowerBIOperations 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.powerbiprivatelinks.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 + + @distributed_trace + def list_by_subscription_id( + self, + **kwargs: Any + ) -> List["_models.TenantResource"]: + """Gets all the private link resources for the given subscription id. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of TenantResource, or the result of cls(response) + :rtype: list[~azure.mgmt.powerbiprivatelinks.models.TenantResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.TenantResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_by_subscription_id_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[TenantResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI'} # type: ignore + diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_link_services_operations.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_link_services_operations.py new file mode 100644 index 000000000000..3186b655db22 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/operations/_private_link_services_operations.py @@ -0,0 +1,125 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class PrivateLinkServicesOperations(object): + """PrivateLinkServicesOperations 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.powerbiprivatelinks.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 + + @distributed_trace + def list_by_resource_group( + self, + **kwargs: Any + ) -> List["_models.TenantResource"]: + """Gets all the private link resources for the given resource group. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of TenantResource, or the result of cls(response) + :rtype: list[~azure.mgmt.powerbiprivatelinks.models.TenantResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.TenantResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=self._config.resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + 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.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[TenantResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/privateLinkServicesForPowerBI'} # type: ignore + diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/py.typed b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/azure/mgmt/powerbiprivatelinks/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/sdk_packaging.toml b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/sdk_packaging.toml new file mode 100644 index 000000000000..e8a68686efba --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-powerbiprivatelinks" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/setup.py b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/setup.py new file mode 100644 index 000000000000..1e13c4cde090 --- /dev/null +++ b/sdk/powerbiprivatelinks/azure-mgmt-powerbiprivatelinks/setup.py @@ -0,0 +1,74 @@ +#!/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-powerbiprivatelinks" +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('-', '.') + +# 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', + keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + '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.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.3.0,<2.0.0', + ], + python_requires=">=3.6" +) diff --git a/sdk/powerbiprivatelinks/ci.yml b/sdk/powerbiprivatelinks/ci.yml new file mode 100644 index 000000000000..30553b6c9980 --- /dev/null +++ b/sdk/powerbiprivatelinks/ci.yml @@ -0,0 +1,33 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/powerbiprivatelinks/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/powerbiprivatelinks/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: powerbiprivatelinks + Artifacts: + - name: azure-mgmt-powerbiprivatelinks + safeName: azuremgmtpowerbiprivatelinks