diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md b/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md index 031dca98691f..ba10466f817a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md +++ b/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md @@ -1,5 +1,44 @@ # Release History +## 3.1.0b1 (2024-03-18) + +### Features Added + + - Added operation ContainerAppsAPIClientOperationsMixin.get_custom_domain_verification_id + - Added operation JobsOperations.get_detector + - Added operation JobsOperations.list_detectors + - Added operation JobsOperations.proxy_get + - Added operation group AppResiliencyOperations + - Added operation group BuildAuthTokenOperations + - Added operation group BuildersOperations + - Added operation group BuildsByBuilderResourceOperations + - Added operation group BuildsOperations + - Added operation group DaprComponentResiliencyPoliciesOperations + - Added operation group DaprSubscriptionsOperations + - Added operation group DotNetComponentsOperations + - Added operation group JavaComponentsOperations + - Added operation group ManagedEnvironmentUsagesOperations + - Added operation group UsagesOperations + - Model AuthConfig has a new parameter encryption_settings + - Model AvailableWorkloadProfileProperties has a new parameter gpus + - Model CertificateProperties has a new parameter certificate_key_vault_properties + - Model CertificateProperties has a new parameter certificate_type + - Model CustomDomainConfiguration has a new parameter certificate_key_vault_properties + - Model DaprComponent has a new parameter service_component_bind + - Model GithubActionConfiguration has a new parameter build_environment_variables + - Model Ingress has a new parameter additional_port_mappings + - Model Ingress has a new parameter target_port_http_scheme + - Model Job has a new parameter extended_location + - Model JobPatchProperties has a new parameter extended_location + - Model LogAnalyticsConfiguration has a new parameter dynamic_json_columns + - Model Login has a new parameter token_store + - Model ManagedEnvironment has a new parameter app_insights_configuration + - Model ManagedEnvironment has a new parameter identity + - Model ManagedEnvironment has a new parameter open_telemetry_configuration + - Model ManagedEnvironmentStorageProperties has a new parameter nfs_azure_file + - Model ServiceBind has a new parameter client_type + - Model ServiceBind has a new parameter customized_keys + ## 3.0.0 (2023-08-18) ### Features Added diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/README.md b/sdk/appcontainers/azure-mgmt-appcontainers/README.md index ff90e78752f4..2fa72cb90b2b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/README.md +++ b/sdk/appcontainers/azure-mgmt-appcontainers/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Appcontainers Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -59,6 +59,3 @@ Code samples for this package can be found at: 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-appcontainers%2FREADME.png) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json index 2b97d51948d3..071ce382b183 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json +++ b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json @@ -1,11 +1,11 @@ { - "commit": "4cd95123fb961c68740565a1efcaa5e43bd35802", + "commit": "e5404d3e55f885d2cb8fdbff3fd1a03bcfc6bb4c", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.13.7", + "@autorest/modelerfour@4.27.0" ], - "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/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --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=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False", "readme": "specification/app/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py index 8c597d56b1c9..5f29dcf6e118 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py @@ -8,7 +8,6 @@ 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 @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class ContainerAppsAPIClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class ContainerAppsAPIClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ContainerAppsAPIClient. Note that all parameters used to create this instance are saved as instance @@ -27,16 +26,15 @@ 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 subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-11-02-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: - super(ContainerAppsAPIClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-05-01") + api_version: str = kwargs.pop("api_version", "2023-11-02-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-appcontainers/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: 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.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py index a40beedb16fa..36b82db88f46 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py @@ -9,15 +9,22 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import ContainerAppsAPIClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + AppResiliencyOperations, AvailableWorkloadProfilesOperations, BillingMetersOperations, + BuildAuthTokenOperations, + BuildersOperations, + BuildsByBuilderResourceOperations, + BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, @@ -30,16 +37,22 @@ ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSourceControlsOperations, + DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, + DaprSubscriptionsOperations, + DotNetComponentsOperations, + JavaComponentsOperations, JobsExecutionsOperations, JobsOperations, ManagedCertificatesOperations, ManagedEnvironmentDiagnosticsOperations, + ManagedEnvironmentUsagesOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, ManagedEnvironmentsStoragesOperations, NamespacesOperations, Operations, + UsagesOperations, ) if TYPE_CHECKING: @@ -52,6 +65,8 @@ class ContainerAppsAPIClient( ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ContainerAppsAPIClient. + :ivar app_resiliency: AppResiliencyOperations operations + :vartype app_resiliency: azure.mgmt.appcontainers.operations.AppResiliencyOperations :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations :vartype container_apps_auth_configs: azure.mgmt.appcontainers.operations.ContainerAppsAuthConfigsOperations @@ -60,6 +75,15 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.AvailableWorkloadProfilesOperations :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.appcontainers.operations.BillingMetersOperations + :ivar builders: BuildersOperations operations + :vartype builders: azure.mgmt.appcontainers.operations.BuildersOperations + :ivar builds_by_builder_resource: BuildsByBuilderResourceOperations operations + :vartype builds_by_builder_resource: + azure.mgmt.appcontainers.operations.BuildsByBuilderResourceOperations + :ivar builds: BuildsOperations operations + :vartype builds: azure.mgmt.appcontainers.operations.BuildsOperations + :ivar build_auth_token: BuildAuthTokenOperations operations + :vartype build_auth_token: azure.mgmt.appcontainers.operations.BuildAuthTokenOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.operations.ConnectedEnvironmentsOperations @@ -91,10 +115,10 @@ class ContainerAppsAPIClient( :ivar managed_environments_diagnostics: ManagedEnvironmentsDiagnosticsOperations operations :vartype managed_environments_diagnostics: 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 operations: Operations operations + :vartype operations: azure.mgmt.appcontainers.operations.Operations :ivar jobs_executions: JobsExecutionsOperations operations :vartype jobs_executions: azure.mgmt.appcontainers.operations.JobsExecutionsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations @@ -107,22 +131,36 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.operations.ManagedCertificatesOperations :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.appcontainers.operations.NamespacesOperations + :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations + :vartype dapr_component_resiliency_policies: + azure.mgmt.appcontainers.operations.DaprComponentResiliencyPoliciesOperations :ivar dapr_components: DaprComponentsOperations operations :vartype dapr_components: azure.mgmt.appcontainers.operations.DaprComponentsOperations + :ivar dapr_subscriptions: DaprSubscriptionsOperations operations + :vartype dapr_subscriptions: azure.mgmt.appcontainers.operations.DaprSubscriptionsOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.operations.ManagedEnvironmentsStoragesOperations :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations :vartype container_apps_source_controls: azure.mgmt.appcontainers.operations.ContainerAppsSourceControlsOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.appcontainers.operations.UsagesOperations + :ivar managed_environment_usages: ManagedEnvironmentUsagesOperations operations + :vartype managed_environment_usages: + azure.mgmt.appcontainers.operations.ManagedEnvironmentUsagesOperations + :ivar java_components: JavaComponentsOperations operations + :vartype java_components: azure.mgmt.appcontainers.operations.JavaComponentsOperations + :ivar dot_net_components: DotNetComponentsOperations operations + :vartype dot_net_components: azure.mgmt.appcontainers.operations.DotNetComponentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2023-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-11-02-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. @@ -138,12 +176,31 @@ def __init__( self._config = ContainerAppsAPIClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **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.app_resiliency = AppResiliencyOperations(self._client, self._config, self._serialize, self._deserialize) self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -151,6 +208,12 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.billing_meters = BillingMetersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builders = BuildersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builds_by_builder_resource = BuildsByBuilderResourceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_auth_token = BuildAuthTokenOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -179,8 +242,8 @@ def __init__( self.managed_environments_diagnostics = ManagedEnvironmentsDiagnosticsOperations( 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.operations = Operations(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 @@ -190,15 +253,29 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.dapr_component_resiliency_policies = DaprComponentResiliencyPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dapr_subscriptions = DaprSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) self.container_apps_source_controls = ContainerAppsSourceControlsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environment_usages = ManagedEnvironmentUsagesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dot_net_components = DotNetComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -218,7 +295,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py index 4bae2292227b..2f781d740827 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +288,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +333,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +344,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +383,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +408,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +438,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +661,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +703,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +723,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +738,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +747,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -804,7 +798,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +818,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1164,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1444,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1481,7 +1473,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1644,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1800,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1853,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1884,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1901,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1936,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1973,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1989,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py index cac9f5d10f8b..48b05f9c489c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.0" +VERSION = "3.1.0b1" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py index 9047e10b128d..079bed7fb5be 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py @@ -8,7 +8,6 @@ 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 @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ContainerAppsAPIClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class ContainerAppsAPIClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ContainerAppsAPIClient. Note that all parameters used to create this instance are saved as instance @@ -27,16 +26,15 @@ 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 subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-11-02-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: - super(ContainerAppsAPIClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-05-01") + api_version: str = kwargs.pop("api_version", "2023-11-02-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-appcontainers/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: 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.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py index fc093b7cef63..33a91fe8d5ac 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py @@ -9,15 +9,22 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import ContainerAppsAPIClientConfiguration from .operations import ( + AppResiliencyOperations, AvailableWorkloadProfilesOperations, BillingMetersOperations, + BuildAuthTokenOperations, + BuildersOperations, + BuildsByBuilderResourceOperations, + BuildsOperations, CertificatesOperations, ConnectedEnvironmentsCertificatesOperations, ConnectedEnvironmentsDaprComponentsOperations, @@ -30,16 +37,22 @@ ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSourceControlsOperations, + DaprComponentResiliencyPoliciesOperations, DaprComponentsOperations, + DaprSubscriptionsOperations, + DotNetComponentsOperations, + JavaComponentsOperations, JobsExecutionsOperations, JobsOperations, ManagedCertificatesOperations, ManagedEnvironmentDiagnosticsOperations, + ManagedEnvironmentUsagesOperations, ManagedEnvironmentsDiagnosticsOperations, ManagedEnvironmentsOperations, ManagedEnvironmentsStoragesOperations, NamespacesOperations, Operations, + UsagesOperations, ) if TYPE_CHECKING: @@ -52,6 +65,8 @@ class ContainerAppsAPIClient( ): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ContainerAppsAPIClient. + :ivar app_resiliency: AppResiliencyOperations operations + :vartype app_resiliency: azure.mgmt.appcontainers.aio.operations.AppResiliencyOperations :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations :vartype container_apps_auth_configs: azure.mgmt.appcontainers.aio.operations.ContainerAppsAuthConfigsOperations @@ -60,6 +75,15 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.AvailableWorkloadProfilesOperations :ivar billing_meters: BillingMetersOperations operations :vartype billing_meters: azure.mgmt.appcontainers.aio.operations.BillingMetersOperations + :ivar builders: BuildersOperations operations + :vartype builders: azure.mgmt.appcontainers.aio.operations.BuildersOperations + :ivar builds_by_builder_resource: BuildsByBuilderResourceOperations operations + :vartype builds_by_builder_resource: + azure.mgmt.appcontainers.aio.operations.BuildsByBuilderResourceOperations + :ivar builds: BuildsOperations operations + :vartype builds: azure.mgmt.appcontainers.aio.operations.BuildsOperations + :ivar build_auth_token: BuildAuthTokenOperations operations + :vartype build_auth_token: azure.mgmt.appcontainers.aio.operations.BuildAuthTokenOperations :ivar connected_environments: ConnectedEnvironmentsOperations operations :vartype connected_environments: azure.mgmt.appcontainers.aio.operations.ConnectedEnvironmentsOperations @@ -91,10 +115,10 @@ class ContainerAppsAPIClient( :ivar managed_environments_diagnostics: ManagedEnvironmentsDiagnosticsOperations operations :vartype managed_environments_diagnostics: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsDiagnosticsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appcontainers.aio.operations.Operations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.appcontainers.aio.operations.JobsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appcontainers.aio.operations.Operations :ivar jobs_executions: JobsExecutionsOperations operations :vartype jobs_executions: azure.mgmt.appcontainers.aio.operations.JobsExecutionsOperations :ivar managed_environments: ManagedEnvironmentsOperations operations @@ -107,22 +131,37 @@ class ContainerAppsAPIClient( azure.mgmt.appcontainers.aio.operations.ManagedCertificatesOperations :ivar namespaces: NamespacesOperations operations :vartype namespaces: azure.mgmt.appcontainers.aio.operations.NamespacesOperations + :ivar dapr_component_resiliency_policies: DaprComponentResiliencyPoliciesOperations operations + :vartype dapr_component_resiliency_policies: + azure.mgmt.appcontainers.aio.operations.DaprComponentResiliencyPoliciesOperations :ivar dapr_components: DaprComponentsOperations operations :vartype dapr_components: azure.mgmt.appcontainers.aio.operations.DaprComponentsOperations + :ivar dapr_subscriptions: DaprSubscriptionsOperations operations + :vartype dapr_subscriptions: + azure.mgmt.appcontainers.aio.operations.DaprSubscriptionsOperations :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations :vartype managed_environments_storages: azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsStoragesOperations :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations :vartype container_apps_source_controls: azure.mgmt.appcontainers.aio.operations.ContainerAppsSourceControlsOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.appcontainers.aio.operations.UsagesOperations + :ivar managed_environment_usages: ManagedEnvironmentUsagesOperations operations + :vartype managed_environment_usages: + azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentUsagesOperations + :ivar java_components: JavaComponentsOperations operations + :vartype java_components: azure.mgmt.appcontainers.aio.operations.JavaComponentsOperations + :ivar dot_net_components: DotNetComponentsOperations operations + :vartype dot_net_components: azure.mgmt.appcontainers.aio.operations.DotNetComponentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2023-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-11-02-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. @@ -138,12 +177,31 @@ def __init__( self._config = ContainerAppsAPIClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **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.app_resiliency = AppResiliencyOperations(self._client, self._config, self._serialize, self._deserialize) self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -151,6 +209,12 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.billing_meters = BillingMetersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builders = BuildersOperations(self._client, self._config, self._serialize, self._deserialize) + self.builds_by_builder_resource = BuildsByBuilderResourceOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.builds = BuildsOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_auth_token = BuildAuthTokenOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_environments = ConnectedEnvironmentsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -179,8 +243,8 @@ def __init__( self.managed_environments_diagnostics = ManagedEnvironmentsDiagnosticsOperations( 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.operations = Operations(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 @@ -190,15 +254,31 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.dapr_component_resiliency_policies = DaprComponentResiliencyPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dapr_subscriptions = DaprSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.managed_environments_storages = ManagedEnvironmentsStoragesOperations( self._client, self._config, self._serialize, self._deserialize ) self.container_apps_source_controls = ContainerAppsSourceControlsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environment_usages = ManagedEnvironmentUsagesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.java_components = JavaComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.dot_net_components = DotNetComponentsOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -218,7 +298,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py index 839be84fdb2f..27819202ef8e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py @@ -6,9 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._app_resiliency_operations import AppResiliencyOperations from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations from ._available_workload_profiles_operations import AvailableWorkloadProfilesOperations from ._billing_meters_operations import BillingMetersOperations +from ._builders_operations import BuildersOperations +from ._builds_by_builder_resource_operations import BuildsByBuilderResourceOperations +from ._builds_operations import BuildsOperations +from ._build_auth_token_operations import BuildAuthTokenOperations from ._connected_environments_operations import ConnectedEnvironmentsOperations from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations @@ -19,26 +24,37 @@ from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations -from ._operations import Operations from ._jobs_operations import JobsOperations +from ._operations import Operations from ._jobs_executions_operations import JobsExecutionsOperations from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin from ._managed_environments_operations import ManagedEnvironmentsOperations from ._certificates_operations import CertificatesOperations from ._managed_certificates_operations import ManagedCertificatesOperations from ._namespaces_operations import NamespacesOperations +from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations from ._dapr_components_operations import DaprComponentsOperations +from ._dapr_subscriptions_operations import DaprSubscriptionsOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations +from ._usages_operations import UsagesOperations +from ._managed_environment_usages_operations import ManagedEnvironmentUsagesOperations +from ._java_components_operations import JavaComponentsOperations +from ._dot_net_components_operations import DotNetComponentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AppResiliencyOperations", "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", + "BuildersOperations", + "BuildsByBuilderResourceOperations", + "BuildsOperations", + "BuildAuthTokenOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", @@ -49,17 +65,23 @@ "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", - "Operations", "JobsOperations", + "Operations", "JobsExecutionsOperations", "ContainerAppsAPIClientOperationsMixin", "ManagedEnvironmentsOperations", "CertificatesOperations", "ManagedCertificatesOperations", "NamespacesOperations", + "DaprComponentResiliencyPoliciesOperations", "DaprComponentsOperations", + "DaprSubscriptionsOperations", "ManagedEnvironmentsStoragesOperations", "ContainerAppsSourceControlsOperations", + "UsagesOperations", + "ManagedEnvironmentUsagesOperations", + "JavaComponentsOperations", + "DotNetComponentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py new file mode 100644 index 000000000000..6e7c5b2e63bd --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_app_resiliency_operations.py @@ -0,0 +1,570 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._app_resiliency_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AppResiliencyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`app_resiliency` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Is either a + AppResiliency type or a IO[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AppResiliency", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AppResiliency", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Is either a AppResiliency type or + a IO[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + _request = build_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_name: str, name: str, **kwargs: Any + ) -> None: + """Delete an application's resiliency policy. + + Delete container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) -> _models.AppResiliency: + """Get an application's resiliency policy. + + Get container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, app_name: str, **kwargs: Any) -> AsyncIterable["_models.AppResiliency"]: + """List an application's resiliency policies. + + List container app resiliency policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :return: An iterator like instance of either AppResiliency or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.AppResiliency] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResiliencyCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("AppResiliencyCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py index 785fcd1d359b..e6c4bdb1ac4d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_available_workload_profiles_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -61,7 +61,6 @@ def get(self, location: str, **kwargs: Any) -> AsyncIterable["_models.AvailableW :param location: The name of Azure region. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableWorkloadProfile or the result of cls(response) :rtype: @@ -85,16 +84,15 @@ def get(self, location: str, **kwargs: Any) -> AsyncIterable["_models.AvailableW def prepare_request(next_link=None): if not next_link: - request = build_get_request( + _request = build_get_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -106,13 +104,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("AvailableWorkloadProfilesCollection", pipeline_response) @@ -122,11 +120,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -138,7 +136,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/availableManagedEnvironmentsWorkloadProfileTypes" - } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py index 63da0d32f836..c4cfa44feb19 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_billing_meters_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -59,7 +59,6 @@ async def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollect :param location: The name of Azure region. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BillingMeterCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.BillingMeterCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -78,20 +77,19 @@ async def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollect api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BillingMeterCollection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -104,8 +102,6 @@ async def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollect deserialized = self._deserialize("BillingMeterCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/billingMeters"} + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py new file mode 100644 index 000000000000..2fb05c7a410f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_build_auth_token_operations.py @@ -0,0 +1,114 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._build_auth_token_operations import build_list_request +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildAuthTokenOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`build_auth_token` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> _models.BuildToken: + """Gets the token used to connect to the endpoint where source code can be uploaded for a build. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: BuildToken or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildToken] = kwargs.pop("cls", None) + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("BuildToken", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py new file mode 100644 index 000000000000..1caf40d02969 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builders_operations.py @@ -0,0 +1,781 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +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._builders_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`builders` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.BuilderResource"]: + """List BuilderResource resources by subscription ID. + + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuilderResource"]: + """List BuilderResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace_async + async def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _models.BuilderResource: + """Get a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("BuilderResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> _models.BuilderResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Is either a BuilderResource type or a + IO[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.BuilderResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BuilderResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResourceUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Is either a + BuilderResourceUpdate type or a IO[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py new file mode 100644 index 000000000000..ae9dcaa12757 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_by_builder_resource_operations.py @@ -0,0 +1,140 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._builds_by_builder_resource_operations import build_list_request +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildsByBuilderResourceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`builds_by_builder_resource` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BuildResource"]: + """List BuildResource resources by BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: An iterator like instance of either BuildResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("BuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py new file mode 100644 index 000000000000..7ad0aa009496 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_builds_operations.py @@ -0,0 +1,436 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +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._builds_operations import build_create_or_update_request, build_delete_request, build_get_request +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`builds` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> _models.BuildResource: + """Get a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: BuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("BuildResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> _models.BuildResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_envelope, (IOBase, bytes)): + _content = build_envelope + else: + _json = self._serialize.body(build_envelope, "BuildResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BuildResource", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("BuildResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: _models.BuildResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Is either a BuildResource type or + a IO[bytes] type. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + build_envelope=build_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BuildResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BuildResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py index b83461a40b75..65ea9ecb3f08 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -74,7 +74,6 @@ def list( :type resource_group_name: str :param environment_name: Name of the Managed Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Certificate or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: @@ -96,17 +95,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +116,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("CertificateCollection", pipeline_response) @@ -134,11 +132,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,10 +149,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates" - } - @distributed_trace_async async def get( self, resource_group_name: str, environment_name: str, certificate_name: str, **kwargs: Any @@ -170,7 +164,6 @@ async def get( :type environment_name: str :param certificate_name: Name of the Certificate. Required. :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -189,22 +182,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, environment_name=environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,13 +209,9 @@ async def get( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -252,7 +240,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -264,7 +251,7 @@ async def create_or_update( resource_group_name: str, environment_name: str, certificate_name: str, - certificate_envelope: Optional[IO] = None, + certificate_envelope: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -281,11 +268,10 @@ async def create_or_update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Certificate to be created or updated. Default value is None. - :type certificate_envelope: IO + :type certificate_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -297,7 +283,7 @@ async def create_or_update( resource_group_name: str, environment_name: str, certificate_name: str, - certificate_envelope: Optional[Union[_models.Certificate, IO]] = None, + certificate_envelope: Optional[Union[_models.Certificate, IO[bytes]]] = None, **kwargs: Any ) -> _models.Certificate: """Create or Update a Certificate. @@ -312,12 +298,8 @@ async def create_or_update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Certificate to be created or updated. Is either a Certificate type - or a IO type. Default value is None. - :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Default value is None. + :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate or IO[bytes] :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -348,7 +330,7 @@ async def create_or_update( else: _json = None - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, environment_name=environment_name, certificate_name=certificate_name, @@ -357,16 +339,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -379,13 +360,9 @@ async def create_or_update( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -402,7 +379,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type environment_name: str :param certificate_name: Name of the Certificate. Required. :type certificate_name: str - :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: @@ -421,22 +397,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, environment_name=environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -447,11 +422,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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.App/managedEnvironments/{environmentName}/certificates/{certificateName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -480,7 +451,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -492,7 +462,7 @@ async def update( resource_group_name: str, environment_name: str, certificate_name: str, - certificate_envelope: IO, + certificate_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -509,11 +479,10 @@ async def update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Properties of a certificate that need to be updated. Required. - :type certificate_envelope: IO + :type certificate_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -525,7 +494,7 @@ async def update( resource_group_name: str, environment_name: str, certificate_name: str, - certificate_envelope: Union[_models.CertificatePatch, IO], + certificate_envelope: Union[_models.CertificatePatch, IO[bytes]], **kwargs: Any ) -> _models.Certificate: """Update properties of a certificate. @@ -540,12 +509,8 @@ async def update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Properties of a certificate that need to be updated. Is either a - CertificatePatch type or a IO type. Required. - :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + CertificatePatch type or a IO[bytes] type. Required. + :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch or IO[bytes] :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -573,7 +538,7 @@ async def update( else: _json = self._serialize.body(certificate_envelope, "CertificatePatch") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, environment_name=environment_name, certificate_name=certificate_name, @@ -582,16 +547,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -604,10 +568,6 @@ async def update( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py index 6b74364ff107..55f2628d5fd2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_certificates_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -42,7 +42,7 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ConnectedEnvironmentsCertificatesOperations: +class ConnectedEnvironmentsCertificatesOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -74,7 +74,6 @@ def list( :type resource_group_name: str :param connected_environment_name: Name of the Connected Environment. Required. :type connected_environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Certificate or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: @@ -96,17 +95,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +116,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("CertificateCollection", pipeline_response) @@ -134,11 +132,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,10 +149,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates" - } - @distributed_trace_async async def get( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, **kwargs: Any @@ -170,7 +164,6 @@ async def get( :type connected_environment_name: str :param certificate_name: Name of the Certificate. Required. :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -189,22 +182,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,13 +209,9 @@ async def get( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -252,7 +240,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -264,7 +251,7 @@ async def create_or_update( resource_group_name: str, connected_environment_name: str, certificate_name: str, - certificate_envelope: Optional[IO] = None, + certificate_envelope: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -281,11 +268,10 @@ async def create_or_update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Certificate to be created or updated. Default value is None. - :type certificate_envelope: IO + :type certificate_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -297,7 +283,7 @@ async def create_or_update( resource_group_name: str, connected_environment_name: str, certificate_name: str, - certificate_envelope: Optional[Union[_models.Certificate, IO]] = None, + certificate_envelope: Optional[Union[_models.Certificate, IO[bytes]]] = None, **kwargs: Any ) -> _models.Certificate: """Create or Update a Certificate. @@ -312,12 +298,8 @@ async def create_or_update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Certificate to be created or updated. Is either a Certificate type - or a IO type. Default value is None. - :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Default value is None. + :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate or IO[bytes] :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -348,7 +330,7 @@ async def create_or_update( else: _json = None - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, @@ -357,16 +339,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -379,13 +360,9 @@ async def create_or_update( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -402,7 +379,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param certificate_name: Name of the Certificate. Required. :type certificate_name: str - :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: @@ -421,22 +397,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -447,11 +422,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -480,7 +451,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -492,7 +462,7 @@ async def update( resource_group_name: str, connected_environment_name: str, certificate_name: str, - certificate_envelope: IO, + certificate_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -509,11 +479,10 @@ async def update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Properties of a certificate that need to be updated. Required. - :type certificate_envelope: IO + :type certificate_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -525,7 +494,7 @@ async def update( resource_group_name: str, connected_environment_name: str, certificate_name: str, - certificate_envelope: Union[_models.CertificatePatch, IO], + certificate_envelope: Union[_models.CertificatePatch, IO[bytes]], **kwargs: Any ) -> _models.Certificate: """Update properties of a certificate. @@ -540,12 +509,8 @@ async def update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Properties of a certificate that need to be updated. Is either a - CertificatePatch type or a IO type. Required. - :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + CertificatePatch type or a IO[bytes] type. Required. + :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch or IO[bytes] :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -573,7 +538,7 @@ async def update( else: _json = self._serialize.body(certificate_envelope, "CertificatePatch") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, @@ -582,16 +547,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -604,10 +568,6 @@ async def update( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py index 6382d6dd4053..811b77b37720 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_dapr_components_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -42,7 +42,7 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ConnectedEnvironmentsDaprComponentsOperations: +class ConnectedEnvironmentsDaprComponentsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -74,7 +74,6 @@ def list( :type resource_group_name: str :param connected_environment_name: Name of the connected environment. Required. :type connected_environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DaprComponent or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprComponent] :raises ~azure.core.exceptions.HttpResponseError: @@ -96,17 +95,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +116,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("DaprComponentsCollection", pipeline_response) @@ -134,11 +132,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,10 +149,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents" - } - @distributed_trace_async async def get( self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any @@ -170,7 +164,6 @@ async def get( :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -189,22 +182,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponent] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,13 +209,9 @@ async def get( deserialized = self._deserialize("DaprComponent", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -252,7 +240,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -264,7 +251,7 @@ async def create_or_update( resource_group_name: str, connected_environment_name: str, component_name: str, - dapr_component_envelope: IO, + dapr_component_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -281,11 +268,10 @@ async def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Required. - :type dapr_component_envelope: IO + :type dapr_component_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -297,7 +283,7 @@ async def create_or_update( resource_group_name: str, connected_environment_name: str, component_name: str, - dapr_component_envelope: Union[_models.DaprComponent, IO], + dapr_component_envelope: Union[_models.DaprComponent, IO[bytes]], **kwargs: Any ) -> _models.DaprComponent: """Creates or updates a Dapr Component. @@ -312,12 +298,8 @@ async def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Is either a - DaprComponent type or a IO type. Required. - :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + DaprComponent type or a IO[bytes] type. Required. + :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent or IO[bytes] :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -345,7 +327,7 @@ async def create_or_update( else: _json = self._serialize.body(dapr_component_envelope, "DaprComponent") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, component_name=component_name, @@ -354,16 +336,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -376,13 +357,9 @@ async def create_or_update( deserialized = self._deserialize("DaprComponent", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -399,7 +376,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :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: @@ -418,22 +394,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,11 +419,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def list_secrets( @@ -465,7 +436,6 @@ async def list_secrets( :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprSecretsCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -484,22 +454,21 @@ async def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprSecretsCollection] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -512,10 +481,6 @@ async def list_secrets( deserialized = self._deserialize("DaprSecretsCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py index 2195628f2b39..c10450558429 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -71,7 +71,6 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Connecte Get all connectedEnvironments for a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ConnectedEnvironment or the result of cls(response) :rtype: @@ -95,15 +94,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Connecte def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -115,13 +113,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ConnectedEnvironmentCollection", pipeline_response) @@ -131,11 +129,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -148,10 +146,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any @@ -161,7 +155,6 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ConnectedEnvironment or the result of cls(response) :rtype: @@ -185,16 +178,15 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -206,13 +198,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ConnectedEnvironmentCollection", pipeline_response) @@ -222,11 +214,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -239,10 +231,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments" - } - @distributed_trace_async async def get( self, resource_group_name: str, connected_environment_name: str, **kwargs: Any @@ -254,7 +242,6 @@ async def get( :type resource_group_name: str :param connected_environment_name: Name of the connectedEnvironment. Required. :type connected_environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectedEnvironment or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: @@ -273,21 +260,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironment] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -300,19 +286,15 @@ async def get( deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, connected_environment_name: str, - environment_envelope: Union[_models.ConnectedEnvironment, IO], + environment_envelope: Union[_models.ConnectedEnvironment, IO[bytes]], **kwargs: Any ) -> _models.ConnectedEnvironment: error_map = { @@ -338,7 +320,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(environment_envelope, "ConnectedEnvironment") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, @@ -346,16 +328,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -376,10 +357,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" - } - @overload async def begin_create_or_update( self, @@ -402,14 +379,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ConnectedEnvironment or the result of cls(response) :rtype: @@ -422,7 +391,7 @@ async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, - environment_envelope: IO, + environment_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -435,18 +404,10 @@ async def begin_create_or_update( :param connected_environment_name: Name of the connectedEnvironment. Required. :type connected_environment_name: str :param environment_envelope: Configuration details of the connectedEnvironment. Required. - :type environment_envelope: IO + :type environment_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ConnectedEnvironment or the result of cls(response) :rtype: @@ -459,7 +420,7 @@ async def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, - environment_envelope: Union[_models.ConnectedEnvironment, IO], + environment_envelope: Union[_models.ConnectedEnvironment, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ConnectedEnvironment]: """Creates or updates an connectedEnvironment. @@ -470,19 +431,8 @@ async def begin_create_or_update( :param connected_environment_name: Name of the connectedEnvironment. Required. :type connected_environment_name: str :param environment_envelope: Configuration details of the connectedEnvironment. Is either a - ConnectedEnvironment type or a IO type. Required. - :type environment_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironment or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + ConnectedEnvironment type or a IO[bytes] type. Required. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironment or IO[bytes] :return: An instance of AsyncLROPoller that returns either ConnectedEnvironment or the result of cls(response) :rtype: @@ -515,7 +465,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -528,17 +478,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ConnectedEnvironment].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" - } + return AsyncLROPoller[_models.ConnectedEnvironment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, connected_environment_name: str, **kwargs: Any @@ -557,21 +505,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -586,11 +533,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -605,14 +548,6 @@ async def begin_delete( :type resource_group_name: str :param connected_environment_name: Name of the connectedEnvironment. Required. :type connected_environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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: @@ -639,7 +574,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -650,17 +585,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def update( @@ -675,7 +606,6 @@ async def update( :type resource_group_name: str :param connected_environment_name: Name of the connectedEnvironment. Required. :type connected_environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectedEnvironment or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: @@ -694,21 +624,20 @@ async def update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironment] = kwargs.pop("cls", None) - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -721,13 +650,9 @@ async def update( deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" - } + return deserialized # type: ignore @overload async def check_name_availability( @@ -755,7 +680,6 @@ async def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResponse or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -766,7 +690,7 @@ async def check_name_availability( self, resource_group_name: str, connected_environment_name: str, - check_name_availability_request: IO, + check_name_availability_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -782,11 +706,10 @@ async def check_name_availability( :type connected_environment_name: str :param check_name_availability_request: The check connectedEnvironmentName availability request. Required. - :type check_name_availability_request: IO + :type check_name_availability_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResponse or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -797,7 +720,7 @@ async def check_name_availability( self, resource_group_name: str, connected_environment_name: str, - check_name_availability_request: Union[_models.CheckNameAvailabilityRequest, IO], + check_name_availability_request: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityResponse: """Checks the resource connectedEnvironmentName availability. @@ -810,13 +733,9 @@ async def check_name_availability( :param connected_environment_name: Name of the Managed Environment. Required. :type connected_environment_name: str :param check_name_availability_request: The check connectedEnvironmentName availability - request. Is either a CheckNameAvailabilityRequest type or a IO type. Required. + request. Is either a CheckNameAvailabilityRequest type or a IO[bytes] type. Required. :type check_name_availability_request: - ~azure.mgmt.appcontainers.models.CheckNameAvailabilityRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.appcontainers.models.CheckNameAvailabilityRequest or IO[bytes] :return: CheckNameAvailabilityResponse or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -844,7 +763,7 @@ async def check_name_availability( else: _json = self._serialize.body(check_name_availability_request, "CheckNameAvailabilityRequest") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, @@ -852,16 +771,15 @@ async def check_name_availability( content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -874,10 +792,6 @@ async def check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/checkNameAvailability" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py index c13a226de5a2..adb4dbd26349 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_connected_environments_storages_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -70,7 +70,6 @@ async def list( :type resource_group_name: str :param connected_environment_name: Name of the Environment. Required. :type connected_environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectedEnvironmentStoragesCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStoragesCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -89,21 +88,20 @@ async def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironmentStoragesCollection] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -116,13 +114,9 @@ async def list( deserialized = self._deserialize("ConnectedEnvironmentStoragesCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages" - } + return deserialized # type: ignore @distributed_trace_async async def get( @@ -139,7 +133,6 @@ async def get( :type connected_environment_name: str :param storage_name: Name of the storage. Required. :type storage_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -158,22 +151,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironmentStorage] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, storage_name=storage_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,13 +178,9 @@ async def get( deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -221,7 +209,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -233,7 +220,7 @@ async def create_or_update( resource_group_name: str, connected_environment_name: str, storage_name: str, - storage_envelope: IO, + storage_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -250,11 +237,10 @@ async def create_or_update( :param storage_name: Name of the storage. Required. :type storage_name: str :param storage_envelope: Configuration details of storage. Required. - :type storage_envelope: IO + :type storage_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -266,7 +252,7 @@ async def create_or_update( resource_group_name: str, connected_environment_name: str, storage_name: str, - storage_envelope: Union[_models.ConnectedEnvironmentStorage, IO], + storage_envelope: Union[_models.ConnectedEnvironmentStorage, IO[bytes]], **kwargs: Any ) -> _models.ConnectedEnvironmentStorage: """Create or update storage for a connectedEnvironment. @@ -281,12 +267,9 @@ async def create_or_update( :param storage_name: Name of the storage. Required. :type storage_name: str :param storage_envelope: Configuration details of storage. Is either a - ConnectedEnvironmentStorage type or a IO type. Required. - :type storage_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ConnectedEnvironmentStorage type or a IO[bytes] type. Required. + :type storage_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage or + IO[bytes] :return: ConnectedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -314,7 +297,7 @@ async def create_or_update( else: _json = self._serialize.body(storage_envelope, "ConnectedEnvironmentStorage") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, storage_name=storage_name, @@ -323,16 +306,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,13 +327,9 @@ async def create_or_update( deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -368,7 +346,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param storage_name: Name of the storage. Required. :type storage_name: str - :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: @@ -387,22 +364,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, storage_name=storage_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,8 +389,4 @@ async def delete( # pylint: disable=inconsistent-return-statements 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.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py index e7644744068f..d7aa8aec4ac6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_api_client_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -25,7 +25,10 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._container_apps_api_client_operations import build_job_execution_request +from ...operations._container_apps_api_client_operations import ( + build_get_custom_domain_verification_id_request, + build_job_execution_request, +) from .._vendor import ContainerAppsAPIClientMixinABC T = TypeVar("T") @@ -48,7 +51,6 @@ async def job_execution( :type job_name: str :param job_execution_name: Job execution name. Required. :type job_execution_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: JobExecution or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.JobExecution :raises ~azure.core.exceptions.HttpResponseError: @@ -67,22 +69,21 @@ async def job_execution( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobExecution] = kwargs.pop("cls", None) - request = build_job_execution_request( + _request = build_job_execution_request( resource_group_name=resource_group_name, job_name=job_name, job_execution_name=job_execution_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.job_execution.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -95,10 +96,56 @@ async def job_execution( deserialized = self._deserialize("JobExecution", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_custom_domain_verification_id(self, **kwargs: Any) -> str: + """Get the verification id of a subscription used for verifying custom domains. + + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[str] = kwargs.pop("cls", None) - return deserialized + _request = build_get_custom_domain_verification_id_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - job_execution.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py index 6a5c2a251391..8f13f8bbeac3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -73,7 +73,6 @@ def list_by_container_app( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AuthConfig or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.AuthConfig] :raises ~azure.core.exceptions.HttpResponseError: @@ -95,17 +94,16 @@ def list_by_container_app( def prepare_request(next_link=None): if not next_link: - request = build_list_by_container_app_request( + _request = build_list_by_container_app_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_container_app.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -117,13 +115,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("AuthConfigCollection", pipeline_response) @@ -133,11 +131,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,10 +148,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_container_app.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs" - } - @distributed_trace_async async def get( self, resource_group_name: str, container_app_name: str, auth_config_name: str, **kwargs: Any @@ -169,7 +163,6 @@ async def get( :type container_app_name: str :param auth_config_name: Name of the Container App AuthConfig. Required. :type auth_config_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthConfig or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: @@ -188,22 +181,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthConfig] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, container_app_name=container_app_name, auth_config_name=auth_config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,13 +208,9 @@ async def get( deserialized = self._deserialize("AuthConfig", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -251,7 +239,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthConfig or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: @@ -263,7 +250,7 @@ async def create_or_update( resource_group_name: str, container_app_name: str, auth_config_name: str, - auth_config_envelope: IO, + auth_config_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -280,11 +267,10 @@ async def create_or_update( :param auth_config_name: Name of the Container App AuthConfig. Required. :type auth_config_name: str :param auth_config_envelope: Properties used to create a Container App AuthConfig. Required. - :type auth_config_envelope: IO + :type auth_config_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthConfig or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: @@ -296,7 +282,7 @@ async def create_or_update( resource_group_name: str, container_app_name: str, auth_config_name: str, - auth_config_envelope: Union[_models.AuthConfig, IO], + auth_config_envelope: Union[_models.AuthConfig, IO[bytes]], **kwargs: Any ) -> _models.AuthConfig: """Create or update the AuthConfig for a Container App. @@ -311,12 +297,8 @@ async def create_or_update( :param auth_config_name: Name of the Container App AuthConfig. Required. :type auth_config_name: str :param auth_config_envelope: Properties used to create a Container App AuthConfig. Is either a - AuthConfig type or a IO type. Required. - :type auth_config_envelope: ~azure.mgmt.appcontainers.models.AuthConfig or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + AuthConfig type or a IO[bytes] type. Required. + :type auth_config_envelope: ~azure.mgmt.appcontainers.models.AuthConfig or IO[bytes] :return: AuthConfig or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: @@ -344,7 +326,7 @@ async def create_or_update( else: _json = self._serialize.body(auth_config_envelope, "AuthConfig") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, container_app_name=container_app_name, auth_config_name=auth_config_name, @@ -353,16 +335,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,13 +356,9 @@ async def create_or_update( deserialized = self._deserialize("AuthConfig", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -398,7 +375,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type container_app_name: str :param auth_config_name: Name of the Container App AuthConfig. Required. :type auth_config_name: str - :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: @@ -417,22 +393,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, container_app_name=container_app_name, auth_config_name=auth_config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -443,8 +418,4 @@ async def delete( # pylint: disable=inconsistent-return-statements 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.App/containerApps/{containerAppName}/authConfigs/{authConfigName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py index 4e7510f48d1b..b57a2ea40dd9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_diagnostics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -74,7 +74,6 @@ def list_detectors( :param container_app_name: Name of the Container App for which detector info is needed. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Diagnostics or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Diagnostics] :raises ~azure.core.exceptions.HttpResponseError: @@ -96,17 +95,16 @@ def list_detectors( def prepare_request(next_link=None): if not next_link: - request = build_list_detectors_request( + _request = build_list_detectors_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_detectors.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +116,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("DiagnosticsCollection", pipeline_response) @@ -134,11 +132,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,10 +149,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_detectors.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors" - } - @distributed_trace_async async def get_detector( self, resource_group_name: str, container_app_name: str, detector_name: str, **kwargs: Any @@ -170,7 +164,6 @@ async def get_detector( :type container_app_name: str :param detector_name: Name of the Container App Detector. Required. :type detector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Diagnostics or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: @@ -189,22 +182,21 @@ async def get_detector( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Diagnostics] = kwargs.pop("cls", None) - request = build_get_detector_request( + _request = build_get_detector_request( resource_group_name=resource_group_name, container_app_name=container_app_name, detector_name=detector_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_detector.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,13 +209,9 @@ async def get_detector( deserialized = self._deserialize("Diagnostics", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_detector.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}" - } + return deserialized # type: ignore @distributed_trace def list_revisions( @@ -240,7 +228,6 @@ def list_revisions( :type container_app_name: str :param filter: The filter to apply on the operation. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Revision or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Revision] :raises ~azure.core.exceptions.HttpResponseError: @@ -262,18 +249,17 @@ def list_revisions( def prepare_request(next_link=None): if not next_link: - request = build_list_revisions_request( + _request = build_list_revisions_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_revisions.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -285,13 +271,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("RevisionCollection", pipeline_response) @@ -301,11 +287,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,10 +304,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_revisions.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/" - } - @distributed_trace_async async def get_revision( self, resource_group_name: str, container_app_name: str, revision_name: str, **kwargs: Any @@ -337,7 +319,6 @@ async def get_revision( :type container_app_name: str :param revision_name: Name of the Container App Revision. Required. :type revision_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Revision or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Revision :raises ~azure.core.exceptions.HttpResponseError: @@ -356,22 +337,21 @@ async def get_revision( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Revision] = kwargs.pop("cls", None) - request = build_get_revision_request( + _request = build_get_revision_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_revision.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -384,13 +364,9 @@ async def get_revision( deserialized = self._deserialize("Revision", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_revision.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/{revisionName}" - } + return deserialized # type: ignore @distributed_trace_async async def get_root(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> _models.ContainerApp: @@ -403,7 +379,6 @@ async def get_root(self, resource_group_name: str, container_app_name: str, **kw :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContainerApp or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises ~azure.core.exceptions.HttpResponseError: @@ -422,37 +397,32 @@ async def get_root(self, resource_group_name: str, container_app_name: str, **kw api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) - request = build_get_root_request( + _request = build_get_root_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_root.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **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) + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ContainerApp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_root.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/rootApi/" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py index 01e585fbba9d..7cc1056bca9f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -75,7 +75,6 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Containe Get the Container Apps in a given subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerApp or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerApp] :raises ~azure.core.exceptions.HttpResponseError: @@ -97,15 +96,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Containe def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -117,13 +115,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ContainerAppCollection", pipeline_response) @@ -133,11 +131,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,8 +148,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps"} - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ContainerApp"]: """Get the Container Apps in a given resource group. @@ -161,7 +157,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerApp or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerApp] :raises ~azure.core.exceptions.HttpResponseError: @@ -183,16 +178,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -204,13 +198,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ContainerAppCollection", pipeline_response) @@ -220,11 +214,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -237,10 +231,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps" - } - @distributed_trace_async async def get(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> _models.ContainerApp: """Get the properties of a Container App. @@ -252,7 +242,6 @@ async def get(self, resource_group_name: str, container_app_name: str, **kwargs: :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContainerApp or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises ~azure.core.exceptions.HttpResponseError: @@ -271,46 +260,41 @@ async def get(self, resource_group_name: str, container_app_name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **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) + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ContainerApp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, container_app_name: str, - container_app_envelope: Union[_models.ContainerApp, IO], + container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any ) -> _models.ContainerApp: error_map = { @@ -336,7 +320,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(container_app_envelope, "ContainerApp") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, @@ -344,16 +328,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,10 +357,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } - @overload async def begin_create_or_update( self, @@ -402,14 +381,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -421,7 +392,7 @@ async def begin_create_or_update( self, resource_group_name: str, container_app_name: str, - container_app_envelope: IO, + container_app_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -436,18 +407,10 @@ async def begin_create_or_update( :param container_app_name: Name of the Container App. Required. :type container_app_name: str :param container_app_envelope: Properties used to create a container app. Required. - :type container_app_envelope: IO + :type container_app_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -459,7 +422,7 @@ async def begin_create_or_update( self, resource_group_name: str, container_app_name: str, - container_app_envelope: Union[_models.ContainerApp, IO], + container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ContainerApp]: """Create or update a Container App. @@ -472,19 +435,8 @@ async def begin_create_or_update( :param container_app_name: Name of the Container App. Required. :type container_app_name: str :param container_app_envelope: Properties used to create a container app. Is either a - ContainerApp type or a IO type. Required. - :type container_app_envelope: ~azure.mgmt.appcontainers.models.ContainerApp or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + ContainerApp type or a IO[bytes] type. Required. + :type container_app_envelope: ~azure.mgmt.appcontainers.models.ContainerApp or IO[bytes] :return: An instance of AsyncLROPoller that returns either ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -516,7 +468,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ContainerApp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -529,17 +481,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ContainerApp].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } + return AsyncLROPoller[_models.ContainerApp]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, **kwargs: Any @@ -558,21 +508,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -587,11 +536,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -606,14 +551,6 @@ async def begin_delete( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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: @@ -640,7 +577,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -651,23 +588,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _update_initial( self, resource_group_name: str, container_app_name: str, - container_app_envelope: Union[_models.ContainerApp, IO], + container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any ) -> Optional[_models.ContainerApp]: error_map = { @@ -693,7 +626,7 @@ async def _update_initial( else: _json = self._serialize.body(container_app_envelope, "ContainerApp") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, @@ -701,16 +634,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -729,13 +661,9 @@ async def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -761,14 +689,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -780,7 +700,7 @@ async def begin_update( self, resource_group_name: str, container_app_name: str, - container_app_envelope: IO, + container_app_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -795,18 +715,10 @@ async def begin_update( :param container_app_name: Name of the Container App. Required. :type container_app_name: str :param container_app_envelope: Properties of a Container App that need to be updated. Required. - :type container_app_envelope: IO + :type container_app_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -818,7 +730,7 @@ async def begin_update( self, resource_group_name: str, container_app_name: str, - container_app_envelope: Union[_models.ContainerApp, IO], + container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ContainerApp]: """Update properties of a Container App. @@ -831,19 +743,8 @@ async def begin_update( :param container_app_name: Name of the Container App. Required. :type container_app_name: str :param container_app_envelope: Properties of a Container App that need to be updated. Is either - a ContainerApp type or a IO type. Required. - :type container_app_envelope: ~azure.mgmt.appcontainers.models.ContainerApp or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + a ContainerApp type or a IO[bytes] type. Required. + :type container_app_envelope: ~azure.mgmt.appcontainers.models.ContainerApp or IO[bytes] :return: An instance of AsyncLROPoller that returns either ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -875,7 +776,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ContainerApp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -885,17 +786,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ContainerApp].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } + return AsyncLROPoller[_models.ContainerApp]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def list_custom_host_name_analysis( @@ -912,7 +811,6 @@ async def list_custom_host_name_analysis( :type container_app_name: str :param custom_hostname: Custom hostname. Default value is None. :type custom_hostname: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomHostnameAnalysisResult or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResult :raises ~azure.core.exceptions.HttpResponseError: @@ -931,22 +829,21 @@ async def list_custom_host_name_analysis( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CustomHostnameAnalysisResult] = kwargs.pop("cls", None) - request = build_list_custom_host_name_analysis_request( + _request = build_list_custom_host_name_analysis_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, custom_hostname=custom_hostname, api_version=api_version, - template_url=self.list_custom_host_name_analysis.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -959,13 +856,9 @@ async def list_custom_host_name_analysis( deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_custom_host_name_analysis.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis" - } + return deserialized # type: ignore @distributed_trace_async async def list_secrets( @@ -980,7 +873,6 @@ async def list_secrets( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SecretsCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.SecretsCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -999,21 +891,20 @@ async def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecretsCollection] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1026,13 +917,9 @@ async def list_secrets( deserialized = self._deserialize("SecretsCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listSecrets" - } + return deserialized # type: ignore @distributed_trace_async async def get_auth_token( @@ -1047,7 +934,6 @@ async def get_auth_token( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContainerAppAuthToken or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ContainerAppAuthToken :raises ~azure.core.exceptions.HttpResponseError: @@ -1066,40 +952,35 @@ async def get_auth_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppAuthToken] = kwargs.pop("cls", None) - request = build_get_auth_token_request( + _request = build_get_auth_token_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_auth_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **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) + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ContainerAppAuthToken", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_auth_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/getAuthtoken" - } + return deserialized # type: ignore async def _start_initial( self, resource_group_name: str, container_app_name: str, **kwargs: Any @@ -1118,21 +999,20 @@ async def _start_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) - request = build_start_request( + _request = build_start_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1151,13 +1031,9 @@ async def _start_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/start" - } + return deserialized # type: ignore @distributed_trace_async async def begin_start( @@ -1172,14 +1048,6 @@ async def begin_start( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -1208,7 +1076,7 @@ async def begin_start( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ContainerApp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1220,17 +1088,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ContainerApp].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/start" - } + return AsyncLROPoller[_models.ContainerApp]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _stop_initial( self, resource_group_name: str, container_app_name: str, **kwargs: Any @@ -1249,21 +1115,20 @@ async def _stop_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) - request = build_stop_request( + _request = build_stop_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1282,13 +1147,9 @@ async def _stop_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/stop" - } + return deserialized # type: ignore @distributed_trace_async async def begin_stop( @@ -1303,14 +1164,6 @@ async def begin_stop( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -1339,7 +1192,7 @@ async def begin_stop( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ContainerApp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1351,14 +1204,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ContainerApp].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/stop" - } + return AsyncLROPoller[_models.ContainerApp]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py index c3a87d5b9019..dfb01b703978 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -71,7 +71,6 @@ async def get_replica( :type revision_name: str :param replica_name: Name of the Container App Revision Replica. Required. :type replica_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Replica or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Replica :raises ~azure.core.exceptions.HttpResponseError: @@ -90,23 +89,22 @@ async def get_replica( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Replica] = kwargs.pop("cls", None) - request = build_get_replica_request( + _request = build_get_replica_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, replica_name=replica_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_replica.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -119,13 +117,9 @@ async def get_replica( deserialized = self._deserialize("Replica", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_replica.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName}" - } + return deserialized # type: ignore @distributed_trace_async async def list_replicas( @@ -142,7 +136,6 @@ async def list_replicas( :type container_app_name: str :param revision_name: Name of the Container App Revision. Required. :type revision_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ReplicaCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ReplicaCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -161,22 +154,21 @@ async def list_replicas( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ReplicaCollection] = kwargs.pop("cls", None) - request = build_list_replicas_request( + _request = build_list_replicas_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_replicas.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -189,10 +181,6 @@ async def list_replicas( deserialized = self._deserialize("ReplicaCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_replicas.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py index 1dbcc9bba533..ef844779c080 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -75,7 +75,6 @@ def list_revisions( :type container_app_name: str :param filter: The filter to apply on the operation. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Revision or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Revision] :raises ~azure.core.exceptions.HttpResponseError: @@ -97,18 +96,17 @@ def list_revisions( def prepare_request(next_link=None): if not next_link: - request = build_list_revisions_request( + _request = build_list_revisions_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_revisions.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -120,13 +118,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("RevisionCollection", pipeline_response) @@ -136,11 +134,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,10 +151,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_revisions.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions" - } - @distributed_trace_async async def get_revision( self, resource_group_name: str, container_app_name: str, revision_name: str, **kwargs: Any @@ -172,7 +166,6 @@ async def get_revision( :type container_app_name: str :param revision_name: Name of the Container App Revision. Required. :type revision_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Revision or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Revision :raises ~azure.core.exceptions.HttpResponseError: @@ -191,22 +184,21 @@ async def get_revision( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Revision] = kwargs.pop("cls", None) - request = build_get_revision_request( + _request = build_get_revision_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_revision.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,13 +211,9 @@ async def get_revision( deserialized = self._deserialize("Revision", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_revision.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}" - } + return deserialized # type: ignore @distributed_trace_async async def activate_revision( # pylint: disable=inconsistent-return-statements @@ -242,7 +230,6 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements :type container_app_name: str :param revision_name: Name of the Container App Revision. Required. :type revision_name: str - :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: @@ -261,22 +248,21 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_activate_revision_request( + _request = build_activate_revision_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.activate_revision.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -287,11 +273,7 @@ async def activate_revision( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - activate_revision.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/activate" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def deactivate_revision( # pylint: disable=inconsistent-return-statements @@ -308,7 +290,6 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements :type container_app_name: str :param revision_name: Name of the Container App Revision. Required. :type revision_name: str - :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: @@ -327,22 +308,21 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_deactivate_revision_request( + _request = build_deactivate_revision_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.deactivate_revision.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -353,11 +333,7 @@ async def deactivate_revision( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - deactivate_revision.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/deactivate" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def restart_revision( # pylint: disable=inconsistent-return-statements @@ -374,7 +350,6 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements :type container_app_name: str :param revision_name: Name of the Container App Revision. Required. :type revision_name: str - :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: @@ -393,22 +368,21 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_restart_revision_request( + _request = build_restart_revision_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.restart_revision.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -419,8 +393,4 @@ async def restart_revision( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - restart_revision.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/restart" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py index f2d3a0e60e1d..f478e444bdc1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -75,7 +75,6 @@ def list_by_container_app( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SourceControl or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.SourceControl] :raises ~azure.core.exceptions.HttpResponseError: @@ -97,17 +96,16 @@ def list_by_container_app( def prepare_request(next_link=None): if not next_link: - request = build_list_by_container_app_request( + _request = build_list_by_container_app_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_container_app.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +117,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("SourceControlCollection", pipeline_response) @@ -135,11 +133,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -152,10 +150,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_container_app.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols" - } - @distributed_trace_async async def get( self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any @@ -171,7 +165,6 @@ async def get( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControl or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: @@ -190,22 +183,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -218,20 +210,16 @@ async def get( deserialized = self._deserialize("SourceControl", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, container_app_name: str, source_control_name: str, - source_control_envelope: Union[_models.SourceControl, IO], + source_control_envelope: Union[_models.SourceControl, IO[bytes]], **kwargs: Any ) -> _models.SourceControl: error_map = { @@ -257,7 +245,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(source_control_envelope, "SourceControl") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, @@ -266,16 +254,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -296,10 +283,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" - } - @overload async def begin_create_or_update( self, @@ -328,14 +311,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 SourceControl or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SourceControl] @@ -348,7 +323,7 @@ async def begin_create_or_update( resource_group_name: str, container_app_name: str, source_control_name: str, - source_control_envelope: IO, + source_control_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -366,18 +341,10 @@ async def begin_create_or_update( :type source_control_name: str :param source_control_envelope: Properties used to create a Container App SourceControl. Required. - :type source_control_envelope: IO + :type source_control_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 SourceControl or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SourceControl] @@ -390,7 +357,7 @@ async def begin_create_or_update( resource_group_name: str, container_app_name: str, source_control_name: str, - source_control_envelope: Union[_models.SourceControl, IO], + source_control_envelope: Union[_models.SourceControl, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.SourceControl]: """Create or update the SourceControl for a Container App. @@ -405,19 +372,8 @@ async def begin_create_or_update( :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str :param source_control_envelope: Properties used to create a Container App SourceControl. Is - either a SourceControl type or a IO type. Required. - :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + either a SourceControl type or a IO[bytes] type. Required. + :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl or IO[bytes] :return: An instance of AsyncLROPoller that returns either SourceControl or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SourceControl] @@ -450,7 +406,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("SourceControl", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -460,17 +416,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.SourceControl].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" - } + return AsyncLROPoller[_models.SourceControl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any @@ -489,22 +443,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -515,11 +468,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -536,14 +485,6 @@ async def begin_delete( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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: @@ -571,7 +512,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -580,14 +521,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py new file mode 100644 index 000000000000..94f079c80704 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,451 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._dapr_component_resiliency_policies_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DaprComponentResiliencyPoliciesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dapr_component_resiliency_policies` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, component_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DaprComponentResiliencyPolicy"]: + """Get the resiliency policies for a Dapr component. + + Get the resiliency policies for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :return: An iterator like instance of either DaprComponentResiliencyPolicy or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprComponentResiliencyPoliciesCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("DaprComponentResiliencyPoliciesCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Get a Dapr component resiliency policy. + + Get a Dapr component resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: _models.DaprComponentResiliencyPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: Union[_models.DaprComponentResiliencyPolicy, IO[bytes]], + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Is either a DaprComponentResiliencyPolicy type or a IO[bytes] type. + Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy or IO[bytes] + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_component_resiliency_policy_envelope, (IOBase, bytes)): + _content = dapr_component_resiliency_policy_envelope + else: + _json = self._serialize.body(dapr_component_resiliency_policy_envelope, "DaprComponentResiliencyPolicy") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr component resiliency policy. + + Delete a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py index 7949d0ab55bd..e083a4e5b17b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -74,7 +74,6 @@ def list( :type resource_group_name: str :param environment_name: Name of the Managed Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DaprComponent or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprComponent] :raises ~azure.core.exceptions.HttpResponseError: @@ -96,17 +95,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +116,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("DaprComponentsCollection", pipeline_response) @@ -134,11 +132,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,10 +149,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents" - } - @distributed_trace_async async def get( self, resource_group_name: str, environment_name: str, component_name: str, **kwargs: Any @@ -170,7 +164,6 @@ async def get( :type environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -189,22 +182,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponent] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, environment_name=environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,13 +209,9 @@ async def get( deserialized = self._deserialize("DaprComponent", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -252,7 +240,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -264,7 +251,7 @@ async def create_or_update( resource_group_name: str, environment_name: str, component_name: str, - dapr_component_envelope: IO, + dapr_component_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -281,11 +268,10 @@ async def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Required. - :type dapr_component_envelope: IO + :type dapr_component_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -297,7 +283,7 @@ async def create_or_update( resource_group_name: str, environment_name: str, component_name: str, - dapr_component_envelope: Union[_models.DaprComponent, IO], + dapr_component_envelope: Union[_models.DaprComponent, IO[bytes]], **kwargs: Any ) -> _models.DaprComponent: """Creates or updates a Dapr Component. @@ -312,12 +298,8 @@ async def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Is either a - DaprComponent type or a IO type. Required. - :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + DaprComponent type or a IO[bytes] type. Required. + :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent or IO[bytes] :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -345,7 +327,7 @@ async def create_or_update( else: _json = self._serialize.body(dapr_component_envelope, "DaprComponent") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, environment_name=environment_name, component_name=component_name, @@ -354,16 +336,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -376,13 +357,9 @@ async def create_or_update( deserialized = self._deserialize("DaprComponent", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -399,7 +376,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :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: @@ -418,22 +394,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, environment_name=environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,11 +419,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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.App/managedEnvironments/{environmentName}/daprComponents/{componentName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def list_secrets( @@ -465,7 +436,6 @@ async def list_secrets( :type environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprSecretsCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -484,22 +454,21 @@ async def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprSecretsCollection] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, environment_name=environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -512,10 +481,6 @@ async def list_secrets( deserialized = self._deserialize("DaprSecretsCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py new file mode 100644 index 000000000000..54b4c58c6440 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_subscriptions_operations.py @@ -0,0 +1,427 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._dapr_subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DaprSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dapr_subscriptions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DaprSubscription"]: + """Get the Dapr subscriptions for a managed environment. + + Get the Dapr subscriptions for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either DaprSubscription or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprSubscriptionsCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("DaprSubscriptionsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.DaprSubscription: + """Get a dapr subscription. + + Get a dapr subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: _models.DaprSubscription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: Union[_models.DaprSubscription, IO[bytes]], + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Is either a + DaprSubscription type or a IO[bytes] type. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription or + IO[bytes] + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_subscription_envelope, (IOBase, bytes)): + _content = dapr_subscription_envelope + else: + _json = self._serialize.body(dapr_subscription_envelope, "DaprSubscription") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DaprSubscription", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DaprSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr subscription. + + Delete a Dapr subscription from a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py new file mode 100644 index 000000000000..a2794217eb51 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dot_net_components_operations.py @@ -0,0 +1,751 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +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._dot_net_components_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DotNetComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`dot_net_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DotNetComponent"]: + """Get the .NET Components for a managed environment. + + Get the .NET Components for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either DotNetComponent or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponentsCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("DotNetComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.DotNetComponent: + """Get a .NET Component. + + Get a .NET Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :return: DotNetComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DotNetComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("DotNetComponent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> _models.DotNetComponent: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("DotNetComponent", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DotNetComponent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.DotNetComponent]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.DotNetComponent]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("DotNetComponent", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a .NET Component. + + Delete a .NET Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py new file mode 100644 index 000000000000..3c1d14fee1e5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_java_components_operations.py @@ -0,0 +1,750 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +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._java_components_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class JavaComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`java_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> AsyncIterable["_models.JavaComponent"]: + """Get the Java Components for a managed environment. + + Get the Java Components for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either JavaComponent or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.JavaComponentsCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("JavaComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace_async + async def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.JavaComponent: + """Get a Java Component. + + Get a Java Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :return: JavaComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.JavaComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("JavaComponent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> _models.JavaComponent: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(java_component_envelope, (IOBase, bytes)): + _content = java_component_envelope + else: + _json = self._serialize.body(java_component_envelope, "JavaComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("JavaComponent", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("JavaComponent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: _models.JavaComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Is either a + JavaComponent type or a IO[bytes] type. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + java_component_envelope=java_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JavaComponent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.JavaComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.JavaComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.JavaComponent]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JavaComponent]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(java_component_envelope, (IOBase, bytes)): + _content = java_component_envelope + else: + _json = self._serialize.body(java_component_envelope, "JavaComponent") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("JavaComponent", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: _models.JavaComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Is either a + JavaComponent type or a IO[bytes] type. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] + :return: An instance of AsyncLROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + java_component_envelope=java_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JavaComponent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.JavaComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.JavaComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Java Component. + + Delete a Java Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py index ec6e8e3a64ad..772caa7189f7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_executions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -68,7 +68,6 @@ def list( :type job_name: str :param filter: The filter to apply on the operation. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobExecution or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.JobExecution] :raises ~azure.core.exceptions.HttpResponseError: @@ -90,18 +89,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +111,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ContainerAppJobExecutions", pipeline_response) @@ -129,11 +127,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -145,7 +143,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions" - } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py index 7a01f30b7159..22276b34a13d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_jobs_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,10 +34,13 @@ from ...operations._jobs_operations import ( build_create_or_update_request, build_delete_request, + build_get_detector_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, + build_list_detectors_request, build_list_secrets_request, + build_proxy_get_request, build_start_request, build_stop_execution_request, build_stop_multiple_executions_request, @@ -68,13 +71,198 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async + async def list_detectors( + self, resource_group_name: str, job_name: str, **kwargs: Any + ) -> _models.DiagnosticsCollection: + """Get the list of diagnostics for a given Container App Job. + + Get the list of diagnostics for a Container App Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :return: DiagnosticsCollection or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) + + _request = build_list_detectors_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_detector( + self, resource_group_name: str, job_name: str, detector_name: str, **kwargs: Any + ) -> _models.Diagnostics: + """Get the diagnostics data for a given Container App Job. + + Get the diagnostics data for a Container App Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :param detector_name: Name of the Container App Job detector. Required. + :type detector_name: str + :return: Diagnostics or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Diagnostics + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Diagnostics] = kwargs.pop("cls", None) + + _request = build_get_detector_request( + resource_group_name=resource_group_name, + job_name=job_name, + detector_name=detector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Diagnostics", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.Job: + """Get the properties for a given Container App Job. + + Get the properties of a Container App Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :return: Job or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_name: Literal["rootApi"] = kwargs.pop("api_name", "rootApi") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + + _request = build_proxy_get_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_name=api_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Job", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Job"]: """Get the Container Apps Jobs in a given subscription. Get the Container Apps Jobs in a given subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Job or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -96,15 +284,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Job"]: def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -116,13 +303,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("JobsCollection", pipeline_response) @@ -132,11 +319,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,8 +336,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/jobs"} - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Job"]: """Get the Container Apps Jobs in a given resource group. @@ -160,7 +345,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Job or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -182,16 +366,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -203,13 +386,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("JobsCollection", pipeline_response) @@ -219,11 +402,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,10 +419,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs" - } - @distributed_trace_async async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.Job: """Get the properties of a Container Apps Job. @@ -251,7 +430,6 @@ async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Job or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Job :raises ~azure.core.exceptions.HttpResponseError: @@ -270,21 +448,20 @@ async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Job] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -297,16 +474,12 @@ async def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _ deserialized = self._deserialize("Job", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } + return deserialized # type: ignore async def _create_or_update_initial( - self, resource_group_name: str, job_name: str, job_envelope: Union[_models.Job, IO], **kwargs: Any + self, resource_group_name: str, job_name: str, job_envelope: Union[_models.Job, IO[bytes]], **kwargs: Any ) -> _models.Job: error_map = { 401: ClientAuthenticationError, @@ -331,7 +504,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(job_envelope, "Job") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, @@ -339,16 +512,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -369,10 +541,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } - @overload async def begin_create_or_update( self, @@ -397,14 +565,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 Job or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -415,7 +575,7 @@ async def begin_create_or_update( self, resource_group_name: str, job_name: str, - job_envelope: IO, + job_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -430,18 +590,10 @@ async def begin_create_or_update( :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Required. - :type job_envelope: IO + :type job_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 Job or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -449,7 +601,7 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, job_name: str, job_envelope: Union[_models.Job, IO], **kwargs: Any + self, resource_group_name: str, job_name: str, job_envelope: Union[_models.Job, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Job]: """Create or Update a Container Apps Job. @@ -461,19 +613,8 @@ async def begin_create_or_update( :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Is either a Job type or a - IO type. Required. - :type job_envelope: ~azure.mgmt.appcontainers.models.Job or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + IO[bytes] type. Required. + :type job_envelope: ~azure.mgmt.appcontainers.models.Job or IO[bytes] :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -504,7 +645,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Job", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -517,17 +658,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Job].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } + return AsyncLROPoller[_models.Job]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, **kwargs: Any @@ -546,21 +685,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -575,11 +713,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -592,14 +726,6 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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: @@ -626,7 +752,7 @@ async def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -637,23 +763,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _update_initial( self, resource_group_name: str, job_name: str, - job_envelope: Union[_models.JobPatchProperties, IO], + job_envelope: Union[_models.JobPatchProperties, IO[bytes]], **kwargs: Any ) -> Optional[_models.Job]: error_map = { @@ -679,7 +801,7 @@ async def _update_initial( else: _json = self._serialize.body(job_envelope, "JobPatchProperties") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, @@ -687,16 +809,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -715,13 +836,9 @@ async def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -747,14 +864,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 Job or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -765,7 +874,7 @@ async def begin_update( self, resource_group_name: str, job_name: str, - job_envelope: IO, + job_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -780,18 +889,10 @@ async def begin_update( :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Required. - :type job_envelope: IO + :type job_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 Job or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -802,7 +903,7 @@ async def begin_update( self, resource_group_name: str, job_name: str, - job_envelope: Union[_models.JobPatchProperties, IO], + job_envelope: Union[_models.JobPatchProperties, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Job]: """Update properties of a Container Apps Job. @@ -815,19 +916,8 @@ async def begin_update( :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Is either a - JobPatchProperties type or a IO type. Required. - :type job_envelope: ~azure.mgmt.appcontainers.models.JobPatchProperties or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + JobPatchProperties type or a IO[bytes] type. Required. + :type job_envelope: ~azure.mgmt.appcontainers.models.JobPatchProperties or IO[bytes] :return: An instance of AsyncLROPoller that returns either Job or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -858,7 +948,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Job", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -868,23 +958,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Job].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } + return AsyncLROPoller[_models.Job]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _start_initial( self, resource_group_name: str, job_name: str, - template: Optional[Union[_models.JobExecutionTemplate, IO]] = None, + template: Optional[Union[_models.JobExecutionTemplate, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.JobExecutionBase]: error_map = { @@ -913,7 +1001,7 @@ async def _start_initial( else: _json = None - request = build_start_request( + _request = build_start_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, @@ -921,16 +1009,15 @@ async def _start_initial( content_type=content_type, json=_json, content=_content, - template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -949,13 +1036,9 @@ async def _start_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/start" - } + return deserialized # type: ignore @overload async def begin_start( @@ -981,14 +1064,6 @@ async def begin_start( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 JobExecutionBase or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JobExecutionBase] @@ -1000,7 +1075,7 @@ async def begin_start( self, resource_group_name: str, job_name: str, - template: Optional[IO] = None, + template: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1015,18 +1090,10 @@ async def begin_start( :param job_name: Job Name. Required. :type job_name: str :param template: Properties used to start a job execution. Default value is None. - :type template: IO + :type template: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 JobExecutionBase or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JobExecutionBase] @@ -1038,7 +1105,7 @@ async def begin_start( self, resource_group_name: str, job_name: str, - template: Optional[Union[_models.JobExecutionTemplate, IO]] = None, + template: Optional[Union[_models.JobExecutionTemplate, IO[bytes]]] = None, **kwargs: Any ) -> AsyncLROPoller[_models.JobExecutionBase]: """Start a Container Apps Job. @@ -1051,19 +1118,8 @@ async def begin_start( :param job_name: Job Name. Required. :type job_name: str :param template: Properties used to start a job execution. Is either a JobExecutionTemplate - type or a IO type. Default value is None. - :type template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + type or a IO[bytes] type. Default value is None. + :type template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate or IO[bytes] :return: An instance of AsyncLROPoller that returns either JobExecutionBase or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.JobExecutionBase] @@ -1095,7 +1151,7 @@ async def begin_start( def get_long_running_output(pipeline_response): deserialized = self._deserialize("JobExecutionBase", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1107,17 +1163,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.JobExecutionBase].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/start" - } + return AsyncLROPoller[_models.JobExecutionBase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _stop_execution_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, job_execution_name: str, **kwargs: Any @@ -1136,22 +1190,21 @@ async def _stop_execution_initial( # pylint: disable=inconsistent-return-statem api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_stop_execution_request( + _request = build_stop_execution_request( resource_group_name=resource_group_name, job_name=job_name, job_execution_name=job_execution_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_execution_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1166,11 +1219,7 @@ async def _stop_execution_initial( # pylint: disable=inconsistent-return-statem response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _stop_execution_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}/stop" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_stop_execution( @@ -1187,14 +1236,6 @@ async def begin_stop_execution( :type job_name: str :param job_execution_name: Job execution name. Required. :type job_execution_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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: @@ -1222,7 +1263,7 @@ async def begin_stop_execution( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -1233,17 +1274,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop_execution.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}/stop" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _stop_multiple_executions_initial( self, resource_group_name: str, job_name: str, **kwargs: Any @@ -1262,21 +1299,20 @@ async def _stop_multiple_executions_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ContainerAppJobExecutions]] = kwargs.pop("cls", None) - request = build_stop_multiple_executions_request( + _request = build_stop_multiple_executions_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_multiple_executions_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1295,13 +1331,9 @@ async def _stop_multiple_executions_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _stop_multiple_executions_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop" - } + return deserialized # type: ignore @distributed_trace_async async def begin_stop_multiple_executions( @@ -1316,14 +1348,6 @@ async def begin_stop_multiple_executions( :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerAppJobExecutions or the result of cls(response) :rtype: @@ -1353,7 +1377,7 @@ async def begin_stop_multiple_executions( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1365,17 +1389,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ContainerAppJobExecutions].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop_multiple_executions.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop" - } + return AsyncLROPoller[_models.ContainerAppJobExecutions]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def list_secrets( @@ -1390,7 +1412,6 @@ async def list_secrets( :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: JobSecretsCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.JobSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -1409,21 +1430,20 @@ async def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobSecretsCollection] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1436,10 +1456,6 @@ async def list_secrets( deserialized = self._deserialize("JobSecretsCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py index 34dade0546d1..3b252ae030d2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_certificates_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,7 +78,6 @@ async def get( :type environment_name: str :param managed_certificate_name: Name of the Managed Certificate. Required. :type managed_certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedCertificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: @@ -97,22 +96,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedCertificate] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, environment_name=environment_name, managed_certificate_name=managed_certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -125,20 +123,16 @@ async def get( deserialized = self._deserialize("ManagedCertificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, environment_name: str, managed_certificate_name: str, - managed_certificate_envelope: Optional[Union[_models.ManagedCertificate, IO]] = None, + managed_certificate_envelope: Optional[Union[_models.ManagedCertificate, IO[bytes]]] = None, **kwargs: Any ) -> _models.ManagedCertificate: error_map = { @@ -168,7 +162,7 @@ async def _create_or_update_initial( else: _json = None - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, environment_name=environment_name, managed_certificate_name=managed_certificate_name, @@ -177,16 +171,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -207,10 +200,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" - } - @overload async def begin_create_or_update( self, @@ -239,14 +228,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ManagedCertificate or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ManagedCertificate] @@ -259,7 +240,7 @@ async def begin_create_or_update( resource_group_name: str, environment_name: str, managed_certificate_name: str, - managed_certificate_envelope: Optional[IO] = None, + managed_certificate_envelope: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -277,18 +258,10 @@ async def begin_create_or_update( :type managed_certificate_name: str :param managed_certificate_envelope: Managed Certificate to be created or updated. Default value is None. - :type managed_certificate_envelope: IO + :type managed_certificate_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ManagedCertificate or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ManagedCertificate] @@ -301,7 +274,7 @@ async def begin_create_or_update( resource_group_name: str, environment_name: str, managed_certificate_name: str, - managed_certificate_envelope: Optional[Union[_models.ManagedCertificate, IO]] = None, + managed_certificate_envelope: Optional[Union[_models.ManagedCertificate, IO[bytes]]] = None, **kwargs: Any ) -> AsyncLROPoller[_models.ManagedCertificate]: """Create or Update a Managed Certificate. @@ -316,19 +289,9 @@ async def begin_create_or_update( :param managed_certificate_name: Name of the Managed Certificate. Required. :type managed_certificate_name: str :param managed_certificate_envelope: Managed Certificate to be created or updated. Is either a - ManagedCertificate type or a IO type. Default value is None. - :type managed_certificate_envelope: ~azure.mgmt.appcontainers.models.ManagedCertificate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + ManagedCertificate type or a IO[bytes] type. Default value is None. + :type managed_certificate_envelope: ~azure.mgmt.appcontainers.models.ManagedCertificate or + IO[bytes] :return: An instance of AsyncLROPoller that returns either ManagedCertificate or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ManagedCertificate] @@ -361,7 +324,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ManagedCertificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -374,17 +337,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ManagedCertificate].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" - } + return AsyncLROPoller[_models.ManagedCertificate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -401,7 +362,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type environment_name: str :param managed_certificate_name: Name of the Managed Certificate. Required. :type managed_certificate_name: str - :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: @@ -420,22 +380,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, environment_name=environment_name, managed_certificate_name=managed_certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -446,11 +405,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def update( @@ -480,7 +435,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedCertificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: @@ -492,7 +446,7 @@ async def update( resource_group_name: str, environment_name: str, managed_certificate_name: str, - managed_certificate_envelope: IO, + managed_certificate_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -510,11 +464,10 @@ async def update( :type managed_certificate_name: str :param managed_certificate_envelope: Properties of a managed certificate that need to be updated. Required. - :type managed_certificate_envelope: IO + :type managed_certificate_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedCertificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: @@ -526,7 +479,7 @@ async def update( resource_group_name: str, environment_name: str, managed_certificate_name: str, - managed_certificate_envelope: Union[_models.ManagedCertificatePatch, IO], + managed_certificate_envelope: Union[_models.ManagedCertificatePatch, IO[bytes]], **kwargs: Any ) -> _models.ManagedCertificate: """Update tags of a managed certificate. @@ -541,13 +494,9 @@ async def update( :param managed_certificate_name: Name of the Managed Certificate. Required. :type managed_certificate_name: str :param managed_certificate_envelope: Properties of a managed certificate that need to be - updated. Is either a ManagedCertificatePatch type or a IO type. Required. + updated. Is either a ManagedCertificatePatch type or a IO[bytes] type. Required. :type managed_certificate_envelope: ~azure.mgmt.appcontainers.models.ManagedCertificatePatch or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: ManagedCertificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: @@ -575,7 +524,7 @@ async def update( else: _json = self._serialize.body(managed_certificate_envelope, "ManagedCertificatePatch") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, environment_name=environment_name, managed_certificate_name=managed_certificate_name, @@ -584,16 +533,15 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -606,13 +554,9 @@ async def update( deserialized = self._deserialize("ManagedCertificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -627,7 +571,6 @@ def list( :type resource_group_name: str :param environment_name: Name of the Managed Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ManagedCertificate or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ManagedCertificate] @@ -650,17 +593,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -672,13 +614,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ManagedCertificateCollection", pipeline_response) @@ -688,11 +630,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -704,7 +646,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates" - } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py index 0c728b1b93c4..7a7bc78871dc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_diagnostics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -67,7 +67,6 @@ async def list_detectors( :type resource_group_name: str :param environment_name: Name of the Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticsCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -86,21 +85,20 @@ async def list_detectors( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) - request = build_list_detectors_request( + _request = build_list_detectors_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_detectors.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -113,13 +111,9 @@ async def list_detectors( deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_detectors.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors" - } + return deserialized # type: ignore @distributed_trace_async async def get_detector( @@ -136,7 +130,6 @@ async def get_detector( :type environment_name: str :param detector_name: Name of the Managed Environment detector. Required. :type detector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Diagnostics or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: @@ -155,22 +148,21 @@ async def get_detector( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Diagnostics] = kwargs.pop("cls", None) - request = build_get_detector_request( + _request = build_get_detector_request( resource_group_name=resource_group_name, environment_name=environment_name, detector_name=detector_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_detector.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,10 +175,6 @@ async def get_detector( deserialized = self._deserialize("Diagnostics", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_detector.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py new file mode 100644 index 000000000000..bad1c1fbb2c0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environment_usages_operations.py @@ -0,0 +1,138 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_environment_usages_operations import build_list_request +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedEnvironmentUsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`managed_environment_usages` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: + """Gets the current usage information as well as the limits for environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Environment. Required. + :type environment_name: str + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("ListUsagesResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py index f7e58e053d8b..898eb2987a58 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_diagnostics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -64,7 +64,6 @@ async def get_root( :type resource_group_name: str :param environment_name: Name of the Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironment or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises ~azure.core.exceptions.HttpResponseError: @@ -83,21 +82,20 @@ async def get_root( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironment] = kwargs.pop("cls", None) - request = build_get_root_request( + _request = build_get_root_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_root.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -110,10 +108,6 @@ async def get_root( deserialized = self._deserialize("ManagedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_root.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorProperties/rootApi/" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py index 1989e65081df..95cc9648f12f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -72,7 +72,6 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ManagedE Get all Managed Environments for a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -95,15 +94,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ManagedE def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -115,13 +113,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ManagedEnvironmentsCollection", pipeline_response) @@ -131,11 +129,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -148,10 +146,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any @@ -163,7 +157,6 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -186,16 +179,15 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -207,13 +199,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ManagedEnvironmentsCollection", pipeline_response) @@ -223,11 +215,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -240,10 +232,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments" - } - @distributed_trace_async async def get(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> _models.ManagedEnvironment: """Get the properties of a Managed Environment. @@ -255,7 +243,6 @@ async def get(self, resource_group_name: str, environment_name: str, **kwargs: A :type resource_group_name: str :param environment_name: Name of the Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironment or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises ~azure.core.exceptions.HttpResponseError: @@ -274,21 +261,20 @@ async def get(self, resource_group_name: str, environment_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironment] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -301,19 +287,15 @@ async def get(self, resource_group_name: str, environment_name: str, **kwargs: A deserialized = self._deserialize("ManagedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, environment_name: str, - environment_envelope: Union[_models.ManagedEnvironment, IO], + environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any ) -> _models.ManagedEnvironment: error_map = { @@ -339,7 +321,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(environment_envelope, "ManagedEnvironment") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, @@ -347,16 +329,15 @@ async def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,10 +358,6 @@ async def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } - @overload async def begin_create_or_update( self, @@ -405,14 +382,6 @@ async def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -424,7 +393,7 @@ async def begin_create_or_update( self, resource_group_name: str, environment_name: str, - environment_envelope: IO, + environment_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -439,18 +408,10 @@ async def begin_create_or_update( :param environment_name: Name of the Environment. Required. :type environment_name: str :param environment_envelope: Configuration details of the Environment. Required. - :type environment_envelope: IO + :type environment_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -462,7 +423,7 @@ async def begin_create_or_update( self, resource_group_name: str, environment_name: str, - environment_envelope: Union[_models.ManagedEnvironment, IO], + environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ManagedEnvironment]: """Creates or updates a Managed Environment. @@ -475,19 +436,8 @@ async def begin_create_or_update( :param environment_name: Name of the Environment. Required. :type environment_name: str :param environment_envelope: Configuration details of the Environment. Is either a - ManagedEnvironment type or a IO type. Required. - :type environment_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironment or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + ManagedEnvironment type or a IO[bytes] type. Required. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironment or IO[bytes] :return: An instance of AsyncLROPoller that returns either ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -519,7 +469,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ManagedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -529,17 +479,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ManagedEnvironment].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } + return AsyncLROPoller[_models.ManagedEnvironment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, environment_name: str, **kwargs: Any @@ -558,21 +506,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -583,11 +530,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete( @@ -602,14 +545,6 @@ async def begin_delete( :type resource_group_name: str :param environment_name: Name of the Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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: @@ -636,7 +571,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -645,23 +580,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _update_initial( self, resource_group_name: str, environment_name: str, - environment_envelope: Union[_models.ManagedEnvironment, IO], + environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any ) -> Optional[_models.ManagedEnvironment]: error_map = { @@ -687,7 +618,7 @@ async def _update_initial( else: _json = self._serialize.body(environment_envelope, "ManagedEnvironment") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, @@ -695,16 +626,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -719,13 +649,9 @@ async def _update_initial( deserialized = self._deserialize("ManagedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -751,14 +677,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -770,7 +688,7 @@ async def begin_update( self, resource_group_name: str, environment_name: str, - environment_envelope: IO, + environment_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -785,18 +703,10 @@ async def begin_update( :param environment_name: Name of the Environment. Required. :type environment_name: str :param environment_envelope: Configuration details of the Environment. Required. - :type environment_envelope: IO + :type environment_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -808,7 +718,7 @@ async def begin_update( self, resource_group_name: str, environment_name: str, - environment_envelope: Union[_models.ManagedEnvironment, IO], + environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ManagedEnvironment]: """Update Managed Environment's properties. @@ -821,19 +731,8 @@ async def begin_update( :param environment_name: Name of the Environment. Required. :type environment_name: str :param environment_envelope: Configuration details of the Environment. Is either a - ManagedEnvironment type or a IO type. Required. - :type environment_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironment or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + ManagedEnvironment type or a IO[bytes] type. Required. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironment or IO[bytes] :return: An instance of AsyncLROPoller that returns either ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -865,7 +764,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ManagedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -875,17 +774,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ManagedEnvironment].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } + return AsyncLROPoller[_models.ManagedEnvironment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def get_auth_token( @@ -900,7 +797,6 @@ async def get_auth_token( :type resource_group_name: str :param environment_name: Name of the Managed Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EnvironmentAuthToken or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.EnvironmentAuthToken :raises ~azure.core.exceptions.HttpResponseError: @@ -919,21 +815,20 @@ async def get_auth_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentAuthToken] = kwargs.pop("cls", None) - request = build_get_auth_token_request( + _request = build_get_auth_token_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_auth_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -946,13 +841,9 @@ async def get_auth_token( deserialized = self._deserialize("EnvironmentAuthToken", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_auth_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/getAuthtoken" - } + return deserialized # type: ignore @distributed_trace def list_workload_profile_states( @@ -967,7 +858,6 @@ def list_workload_profile_states( :type resource_group_name: str :param environment_name: Name of the Managed Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkloadProfileStates or the result of cls(response) :rtype: @@ -991,17 +881,16 @@ def list_workload_profile_states( def prepare_request(next_link=None): if not next_link: - request = build_list_workload_profile_states_request( + _request = build_list_workload_profile_states_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_workload_profile_states.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1013,13 +902,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("WorkloadProfileStatesCollection", pipeline_response) @@ -1029,11 +918,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1045,7 +934,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_workload_profile_states.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/workloadProfileStates" - } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py index dd51d8ccbccb..c70d7e6a5626 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -70,7 +70,6 @@ async def list( :type resource_group_name: str :param environment_name: Name of the Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStoragesCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStoragesCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -89,21 +88,20 @@ async def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironmentStoragesCollection] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -116,13 +114,9 @@ async def list( deserialized = self._deserialize("ManagedEnvironmentStoragesCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages" - } + return deserialized # type: ignore @distributed_trace_async async def get( @@ -139,7 +133,6 @@ async def get( :type environment_name: str :param storage_name: Name of the storage. Required. :type storage_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -158,22 +151,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironmentStorage] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, environment_name=environment_name, storage_name=storage_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -186,13 +178,9 @@ async def get( deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -221,7 +209,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -233,7 +220,7 @@ async def create_or_update( resource_group_name: str, environment_name: str, storage_name: str, - storage_envelope: IO, + storage_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -250,11 +237,10 @@ async def create_or_update( :param storage_name: Name of the storage. Required. :type storage_name: str :param storage_envelope: Configuration details of storage. Required. - :type storage_envelope: IO + :type storage_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -266,7 +252,7 @@ async def create_or_update( resource_group_name: str, environment_name: str, storage_name: str, - storage_envelope: Union[_models.ManagedEnvironmentStorage, IO], + storage_envelope: Union[_models.ManagedEnvironmentStorage, IO[bytes]], **kwargs: Any ) -> _models.ManagedEnvironmentStorage: """Create or update storage for a managedEnvironment. @@ -281,12 +267,8 @@ async def create_or_update( :param storage_name: Name of the storage. Required. :type storage_name: str :param storage_envelope: Configuration details of storage. Is either a - ManagedEnvironmentStorage type or a IO type. Required. - :type storage_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ManagedEnvironmentStorage type or a IO[bytes] type. Required. + :type storage_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage or IO[bytes] :return: ManagedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -314,7 +296,7 @@ async def create_or_update( else: _json = self._serialize.body(storage_envelope, "ManagedEnvironmentStorage") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, environment_name=environment_name, storage_name=storage_name, @@ -323,16 +305,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -345,13 +326,9 @@ async def create_or_update( deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -368,7 +345,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type environment_name: str :param storage_name: Name of the storage. Required. :type storage_name: str - :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: @@ -387,22 +363,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, environment_name=environment_name, storage_name=storage_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -413,8 +388,4 @@ async def delete( # pylint: disable=inconsistent-return-statements 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.App/managedEnvironments/{environmentName}/storages/{storageName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py index 1a0b6ed2c2d0..c95740bbf0b1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -77,7 +77,6 @@ async def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResponse or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -88,7 +87,7 @@ async def check_name_availability( self, resource_group_name: str, environment_name: str, - check_name_availability_request: IO, + check_name_availability_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -103,11 +102,10 @@ async def check_name_availability( :param environment_name: Name of the Managed Environment. Required. :type environment_name: str :param check_name_availability_request: The check name availability request. Required. - :type check_name_availability_request: IO + :type check_name_availability_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResponse or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -118,7 +116,7 @@ async def check_name_availability( self, resource_group_name: str, environment_name: str, - check_name_availability_request: Union[_models.CheckNameAvailabilityRequest, IO], + check_name_availability_request: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityResponse: """Checks the resource name availability. @@ -131,13 +129,9 @@ async def check_name_availability( :param environment_name: Name of the Managed Environment. Required. :type environment_name: str :param check_name_availability_request: The check name availability request. Is either a - CheckNameAvailabilityRequest type or a IO type. Required. + CheckNameAvailabilityRequest type or a IO[bytes] type. Required. :type check_name_availability_request: - ~azure.mgmt.appcontainers.models.CheckNameAvailabilityRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.appcontainers.models.CheckNameAvailabilityRequest or IO[bytes] :return: CheckNameAvailabilityResponse or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -165,7 +159,7 @@ async def check_name_availability( else: _json = self._serialize.body(check_name_availability_request, "CheckNameAvailabilityRequest") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, @@ -173,16 +167,15 @@ async def check_name_availability( content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -195,10 +188,6 @@ async def check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/checkNameAvailability" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py index 8b1098269102..560fc6a10fe1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -57,7 +57,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: """Lists all of the available RP operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationDetail or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.OperationDetail] @@ -80,14 +79,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationDetail"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -99,13 +97,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("AvailableOperations", pipeline_response) @@ -115,11 +113,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,5 +129,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.App/operations"} diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py new file mode 100644 index 000000000000..e882d2283742 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_usages_operations.py @@ -0,0 +1,135 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._usages_operations import build_list_request +from .._vendor import ContainerAppsAPIClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class UsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.aio.ContainerAppsAPIClient`'s + :attr:`usages` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: + """Gets, for the specified location, the current resource usage information as well as the limits + under the subscription. + + :param location: The location for which resource usage is queried. Required. + :type location: str + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("ListUsagesResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py index 0c785f1782aa..d81009d3ad02 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py @@ -8,8 +8,11 @@ from ._models_py3 import AllowedAudiencesValidation from ._models_py3 import AllowedPrincipals +from ._models_py3 import AppInsightsConfiguration from ._models_py3 import AppLogsConfiguration from ._models_py3 import AppRegistration +from ._models_py3 import AppResiliency +from ._models_py3 import AppResiliencyCollection from ._models_py3 import Apple from ._models_py3 import AppleRegistration from ._models_py3 import AuthConfig @@ -31,12 +34,22 @@ from ._models_py3 import BillingMeter from ._models_py3 import BillingMeterCollection from ._models_py3 import BillingMeterProperties +from ._models_py3 import BlobStorageTokenStore +from ._models_py3 import BuildCollection +from ._models_py3 import BuildConfiguration +from ._models_py3 import BuildResource +from ._models_py3 import BuildToken +from ._models_py3 import BuilderCollection +from ._models_py3 import BuilderResource +from ._models_py3 import BuilderResourceUpdate from ._models_py3 import Certificate from ._models_py3 import CertificateCollection +from ._models_py3 import CertificateKeyVaultProperties from ._models_py3 import CertificatePatch from ._models_py3 import CertificateProperties from ._models_py3 import CheckNameAvailabilityRequest from ._models_py3 import CheckNameAvailabilityResponse +from ._models_py3 import CircuitBreakerPolicy from ._models_py3 import ClientRegistration from ._models_py3 import Configuration from ._models_py3 import ConnectedEnvironment @@ -54,6 +67,8 @@ from ._models_py3 import ContainerAppProbeHttpGetHttpHeadersItem from ._models_py3 import ContainerAppProbeTcpSocket from ._models_py3 import ContainerAppSecret +from ._models_py3 import ContainerRegistry +from ._models_py3 import ContainerRegistryWithCustomImage from ._models_py3 import ContainerResources from ._models_py3 import CookieExpiration from ._models_py3 import CorsPolicy @@ -66,15 +81,31 @@ from ._models_py3 import CustomScaleRule from ._models_py3 import Dapr from ._models_py3 import DaprComponent +from ._models_py3 import DaprComponentResiliencyPoliciesCollection +from ._models_py3 import DaprComponentResiliencyPolicy +from ._models_py3 import DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration +from ._models_py3 import DaprComponentResiliencyPolicyConfiguration +from ._models_py3 import DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration +from ._models_py3 import DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration +from ._models_py3 import DaprComponentResiliencyPolicyTimeoutPolicyConfiguration +from ._models_py3 import DaprComponentServiceBinding from ._models_py3 import DaprComponentsCollection from ._models_py3 import DaprConfiguration from ._models_py3 import DaprMetadata from ._models_py3 import DaprSecret from ._models_py3 import DaprSecretsCollection +from ._models_py3 import DaprServiceBindMetadata +from ._models_py3 import DaprSubscription +from ._models_py3 import DaprSubscriptionBulkSubscribeOptions +from ._models_py3 import DaprSubscriptionRouteRule +from ._models_py3 import DaprSubscriptionRoutes +from ._models_py3 import DaprSubscriptionsCollection +from ._models_py3 import DataDogConfiguration from ._models_py3 import DefaultAuthorizationPolicy from ._models_py3 import DefaultErrorResponse from ._models_py3 import DefaultErrorResponseError from ._models_py3 import DefaultErrorResponseErrorDetailsItem +from ._models_py3 import DestinationsConfiguration from ._models_py3 import DiagnosticDataProviderMetadata from ._models_py3 import DiagnosticDataProviderMetadataPropertyBagItem from ._models_py3 import DiagnosticDataTableResponseColumn @@ -87,8 +118,14 @@ from ._models_py3 import DiagnosticsDefinition from ._models_py3 import DiagnosticsProperties from ._models_py3 import DiagnosticsStatus +from ._models_py3 import DotNetComponent +from ._models_py3 import DotNetComponentConfigurationProperty +from ._models_py3 import DotNetComponentServiceBind +from ._models_py3 import DotNetComponentsCollection +from ._models_py3 import EncryptionSettings from ._models_py3 import EnvironmentAuthToken from ._models_py3 import EnvironmentVar +from ._models_py3 import EnvironmentVariable from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse @@ -99,14 +136,24 @@ from ._models_py3 import GithubActionConfiguration from ._models_py3 import GlobalValidation from ._models_py3 import Google +from ._models_py3 import Header +from ._models_py3 import HeaderMatch +from ._models_py3 import HttpConnectionPool +from ._models_py3 import HttpGet +from ._models_py3 import HttpRetryPolicy from ._models_py3 import HttpScaleRule from ._models_py3 import HttpSettings from ._models_py3 import HttpSettingsRoutes from ._models_py3 import IdentityProviders from ._models_py3 import Ingress +from ._models_py3 import IngressPortMapping from ._models_py3 import IngressStickySessions from ._models_py3 import InitContainer from ._models_py3 import IpSecurityRestrictionRule +from ._models_py3 import JavaComponent +from ._models_py3 import JavaComponentConfigurationProperty +from ._models_py3 import JavaComponentServiceBind +from ._models_py3 import JavaComponentsCollection from ._models_py3 import Job from ._models_py3 import JobConfiguration from ._models_py3 import JobConfigurationEventTriggerConfig @@ -126,10 +173,12 @@ from ._models_py3 import JobsCollection from ._models_py3 import JwtClaimChecks from ._models_py3 import KedaConfiguration +from ._models_py3 import ListUsagesResult from ._models_py3 import LogAnalyticsConfiguration from ._models_py3 import Login from ._models_py3 import LoginRoutes from ._models_py3 import LoginScopes +from ._models_py3 import LogsConfiguration from ._models_py3 import ManagedCertificate from ._models_py3 import ManagedCertificateCollection from ._models_py3 import ManagedCertificatePatch @@ -141,14 +190,19 @@ from ._models_py3 import ManagedEnvironmentStoragesCollection from ._models_py3 import ManagedEnvironmentsCollection from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import MetricsConfiguration from ._models_py3 import Mtls +from ._models_py3 import NfsAzureFileProperties from ._models_py3 import Nonce from ._models_py3 import OpenIdConnectClientCredential from ._models_py3 import OpenIdConnectConfig from ._models_py3 import OpenIdConnectLogin from ._models_py3 import OpenIdConnectRegistration +from ._models_py3 import OpenTelemetryConfiguration from ._models_py3 import OperationDetail from ._models_py3 import OperationDisplay +from ._models_py3 import OtlpConfiguration +from ._models_py3 import PreBuildStep from ._models_py3 import ProxyResource from ._models_py3 import QueueScaleRule from ._models_py3 import RegistryCredentials @@ -170,12 +224,19 @@ from ._models_py3 import SourceControl from ._models_py3 import SourceControlCollection from ._models_py3 import SystemData +from ._models_py3 import TcpConnectionPool +from ._models_py3 import TcpRetryPolicy from ._models_py3 import TcpScaleRule from ._models_py3 import Template +from ._models_py3 import TimeoutPolicy +from ._models_py3 import TokenStore +from ._models_py3 import TracesConfiguration from ._models_py3 import TrackedResource from ._models_py3 import TrafficWeight from ._models_py3 import Twitter from ._models_py3 import TwitterRegistration +from ._models_py3 import Usage +from ._models_py3 import UsageName from ._models_py3 import UserAssignedIdentity from ._models_py3 import VnetConfiguration from ._models_py3 import Volume @@ -192,7 +253,11 @@ from ._container_apps_api_client_enums import AppProtocol from ._container_apps_api_client_enums import Applicability from ._container_apps_api_client_enums import BindingType +from ._container_apps_api_client_enums import BuildProvisioningState +from ._container_apps_api_client_enums import BuildStatus +from ._container_apps_api_client_enums import BuilderProvisioningState from ._container_apps_api_client_enums import CertificateProvisioningState +from ._container_apps_api_client_enums import CertificateType from ._container_apps_api_client_enums import CheckNameAvailabilityReason from ._container_apps_api_client_enums import ConnectedEnvironmentProvisioningState from ._container_apps_api_client_enums import ContainerAppContainerRunningState @@ -201,11 +266,16 @@ from ._container_apps_api_client_enums import CookieExpirationConvention from ._container_apps_api_client_enums import CreatedByType from ._container_apps_api_client_enums import DnsVerificationTestResult +from ._container_apps_api_client_enums import DotNetComponentProvisioningState +from ._container_apps_api_client_enums import DotNetComponentType from ._container_apps_api_client_enums import EnvironmentProvisioningState from ._container_apps_api_client_enums import ExtendedLocationTypes from ._container_apps_api_client_enums import ForwardProxyConvention from ._container_apps_api_client_enums import IngressClientCertificateMode +from ._container_apps_api_client_enums import IngressTargetPortHttpScheme from ._container_apps_api_client_enums import IngressTransportMethod +from ._container_apps_api_client_enums import JavaComponentProvisioningState +from ._container_apps_api_client_enums import JavaComponentType from ._container_apps_api_client_enums import JobExecutionRunningState from ._container_apps_api_client_enums import JobProvisioningState from ._container_apps_api_client_enums import LogLevel @@ -227,8 +297,11 @@ __all__ = [ "AllowedAudiencesValidation", "AllowedPrincipals", + "AppInsightsConfiguration", "AppLogsConfiguration", "AppRegistration", + "AppResiliency", + "AppResiliencyCollection", "Apple", "AppleRegistration", "AuthConfig", @@ -250,12 +323,22 @@ "BillingMeter", "BillingMeterCollection", "BillingMeterProperties", + "BlobStorageTokenStore", + "BuildCollection", + "BuildConfiguration", + "BuildResource", + "BuildToken", + "BuilderCollection", + "BuilderResource", + "BuilderResourceUpdate", "Certificate", "CertificateCollection", + "CertificateKeyVaultProperties", "CertificatePatch", "CertificateProperties", "CheckNameAvailabilityRequest", "CheckNameAvailabilityResponse", + "CircuitBreakerPolicy", "ClientRegistration", "Configuration", "ConnectedEnvironment", @@ -273,6 +356,8 @@ "ContainerAppProbeHttpGetHttpHeadersItem", "ContainerAppProbeTcpSocket", "ContainerAppSecret", + "ContainerRegistry", + "ContainerRegistryWithCustomImage", "ContainerResources", "CookieExpiration", "CorsPolicy", @@ -285,15 +370,31 @@ "CustomScaleRule", "Dapr", "DaprComponent", + "DaprComponentResiliencyPoliciesCollection", + "DaprComponentResiliencyPolicy", + "DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration", + "DaprComponentResiliencyPolicyConfiguration", + "DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration", + "DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration", + "DaprComponentResiliencyPolicyTimeoutPolicyConfiguration", + "DaprComponentServiceBinding", "DaprComponentsCollection", "DaprConfiguration", "DaprMetadata", "DaprSecret", "DaprSecretsCollection", + "DaprServiceBindMetadata", + "DaprSubscription", + "DaprSubscriptionBulkSubscribeOptions", + "DaprSubscriptionRouteRule", + "DaprSubscriptionRoutes", + "DaprSubscriptionsCollection", + "DataDogConfiguration", "DefaultAuthorizationPolicy", "DefaultErrorResponse", "DefaultErrorResponseError", "DefaultErrorResponseErrorDetailsItem", + "DestinationsConfiguration", "DiagnosticDataProviderMetadata", "DiagnosticDataProviderMetadataPropertyBagItem", "DiagnosticDataTableResponseColumn", @@ -306,8 +407,14 @@ "DiagnosticsDefinition", "DiagnosticsProperties", "DiagnosticsStatus", + "DotNetComponent", + "DotNetComponentConfigurationProperty", + "DotNetComponentServiceBind", + "DotNetComponentsCollection", + "EncryptionSettings", "EnvironmentAuthToken", "EnvironmentVar", + "EnvironmentVariable", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -318,14 +425,24 @@ "GithubActionConfiguration", "GlobalValidation", "Google", + "Header", + "HeaderMatch", + "HttpConnectionPool", + "HttpGet", + "HttpRetryPolicy", "HttpScaleRule", "HttpSettings", "HttpSettingsRoutes", "IdentityProviders", "Ingress", + "IngressPortMapping", "IngressStickySessions", "InitContainer", "IpSecurityRestrictionRule", + "JavaComponent", + "JavaComponentConfigurationProperty", + "JavaComponentServiceBind", + "JavaComponentsCollection", "Job", "JobConfiguration", "JobConfigurationEventTriggerConfig", @@ -345,10 +462,12 @@ "JobsCollection", "JwtClaimChecks", "KedaConfiguration", + "ListUsagesResult", "LogAnalyticsConfiguration", "Login", "LoginRoutes", "LoginScopes", + "LogsConfiguration", "ManagedCertificate", "ManagedCertificateCollection", "ManagedCertificatePatch", @@ -360,14 +479,19 @@ "ManagedEnvironmentStoragesCollection", "ManagedEnvironmentsCollection", "ManagedServiceIdentity", + "MetricsConfiguration", "Mtls", + "NfsAzureFileProperties", "Nonce", "OpenIdConnectClientCredential", "OpenIdConnectConfig", "OpenIdConnectLogin", "OpenIdConnectRegistration", + "OpenTelemetryConfiguration", "OperationDetail", "OperationDisplay", + "OtlpConfiguration", + "PreBuildStep", "ProxyResource", "QueueScaleRule", "RegistryCredentials", @@ -389,12 +513,19 @@ "SourceControl", "SourceControlCollection", "SystemData", + "TcpConnectionPool", + "TcpRetryPolicy", "TcpScaleRule", "Template", + "TimeoutPolicy", + "TokenStore", + "TracesConfiguration", "TrackedResource", "TrafficWeight", "Twitter", "TwitterRegistration", + "Usage", + "UsageName", "UserAssignedIdentity", "VnetConfiguration", "Volume", @@ -410,7 +541,11 @@ "AppProtocol", "Applicability", "BindingType", + "BuildProvisioningState", + "BuildStatus", + "BuilderProvisioningState", "CertificateProvisioningState", + "CertificateType", "CheckNameAvailabilityReason", "ConnectedEnvironmentProvisioningState", "ContainerAppContainerRunningState", @@ -419,11 +554,16 @@ "CookieExpirationConvention", "CreatedByType", "DnsVerificationTestResult", + "DotNetComponentProvisioningState", + "DotNetComponentType", "EnvironmentProvisioningState", "ExtendedLocationTypes", "ForwardProxyConvention", "IngressClientCertificateMode", + "IngressTargetPortHttpScheme", "IngressTransportMethod", + "JavaComponentProvisioningState", + "JavaComponentType", "JobExecutionRunningState", "JobProvisioningState", "LogLevel", diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py index 694a6932ba5d..76e21fe999be 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py @@ -71,6 +71,38 @@ class BindingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SNI_ENABLED = "SniEnabled" +class BuilderProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource instance provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + +class BuildProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Resource instance provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + +class BuildStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the build once it has been provisioned.""" + + NOT_STARTED = "NotStarted" + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + CANCELED = "Canceled" + FAILED = "Failed" + + class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the certificate.""" @@ -81,6 +113,15 @@ class CertificateProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta) PENDING = "Pending" +class CertificateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the certificate. Allowed values are ``ServerSSLCertificate`` and + ``ImagePullTrustedCA``. + """ + + SERVER_SSL_CERTIFICATE = "ServerSSLCertificate" + IMAGE_PULL_TRUSTED_CA = "ImagePullTrustedCA" + + class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason why the given name is not available.""" @@ -151,6 +192,23 @@ class DnsVerificationTestResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): SKIPPED = "Skipped" +class DotNetComponentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the .NET Component.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETING = "Deleting" + IN_PROGRESS = "InProgress" + + +class DotNetComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the .NET Component.""" + + ASPIRE_DASHBOARD = "AspireDashboard" + ASPIRE_RESOURCE_SERVER_API = "AspireResourceServerApi" + + class EnvironmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the Environment.""" @@ -191,6 +249,13 @@ class IngressClientCertificateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta) REQUIRE = "require" +class IngressTargetPortHttpScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether an http app listens on http or https.""" + + HTTP = "http" + HTTPS = "https" + + class IngressTransportMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Ingress transport protocol.""" @@ -200,6 +265,24 @@ class IngressTransportMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): TCP = "tcp" +class JavaComponentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Java Component.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETING = "Deleting" + IN_PROGRESS = "InProgress" + + +class JavaComponentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the Java Component.""" + + SPRING_BOOT_ADMIN = "SpringBootAdmin" + SPRING_CLOUD_EUREKA = "SpringCloudEureka" + SPRING_CLOUD_CONFIG = "SpringCloudConfig" + + class JobExecutionRunningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current running State of the job.""" @@ -303,6 +386,7 @@ class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_FILE = "AzureFile" EMPTY_DIR = "EmptyDir" SECRET = "Secret" + NFS_AZURE_FILE = "NfsAzureFile" class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py index 4451f6940f93..e6f107c1bec7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py @@ -9,7 +9,7 @@ import datetime import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -17,10 +17,6 @@ from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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 @@ -78,6 +74,26 @@ def __init__( self.identities = identities +class AppInsightsConfiguration(_serialization.Model): + """Configuration of Application Insights. + + :ivar connection_string: Application Insights connection string. + :vartype connection_string: str + """ + + _attribute_map = { + "connection_string": {"key": "connectionString", "type": "str"}, + } + + def __init__(self, *, connection_string: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword connection_string: Application Insights connection string. + :paramtype connection_string: str + """ + super().__init__(**kwargs) + self.connection_string = connection_string + + class Apple(_serialization.Model): """The configuration settings of the Apple provider. @@ -218,7 +234,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -260,7 +276,26 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + """ + + +class AppResiliency(ProxyResource): + """Configuration to setup App Resiliency. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -270,6 +305,18 @@ class ProxyResource(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar timeout_policy: Policy to set request timeouts. + :vartype timeout_policy: ~azure.mgmt.appcontainers.models.TimeoutPolicy + :ivar http_retry_policy: Policy that defines http request retry conditions. + :vartype http_retry_policy: ~azure.mgmt.appcontainers.models.HttpRetryPolicy + :ivar tcp_retry_policy: Policy that defines tcp request retry conditions. + :vartype tcp_retry_policy: ~azure.mgmt.appcontainers.models.TcpRetryPolicy + :ivar circuit_breaker_policy: Policy that defines circuit breaker conditions. + :vartype circuit_breaker_policy: ~azure.mgmt.appcontainers.models.CircuitBreakerPolicy + :ivar http_connection_pool: Defines parameters for http connection pooling. + :vartype http_connection_pool: ~azure.mgmt.appcontainers.models.HttpConnectionPool + :ivar tcp_connection_pool: Defines parameters for tcp connection pooling. + :vartype tcp_connection_pool: ~azure.mgmt.appcontainers.models.TcpConnectionPool """ _validation = { @@ -284,11 +331,79 @@ class ProxyResource(Resource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "timeout_policy": {"key": "properties.timeoutPolicy", "type": "TimeoutPolicy"}, + "http_retry_policy": {"key": "properties.httpRetryPolicy", "type": "HttpRetryPolicy"}, + "tcp_retry_policy": {"key": "properties.tcpRetryPolicy", "type": "TcpRetryPolicy"}, + "circuit_breaker_policy": {"key": "properties.circuitBreakerPolicy", "type": "CircuitBreakerPolicy"}, + "http_connection_pool": {"key": "properties.httpConnectionPool", "type": "HttpConnectionPool"}, + "tcp_connection_pool": {"key": "properties.tcpConnectionPool", "type": "TcpConnectionPool"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + timeout_policy: Optional["_models.TimeoutPolicy"] = None, + http_retry_policy: Optional["_models.HttpRetryPolicy"] = None, + tcp_retry_policy: Optional["_models.TcpRetryPolicy"] = None, + circuit_breaker_policy: Optional["_models.CircuitBreakerPolicy"] = None, + http_connection_pool: Optional["_models.HttpConnectionPool"] = None, + tcp_connection_pool: Optional["_models.TcpConnectionPool"] = None, + **kwargs: Any + ) -> None: + """ + :keyword timeout_policy: Policy to set request timeouts. + :paramtype timeout_policy: ~azure.mgmt.appcontainers.models.TimeoutPolicy + :keyword http_retry_policy: Policy that defines http request retry conditions. + :paramtype http_retry_policy: ~azure.mgmt.appcontainers.models.HttpRetryPolicy + :keyword tcp_retry_policy: Policy that defines tcp request retry conditions. + :paramtype tcp_retry_policy: ~azure.mgmt.appcontainers.models.TcpRetryPolicy + :keyword circuit_breaker_policy: Policy that defines circuit breaker conditions. + :paramtype circuit_breaker_policy: ~azure.mgmt.appcontainers.models.CircuitBreakerPolicy + :keyword http_connection_pool: Defines parameters for http connection pooling. + :paramtype http_connection_pool: ~azure.mgmt.appcontainers.models.HttpConnectionPool + :keyword tcp_connection_pool: Defines parameters for tcp connection pooling. + :paramtype tcp_connection_pool: ~azure.mgmt.appcontainers.models.TcpConnectionPool + """ + super().__init__(**kwargs) + self.timeout_policy = timeout_policy + self.http_retry_policy = http_retry_policy + self.tcp_retry_policy = tcp_retry_policy + self.circuit_breaker_policy = circuit_breaker_policy + self.http_connection_pool = http_connection_pool + self.tcp_connection_pool = tcp_connection_pool + + +class AppResiliencyCollection(_serialization.Model): + """Collection of AppResiliency policies. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.AppResiliency] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AppResiliency]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.AppResiliency"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.AppResiliency] + """ super().__init__(**kwargs) + self.value = value + self.next_link = None class AuthConfig(ProxyResource): @@ -298,7 +413,7 @@ class AuthConfig(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -323,6 +438,9 @@ class AuthConfig(ProxyResource): :ivar http_settings: The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp Service Authentication/Authorization. :vartype http_settings: ~azure.mgmt.appcontainers.models.HttpSettings + :ivar encryption_settings: The configuration settings of the secrets references of encryption + key and signing key for ContainerApp Service Authentication/Authorization. + :vartype encryption_settings: ~azure.mgmt.appcontainers.models.EncryptionSettings """ _validation = { @@ -342,6 +460,7 @@ class AuthConfig(ProxyResource): "identity_providers": {"key": "properties.identityProviders", "type": "IdentityProviders"}, "login": {"key": "properties.login", "type": "Login"}, "http_settings": {"key": "properties.httpSettings", "type": "HttpSettings"}, + "encryption_settings": {"key": "properties.encryptionSettings", "type": "EncryptionSettings"}, } def __init__( @@ -352,6 +471,7 @@ def __init__( identity_providers: Optional["_models.IdentityProviders"] = None, login: Optional["_models.Login"] = None, http_settings: Optional["_models.HttpSettings"] = None, + encryption_settings: Optional["_models.EncryptionSettings"] = None, **kwargs: Any ) -> None: """ @@ -370,6 +490,9 @@ def __init__( :keyword http_settings: The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp Service Authentication/Authorization. :paramtype http_settings: ~azure.mgmt.appcontainers.models.HttpSettings + :keyword encryption_settings: The configuration settings of the secrets references of + encryption key and signing key for ContainerApp Service Authentication/Authorization. + :paramtype encryption_settings: ~azure.mgmt.appcontainers.models.EncryptionSettings """ super().__init__(**kwargs) self.platform = platform @@ -377,6 +500,7 @@ def __init__( self.identity_providers = identity_providers self.login = login self.http_settings = http_settings + self.encryption_settings = encryption_settings class AuthConfigCollection(_serialization.Model): @@ -384,7 +508,7 @@ class AuthConfigCollection(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.AuthConfig] @@ -483,7 +607,7 @@ class AvailableWorkloadProfile(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -545,6 +669,8 @@ class AvailableWorkloadProfileProperties(_serialization.Model): :vartype cores: int :ivar memory_gi_b: Memory in GiB. :vartype memory_gi_b: int + :ivar gpus: Number of GPUs. + :vartype gpus: int :ivar display_name: The everyday name of the workload profile. :vartype display_name: str """ @@ -554,6 +680,7 @@ class AvailableWorkloadProfileProperties(_serialization.Model): "applicability": {"key": "applicability", "type": "str"}, "cores": {"key": "cores", "type": "int"}, "memory_gi_b": {"key": "memoryGiB", "type": "int"}, + "gpus": {"key": "gpus", "type": "int"}, "display_name": {"key": "displayName", "type": "str"}, } @@ -564,6 +691,7 @@ def __init__( applicability: Optional[Union[str, "_models.Applicability"]] = None, cores: Optional[int] = None, memory_gi_b: Optional[int] = None, + gpus: Optional[int] = None, display_name: Optional[str] = None, **kwargs: Any ) -> None: @@ -577,6 +705,8 @@ def __init__( :paramtype cores: int :keyword memory_gi_b: Memory in GiB. :paramtype memory_gi_b: int + :keyword gpus: Number of GPUs. + :paramtype gpus: int :keyword display_name: The everyday name of the workload profile. :paramtype display_name: str """ @@ -585,6 +715,7 @@ def __init__( self.applicability = applicability self.cores = cores self.memory_gi_b = memory_gi_b + self.gpus = gpus self.display_name = display_name @@ -593,7 +724,7 @@ class AvailableWorkloadProfilesCollection(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of workload profiles. Required. :vartype value: list[~azure.mgmt.appcontainers.models.AvailableWorkloadProfile] @@ -1097,7 +1228,7 @@ class BillingMeter(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1150,7 +1281,7 @@ def __init__( class BillingMeterCollection(_serialization.Model): """Collection of billing meters. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of billing meters. Required. :vartype value: list[~azure.mgmt.appcontainers.models.BillingMeter] @@ -1212,16 +1343,165 @@ def __init__( self.display_name = display_name +class BlobStorageTokenStore(_serialization.Model): + """The configuration settings of the storage of the tokens if blob storage is used. + + All required parameters must be populated in order to send to server. + + :ivar sas_url_setting_name: The name of the app secrets containing the SAS URL of the blob + storage containing the tokens. Required. + :vartype sas_url_setting_name: str + """ + + _validation = { + "sas_url_setting_name": {"required": True}, + } + + _attribute_map = { + "sas_url_setting_name": {"key": "sasUrlSettingName", "type": "str"}, + } + + def __init__(self, *, sas_url_setting_name: str, **kwargs: Any) -> None: + """ + :keyword sas_url_setting_name: The name of the app secrets containing the SAS URL of the blob + storage containing the tokens. Required. + :paramtype sas_url_setting_name: str + """ + super().__init__(**kwargs) + self.sas_url_setting_name = sas_url_setting_name + + +class BuildCollection(_serialization.Model): + """The response of a BuildResource list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The BuildResource items on this page. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.BuildResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[BuildResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.BuildResource"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The BuildResource items on this page. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.BuildResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildConfiguration(_serialization.Model): + """Configuration of the build. + + :ivar base_os: Base OS used to build and run the app. + :vartype base_os: str + :ivar platform: Platform to be used to build and run the app. + :vartype platform: str + :ivar platform_version: Platform version to be used to build and run the app. + :vartype platform_version: str + :ivar environment_variables: List of environment variables to be passed to the build, secrets + should not be used in environment variable. + :vartype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] + :ivar pre_build_steps: List of steps to perform before the build. + :vartype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] + """ + + _attribute_map = { + "base_os": {"key": "baseOs", "type": "str"}, + "platform": {"key": "platform", "type": "str"}, + "platform_version": {"key": "platformVersion", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "[EnvironmentVariable]"}, + "pre_build_steps": {"key": "preBuildSteps", "type": "[PreBuildStep]"}, + } + + def __init__( + self, + *, + base_os: Optional[str] = None, + platform: Optional[str] = None, + platform_version: Optional[str] = None, + environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, + pre_build_steps: Optional[List["_models.PreBuildStep"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword base_os: Base OS used to build and run the app. + :paramtype base_os: str + :keyword platform: Platform to be used to build and run the app. + :paramtype platform: str + :keyword platform_version: Platform version to be used to build and run the app. + :paramtype platform_version: str + :keyword environment_variables: List of environment variables to be passed to the build, + secrets should not be used in environment variable. + :paramtype environment_variables: list[~azure.mgmt.appcontainers.models.EnvironmentVariable] + :keyword pre_build_steps: List of steps to perform before the build. + :paramtype pre_build_steps: list[~azure.mgmt.appcontainers.models.PreBuildStep] + """ + super().__init__(**kwargs) + self.base_os = base_os + self.platform = platform + self.platform_version = platform_version + self.environment_variables = environment_variables + self.pre_build_steps = pre_build_steps + + +class BuilderCollection(_serialization.Model): + """The response of a BuilderResource list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The BuilderResource items on this page. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.BuilderResource] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[BuilderResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: List["_models.BuilderResource"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The BuilderResource items on this page. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.BuilderResource] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + class TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1266,15 +1546,15 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class Certificate(TrackedResource): - """Certificate used for Custom Domain bindings of Container Apps in a Managed Environment. +class BuilderResource(TrackedResource): + """Information about the SourceToCloud builder resource. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1288,8 +1568,17 @@ class Certificate(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar properties: Certificate resource specific properties. - :vartype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar provisioning_state: Provisioning state of a builder resource. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuilderProvisioningState + :ivar environment_id: Resource ID of the container apps environment that the builder is + associated with. + :vartype environment_id: str + :ivar container_registries: List of mappings of container registries and the managed identity + used to connect to it. + :vartype container_registries: list[~azure.mgmt.appcontainers.models.ContainerRegistry] """ _validation = { @@ -1298,6 +1587,7 @@ class Certificate(TrackedResource): "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -1307,7 +1597,10 @@ class Certificate(TrackedResource): "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "properties": {"key": "properties", "type": "CertificateProperties"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, + "container_registries": {"key": "properties.containerRegistries", "type": "[ContainerRegistry]"}, } def __init__( @@ -1315,7 +1608,9 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.CertificateProperties"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + environment_id: Optional[str] = None, + container_registries: Optional[List["_models.ContainerRegistry"]] = None, **kwargs: Any ) -> None: """ @@ -1323,75 +1618,339 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword properties: Certificate resource specific properties. - :paramtype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword environment_id: Resource ID of the container apps environment that the builder is + associated with. + :paramtype environment_id: str + :keyword container_registries: List of mappings of container registries and the managed + identity used to connect to it. + :paramtype container_registries: list[~azure.mgmt.appcontainers.models.ContainerRegistry] """ super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - - -class CertificateCollection(_serialization.Model): - """Collection of Certificates. + self.identity = identity + self.provisioning_state = None + self.environment_id = environment_id + self.container_registries = container_registries - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. +class BuilderResourceUpdate(_serialization.Model): + """The type used for update operations of the BuilderResource. - :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.Certificate] - :ivar next_link: Link to next page of resources. - :vartype next_link: str + :ivar identity: The managed service identities assigned to this resource. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar environment_id: Resource ID of the container apps environment that the builder is + associated with. + :vartype environment_id: str """ - _validation = { - "value": {"required": True}, - "next_link": {"readonly": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[Certificate]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "tags": {"key": "tags", "type": "{str}"}, + "environment_id": {"key": "properties.environmentId", "type": "str"}, } - def __init__(self, *, value: List["_models.Certificate"], **kwargs: Any) -> None: + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + environment_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.Certificate] + :keyword identity: The managed service identities assigned to this resource. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword environment_id: Resource ID of the container apps environment that the builder is + associated with. + :paramtype environment_id: str """ super().__init__(**kwargs) - self.value = value - self.next_link = None + self.identity = identity + self.tags = tags + self.environment_id = environment_id -class CertificatePatch(_serialization.Model): - """A certificate to update. +class BuildResource(ProxyResource): # pylint: disable=too-many-instance-attributes + """Information pertaining to an individual build. - :ivar tags: Application-specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar provisioning_state: Build provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.BuildProvisioningState + :ivar build_status: Status of the build once it has been provisioned. Known values are: + "NotStarted", "InProgress", "Succeeded", "Canceled", and "Failed". + :vartype build_status: str or ~azure.mgmt.appcontainers.models.BuildStatus + :ivar destination_container_registry: Container registry that the final image will be uploaded + to. + :vartype destination_container_registry: + ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage + :ivar configuration: Configuration of the build. + :vartype configuration: ~azure.mgmt.appcontainers.models.BuildConfiguration + :ivar upload_endpoint: Endpoint to which the source code should be uploaded. + :vartype upload_endpoint: str + :ivar log_stream_endpoint: Endpoint from which the build logs can be streamed. + :vartype log_stream_endpoint: str + :ivar token_endpoint: Endpoint to use to retrieve an authentication token for log streaming and + uploading source code. + :vartype token_endpoint: str """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "build_status": {"readonly": True}, + "upload_endpoint": {"readonly": True}, + "log_stream_endpoint": {"readonly": True}, + "token_endpoint": {"readonly": True}, + } + _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "build_status": {"key": "properties.buildStatus", "type": "str"}, + "destination_container_registry": { + "key": "properties.destinationContainerRegistry", + "type": "ContainerRegistryWithCustomImage", + }, + "configuration": {"key": "properties.configuration", "type": "BuildConfiguration"}, + "upload_endpoint": {"key": "properties.uploadEndpoint", "type": "str"}, + "log_stream_endpoint": {"key": "properties.logStreamEndpoint", "type": "str"}, + "token_endpoint": {"key": "properties.tokenEndpoint", "type": "str"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + destination_container_registry: Optional["_models.ContainerRegistryWithCustomImage"] = None, + configuration: Optional["_models.BuildConfiguration"] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: Application-specific metadata in the form of key-value pairs. - :paramtype tags: dict[str, str] + :keyword destination_container_registry: Container registry that the final image will be + uploaded to. + :paramtype destination_container_registry: + ~azure.mgmt.appcontainers.models.ContainerRegistryWithCustomImage + :keyword configuration: Configuration of the build. + :paramtype configuration: ~azure.mgmt.appcontainers.models.BuildConfiguration """ super().__init__(**kwargs) - self.tags = tags + self.provisioning_state = None + self.build_status = None + self.destination_container_registry = destination_container_registry + self.configuration = configuration + self.upload_endpoint = None + self.log_stream_endpoint = None + self.token_endpoint = None -class CertificateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Certificate resource specific properties. +class BuildToken(_serialization.Model): + """Build Auth Token. Variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", - "Failed", "Canceled", "DeleteFailed", and "Pending". - :vartype provisioning_state: str or - ~azure.mgmt.appcontainers.models.CertificateProvisioningState + :ivar token: Authentication token. + :vartype token: str + :ivar expires: Token expiration date. + :vartype expires: ~datetime.datetime + """ + + _validation = { + "token": {"readonly": True}, + "expires": {"readonly": True}, + } + + _attribute_map = { + "token": {"key": "token", "type": "str"}, + "expires": {"key": "expires", "type": "iso-8601"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.token = None + self.expires = None + + +class Certificate(TrackedResource): + """Certificate used for Custom Domain bindings of Container Apps in a Managed Environment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Certificate resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "CertificateProperties"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.CertificateProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Certificate resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class CertificateCollection(_serialization.Model): + """Collection of Certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Certificate]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.Certificate"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.Certificate] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class CertificateKeyVaultProperties(_serialization.Model): + """Properties for a certificate stored in a Key Vault. + + :ivar identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :vartype identity: str + :ivar key_vault_url: URL pointing to the Azure Key Vault secret that holds the certificate. + :vartype key_vault_url: str + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "str"}, + "key_vault_url": {"key": "keyVaultUrl", "type": "str"}, + } + + def __init__(self, *, identity: Optional[str] = None, key_vault_url: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword identity: Resource ID of a managed identity to authenticate with Azure Key Vault, or + System to use a system-assigned identity. + :paramtype identity: str + :keyword key_vault_url: URL pointing to the Azure Key Vault secret that holds the certificate. + :paramtype key_vault_url: str + """ + super().__init__(**kwargs) + self.identity = identity + self.key_vault_url = key_vault_url + + +class CertificatePatch(_serialization.Model): + """A certificate to update. + + :ivar tags: Application-specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Application-specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class CertificateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Certificate resource specific properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the certificate. Known values are: "Succeeded", + "Failed", "Canceled", "DeleteFailed", and "Pending". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.CertificateProvisioningState + :ivar certificate_key_vault_properties: Properties for a certificate stored in a Key Vault. + :vartype certificate_key_vault_properties: + ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :ivar password: Certificate password. :vartype password: str :ivar subject_name: Subject name of the certificate. @@ -1412,6 +1971,10 @@ class CertificateProperties(_serialization.Model): # pylint: disable=too-many-i :vartype valid: bool :ivar public_key_hash: Public key hash. :vartype public_key_hash: str + :ivar certificate_type: The type of the certificate. Allowed values are + ``ServerSSLCertificate`` and ``ImagePullTrustedCA``. Known values are: "ServerSSLCertificate" + and "ImagePullTrustedCA". + :vartype certificate_type: str or ~azure.mgmt.appcontainers.models.CertificateType """ _validation = { @@ -1428,6 +1991,10 @@ class CertificateProperties(_serialization.Model): # pylint: disable=too-many-i _attribute_map = { "provisioning_state": {"key": "provisioningState", "type": "str"}, + "certificate_key_vault_properties": { + "key": "certificateKeyVaultProperties", + "type": "CertificateKeyVaultProperties", + }, "password": {"key": "password", "type": "str"}, "subject_name": {"key": "subjectName", "type": "str"}, "subject_alternative_names": {"key": "subjectAlternativeNames", "type": "[str]"}, @@ -1438,17 +2005,34 @@ class CertificateProperties(_serialization.Model): # pylint: disable=too-many-i "thumbprint": {"key": "thumbprint", "type": "str"}, "valid": {"key": "valid", "type": "bool"}, "public_key_hash": {"key": "publicKeyHash", "type": "str"}, + "certificate_type": {"key": "certificateType", "type": "str"}, } - def __init__(self, *, password: Optional[str] = None, value: Optional[bytes] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + certificate_key_vault_properties: Optional["_models.CertificateKeyVaultProperties"] = None, + password: Optional[str] = None, + value: Optional[bytes] = None, + certificate_type: Optional[Union[str, "_models.CertificateType"]] = None, + **kwargs: Any + ) -> None: """ + :keyword certificate_key_vault_properties: Properties for a certificate stored in a Key Vault. + :paramtype certificate_key_vault_properties: + ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :keyword password: Certificate password. :paramtype password: str :keyword value: PFX or PEM blob. :paramtype value: bytes + :keyword certificate_type: The type of the certificate. Allowed values are + ``ServerSSLCertificate`` and ``ImagePullTrustedCA``. Known values are: "ServerSSLCertificate" + and "ImagePullTrustedCA". + :paramtype certificate_type: str or ~azure.mgmt.appcontainers.models.CertificateType """ super().__init__(**kwargs) self.provisioning_state = None + self.certificate_key_vault_properties = certificate_key_vault_properties self.password = password self.subject_name = None self.subject_alternative_names = None @@ -1459,6 +2043,7 @@ def __init__(self, *, password: Optional[str] = None, value: Optional[bytes] = N self.thumbprint = None self.valid = None self.public_key_hash = None + self.certificate_type = certificate_type class CheckNameAvailabilityRequest(_serialization.Model): @@ -1528,6 +2113,51 @@ def __init__( self.message = message +class CircuitBreakerPolicy(_serialization.Model): + """Policy that defines circuit breaker conditions. + + :ivar consecutive_errors: Number of consecutive errors before the circuit breaker opens. + :vartype consecutive_errors: int + :ivar interval_in_seconds: The time interval, in seconds, between endpoint checks. This can + result in opening the circuit breaker if the check fails as well as closing the circuit breaker + if the check succeeds. Defaults to 10s. + :vartype interval_in_seconds: int + :ivar max_ejection_percent: Maximum percentage of hosts that will be ejected after failure + threshold has been met. + :vartype max_ejection_percent: int + """ + + _attribute_map = { + "consecutive_errors": {"key": "consecutiveErrors", "type": "int"}, + "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, + "max_ejection_percent": {"key": "maxEjectionPercent", "type": "int"}, + } + + def __init__( + self, + *, + consecutive_errors: Optional[int] = None, + interval_in_seconds: Optional[int] = None, + max_ejection_percent: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword consecutive_errors: Number of consecutive errors before the circuit breaker opens. + :paramtype consecutive_errors: int + :keyword interval_in_seconds: The time interval, in seconds, between endpoint checks. This can + result in opening the circuit breaker if the check fails as well as closing the circuit breaker + if the check succeeds. Defaults to 10s. + :paramtype interval_in_seconds: int + :keyword max_ejection_percent: Maximum percentage of hosts that will be ejected after failure + threshold has been met. + :paramtype max_ejection_percent: int + """ + super().__init__(**kwargs) + self.consecutive_errors = consecutive_errors + self.interval_in_seconds = interval_in_seconds + self.max_ejection_percent = max_ejection_percent + + class ClientRegistration(_serialization.Model): """The configuration settings of the app registration for providers that have client ids and client secrets. @@ -1648,10 +2278,10 @@ class ConnectedEnvironment(TrackedResource): # pylint: disable=too-many-instanc Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1789,7 +2419,7 @@ class ConnectedEnvironmentStorage(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1852,7 +2482,7 @@ def __init__(self, *, azure_file: Optional["_models.AzureFileProperties"] = None class ConnectedEnvironmentStoragesCollection(_serialization.Model): """Collection of Storage for Environments. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of storage resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage] @@ -1956,10 +2586,10 @@ class ContainerApp(TrackedResource): # pylint: disable=too-many-instance-attrib Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2115,10 +2745,10 @@ class ContainerAppAuthToken(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2176,7 +2806,7 @@ class ContainerAppCollection(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.ContainerApp] @@ -2209,7 +2839,7 @@ class ContainerAppJobExecutions(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.JobExecution] @@ -2352,7 +2982,7 @@ def __init__( class ContainerAppProbeHttpGet(_serialization.Model): """HTTPGet specifies the http request to perform. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar host: Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead. @@ -2419,7 +3049,7 @@ def __init__( class ContainerAppProbeHttpGetHttpHeadersItem(_serialization.Model): """HTTPHeader describes a custom header to be used in HTTP probes. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The header field name. Required. :vartype name: str @@ -2452,7 +3082,7 @@ def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: class ContainerAppProbeTcpSocket(_serialization.Model): """TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar host: Optional: Host name to connect to, defaults to the pod IP. :vartype host: str @@ -2523,6 +3153,77 @@ def __init__(self, **kwargs: Any) -> None: self.key_vault_url = None +class ContainerRegistry(_serialization.Model): + """Model representing a mapping from a container registry to the identity used to connect to it. + + All required parameters must be populated in order to send to server. + + :ivar container_registry_server: Login server of the container registry. Required. + :vartype container_registry_server: str + :ivar identity_resource_id: Resource ID of the managed identity. Required. + :vartype identity_resource_id: str + """ + + _validation = { + "container_registry_server": {"required": True}, + "identity_resource_id": {"required": True}, + } + + _attribute_map = { + "container_registry_server": {"key": "containerRegistryServer", "type": "str"}, + "identity_resource_id": {"key": "identityResourceId", "type": "str"}, + } + + def __init__(self, *, container_registry_server: str, identity_resource_id: str, **kwargs: Any) -> None: + """ + :keyword container_registry_server: Login server of the container registry. Required. + :paramtype container_registry_server: str + :keyword identity_resource_id: Resource ID of the managed identity. Required. + :paramtype identity_resource_id: str + """ + super().__init__(**kwargs) + self.container_registry_server = container_registry_server + self.identity_resource_id = identity_resource_id + + +class ContainerRegistryWithCustomImage(_serialization.Model): + """Container registry that the final image will be uploaded to. + + All required parameters must be populated in order to send to server. + + :ivar server: Login server of the container registry that the final image should be uploaded + to. Builder resource needs to have this container registry defined along with an identity to + use to access it. Required. + :vartype server: str + :ivar image: Full name that the final image should be uploaded as, including both image name + and tag. + :vartype image: str + """ + + _validation = { + "server": {"required": True}, + } + + _attribute_map = { + "server": {"key": "server", "type": "str"}, + "image": {"key": "image", "type": "str"}, + } + + def __init__(self, *, server: str, image: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword server: Login server of the container registry that the final image should be uploaded + to. Builder resource needs to have this container registry defined along with an identity to + use to access it. Required. + :paramtype server: str + :keyword image: Full name that the final image should be uploaded as, including both image name + and tag. + :paramtype image: str + """ + super().__init__(**kwargs) + self.server = server + self.image = image + + class ContainerResources(_serialization.Model): """Container App container resource requirements. @@ -2598,7 +3299,7 @@ def __init__( class CorsPolicy(_serialization.Model): """Cross-Origin-Resource-Sharing policy. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar allowed_origins: Specifies the content for the access-control-allow-origins header. Required. @@ -2666,7 +3367,7 @@ def __init__( class CustomDomain(_serialization.Model): """Custom Domain of a Container App. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: Hostname. Required. :vartype name: str @@ -2720,6 +3421,9 @@ class CustomDomainConfiguration(_serialization.Model): :vartype custom_domain_verification_id: str :ivar dns_suffix: Dns suffix for the environment domain. :vartype dns_suffix: str + :ivar certificate_key_vault_properties: Certificate stored in Azure Key Vault. + :vartype certificate_key_vault_properties: + ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :ivar certificate_value: PFX or PEM blob. :vartype certificate_value: bytes :ivar certificate_password: Certificate password. @@ -2742,6 +3446,10 @@ class CustomDomainConfiguration(_serialization.Model): _attribute_map = { "custom_domain_verification_id": {"key": "customDomainVerificationId", "type": "str"}, "dns_suffix": {"key": "dnsSuffix", "type": "str"}, + "certificate_key_vault_properties": { + "key": "certificateKeyVaultProperties", + "type": "CertificateKeyVaultProperties", + }, "certificate_value": {"key": "certificateValue", "type": "bytearray"}, "certificate_password": {"key": "certificatePassword", "type": "str"}, "expiration_date": {"key": "expirationDate", "type": "iso-8601"}, @@ -2753,6 +3461,7 @@ def __init__( self, *, dns_suffix: Optional[str] = None, + certificate_key_vault_properties: Optional["_models.CertificateKeyVaultProperties"] = None, certificate_value: Optional[bytes] = None, certificate_password: Optional[str] = None, **kwargs: Any @@ -2760,6 +3469,9 @@ def __init__( """ :keyword dns_suffix: Dns suffix for the environment domain. :paramtype dns_suffix: str + :keyword certificate_key_vault_properties: Certificate stored in Azure Key Vault. + :paramtype certificate_key_vault_properties: + ~azure.mgmt.appcontainers.models.CertificateKeyVaultProperties :keyword certificate_value: PFX or PEM blob. :paramtype certificate_value: bytes :keyword certificate_password: Certificate password. @@ -2768,6 +3480,7 @@ def __init__( super().__init__(**kwargs) self.custom_domain_verification_id = None self.dns_suffix = dns_suffix + self.certificate_key_vault_properties = certificate_key_vault_properties self.certificate_value = certificate_value self.certificate_password = certificate_password self.expiration_date = None @@ -2880,7 +3593,9 @@ def __init__( self.alternate_txt_records = alternate_txt_records -class CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo(_serialization.Model): +class CustomHostnameAnalysisResultCustomDomainVerificationFailureInfo( + _serialization.Model +): # pylint: disable=name-too-long """Raw failure information if DNS verification fails. Variables are only populated by the server, and will be ignored when sending a request. @@ -2923,7 +3638,7 @@ def __init__( """ :keyword details: Details or the error. :paramtype details: - list[~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem] + list[~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem] # pylint: disable=line-too-long """ super().__init__(**kwargs) self.code = None @@ -2932,7 +3647,9 @@ def __init__( self.details = details -class CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem(_serialization.Model): +class CustomHostnameAnalysisResultCustomDomainVerificationFailureInfoDetailsItem( + _serialization.Model +): # pylint: disable=name-too-long """Detailed errors. Variables are only populated by the server, and will be ignored when sending a request. @@ -3139,7 +3856,7 @@ class DaprComponent(ProxyResource): # pylint: disable=too-many-instance-attribu Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3165,6 +3882,10 @@ class DaprComponent(ProxyResource): # pylint: disable=too-many-instance-attribu :vartype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] :ivar scopes: Names of container apps that can use this Dapr component. :vartype scopes: list[str] + :ivar service_component_bind: List of container app services that are bound to the Dapr + component. + :vartype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] """ _validation = { @@ -3187,6 +3908,7 @@ class DaprComponent(ProxyResource): # pylint: disable=too-many-instance-attribu "secret_store_component": {"key": "properties.secretStoreComponent", "type": "str"}, "metadata": {"key": "properties.metadata", "type": "[DaprMetadata]"}, "scopes": {"key": "properties.scopes", "type": "[str]"}, + "service_component_bind": {"key": "properties.serviceComponentBind", "type": "[DaprComponentServiceBinding]"}, } def __init__( @@ -3200,6 +3922,7 @@ def __init__( secret_store_component: Optional[str] = None, metadata: Optional[List["_models.DaprMetadata"]] = None, scopes: Optional[List[str]] = None, + service_component_bind: Optional[List["_models.DaprComponentServiceBinding"]] = None, **kwargs: Any ) -> None: """ @@ -3219,6 +3942,10 @@ def __init__( :paramtype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] :keyword scopes: Names of container apps that can use this Dapr component. :paramtype scopes: list[str] + :keyword service_component_bind: List of container app services that are bound to the Dapr + component. + :paramtype service_component_bind: + list[~azure.mgmt.appcontainers.models.DaprComponentServiceBinding] """ super().__init__(**kwargs) self.component_type = component_type @@ -3229,17 +3956,18 @@ def __init__( self.secret_store_component = secret_store_component self.metadata = metadata self.scopes = scopes + self.service_component_bind = service_component_bind -class DaprComponentsCollection(_serialization.Model): - """Dapr Components ARM resource. +class DaprComponentResiliencyPoliciesCollection(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policies ARM resource. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. - :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -3250,38 +3978,360 @@ class DaprComponentsCollection(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[DaprComponent]"}, + "value": {"key": "value", "type": "[DaprComponentResiliencyPolicy]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.DaprComponent"], **kwargs: Any) -> None: + def __init__(self, *, value: List["_models.DaprComponentResiliencyPolicy"], **kwargs: Any) -> None: """ :keyword value: Collection of resources. Required. - :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] """ super().__init__(**kwargs) self.value = value self.next_link = None -class DaprConfiguration(_serialization.Model): - """Configuration properties Dapr component. +class DaprComponentResiliencyPolicy(ProxyResource): + """Dapr Component Resiliency Policy. Variables are only populated by the server, and will be ignored when sending a request. - :ivar version: The version of Dapr. - :vartype version: str + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar inbound_policy: The optional inbound component resiliency policy configuration. + :vartype inbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + :ivar outbound_policy: The optional outbound component resiliency policy configuration. + :vartype outbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration """ _validation = { - "version": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "inbound_policy": {"key": "properties.inboundPolicy", "type": "DaprComponentResiliencyPolicyConfiguration"}, + "outbound_policy": {"key": "properties.outboundPolicy", "type": "DaprComponentResiliencyPolicyConfiguration"}, + } + + def __init__( + self, + *, + inbound_policy: Optional["_models.DaprComponentResiliencyPolicyConfiguration"] = None, + outbound_policy: Optional["_models.DaprComponentResiliencyPolicyConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword inbound_policy: The optional inbound component resiliency policy configuration. + :paramtype inbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + :keyword outbound_policy: The optional outbound component resiliency policy configuration. + :paramtype outbound_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyConfiguration + """ + super().__init__(**kwargs) + self.inbound_policy = inbound_policy + self.outbound_policy = outbound_policy + + +class DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration( + _serialization.Model +): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy Circuit Breaker Policy Configuration. + + :ivar consecutive_errors: The number of consecutive errors before the circuit is opened. + :vartype consecutive_errors: int + :ivar timeout_in_seconds: The interval in seconds until a retry attempt is made after the + circuit is opened. + :vartype timeout_in_seconds: int + :ivar interval_in_seconds: The optional interval in seconds after which the error count resets + to 0. An interval of 0 will never reset. If not specified, the timeoutInSeconds value will be + used. + :vartype interval_in_seconds: int + """ + + _attribute_map = { + "consecutive_errors": {"key": "consecutiveErrors", "type": "int"}, + "timeout_in_seconds": {"key": "timeoutInSeconds", "type": "int"}, + "interval_in_seconds": {"key": "intervalInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + consecutive_errors: Optional[int] = None, + timeout_in_seconds: Optional[int] = None, + interval_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword consecutive_errors: The number of consecutive errors before the circuit is opened. + :paramtype consecutive_errors: int + :keyword timeout_in_seconds: The interval in seconds until a retry attempt is made after the + circuit is opened. + :paramtype timeout_in_seconds: int + :keyword interval_in_seconds: The optional interval in seconds after which the error count + resets to 0. An interval of 0 will never reset. If not specified, the timeoutInSeconds value + will be used. + :paramtype interval_in_seconds: int + """ + super().__init__(**kwargs) + self.consecutive_errors = consecutive_errors + self.timeout_in_seconds = timeout_in_seconds + self.interval_in_seconds = interval_in_seconds + + +class DaprComponentResiliencyPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy Configuration. + + :ivar http_retry_policy: The optional HTTP retry policy configuration. + :vartype http_retry_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration + :ivar timeout_policy: The optional timeout policy configuration. + :vartype timeout_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration + :ivar circuit_breaker_policy: The optional circuit breaker policy configuration. + :vartype circuit_breaker_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration + """ + + _attribute_map = { + "http_retry_policy": { + "key": "httpRetryPolicy", + "type": "DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration", + }, + "timeout_policy": {"key": "timeoutPolicy", "type": "DaprComponentResiliencyPolicyTimeoutPolicyConfiguration"}, + "circuit_breaker_policy": { + "key": "circuitBreakerPolicy", + "type": "DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration", + }, + } + + def __init__( + self, + *, + http_retry_policy: Optional["_models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration"] = None, + timeout_policy: Optional["_models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration"] = None, + circuit_breaker_policy: Optional[ + "_models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword http_retry_policy: The optional HTTP retry policy configuration. + :paramtype http_retry_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration + :keyword timeout_policy: The optional timeout policy configuration. + :paramtype timeout_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyTimeoutPolicyConfiguration + :keyword circuit_breaker_policy: The optional circuit breaker policy configuration. + :paramtype circuit_breaker_policy: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyCircuitBreakerPolicyConfiguration + """ + super().__init__(**kwargs) + self.http_retry_policy = http_retry_policy + self.timeout_policy = timeout_policy + self.circuit_breaker_policy = circuit_breaker_policy + + +class DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy HTTP Retry Backoff Configuration. + + :ivar initial_delay_in_milliseconds: The optional initial delay in milliseconds before an + operation is retried. + :vartype initial_delay_in_milliseconds: int + :ivar max_interval_in_milliseconds: The optional maximum time interval in milliseconds between + retry attempts. + :vartype max_interval_in_milliseconds: int + """ + + _attribute_map = { + "initial_delay_in_milliseconds": {"key": "initialDelayInMilliseconds", "type": "int"}, + "max_interval_in_milliseconds": {"key": "maxIntervalInMilliseconds", "type": "int"}, + } + + def __init__( + self, + *, + initial_delay_in_milliseconds: Optional[int] = None, + max_interval_in_milliseconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword initial_delay_in_milliseconds: The optional initial delay in milliseconds before an + operation is retried. + :paramtype initial_delay_in_milliseconds: int + :keyword max_interval_in_milliseconds: The optional maximum time interval in milliseconds + between retry attempts. + :paramtype max_interval_in_milliseconds: int + """ + super().__init__(**kwargs) + self.initial_delay_in_milliseconds = initial_delay_in_milliseconds + self.max_interval_in_milliseconds = max_interval_in_milliseconds + + +class DaprComponentResiliencyPolicyHttpRetryPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy HTTP Retry Policy Configuration. + + :ivar max_retries: The optional maximum number of retries. + :vartype max_retries: int + :ivar retry_back_off: The optional retry backoff configuration. + :vartype retry_back_off: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration + """ + + _attribute_map = { + "max_retries": {"key": "maxRetries", "type": "int"}, + "retry_back_off": {"key": "retryBackOff", "type": "DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration"}, + } + + def __init__( + self, + *, + max_retries: Optional[int] = None, + retry_back_off: Optional["_models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword max_retries: The optional maximum number of retries. + :paramtype max_retries: int + :keyword retry_back_off: The optional retry backoff configuration. + :paramtype retry_back_off: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicyHttpRetryBackOffConfiguration + """ + super().__init__(**kwargs) + self.max_retries = max_retries + self.retry_back_off = retry_back_off + + +class DaprComponentResiliencyPolicyTimeoutPolicyConfiguration(_serialization.Model): # pylint: disable=name-too-long + """Dapr Component Resiliency Policy Timeout Policy Configuration. + + :ivar response_timeout_in_seconds: The optional response timeout in seconds. + :vartype response_timeout_in_seconds: int + """ + + _attribute_map = { + "response_timeout_in_seconds": {"key": "responseTimeoutInSeconds", "type": "int"}, + } + + def __init__(self, *, response_timeout_in_seconds: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword response_timeout_in_seconds: The optional response timeout in seconds. + :paramtype response_timeout_in_seconds: int + """ + super().__init__(**kwargs) + self.response_timeout_in_seconds = response_timeout_in_seconds + + +class DaprComponentsCollection(_serialization.Model): + """Dapr Components ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DaprComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DaprComponent"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DaprComponentServiceBinding(_serialization.Model): + """Configuration to bind a Dapr Component to a dev ContainerApp Service. + + :ivar name: Name of the service bind. + :vartype name: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str + :ivar metadata: Service bind metadata. + :vartype metadata: ~azure.mgmt.appcontainers.models.DaprServiceBindMetadata + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, + "metadata": {"key": "metadata", "type": "DaprServiceBindMetadata"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + service_id: Optional[str] = None, + metadata: Optional["_models.DaprServiceBindMetadata"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the service bind. + :paramtype name: str + :keyword service_id: Resource id of the target service. + :paramtype service_id: str + :keyword metadata: Service bind metadata. + :paramtype metadata: ~azure.mgmt.appcontainers.models.DaprServiceBindMetadata + """ + super().__init__(**kwargs) + self.name = name + self.service_id = service_id + self.metadata = metadata + + +class DaprConfiguration(_serialization.Model): + """Configuration properties Dapr component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: The version of Dapr. + :vartype version: str + """ + + _validation = { + "version": {"readonly": True}, + } + + _attribute_map = { + "version": {"key": "version", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.version = None @@ -3359,7 +4409,7 @@ def __init__(self, **kwargs: Any) -> None: class DaprSecretsCollection(_serialization.Model): """Dapr component Secrets Collection for ListSecrets Action. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of secrets used by a Dapr component. Required. :vartype value: list[~azure.mgmt.appcontainers.models.DaprSecret] @@ -3382,6 +4432,289 @@ def __init__(self, *, value: List["_models.DaprSecret"], **kwargs: Any) -> None: self.value = value +class DaprServiceBindMetadata(_serialization.Model): + """Dapr component metadata. + + :ivar name: Service bind metadata property name. + :vartype name: str + :ivar value: Service bind metadata property value. + :vartype value: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Service bind metadata property name. + :paramtype name: str + :keyword value: Service bind metadata property value. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + +class DaprSubscription(ProxyResource): # pylint: disable=too-many-instance-attributes + """Dapr PubSub Event Subscription. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar pubsub_name: Dapr PubSub component name. + :vartype pubsub_name: str + :ivar topic: Topic name. + :vartype topic: str + :ivar dead_letter_topic: Deadletter topic name. + :vartype dead_letter_topic: str + :ivar routes: Subscription routes. + :vartype routes: ~azure.mgmt.appcontainers.models.DaprSubscriptionRoutes + :ivar scopes: Application scopes to restrict the subscription to specific apps. + :vartype scopes: list[str] + :ivar metadata: Subscription metadata. + :vartype metadata: dict[str, str] + :ivar bulk_subscribe: Bulk subscription options. + :vartype bulk_subscribe: ~azure.mgmt.appcontainers.models.DaprSubscriptionBulkSubscribeOptions + """ + + _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"}, + "pubsub_name": {"key": "properties.pubsubName", "type": "str"}, + "topic": {"key": "properties.topic", "type": "str"}, + "dead_letter_topic": {"key": "properties.deadLetterTopic", "type": "str"}, + "routes": {"key": "properties.routes", "type": "DaprSubscriptionRoutes"}, + "scopes": {"key": "properties.scopes", "type": "[str]"}, + "metadata": {"key": "properties.metadata", "type": "{str}"}, + "bulk_subscribe": {"key": "properties.bulkSubscribe", "type": "DaprSubscriptionBulkSubscribeOptions"}, + } + + def __init__( + self, + *, + pubsub_name: Optional[str] = None, + topic: Optional[str] = None, + dead_letter_topic: Optional[str] = None, + routes: Optional["_models.DaprSubscriptionRoutes"] = None, + scopes: Optional[List[str]] = None, + metadata: Optional[Dict[str, str]] = None, + bulk_subscribe: Optional["_models.DaprSubscriptionBulkSubscribeOptions"] = None, + **kwargs: Any + ) -> None: + """ + :keyword pubsub_name: Dapr PubSub component name. + :paramtype pubsub_name: str + :keyword topic: Topic name. + :paramtype topic: str + :keyword dead_letter_topic: Deadletter topic name. + :paramtype dead_letter_topic: str + :keyword routes: Subscription routes. + :paramtype routes: ~azure.mgmt.appcontainers.models.DaprSubscriptionRoutes + :keyword scopes: Application scopes to restrict the subscription to specific apps. + :paramtype scopes: list[str] + :keyword metadata: Subscription metadata. + :paramtype metadata: dict[str, str] + :keyword bulk_subscribe: Bulk subscription options. + :paramtype bulk_subscribe: + ~azure.mgmt.appcontainers.models.DaprSubscriptionBulkSubscribeOptions + """ + super().__init__(**kwargs) + self.pubsub_name = pubsub_name + self.topic = topic + self.dead_letter_topic = dead_letter_topic + self.routes = routes + self.scopes = scopes + self.metadata = metadata + self.bulk_subscribe = bulk_subscribe + + +class DaprSubscriptionBulkSubscribeOptions(_serialization.Model): + """Dapr PubSub Bulk Subscription Options. + + :ivar enabled: Enable bulk subscription. + :vartype enabled: bool + :ivar max_messages_count: Maximum number of messages to deliver in a bulk message. + :vartype max_messages_count: int + :ivar max_await_duration_ms: Maximum duration in milliseconds to wait before a bulk message is + sent to the app. + :vartype max_await_duration_ms: int + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "max_messages_count": {"key": "maxMessagesCount", "type": "int"}, + "max_await_duration_ms": {"key": "maxAwaitDurationMs", "type": "int"}, + } + + def __init__( + self, + *, + enabled: bool = False, + max_messages_count: Optional[int] = None, + max_await_duration_ms: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: Enable bulk subscription. + :paramtype enabled: bool + :keyword max_messages_count: Maximum number of messages to deliver in a bulk message. + :paramtype max_messages_count: int + :keyword max_await_duration_ms: Maximum duration in milliseconds to wait before a bulk message + is sent to the app. + :paramtype max_await_duration_ms: int + """ + super().__init__(**kwargs) + self.enabled = enabled + self.max_messages_count = max_messages_count + self.max_await_duration_ms = max_await_duration_ms + + +class DaprSubscriptionRouteRule(_serialization.Model): + """Dapr Pubsub Event Subscription Route Rule is used to specify the condition for sending a + message to a specific path. + + :ivar match: The optional CEL expression used to match the event. If the match is not + specified, then the route is considered the default. The rules are tested in the order + specified, so they should be define from most-to-least specific. The default route should + appear last in the list. + :vartype match: str + :ivar path: The path for events that match this rule. + :vartype path: str + """ + + _attribute_map = { + "match": {"key": "match", "type": "str"}, + "path": {"key": "path", "type": "str"}, + } + + def __init__(self, *, match: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword match: The optional CEL expression used to match the event. If the match is not + specified, then the route is considered the default. The rules are tested in the order + specified, so they should be define from most-to-least specific. The default route should + appear last in the list. + :paramtype match: str + :keyword path: The path for events that match this rule. + :paramtype path: str + """ + super().__init__(**kwargs) + self.match = match + self.path = path + + +class DaprSubscriptionRoutes(_serialization.Model): + """Dapr PubSub Event Subscription Routes configuration. + + :ivar rules: The list of Dapr PubSub Event Subscription Route Rules. + :vartype rules: list[~azure.mgmt.appcontainers.models.DaprSubscriptionRouteRule] + :ivar default: The default path to deliver events that do not match any of the rules. + :vartype default: str + """ + + _attribute_map = { + "rules": {"key": "rules", "type": "[DaprSubscriptionRouteRule]"}, + "default": {"key": "default", "type": "str"}, + } + + def __init__( + self, + *, + rules: Optional[List["_models.DaprSubscriptionRouteRule"]] = None, + default: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword rules: The list of Dapr PubSub Event Subscription Route Rules. + :paramtype rules: list[~azure.mgmt.appcontainers.models.DaprSubscriptionRouteRule] + :keyword default: The default path to deliver events that do not match any of the rules. + :paramtype default: str + """ + super().__init__(**kwargs) + self.rules = rules + self.default = default + + +class DaprSubscriptionsCollection(_serialization.Model): + """Dapr Subscriptions ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DaprSubscription] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DaprSubscription]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.DaprSubscription"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprSubscription] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class DataDogConfiguration(_serialization.Model): + """Configuration of datadog. + + :ivar site: The data dog site. + :vartype site: str + :ivar key: The data dog api key. + :vartype key: str + """ + + _attribute_map = { + "site": {"key": "site", "type": "str"}, + "key": {"key": "key", "type": "str"}, + } + + def __init__(self, *, site: Optional[str] = None, key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword site: The data dog site. + :paramtype site: str + :keyword key: The data dog api key. + :paramtype key: str + """ + super().__init__(**kwargs) + self.site = site + self.key = key + + class DefaultAuthorizationPolicy(_serialization.Model): """The configuration settings of the Azure Active Directory default authorization policy. @@ -3521,6 +4854,38 @@ def __init__(self, **kwargs: Any) -> None: self.target = None +class DestinationsConfiguration(_serialization.Model): + """Configuration of Open Telemetry destinations. + + :ivar data_dog_configuration: Open telemetry datadog destination configuration. + :vartype data_dog_configuration: ~azure.mgmt.appcontainers.models.DataDogConfiguration + :ivar otlp_configurations: Open telemetry otlp configurations. + :vartype otlp_configurations: list[~azure.mgmt.appcontainers.models.OtlpConfiguration] + """ + + _attribute_map = { + "data_dog_configuration": {"key": "dataDogConfiguration", "type": "DataDogConfiguration"}, + "otlp_configurations": {"key": "otlpConfigurations", "type": "[OtlpConfiguration]"}, + } + + def __init__( + self, + *, + data_dog_configuration: Optional["_models.DataDogConfiguration"] = None, + otlp_configurations: Optional[List["_models.OtlpConfiguration"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_dog_configuration: Open telemetry datadog destination configuration. + :paramtype data_dog_configuration: ~azure.mgmt.appcontainers.models.DataDogConfiguration + :keyword otlp_configurations: Open telemetry otlp configurations. + :paramtype otlp_configurations: list[~azure.mgmt.appcontainers.models.OtlpConfiguration] + """ + super().__init__(**kwargs) + self.data_dog_configuration = data_dog_configuration + self.otlp_configurations = otlp_configurations + + class DiagnosticDataProviderMetadata(_serialization.Model): """Details of a diagnostics data provider. @@ -3555,7 +4920,7 @@ def __init__( self.property_bag = property_bag -class DiagnosticDataProviderMetadataPropertyBagItem(_serialization.Model): +class DiagnosticDataProviderMetadataPropertyBagItem(_serialization.Model): # pylint: disable=name-too-long """Property details. :ivar name: Property name. @@ -3711,7 +5076,7 @@ class Diagnostics(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3754,7 +5119,7 @@ class DiagnosticsCollection(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of diagnostic data. Required. :vartype value: list[~azure.mgmt.appcontainers.models.Diagnostics] @@ -3910,82 +5275,278 @@ class DiagnosticsProperties(_serialization.Model): def __init__( self, *, - metadata: Optional["_models.DiagnosticsDefinition"] = None, - dataset: Optional[List["_models.DiagnosticsDataApiResponse"]] = None, - status: Optional["_models.DiagnosticsStatus"] = None, - data_provider_metadata: Optional["_models.DiagnosticDataProviderMetadata"] = None, + metadata: Optional["_models.DiagnosticsDefinition"] = None, + dataset: Optional[List["_models.DiagnosticsDataApiResponse"]] = None, + status: Optional["_models.DiagnosticsStatus"] = None, + data_provider_metadata: Optional["_models.DiagnosticDataProviderMetadata"] = None, + **kwargs: Any + ) -> None: + """ + :keyword metadata: Metadata of the diagnostics response. + :paramtype metadata: ~azure.mgmt.appcontainers.models.DiagnosticsDefinition + :keyword dataset: Set of data collections associated with the response. + :paramtype dataset: list[~azure.mgmt.appcontainers.models.DiagnosticsDataApiResponse] + :keyword status: Status of the diagnostics response. + :paramtype status: ~azure.mgmt.appcontainers.models.DiagnosticsStatus + :keyword data_provider_metadata: List of data providers' metadata. + :paramtype data_provider_metadata: + ~azure.mgmt.appcontainers.models.DiagnosticDataProviderMetadata + """ + super().__init__(**kwargs) + self.metadata = metadata + self.dataset = dataset + self.status = status + self.data_provider_metadata = data_provider_metadata + + +class DiagnosticsStatus(_serialization.Model): + """Rendering details of a diagnostics table. + + :ivar message: Diagnostic message. + :vartype message: str + :ivar status_id: Status. + :vartype status_id: int + """ + + _attribute_map = { + "message": {"key": "message", "type": "str"}, + "status_id": {"key": "statusId", "type": "int"}, + } + + def __init__(self, *, message: Optional[str] = None, status_id: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword message: Diagnostic message. + :paramtype message: str + :keyword status_id: Status. + :paramtype status_id: int + """ + super().__init__(**kwargs) + self.message = message + self.status_id = status_id + + +class DiagnosticSupportTopic(_serialization.Model): + """Support topic information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Unique topic identifier. + :vartype id: str + :ivar pes_id: PES identifier. + :vartype pes_id: str + """ + + _validation = { + "id": {"readonly": True}, + "pes_id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "pes_id": {"key": "pesId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.pes_id = None + + +class DotNetComponent(ProxyResource): + """.NET Component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar component_type: Type of the .NET Component. Known values are: "AspireDashboard" and + "AspireResourceServerApi". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.DotNetComponentType + :ivar provisioning_state: Provisioning state of the .NET Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.DotNetComponentProvisioningState + :ivar configurations: List of .NET Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.DotNetComponentConfigurationProperty] + :ivar service_binds: List of .NET Components that are bound to the .NET component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.DotNetComponentServiceBind] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"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"}, + "component_type": {"key": "properties.componentType", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "configurations": {"key": "properties.configurations", "type": "[DotNetComponentConfigurationProperty]"}, + "service_binds": {"key": "properties.serviceBinds", "type": "[DotNetComponentServiceBind]"}, + } + + def __init__( + self, + *, + component_type: Optional[Union[str, "_models.DotNetComponentType"]] = None, + configurations: Optional[List["_models.DotNetComponentConfigurationProperty"]] = None, + service_binds: Optional[List["_models.DotNetComponentServiceBind"]] = None, **kwargs: Any ) -> None: """ - :keyword metadata: Metadata of the diagnostics response. - :paramtype metadata: ~azure.mgmt.appcontainers.models.DiagnosticsDefinition - :keyword dataset: Set of data collections associated with the response. - :paramtype dataset: list[~azure.mgmt.appcontainers.models.DiagnosticsDataApiResponse] - :keyword status: Status of the diagnostics response. - :paramtype status: ~azure.mgmt.appcontainers.models.DiagnosticsStatus - :keyword data_provider_metadata: List of data providers' metadata. - :paramtype data_provider_metadata: - ~azure.mgmt.appcontainers.models.DiagnosticDataProviderMetadata + :keyword component_type: Type of the .NET Component. Known values are: "AspireDashboard" and + "AspireResourceServerApi". + :paramtype component_type: str or ~azure.mgmt.appcontainers.models.DotNetComponentType + :keyword configurations: List of .NET Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.DotNetComponentConfigurationProperty] + :keyword service_binds: List of .NET Components that are bound to the .NET component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.DotNetComponentServiceBind] """ super().__init__(**kwargs) - self.metadata = metadata - self.dataset = dataset - self.status = status - self.data_provider_metadata = data_provider_metadata + self.component_type = component_type + self.provisioning_state = None + self.configurations = configurations + self.service_binds = service_binds -class DiagnosticsStatus(_serialization.Model): - """Rendering details of a diagnostics table. +class DotNetComponentConfigurationProperty(_serialization.Model): + """Configuration properties for a .NET Component. - :ivar message: Diagnostic message. - :vartype message: str - :ivar status_id: Status. - :vartype status_id: int + :ivar property_name: The name of the property. + :vartype property_name: str + :ivar value: The value of the property. + :vartype value: str """ _attribute_map = { - "message": {"key": "message", "type": "str"}, - "status_id": {"key": "statusId", "type": "int"}, + "property_name": {"key": "propertyName", "type": "str"}, + "value": {"key": "value", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, status_id: Optional[int] = None, **kwargs: Any) -> None: + def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword message: Diagnostic message. - :paramtype message: str - :keyword status_id: Status. - :paramtype status_id: int + :keyword property_name: The name of the property. + :paramtype property_name: str + :keyword value: The value of the property. + :paramtype value: str """ super().__init__(**kwargs) - self.message = message - self.status_id = status_id + self.property_name = property_name + self.value = value -class DiagnosticSupportTopic(_serialization.Model): - """Support topic information. +class DotNetComponentsCollection(_serialization.Model): + """.NET Components ARM resource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Unique topic identifier. - :vartype id: str - :ivar pes_id: PES identifier. - :vartype pes_id: str + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.DotNetComponent] + :ivar next_link: Link to next page of resources. + :vartype next_link: str """ _validation = { - "id": {"readonly": True}, - "pes_id": {"readonly": True}, + "value": {"required": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "pes_id": {"key": "pesId", "type": "str"}, + "value": {"key": "value", "type": "[DotNetComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, value: List["_models.DotNetComponent"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.DotNetComponent] + """ super().__init__(**kwargs) - self.id = None - self.pes_id = None + self.value = value + self.next_link = None + + +class DotNetComponentServiceBind(_serialization.Model): + """Configuration to bind a .NET Component to another .NET Component. + + :ivar name: Name of the service bind. + :vartype name: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, service_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the service bind. + :paramtype name: str + :keyword service_id: Resource id of the target service. + :paramtype service_id: str + """ + super().__init__(**kwargs) + self.name = name + self.service_id = service_id + + +class EncryptionSettings(_serialization.Model): + """The configuration settings of the secrets references of encryption key and signing key for + ContainerApp Service Authentication/Authorization. + + :ivar container_app_auth_encryption_secret_name: The secret name which is referenced for + EncryptionKey. + :vartype container_app_auth_encryption_secret_name: str + :ivar container_app_auth_signing_secret_name: The secret name which is referenced for + SigningKey. + :vartype container_app_auth_signing_secret_name: str + """ + + _attribute_map = { + "container_app_auth_encryption_secret_name": {"key": "containerAppAuthEncryptionSecretName", "type": "str"}, + "container_app_auth_signing_secret_name": {"key": "containerAppAuthSigningSecretName", "type": "str"}, + } + + def __init__( + self, + *, + container_app_auth_encryption_secret_name: Optional[str] = None, + container_app_auth_signing_secret_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword container_app_auth_encryption_secret_name: The secret name which is referenced for + EncryptionKey. + :paramtype container_app_auth_encryption_secret_name: str + :keyword container_app_auth_signing_secret_name: The secret name which is referenced for + SigningKey. + :paramtype container_app_auth_signing_secret_name: str + """ + super().__init__(**kwargs) + self.container_app_auth_encryption_secret_name = container_app_auth_encryption_secret_name + self.container_app_auth_signing_secret_name = container_app_auth_signing_secret_name class EnvironmentAuthToken(TrackedResource): @@ -3993,10 +5554,10 @@ class EnvironmentAuthToken(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4090,6 +5651,39 @@ def __init__( self.secret_ref = secret_ref +class EnvironmentVariable(_serialization.Model): + """Model representing an environment variable. + + All required parameters must be populated in order to send to server. + + :ivar name: Environment variable name. Required. + :vartype name: str + :ivar value: Environment variable value. Required. + :vartype value: str + """ + + _validation = { + "name": {"required": True}, + "value": {"required": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: + """ + :keyword name: Environment variable name. Required. + :paramtype name: str + :keyword value: Environment variable value. Required. + :paramtype value: str + """ + super().__init__(**kwargs) + self.name = name + self.value = value + + class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. @@ -4368,6 +5962,9 @@ class GithubActionConfiguration(_serialization.Model): :vartype runtime_stack: str :ivar runtime_version: Runtime version. :vartype runtime_version: str + :ivar build_environment_variables: List of environment variables to be passed to the build. + :vartype build_environment_variables: + list[~azure.mgmt.appcontainers.models.EnvironmentVariable] """ _attribute_map = { @@ -4380,6 +5977,7 @@ class GithubActionConfiguration(_serialization.Model): "os": {"key": "os", "type": "str"}, "runtime_stack": {"key": "runtimeStack", "type": "str"}, "runtime_version": {"key": "runtimeVersion", "type": "str"}, + "build_environment_variables": {"key": "buildEnvironmentVariables", "type": "[EnvironmentVariable]"}, } def __init__( @@ -4394,6 +5992,7 @@ def __init__( os: Optional[str] = None, runtime_stack: Optional[str] = None, runtime_version: Optional[str] = None, + build_environment_variables: Optional[List["_models.EnvironmentVariable"]] = None, **kwargs: Any ) -> None: """ @@ -4415,6 +6014,9 @@ def __init__( :paramtype runtime_stack: str :keyword runtime_version: Runtime version. :paramtype runtime_version: str + :keyword build_environment_variables: List of environment variables to be passed to the build. + :paramtype build_environment_variables: + list[~azure.mgmt.appcontainers.models.EnvironmentVariable] """ super().__init__(**kwargs) self.registry_info = registry_info @@ -4426,6 +6028,7 @@ def __init__( self.os = os self.runtime_stack = runtime_stack self.runtime_version = runtime_version + self.build_environment_variables = build_environment_variables class GlobalValidation(_serialization.Model): @@ -4479,60 +6082,272 @@ def __init__( :paramtype excluded_paths: list[str] """ super().__init__(**kwargs) - self.unauthenticated_client_action = unauthenticated_client_action - self.redirect_to_provider = redirect_to_provider - self.excluded_paths = excluded_paths + self.unauthenticated_client_action = unauthenticated_client_action + self.redirect_to_provider = redirect_to_provider + self.excluded_paths = excluded_paths + + +class Google(_serialization.Model): + """The configuration settings of the Google provider. + + :ivar enabled: :code:`false` if the Google provider should not be enabled despite + the set registration; otherwise, :code:`true`. + :vartype enabled: bool + :ivar registration: The configuration settings of the app registration for the Google provider. + :vartype registration: ~azure.mgmt.appcontainers.models.ClientRegistration + :ivar login: The configuration settings of the login flow. + :vartype login: ~azure.mgmt.appcontainers.models.LoginScopes + :ivar validation: The configuration settings of the Azure Active Directory token validation + flow. + :vartype validation: ~azure.mgmt.appcontainers.models.AllowedAudiencesValidation + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "registration": {"key": "registration", "type": "ClientRegistration"}, + "login": {"key": "login", "type": "LoginScopes"}, + "validation": {"key": "validation", "type": "AllowedAudiencesValidation"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + registration: Optional["_models.ClientRegistration"] = None, + login: Optional["_models.LoginScopes"] = None, + validation: Optional["_models.AllowedAudiencesValidation"] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: :code:`false` if the Google provider should not be enabled + despite the set registration; otherwise, :code:`true`. + :paramtype enabled: bool + :keyword registration: The configuration settings of the app registration for the Google + provider. + :paramtype registration: ~azure.mgmt.appcontainers.models.ClientRegistration + :keyword login: The configuration settings of the login flow. + :paramtype login: ~azure.mgmt.appcontainers.models.LoginScopes + :keyword validation: The configuration settings of the Azure Active Directory token validation + flow. + :paramtype validation: ~azure.mgmt.appcontainers.models.AllowedAudiencesValidation + """ + super().__init__(**kwargs) + self.enabled = enabled + self.registration = registration + self.login = login + self.validation = validation + + +class Header(_serialization.Model): + """Header of otlp configuration. + + :ivar key: The key of otlp configuration header. + :vartype key: str + :ivar value: The value of otlp configuration header. + :vartype value: str + """ + + _attribute_map = { + "key": {"key": "key", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, key: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key: The key of otlp configuration header. + :paramtype key: str + :keyword value: The value of otlp configuration header. + :paramtype value: str + """ + super().__init__(**kwargs) + self.key = key + self.value = value + + +class HeaderMatch(_serialization.Model): + """Conditions required to match a header. + + :ivar header: Name of the header. + :vartype header: str + :ivar exact_match: Exact value of the header. + :vartype exact_match: str + :ivar prefix_match: Prefix value of the header. + :vartype prefix_match: str + :ivar suffix_match: Suffix value of the header. + :vartype suffix_match: str + :ivar regex_match: Regex value of the header. + :vartype regex_match: str + """ + + _attribute_map = { + "header": {"key": "header", "type": "str"}, + "exact_match": {"key": "match.exactMatch", "type": "str"}, + "prefix_match": {"key": "match.prefixMatch", "type": "str"}, + "suffix_match": {"key": "match.suffixMatch", "type": "str"}, + "regex_match": {"key": "match.regexMatch", "type": "str"}, + } + + def __init__( + self, + *, + header: Optional[str] = None, + exact_match: Optional[str] = None, + prefix_match: Optional[str] = None, + suffix_match: Optional[str] = None, + regex_match: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword header: Name of the header. + :paramtype header: str + :keyword exact_match: Exact value of the header. + :paramtype exact_match: str + :keyword prefix_match: Prefix value of the header. + :paramtype prefix_match: str + :keyword suffix_match: Suffix value of the header. + :paramtype suffix_match: str + :keyword regex_match: Regex value of the header. + :paramtype regex_match: str + """ + super().__init__(**kwargs) + self.header = header + self.exact_match = exact_match + self.prefix_match = prefix_match + self.suffix_match = suffix_match + self.regex_match = regex_match + + +class HttpConnectionPool(_serialization.Model): + """Defines parameters for http connection pooling. + + :ivar http1_max_pending_requests: Maximum number of pending http1 requests allowed. + :vartype http1_max_pending_requests: int + :ivar http2_max_requests: Maximum number of http2 requests allowed. + :vartype http2_max_requests: int + """ + + _attribute_map = { + "http1_max_pending_requests": {"key": "http1MaxPendingRequests", "type": "int"}, + "http2_max_requests": {"key": "http2MaxRequests", "type": "int"}, + } + + def __init__( + self, + *, + http1_max_pending_requests: Optional[int] = None, + http2_max_requests: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword http1_max_pending_requests: Maximum number of pending http1 requests allowed. + :paramtype http1_max_pending_requests: int + :keyword http2_max_requests: Maximum number of http2 requests allowed. + :paramtype http2_max_requests: int + """ + super().__init__(**kwargs) + self.http1_max_pending_requests = http1_max_pending_requests + self.http2_max_requests = http2_max_requests + + +class HttpGet(_serialization.Model): + """Model representing a http get request. + + All required parameters must be populated in order to send to server. + + :ivar url: URL to make HTTP GET request against. Required. + :vartype url: str + :ivar file_name: Name of the file that the request should be saved to. + :vartype file_name: str + :ivar headers: List of headers to send with the request. + :vartype headers: list[str] + """ + + _validation = { + "url": {"required": True}, + } + + _attribute_map = { + "url": {"key": "url", "type": "str"}, + "file_name": {"key": "fileName", "type": "str"}, + "headers": {"key": "headers", "type": "[str]"}, + } + + def __init__( + self, *, url: str, file_name: Optional[str] = None, headers: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :keyword url: URL to make HTTP GET request against. Required. + :paramtype url: str + :keyword file_name: Name of the file that the request should be saved to. + :paramtype file_name: str + :keyword headers: List of headers to send with the request. + :paramtype headers: list[str] + """ + super().__init__(**kwargs) + self.url = url + self.file_name = file_name + self.headers = headers -class Google(_serialization.Model): - """The configuration settings of the Google provider. +class HttpRetryPolicy(_serialization.Model): + """Policy that defines http request retry conditions. - :ivar enabled: :code:`false` if the Google provider should not be enabled despite - the set registration; otherwise, :code:`true`. - :vartype enabled: bool - :ivar registration: The configuration settings of the app registration for the Google provider. - :vartype registration: ~azure.mgmt.appcontainers.models.ClientRegistration - :ivar login: The configuration settings of the login flow. - :vartype login: ~azure.mgmt.appcontainers.models.LoginScopes - :ivar validation: The configuration settings of the Azure Active Directory token validation - flow. - :vartype validation: ~azure.mgmt.appcontainers.models.AllowedAudiencesValidation + :ivar max_retries: Maximum number of times a request will retry. + :vartype max_retries: int + :ivar headers: Headers that must be present for a request to be retried. + :vartype headers: list[~azure.mgmt.appcontainers.models.HeaderMatch] + :ivar http_status_codes: Additional http status codes that can trigger a retry. + :vartype http_status_codes: list[int] + :ivar errors: Errors that can trigger a retry. + :vartype errors: list[str] + :ivar initial_delay_in_milliseconds: Initial delay, in milliseconds, before retrying a request. + :vartype initial_delay_in_milliseconds: int + :ivar max_interval_in_milliseconds: Maximum interval, in milliseconds, between retries. + :vartype max_interval_in_milliseconds: int """ _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - "registration": {"key": "registration", "type": "ClientRegistration"}, - "login": {"key": "login", "type": "LoginScopes"}, - "validation": {"key": "validation", "type": "AllowedAudiencesValidation"}, + "max_retries": {"key": "maxRetries", "type": "int"}, + "headers": {"key": "matches.headers", "type": "[HeaderMatch]"}, + "http_status_codes": {"key": "matches.httpStatusCodes", "type": "[int]"}, + "errors": {"key": "matches.errors", "type": "[str]"}, + "initial_delay_in_milliseconds": {"key": "retryBackOff.initialDelayInMilliseconds", "type": "int"}, + "max_interval_in_milliseconds": {"key": "retryBackOff.maxIntervalInMilliseconds", "type": "int"}, } def __init__( self, *, - enabled: Optional[bool] = None, - registration: Optional["_models.ClientRegistration"] = None, - login: Optional["_models.LoginScopes"] = None, - validation: Optional["_models.AllowedAudiencesValidation"] = None, + max_retries: Optional[int] = None, + headers: Optional[List["_models.HeaderMatch"]] = None, + http_status_codes: Optional[List[int]] = None, + errors: Optional[List[str]] = None, + initial_delay_in_milliseconds: Optional[int] = None, + max_interval_in_milliseconds: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword enabled: :code:`false` if the Google provider should not be enabled - despite the set registration; otherwise, :code:`true`. - :paramtype enabled: bool - :keyword registration: The configuration settings of the app registration for the Google - provider. - :paramtype registration: ~azure.mgmt.appcontainers.models.ClientRegistration - :keyword login: The configuration settings of the login flow. - :paramtype login: ~azure.mgmt.appcontainers.models.LoginScopes - :keyword validation: The configuration settings of the Azure Active Directory token validation - flow. - :paramtype validation: ~azure.mgmt.appcontainers.models.AllowedAudiencesValidation - """ - super().__init__(**kwargs) - self.enabled = enabled - self.registration = registration - self.login = login - self.validation = validation + :keyword max_retries: Maximum number of times a request will retry. + :paramtype max_retries: int + :keyword headers: Headers that must be present for a request to be retried. + :paramtype headers: list[~azure.mgmt.appcontainers.models.HeaderMatch] + :keyword http_status_codes: Additional http status codes that can trigger a retry. + :paramtype http_status_codes: list[int] + :keyword errors: Errors that can trigger a retry. + :paramtype errors: list[str] + :keyword initial_delay_in_milliseconds: Initial delay, in milliseconds, before retrying a + request. + :paramtype initial_delay_in_milliseconds: int + :keyword max_interval_in_milliseconds: Maximum interval, in milliseconds, between retries. + :paramtype max_interval_in_milliseconds: int + """ + super().__init__(**kwargs) + self.max_retries = max_retries + self.headers = headers + self.http_status_codes = http_status_codes + self.errors = errors + self.initial_delay_in_milliseconds = initial_delay_in_milliseconds + self.max_interval_in_milliseconds = max_interval_in_milliseconds class HttpScaleRule(_serialization.Model): @@ -4753,6 +6568,12 @@ class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attrib ~azure.mgmt.appcontainers.models.IngressClientCertificateMode :ivar cors_policy: CORS policy for container app. :vartype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy + :ivar additional_port_mappings: Settings to expose additional ports on container app. + :vartype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] + :ivar target_port_http_scheme: Whether an http app listens on http or https. Known values are: + "http" and "https". + :vartype target_port_http_scheme: str or + ~azure.mgmt.appcontainers.models.IngressTargetPortHttpScheme """ _validation = { @@ -4772,6 +6593,8 @@ class Ingress(_serialization.Model): # pylint: disable=too-many-instance-attrib "sticky_sessions": {"key": "stickySessions", "type": "IngressStickySessions"}, "client_certificate_mode": {"key": "clientCertificateMode", "type": "str"}, "cors_policy": {"key": "corsPolicy", "type": "CorsPolicy"}, + "additional_port_mappings": {"key": "additionalPortMappings", "type": "[IngressPortMapping]"}, + "target_port_http_scheme": {"key": "targetPortHttpScheme", "type": "str"}, } def __init__( @@ -4788,6 +6611,8 @@ def __init__( sticky_sessions: Optional["_models.IngressStickySessions"] = None, client_certificate_mode: Optional[Union[str, "_models.IngressClientCertificateMode"]] = None, cors_policy: Optional["_models.CorsPolicy"] = None, + additional_port_mappings: Optional[List["_models.IngressPortMapping"]] = None, + target_port_http_scheme: Optional[Union[str, "_models.IngressTargetPortHttpScheme"]] = None, **kwargs: Any ) -> None: """ @@ -4820,6 +6645,12 @@ def __init__( ~azure.mgmt.appcontainers.models.IngressClientCertificateMode :keyword cors_policy: CORS policy for container app. :paramtype cors_policy: ~azure.mgmt.appcontainers.models.CorsPolicy + :keyword additional_port_mappings: Settings to expose additional ports on container app. + :paramtype additional_port_mappings: list[~azure.mgmt.appcontainers.models.IngressPortMapping] + :keyword target_port_http_scheme: Whether an http app listens on http or https. Known values + are: "http" and "https". + :paramtype target_port_http_scheme: str or + ~azure.mgmt.appcontainers.models.IngressTargetPortHttpScheme """ super().__init__(**kwargs) self.fqdn = None @@ -4834,6 +6665,51 @@ def __init__( self.sticky_sessions = sticky_sessions self.client_certificate_mode = client_certificate_mode self.cors_policy = cors_policy + self.additional_port_mappings = additional_port_mappings + self.target_port_http_scheme = target_port_http_scheme + + +class IngressPortMapping(_serialization.Model): + """Port mappings of container app ingress. + + All required parameters must be populated in order to send to server. + + :ivar external: Specifies whether the app port is accessible outside of the environment. + Required. + :vartype external: bool + :ivar target_port: Specifies the port user's container listens on. Required. + :vartype target_port: int + :ivar exposed_port: Specifies the exposed port for the target port. If not specified, it + defaults to target port. + :vartype exposed_port: int + """ + + _validation = { + "external": {"required": True}, + "target_port": {"required": True}, + } + + _attribute_map = { + "external": {"key": "external", "type": "bool"}, + "target_port": {"key": "targetPort", "type": "int"}, + "exposed_port": {"key": "exposedPort", "type": "int"}, + } + + def __init__(self, *, external: bool, target_port: int, exposed_port: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword external: Specifies whether the app port is accessible outside of the environment. + Required. + :paramtype external: bool + :keyword target_port: Specifies the port user's container listens on. Required. + :paramtype target_port: int + :keyword exposed_port: Specifies the exposed port for the target port. If not specified, it + defaults to target port. + :paramtype exposed_port: int + """ + super().__init__(**kwargs) + self.external = external + self.target_port = target_port + self.exposed_port = exposed_port class IngressStickySessions(_serialization.Model): @@ -4875,60 +6751,11 @@ class InitContainer(BaseContainer): :vartype volume_mounts: list[~azure.mgmt.appcontainers.models.VolumeMount] """ - _attribute_map = { - "image": {"key": "image", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "command": {"key": "command", "type": "[str]"}, - "args": {"key": "args", "type": "[str]"}, - "env": {"key": "env", "type": "[EnvironmentVar]"}, - "resources": {"key": "resources", "type": "ContainerResources"}, - "volume_mounts": {"key": "volumeMounts", "type": "[VolumeMount]"}, - } - - def __init__( - self, - *, - image: Optional[str] = None, - name: Optional[str] = None, - command: Optional[List[str]] = None, - args: Optional[List[str]] = None, - env: Optional[List["_models.EnvironmentVar"]] = None, - resources: Optional["_models.ContainerResources"] = None, - volume_mounts: Optional[List["_models.VolumeMount"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword image: Container image tag. - :paramtype image: str - :keyword name: Custom container name. - :paramtype name: str - :keyword command: Container start command. - :paramtype command: list[str] - :keyword args: Container start command arguments. - :paramtype args: list[str] - :keyword env: Container environment variables. - :paramtype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] - :keyword resources: Container resource requirements. - :paramtype resources: ~azure.mgmt.appcontainers.models.ContainerResources - :keyword volume_mounts: Container volume mounts. - :paramtype volume_mounts: list[~azure.mgmt.appcontainers.models.VolumeMount] - """ - super().__init__( - image=image, - name=name, - command=command, - args=args, - env=env, - resources=resources, - volume_mounts=volume_mounts, - **kwargs - ) - class IpSecurityRestrictionRule(_serialization.Model): """Rule to restrict incoming IP address. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: Name for the IP restriction rule. Required. :vartype name: str @@ -4983,15 +6810,174 @@ def __init__( self.action = action +class JavaComponent(ProxyResource): + """Java Component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar component_type: Type of the Java Component. Known values are: "SpringBootAdmin", + "SpringCloudEureka", and "SpringCloudConfig". + :vartype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :ivar provisioning_state: Provisioning state of the Java Component. Known values are: + "Succeeded", "Failed", "Canceled", "Deleting", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.JavaComponentProvisioningState + :ivar configurations: List of Java Components configuration properties. + :vartype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :ivar service_binds: List of Java Components that are bound to the Java component. + :vartype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"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"}, + "component_type": {"key": "properties.componentType", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "configurations": {"key": "properties.configurations", "type": "[JavaComponentConfigurationProperty]"}, + "service_binds": {"key": "properties.serviceBinds", "type": "[JavaComponentServiceBind]"}, + } + + def __init__( + self, + *, + component_type: Optional[Union[str, "_models.JavaComponentType"]] = None, + configurations: Optional[List["_models.JavaComponentConfigurationProperty"]] = None, + service_binds: Optional[List["_models.JavaComponentServiceBind"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword component_type: Type of the Java Component. Known values are: "SpringBootAdmin", + "SpringCloudEureka", and "SpringCloudConfig". + :paramtype component_type: str or ~azure.mgmt.appcontainers.models.JavaComponentType + :keyword configurations: List of Java Components configuration properties. + :paramtype configurations: + list[~azure.mgmt.appcontainers.models.JavaComponentConfigurationProperty] + :keyword service_binds: List of Java Components that are bound to the Java component. + :paramtype service_binds: list[~azure.mgmt.appcontainers.models.JavaComponentServiceBind] + """ + super().__init__(**kwargs) + self.component_type = component_type + self.provisioning_state = None + self.configurations = configurations + self.service_binds = service_binds + + +class JavaComponentConfigurationProperty(_serialization.Model): + """Configuration properties for a Java Component. + + :ivar property_name: The name of the property. + :vartype property_name: str + :ivar value: The value of the property. + :vartype value: str + """ + + _attribute_map = { + "property_name": {"key": "propertyName", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, property_name: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword property_name: The name of the property. + :paramtype property_name: str + :keyword value: The value of the property. + :paramtype value: str + """ + super().__init__(**kwargs) + self.property_name = property_name + self.value = value + + +class JavaComponentsCollection(_serialization.Model): + """Java Components ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar value: Collection of resources. Required. + :vartype value: list[~azure.mgmt.appcontainers.models.JavaComponent] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[JavaComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.JavaComponent"], **kwargs: Any) -> None: + """ + :keyword value: Collection of resources. Required. + :paramtype value: list[~azure.mgmt.appcontainers.models.JavaComponent] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class JavaComponentServiceBind(_serialization.Model): + """Configuration to bind a Java Component to another Java Component. + + :ivar name: Name of the service bind. + :vartype name: str + :ivar service_id: Resource id of the target service. + :vartype service_id: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, service_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the service bind. + :paramtype name: str + :keyword service_id: Resource id of the target service. + :paramtype service_id: str + """ + super().__init__(**kwargs) + self.name = name + self.service_id = service_id + + class Job(TrackedResource): # pylint: disable=too-many-instance-attributes """Container App Job. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5005,6 +6991,8 @@ class Job(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str + :ivar extended_location: The complex type of the extended location. + :vartype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation :ivar identity: Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity @@ -5043,6 +7031,7 @@ class Job(TrackedResource): # pylint: disable=too-many-instance-attributes "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "environment_id": {"key": "properties.environmentId", "type": "str"}, @@ -5058,6 +7047,7 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, environment_id: Optional[str] = None, workload_profile_name: Optional[str] = None, @@ -5070,6 +7060,8 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str + :keyword extended_location: The complex type of the extended location. + :paramtype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation :keyword identity: Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity @@ -5083,6 +7075,7 @@ def __init__( :paramtype template: ~azure.mgmt.appcontainers.models.JobTemplate """ super().__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location self.identity = identity self.provisioning_state = None self.environment_id = environment_id @@ -5096,7 +7089,7 @@ def __init__( class JobConfiguration(_serialization.Model): """Non versioned Container Apps Job configuration properties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar secrets: Collection of secrets used by a Container Apps Job. :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] @@ -5264,7 +7257,7 @@ class JobConfigurationScheduleTriggerConfig(_serialization.Model): """Cron formatted repeating trigger schedule ("\ * * * * *") for cronjobs. Properties completions and parallelism would be set to 1 by default. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar replica_completion_count: Minimum number of successful replica completions before overall job completion. @@ -5319,7 +7312,7 @@ class JobExecution(_serialization.Model): :vartype name: str :ivar id: Job execution Id. :vartype id: str - :ivar type: Job Type. + :ivar type: Job execution type. :vartype type: str :ivar status: Current running State of the job. Known values are: "Running", "Processing", "Stopped", "Degraded", "Failed", "Unknown", and "Succeeded". @@ -5340,10 +7333,10 @@ class JobExecution(_serialization.Model): "name": {"key": "name", "type": "str"}, "id": {"key": "id", "type": "str"}, "type": {"key": "type", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "template": {"key": "template", "type": "JobExecutionTemplate"}, + "status": {"key": "properties.status", "type": "str"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "end_time": {"key": "properties.endTime", "type": "iso-8601"}, + "template": {"key": "properties.template", "type": "JobExecutionTemplate"}, } def __init__( @@ -5362,7 +7355,7 @@ def __init__( :paramtype name: str :keyword id: Job execution Id. :paramtype id: str - :keyword type: Job Type. + :keyword type: Job execution type. :paramtype type: str :keyword start_time: Job execution start time. :paramtype start_time: ~datetime.datetime @@ -5476,7 +7469,7 @@ def __init__( class JobExecutionNamesCollection(_serialization.Model): """Container App executions names list. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.JobExecutionBase] @@ -5534,6 +7527,8 @@ def __init__( class JobPatchProperties(_serialization.Model): """Container Apps Job resource specific properties. + :ivar extended_location: The complex type of the extended location. + :vartype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation :ivar identity: Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity @@ -5544,6 +7539,7 @@ class JobPatchProperties(_serialization.Model): """ _attribute_map = { + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "tags": {"key": "tags", "type": "{str}"}, "properties": {"key": "properties", "type": "JobPatchPropertiesProperties"}, @@ -5552,12 +7548,15 @@ class JobPatchProperties(_serialization.Model): def __init__( self, *, + extended_location: Optional["_models.ExtendedLocation"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, tags: Optional[Dict[str, str]] = None, properties: Optional["_models.JobPatchPropertiesProperties"] = None, **kwargs: Any ) -> None: """ + :keyword extended_location: The complex type of the extended location. + :paramtype extended_location: ~azure.mgmt.appcontainers.models.ExtendedLocation :keyword identity: Managed identities needed by a container app job to interact with other Azure services to not maintain any secrets or credentials in code. :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity @@ -5567,6 +7566,7 @@ def __init__( :paramtype properties: ~azure.mgmt.appcontainers.models.JobPatchPropertiesProperties """ super().__init__(**kwargs) + self.extended_location = extended_location self.identity = identity self.tags = tags self.properties = properties @@ -5728,7 +7728,7 @@ class JobsCollection(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.Job] @@ -5759,7 +7759,7 @@ def __init__(self, *, value: List["_models.Job"], **kwargs: Any) -> None: class JobSecretsCollection(_serialization.Model): """Container Apps Job Secrets Collection ARM resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.Secret] @@ -5871,10 +7871,40 @@ class KedaConfiguration(_serialization.Model): "version": {"key": "version", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.version = None + + +class ListUsagesResult(_serialization.Model): + """ListUsagesResult. + + :ivar value: The list of compute resource usages. + :vartype value: list[~azure.mgmt.appcontainers.models.Usage] + :ivar next_link: The URI to fetch the next page of compute resource usage information. Call + ListNext() with this to fetch the next page of compute resource usage information. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Usage]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Usage"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: The list of compute resource usages. + :paramtype value: list[~azure.mgmt.appcontainers.models.Usage] + :keyword next_link: The URI to fetch the next page of compute resource usage information. Call + ListNext() with this to fetch the next page of compute resource usage information. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.version = None + self.value = value + self.next_link = next_link class LogAnalyticsConfiguration(_serialization.Model): @@ -5885,23 +7915,38 @@ class LogAnalyticsConfiguration(_serialization.Model): :vartype customer_id: str :ivar shared_key: Log analytics customer key. :vartype shared_key: str + :ivar dynamic_json_columns: Boolean indicating whether to parse json string log into dynamic + json columns. + :vartype dynamic_json_columns: bool """ _attribute_map = { "customer_id": {"key": "customerId", "type": "str"}, "shared_key": {"key": "sharedKey", "type": "str"}, + "dynamic_json_columns": {"key": "dynamicJsonColumns", "type": "bool"}, } - def __init__(self, *, customer_id: Optional[str] = None, shared_key: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + customer_id: Optional[str] = None, + shared_key: Optional[str] = None, + dynamic_json_columns: Optional[bool] = None, + **kwargs: Any + ) -> None: """ :keyword customer_id: Log analytics customer id. :paramtype customer_id: str :keyword shared_key: Log analytics customer key. :paramtype shared_key: str + :keyword dynamic_json_columns: Boolean indicating whether to parse json string log into dynamic + json columns. + :paramtype dynamic_json_columns: bool """ super().__init__(**kwargs) self.customer_id = customer_id self.shared_key = shared_key + self.dynamic_json_columns = dynamic_json_columns class Login(_serialization.Model): @@ -5910,6 +7955,8 @@ class Login(_serialization.Model): :ivar routes: The routes that specify the endpoints used for login and logout requests. :vartype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :ivar token_store: The configuration settings of the token store. + :vartype token_store: ~azure.mgmt.appcontainers.models.TokenStore :ivar preserve_url_fragments_for_logins: :code:`true` if the fragments from the request are preserved after the login request is made; otherwise, :code:`false`. :vartype preserve_url_fragments_for_logins: bool @@ -5926,6 +7973,7 @@ class Login(_serialization.Model): _attribute_map = { "routes": {"key": "routes", "type": "LoginRoutes"}, + "token_store": {"key": "tokenStore", "type": "TokenStore"}, "preserve_url_fragments_for_logins": {"key": "preserveUrlFragmentsForLogins", "type": "bool"}, "allowed_external_redirect_urls": {"key": "allowedExternalRedirectUrls", "type": "[str]"}, "cookie_expiration": {"key": "cookieExpiration", "type": "CookieExpiration"}, @@ -5936,6 +7984,7 @@ def __init__( self, *, routes: Optional["_models.LoginRoutes"] = None, + token_store: Optional["_models.TokenStore"] = None, preserve_url_fragments_for_logins: Optional[bool] = None, allowed_external_redirect_urls: Optional[List[str]] = None, cookie_expiration: Optional["_models.CookieExpiration"] = None, @@ -5945,6 +7994,8 @@ def __init__( """ :keyword routes: The routes that specify the endpoints used for login and logout requests. :paramtype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :keyword token_store: The configuration settings of the token store. + :paramtype token_store: ~azure.mgmt.appcontainers.models.TokenStore :keyword preserve_url_fragments_for_logins: :code:`true` if the fragments from the request are preserved after the login request is made; otherwise, :code:`false`. :paramtype preserve_url_fragments_for_logins: bool @@ -5960,6 +8011,7 @@ def __init__( """ super().__init__(**kwargs) self.routes = routes + self.token_store = token_store self.preserve_url_fragments_for_logins = preserve_url_fragments_for_logins self.allowed_external_redirect_urls = allowed_external_redirect_urls self.cookie_expiration = cookie_expiration @@ -6006,16 +8058,36 @@ def __init__(self, *, scopes: Optional[List[str]] = None, **kwargs: Any) -> None self.scopes = scopes +class LogsConfiguration(_serialization.Model): + """Configuration of Open Telemetry logs. + + :ivar destinations: Open telemetry logs destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__(self, *, destinations: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword destinations: Open telemetry logs destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.destinations = destinations + + class ManagedCertificate(TrackedResource): """Managed certificates used for Custom Domain bindings of Container Apps in a Managed Environment. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -6076,7 +8148,7 @@ class ManagedCertificateCollection(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.ManagedCertificate] @@ -6188,10 +8260,10 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -6207,6 +8279,9 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- :vartype location: str :ivar kind: Kind of the Environment. :vartype kind: str + :ivar identity: Managed identities for the Managed Environment to interact with other Azure + services without maintaining any secrets or credentials in code. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity :ivar provisioning_state: Provisioning state of the Environment. Known values are: "Succeeded", "Failed", "Canceled", "Waiting", "InitializationInProgress", "InfrastructureSetupInProgress", "InfrastructureSetupComplete", "ScheduledForDelete", "UpgradeRequested", and "UpgradeFailed". @@ -6230,6 +8305,11 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- app logs to a destination. Currently only "log-analytics" is supported. :vartype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration + :ivar app_insights_configuration: Environment level Application Insights configuration. + :vartype app_insights_configuration: ~azure.mgmt.appcontainers.models.AppInsightsConfiguration + :ivar open_telemetry_configuration: Environment Open Telemetry configuration. + :vartype open_telemetry_configuration: + ~azure.mgmt.appcontainers.models.OpenTelemetryConfiguration :ivar zone_redundant: Whether or not this Managed Environment is zone-redundant. :vartype zone_redundant: bool :ivar custom_domain_configuration: Custom domain configuration for the environment. @@ -6273,6 +8353,7 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, "kind": {"key": "kind", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "dapr_ai_instrumentation_key": {"key": "properties.daprAIInstrumentationKey", "type": "str"}, "dapr_ai_connection_string": {"key": "properties.daprAIConnectionString", "type": "str"}, @@ -6281,6 +8362,14 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- "default_domain": {"key": "properties.defaultDomain", "type": "str"}, "static_ip": {"key": "properties.staticIp", "type": "str"}, "app_logs_configuration": {"key": "properties.appLogsConfiguration", "type": "AppLogsConfiguration"}, + "app_insights_configuration": { + "key": "properties.appInsightsConfiguration", + "type": "AppInsightsConfiguration", + }, + "open_telemetry_configuration": { + "key": "properties.openTelemetryConfiguration", + "type": "OpenTelemetryConfiguration", + }, "zone_redundant": {"key": "properties.zoneRedundant", "type": "bool"}, "custom_domain_configuration": { "key": "properties.customDomainConfiguration", @@ -6297,16 +8386,19 @@ class ManagedEnvironment(TrackedResource): # pylint: disable=too-many-instance- }, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, location: str, tags: Optional[Dict[str, str]] = None, kind: Optional[str] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, dapr_ai_instrumentation_key: Optional[str] = None, dapr_ai_connection_string: Optional[str] = None, vnet_configuration: Optional["_models.VnetConfiguration"] = None, app_logs_configuration: Optional["_models.AppLogsConfiguration"] = None, + app_insights_configuration: Optional["_models.AppInsightsConfiguration"] = None, + open_telemetry_configuration: Optional["_models.OpenTelemetryConfiguration"] = None, zone_redundant: Optional[bool] = None, custom_domain_configuration: Optional["_models.CustomDomainConfiguration"] = None, workload_profiles: Optional[List["_models.WorkloadProfile"]] = None, @@ -6323,6 +8415,9 @@ def __init__( :paramtype location: str :keyword kind: Kind of the Environment. :paramtype kind: str + :keyword identity: Managed identities for the Managed Environment to interact with other Azure + services without maintaining any secrets or credentials in code. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity :keyword dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export Service to Service communication telemetry. :paramtype dapr_ai_instrumentation_key: str @@ -6335,6 +8430,12 @@ def __init__( app logs to a destination. Currently only "log-analytics" is supported. :paramtype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration + :keyword app_insights_configuration: Environment level Application Insights configuration. + :paramtype app_insights_configuration: + ~azure.mgmt.appcontainers.models.AppInsightsConfiguration + :keyword open_telemetry_configuration: Environment Open Telemetry configuration. + :paramtype open_telemetry_configuration: + ~azure.mgmt.appcontainers.models.OpenTelemetryConfiguration :keyword zone_redundant: Whether or not this Managed Environment is zone-redundant. :paramtype zone_redundant: bool :keyword custom_domain_configuration: Custom domain configuration for the environment. @@ -6356,6 +8457,7 @@ def __init__( """ super().__init__(tags=tags, location=location, **kwargs) self.kind = kind + self.identity = identity self.provisioning_state = None self.dapr_ai_instrumentation_key = dapr_ai_instrumentation_key self.dapr_ai_connection_string = dapr_ai_connection_string @@ -6364,6 +8466,8 @@ def __init__( self.default_domain = None self.static_ip = None self.app_logs_configuration = app_logs_configuration + self.app_insights_configuration = app_insights_configuration + self.open_telemetry_configuration = open_telemetry_configuration self.zone_redundant = zone_redundant self.custom_domain_configuration = custom_domain_configuration self.event_stream_endpoint = None @@ -6374,7 +8478,7 @@ def __init__( self.peer_authentication = peer_authentication -class ManagedEnvironmentPropertiesPeerAuthentication(_serialization.Model): +class ManagedEnvironmentPropertiesPeerAuthentication(_serialization.Model): # pylint: disable=name-too-long """Peer authentication settings for the Managed Environment. :ivar mtls: Mutual TLS authentication settings for the Managed Environment. @@ -6399,7 +8503,7 @@ class ManagedEnvironmentsCollection(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -6433,7 +8537,7 @@ class ManagedEnvironmentStorage(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -6478,25 +8582,37 @@ class ManagedEnvironmentStorageProperties(_serialization.Model): :ivar azure_file: Azure file properties. :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :ivar nfs_azure_file: NFS Azure file properties. + :vartype nfs_azure_file: ~azure.mgmt.appcontainers.models.NfsAzureFileProperties """ _attribute_map = { "azure_file": {"key": "azureFile", "type": "AzureFileProperties"}, + "nfs_azure_file": {"key": "nfsAzureFile", "type": "NfsAzureFileProperties"}, } - def __init__(self, *, azure_file: Optional["_models.AzureFileProperties"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + azure_file: Optional["_models.AzureFileProperties"] = None, + nfs_azure_file: Optional["_models.NfsAzureFileProperties"] = None, + **kwargs: Any + ) -> None: """ :keyword azure_file: Azure file properties. :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + :keyword nfs_azure_file: NFS Azure file properties. + :paramtype nfs_azure_file: ~azure.mgmt.appcontainers.models.NfsAzureFileProperties """ super().__init__(**kwargs) self.azure_file = azure_file + self.nfs_azure_file = nfs_azure_file class ManagedEnvironmentStoragesCollection(_serialization.Model): """Collection of Storage for Environments. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of storage resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] @@ -6524,7 +8640,7 @@ class ManagedServiceIdentity(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar principal_id: The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. @@ -6538,7 +8654,7 @@ class ManagedServiceIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType :ivar user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. :vartype user_assigned_identities: dict[str, ~azure.mgmt.appcontainers.models.UserAssignedIdentity] @@ -6571,7 +8687,7 @@ def __init__( :paramtype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType :keyword user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.appcontainers.models.UserAssignedIdentity] @@ -6583,6 +8699,26 @@ def __init__( self.user_assigned_identities = user_assigned_identities +class MetricsConfiguration(_serialization.Model): + """Configuration of Open Telemetry metrics. + + :ivar destinations: Open telemetry metrics destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__(self, *, destinations: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword destinations: Open telemetry metrics destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.destinations = destinations + + class Mtls(_serialization.Model): """Configuration properties for mutual TLS authentication. @@ -6603,6 +8739,45 @@ def __init__(self, *, enabled: Optional[bool] = None, **kwargs: Any) -> None: self.enabled = enabled +class NfsAzureFileProperties(_serialization.Model): + """NFS Azure File Properties. + + :ivar server: Server for NFS azure file. + :vartype server: str + :ivar access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :vartype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode + :ivar share_name: NFS Azure file share name. + :vartype share_name: str + """ + + _attribute_map = { + "server": {"key": "server", "type": "str"}, + "access_mode": {"key": "accessMode", "type": "str"}, + "share_name": {"key": "shareName", "type": "str"}, + } + + def __init__( + self, + *, + server: Optional[str] = None, + access_mode: Optional[Union[str, "_models.AccessMode"]] = None, + share_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword server: Server for NFS azure file. + :paramtype server: str + :keyword access_mode: Access mode for storage. Known values are: "ReadOnly" and "ReadWrite". + :paramtype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode + :keyword share_name: NFS Azure file share name. + :paramtype share_name: str + """ + super().__init__(**kwargs) + self.server = server + self.access_mode = access_mode + self.share_name = share_name + + class Nonce(_serialization.Model): """The configuration settings of the nonce used in the login flow. @@ -6797,6 +8972,53 @@ def __init__( self.open_id_connect_configuration = open_id_connect_configuration +class OpenTelemetryConfiguration(_serialization.Model): + """Configuration of Open Telemetry. + + :ivar destinations_configuration: Open telemetry destinations configuration. + :vartype destinations_configuration: ~azure.mgmt.appcontainers.models.DestinationsConfiguration + :ivar traces_configuration: Open telemetry trace configuration. + :vartype traces_configuration: ~azure.mgmt.appcontainers.models.TracesConfiguration + :ivar logs_configuration: Open telemetry logs configuration. + :vartype logs_configuration: ~azure.mgmt.appcontainers.models.LogsConfiguration + :ivar metrics_configuration: Open telemetry metrics configuration. + :vartype metrics_configuration: ~azure.mgmt.appcontainers.models.MetricsConfiguration + """ + + _attribute_map = { + "destinations_configuration": {"key": "destinationsConfiguration", "type": "DestinationsConfiguration"}, + "traces_configuration": {"key": "tracesConfiguration", "type": "TracesConfiguration"}, + "logs_configuration": {"key": "logsConfiguration", "type": "LogsConfiguration"}, + "metrics_configuration": {"key": "metricsConfiguration", "type": "MetricsConfiguration"}, + } + + def __init__( + self, + *, + destinations_configuration: Optional["_models.DestinationsConfiguration"] = None, + traces_configuration: Optional["_models.TracesConfiguration"] = None, + logs_configuration: Optional["_models.LogsConfiguration"] = None, + metrics_configuration: Optional["_models.MetricsConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword destinations_configuration: Open telemetry destinations configuration. + :paramtype destinations_configuration: + ~azure.mgmt.appcontainers.models.DestinationsConfiguration + :keyword traces_configuration: Open telemetry trace configuration. + :paramtype traces_configuration: ~azure.mgmt.appcontainers.models.TracesConfiguration + :keyword logs_configuration: Open telemetry logs configuration. + :paramtype logs_configuration: ~azure.mgmt.appcontainers.models.LogsConfiguration + :keyword metrics_configuration: Open telemetry metrics configuration. + :paramtype metrics_configuration: ~azure.mgmt.appcontainers.models.MetricsConfiguration + """ + super().__init__(**kwargs) + self.destinations_configuration = destinations_configuration + self.traces_configuration = traces_configuration + self.logs_configuration = logs_configuration + self.metrics_configuration = metrics_configuration + + class OperationDetail(_serialization.Model): """Operation detail payload. @@ -6889,6 +9111,91 @@ def __init__( self.description = description +class OtlpConfiguration(_serialization.Model): + """Configuration of otlp. + + :ivar name: The name of otlp configuration. + :vartype name: str + :ivar endpoint: The endpoint of otlp configuration. + :vartype endpoint: str + :ivar insecure: Boolean indicating if otlp configuration is insecure. + :vartype insecure: bool + :ivar headers: Headers of otlp configurations. + :vartype headers: list[~azure.mgmt.appcontainers.models.Header] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "endpoint": {"key": "endpoint", "type": "str"}, + "insecure": {"key": "insecure", "type": "bool"}, + "headers": {"key": "headers", "type": "[Header]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + endpoint: Optional[str] = None, + insecure: Optional[bool] = None, + headers: Optional[List["_models.Header"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of otlp configuration. + :paramtype name: str + :keyword endpoint: The endpoint of otlp configuration. + :paramtype endpoint: str + :keyword insecure: Boolean indicating if otlp configuration is insecure. + :paramtype insecure: bool + :keyword headers: Headers of otlp configurations. + :paramtype headers: list[~azure.mgmt.appcontainers.models.Header] + """ + super().__init__(**kwargs) + self.name = name + self.endpoint = endpoint + self.insecure = insecure + self.headers = headers + + +class PreBuildStep(_serialization.Model): + """Model representing a pre-build step. + + :ivar description: Description of the pre-build step. + :vartype description: str + :ivar scripts: List of custom commands to run. + :vartype scripts: list[str] + :ivar http_get: Http get request to send before the build. + :vartype http_get: ~azure.mgmt.appcontainers.models.HttpGet + """ + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "scripts": {"key": "scripts", "type": "[str]"}, + "http_get": {"key": "httpGet", "type": "HttpGet"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + scripts: Optional[List[str]] = None, + http_get: Optional["_models.HttpGet"] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description of the pre-build step. + :paramtype description: str + :keyword scripts: List of custom commands to run. + :paramtype scripts: list[str] + :keyword http_get: Http get request to send before the build. + :paramtype http_get: ~azure.mgmt.appcontainers.models.HttpGet + """ + super().__init__(**kwargs) + self.description = description + self.scripts = scripts + self.http_get = http_get + + class QueueScaleRule(_serialization.Model): """Container App container Azure Queue based scaling rule. @@ -7023,7 +9330,7 @@ class Replica(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -7092,7 +9399,7 @@ def __init__( class ReplicaCollection(_serialization.Model): """Container App Revision Replicas collection ARM resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.Replica] @@ -7201,7 +9508,7 @@ class Revision(ProxyResource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -7299,7 +9606,7 @@ class RevisionCollection(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.Revision] @@ -7501,7 +9808,7 @@ def __init__( class SecretsCollection(_serialization.Model): """Container App Secrets Collection ARM resource. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] @@ -7555,7 +9862,7 @@ def __init__(self, *, secret_ref: Optional[str] = None, path: Optional[str] = No class Service(_serialization.Model): """Container App to be a dev service. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar type: Dev ContainerApp service type. Required. :vartype type: str @@ -7585,23 +9892,43 @@ class ServiceBind(_serialization.Model): :vartype service_id: str :ivar name: Name of the service bind. :vartype name: str + :ivar client_type: Type of the client to be used to connect to the service. + :vartype client_type: str + :ivar customized_keys: Customized keys for customizing injected values to the app. + :vartype customized_keys: dict[str, str] """ _attribute_map = { "service_id": {"key": "serviceId", "type": "str"}, "name": {"key": "name", "type": "str"}, + "client_type": {"key": "clientType", "type": "str"}, + "customized_keys": {"key": "customizedKeys", "type": "{str}"}, } - def __init__(self, *, service_id: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + service_id: Optional[str] = None, + name: Optional[str] = None, + client_type: Optional[str] = None, + customized_keys: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: """ :keyword service_id: Resource id of the target service. :paramtype service_id: str :keyword name: Name of the service bind. :paramtype name: str + :keyword client_type: Type of the client to be used to connect to the service. + :paramtype client_type: str + :keyword customized_keys: Customized keys for customizing injected values to the app. + :paramtype customized_keys: dict[str, str] """ super().__init__(**kwargs) self.service_id = service_id self.name = name + self.client_type = client_type + self.customized_keys = customized_keys class SourceControl(ProxyResource): @@ -7610,7 +9937,7 @@ class SourceControl(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -7689,7 +10016,7 @@ class SourceControlCollection(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.SourceControl] @@ -7781,6 +10108,46 @@ def __init__( self.last_modified_at = last_modified_at +class TcpConnectionPool(_serialization.Model): + """Defines parameters for tcp connection pooling. + + :ivar max_connections: Maximum number of tcp connections allowed. + :vartype max_connections: int + """ + + _attribute_map = { + "max_connections": {"key": "maxConnections", "type": "int"}, + } + + def __init__(self, *, max_connections: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword max_connections: Maximum number of tcp connections allowed. + :paramtype max_connections: int + """ + super().__init__(**kwargs) + self.max_connections = max_connections + + +class TcpRetryPolicy(_serialization.Model): + """Policy that defines tcp request retry conditions. + + :ivar max_connect_attempts: Maximum number of attempts to connect to the tcp service. + :vartype max_connect_attempts: int + """ + + _attribute_map = { + "max_connect_attempts": {"key": "maxConnectAttempts", "type": "int"}, + } + + def __init__(self, *, max_connect_attempts: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword max_connect_attempts: Maximum number of attempts to connect to the tcp service. + :paramtype max_connect_attempts: int + """ + super().__init__(**kwargs) + self.max_connect_attempts = max_connect_attempts + + class TcpScaleRule(_serialization.Model): """Container App container Tcp scaling rule. @@ -7890,6 +10257,109 @@ def __init__( self.service_binds = service_binds +class TimeoutPolicy(_serialization.Model): + """Policy to set request timeouts. + + :ivar response_timeout_in_seconds: Timeout, in seconds, for a request to respond. + :vartype response_timeout_in_seconds: int + :ivar connection_timeout_in_seconds: Timeout, in seconds, for a request to initiate a + connection. + :vartype connection_timeout_in_seconds: int + """ + + _attribute_map = { + "response_timeout_in_seconds": {"key": "responseTimeoutInSeconds", "type": "int"}, + "connection_timeout_in_seconds": {"key": "connectionTimeoutInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + response_timeout_in_seconds: Optional[int] = None, + connection_timeout_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword response_timeout_in_seconds: Timeout, in seconds, for a request to respond. + :paramtype response_timeout_in_seconds: int + :keyword connection_timeout_in_seconds: Timeout, in seconds, for a request to initiate a + connection. + :paramtype connection_timeout_in_seconds: int + """ + super().__init__(**kwargs) + self.response_timeout_in_seconds = response_timeout_in_seconds + self.connection_timeout_in_seconds = connection_timeout_in_seconds + + +class TokenStore(_serialization.Model): + """The configuration settings of the token store. + + :ivar enabled: :code:`true` to durably store platform-specific security tokens + that are obtained during login flows; otherwise, :code:`false`. + The default is :code:`false`. + :vartype enabled: bool + :ivar token_refresh_extension_hours: The number of hours after session token expiration that a + session token can be used to + call the token refresh API. The default is 72 hours. + :vartype token_refresh_extension_hours: float + :ivar azure_blob_storage: The configuration settings of the storage of the tokens if blob + storage is used. + :vartype azure_blob_storage: ~azure.mgmt.appcontainers.models.BlobStorageTokenStore + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "token_refresh_extension_hours": {"key": "tokenRefreshExtensionHours", "type": "float"}, + "azure_blob_storage": {"key": "azureBlobStorage", "type": "BlobStorageTokenStore"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + token_refresh_extension_hours: Optional[float] = None, + azure_blob_storage: Optional["_models.BlobStorageTokenStore"] = None, + **kwargs: Any + ) -> None: + """ + :keyword enabled: :code:`true` to durably store platform-specific security tokens + that are obtained during login flows; otherwise, :code:`false`. + The default is :code:`false`. + :paramtype enabled: bool + :keyword token_refresh_extension_hours: The number of hours after session token expiration that + a session token can be used to + call the token refresh API. The default is 72 hours. + :paramtype token_refresh_extension_hours: float + :keyword azure_blob_storage: The configuration settings of the storage of the tokens if blob + storage is used. + :paramtype azure_blob_storage: ~azure.mgmt.appcontainers.models.BlobStorageTokenStore + """ + super().__init__(**kwargs) + self.enabled = enabled + self.token_refresh_extension_hours = token_refresh_extension_hours + self.azure_blob_storage = azure_blob_storage + + +class TracesConfiguration(_serialization.Model): + """Configuration of Open Telemetry traces. + + :ivar destinations: Open telemetry traces destinations. + :vartype destinations: list[str] + """ + + _attribute_map = { + "destinations": {"key": "destinations", "type": "[str]"}, + } + + def __init__(self, *, destinations: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword destinations: Open telemetry traces destinations. + :paramtype destinations: list[str] + """ + super().__init__(**kwargs) + self.destinations = destinations + + class TrafficWeight(_serialization.Model): """Traffic weight assigned to a revision. @@ -8009,6 +10479,81 @@ def __init__( self.consumer_secret_setting_name = consumer_secret_setting_name +class Usage(_serialization.Model): + """Describes Compute Resource Usage. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar unit: An enum describing the unit of usage measurement. Required. Default value is + "Count". + :vartype unit: str + :ivar current_value: The current usage of the resource. Required. + :vartype current_value: float + :ivar limit: The maximum permitted usage of the resource. Required. + :vartype limit: float + :ivar name: The name of the type of usage. Required. + :vartype name: ~azure.mgmt.appcontainers.models.UsageName + """ + + _validation = { + "unit": {"required": True, "constant": True}, + "current_value": {"required": True}, + "limit": {"required": True}, + "name": {"required": True}, + } + + _attribute_map = { + "unit": {"key": "unit", "type": "str"}, + "current_value": {"key": "currentValue", "type": "float"}, + "limit": {"key": "limit", "type": "float"}, + "name": {"key": "name", "type": "UsageName"}, + } + + unit = "Count" + + def __init__(self, *, current_value: float, limit: float, name: "_models.UsageName", **kwargs: Any) -> None: + """ + :keyword current_value: The current usage of the resource. Required. + :paramtype current_value: float + :keyword limit: The maximum permitted usage of the resource. Required. + :paramtype limit: float + :keyword name: The name of the type of usage. Required. + :paramtype name: ~azure.mgmt.appcontainers.models.UsageName + """ + super().__init__(**kwargs) + self.current_value = current_value + self.limit = limit + self.name = name + + +class UsageName(_serialization.Model): + """The Usage Names. + + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, + } + + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The name of the resource. + :paramtype value: str + :keyword localized_value: The localized name of the resource. + :paramtype localized_value: str + """ + super().__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + class UserAssignedIdentity(_serialization.Model): """User assigned identity properties. @@ -8108,15 +10653,15 @@ class Volume(_serialization.Model): :ivar name: Volume name. :vartype name: str :ivar storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values - are: "AzureFile", "EmptyDir", and "Secret". + are: "AzureFile", "EmptyDir", "Secret", and "NfsAzureFile". :vartype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :ivar storage_name: Name of storage resource. No need to provide for EmptyDir and Secret. :vartype storage_name: str :ivar secrets: List of secrets to be added in volume. If no secrets are provided, all secrets in collection will be added to volume. :vartype secrets: list[~azure.mgmt.appcontainers.models.SecretVolumeItem] - :ivar mount_options: Mount options used while mounting the AzureFile. Must be a comma-separated - string. + :ivar mount_options: Mount options used while mounting the Azure file share or NFS Azure file + share. Must be a comma-separated string. :vartype mount_options: str """ @@ -8142,15 +10687,15 @@ def __init__( :keyword name: Volume name. :paramtype name: str :keyword storage_type: Storage type for the volume. If not provided, use EmptyDir. Known values - are: "AzureFile", "EmptyDir", and "Secret". + are: "AzureFile", "EmptyDir", "Secret", and "NfsAzureFile". :paramtype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType :keyword storage_name: Name of storage resource. No need to provide for EmptyDir and Secret. :paramtype storage_name: str :keyword secrets: List of secrets to be added in volume. If no secrets are provided, all secrets in collection will be added to volume. :paramtype secrets: list[~azure.mgmt.appcontainers.models.SecretVolumeItem] - :keyword mount_options: Mount options used while mounting the AzureFile. Must be a - comma-separated string. + :keyword mount_options: Mount options used while mounting the Azure file share or NFS Azure + file share. Must be a comma-separated string. :paramtype mount_options: str """ super().__init__(**kwargs) @@ -8207,7 +10752,7 @@ def __init__( class WorkloadProfile(_serialization.Model): """Workload profile to scope container app execution. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: Workload profile type for the workloads to run on. Required. :vartype name: str @@ -8263,7 +10808,7 @@ class WorkloadProfileStates(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -8308,7 +10853,7 @@ class WorkloadProfileStatesCollection(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: Collection of resources. Required. :vartype value: list[~azure.mgmt.appcontainers.models.WorkloadProfileStates] diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py index 839be84fdb2f..27819202ef8e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py @@ -6,9 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._app_resiliency_operations import AppResiliencyOperations from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations from ._available_workload_profiles_operations import AvailableWorkloadProfilesOperations from ._billing_meters_operations import BillingMetersOperations +from ._builders_operations import BuildersOperations +from ._builds_by_builder_resource_operations import BuildsByBuilderResourceOperations +from ._builds_operations import BuildsOperations +from ._build_auth_token_operations import BuildAuthTokenOperations from ._connected_environments_operations import ConnectedEnvironmentsOperations from ._connected_environments_certificates_operations import ConnectedEnvironmentsCertificatesOperations from ._connected_environments_dapr_components_operations import ConnectedEnvironmentsDaprComponentsOperations @@ -19,26 +24,37 @@ from ._container_apps_diagnostics_operations import ContainerAppsDiagnosticsOperations from ._managed_environment_diagnostics_operations import ManagedEnvironmentDiagnosticsOperations from ._managed_environments_diagnostics_operations import ManagedEnvironmentsDiagnosticsOperations -from ._operations import Operations from ._jobs_operations import JobsOperations +from ._operations import Operations from ._jobs_executions_operations import JobsExecutionsOperations from ._container_apps_api_client_operations import ContainerAppsAPIClientOperationsMixin from ._managed_environments_operations import ManagedEnvironmentsOperations from ._certificates_operations import CertificatesOperations from ._managed_certificates_operations import ManagedCertificatesOperations from ._namespaces_operations import NamespacesOperations +from ._dapr_component_resiliency_policies_operations import DaprComponentResiliencyPoliciesOperations from ._dapr_components_operations import DaprComponentsOperations +from ._dapr_subscriptions_operations import DaprSubscriptionsOperations from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations +from ._usages_operations import UsagesOperations +from ._managed_environment_usages_operations import ManagedEnvironmentUsagesOperations +from ._java_components_operations import JavaComponentsOperations +from ._dot_net_components_operations import DotNetComponentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AppResiliencyOperations", "ContainerAppsAuthConfigsOperations", "AvailableWorkloadProfilesOperations", "BillingMetersOperations", + "BuildersOperations", + "BuildsByBuilderResourceOperations", + "BuildsOperations", + "BuildAuthTokenOperations", "ConnectedEnvironmentsOperations", "ConnectedEnvironmentsCertificatesOperations", "ConnectedEnvironmentsDaprComponentsOperations", @@ -49,17 +65,23 @@ "ContainerAppsDiagnosticsOperations", "ManagedEnvironmentDiagnosticsOperations", "ManagedEnvironmentsDiagnosticsOperations", - "Operations", "JobsOperations", + "Operations", "JobsExecutionsOperations", "ContainerAppsAPIClientOperationsMixin", "ManagedEnvironmentsOperations", "CertificatesOperations", "ManagedCertificatesOperations", "NamespacesOperations", + "DaprComponentResiliencyPoliciesOperations", "DaprComponentsOperations", + "DaprSubscriptionsOperations", "ManagedEnvironmentsStoragesOperations", "ContainerAppsSourceControlsOperations", + "UsagesOperations", + "ManagedEnvironmentUsagesOperations", + "JavaComponentsOperations", + "DotNetComponentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py new file mode 100644 index 000000000000..335c0f80f99e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_app_resiliency_operations.py @@ -0,0 +1,738 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _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_create_or_update_request( + resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, app_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request(resource_group_name: str, app_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{appName}/resiliencyPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "appName": _SERIALIZER.url("app_name", app_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AppResiliencyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`app_resiliency` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Required. + :type resiliency_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], + **kwargs: Any + ) -> _models.AppResiliency: + """Create or update an application's resiliency policy. + + Create or update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to create or update. Is either a + AppResiliency type or a IO[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("AppResiliency", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("AppResiliency", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: _models.AppResiliency, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Required. + :type resiliency_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + app_name: str, + name: str, + resiliency_envelope: Union[_models.AppResiliency, IO[bytes]], + **kwargs: Any + ) -> _models.AppResiliency: + """Update an application's resiliency policy. + + Update container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :param resiliency_envelope: The resiliency policy to update. Is either a AppResiliency type or + a IO[bytes] type. Required. + :type resiliency_envelope: ~azure.mgmt.appcontainers.models.AppResiliency or IO[bytes] + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(resiliency_envelope, (IOBase, bytes)): + _content = resiliency_envelope + else: + _json = self._serialize.body(resiliency_envelope, "AppResiliency") + + _request = build_update_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, app_name: str, name: str, **kwargs: Any + ) -> None: + """Delete an application's resiliency policy. + + Delete container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, app_name: str, name: str, **kwargs: Any) -> _models.AppResiliency: + """Get an application's resiliency policy. + + Get container app resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :param name: Name of the resiliency policy. Required. + :type name: str + :return: AppResiliency or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AppResiliency + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResiliency] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + app_name=app_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AppResiliency", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, app_name: str, **kwargs: Any) -> Iterable["_models.AppResiliency"]: + """List an application's resiliency policies. + + List container app resiliency policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param app_name: Name of the Container App. Required. + :type app_name: str + :return: An iterator like instance of either AppResiliency or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.AppResiliency] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AppResiliencyCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + app_name=app_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("AppResiliencyCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py index a4512d46ae92..b5b3325841ae 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_available_workload_profiles_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,7 +40,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/availableManagedEnvironmentsWorkloadProfileTypes", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str", min_length=1), } @@ -91,7 +91,6 @@ def get(self, location: str, **kwargs: Any) -> Iterable["_models.AvailableWorklo :param location: The name of Azure region. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableWorkloadProfile or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.AvailableWorkloadProfile] @@ -114,16 +113,15 @@ def get(self, location: str, **kwargs: Any) -> Iterable["_models.AvailableWorklo def prepare_request(next_link=None): if not next_link: - request = build_get_request( + _request = build_get_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -135,13 +133,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("AvailableWorkloadProfilesCollection", pipeline_response) @@ -151,11 +149,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -167,7 +165,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/availableManagedEnvironmentsWorkloadProfileTypes" - } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py index c14efc555e25..cc656256a0da 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_billing_meters_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,7 +38,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -46,7 +46,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/billingMeters" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str", min_length=1), } @@ -88,7 +88,6 @@ def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollection: :param location: The name of Azure region. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BillingMeterCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.BillingMeterCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -107,20 +106,19 @@ def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollection: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BillingMeterCollection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,8 +131,6 @@ def get(self, location: str, **kwargs: Any) -> _models.BillingMeterCollection: deserialized = self._deserialize("BillingMeterCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/billingMeters"} + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py new file mode 100644 index 000000000000..03f255159915 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_build_auth_token_operations.py @@ -0,0 +1,152 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _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( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}/listAuthToken", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildAuthTokenOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`build_auth_token` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any) -> _models.BuildToken: + """Gets the token used to connect to the endpoint where source code can be uploaded for a build. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: BuildToken or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildToken + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildToken] = kwargs.pop("cls", None) + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("BuildToken", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py new file mode 100644 index 000000000000..2ee9ea5294f4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builders_operations.py @@ -0,0 +1,968 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _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_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/builders") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`builders` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.BuilderResource"]: + """List BuilderResource resources by subscription ID. + + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.BuilderResource"]: + """List BuilderResource resources by resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either BuilderResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("BuilderCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def get(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> _models.BuilderResource: + """Get a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: BuilderResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuilderResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("BuilderResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> _models.BuilderResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Required. + :type builder_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Create or update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: Resource create parameters. Is either a BuilderResource type or a + IO[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResource or IO[bytes] + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.BuilderResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.BuilderResource]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(builder_envelope, (IOBase, bytes)): + _content = builder_envelope + else: + _json = self._serialize.body(builder_envelope, "BuilderResourceUpdate") + + _request = build_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BuilderResource", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: _models.BuilderResourceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Required. + :type builder_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + builder_name: str, + builder_envelope: Union[_models.BuilderResourceUpdate, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BuilderResource]: + """Update a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param builder_envelope: The resource properties to be updated. Is either a + BuilderResourceUpdate type or a IO[bytes] type. Required. + :type builder_envelope: ~azure.mgmt.appcontainers.models.BuilderResourceUpdate or IO[bytes] + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuilderResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + builder_envelope=builder_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuilderResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuilderResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuilderResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, builder_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py new file mode 100644 index 000000000000..b1a3d7ef324f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_by_builder_resource_operations.py @@ -0,0 +1,173 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _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(resource_group_name: str, builder_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildsByBuilderResourceOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`builds_by_builder_resource` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, builder_name: str, **kwargs: Any) -> Iterable["_models.BuildResource"]: + """List BuildResource resources by BuilderResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :return: An iterator like instance of either BuildResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("BuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py new file mode 100644 index 000000000000..8007534cc4ae --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_builds_operations.py @@ -0,0 +1,552 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _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_get_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, builder_name: str, build_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/builders/{builderName}/builds/{buildName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "builderName": _SERIALIZER.url( + "builder_name", builder_name, "str", max_length=32, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + "buildName": _SERIALIZER.url( + "build_name", build_name, "str", max_length=64, min_length=2, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class BuildsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`builds` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any) -> _models.BuildResource: + """Get a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :return: BuildResource or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.BuildResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("BuildResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> _models.BuildResource: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(build_envelope, (IOBase, bytes)): + _content = build_envelope + else: + _json = self._serialize.body(build_envelope, "BuildResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("BuildResource", pipeline_response) + + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("BuildResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: _models.BuildResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Required. + :type build_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + builder_name: str, + build_name: str, + build_envelope: Union[_models.BuildResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BuildResource]: + """Create a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :param build_envelope: Resource create or update parameters. Is either a BuildResource type or + a IO[bytes] type. Required. + :type build_envelope: ~azure.mgmt.appcontainers.models.BuildResource or IO[bytes] + :return: An instance of LROPoller that returns either BuildResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.BuildResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BuildResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + build_envelope=build_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("BuildResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.BuildResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.BuildResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, builder_name: str, build_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a BuildResource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param builder_name: The name of the builder. Required. + :type builder_name: str + :param build_name: The name of a build. Required. + :type build_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + builder_name=builder_name, + build_name=build_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py index 27f61a142e07..2739382988f7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +120,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -181,7 +181,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -191,7 +191,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -242,7 +242,6 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - :type resource_group_name: str :param environment_name: Name of the Managed Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Certificate or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: @@ -264,17 +263,16 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -286,13 +284,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("CertificateCollection", pipeline_response) @@ -302,11 +300,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,10 +317,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates" - } - @distributed_trace def get( self, resource_group_name: str, environment_name: str, certificate_name: str, **kwargs: Any @@ -338,7 +332,6 @@ def get( :type environment_name: str :param certificate_name: Name of the Certificate. Required. :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -357,22 +350,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, environment_name=environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -385,13 +377,9 @@ def get( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -420,7 +408,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -432,7 +419,7 @@ def create_or_update( resource_group_name: str, environment_name: str, certificate_name: str, - certificate_envelope: Optional[IO] = None, + certificate_envelope: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -449,11 +436,10 @@ def create_or_update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Certificate to be created or updated. Default value is None. - :type certificate_envelope: IO + :type certificate_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -465,7 +451,7 @@ def create_or_update( resource_group_name: str, environment_name: str, certificate_name: str, - certificate_envelope: Optional[Union[_models.Certificate, IO]] = None, + certificate_envelope: Optional[Union[_models.Certificate, IO[bytes]]] = None, **kwargs: Any ) -> _models.Certificate: """Create or Update a Certificate. @@ -480,12 +466,8 @@ def create_or_update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Certificate to be created or updated. Is either a Certificate type - or a IO type. Default value is None. - :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Default value is None. + :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate or IO[bytes] :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -516,7 +498,7 @@ def create_or_update( else: _json = None - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, environment_name=environment_name, certificate_name=certificate_name, @@ -525,16 +507,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -547,13 +528,9 @@ def create_or_update( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -570,7 +547,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type environment_name: str :param certificate_name: Name of the Certificate. Required. :type certificate_name: str - :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: @@ -589,22 +565,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, environment_name=environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -615,11 +590,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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.App/managedEnvironments/{environmentName}/certificates/{certificateName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -648,7 +619,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -660,7 +630,7 @@ def update( resource_group_name: str, environment_name: str, certificate_name: str, - certificate_envelope: IO, + certificate_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -677,11 +647,10 @@ def update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Properties of a certificate that need to be updated. Required. - :type certificate_envelope: IO + :type certificate_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -693,7 +662,7 @@ def update( resource_group_name: str, environment_name: str, certificate_name: str, - certificate_envelope: Union[_models.CertificatePatch, IO], + certificate_envelope: Union[_models.CertificatePatch, IO[bytes]], **kwargs: Any ) -> _models.Certificate: """Update properties of a certificate. @@ -708,12 +677,8 @@ def update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Properties of a certificate that need to be updated. Is either a - CertificatePatch type or a IO type. Required. - :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + CertificatePatch type or a IO[bytes] type. Required. + :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch or IO[bytes] :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -741,7 +706,7 @@ def update( else: _json = self._serialize.body(certificate_envelope, "CertificatePatch") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, environment_name=environment_name, certificate_name=certificate_name, @@ -750,16 +715,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -772,10 +736,6 @@ def update( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/certificates/{certificateName}" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py index 62a998e48a9b..e06b5f9cbd78 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_certificates_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +80,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -118,7 +118,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -128,7 +128,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -159,7 +159,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +168,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -197,7 +197,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -207,7 +207,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -228,7 +228,7 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -class ConnectedEnvironmentsCertificatesOperations: +class ConnectedEnvironmentsCertificatesOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -260,7 +260,6 @@ def list( :type resource_group_name: str :param connected_environment_name: Name of the Connected Environment. Required. :type connected_environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Certificate or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Certificate] :raises ~azure.core.exceptions.HttpResponseError: @@ -282,17 +281,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -304,13 +302,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("CertificateCollection", pipeline_response) @@ -320,11 +318,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -337,10 +335,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates" - } - @distributed_trace def get( self, resource_group_name: str, connected_environment_name: str, certificate_name: str, **kwargs: Any @@ -356,7 +350,6 @@ def get( :type connected_environment_name: str :param certificate_name: Name of the Certificate. Required. :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -375,22 +368,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Certificate] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,13 +395,9 @@ def get( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -438,7 +426,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -450,7 +437,7 @@ def create_or_update( resource_group_name: str, connected_environment_name: str, certificate_name: str, - certificate_envelope: Optional[IO] = None, + certificate_envelope: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -467,11 +454,10 @@ def create_or_update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Certificate to be created or updated. Default value is None. - :type certificate_envelope: IO + :type certificate_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -483,7 +469,7 @@ def create_or_update( resource_group_name: str, connected_environment_name: str, certificate_name: str, - certificate_envelope: Optional[Union[_models.Certificate, IO]] = None, + certificate_envelope: Optional[Union[_models.Certificate, IO[bytes]]] = None, **kwargs: Any ) -> _models.Certificate: """Create or Update a Certificate. @@ -498,12 +484,8 @@ def create_or_update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Certificate to be created or updated. Is either a Certificate type - or a IO type. Default value is None. - :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Default value is None. + :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate or IO[bytes] :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -534,7 +516,7 @@ def create_or_update( else: _json = None - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, @@ -543,16 +525,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -565,13 +546,9 @@ def create_or_update( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -588,7 +565,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param certificate_name: Name of the Certificate. Required. :type certificate_name: str - :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: @@ -607,22 +583,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -633,11 +608,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -666,7 +637,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -678,7 +648,7 @@ def update( resource_group_name: str, connected_environment_name: str, certificate_name: str, - certificate_envelope: IO, + certificate_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -695,11 +665,10 @@ def update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Properties of a certificate that need to be updated. Required. - :type certificate_envelope: IO + :type certificate_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -711,7 +680,7 @@ def update( resource_group_name: str, connected_environment_name: str, certificate_name: str, - certificate_envelope: Union[_models.CertificatePatch, IO], + certificate_envelope: Union[_models.CertificatePatch, IO[bytes]], **kwargs: Any ) -> _models.Certificate: """Update properties of a certificate. @@ -726,12 +695,8 @@ def update( :param certificate_name: Name of the Certificate. Required. :type certificate_name: str :param certificate_envelope: Properties of a certificate that need to be updated. Is either a - CertificatePatch type or a IO type. Required. - :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + CertificatePatch type or a IO[bytes] type. Required. + :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch or IO[bytes] :return: Certificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Certificate :raises ~azure.core.exceptions.HttpResponseError: @@ -759,7 +724,7 @@ def update( else: _json = self._serialize.body(certificate_envelope, "CertificatePatch") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, certificate_name=certificate_name, @@ -768,16 +733,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -790,10 +754,6 @@ def update( deserialized = self._deserialize("Certificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/certificates/{certificateName}" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py index 231c1e56afd3..db1d06c8ffd3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_dapr_components_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +120,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -181,7 +181,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +190,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -209,7 +209,7 @@ def build_list_secrets_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class ConnectedEnvironmentsDaprComponentsOperations: +class ConnectedEnvironmentsDaprComponentsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. @@ -241,7 +241,6 @@ def list( :type resource_group_name: str :param connected_environment_name: Name of the connected environment. Required. :type connected_environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DaprComponent or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprComponent] :raises ~azure.core.exceptions.HttpResponseError: @@ -263,17 +262,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -285,13 +283,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("DaprComponentsCollection", pipeline_response) @@ -301,11 +299,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,10 +316,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents" - } - @distributed_trace def get( self, resource_group_name: str, connected_environment_name: str, component_name: str, **kwargs: Any @@ -337,7 +331,6 @@ def get( :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -356,22 +349,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponent] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -384,13 +376,9 @@ def get( deserialized = self._deserialize("DaprComponent", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -419,7 +407,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -431,7 +418,7 @@ def create_or_update( resource_group_name: str, connected_environment_name: str, component_name: str, - dapr_component_envelope: IO, + dapr_component_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -448,11 +435,10 @@ def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Required. - :type dapr_component_envelope: IO + :type dapr_component_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -464,7 +450,7 @@ def create_or_update( resource_group_name: str, connected_environment_name: str, component_name: str, - dapr_component_envelope: Union[_models.DaprComponent, IO], + dapr_component_envelope: Union[_models.DaprComponent, IO[bytes]], **kwargs: Any ) -> _models.DaprComponent: """Creates or updates a Dapr Component. @@ -479,12 +465,8 @@ def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Is either a - DaprComponent type or a IO type. Required. - :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + DaprComponent type or a IO[bytes] type. Required. + :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent or IO[bytes] :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -512,7 +494,7 @@ def create_or_update( else: _json = self._serialize.body(dapr_component_envelope, "DaprComponent") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, component_name=component_name, @@ -521,16 +503,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -543,13 +524,9 @@ def create_or_update( deserialized = self._deserialize("DaprComponent", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -566,7 +543,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :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: @@ -585,22 +561,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,11 +586,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_secrets( @@ -632,7 +603,6 @@ def list_secrets( :type connected_environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprSecretsCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -651,22 +621,21 @@ def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprSecretsCollection] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -679,10 +648,6 @@ def list_secrets( deserialized = self._deserialize("DaprSecretsCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/daprComponents/{componentName}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py index df60ba17c572..8bc2e4540fbc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,13 +43,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -99,7 +99,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +108,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -132,7 +132,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +142,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -168,7 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +177,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -201,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -210,7 +210,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -234,7 +234,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -244,7 +244,7 @@ def build_check_name_availability_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/checkNameAvailability", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -289,7 +289,6 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ConnectedEnvi Get all connectedEnvironments for a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ConnectedEnvironment or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ConnectedEnvironment] @@ -312,15 +311,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ConnectedEnvi def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -332,13 +330,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ConnectedEnvironmentCollection", pipeline_response) @@ -348,11 +346,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -365,10 +363,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/connectedEnvironments" - } - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any @@ -378,7 +372,6 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ConnectedEnvironment or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ConnectedEnvironment] @@ -401,16 +394,15 @@ def list_by_resource_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -422,13 +414,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ConnectedEnvironmentCollection", pipeline_response) @@ -438,11 +430,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -455,10 +447,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments" - } - @distributed_trace def get( self, resource_group_name: str, connected_environment_name: str, **kwargs: Any @@ -470,7 +458,6 @@ def get( :type resource_group_name: str :param connected_environment_name: Name of the connectedEnvironment. Required. :type connected_environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectedEnvironment or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: @@ -489,21 +476,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironment] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,19 +502,15 @@ def get( deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, connected_environment_name: str, - environment_envelope: Union[_models.ConnectedEnvironment, IO], + environment_envelope: Union[_models.ConnectedEnvironment, IO[bytes]], **kwargs: Any ) -> _models.ConnectedEnvironment: error_map = { @@ -554,7 +536,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(environment_envelope, "ConnectedEnvironment") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, @@ -562,16 +544,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -592,10 +573,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" - } - @overload def begin_create_or_update( self, @@ -618,14 +595,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ConnectedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironment] @@ -637,7 +606,7 @@ def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, - environment_envelope: IO, + environment_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -650,18 +619,10 @@ def begin_create_or_update( :param connected_environment_name: Name of the connectedEnvironment. Required. :type connected_environment_name: str :param environment_envelope: Configuration details of the connectedEnvironment. Required. - :type environment_envelope: IO + :type environment_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ConnectedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironment] @@ -673,7 +634,7 @@ def begin_create_or_update( self, resource_group_name: str, connected_environment_name: str, - environment_envelope: Union[_models.ConnectedEnvironment, IO], + environment_envelope: Union[_models.ConnectedEnvironment, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ConnectedEnvironment]: """Creates or updates an connectedEnvironment. @@ -684,19 +645,8 @@ def begin_create_or_update( :param connected_environment_name: Name of the connectedEnvironment. Required. :type connected_environment_name: str :param environment_envelope: Configuration details of the connectedEnvironment. Is either a - ConnectedEnvironment type or a IO type. Required. - :type environment_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironment or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + ConnectedEnvironment type or a IO[bytes] type. Required. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironment or IO[bytes] :return: An instance of LROPoller that returns either ConnectedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ConnectedEnvironment] @@ -728,7 +678,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -740,17 +690,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ConnectedEnvironment].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" - } + return LROPoller[_models.ConnectedEnvironment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, connected_environment_name: str, **kwargs: Any @@ -769,21 +717,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -798,11 +745,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, connected_environment_name: str, **kwargs: Any) -> LROPoller[None]: @@ -815,14 +758,6 @@ def begin_delete(self, resource_group_name: str, connected_environment_name: str :type resource_group_name: str :param connected_environment_name: Name of the connectedEnvironment. Required. :type connected_environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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: @@ -849,7 +784,7 @@ def begin_delete(self, resource_group_name: str, connected_environment_name: str def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -860,17 +795,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def update( @@ -885,7 +816,6 @@ def update( :type resource_group_name: str :param connected_environment_name: Name of the connectedEnvironment. Required. :type connected_environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectedEnvironment or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironment :raises ~azure.core.exceptions.HttpResponseError: @@ -904,21 +834,20 @@ def update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironment] = kwargs.pop("cls", None) - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -931,13 +860,9 @@ def update( deserialized = self._deserialize("ConnectedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}" - } + return deserialized # type: ignore @overload def check_name_availability( @@ -965,7 +890,6 @@ def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResponse or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -976,7 +900,7 @@ def check_name_availability( self, resource_group_name: str, connected_environment_name: str, - check_name_availability_request: IO, + check_name_availability_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -992,11 +916,10 @@ def check_name_availability( :type connected_environment_name: str :param check_name_availability_request: The check connectedEnvironmentName availability request. Required. - :type check_name_availability_request: IO + :type check_name_availability_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResponse or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -1007,7 +930,7 @@ def check_name_availability( self, resource_group_name: str, connected_environment_name: str, - check_name_availability_request: Union[_models.CheckNameAvailabilityRequest, IO], + check_name_availability_request: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityResponse: """Checks the resource connectedEnvironmentName availability. @@ -1020,13 +943,9 @@ def check_name_availability( :param connected_environment_name: Name of the Managed Environment. Required. :type connected_environment_name: str :param check_name_availability_request: The check connectedEnvironmentName availability - request. Is either a CheckNameAvailabilityRequest type or a IO type. Required. + request. Is either a CheckNameAvailabilityRequest type or a IO[bytes] type. Required. :type check_name_availability_request: - ~azure.mgmt.appcontainers.models.CheckNameAvailabilityRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.appcontainers.models.CheckNameAvailabilityRequest or IO[bytes] :return: CheckNameAvailabilityResponse or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -1054,7 +973,7 @@ def check_name_availability( else: _json = self._serialize.body(check_name_availability_request, "CheckNameAvailabilityRequest") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, @@ -1062,16 +981,15 @@ def check_name_availability( content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1084,10 +1002,6 @@ def check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/checkNameAvailability" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py index 137b91f69a70..084b50d04075 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_connected_environments_storages_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -41,7 +41,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +50,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -74,7 +74,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -108,7 +108,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,7 +118,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -145,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +154,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -205,7 +205,6 @@ def list( :type resource_group_name: str :param connected_environment_name: Name of the Environment. Required. :type connected_environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectedEnvironmentStoragesCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStoragesCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -224,21 +223,20 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironmentStoragesCollection] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,13 +249,9 @@ def list( deserialized = self._deserialize("ConnectedEnvironmentStoragesCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages" - } + return deserialized # type: ignore @distributed_trace def get( @@ -274,7 +268,6 @@ def get( :type connected_environment_name: str :param storage_name: Name of the storage. Required. :type storage_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -293,22 +286,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ConnectedEnvironmentStorage] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, storage_name=storage_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -321,13 +313,9 @@ def get( deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -356,7 +344,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -368,7 +355,7 @@ def create_or_update( resource_group_name: str, connected_environment_name: str, storage_name: str, - storage_envelope: IO, + storage_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -385,11 +372,10 @@ def create_or_update( :param storage_name: Name of the storage. Required. :type storage_name: str :param storage_envelope: Configuration details of storage. Required. - :type storage_envelope: IO + :type storage_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ConnectedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -401,7 +387,7 @@ def create_or_update( resource_group_name: str, connected_environment_name: str, storage_name: str, - storage_envelope: Union[_models.ConnectedEnvironmentStorage, IO], + storage_envelope: Union[_models.ConnectedEnvironmentStorage, IO[bytes]], **kwargs: Any ) -> _models.ConnectedEnvironmentStorage: """Create or update storage for a connectedEnvironment. @@ -416,12 +402,9 @@ def create_or_update( :param storage_name: Name of the storage. Required. :type storage_name: str :param storage_envelope: Configuration details of storage. Is either a - ConnectedEnvironmentStorage type or a IO type. Required. - :type storage_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ConnectedEnvironmentStorage type or a IO[bytes] type. Required. + :type storage_envelope: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage or + IO[bytes] :return: ConnectedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ConnectedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -449,7 +432,7 @@ def create_or_update( else: _json = self._serialize.body(storage_envelope, "ConnectedEnvironmentStorage") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, storage_name=storage_name, @@ -458,16 +441,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -480,13 +462,9 @@ def create_or_update( deserialized = self._deserialize("ConnectedEnvironmentStorage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -503,7 +481,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type connected_environment_name: str :param storage_name: Name of the storage. Required. :type storage_name: str - :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: @@ -522,22 +499,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, connected_environment_name=connected_environment_name, storage_name=storage_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,8 +524,4 @@ def delete( # pylint: disable=inconsistent-return-statements 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.App/connectedEnvironments/{connectedEnvironmentName}/storages/{storageName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py index 32fc8b154350..b959732eef68 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_api_client_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,7 +40,7 @@ def build_job_execution_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_job_execution_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -70,6 +70,34 @@ def build_job_execution_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_get_custom_domain_verification_id_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/getCustomDomainVerificationId" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class ContainerAppsAPIClientOperationsMixin(ContainerAppsAPIClientMixinABC): @distributed_trace def job_execution( @@ -86,7 +114,6 @@ def job_execution( :type job_name: str :param job_execution_name: Job execution name. Required. :type job_execution_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: JobExecution or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.JobExecution :raises ~azure.core.exceptions.HttpResponseError: @@ -105,22 +132,21 @@ def job_execution( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobExecution] = kwargs.pop("cls", None) - request = build_job_execution_request( + _request = build_job_execution_request( resource_group_name=resource_group_name, job_name=job_name, job_execution_name=job_execution_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.job_execution.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,10 +159,56 @@ def job_execution( deserialized = self._deserialize("JobExecution", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - job_execution.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}" - } + @distributed_trace + def get_custom_domain_verification_id(self, **kwargs: Any) -> str: + """Get the verification id of a subscription used for verifying custom domains. + + :return: str or the result of cls(response) + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_get_custom_domain_verification_id_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("str", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py index 4d5a8ba42b0b..6d16ff0bbc57 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_list_by_container_app_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_by_container_app_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +120,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -207,7 +207,6 @@ def list_by_container_app( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AuthConfig or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.AuthConfig] :raises ~azure.core.exceptions.HttpResponseError: @@ -229,17 +228,16 @@ def list_by_container_app( def prepare_request(next_link=None): if not next_link: - request = build_list_by_container_app_request( + _request = build_list_by_container_app_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_container_app.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -251,13 +249,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("AuthConfigCollection", pipeline_response) @@ -267,11 +265,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -284,10 +282,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_container_app.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs" - } - @distributed_trace def get( self, resource_group_name: str, container_app_name: str, auth_config_name: str, **kwargs: Any @@ -303,7 +297,6 @@ def get( :type container_app_name: str :param auth_config_name: Name of the Container App AuthConfig. Required. :type auth_config_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthConfig or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: @@ -322,22 +315,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AuthConfig] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, container_app_name=container_app_name, auth_config_name=auth_config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -350,13 +342,9 @@ def get( deserialized = self._deserialize("AuthConfig", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -385,7 +373,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthConfig or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: @@ -397,7 +384,7 @@ def create_or_update( resource_group_name: str, container_app_name: str, auth_config_name: str, - auth_config_envelope: IO, + auth_config_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -414,11 +401,10 @@ def create_or_update( :param auth_config_name: Name of the Container App AuthConfig. Required. :type auth_config_name: str :param auth_config_envelope: Properties used to create a Container App AuthConfig. Required. - :type auth_config_envelope: IO + :type auth_config_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: AuthConfig or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: @@ -430,7 +416,7 @@ def create_or_update( resource_group_name: str, container_app_name: str, auth_config_name: str, - auth_config_envelope: Union[_models.AuthConfig, IO], + auth_config_envelope: Union[_models.AuthConfig, IO[bytes]], **kwargs: Any ) -> _models.AuthConfig: """Create or update the AuthConfig for a Container App. @@ -445,12 +431,8 @@ def create_or_update( :param auth_config_name: Name of the Container App AuthConfig. Required. :type auth_config_name: str :param auth_config_envelope: Properties used to create a Container App AuthConfig. Is either a - AuthConfig type or a IO type. Required. - :type auth_config_envelope: ~azure.mgmt.appcontainers.models.AuthConfig or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + AuthConfig type or a IO[bytes] type. Required. + :type auth_config_envelope: ~azure.mgmt.appcontainers.models.AuthConfig or IO[bytes] :return: AuthConfig or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.AuthConfig :raises ~azure.core.exceptions.HttpResponseError: @@ -478,7 +460,7 @@ def create_or_update( else: _json = self._serialize.body(auth_config_envelope, "AuthConfig") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, container_app_name=container_app_name, auth_config_name=auth_config_name, @@ -487,16 +469,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,13 +490,9 @@ def create_or_update( deserialized = self._deserialize("AuthConfig", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{authConfigName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -532,7 +509,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type container_app_name: str :param auth_config_name: Name of the Container App AuthConfig. Required. :type auth_config_name: str - :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: @@ -551,22 +527,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, container_app_name=container_app_name, auth_config_name=auth_config_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -577,8 +552,4 @@ def delete( # pylint: disable=inconsistent-return-statements 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.App/containerApps/{containerAppName}/authConfigs/{authConfigName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py index c0b74244ccaa..5014cf298b1b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_diagnostics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -42,7 +42,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +51,7 @@ def build_list_detectors_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -75,7 +75,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +84,7 @@ def build_get_detector_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -114,7 +114,7 @@ def build_list_revisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +123,7 @@ def build_list_revisions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,7 +149,7 @@ def build_get_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +158,7 @@ def build_get_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/{revisionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -183,7 +183,7 @@ def build_get_root_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +192,7 @@ def build_get_root_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/rootApi/", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -243,7 +243,6 @@ def list_detectors( :param container_app_name: Name of the Container App for which detector info is needed. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Diagnostics or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Diagnostics] :raises ~azure.core.exceptions.HttpResponseError: @@ -265,17 +264,16 @@ def list_detectors( def prepare_request(next_link=None): if not next_link: - request = build_list_detectors_request( + _request = build_list_detectors_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_detectors.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -287,13 +285,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("DiagnosticsCollection", pipeline_response) @@ -303,11 +301,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -320,10 +318,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_detectors.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors" - } - @distributed_trace def get_detector( self, resource_group_name: str, container_app_name: str, detector_name: str, **kwargs: Any @@ -339,7 +333,6 @@ def get_detector( :type container_app_name: str :param detector_name: Name of the Container App Detector. Required. :type detector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Diagnostics or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: @@ -358,22 +351,21 @@ def get_detector( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Diagnostics] = kwargs.pop("cls", None) - request = build_get_detector_request( + _request = build_get_detector_request( resource_group_name=resource_group_name, container_app_name=container_app_name, detector_name=detector_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_detector.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -386,13 +378,9 @@ def get_detector( deserialized = self._deserialize("Diagnostics", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_detector.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectors/{detectorName}" - } + return deserialized # type: ignore @distributed_trace def list_revisions( @@ -409,7 +397,6 @@ def list_revisions( :type container_app_name: str :param filter: The filter to apply on the operation. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Revision or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Revision] :raises ~azure.core.exceptions.HttpResponseError: @@ -431,18 +418,17 @@ def list_revisions( def prepare_request(next_link=None): if not next_link: - request = build_list_revisions_request( + _request = build_list_revisions_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_revisions.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -454,13 +440,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("RevisionCollection", pipeline_response) @@ -470,11 +456,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,10 +473,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_revisions.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/" - } - @distributed_trace def get_revision( self, resource_group_name: str, container_app_name: str, revision_name: str, **kwargs: Any @@ -506,7 +488,6 @@ def get_revision( :type container_app_name: str :param revision_name: Name of the Container App Revision. Required. :type revision_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Revision or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Revision :raises ~azure.core.exceptions.HttpResponseError: @@ -525,22 +506,21 @@ def get_revision( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Revision] = kwargs.pop("cls", None) - request = build_get_revision_request( + _request = build_get_revision_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_revision.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -553,13 +533,9 @@ def get_revision( deserialized = self._deserialize("Revision", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_revision.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/revisionsApi/revisions/{revisionName}" - } + return deserialized # type: ignore @distributed_trace def get_root(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> _models.ContainerApp: @@ -572,7 +548,6 @@ def get_root(self, resource_group_name: str, container_app_name: str, **kwargs: :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContainerApp or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises ~azure.core.exceptions.HttpResponseError: @@ -591,37 +566,32 @@ def get_root(self, resource_group_name: str, container_app_name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) - request = build_get_root_request( + _request = build_get_root_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_root.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **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) + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ContainerApp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_root.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/detectorProperties/rootApi/" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py index c34634c1b3c5..c4bec66f23ce 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,13 +43,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -99,7 +99,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +108,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -132,7 +132,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +142,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -168,7 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +177,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -201,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -211,7 +211,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -231,7 +231,7 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_custom_host_name_analysis_request( +def build_list_custom_host_name_analysis_request( # pylint: disable=name-too-long resource_group_name: str, container_app_name: str, subscription_id: str, @@ -242,7 +242,7 @@ def build_list_custom_host_name_analysis_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +251,7 @@ def build_list_custom_host_name_analysis_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -277,7 +277,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,7 +286,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -310,7 +310,7 @@ def build_get_auth_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -319,7 +319,7 @@ def build_get_auth_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/getAuthtoken", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -343,7 +343,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -352,7 +352,7 @@ def build_start_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/start", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -378,7 +378,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -387,7 +387,7 @@ def build_stop_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -432,7 +432,6 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ContainerApp" Get the Container Apps in a given subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerApp or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerApp] :raises ~azure.core.exceptions.HttpResponseError: @@ -454,15 +453,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ContainerApp" def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -474,13 +472,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ContainerAppCollection", pipeline_response) @@ -490,11 +488,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -507,8 +505,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps"} - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ContainerApp"]: """Get the Container Apps in a given resource group. @@ -518,7 +514,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ContainerApp or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerApp] :raises ~azure.core.exceptions.HttpResponseError: @@ -540,16 +535,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -561,13 +555,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ContainerAppCollection", pipeline_response) @@ -577,11 +571,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -594,10 +588,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps" - } - @distributed_trace def get(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> _models.ContainerApp: """Get the properties of a Container App. @@ -609,7 +599,6 @@ def get(self, resource_group_name: str, container_app_name: str, **kwargs: Any) :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContainerApp or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ContainerApp :raises ~azure.core.exceptions.HttpResponseError: @@ -628,46 +617,41 @@ def get(self, resource_group_name: str, container_app_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerApp] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **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) + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ContainerApp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, container_app_name: str, - container_app_envelope: Union[_models.ContainerApp, IO], + container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any ) -> _models.ContainerApp: error_map = { @@ -693,7 +677,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(container_app_envelope, "ContainerApp") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, @@ -701,16 +685,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -731,10 +714,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } - @overload def begin_create_or_update( self, @@ -759,14 +738,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -778,7 +749,7 @@ def begin_create_or_update( self, resource_group_name: str, container_app_name: str, - container_app_envelope: IO, + container_app_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -793,18 +764,10 @@ def begin_create_or_update( :param container_app_name: Name of the Container App. Required. :type container_app_name: str :param container_app_envelope: Properties used to create a container app. Required. - :type container_app_envelope: IO + :type container_app_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -816,7 +779,7 @@ def begin_create_or_update( self, resource_group_name: str, container_app_name: str, - container_app_envelope: Union[_models.ContainerApp, IO], + container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ContainerApp]: """Create or update a Container App. @@ -829,19 +792,8 @@ def begin_create_or_update( :param container_app_name: Name of the Container App. Required. :type container_app_name: str :param container_app_envelope: Properties used to create a container app. Is either a - ContainerApp type or a IO type. Required. - :type container_app_envelope: ~azure.mgmt.appcontainers.models.ContainerApp or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + ContainerApp type or a IO[bytes] type. Required. + :type container_app_envelope: ~azure.mgmt.appcontainers.models.ContainerApp or IO[bytes] :return: An instance of LROPoller that returns either ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -873,7 +825,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ContainerApp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -885,17 +837,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ContainerApp].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } + return LROPoller[_models.ContainerApp]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, **kwargs: Any @@ -914,21 +864,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -943,11 +892,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, container_app_name: str, **kwargs: Any) -> LROPoller[None]: @@ -960,14 +905,6 @@ def begin_delete(self, resource_group_name: str, container_app_name: str, **kwar :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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: @@ -994,7 +931,7 @@ def begin_delete(self, resource_group_name: str, container_app_name: str, **kwar def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1005,23 +942,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _update_initial( self, resource_group_name: str, container_app_name: str, - container_app_envelope: Union[_models.ContainerApp, IO], + container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any ) -> Optional[_models.ContainerApp]: error_map = { @@ -1047,7 +980,7 @@ def _update_initial( else: _json = self._serialize.body(container_app_envelope, "ContainerApp") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, @@ -1055,16 +988,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1083,13 +1015,9 @@ def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -1115,14 +1043,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -1134,7 +1054,7 @@ def begin_update( self, resource_group_name: str, container_app_name: str, - container_app_envelope: IO, + container_app_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1149,18 +1069,10 @@ def begin_update( :param container_app_name: Name of the Container App. Required. :type container_app_name: str :param container_app_envelope: Properties of a Container App that need to be updated. Required. - :type container_app_envelope: IO + :type container_app_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -1172,7 +1084,7 @@ def begin_update( self, resource_group_name: str, container_app_name: str, - container_app_envelope: Union[_models.ContainerApp, IO], + container_app_envelope: Union[_models.ContainerApp, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ContainerApp]: """Update properties of a Container App. @@ -1185,19 +1097,8 @@ def begin_update( :param container_app_name: Name of the Container App. Required. :type container_app_name: str :param container_app_envelope: Properties of a Container App that need to be updated. Is either - a ContainerApp type or a IO type. Required. - :type container_app_envelope: ~azure.mgmt.appcontainers.models.ContainerApp or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + a ContainerApp type or a IO[bytes] type. Required. + :type container_app_envelope: ~azure.mgmt.appcontainers.models.ContainerApp or IO[bytes] :return: An instance of LROPoller that returns either ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -1229,7 +1130,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ContainerApp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1239,17 +1140,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ContainerApp].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}" - } + return LROPoller[_models.ContainerApp]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_custom_host_name_analysis( @@ -1266,7 +1165,6 @@ def list_custom_host_name_analysis( :type container_app_name: str :param custom_hostname: Custom hostname. Default value is None. :type custom_hostname: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomHostnameAnalysisResult or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1285,22 +1183,21 @@ def list_custom_host_name_analysis( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CustomHostnameAnalysisResult] = kwargs.pop("cls", None) - request = build_list_custom_host_name_analysis_request( + _request = build_list_custom_host_name_analysis_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, custom_hostname=custom_hostname, api_version=api_version, - template_url=self.list_custom_host_name_analysis.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1313,13 +1210,9 @@ def list_custom_host_name_analysis( deserialized = self._deserialize("CustomHostnameAnalysisResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_custom_host_name_analysis.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis" - } + return deserialized # type: ignore @distributed_trace def list_secrets( @@ -1334,7 +1227,6 @@ def list_secrets( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SecretsCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.SecretsCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -1353,21 +1245,20 @@ def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SecretsCollection] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1380,13 +1271,9 @@ def list_secrets( deserialized = self._deserialize("SecretsCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listSecrets" - } + return deserialized # type: ignore @distributed_trace def get_auth_token( @@ -1401,7 +1288,6 @@ def get_auth_token( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ContainerAppAuthToken or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ContainerAppAuthToken :raises ~azure.core.exceptions.HttpResponseError: @@ -1420,40 +1306,35 @@ def get_auth_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ContainerAppAuthToken] = kwargs.pop("cls", None) - request = build_get_auth_token_request( + _request = build_get_auth_token_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_auth_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **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) + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ContainerAppAuthToken", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_auth_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/getAuthtoken" - } + return deserialized # type: ignore def _start_initial( self, resource_group_name: str, container_app_name: str, **kwargs: Any @@ -1472,21 +1353,20 @@ def _start_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) - request = build_start_request( + _request = build_start_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1505,13 +1385,9 @@ def _start_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/start" - } + return deserialized # type: ignore @distributed_trace def begin_start( @@ -1526,14 +1402,6 @@ def begin_start( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -1562,7 +1430,7 @@ def begin_start( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ContainerApp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1574,17 +1442,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ContainerApp].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/start" - } + return LROPoller[_models.ContainerApp]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _stop_initial( self, resource_group_name: str, container_app_name: str, **kwargs: Any @@ -1603,21 +1469,20 @@ def _stop_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ContainerApp]] = kwargs.pop("cls", None) - request = build_stop_request( + _request = build_stop_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1636,13 +1501,9 @@ def _stop_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/stop" - } + return deserialized # type: ignore @distributed_trace def begin_stop( @@ -1657,14 +1518,6 @@ def begin_stop( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerApp or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerApp] @@ -1693,7 +1546,7 @@ def begin_stop( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ContainerApp", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1705,14 +1558,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ContainerApp].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/stop" - } + return LROPoller[_models.ContainerApp]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py index 07d96073dab9..513cfd8687bd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -45,7 +45,7 @@ def build_get_replica_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_get_replica_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +80,7 @@ def build_list_replicas_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,7 @@ def build_list_replicas_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -144,7 +144,6 @@ def get_replica( :type revision_name: str :param replica_name: Name of the Container App Revision Replica. Required. :type replica_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Replica or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Replica :raises ~azure.core.exceptions.HttpResponseError: @@ -163,23 +162,22 @@ def get_replica( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Replica] = kwargs.pop("cls", None) - request = build_get_replica_request( + _request = build_get_replica_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, replica_name=replica_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_replica.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -192,13 +190,9 @@ def get_replica( deserialized = self._deserialize("Replica", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_replica.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{replicaName}" - } + return deserialized # type: ignore @distributed_trace def list_replicas( @@ -215,7 +209,6 @@ def list_replicas( :type container_app_name: str :param revision_name: Name of the Container App Revision. Required. :type revision_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ReplicaCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ReplicaCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -234,22 +227,21 @@ def list_replicas( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ReplicaCollection] = kwargs.pop("cls", None) - request = build_list_replicas_request( + _request = build_list_replicas_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_replicas.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -262,10 +254,6 @@ def list_replicas( deserialized = self._deserialize("ReplicaCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_replicas.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py index f3b824f57146..dbb59afb6558 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -47,7 +47,7 @@ def build_list_revisions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_revisions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -82,7 +82,7 @@ def build_get_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +91,7 @@ def build_get_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -116,7 +116,7 @@ def build_activate_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +125,7 @@ def build_activate_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/activate", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -150,7 +150,7 @@ def build_deactivate_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +159,7 @@ def build_deactivate_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/deactivate", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -184,7 +184,7 @@ def build_restart_revision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -193,7 +193,7 @@ def build_restart_revision_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/restart", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -246,7 +246,6 @@ def list_revisions( :type container_app_name: str :param filter: The filter to apply on the operation. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Revision or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Revision] :raises ~azure.core.exceptions.HttpResponseError: @@ -268,18 +267,17 @@ def list_revisions( def prepare_request(next_link=None): if not next_link: - request = build_list_revisions_request( + _request = build_list_revisions_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_revisions.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -291,13 +289,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("RevisionCollection", pipeline_response) @@ -307,11 +305,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,10 +322,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_revisions.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions" - } - @distributed_trace def get_revision( self, resource_group_name: str, container_app_name: str, revision_name: str, **kwargs: Any @@ -343,7 +337,6 @@ def get_revision( :type container_app_name: str :param revision_name: Name of the Container App Revision. Required. :type revision_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Revision or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Revision :raises ~azure.core.exceptions.HttpResponseError: @@ -362,22 +355,21 @@ def get_revision( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Revision] = kwargs.pop("cls", None) - request = build_get_revision_request( + _request = build_get_revision_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_revision.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -390,13 +382,9 @@ def get_revision( deserialized = self._deserialize("Revision", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_revision.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}" - } + return deserialized # type: ignore @distributed_trace def activate_revision( # pylint: disable=inconsistent-return-statements @@ -413,7 +401,6 @@ def activate_revision( # pylint: disable=inconsistent-return-statements :type container_app_name: str :param revision_name: Name of the Container App Revision. Required. :type revision_name: str - :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: @@ -432,22 +419,21 @@ def activate_revision( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_activate_revision_request( + _request = build_activate_revision_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.activate_revision.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -458,11 +444,7 @@ def activate_revision( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - activate_revision.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/activate" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def deactivate_revision( # pylint: disable=inconsistent-return-statements @@ -479,7 +461,6 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements :type container_app_name: str :param revision_name: Name of the Container App Revision. Required. :type revision_name: str - :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: @@ -498,22 +479,21 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_deactivate_revision_request( + _request = build_deactivate_revision_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.deactivate_revision.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -524,11 +504,7 @@ def deactivate_revision( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - deactivate_revision.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/deactivate" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def restart_revision( # pylint: disable=inconsistent-return-statements @@ -545,7 +521,6 @@ def restart_revision( # pylint: disable=inconsistent-return-statements :type container_app_name: str :param revision_name: Name of the Container App Revision. Required. :type revision_name: str - :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: @@ -564,22 +539,21 @@ def restart_revision( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_restart_revision_request( + _request = build_restart_revision_request( resource_group_name=resource_group_name, container_app_name=container_app_name, revision_name=revision_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.restart_revision.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -590,8 +564,4 @@ def restart_revision( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - restart_revision.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/restart" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py index b63b5e798db5..5c56850d64f3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -45,7 +45,7 @@ def build_list_by_container_app_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_list_by_container_app_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -78,7 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +87,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -112,7 +112,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -122,7 +122,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,7 +149,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +158,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -209,7 +209,6 @@ def list_by_container_app( :type resource_group_name: str :param container_app_name: Name of the Container App. Required. :type container_app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SourceControl or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.SourceControl] :raises ~azure.core.exceptions.HttpResponseError: @@ -231,17 +230,16 @@ def list_by_container_app( def prepare_request(next_link=None): if not next_link: - request = build_list_by_container_app_request( + _request = build_list_by_container_app_request( resource_group_name=resource_group_name, container_app_name=container_app_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_container_app.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -253,13 +251,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("SourceControlCollection", pipeline_response) @@ -269,11 +267,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -286,10 +284,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_container_app.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols" - } - @distributed_trace def get( self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any @@ -305,7 +299,6 @@ def get( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControl or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.SourceControl :raises ~azure.core.exceptions.HttpResponseError: @@ -324,22 +317,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SourceControl] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -352,20 +344,16 @@ def get( deserialized = self._deserialize("SourceControl", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, container_app_name: str, source_control_name: str, - source_control_envelope: Union[_models.SourceControl, IO], + source_control_envelope: Union[_models.SourceControl, IO[bytes]], **kwargs: Any ) -> _models.SourceControl: error_map = { @@ -391,7 +379,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(source_control_envelope, "SourceControl") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, @@ -400,16 +388,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,10 +417,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" - } - @overload def begin_create_or_update( self, @@ -462,14 +445,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 SourceControl or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SourceControl] @@ -482,7 +457,7 @@ def begin_create_or_update( resource_group_name: str, container_app_name: str, source_control_name: str, - source_control_envelope: IO, + source_control_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -500,18 +475,10 @@ def begin_create_or_update( :type source_control_name: str :param source_control_envelope: Properties used to create a Container App SourceControl. Required. - :type source_control_envelope: IO + :type source_control_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 SourceControl or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SourceControl] @@ -524,7 +491,7 @@ def begin_create_or_update( resource_group_name: str, container_app_name: str, source_control_name: str, - source_control_envelope: Union[_models.SourceControl, IO], + source_control_envelope: Union[_models.SourceControl, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.SourceControl]: """Create or update the SourceControl for a Container App. @@ -539,19 +506,8 @@ def begin_create_or_update( :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str :param source_control_envelope: Properties used to create a Container App SourceControl. Is - either a SourceControl type or a IO type. Required. - :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + either a SourceControl type or a IO[bytes] type. Required. + :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl or IO[bytes] :return: An instance of LROPoller that returns either SourceControl or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SourceControl] @@ -584,7 +540,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("SourceControl", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -594,17 +550,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.SourceControl].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" - } + return LROPoller[_models.SourceControl]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, container_app_name: str, source_control_name: str, **kwargs: Any @@ -623,22 +577,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, container_app_name=container_app_name, source_control_name=source_control_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -649,11 +602,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete( @@ -670,14 +619,6 @@ def begin_delete( :type container_app_name: str :param source_control_name: Name of the Container App SourceControl. Required. :type source_control_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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: @@ -705,7 +646,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -714,14 +655,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{sourceControlName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py new file mode 100644 index 000000000000..8651964a9c97 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_component_resiliency_policies_operations.py @@ -0,0 +1,589 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _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( + resource_group_name: str, environment_name: str, component_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, environment_name: str, component_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, component_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, component_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/resiliencyPolicies/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "componentName": _SERIALIZER.url("component_name", component_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DaprComponentResiliencyPoliciesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dapr_component_resiliency_policies` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, component_name: str, **kwargs: Any + ) -> Iterable["_models.DaprComponentResiliencyPolicy"]: + """Get the resiliency policies for a Dapr component. + + Get the resiliency policies for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :return: An iterator like instance of either DaprComponentResiliencyPolicy or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprComponentResiliencyPoliciesCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("DaprComponentResiliencyPoliciesCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Get a Dapr component resiliency policy. + + Get a Dapr component resiliency policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: _models.DaprComponentResiliencyPolicy, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Required. + :type dapr_component_resiliency_policy_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + component_name: str, + name: str, + dapr_component_resiliency_policy_envelope: Union[_models.DaprComponentResiliencyPolicy, IO[bytes]], + **kwargs: Any + ) -> _models.DaprComponentResiliencyPolicy: + """Creates or updates a Dapr component resiliency policy. + + Creates or updates a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :param dapr_component_resiliency_policy_envelope: Configuration details of the Dapr Component + Resiliency Policy. Is either a DaprComponentResiliencyPolicy type or a IO[bytes] type. + Required. + :type dapr_component_resiliency_policy_envelope: + ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy or IO[bytes] + :return: DaprComponentResiliencyPolicy or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponentResiliencyPolicy + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DaprComponentResiliencyPolicy] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_component_resiliency_policy_envelope, (IOBase, bytes)): + _content = dapr_component_resiliency_policy_envelope + else: + _json = self._serialize.body(dapr_component_resiliency_policy_envelope, "DaprComponentResiliencyPolicy") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DaprComponentResiliencyPolicy", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, component_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr component resiliency policy. + + Delete a resiliency policy for a Dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param component_name: Name of the Dapr Component. Required. + :type component_name: str + :param name: Name of the Dapr Component Resiliency Policy. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + component_name=component_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py index 13bdf064e305..6185be9c9fbe 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +52,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -76,7 +76,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -110,7 +110,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -120,7 +120,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -147,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -181,7 +181,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +190,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -239,7 +239,6 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - :type resource_group_name: str :param environment_name: Name of the Managed Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DaprComponent or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprComponent] :raises ~azure.core.exceptions.HttpResponseError: @@ -261,17 +260,16 @@ def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) - def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -283,13 +281,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("DaprComponentsCollection", pipeline_response) @@ -299,11 +297,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -316,10 +314,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents" - } - @distributed_trace def get( self, resource_group_name: str, environment_name: str, component_name: str, **kwargs: Any @@ -335,7 +329,6 @@ def get( :type environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -354,22 +347,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprComponent] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, environment_name=environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -382,13 +374,9 @@ def get( deserialized = self._deserialize("DaprComponent", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -417,7 +405,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -429,7 +416,7 @@ def create_or_update( resource_group_name: str, environment_name: str, component_name: str, - dapr_component_envelope: IO, + dapr_component_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -446,11 +433,10 @@ def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Required. - :type dapr_component_envelope: IO + :type dapr_component_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -462,7 +448,7 @@ def create_or_update( resource_group_name: str, environment_name: str, component_name: str, - dapr_component_envelope: Union[_models.DaprComponent, IO], + dapr_component_envelope: Union[_models.DaprComponent, IO[bytes]], **kwargs: Any ) -> _models.DaprComponent: """Creates or updates a Dapr Component. @@ -477,12 +463,8 @@ def create_or_update( :param component_name: Name of the Dapr Component. Required. :type component_name: str :param dapr_component_envelope: Configuration details of the Dapr Component. Is either a - DaprComponent type or a IO type. Required. - :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + DaprComponent type or a IO[bytes] type. Required. + :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent or IO[bytes] :return: DaprComponent or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprComponent :raises ~azure.core.exceptions.HttpResponseError: @@ -510,7 +492,7 @@ def create_or_update( else: _json = self._serialize.body(dapr_component_envelope, "DaprComponent") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, environment_name=environment_name, component_name=component_name, @@ -519,16 +501,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -541,13 +522,9 @@ def create_or_update( deserialized = self._deserialize("DaprComponent", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -564,7 +541,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :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: @@ -583,22 +559,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, environment_name=environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -609,11 +584,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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.App/managedEnvironments/{environmentName}/daprComponents/{componentName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_secrets( @@ -630,7 +601,6 @@ def list_secrets( :type environment_name: str :param component_name: Name of the Dapr Component. Required. :type component_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DaprSecretsCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -649,22 +619,21 @@ def list_secrets( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DaprSecretsCollection] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, environment_name=environment_name, component_name=component_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -677,10 +646,6 @@ def list_secrets( deserialized = self._deserialize("DaprSecretsCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{componentName}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py new file mode 100644 index 000000000000..8b2488ce964a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_subscriptions_operations.py @@ -0,0 +1,560 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _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( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DaprSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dapr_subscriptions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.DaprSubscription"]: + """Get the Dapr subscriptions for a managed environment. + + Get the Dapr subscriptions for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either DaprSubscription or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprSubscriptionsCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("DaprSubscriptionsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> _models.DaprSubscription: + """Get a dapr subscription. + + Get a dapr subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DaprSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: _models.DaprSubscription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Required. + :type dapr_subscription_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_subscription_envelope: Union[_models.DaprSubscription, IO[bytes]], + **kwargs: Any + ) -> _models.DaprSubscription: + """Creates or updates a Dapr subscription. + + Creates or updates a Dapr subscription in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :param dapr_subscription_envelope: Configuration details of the Dapr subscription. Is either a + DaprSubscription type or a IO[bytes] type. Required. + :type dapr_subscription_envelope: ~azure.mgmt.appcontainers.models.DaprSubscription or + IO[bytes] + :return: DaprSubscription or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DaprSubscription] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dapr_subscription_envelope, (IOBase, bytes)): + _content = dapr_subscription_envelope + else: + _json = self._serialize.body(dapr_subscription_envelope, "DaprSubscription") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("DaprSubscription", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DaprSubscription", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> None: + """Delete a Dapr subscription. + + Delete a Dapr subscription from a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Dapr subscription. Required. + :type name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py new file mode 100644 index 000000000000..eb95db3a3c78 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dot_net_components_operations.py @@ -0,0 +1,917 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _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( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/dotNetComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class DotNetComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`dot_net_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, environment_name: str, **kwargs: Any + ) -> Iterable["_models.DotNetComponent"]: + """Get the .NET Components for a managed environment. + + Get the .NET Components for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either DotNetComponent or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponentsCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("DotNetComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def get(self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any) -> _models.DotNetComponent: + """Get a .NET Component. + + Get a .NET Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :return: DotNetComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DotNetComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("DotNetComponent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> _models.DotNetComponent: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("DotNetComponent", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("DotNetComponent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Creates or updates a .NET Component. + + Creates or updates a .NET Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.DotNetComponent]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.DotNetComponent]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(dot_net_component_envelope, (IOBase, bytes)): + _content = dot_net_component_envelope + else: + _json = self._serialize.body(dot_net_component_envelope, "DotNetComponent") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("DotNetComponent", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: _models.DotNetComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Required. + :type dot_net_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dot_net_component_envelope: Union[_models.DotNetComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DotNetComponent]: + """Update properties of a .NET Component. + + Patches a .NET Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :param dot_net_component_envelope: Configuration details of the .NET Component. Is either a + DotNetComponent type or a IO[bytes] type. Required. + :type dot_net_component_envelope: ~azure.mgmt.appcontainers.models.DotNetComponent or IO[bytes] + :return: An instance of LROPoller that returns either DotNetComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.DotNetComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DotNetComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + dot_net_component_envelope=dot_net_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DotNetComponent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DotNetComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DotNetComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a .NET Component. + + Delete a .NET Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the .NET Component. Required. + :type name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py new file mode 100644 index 000000000000..46f755fed0e0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_java_components_operations.py @@ -0,0 +1,915 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _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( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, environment_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/javaComponents/{name}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class JavaComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`java_components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> Iterable["_models.JavaComponent"]: + """Get the Java Components for a managed environment. + + Get the Java Components for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :return: An iterator like instance of either JavaComponent or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.JavaComponentsCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("JavaComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def get(self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any) -> _models.JavaComponent: + """Get a Java Component. + + Get a Java Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :return: JavaComponent or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.JavaComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("JavaComponent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> _models.JavaComponent: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(java_component_envelope, (IOBase, bytes)): + _content = java_component_envelope + else: + _json = self._serialize.body(java_component_envelope, "JavaComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("JavaComponent", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("JavaComponent", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: _models.JavaComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Creates or updates a Java Component. + + Creates or updates a Java Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Is either a + JavaComponent type or a IO[bytes] type. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + java_component_envelope=java_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JavaComponent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.JavaComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.JavaComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> Optional[_models.JavaComponent]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.JavaComponent]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(java_component_envelope, (IOBase, bytes)): + _content = java_component_envelope + else: + _json = self._serialize.body(java_component_envelope, "JavaComponent") + + _request = build_update_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("JavaComponent", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: _models.JavaComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Required. + :type java_component_envelope: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + java_component_envelope: Union[_models.JavaComponent, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.JavaComponent]: + """Update properties of a Java Component. + + Patches a Java Component using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :param java_component_envelope: Configuration details of the Java Component. Is either a + JavaComponent type or a IO[bytes] type. Required. + :type java_component_envelope: ~azure.mgmt.appcontainers.models.JavaComponent or IO[bytes] + :return: An instance of LROPoller that returns either JavaComponent or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JavaComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JavaComponent] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + java_component_envelope=java_component_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("JavaComponent", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.JavaComponent].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.JavaComponent]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, environment_name: str, name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Java Component. + + Delete a Java Component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. Required. + :type environment_name: str + :param name: Name of the Java Component. Required. + :type name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py index 8fb796cc10bb..eee36884768a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_executions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -42,7 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +51,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -105,7 +105,6 @@ def list( :type job_name: str :param filter: The filter to apply on the operation. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobExecution or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.JobExecution] :raises ~azure.core.exceptions.HttpResponseError: @@ -127,18 +126,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -150,13 +148,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ContainerAppJobExecutions", pipeline_response) @@ -166,11 +164,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,7 +180,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions" - } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py index 8c365448a72c..9ad72330b0e7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_jobs_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -39,17 +39,119 @@ _SERIALIZER.client_side_validation = False +def build_list_detectors_request( + resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_detector_request( + resource_group_name: str, job_name: str, detector_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectors/{detectorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "detectorName": _SERIALIZER.url("detector_name", detector_name, "str", pattern=r"^[-\w\._\(\)]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_proxy_get_request( + resource_group_name: str, job_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_name: Literal["rootApi"] = kwargs.pop("api_name", "rootApi") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/detectorProperties/{apiName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "jobName": _SERIALIZER.url("job_name", job_name, "str", pattern=r"^[-\w\._\(\)]+$"), + "apiName": _SERIALIZER.url("api_name", api_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/jobs") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,7 +169,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +178,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -97,7 +199,7 @@ def build_get_request(resource_group_name: str, job_name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +208,7 @@ def build_get_request(resource_group_name: str, job_name: str, subscription_id: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -130,7 +232,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -140,7 +242,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -164,7 +266,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -173,7 +275,7 @@ def build_delete_request(resource_group_name: str, job_name: str, subscription_i "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -195,7 +297,7 @@ def build_update_request(resource_group_name: str, job_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -205,7 +307,7 @@ def build_update_request(resource_group_name: str, job_name: str, subscription_i "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -229,7 +331,7 @@ def build_start_request(resource_group_name: str, job_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -239,7 +341,7 @@ def build_start_request(resource_group_name: str, job_name: str, subscription_id "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/start", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -265,7 +367,7 @@ def build_stop_execution_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +376,7 @@ def build_stop_execution_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -301,7 +403,7 @@ def build_stop_multiple_executions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +412,7 @@ def build_stop_multiple_executions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -334,7 +436,7 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -343,7 +445,7 @@ def build_list_secrets_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/listSecrets", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -380,13 +482,196 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list_detectors(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.DiagnosticsCollection: + """Get the list of diagnostics for a given Container App Job. + + Get the list of diagnostics for a Container App Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :return: DiagnosticsCollection or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) + + _request = build_list_detectors_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_detector( + self, resource_group_name: str, job_name: str, detector_name: str, **kwargs: Any + ) -> _models.Diagnostics: + """Get the diagnostics data for a given Container App Job. + + Get the diagnostics data for a Container App Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :param detector_name: Name of the Container App Job detector. Required. + :type detector_name: str + :return: Diagnostics or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Diagnostics + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Diagnostics] = kwargs.pop("cls", None) + + _request = build_get_detector_request( + resource_group_name=resource_group_name, + job_name=job_name, + detector_name=detector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Diagnostics", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def proxy_get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.Job: + """Get the properties for a given Container App Job. + + Get the properties of a Container App Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param job_name: Job Name. Required. + :type job_name: str + :return: Job or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Job + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_name: Literal["rootApi"] = kwargs.pop("api_name", "rootApi") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Job] = kwargs.pop("cls", None) + + _request = build_proxy_get_request( + resource_group_name=resource_group_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_name=api_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Job", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Job"]: """Get the Container Apps Jobs in a given subscription. Get the Container Apps Jobs in a given subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Job or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -408,15 +693,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Job"]: def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -428,13 +712,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("JobsCollection", pipeline_response) @@ -444,11 +728,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -461,8 +745,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/jobs"} - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Job"]: """Get the Container Apps Jobs in a given resource group. @@ -472,7 +754,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Job or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -494,16 +775,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -515,13 +795,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("JobsCollection", pipeline_response) @@ -531,11 +811,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,10 +828,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs" - } - @distributed_trace def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.Job: """Get the properties of a Container Apps Job. @@ -563,7 +839,6 @@ def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Job or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Job :raises ~azure.core.exceptions.HttpResponseError: @@ -582,21 +857,20 @@ def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Job] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -609,16 +883,12 @@ def get(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models deserialized = self._deserialize("Job", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } + return deserialized # type: ignore def _create_or_update_initial( - self, resource_group_name: str, job_name: str, job_envelope: Union[_models.Job, IO], **kwargs: Any + self, resource_group_name: str, job_name: str, job_envelope: Union[_models.Job, IO[bytes]], **kwargs: Any ) -> _models.Job: error_map = { 401: ClientAuthenticationError, @@ -643,7 +913,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(job_envelope, "Job") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, @@ -651,16 +921,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -681,10 +950,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } - @overload def begin_create_or_update( self, @@ -709,14 +974,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 Job or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -727,7 +984,7 @@ def begin_create_or_update( self, resource_group_name: str, job_name: str, - job_envelope: IO, + job_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -742,18 +999,10 @@ def begin_create_or_update( :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Required. - :type job_envelope: IO + :type job_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 Job or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -761,7 +1010,7 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, job_name: str, job_envelope: Union[_models.Job, IO], **kwargs: Any + self, resource_group_name: str, job_name: str, job_envelope: Union[_models.Job, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Job]: """Create or Update a Container Apps Job. @@ -773,19 +1022,8 @@ def begin_create_or_update( :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Is either a Job type or a - IO type. Required. - :type job_envelope: ~azure.mgmt.appcontainers.models.Job or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + IO[bytes] type. Required. + :type job_envelope: ~azure.mgmt.appcontainers.models.Job or IO[bytes] :return: An instance of LROPoller that returns either Job or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -816,7 +1054,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Job", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -828,17 +1066,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Job].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } + return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, **kwargs: Any @@ -857,21 +1091,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -886,11 +1119,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) -> LROPoller[None]: @@ -903,14 +1132,6 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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: @@ -937,7 +1158,7 @@ def begin_delete(self, resource_group_name: str, job_name: str, **kwargs: Any) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -948,23 +1169,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _update_initial( self, resource_group_name: str, job_name: str, - job_envelope: Union[_models.JobPatchProperties, IO], + job_envelope: Union[_models.JobPatchProperties, IO[bytes]], **kwargs: Any ) -> Optional[_models.Job]: error_map = { @@ -990,7 +1207,7 @@ def _update_initial( else: _json = self._serialize.body(job_envelope, "JobPatchProperties") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, @@ -998,16 +1215,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1026,13 +1242,9 @@ def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -1058,14 +1270,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 Job or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -1076,7 +1280,7 @@ def begin_update( self, resource_group_name: str, job_name: str, - job_envelope: IO, + job_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1091,18 +1295,10 @@ def begin_update( :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Required. - :type job_envelope: IO + :type job_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 Job or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -1113,7 +1309,7 @@ def begin_update( self, resource_group_name: str, job_name: str, - job_envelope: Union[_models.JobPatchProperties, IO], + job_envelope: Union[_models.JobPatchProperties, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Job]: """Update properties of a Container Apps Job. @@ -1126,19 +1322,8 @@ def begin_update( :param job_name: Job Name. Required. :type job_name: str :param job_envelope: Properties used to create a container apps job. Is either a - JobPatchProperties type or a IO type. Required. - :type job_envelope: ~azure.mgmt.appcontainers.models.JobPatchProperties or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + JobPatchProperties type or a IO[bytes] type. Required. + :type job_envelope: ~azure.mgmt.appcontainers.models.JobPatchProperties or IO[bytes] :return: An instance of LROPoller that returns either Job or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.Job] :raises ~azure.core.exceptions.HttpResponseError: @@ -1169,7 +1354,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Job", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1179,23 +1364,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Job].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}" - } + return LROPoller[_models.Job](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _start_initial( self, resource_group_name: str, job_name: str, - template: Optional[Union[_models.JobExecutionTemplate, IO]] = None, + template: Optional[Union[_models.JobExecutionTemplate, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.JobExecutionBase]: error_map = { @@ -1224,7 +1405,7 @@ def _start_initial( else: _json = None - request = build_start_request( + _request = build_start_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, @@ -1232,16 +1413,15 @@ def _start_initial( content_type=content_type, json=_json, content=_content, - template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1260,13 +1440,9 @@ def _start_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/start" - } + return deserialized # type: ignore @overload def begin_start( @@ -1292,14 +1468,6 @@ def begin_start( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 JobExecutionBase or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JobExecutionBase] @@ -1311,7 +1479,7 @@ def begin_start( self, resource_group_name: str, job_name: str, - template: Optional[IO] = None, + template: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1326,18 +1494,10 @@ def begin_start( :param job_name: Job Name. Required. :type job_name: str :param template: Properties used to start a job execution. Default value is None. - :type template: IO + :type template: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 JobExecutionBase or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JobExecutionBase] @@ -1349,7 +1509,7 @@ def begin_start( self, resource_group_name: str, job_name: str, - template: Optional[Union[_models.JobExecutionTemplate, IO]] = None, + template: Optional[Union[_models.JobExecutionTemplate, IO[bytes]]] = None, **kwargs: Any ) -> LROPoller[_models.JobExecutionBase]: """Start a Container Apps Job. @@ -1362,19 +1522,8 @@ def begin_start( :param job_name: Job Name. Required. :type job_name: str :param template: Properties used to start a job execution. Is either a JobExecutionTemplate - type or a IO type. Default value is None. - :type template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + type or a IO[bytes] type. Default value is None. + :type template: ~azure.mgmt.appcontainers.models.JobExecutionTemplate or IO[bytes] :return: An instance of LROPoller that returns either JobExecutionBase or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.JobExecutionBase] @@ -1406,7 +1555,7 @@ def begin_start( def get_long_running_output(pipeline_response): deserialized = self._deserialize("JobExecutionBase", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1418,17 +1567,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.JobExecutionBase].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/start" - } + return LROPoller[_models.JobExecutionBase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _stop_execution_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, job_name: str, job_execution_name: str, **kwargs: Any @@ -1447,22 +1594,21 @@ def _stop_execution_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_stop_execution_request( + _request = build_stop_execution_request( resource_group_name=resource_group_name, job_name=job_name, job_execution_name=job_execution_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_execution_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1477,11 +1623,7 @@ def _stop_execution_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _stop_execution_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}/stop" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_stop_execution( @@ -1498,14 +1640,6 @@ def begin_stop_execution( :type job_name: str :param job_execution_name: Job execution name. Required. :type job_execution_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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: @@ -1533,7 +1667,7 @@ def begin_stop_execution( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1544,17 +1678,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop_execution.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/executions/{jobExecutionName}/stop" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _stop_multiple_executions_initial( self, resource_group_name: str, job_name: str, **kwargs: Any @@ -1573,21 +1703,20 @@ def _stop_multiple_executions_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.ContainerAppJobExecutions]] = kwargs.pop("cls", None) - request = build_stop_multiple_executions_request( + _request = build_stop_multiple_executions_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._stop_multiple_executions_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1606,13 +1735,9 @@ def _stop_multiple_executions_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _stop_multiple_executions_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop" - } + return deserialized # type: ignore @distributed_trace def begin_stop_multiple_executions( @@ -1627,14 +1752,6 @@ def begin_stop_multiple_executions( :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ContainerAppJobExecutions or the result of cls(response) :rtype: @@ -1664,7 +1781,7 @@ def begin_stop_multiple_executions( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ContainerAppJobExecutions", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1676,17 +1793,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ContainerAppJobExecutions].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop_multiple_executions.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/stop" - } + return LROPoller[_models.ContainerAppJobExecutions]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) -> _models.JobSecretsCollection: @@ -1699,7 +1814,6 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - :type resource_group_name: str :param job_name: Job Name. Required. :type job_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: JobSecretsCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.JobSecretsCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -1718,21 +1832,20 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobSecretsCollection] = kwargs.pop("cls", None) - request = build_list_secrets_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, job_name=job_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1745,10 +1858,6 @@ def list_secrets(self, resource_group_name: str, job_name: str, **kwargs: Any) - deserialized = self._deserialize("JobSecretsCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/jobs/{jobName}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py index fae571bdf1bf..1d0a9bdec49f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_certificates_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -45,7 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +54,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -79,7 +79,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -89,7 +89,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -116,7 +116,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +125,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -150,7 +150,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -160,7 +160,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -187,7 +187,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -196,7 +196,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -248,7 +248,6 @@ def get( :type environment_name: str :param managed_certificate_name: Name of the Managed Certificate. Required. :type managed_certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedCertificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: @@ -267,22 +266,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedCertificate] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, environment_name=environment_name, managed_certificate_name=managed_certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,20 +293,16 @@ def get( deserialized = self._deserialize("ManagedCertificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, environment_name: str, managed_certificate_name: str, - managed_certificate_envelope: Optional[Union[_models.ManagedCertificate, IO]] = None, + managed_certificate_envelope: Optional[Union[_models.ManagedCertificate, IO[bytes]]] = None, **kwargs: Any ) -> _models.ManagedCertificate: error_map = { @@ -338,7 +332,7 @@ def _create_or_update_initial( else: _json = None - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, environment_name=environment_name, managed_certificate_name=managed_certificate_name, @@ -347,16 +341,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,10 +370,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" - } - @overload def begin_create_or_update( self, @@ -409,14 +398,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ManagedCertificate or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ManagedCertificate] @@ -429,7 +410,7 @@ def begin_create_or_update( resource_group_name: str, environment_name: str, managed_certificate_name: str, - managed_certificate_envelope: Optional[IO] = None, + managed_certificate_envelope: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -447,18 +428,10 @@ def begin_create_or_update( :type managed_certificate_name: str :param managed_certificate_envelope: Managed Certificate to be created or updated. Default value is None. - :type managed_certificate_envelope: IO + :type managed_certificate_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ManagedCertificate or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ManagedCertificate] @@ -471,7 +444,7 @@ def begin_create_or_update( resource_group_name: str, environment_name: str, managed_certificate_name: str, - managed_certificate_envelope: Optional[Union[_models.ManagedCertificate, IO]] = None, + managed_certificate_envelope: Optional[Union[_models.ManagedCertificate, IO[bytes]]] = None, **kwargs: Any ) -> LROPoller[_models.ManagedCertificate]: """Create or Update a Managed Certificate. @@ -486,19 +459,9 @@ def begin_create_or_update( :param managed_certificate_name: Name of the Managed Certificate. Required. :type managed_certificate_name: str :param managed_certificate_envelope: Managed Certificate to be created or updated. Is either a - ManagedCertificate type or a IO type. Default value is None. - :type managed_certificate_envelope: ~azure.mgmt.appcontainers.models.ManagedCertificate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + ManagedCertificate type or a IO[bytes] type. Default value is None. + :type managed_certificate_envelope: ~azure.mgmt.appcontainers.models.ManagedCertificate or + IO[bytes] :return: An instance of LROPoller that returns either ManagedCertificate or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ManagedCertificate] @@ -531,7 +494,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ManagedCertificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -543,17 +506,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ManagedCertificate].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" - } + return LROPoller[_models.ManagedCertificate]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -570,7 +531,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type environment_name: str :param managed_certificate_name: Name of the Managed Certificate. Required. :type managed_certificate_name: str - :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: @@ -589,22 +549,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, environment_name=environment_name, managed_certificate_name=managed_certificate_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -615,11 +574,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def update( @@ -649,7 +604,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedCertificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: @@ -661,7 +615,7 @@ def update( resource_group_name: str, environment_name: str, managed_certificate_name: str, - managed_certificate_envelope: IO, + managed_certificate_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -679,11 +633,10 @@ def update( :type managed_certificate_name: str :param managed_certificate_envelope: Properties of a managed certificate that need to be updated. Required. - :type managed_certificate_envelope: IO + :type managed_certificate_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedCertificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: @@ -695,7 +648,7 @@ def update( resource_group_name: str, environment_name: str, managed_certificate_name: str, - managed_certificate_envelope: Union[_models.ManagedCertificatePatch, IO], + managed_certificate_envelope: Union[_models.ManagedCertificatePatch, IO[bytes]], **kwargs: Any ) -> _models.ManagedCertificate: """Update tags of a managed certificate. @@ -710,13 +663,9 @@ def update( :param managed_certificate_name: Name of the Managed Certificate. Required. :type managed_certificate_name: str :param managed_certificate_envelope: Properties of a managed certificate that need to be - updated. Is either a ManagedCertificatePatch type or a IO type. Required. + updated. Is either a ManagedCertificatePatch type or a IO[bytes] type. Required. :type managed_certificate_envelope: ~azure.mgmt.appcontainers.models.ManagedCertificatePatch or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: ManagedCertificate or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedCertificate :raises ~azure.core.exceptions.HttpResponseError: @@ -744,7 +693,7 @@ def update( else: _json = self._serialize.body(managed_certificate_envelope, "ManagedCertificatePatch") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, environment_name=environment_name, managed_certificate_name=managed_certificate_name, @@ -753,16 +702,15 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -775,13 +723,9 @@ def update( deserialized = self._deserialize("ManagedCertificate", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates/{managedCertificateName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -796,7 +740,6 @@ def list( :type resource_group_name: str :param environment_name: Name of the Managed Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ManagedCertificate or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ManagedCertificate] :raises ~azure.core.exceptions.HttpResponseError: @@ -818,17 +761,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -840,13 +782,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ManagedCertificateCollection", pipeline_response) @@ -856,11 +798,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -872,7 +814,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/managedCertificates" - } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py index d1bcbc91fd4b..36671189de6e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_diagnostics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,7 +40,7 @@ def build_list_detectors_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_list_detectors_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -73,7 +73,7 @@ def build_get_detector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +82,7 @@ def build_get_detector_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -133,7 +133,6 @@ def list_detectors( :type resource_group_name: str :param environment_name: Name of the Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DiagnosticsCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.DiagnosticsCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -152,21 +151,20 @@ def list_detectors( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DiagnosticsCollection] = kwargs.pop("cls", None) - request = build_list_detectors_request( + _request = build_list_detectors_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_detectors.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,13 +177,9 @@ def list_detectors( deserialized = self._deserialize("DiagnosticsCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_detectors.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors" - } + return deserialized # type: ignore @distributed_trace def get_detector( @@ -202,7 +196,6 @@ def get_detector( :type environment_name: str :param detector_name: Name of the Managed Environment detector. Required. :type detector_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Diagnostics or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.Diagnostics :raises ~azure.core.exceptions.HttpResponseError: @@ -221,22 +214,21 @@ def get_detector( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Diagnostics] = kwargs.pop("cls", None) - request = build_get_detector_request( + _request = build_get_detector_request( resource_group_name=resource_group_name, environment_name=environment_name, detector_name=detector_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_detector.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -249,10 +241,6 @@ def get_detector( deserialized = self._deserialize("Diagnostics", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_detector.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectors/{detectorName}" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py new file mode 100644 index 000000000000..82dec27ebb0a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environment_usages_operations.py @@ -0,0 +1,173 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _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( + resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/usages", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str", pattern=r"^[-\w\._]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ManagedEnvironmentUsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`managed_environment_usages` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> Iterable["_models.Usage"]: + """Gets the current usage information as well as the limits for environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param environment_name: Name of the Environment. Required. + :type environment_name: str + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("ListUsagesResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py index c3f01b2462f7..077dcd413feb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_diagnostics_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,7 +40,7 @@ def build_get_root_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -49,7 +49,7 @@ def build_get_root_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorProperties/rootApi/", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -97,7 +97,6 @@ def get_root(self, resource_group_name: str, environment_name: str, **kwargs: An :type resource_group_name: str :param environment_name: Name of the Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironment or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises ~azure.core.exceptions.HttpResponseError: @@ -116,21 +115,20 @@ def get_root(self, resource_group_name: str, environment_name: str, **kwargs: An api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironment] = kwargs.pop("cls", None) - request = build_get_root_request( + _request = build_get_root_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_root.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -143,10 +141,6 @@ def get_root(self, resource_group_name: str, environment_name: str, **kwargs: An deserialized = self._deserialize("ManagedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_root.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/detectorProperties/rootApi/" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py index 79a74f4d0ccc..4d29d04b1a48 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,13 +43,13 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,7 +67,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -99,7 +99,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +108,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -132,7 +132,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +142,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -168,7 +168,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -177,7 +177,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -201,7 +201,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -211,7 +211,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -237,7 +237,7 @@ def build_get_auth_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +246,7 @@ def build_get_auth_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/getAuthtoken", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -264,13 +264,13 @@ def build_get_auth_token_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_workload_profile_states_request( +def build_list_workload_profile_states_request( # pylint: disable=name-too-long resource_group_name: str, environment_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -279,7 +279,7 @@ def build_list_workload_profile_states_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/workloadProfileStates", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -322,7 +322,6 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ManagedEnviro Get all Managed Environments for a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ManagedEnvironment] :raises ~azure.core.exceptions.HttpResponseError: @@ -344,15 +343,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ManagedEnviro def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -364,13 +362,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ManagedEnvironmentsCollection", pipeline_response) @@ -380,11 +378,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -397,10 +395,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments" - } - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedEnvironment"]: """Get all the Environments in a resource group. @@ -410,7 +404,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ManagedEnvironment] :raises ~azure.core.exceptions.HttpResponseError: @@ -432,16 +425,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -453,13 +445,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("ManagedEnvironmentsCollection", pipeline_response) @@ -469,11 +461,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -486,10 +478,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments" - } - @distributed_trace def get(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> _models.ManagedEnvironment: """Get the properties of a Managed Environment. @@ -501,7 +489,6 @@ def get(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> :type resource_group_name: str :param environment_name: Name of the Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironment or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment :raises ~azure.core.exceptions.HttpResponseError: @@ -520,21 +507,20 @@ def get(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironment] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -547,19 +533,15 @@ def get(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> deserialized = self._deserialize("ManagedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, environment_name: str, - environment_envelope: Union[_models.ManagedEnvironment, IO], + environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any ) -> _models.ManagedEnvironment: error_map = { @@ -585,7 +567,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(environment_envelope, "ManagedEnvironment") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, @@ -593,16 +575,15 @@ def _create_or_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -623,10 +604,6 @@ def _create_or_update_initial( return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } - @overload def begin_create_or_update( self, @@ -651,14 +628,6 @@ def begin_create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -670,7 +639,7 @@ def begin_create_or_update( self, resource_group_name: str, environment_name: str, - environment_envelope: IO, + environment_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -685,18 +654,10 @@ def begin_create_or_update( :param environment_name: Name of the Environment. Required. :type environment_name: str :param environment_envelope: Configuration details of the Environment. Required. - :type environment_envelope: IO + :type environment_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -708,7 +669,7 @@ def begin_create_or_update( self, resource_group_name: str, environment_name: str, - environment_envelope: Union[_models.ManagedEnvironment, IO], + environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ManagedEnvironment]: """Creates or updates a Managed Environment. @@ -721,19 +682,8 @@ def begin_create_or_update( :param environment_name: Name of the Environment. Required. :type environment_name: str :param environment_envelope: Configuration details of the Environment. Is either a - ManagedEnvironment type or a IO type. Required. - :type environment_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironment or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + ManagedEnvironment type or a IO[bytes] type. Required. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironment or IO[bytes] :return: An instance of LROPoller that returns either ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -765,7 +715,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ManagedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -775,17 +725,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ManagedEnvironment].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } + return LROPoller[_models.ManagedEnvironment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, environment_name: str, **kwargs: Any @@ -804,21 +752,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -829,11 +776,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, environment_name: str, **kwargs: Any) -> LROPoller[None]: @@ -846,14 +789,6 @@ def begin_delete(self, resource_group_name: str, environment_name: str, **kwargs :type resource_group_name: str :param environment_name: Name of the Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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: @@ -880,7 +815,7 @@ def begin_delete(self, resource_group_name: str, environment_name: str, **kwargs def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -889,23 +824,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _update_initial( self, resource_group_name: str, environment_name: str, - environment_envelope: Union[_models.ManagedEnvironment, IO], + environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any ) -> Optional[_models.ManagedEnvironment]: error_map = { @@ -931,7 +862,7 @@ def _update_initial( else: _json = self._serialize.body(environment_envelope, "ManagedEnvironment") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, @@ -939,16 +870,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -963,13 +893,9 @@ def _update_initial( deserialized = self._deserialize("ManagedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -995,14 +921,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -1014,7 +932,7 @@ def begin_update( self, resource_group_name: str, environment_name: str, - environment_envelope: IO, + environment_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1029,18 +947,10 @@ def begin_update( :param environment_name: Name of the Environment. Required. :type environment_name: str :param environment_envelope: Configuration details of the Environment. Required. - :type environment_envelope: IO + :type environment_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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 ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -1052,7 +962,7 @@ def begin_update( self, resource_group_name: str, environment_name: str, - environment_envelope: Union[_models.ManagedEnvironment, IO], + environment_envelope: Union[_models.ManagedEnvironment, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ManagedEnvironment]: """Update Managed Environment's properties. @@ -1065,19 +975,8 @@ def begin_update( :param environment_name: Name of the Environment. Required. :type environment_name: str :param environment_envelope: Configuration details of the Environment. Is either a - ManagedEnvironment type or a IO type. Required. - :type environment_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironment or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: 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. + ManagedEnvironment type or a IO[bytes] type. Required. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironment or IO[bytes] :return: An instance of LROPoller that returns either ManagedEnvironment or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] @@ -1109,7 +1008,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ManagedEnvironment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1119,17 +1018,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ManagedEnvironment].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}" - } + return LROPoller[_models.ManagedEnvironment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def get_auth_token( @@ -1144,7 +1041,6 @@ def get_auth_token( :type resource_group_name: str :param environment_name: Name of the Managed Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EnvironmentAuthToken or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.EnvironmentAuthToken :raises ~azure.core.exceptions.HttpResponseError: @@ -1163,21 +1059,20 @@ def get_auth_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentAuthToken] = kwargs.pop("cls", None) - request = build_get_auth_token_request( + _request = build_get_auth_token_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_auth_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1190,13 +1085,9 @@ def get_auth_token( deserialized = self._deserialize("EnvironmentAuthToken", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get_auth_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/getAuthtoken" - } + return deserialized # type: ignore @distributed_trace def list_workload_profile_states( @@ -1211,7 +1102,6 @@ def list_workload_profile_states( :type resource_group_name: str :param environment_name: Name of the Managed Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkloadProfileStates or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.WorkloadProfileStates] @@ -1234,17 +1124,16 @@ def list_workload_profile_states( def prepare_request(next_link=None): if not next_link: - request = build_list_workload_profile_states_request( + _request = build_list_workload_profile_states_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_workload_profile_states.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1256,13 +1145,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("WorkloadProfileStatesCollection", pipeline_response) @@ -1272,11 +1161,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1288,7 +1177,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_workload_profile_states.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/workloadProfileStates" - } diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py index 733f73c8967d..efdd9a9c7d60 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -41,7 +41,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,7 +50,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -74,7 +74,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -108,7 +108,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,7 +118,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -145,7 +145,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +154,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -205,7 +205,6 @@ def list( :type resource_group_name: str :param environment_name: Name of the Environment. Required. :type environment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStoragesCollection or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStoragesCollection :raises ~azure.core.exceptions.HttpResponseError: @@ -224,21 +223,20 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironmentStoragesCollection] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -251,13 +249,9 @@ def list( deserialized = self._deserialize("ManagedEnvironmentStoragesCollection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages" - } + return deserialized # type: ignore @distributed_trace def get( @@ -274,7 +268,6 @@ def get( :type environment_name: str :param storage_name: Name of the storage. Required. :type storage_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -293,22 +286,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ManagedEnvironmentStorage] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, environment_name=environment_name, storage_name=storage_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -321,13 +313,9 @@ def get( deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -356,7 +344,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -368,7 +355,7 @@ def create_or_update( resource_group_name: str, environment_name: str, storage_name: str, - storage_envelope: IO, + storage_envelope: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -385,11 +372,10 @@ def create_or_update( :param storage_name: Name of the storage. Required. :type storage_name: str :param storage_envelope: Configuration details of storage. Required. - :type storage_envelope: IO + :type storage_envelope: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -401,7 +387,7 @@ def create_or_update( resource_group_name: str, environment_name: str, storage_name: str, - storage_envelope: Union[_models.ManagedEnvironmentStorage, IO], + storage_envelope: Union[_models.ManagedEnvironmentStorage, IO[bytes]], **kwargs: Any ) -> _models.ManagedEnvironmentStorage: """Create or update storage for a managedEnvironment. @@ -416,12 +402,8 @@ def create_or_update( :param storage_name: Name of the storage. Required. :type storage_name: str :param storage_envelope: Configuration details of storage. Is either a - ManagedEnvironmentStorage type or a IO type. Required. - :type storage_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ManagedEnvironmentStorage type or a IO[bytes] type. Required. + :type storage_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage or IO[bytes] :return: ManagedEnvironmentStorage or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage :raises ~azure.core.exceptions.HttpResponseError: @@ -449,7 +431,7 @@ def create_or_update( else: _json = self._serialize.body(storage_envelope, "ManagedEnvironmentStorage") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, environment_name=environment_name, storage_name=storage_name, @@ -458,16 +440,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -480,13 +461,9 @@ def create_or_update( deserialized = self._deserialize("ManagedEnvironmentStorage", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/storages/{storageName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -503,7 +480,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type environment_name: str :param storage_name: Name of the storage. Required. :type storage_name: str - :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: @@ -522,22 +498,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, environment_name=environment_name, storage_name=storage_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -548,8 +523,4 @@ def delete( # pylint: disable=inconsistent-return-statements 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.App/managedEnvironments/{environmentName}/storages/{storageName}" - } + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py index c18e4e341a53..56f460ad18ba 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -41,7 +41,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -51,7 +51,7 @@ def build_check_name_availability_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/checkNameAvailability", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -115,7 +115,6 @@ def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResponse or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -126,7 +125,7 @@ def check_name_availability( self, resource_group_name: str, environment_name: str, - check_name_availability_request: IO, + check_name_availability_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -141,11 +140,10 @@ def check_name_availability( :param environment_name: Name of the Managed Environment. Required. :type environment_name: str :param check_name_availability_request: The check name availability request. Required. - :type check_name_availability_request: IO + :type check_name_availability_request: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResponse or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -156,7 +154,7 @@ def check_name_availability( self, resource_group_name: str, environment_name: str, - check_name_availability_request: Union[_models.CheckNameAvailabilityRequest, IO], + check_name_availability_request: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityResponse: """Checks the resource name availability. @@ -169,13 +167,9 @@ def check_name_availability( :param environment_name: Name of the Managed Environment. Required. :type environment_name: str :param check_name_availability_request: The check name availability request. Is either a - CheckNameAvailabilityRequest type or a IO type. Required. + CheckNameAvailabilityRequest type or a IO[bytes] type. Required. :type check_name_availability_request: - ~azure.mgmt.appcontainers.models.CheckNameAvailabilityRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + ~azure.mgmt.appcontainers.models.CheckNameAvailabilityRequest or IO[bytes] :return: CheckNameAvailabilityResponse or the result of cls(response) :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -203,7 +197,7 @@ def check_name_availability( else: _json = self._serialize.body(check_name_availability_request, "CheckNameAvailabilityRequest") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( resource_group_name=resource_group_name, environment_name=environment_name, subscription_id=self._config.subscription_id, @@ -211,16 +205,15 @@ def check_name_availability( content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -233,10 +226,6 @@ def check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/checkNameAvailability" - } + return deserialized # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py index 72dfb15cee16..1a05294e4428 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: """Lists all of the available RP operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationDetail or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.OperationDetail] :raises ~azure.core.exceptions.HttpResponseError: @@ -100,14 +99,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationDetail"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +117,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _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("AvailableOperations", pipeline_response) @@ -135,11 +133,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +149,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.App/operations"} diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py new file mode 100644 index 000000000000..03bc72d24244 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_usages_operations.py @@ -0,0 +1,164 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + 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.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import ContainerAppsAPIClientMixinABC, _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(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/locations/{location}/usages" + ) + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class UsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.appcontainers.ContainerAppsAPIClient`'s + :attr:`usages` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: + """Gets, for the specified location, the current resource usage information as well as the limits + under the subscription. + + :param location: The location for which resource usage is queried. Required. + :type location: str + :return: An iterator like instance of either Usage or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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("ListUsagesResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.py new file mode 100644 index 000000000000..e98b4e1f846b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_create_or_update.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 typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.create_or_update( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + resiliency_envelope={ + "properties": { + "circuitBreakerPolicy": {"consecutiveErrors": 5, "intervalInSeconds": 10, "maxEjectionPercent": 50}, + "httpConnectionPool": {"http1MaxPendingRequests": 1024, "http2MaxRequests": 1024}, + "httpRetryPolicy": { + "matches": { + "errors": ["5xx", "connect-failure", "reset", "retriable-headers", "retriable-status-codes"], + "headers": [{"header": "X-Content-Type", "match": {"prefixMatch": "GOATS"}}], + "httpStatusCodes": [502, 503], + }, + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 1000, "maxIntervalInMilliseconds": 10000}, + }, + "tcpConnectionPool": {"maxConnections": 100}, + "tcpRetryPolicy": {"maxConnectAttempts": 3}, + "timeoutPolicy": {"connectionTimeoutInSeconds": 5, "responseTimeoutInSeconds": 15}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py new file mode 100644 index 000000000000..fab04833c272 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + client.app_resiliency.delete( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py new file mode 100644 index 000000000000..26b4f027f9c5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.get( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py new file mode 100644 index 000000000000..2ff4b5bb7403 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.list( + resource_group_name="rg", + app_name="testcontainerApp0", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py new file mode 100644 index 000000000000..e351bd2e4a3d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/app_resiliency_patch.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python app_resiliency_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.app_resiliency.update( + resource_group_name="rg", + app_name="testcontainerApp0", + name="resiliency-policy-1", + resiliency_envelope={ + "properties": {"timeoutPolicy": {"connectionTimeoutInSeconds": 40, "responseTimeoutInSeconds": 30}} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AppResiliency_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py index e933e3c96b01..bbc6ec8fc9b3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -35,6 +38,10 @@ def main(): auth_config_name="current", auth_config_envelope={ "properties": { + "encryptionSettings": { + "containerAppAuthEncryptionSecretName": "testEncryptionSecretName", + "containerAppAuthSigningSecretName": "testSigningSecretName", + }, "globalValidation": {"unauthenticatedClientAction": "AllowAnonymous"}, "identityProviders": { "facebook": {"registration": {"appId": "123", "appSecretSettingName": "facebook-secret"}} @@ -46,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/AuthConfigs_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AuthConfigs_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py index d913c3efce8c..6c96c3fdc91d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/AuthConfigs_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AuthConfigs_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py index c9d09e41f997..1095283b90d4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/AuthConfigs_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AuthConfigs_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py index 370df7f6cdaf..8edbbff4ffae 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/auth_configs_list_by_container.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/AuthConfigs_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AuthConfigs_ListByContainer.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py index 8ebff8a5ac89..865e1cbbd4fb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/available_workload_profiles_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/AvailableWorkloadProfiles_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/AvailableWorkloadProfiles_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py index a5f9b32efea8..dff89c99c439 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/billing_meters_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/BillingMeters_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/BillingMeters_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py new file mode 100644 index 000000000000..0f6707c6de5b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_create_or_update.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.begin_create_or_update( + resource_group_name="rg", + builder_name="testBuilder", + builder_envelope={ + "identity": { + "type": "SystemAssigned,UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": {} + }, + }, + "location": "eastus", + "properties": { + "containerRegistries": [ + { + "containerRegistryServer": "test.azurecr.io", + "identityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + }, + { + "containerRegistryServer": "test2.azurecr.io", + "identityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + }, + ], + "environmentId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/Microsoft.App/managedEnvironments/testEnv", + }, + "tags": {"company": "Microsoft"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py new file mode 100644 index 000000000000..f014b49a4339 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_delete.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.builders.begin_delete( + resource_group_name="rg", + builder_name="testBuilder", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py new file mode 100644 index 000000000000..e48ce3a5ca80 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.get( + resource_group_name="rg", + builder_name="testBuilder", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py new file mode 100644 index 000000000000..812800c9de41 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_resource_group.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.list_by_resource_group( + resource_group_name="rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py new file mode 100644 index 000000000000..67032bc436ba --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_list_by_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py new file mode 100644 index 000000000000..f5e123b1badb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builders_update.py @@ -0,0 +1,45 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builders_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builders.begin_update( + resource_group_name="rg", + builder_name="testBuilder", + builder_envelope={"tags": {"mytag1": "myvalue1"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builders_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py new file mode 100644 index 000000000000..4fde89dd07ac --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_create_or_update.py @@ -0,0 +1,72 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds.begin_create_or_update( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild-123456789az", + build_envelope={ + "properties": { + "configuration": { + "baseOs": "DebianBullseye", + "environmentVariables": [{"name": "foo1", "value": "bar1"}, {"name": "foo2", "value": "bar2"}], + "platform": "dotnetcore", + "platformVersion": "7.0", + "preBuildSteps": [ + { + "description": "First pre build step.", + "httpGet": { + "fileName": "output.txt", + "headers": ["foo", "bar"], + "url": "https://microsoft.com", + }, + "scripts": ["echo 'hello'", "echo 'world'"], + }, + { + "description": "Second pre build step.", + "httpGet": {"fileName": "output.txt", "headers": ["foo"], "url": "https://microsoft.com"}, + "scripts": ["echo 'hello'", "echo 'again'"], + }, + ], + }, + "destinationContainerRegistry": {"image": "test.azurecr.io/repo:tag", "server": "test.azurecr.io"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py new file mode 100644 index 000000000000..0cd6d19d5c57 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.builds.begin_delete( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py new file mode 100644 index 000000000000..7c6dda4f0e38 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds.get( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py new file mode 100644 index 000000000000..0adf09f0fcc0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_auth_token.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_list_auth_token.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.build_auth_token.list( + resource_group_name="rg", + builder_name="testBuilder", + build_name="testBuild", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_ListAuthToken.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py new file mode 100644 index 000000000000..804827d40261 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/builds_list_by_builder_resource.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python builds_list_by_builder_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.builds_by_builder_resource.list( + resource_group_name="rg", + builder_name="testBuilder", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Builds_ListByBuilderResource.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py index dea5245c2589..675eb5b8c480 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py new file mode 100644 index 000000000000..68eda9fa1946 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_create_or_update_from_key_vault.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python certificate_create_or_update_from_key_vault.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.certificates.create_or_update( + resource_group_name="examplerg", + environment_name="testcontainerenv", + certificate_name="certificate-firendly-name", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificate_CreateOrUpdate_FromKeyVault.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py index 9bedcdc0d2c4..2989b2951a35 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py index 62539bee8b81..49eeaff2ccb1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificate_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py index af5b1bdad649..92c3839cc465 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_check_name_availability.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -40,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificates_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py index 680006d38a36..ec5a8b88a5e7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_list_by_managed_environment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificates_ListByManagedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py index 1f2f47e01827..4006011a62c5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/certificates_patch.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Certificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Certificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py index 5dc0509c4cf9..24c5e8187dd4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py index 2633d9418944..eafde70f5640 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py index 546e64901b68..f54e0c564dae 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificate_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py index e5ccd5834d34..e7f072087734 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_check_name_availability.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -40,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificates_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py index 9d5231c54a61..06e06685241e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_list_by_connected_environment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificates_ListByConnectedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py index 50ac15f55c98..49e23990fabf 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_certificates_patch.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsCertificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py index 024b703035d0..6e8f8e7c6140 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -48,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py index 30ab1302e2e4..30dc14394373 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -46,6 +49,13 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secrets": [{"name": "masterkey", "value": "keyvalue"}], + "serviceComponentBind": [ + { + "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, + "name": "statestore", + "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", + } + ], "version": "v1", } }, @@ -53,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py index 94be51b901ab..14fe8bfd6a9f 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsDaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py index 034e8c27c470..4fbf110564f2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsDaprComponents_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py index 929659d36ee9..f43c438ddde6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsDaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py index ea1924799cfe..5c81a547ae0c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_dapr_components_list_secrets.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsDaprComponents_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py index e91c1a4ad166..7bca2f8f07cd 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py index 8ecda7c844be..5d8f8bd24481 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py index a7437b6acabe..52df79f1d713 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py index 31d38cb5e5dd..211eaa06ed11 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py index af6d619d9777..860f287b5d10 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_patch.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironments_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py index e4e7ab5a9df6..adf5251229f1 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -47,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsStorages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py index bca28941a160..d4ba700860ea 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsStorages_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py index 97a62f342dd5..2b2bf696fe9a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsStorages_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py index a90a72645a73..cec40e7e7126 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/connected_environments_storages_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ConnectedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ConnectedEnvironmentsStorages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py index 5c35e5a4779f..ce1cd05f4de8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_check_name_availability.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_CheckNameAvailability.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py index 10fe12cf4049..9f0444130090 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -46,6 +49,10 @@ def main(): "logLevel": "debug", }, "ingress": { + "additionalPortMappings": [ + {"external": True, "targetPort": 1234}, + {"exposedPort": 3456, "external": False, "targetPort": 2345}, + ], "clientCertificateMode": "accept", "corsPolicy": { "allowCredentials": True, @@ -107,6 +114,10 @@ def main(): "type": "Liveness", } ], + "volumeMounts": [ + {"mountPath": "/mnt/path1", "subPath": "subPath1", "volumeName": "azurefile"}, + {"mountPath": "/mnt/path2", "subPath": "subPath2", "volumeName": "nfsazurefile"}, + ], } ], "initContainers": [ @@ -130,10 +141,16 @@ def main(): }, "serviceBinds": [ { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, "name": "redisService", "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/redisService", } ], + "volumes": [ + {"name": "azurefile", "storageName": "storage", "storageType": "AzureFile"}, + {"name": "nfsazurefile", "storageName": "nfsStorage", "storageType": "NfsAzureFile"}, + ], }, "workloadProfileName": "My-GP-01", }, @@ -142,6 +159,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py new file mode 100644 index 000000000000..02be9846c6a6 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_create_or_update_connected_environment.py @@ -0,0 +1,150 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python container_apps_create_or_update_connected_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.container_apps.begin_create_or_update( + resource_group_name="rg", + container_app_name="testcontainerApp0", + container_app_envelope={ + "extendedLocation": { + "name": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", + "type": "CustomLocation", + }, + "location": "East US", + "properties": { + "configuration": { + "dapr": { + "appPort": 3000, + "appProtocol": "http", + "enableApiLogging": True, + "enabled": True, + "httpMaxRequestSize": 10, + "httpReadBufferSize": 30, + "logLevel": "debug", + }, + "ingress": { + "additionalPortMappings": [ + {"external": True, "targetPort": 1234}, + {"exposedPort": 3456, "external": False, "targetPort": 2345}, + ], + "clientCertificateMode": "accept", + "corsPolicy": { + "allowCredentials": True, + "allowedHeaders": ["HEADER1", "HEADER2"], + "allowedMethods": ["GET", "POST"], + "allowedOrigins": ["https://a.test.com", "https://b.test.com"], + "exposeHeaders": ["HEADER3", "HEADER4"], + "maxAge": 1234, + }, + "customDomains": [ + { + "bindingType": "SniEnabled", + "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube/certificates/my-certificate-for-my-name-dot-com", + "name": "www.my-name.com", + }, + { + "bindingType": "SniEnabled", + "certificateId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube/certificates/my-certificate-for-my-other-name-dot-com", + "name": "www.my-other-name.com", + }, + ], + "external": True, + "ipSecurityRestrictions": [ + { + "action": "Allow", + "description": "Allowing all IP's within the subnet below to access containerapp", + "ipAddressRange": "192.168.1.1/32", + "name": "Allow work IP A subnet", + }, + { + "action": "Allow", + "description": "Allowing all IP's within the subnet below to access containerapp", + "ipAddressRange": "192.168.1.1/8", + "name": "Allow work IP B subnet", + }, + ], + "stickySessions": {"affinity": "sticky"}, + "targetPort": 3000, + "traffic": [{"label": "production", "revisionName": "testcontainerApp0-ab1234", "weight": 100}], + }, + "maxInactiveRevisions": 10, + }, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube", + "template": { + "containers": [ + { + "image": "repo/testcontainerApp0:v1", + "name": "testcontainerApp0", + "probes": [ + { + "httpGet": { + "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], + "path": "/health", + "port": 8080, + }, + "initialDelaySeconds": 3, + "periodSeconds": 3, + "type": "Liveness", + } + ], + } + ], + "initContainers": [ + { + "args": ["-c", "while true; do echo hello; sleep 10;done"], + "command": ["/bin/sh"], + "image": "repo/testcontainerApp0:v4", + "name": "testinitcontainerApp0", + "resources": {"cpu": 0.2, "memory": "100Mi"}, + } + ], + "scale": { + "maxReplicas": 5, + "minReplicas": 1, + "rules": [ + { + "custom": {"metadata": {"concurrentRequests": "50"}, "type": "http"}, + "name": "httpscalingrule", + } + ], + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_CreateOrUpdate_ConnectedEnvironment.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py index 48c2756b876f..d4b0b91bd67d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py index 0761a61c008a..0621e4623d72 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerAppsDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerAppsDiagnostics_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py index 5aa2868ba2f0..948e502bc334 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_diagnostics_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerAppsDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerAppsDiagnostics_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py index c2559b742b38..a8f09b0d5a5b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py index 85cbd920a7aa..97280c262a21 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_get_auth_token.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_GetAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py index 73845482b33c..3ddd12b249a7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py index ce7078802744..762384b44e69 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py index 2eae969a7545..e39c06791164 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_custom_host_name_analysis.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_ListCustomHostNameAnalysis.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ListCustomHostNameAnalysis.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py index 231a13c9fcfd..eb5fab29e6b8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_list_secrets.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py index 3133e2bdfcdd..5c90c8d56eac 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_managed_by_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -73,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_ManagedBy_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_ManagedBy_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py index 3e56a5045fd9..e0ebd96a01a5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_patch.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -118,6 +121,8 @@ def main(): }, "serviceBinds": [ { + "clientType": "dotnet", + "customizedKeys": {"DesiredKey": "defaultKey"}, "name": "service", "serviceId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/containerApps/service", } @@ -130,6 +135,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py index 71164ee29964..9125f2d8182a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_start.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Start.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py index c0d7fd44776d..0fc89828ced7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_stop.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_Stop.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_Stop.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py index a0c0482f4f7f..bd84fa656785 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/container_apps_tcp_app_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -72,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ContainerApps_TcpApp_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ContainerApps_TcpApp_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py new file mode 100644 index 000000000000..eb3c02bb76d0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policies_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.dapr_component_resiliency_policies.delete( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicies_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py new file mode 100644 index 000000000000..d3a007f91680 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policies_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.get( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicies_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py new file mode 100644 index 000000000000..1fc552c48b8b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policies_list.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policies_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.list( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicies_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py new file mode 100644 index 000000000000..399c7ed65abf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_all_options.py @@ -0,0 +1,66 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policy_create_or_update_all_options.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + dapr_component_resiliency_policy_envelope={ + "properties": { + "inboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 5, "intervalInSeconds": 4, "timeoutInSeconds": 10}, + "httpRetryPolicy": { + "maxRetries": 15, + "retryBackOff": {"initialDelayInMilliseconds": 2000, "maxIntervalInMilliseconds": 5500}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 30}, + }, + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 3, "intervalInSeconds": 60, "timeoutInSeconds": 20}, + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 100, "maxIntervalInMilliseconds": 30000}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 12}, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_AllOptions.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py new file mode 100644 index 000000000000..f3b4323bad94 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_outbound_only.py @@ -0,0 +1,58 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policy_create_or_update_outbound_only.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + dapr_component_resiliency_policy_envelope={ + "properties": { + "outboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 3, "intervalInSeconds": 60, "timeoutInSeconds": 20}, + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 100, "maxIntervalInMilliseconds": 30000}, + }, + "timeoutPolicy": {"responseTimeoutInSeconds": 12}, + } + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_OutboundOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py new file mode 100644 index 000000000000..692e76e00cf4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_component_resiliency_policy_create_or_update_sparse_options.py @@ -0,0 +1,58 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_component_resiliency_policy_create_or_update_sparse_options.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_component_resiliency_policies.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + component_name="mydaprcomponent", + name="myresiliencypolicy", + dapr_component_resiliency_policy_envelope={ + "properties": { + "inboundPolicy": { + "circuitBreakerPolicy": {"consecutiveErrors": 3, "timeoutInSeconds": 20}, + "httpRetryPolicy": { + "maxRetries": 5, + "retryBackOff": {"initialDelayInMilliseconds": 2000, "maxIntervalInMilliseconds": 5500}, + }, + }, + "outboundPolicy": {"timeoutPolicy": {"responseTimeoutInSeconds": 12}}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponentResiliencyPolicy_CreateOrUpdate_SparseOptions.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py index bb315049008e..98d1b2f380e4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secret_store_component.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -46,6 +49,13 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secretStoreComponent": "my-secret-store", + "serviceComponentBind": [ + { + "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, + "name": "statestore", + "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", + } + ], "version": "v1", } }, @@ -53,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_CreateOrUpdate_SecretStoreComponent.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py index 39a7b6e29848..adff70eea4af 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_create_or_update_secrets.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -46,6 +49,13 @@ def main(): ], "scopes": ["container-app-1", "container-app-2"], "secrets": [{"name": "masterkey", "value": "keyvalue"}], + "serviceComponentBind": [ + { + "metadata": {"name": "daprcomponentBind", "value": "redis-bind"}, + "name": "statestore", + "serviceId": "/subscriptions/9f7371f1-b593-4c3c-84e2-9167806ad358/resourceGroups/ca-syn2-group/providers/Microsoft.App/containerapps/cappredis", + } + ], "version": "v1", } }, @@ -53,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_CreateOrUpdate_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_CreateOrUpdate_Secrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py index 2324831379ea..edfbdb28f867 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py index 09054b947037..ec4b1a935bb7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secret_store_component.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_Get_SecretStoreComponent.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_Get_SecretStoreComponent.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py index 3c46e8ecf802..e797ea7a4c3b 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_get_secrets.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_Get_Secrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_Get_Secrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py index a965910cf0cb..742c780dd094 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py index 8f12f74c815f..6071afa6717d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_components_list_secrets.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/DaprComponents_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprComponents_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py new file mode 100644 index 000000000000..c78a49eb395b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_create_or_update_bulk_subscribe_and_scopes.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + dapr_subscription_envelope={ + "properties": { + "bulkSubscribe": {"enabled": True, "maxAwaitDurationMs": 500, "maxMessagesCount": 123}, + "pubsubName": "mypubsubcomponent", + "routes": {"default": "/products"}, + "scopes": ["warehouseapp", "customersupportapp"], + "topic": "inventory", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_CreateOrUpdate_BulkSubscribeAndScopes.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py new file mode 100644 index 000000000000..4756e5f0cf94 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_default_route.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_create_or_update_default_route.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + dapr_subscription_envelope={ + "properties": {"pubsubName": "mypubsubcomponent", "routes": {"default": "/products"}, "topic": "inventory"} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_CreateOrUpdate_DefaultRoute.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py new file mode 100644 index 000000000000..1005320a7c2a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_create_or_update_route_rules_and_metadata.py @@ -0,0 +1,59 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_create_or_update_route_rules_and_metadata.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + dapr_subscription_envelope={ + "properties": { + "metadata": {"foo": "bar", "hello": "world"}, + "pubsubName": "mypubsubcomponent", + "routes": { + "default": "/products", + "rules": [ + {"match": "event.type == 'widget'", "path": "/widgets"}, + {"match": "event.type == 'gadget'", "path": "/gadgets"}, + ], + }, + "topic": "inventory", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_CreateOrUpdate_RouteRulesAndMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py new file mode 100644 index 000000000000..ba81e2ee5418 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.dapr_subscriptions.delete( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mysubscription", + ) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py new file mode 100644 index 000000000000..65b1aaafe2ec --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_bulk_subscribe_and_scopes.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_get_bulk_subscribe_and_scopes.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mypubsubcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_Get_BulkSubscribeAndScopes.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py new file mode 100644 index 000000000000..505a1dc57b79 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_default_route.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_get_default_route.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mypubsubcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_Get_DefaultRoute.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py new file mode 100644 index 000000000000..1b75ba87e155 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_get_route_rules_and_metadata.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_get_route_rules_and_metadata.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mypubsubcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_Get_RouteRulesAndMetadata.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py new file mode 100644 index 000000000000..53d9fdff5473 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dapr_subscriptions_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dapr_subscriptions_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dapr_subscriptions.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DaprSubscriptions_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py new file mode 100644 index 000000000000..083c21be5588 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update.py @@ -0,0 +1,51 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py new file mode 100644 index 000000000000..124f25f97468 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_create_or_update_service_bind.py @@ -0,0 +1,57 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_create_or_update_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_CreateOrUpdate_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py new file mode 100644 index 000000000000..8f767c38f83f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.dot_net_components.begin_delete( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py new file mode 100644 index 000000000000..527ce8b43bcb --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py new file mode 100644 index 000000000000..bffb648b2e74 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_get_service_bind.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_get_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Get_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py new file mode 100644 index 000000000000..0505fb4bf395 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py new file mode 100644 index 000000000000..fd153eb24c56 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_list_service_bind.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_list_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_List_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py new file mode 100644 index 000000000000..6dd065b5ee1b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch.py @@ -0,0 +1,51 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py new file mode 100644 index 000000000000..7289c041a76c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/dot_net_components_patch_service_bind.py @@ -0,0 +1,57 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python dot_net_components_patch_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.dot_net_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="mydotnetcomponent", + dot_net_component_envelope={ + "properties": { + "componentType": "AspireDashboard", + "configurations": [{"propertyName": "dashboard-theme", "value": "dark"}], + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/dotNetComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/DotNetComponents_Patch_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py new file mode 100644 index 000000000000..703c852b6736 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + java_component_envelope={ + "properties": { + "componentType": "SpringBootAdmin", + "configurations": [ + {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, + {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py new file mode 100644 index 000000000000..a7fd208f05a6 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_create_or_update_service_bind.py @@ -0,0 +1,60 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_create_or_update_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.begin_create_or_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + java_component_envelope={ + "properties": { + "componentType": "SpringBootAdmin", + "configurations": [ + {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, + {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, + ], + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_CreateOrUpdate_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py new file mode 100644 index 000000000000..c90fd77d7b3d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + client.java_components.begin_delete( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + ).result() + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py new file mode 100644 index 000000000000..957441f7e6b6 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py new file mode 100644 index 000000000000..51378453d799 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_get_service_bind.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_get_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.get( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Get_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py new file mode 100644 index 000000000000..0fb2ce7d5a59 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py new file mode 100644 index 000000000000..bfbbba681c61 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_list_service_bind.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_list_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.list( + resource_group_name="examplerg", + environment_name="myenvironment", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_List_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py new file mode 100644 index 000000000000..95689cb92c43 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + java_component_envelope={ + "properties": { + "componentType": "SpringBootAdmin", + "configurations": [ + {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, + {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py new file mode 100644 index 000000000000..4c0daf6835f0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/java_components_patch_service_bind.py @@ -0,0 +1,60 @@ +# 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, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python java_components_patch_service_bind.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.java_components.begin_update( + resource_group_name="examplerg", + environment_name="myenvironment", + name="myjavacomponent", + java_component_envelope={ + "properties": { + "componentType": "SpringBootAdmin", + "configurations": [ + {"propertyName": "spring.boot.admin.ui.enable-toasts", "value": "true"}, + {"propertyName": "spring.boot.admin.monitor.status-interval", "value": "10000ms"}, + ], + "serviceBinds": [ + { + "name": "yellowcat", + "serviceId": "/subscriptions/8efdecc5-919e-44eb-b179-915dca89ebf9/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/myenvironment/javaComponents/yellowcat", + } + ], + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/JavaComponents_Patch_ServiceBind.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py index 5d2531451ea8..226e0f4c27dc 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -59,6 +62,10 @@ def main(): "type": "Liveness", } ], + "volumeMounts": [ + {"mountPath": "/mnt/path1", "subPath": "subPath1", "volumeName": "azurefile"}, + {"mountPath": "/mnt/path2", "subPath": "subPath2", "volumeName": "nfsazurefile"}, + ], } ], "initContainers": [ @@ -77,6 +84,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_CreateorUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_CreateorUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_connected_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_connected_environment.py new file mode 100644 index 000000000000..3a34b6d23ba3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_connected_environment.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. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python job_createor_update_connected_environment.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.jobs.begin_create_or_update( + resource_group_name="rg", + job_name="testcontainerAppsJob0", + job_envelope={ + "extendedLocation": { + "name": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.ExtendedLocation/customLocations/testcustomlocation", + "type": "CustomLocation", + }, + "location": "East US", + "properties": { + "configuration": { + "manualTriggerConfig": {"parallelism": 4, "replicaCompletionCount": 1}, + "replicaRetryLimit": 10, + "replicaTimeout": 10, + "triggerType": "Manual", + }, + "environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/connectedEnvironments/demokube", + "template": { + "containers": [ + { + "image": "repo/testcontainerAppsJob0:v1", + "name": "testcontainerAppsJob0", + "probes": [ + { + "httpGet": { + "httpHeaders": [{"name": "Custom-Header", "value": "Awesome"}], + "path": "/health", + "port": 8080, + }, + "initialDelaySeconds": 5, + "periodSeconds": 3, + "type": "Liveness", + } + ], + } + ], + "initContainers": [ + { + "args": ["-c", "while true; do echo hello; sleep 10;done"], + "command": ["/bin/sh"], + "image": "repo/testcontainerAppsJob0:v4", + "name": "testinitcontainerAppsJob0", + "resources": {"cpu": 0.2, "memory": "100Mi"}, + } + ], + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_CreateorUpdate_ConnectedEnvironment.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py index e8a7418aa1b0..76642c7b3be0 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_createor_update_event_trigger.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -75,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_CreateorUpdate_EventTrigger.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_CreateorUpdate_EventTrigger.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py index 67bf62912f9e..707d5be599a9 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py index 9040eb4aaee7..71e6f219196e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_execution_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Execution_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Execution_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py index f374a86cd237..5c42446c93b7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_executions_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Executions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Executions_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py index 489e21ab3c9a..13df12d0d25a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py new file mode 100644 index 000000000000..34492b40251e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_get_detector.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python job_get_detector.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="f07f3711-b45e-40fe-a941-4e6d93f851e6", + ) + + response = client.jobs.get_detector( + resource_group_name="mikono-workerapp-test-rg", + job_name="mikonojob1", + detector_name="containerappjobnetworkIO", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_GetDetector.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py new file mode 100644 index 000000000000..43aa91b84e69 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_detectors.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python job_list_detectors.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="f07f3711-b45e-40fe-a941-4e6d93f851e6", + ) + + response = client.jobs.list_detectors( + resource_group_name="mikono-workerapp-test-rg", + job_name="mikonojob1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_ListDetectors.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py index 68992384b2e4..a00a65ae0774 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_list_secrets.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_ListSecrets.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_ListSecrets.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py index 654850772d0a..fdd90a62cd4d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_patch.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -75,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py new file mode 100644 index 000000000000..cb08ef600bde --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_proxy_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python job_proxy_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.jobs.proxy_get( + resource_group_name="rg", + job_name="testcontainerAppsJob0", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_ProxyGet.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py index b1bd6eb6eb1b..9c45dd9143a2 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_start.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Start.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Start.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py index 34e063182943..a35dbe1fdb88 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_execution.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Stop_Execution.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Stop_Execution.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py index ad671acce7fa..fc6afaa7d9e4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/job_stop_multiple.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Job_Stop_Multiple.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Job_Stop_Multiple.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py index 974f1948ea56..bb74c063d810 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Jobs_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Jobs_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py index dbf9fb00334f..417ccd48b7b5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/jobs_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Jobs_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Jobs_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py index 59cf78f978dc..f82b4b92f33e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedCertificate_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificate_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py index 3f20a343dbe5..d81ae7f29fbe 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedCertificate_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificate_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py index d9b1fd94cdc5..fcf0c6f806e7 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificate_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedCertificate_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificate_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py index 05a25fd05c2c..7d3485b3dc42 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_list_by_managed_environment.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedCertificates_ListByManagedEnvironment.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificates_ListByManagedEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py index 5653b6bcde0a..3d48fd683378 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_certificates_patch.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -38,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedCertificates_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedCertificates_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py index d5481f13e31e..9654c3282d2c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentDiagnostics_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentDiagnostics_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py index 8e6dcc86a300..5869e15ea3a5 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_diagnostics_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentDiagnostics_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentDiagnostics_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py new file mode 100644 index 000000000000..49df9cba2d41 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environment_usages_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environment_usages_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.managed_environment_usages.list( + resource_group_name="examplerg", + environment_name="jlaw-demo1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentUsages_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py index 46827d450f11..d14f9aa12b11 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -33,15 +36,46 @@ def main(): resource_group_name="examplerg", environment_name="testcontainerenv", environment_envelope={ + "identity": { + "type": "SystemAssigned, UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {} + }, + }, "location": "East US", "properties": { - "appLogsConfiguration": {"logAnalyticsConfiguration": {"customerId": "string", "sharedKey": "string"}}, + "appInsightsConfiguration": { + "connectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/" + }, + "appLogsConfiguration": { + "logAnalyticsConfiguration": { + "customerId": "string", + "dynamicJsonColumns": True, + "sharedKey": "string", + } + }, "customDomainConfiguration": { "certificatePassword": "1234", "certificateValue": "Y2VydA==", "dnsSuffix": "www.my-name.com", }, "daprAIConnectionString": "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://northcentralus-0.in.applicationinsights.azure.com/", + "openTelemetryConfiguration": { + "destinationsConfiguration": { + "dataDogConfiguration": {"key": "000000000000000000000000", "site": "string"}, + "otlpConfigurations": [ + { + "endpoint": "dashboard.k8s.region.azurecontainerapps.io:80", + "headers": [{"key": "api-key", "value": "xxxxxxxxxxx"}], + "insecure": True, + "name": "dashboard", + } + ], + }, + "logsConfiguration": {"destinations": ["appInsights"]}, + "metricsConfiguration": {"destinations": ["dataDog"]}, + "tracesConfiguration": {"destinations": ["appInsights"]}, + }, "peerAuthentication": {"mtls": {"enabled": True}}, "vnetConfiguration": { "infrastructureSubnetId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/RGName/providers/Microsoft.Network/virtualNetworks/VNetName/subnets/subnetName1" @@ -74,6 +108,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py index fd5232fae232..bf8b11e1fa3d 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_custom_infrastructure_resource_group_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -74,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_CustomInfrastructureResourceGroup_Create.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py index ddf5bc40e33b..75019f367c6c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py index e4873afecaa8..0f70c08f3366 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py index 56e3171f8129..e2020d33fdc3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_get_auth_token.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_GetAuthToken.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_GetAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py index d0e3555d080e..6a42e68a13fb 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_ListByResourceGroup.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py index 48105b604bb0..157f4e41569a 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_ListBySubscription.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py index 73b67ee3f603..7fbce5c40111 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_list_workload_profile_states.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_ListWorkloadProfileStates.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_ListWorkloadProfileStates.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py index 96b6650b2bcd..6c8a286e29f8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_patch.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironments_Patch.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironments_Patch.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py index da74a2c75c5d..e1b2ea86cf93 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -47,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py new file mode 100644 index 000000000000..41af4163e581 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_create_or_update_nfs_azure_file.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environments_storages_create_or_update_nfs_azure_file.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environments_storages.create_or_update( + resource_group_name="examplerg", + environment_name="managedEnv", + storage_name="jlaw-demo1", + storage_envelope={ + "properties": {"nfsAzureFile": {"accessMode": "ReadOnly", "server": "server1", "shareName": "share1"}} + }, + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_CreateOrUpdate_NfsAzureFile.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py index 60a920675098..2998b568b579 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentsStorages_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py index 8a534fd74c8d..0d0955564cd3 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentsStorages_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py new file mode 100644 index 000000000000..e61419aaacb1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_get_nfs_azure_file.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python managed_environments_storages_get_nfs_azure_file.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="8efdecc5-919e-44eb-b179-915dca89ebf9", + ) + + response = client.managed_environments_storages.get( + resource_group_name="examplerg", + environment_name="managedEnv", + storage_name="jlaw-demo1", + ) + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_Get_NfsAzureFile.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py index 27117ddea822..eed274629609 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/managed_environments_storages_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/ManagedEnvironmentsStorages_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/ManagedEnvironmentsStorages_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py index e04bb66279db..119af87df18c 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/operations_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Operations_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py index e0780e406120..f1e6923b9510 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Replicas_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Replicas_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py index 59dae6a808c3..ced67bc69945 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/replicas_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Replicas_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Replicas_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py index 07aa985c27a9..16bf6566e1a4 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_activate.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Revisions_Activate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_Activate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py index f1c8b953f9b5..12cf26fe99f8 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_deactivate.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Revisions_Deactivate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_Deactivate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py index c9a7dbf05f90..dd0b6278c92e 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Revisions_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py index 4df2b7c55692..c9bde6a3e2c6 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Revisions_List.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_List.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py index 126a3c1a84a3..3e581135da72 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/revisions_restart.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/Revisions_Restart.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Revisions_Restart.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py index bcfcea00137e..b2a93c97a1fa 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_create_or_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -43,6 +46,7 @@ def main(): "kind": "feaderated", "tenantId": "", }, + "buildEnvironmentVariables": [{"name": "foo1", "value": "bar1"}, {"name": "foo2", "value": "bar2"}], "contextPath": "./", "githubPersonalAccessToken": "test", "image": "image/tag", @@ -59,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/SourceControls_CreateOrUpdate.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/SourceControls_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py index c4da8857288c..ca22d4352d20 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/SourceControls_Delete.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/SourceControls_Delete.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py index cb0dd31f2206..9276b931e314 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/SourceControls_Get.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/SourceControls_Get.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py index 6c7178b74834..3d8e2b44f018 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/source_controls_list_by_container.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.appcontainers import ContainerAppsAPIClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/app/resource-manager/Microsoft.App/stable/2023-05-01/examples/SourceControls_ListByContainer.json +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/SourceControls_ListByContainer.json if __name__ == "__main__": main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py new file mode 100644 index 000000000000..cea7244da098 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/subscriptions_get_custom_domain_verification_id.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python subscriptions_get_custom_domain_verification_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="d27c3573-f76e-4b26-b871-0ccd2203d08c", + ) + + response = client.get_custom_domain_verification_id() + print(response) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Subscriptions_GetCustomDomainVerificationId.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py new file mode 100644 index 000000000000..c3633f4f65d5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/generated_samples/usages_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.appcontainers import ContainerAppsAPIClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-appcontainers +# USAGE + python usages_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ContainerAppsAPIClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.usages.list( + location="westus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2023-11-02-preview/examples/Usages_List.json +if __name__ == "__main__": + main() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml b/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml index f16da3032654..9b9e139e8165 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml +++ b/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-appcontainers" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Appcontainers Management" package_doc_id = "" -is_stable = true +is_stable = false is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/setup.py b/sdk/appcontainers/azure-mgmt-appcontainers/setup.py index 3dabef513bc5..98a7edfe26ee 100644 --- a/sdk/appcontainers/azure-mgmt-appcontainers/setup.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/setup.py @@ -49,15 +49,15 @@ 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 :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -74,10 +74,9 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7", + python_requires=">=3.8", )