Skip to content

Commit

Permalink
CodeGen from PR 23816 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge eecbe3142da314cbf1468a8bcbe08ccbbdbb2fac into a7f520b6a20f0874aa3e0e94dc08039589384baf
  • Loading branch information
SDKAuto committed May 17, 2023
1 parent 79080d1 commit f8a9887
Show file tree
Hide file tree
Showing 160 changed files with 9,419 additions and 1,475 deletions.
6 changes: 3 additions & 3 deletions sdk/appcontainers/azure-mgmt-appcontainers/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "d1b57073903fc64486bf53a37f061e5c7ab9ca31",
"commit": "fb2889ee8313bbb906ad0dedd0eece4906611601",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/[email protected].0",
"@autorest/[email protected].12",
"@autorest/[email protected]"
],
"autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/[email protected].0 --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
"autorest_command": "autorest specification/app/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/[email protected].12 --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
"readme": "specification/app/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -15,11 +14,6 @@

from ._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
Expand All @@ -33,23 +27,35 @@ class ContainerAppsAPIClientConfiguration(Configuration): # pylint: disable=too
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param job_name: Job Name. Required.
:type job_name: str
:param job_execution_name: Job execution name. Required.
:type job_execution_name: str
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-04-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
def __init__(
self, credential: "TokenCredential", job_name: str, job_execution_name: str, subscription_id: str, **kwargs: Any
) -> None:
super(ContainerAppsAPIClientConfiguration, self).__init__(**kwargs)
api_version: Literal["2022-10-01"] = kwargs.pop("api_version", "2022-10-01")
api_version: str = kwargs.pop("api_version", "2023-04-01-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if job_name is None:
raise ValueError("Parameter 'job_name' must not be None.")
if job_execution_name is None:
raise ValueError("Parameter 'job_execution_name' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")

self.credential = credential
self.job_name = job_name
self.job_execution_name = job_execution_name
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@
ConnectedEnvironmentsDaprComponentsOperations,
ConnectedEnvironmentsOperations,
ConnectedEnvironmentsStoragesOperations,
ContainerAppsAPIClientOperationsMixin,
ContainerAppsAuthConfigsOperations,
ContainerAppsDiagnosticsOperations,
ContainerAppsOperations,
ContainerAppsRevisionReplicasOperations,
ContainerAppsRevisionsOperations,
ContainerAppsSourceControlsOperations,
DaprComponentsOperations,
JobsExecutionsOperations,
JobsOperations,
ManagedCertificatesOperations,
ManagedEnvironmentDiagnosticsOperations,
ManagedEnvironmentsDiagnosticsOperations,
ManagedEnvironmentsOperations,
Expand All @@ -43,7 +47,9 @@
from azure.core.credentials import TokenCredential


class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
class ContainerAppsAPIClient(
ContainerAppsAPIClientOperationsMixin
): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""ContainerAppsAPIClient.
:ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations
Expand Down Expand Up @@ -87,11 +93,18 @@ class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyw
azure.mgmt.appcontainers.operations.ManagedEnvironmentsDiagnosticsOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.appcontainers.operations.Operations
:ivar jobs: JobsOperations operations
:vartype jobs: azure.mgmt.appcontainers.operations.JobsOperations
:ivar jobs_executions: JobsExecutionsOperations operations
:vartype jobs_executions: azure.mgmt.appcontainers.operations.JobsExecutionsOperations
:ivar managed_environments: ManagedEnvironmentsOperations operations
:vartype managed_environments:
azure.mgmt.appcontainers.operations.ManagedEnvironmentsOperations
:ivar certificates: CertificatesOperations operations
:vartype certificates: azure.mgmt.appcontainers.operations.CertificatesOperations
:ivar managed_certificates: ManagedCertificatesOperations operations
:vartype managed_certificates:
azure.mgmt.appcontainers.operations.ManagedCertificatesOperations
:ivar namespaces: NamespacesOperations operations
:vartype namespaces: azure.mgmt.appcontainers.operations.NamespacesOperations
:ivar dapr_components: DaprComponentsOperations operations
Expand All @@ -104,12 +117,16 @@ class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyw
azure.mgmt.appcontainers.operations.ContainerAppsSourceControlsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param job_name: Job Name. Required.
:type job_name: str
:param job_execution_name: Job execution name. Required.
:type job_execution_name: str
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-04-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
Expand All @@ -118,14 +135,20 @@ class ContainerAppsAPIClient: # pylint: disable=client-accepts-api-version-keyw
def __init__(
self,
credential: "TokenCredential",
job_name: str,
job_execution_name: str,
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = ContainerAppsAPIClientConfiguration(
credential=credential, subscription_id=subscription_id, **kwargs
credential=credential,
job_name=job_name,
job_execution_name=job_execution_name,
subscription_id=subscription_id,
**kwargs
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
self._client: ARMPipelineClient = 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)
Expand Down Expand Up @@ -167,10 +190,15 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize)
self.jobs_executions = JobsExecutionsOperations(self._client, self._config, self._serialize, self._deserialize)
self.managed_environments = ManagedEnvironmentsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize)
self.managed_certificates = ManagedCertificatesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize)
self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize)
self.managed_environments_storages = ManagedEnvironmentsStoragesOperations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
if xml_desc.get("attr", False):
if xml_ns:
ET.register_namespace(xml_prefix, xml_ns)
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
serialized.set(xml_name, new_attr) # type: ignore
continue
if xml_desc.get("text", False):
Expand Down Expand Up @@ -1271,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type):
xml_name = internal_type_xml_map.get("name", internal_type.__name__)
xml_ns = internal_type_xml_map.get("ns", None)
if xml_ns:
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)
return xml_name


