Skip to content

Commit

Permalink
CodeGen from PR 18208 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 4772ab9f3e13afc920d577bea23077ec30e32528 into 2abe647120f14bb145968a5543ead8ed51394498
  • Loading branch information
SDKAuto committed Mar 15, 2022
1 parent 14ff5a8 commit fd96d62
Show file tree
Hide file tree
Showing 40 changed files with 5,410 additions and 7,049 deletions.
11 changes: 11 additions & 0 deletions sdk/network/azure-mgmt-frontdoor/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"autorest": "3.7.2",
"use": [
"@autorest/python@5.12.0",
"@autorest/modelerfour@4.19.3"
],
"commit": "d6191d641c750189751bde4466749fa589265abc",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/frontdoor/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/frontdoor/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
__version__ = VERSION
__all__ = ['FrontDoorManagementClient']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
# `._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()
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential


Expand All @@ -35,16 +33,15 @@ class FrontDoorManagementClientConfiguration(Configuration):

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
):
# type: (...) -> None
credential: "TokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
super(FrontDoorManagementClientConfiguration, 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.")
super(FrontDoorManagementClientConfiguration, self).__init__(**kwargs)

self.credential = credential
self.subscription_id = subscription_id
Expand All @@ -67,4 +64,4 @@ def _configure(
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,41 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING
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 FrontDoorManagementClientConfiguration
from .operations import EndpointsOperations, ExperimentsOperations, FrontDoorNameAvailabilityOperations, FrontDoorNameAvailabilityWithSubscriptionOperations, FrontDoorsOperations, FrontendEndpointsOperations, ManagedRuleSetsOperations, NetworkExperimentProfilesOperations, PoliciesOperations, PreconfiguredEndpointsOperations, ReportsOperations, RulesEnginesOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.credentials import TokenCredential

from ._configuration import FrontDoorManagementClientConfiguration
from .operations import NetworkExperimentProfilesOperations
from .operations import PreconfiguredEndpointsOperations
from .operations import ExperimentsOperations
from .operations import ReportsOperations
from .operations import FrontDoorNameAvailabilityOperations
from .operations import FrontDoorNameAvailabilityWithSubscriptionOperations
from .operations import FrontDoorsOperations
from .operations import FrontendEndpointsOperations
from .operations import EndpointsOperations
from .operations import RulesEnginesOperations
from .operations import PoliciesOperations
from .operations import ManagedRuleSetsOperations
from . import models


class FrontDoorManagementClient(object):
class FrontDoorManagementClient:
"""FrontDoor Client.
:ivar network_experiment_profiles: NetworkExperimentProfilesOperations operations
:vartype network_experiment_profiles: azure.mgmt.frontdoor.operations.NetworkExperimentProfilesOperations
:vartype network_experiment_profiles:
azure.mgmt.frontdoor.operations.NetworkExperimentProfilesOperations
:ivar preconfigured_endpoints: PreconfiguredEndpointsOperations operations
:vartype preconfigured_endpoints: azure.mgmt.frontdoor.operations.PreconfiguredEndpointsOperations
:vartype preconfigured_endpoints:
azure.mgmt.frontdoor.operations.PreconfiguredEndpointsOperations
:ivar experiments: ExperimentsOperations operations
:vartype experiments: azure.mgmt.frontdoor.operations.ExperimentsOperations
:ivar reports: ReportsOperations operations
:vartype reports: azure.mgmt.frontdoor.operations.ReportsOperations
:ivar front_door_name_availability: FrontDoorNameAvailabilityOperations operations
:vartype front_door_name_availability: azure.mgmt.frontdoor.operations.FrontDoorNameAvailabilityOperations
:ivar front_door_name_availability_with_subscription: FrontDoorNameAvailabilityWithSubscriptionOperations operations
:vartype front_door_name_availability_with_subscription: azure.mgmt.frontdoor.operations.FrontDoorNameAvailabilityWithSubscriptionOperations
:vartype front_door_name_availability:
azure.mgmt.frontdoor.operations.FrontDoorNameAvailabilityOperations
:ivar front_door_name_availability_with_subscription:
FrontDoorNameAvailabilityWithSubscriptionOperations operations
:vartype front_door_name_availability_with_subscription:
azure.mgmt.frontdoor.operations.FrontDoorNameAvailabilityWithSubscriptionOperations
:ivar front_doors: FrontDoorsOperations operations
:vartype front_doors: azure.mgmt.frontdoor.operations.FrontDoorsOperations
:ivar frontend_endpoints: FrontendEndpointsOperations operations
Expand All @@ -62,54 +55,68 @@ class FrontDoorManagementClient(object):
:vartype managed_rule_sets: azure.mgmt.frontdoor.operations.ManagedRuleSetsOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
:param subscription_id: The subscription credentials which uniquely identify the Microsoft
Azure subscription. The subscription ID forms part of the URI for every service call.
:type subscription_id: str
:param str base_url: Service URL
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
: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, # type: "TokenCredential"
subscription_id, # type: str
base_url=None, # type: Optional[str]
**kwargs # type: Any
):
# type: (...) -> None
if not base_url:
base_url = 'https://management.azure.com'
self._config = FrontDoorManagementClientConfiguration(credential, subscription_id, **kwargs)
credential: "TokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = FrontDoorManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.network_experiment_profiles = NetworkExperimentProfilesOperations(self._client, self._config, self._serialize, self._deserialize)
self.preconfigured_endpoints = PreconfiguredEndpointsOperations(self._client, self._config, self._serialize, self._deserialize)
self.experiments = ExperimentsOperations(self._client, self._config, self._serialize, self._deserialize)
self.reports = ReportsOperations(self._client, self._config, self._serialize, self._deserialize)
self.front_door_name_availability = FrontDoorNameAvailabilityOperations(self._client, self._config, self._serialize, self._deserialize)
self.front_door_name_availability_with_subscription = FrontDoorNameAvailabilityWithSubscriptionOperations(self._client, self._config, self._serialize, self._deserialize)
self.front_doors = FrontDoorsOperations(self._client, self._config, self._serialize, self._deserialize)
self.frontend_endpoints = FrontendEndpointsOperations(self._client, self._config, self._serialize, self._deserialize)
self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize)
self.rules_engines = RulesEnginesOperations(self._client, self._config, self._serialize, self._deserialize)
self.policies = PoliciesOperations(self._client, self._config, self._serialize, self._deserialize)
self.managed_rule_sets = ManagedRuleSetsOperations(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/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client._send_request(request)
<HttpResponse: 200 OK>
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
"""

self.network_experiment_profiles = NetworkExperimentProfilesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.preconfigured_endpoints = PreconfiguredEndpointsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.experiments = ExperimentsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.reports = ReportsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.front_door_name_availability = FrontDoorNameAvailabilityOperations(
self._client, self._config, self._serialize, self._deserialize)
self.front_door_name_availability_with_subscription = FrontDoorNameAvailabilityWithSubscriptionOperations(
self._client, self._config, self._serialize, self._deserialize)
self.front_doors = FrontDoorsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.frontend_endpoints = FrontendEndpointsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.endpoints = EndpointsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.rules_engines = RulesEnginesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.policies = PoliciesOperations(
self._client, self._config, self._serialize, self._deserialize)
self.managed_rule_sets = ManagedRuleSetsOperations(
self._client, self._config, self._serialize, self._deserialize)
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
"name": "FrontDoorManagementClient",
"filename": "_front_door_management_client",
"description": "FrontDoor Client.",
"base_url": "\u0027https://management.azure.com\u0027",
"custom_base_url": null,
"host_value": "\"https://management.azure.com\"",
"parameterized_host_template": null,
"azure_arm": true,
"has_lro_operations": true,
"client_side_validation": false
"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\": [\"FrontDoorManagementClientConfiguration\"]}}, \"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\": [\"FrontDoorManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}"
},
"global_parameters": {
"sync": {
Expand All @@ -28,28 +30,71 @@
},
"async": {
"credential": {
"signature": "credential, # type: \"AsyncTokenCredential\"",
"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, # type: str",
"signature": "subscription_id: str,",
"description": "The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
"docstring_type": "str",
"required": true
}
},
"constant": {
},
"call": "credential, subscription_id"
"call": "credential, subscription_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_default_policy_type": "BearerTokenCredentialPolicy",
"credential_default_policy_type_has_async_version": true,
"credential_key_header_name": null
"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": {
"network_experiment_profiles": "NetworkExperimentProfilesOperations",
Expand All @@ -64,9 +109,5 @@
"rules_engines": "RulesEnginesOperations",
"policies": "PoliciesOperations",
"managed_rule_sets": "ManagedRuleSetsOperations"
},
"operation_mixins": {
},
"sync_imports": "None",
"async_imports": "None"
}
}
Loading

0 comments on commit fd96d62

Please sign in to comment.