Expand All @@ -1295,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data):
# Integrate namespace if necessary
xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None))
if xml_ns:
xml_name = "{}{}".format(xml_ns, xml_name)
xml_name = "{{{}}}{}".format(xml_ns, xml_name)

# If it's an attribute, that's simple
if xml_desc.get("attr", False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import List, cast
from abc import ABC
from typing import List, TYPE_CHECKING, cast

from azure.core.pipeline.transport import HttpRequest

from ._configuration import ContainerAppsAPIClientConfiguration

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core import PipelineClient

from ._serialization import Deserializer, Serializer


def _convert_request(request, files=None):
data = request.content if not files else None
Expand All @@ -28,3 +37,12 @@ def _format_url_section(template, **kwargs):
formatted_components = cast(List[str], template.split("/"))
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
template = "/".join(components)


class ContainerAppsAPIClientMixinABC(ABC):
"""DO NOT use this class. It is for internal typing use only."""

_client: "PipelineClient"
_config: ContainerAppsAPIClientConfiguration
_serialize: "Serializer"
_deserialize: "Deserializer"
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "2.0.0"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -15,11 +14,6 @@

from .._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
Expand All @@ -33,23 +27,40 @@ class ContainerAppsAPIClientConfiguration(Configuration): # pylint: disable=too
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param job_name: Job Name. Required.
:type job_name: str
:param job_execution_name: Job execution name. Required.
:type job_execution_name: str
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2023-04-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
def __init__(
self,
credential: "AsyncTokenCredential",
job_name: str,
job_execution_name: str,
subscription_id: str,
**kwargs: Any
) -> None:
super(ContainerAppsAPIClientConfiguration, self).__init__(**kwargs)
api_version: Literal["2022-10-01"] = kwargs.pop("api_version", "2022-10-01")
api_version: str = kwargs.pop("api_version", "2023-04-01-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if job_name is None:
raise ValueError("Parameter 'job_name' must not be None.")
if job_execution_name is None:
raise ValueError("Parameter 'job_execution_name' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")

self.credential = credential
self.job_name = job_name
self.job_execution_name = job_execution_name
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
Expand Down
Loading

0 comments on commit f8a9887

Please sign in to comment.