diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/__init__.py deleted file mode 100644 index 0e99a7bac3b7..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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 ._container_registry_management_client import ContainerRegistryManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerRegistryManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_configuration.py deleted file mode 100644 index edb293427e1b..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerRegistryManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for ContainerRegistryManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2018-02-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2018-02-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerregistry/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_container_registry_management_client.py deleted file mode 100644 index 765d65d290d0..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_container_registry_management_client.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import BuildStepsOperations, BuildTasksOperations, BuildsOperations, RegistriesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerRegistryManagementClient: # pylint: disable=client-accepts-api-version-keyword - """ContainerRegistryManagementClient. - - :ivar builds: BuildsOperations operations - :vartype builds: azure.mgmt.containerregistry.v2018_02_01_preview.operations.BuildsOperations - :ivar build_steps: BuildStepsOperations operations - :vartype build_steps: - azure.mgmt.containerregistry.v2018_02_01_preview.operations.BuildStepsOperations - :ivar build_tasks: BuildTasksOperations operations - :vartype build_tasks: - azure.mgmt.containerregistry.v2018_02_01_preview.operations.BuildTasksOperations - :ivar registries: RegistriesOperations operations - :vartype registries: - azure.mgmt.containerregistry.v2018_02_01_preview.operations.RegistriesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Microsoft Azure subscription ID. 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 "2018-02-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerRegistryManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.builds = BuildsOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-02-01-preview" - ) - self.build_steps = BuildStepsOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-02-01-preview" - ) - self.build_tasks = BuildTasksOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-02-01-preview" - ) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-02-01-preview" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> "ContainerRegistryManagementClient": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_metadata.json deleted file mode 100644 index 428c616e2b99..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_metadata.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "chosen_version": "2018-02-01-preview", - "total_api_version_list": ["2018-02-01-preview"], - "client": { - "name": "ContainerRegistryManagementClient", - "filename": "_container_registry_management_client", - "description": "ContainerRegistryManagementClient.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerRegistryManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The Microsoft Azure subscription ID. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The Microsoft Azure subscription ID. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "builds": "BuildsOperations", - "build_steps": "BuildStepsOperations", - "build_tasks": "BuildTasksOperations", - "registries": "RegistriesOperations" - } -} diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_patch.py deleted file mode 100644 index 17dbc073e01b..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_patch.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_vendor.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_version.py deleted file mode 100644 index b7a62f0761e5..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "10.3.0" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/__init__.py deleted file mode 100644 index 2b9f561654c9..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# 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 ._container_registry_management_client import ContainerRegistryManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerRegistryManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_configuration.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_configuration.py deleted file mode 100644 index efab7c337c2a..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerRegistryManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for ContainerRegistryManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2018-02-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ContainerRegistryManagementClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2018-02-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerregistry/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_container_registry_management_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_container_registry_management_client.py deleted file mode 100644 index 0c4075c86bbc..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_container_registry_management_client.py +++ /dev/null @@ -1,112 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ContainerRegistryManagementClientConfiguration -from .operations import BuildStepsOperations, BuildTasksOperations, BuildsOperations, RegistriesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerRegistryManagementClient: # pylint: disable=client-accepts-api-version-keyword - """ContainerRegistryManagementClient. - - :ivar builds: BuildsOperations operations - :vartype builds: - azure.mgmt.containerregistry.v2018_02_01_preview.aio.operations.BuildsOperations - :ivar build_steps: BuildStepsOperations operations - :vartype build_steps: - azure.mgmt.containerregistry.v2018_02_01_preview.aio.operations.BuildStepsOperations - :ivar build_tasks: BuildTasksOperations operations - :vartype build_tasks: - azure.mgmt.containerregistry.v2018_02_01_preview.aio.operations.BuildTasksOperations - :ivar registries: RegistriesOperations operations - :vartype registries: - azure.mgmt.containerregistry.v2018_02_01_preview.aio.operations.RegistriesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Microsoft Azure subscription ID. 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 "2018-02-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerRegistryManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.builds = BuildsOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-02-01-preview" - ) - self.build_steps = BuildStepsOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-02-01-preview" - ) - self.build_tasks = BuildTasksOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-02-01-preview" - ) - self.registries = RegistriesOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-02-01-preview" - ) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "ContainerRegistryManagementClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_patch.py deleted file mode 100644 index 17dbc073e01b..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/_patch.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/__init__.py deleted file mode 100644 index cf2f497714be..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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 ._builds_operations import BuildsOperations -from ._build_steps_operations import BuildStepsOperations -from ._build_tasks_operations import BuildTasksOperations -from ._registries_operations import RegistriesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "BuildsOperations", - "BuildStepsOperations", - "BuildTasksOperations", - "RegistriesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_steps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_steps_operations.py deleted file mode 100644 index ecb21b319293..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_steps_operations.py +++ /dev/null @@ -1,975 +0,0 @@ -# pylint: disable=too-many-lines -# 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._build_steps_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_build_arguments_request, - build_list_request, - build_update_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildStepsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.v2018_02_01_preview.aio.ContainerRegistryManagementClient`'s - :attr:`build_steps` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, registry_name: str, build_task_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildStep"]: - """List all the build steps for a given build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildStep or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildStepList] = 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, - registry_name=registry_name, - build_task_name=build_task_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) - - 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("BuildStepList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, registry_name: str, build_task_name: str, step_name: str, **kwargs: Any - ) -> _models.BuildStep: - """Gets the build step for a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildStep or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildStep] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BuildStep", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - async def _create_initial( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_create_parameters: Union[_models.BuildStep, IO], - **kwargs: Any - ) -> _models.BuildStep: - 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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildStep] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_step_create_parameters, (IOBase, bytes)): - _content = build_step_create_parameters - else: - _json = self._serialize.body(build_step_create_parameters, "BuildStep") - - request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BuildStep", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BuildStep", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_create_parameters: _models.BuildStep, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildStep]: - """Creates a build step for a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :param build_step_create_parameters: The parameters for creating a build step. Required. - :type build_step_create_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep - :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 BuildStep or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_create_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildStep]: - """Creates a build step for a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :param build_step_create_parameters: The parameters for creating a build step. Required. - :type build_step_create_parameters: IO - :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 BuildStep or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_create_parameters: Union[_models.BuildStep, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildStep]: - """Creates a build step for a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :param build_step_create_parameters: The parameters for creating a build step. Is either a - BuildStep type or a IO type. Required. - :type build_step_create_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep 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. - :return: An instance of AsyncLROPoller that returns either BuildStep or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildStep] = 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_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_name, - build_step_create_parameters=build_step_create_parameters, - 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("BuildStep", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, registry_name: str, build_task_name: str, step_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._api_version or "2018-02-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, registry_name: str, build_task_name: str, step_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a build step from the build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_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: - """ - _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._api_version or "2018-02-01-preview") - ) - 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, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_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, {}) - - 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.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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_update_parameters: Union[_models.BuildStepUpdateParameters, IO], - **kwargs: Any - ) -> _models.BuildStep: - 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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildStep] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_step_update_parameters, (IOBase, bytes)): - _content = build_step_update_parameters - else: - _json = self._serialize.body(build_step_update_parameters, "BuildStepUpdateParameters") - - request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BuildStep", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BuildStep", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_update_parameters: _models.BuildStepUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildStep]: - """Updates a build step in a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :param build_step_update_parameters: The parameters for updating a build step. Required. - :type build_step_update_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepUpdateParameters - :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 BuildStep or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_update_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildStep]: - """Updates a build step in a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :param build_step_update_parameters: The parameters for updating a build step. Required. - :type build_step_update_parameters: IO - :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 BuildStep or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_update_parameters: Union[_models.BuildStepUpdateParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildStep]: - """Updates a build step in a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :param build_step_update_parameters: The parameters for updating a build step. Is either a - BuildStepUpdateParameters type or a IO type. Required. - :type build_step_update_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepUpdateParameters 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. - :return: An instance of AsyncLROPoller that returns either BuildStep or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildStep] = 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, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_name, - build_step_update_parameters=build_step_update_parameters, - 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("BuildStep", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - @distributed_trace - def list_build_arguments( - self, resource_group_name: str, registry_name: str, build_task_name: str, step_name: str, **kwargs: Any - ) -> AsyncIterable["_models.BuildArgument"]: - """List the build arguments for a step including the secret arguments. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildArgument or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildArgumentList] = 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_build_arguments_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_build_arguments.metadata["url"], - 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("BuildArgumentList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_build_arguments.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}/listBuildArguments" - } diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_tasks_operations.py deleted file mode 100644 index b454bee68e63..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_build_tasks_operations.py +++ /dev/null @@ -1,922 +0,0 @@ -# pylint: disable=too-many-lines -# 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._build_tasks_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_list_source_repository_properties_request, - build_update_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BuildTasksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.v2018_02_01_preview.aio.ContainerRegistryManagementClient`'s - :attr:`build_tasks` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, - resource_group_name: str, - registry_name: str, - filter: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.BuildTask"]: - """Lists all the build tasks for a specified container registry. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param filter: The build task filter to apply on the operation. Default value is None. - :type filter: str - :param skip_token: $skipToken is supported on get list of build tasks, which provides the next - page in the list of tasks. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildTask or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildTaskListResult] = 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, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - filter=filter, - skip_token=skip_token, - 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) - - 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("BuildTaskListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, registry_name: str, build_task_name: str, **kwargs: Any - ) -> _models.BuildTask: - """Get the properties of a specified build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildTask or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildTask] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BuildTask", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - async def _create_initial( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_create_parameters: Union[_models.BuildTask, IO], - **kwargs: Any - ) -> _models.BuildTask: - 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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildTask] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_task_create_parameters, (IOBase, bytes)): - _content = build_task_create_parameters - else: - _json = self._serialize.body(build_task_create_parameters, "BuildTask") - - request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BuildTask", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BuildTask", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_create_parameters: _models.BuildTask, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildTask]: - """Creates a build task for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param build_task_create_parameters: The parameters for creating a build task. Required. - :type build_task_create_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask - :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 BuildTask or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_create_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildTask]: - """Creates a build task for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param build_task_create_parameters: The parameters for creating a build task. Required. - :type build_task_create_parameters: IO - :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 BuildTask or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_create_parameters: Union[_models.BuildTask, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildTask]: - """Creates a build task for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param build_task_create_parameters: The parameters for creating a build task. Is either a - BuildTask type or a IO type. Required. - :type build_task_create_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask 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. - :return: An instance of AsyncLROPoller that returns either BuildTask or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildTask] = 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_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - build_task_create_parameters=build_task_create_parameters, - 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("BuildTask", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, registry_name: str, build_task_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._api_version or "2018-02-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_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) - - _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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, registry_name: str, build_task_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a specified build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_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: - """ - _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._api_version or "2018-02-01-preview") - ) - 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, - registry_name=registry_name, - build_task_name=build_task_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, {}) - - 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.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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_update_parameters: Union[_models.BuildTaskUpdateParameters, IO], - **kwargs: Any - ) -> _models.BuildTask: - 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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildTask] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_task_update_parameters, (IOBase, bytes)): - _content = build_task_update_parameters - else: - _json = self._serialize.body(build_task_update_parameters, "BuildTaskUpdateParameters") - - request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BuildTask", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BuildTask", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_update_parameters: _models.BuildTaskUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildTask]: - """Updates a build task with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param build_task_update_parameters: The parameters for updating a build task. Required. - :type build_task_update_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskUpdateParameters - :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 BuildTask or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_update_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildTask]: - """Updates a build task with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param build_task_update_parameters: The parameters for updating a build task. Required. - :type build_task_update_parameters: IO - :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 BuildTask or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_update_parameters: Union[_models.BuildTaskUpdateParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.BuildTask]: - """Updates a build task with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param build_task_update_parameters: The parameters for updating a build task. Is either a - BuildTaskUpdateParameters type or a IO type. Required. - :type build_task_update_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskUpdateParameters 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. - :return: An instance of AsyncLROPoller that returns either BuildTask or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildTask] = 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, - registry_name=registry_name, - build_task_name=build_task_name, - build_task_update_parameters=build_task_update_parameters, - 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("BuildTask", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - @distributed_trace_async - async def list_source_repository_properties( - self, resource_group_name: str, registry_name: str, build_task_name: str, **kwargs: Any - ) -> _models.SourceRepositoryProperties: - """Get the source control properties for a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SourceRepositoryProperties or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceRepositoryProperties - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.SourceRepositoryProperties] = kwargs.pop("cls", None) - - request = build_list_source_repository_properties_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_source_repository_properties.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SourceRepositoryProperties", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_source_repository_properties.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/listSourceRepositoryProperties" - } diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_builds_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_builds_operations.py deleted file mode 100644 index 3d9730cafb86..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_builds_operations.py +++ /dev/null @@ -1,675 +0,0 @@ -# pylint: disable=too-many-lines -# 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._builds_operations import ( - build_cancel_request, - build_get_log_link_request, - build_get_request, - build_list_request, - build_update_request, -) - -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.containerregistry.v2018_02_01_preview.aio.ContainerRegistryManagementClient`'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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, - resource_group_name: str, - registry_name: str, - filter: Optional[str] = None, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.Build"]: - """Gets all the builds for a registry. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param filter: The builds filter to apply on the operation. Default value is None. - :type filter: str - :param top: $top is supported for get list of builds, which limits the maximum number of builds - to return. Default value is None. - :type top: int - :param skip_token: $skipToken is supported on get list of builds, which provides the next page - in the list of builds. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildListResult] = 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, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip_token=skip_token, - 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) - - 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("BuildListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds" - } - - @distributed_trace_async - async def get(self, resource_group_name: str, registry_name: str, build_id: str, **kwargs: Any) -> _models.Build: - """Gets the detailed information for a given build. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_id: The build ID. Required. - :type build_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_id=build_id, - 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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Build", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}" - } - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - build_id: str, - build_update_parameters: Union[_models.BuildUpdateParameters, IO], - **kwargs: Any - ) -> _models.Build: - 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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_update_parameters, (IOBase, bytes)): - _content = build_update_parameters - else: - _json = self._serialize.body(build_update_parameters, "BuildUpdateParameters") - - request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_id=build_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Build", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}" - } - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_id: str, - build_update_parameters: _models.BuildUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Build]: - """Patch the build properties. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_id: The build ID. Required. - :type build_id: str - :param build_update_parameters: The build update properties. Required. - :type build_update_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildUpdateParameters - :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 Build or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_id: str, - build_update_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Build]: - """Patch the build properties. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_id: The build ID. Required. - :type build_id: str - :param build_update_parameters: The build update properties. Required. - :type build_update_parameters: IO - :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 Build or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_id: str, - build_update_parameters: Union[_models.BuildUpdateParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.Build]: - """Patch the build properties. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_id: The build ID. Required. - :type build_id: str - :param build_update_parameters: The build update properties. Is either a BuildUpdateParameters - type or a IO type. Required. - :type build_update_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildUpdateParameters 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. - :return: An instance of AsyncLROPoller that returns either Build or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = 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, - registry_name=registry_name, - build_id=build_id, - build_update_parameters=build_update_parameters, - 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("Build", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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.ContainerRegistry/registries/{registryName}/builds/{buildId}" - } - - @distributed_trace_async - async def get_log_link( - self, resource_group_name: str, registry_name: str, build_id: str, **kwargs: Any - ) -> _models.BuildGetLogResult: - """Gets a link to download the build logs. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_id: The build ID. Required. - :type build_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildGetLogResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildGetLogResult - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildGetLogResult] = kwargs.pop("cls", None) - - request = build_get_log_link_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_id=build_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_log_link.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BuildGetLogResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_log_link.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/getLogLink" - } - - async def _cancel_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, registry_name: str, build_id: 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._api_version or "2018-02-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_cancel_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_id=build_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._cancel_initial.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _cancel_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/cancel" - } - - @distributed_trace_async - async def begin_cancel( - self, resource_group_name: str, registry_name: str, build_id: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Cancel an existing build. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_id: The build ID. Required. - :type build_id: 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: - """ - _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._api_version or "2018-02-01-preview") - ) - 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._cancel_initial( # type: ignore - resource_group_name=resource_group_name, - registry_name=registry_name, - build_id=build_id, - 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, {}) - - 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.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_cancel.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/cancel" - } diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_registries_operations.py deleted file mode 100644 index e7f6926695ad..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/aio/operations/_registries_operations.py +++ /dev/null @@ -1,349 +0,0 @@ -# pylint: disable=too-many-lines -# 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._registries_operations import build_get_build_source_upload_url_request, build_queue_build_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.v2018_02_01_preview.aio.ContainerRegistryManagementClient`'s - :attr:`registries` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - async def _queue_build_initial( - self, - resource_group_name: str, - registry_name: str, - build_request: Union[_models.QueueBuildRequest, IO], - **kwargs: Any - ) -> Optional[_models.Build]: - 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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Build]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_request, (IOBase, bytes)): - _content = build_request - else: - _json = self._serialize.body(build_request, "QueueBuildRequest") - - request = build_queue_build_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._queue_build_initial.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Build", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _queue_build_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/queueBuild" - } - - @overload - async def begin_queue_build( - self, - resource_group_name: str, - registry_name: str, - build_request: _models.QueueBuildRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Build]: - """Creates a new build based on the request parameters and add it to the build queue. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_request: The parameters of a build that needs to queued. Required. - :type build_request: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.QueueBuildRequest - :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 Build or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_queue_build( - self, - resource_group_name: str, - registry_name: str, - build_request: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Build]: - """Creates a new build based on the request parameters and add it to the build queue. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_request: The parameters of a build that needs to queued. Required. - :type build_request: IO - :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 Build or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_queue_build( - self, - resource_group_name: str, - registry_name: str, - build_request: Union[_models.QueueBuildRequest, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.Build]: - """Creates a new build based on the request parameters and add it to the build queue. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_request: The parameters of a build that needs to queued. Is either a - QueueBuildRequest type or a IO type. Required. - :type build_request: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.QueueBuildRequest - 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. - :return: An instance of AsyncLROPoller that returns either Build or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = 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._queue_build_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_request=build_request, - 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("Build", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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_queue_build.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/queueBuild" - } - - @distributed_trace_async - async def get_build_source_upload_url( - self, resource_group_name: str, registry_name: str, **kwargs: Any - ) -> _models.SourceUploadDefinition: - """Get the upload location for the user to be able to upload the source. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceUploadDefinition - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.SourceUploadDefinition] = kwargs.pop("cls", None) - - request = build_get_build_source_upload_url_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_build_source_upload_url.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SourceUploadDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_source_upload_url.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/getBuildSourceUploadUrl" - } diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/__init__.py deleted file mode 100644 index d4019b3b1152..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/__init__.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import BaseImageDependency -from ._models_py3 import Build -from ._models_py3 import BuildArgument -from ._models_py3 import BuildArgumentList -from ._models_py3 import BuildFilter -from ._models_py3 import BuildGetLogResult -from ._models_py3 import BuildListResult -from ._models_py3 import BuildStep -from ._models_py3 import BuildStepList -from ._models_py3 import BuildStepProperties -from ._models_py3 import BuildStepPropertiesUpdateParameters -from ._models_py3 import BuildStepUpdateParameters -from ._models_py3 import BuildTask -from ._models_py3 import BuildTaskBuildRequest -from ._models_py3 import BuildTaskFilter -from ._models_py3 import BuildTaskListResult -from ._models_py3 import BuildTaskUpdateParameters -from ._models_py3 import BuildUpdateParameters -from ._models_py3 import DockerBuildStep -from ._models_py3 import DockerBuildStepUpdateParameters -from ._models_py3 import GitCommitTrigger -from ._models_py3 import ImageDescriptor -from ._models_py3 import ImageUpdateTrigger -from ._models_py3 import PlatformProperties -from ._models_py3 import ProxyResource -from ._models_py3 import QueueBuildRequest -from ._models_py3 import QuickBuildRequest -from ._models_py3 import Resource -from ._models_py3 import SourceControlAuthInfo -from ._models_py3 import SourceRepositoryProperties -from ._models_py3 import SourceRepositoryUpdateParameters -from ._models_py3 import SourceUploadDefinition - -from ._container_registry_management_client_enums import BaseImageDependencyType -from ._container_registry_management_client_enums import BaseImageTriggerType -from ._container_registry_management_client_enums import BuildArgumentType -from ._container_registry_management_client_enums import BuildStatus -from ._container_registry_management_client_enums import BuildStepType -from ._container_registry_management_client_enums import BuildTaskStatus -from ._container_registry_management_client_enums import BuildType -from ._container_registry_management_client_enums import OsType -from ._container_registry_management_client_enums import ProvisioningState -from ._container_registry_management_client_enums import SourceControlType -from ._container_registry_management_client_enums import TokenType -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "BaseImageDependency", - "Build", - "BuildArgument", - "BuildArgumentList", - "BuildFilter", - "BuildGetLogResult", - "BuildListResult", - "BuildStep", - "BuildStepList", - "BuildStepProperties", - "BuildStepPropertiesUpdateParameters", - "BuildStepUpdateParameters", - "BuildTask", - "BuildTaskBuildRequest", - "BuildTaskFilter", - "BuildTaskListResult", - "BuildTaskUpdateParameters", - "BuildUpdateParameters", - "DockerBuildStep", - "DockerBuildStepUpdateParameters", - "GitCommitTrigger", - "ImageDescriptor", - "ImageUpdateTrigger", - "PlatformProperties", - "ProxyResource", - "QueueBuildRequest", - "QuickBuildRequest", - "Resource", - "SourceControlAuthInfo", - "SourceRepositoryProperties", - "SourceRepositoryUpdateParameters", - "SourceUploadDefinition", - "BaseImageDependencyType", - "BaseImageTriggerType", - "BuildArgumentType", - "BuildStatus", - "BuildStepType", - "BuildTaskStatus", - "BuildType", - "OsType", - "ProvisioningState", - "SourceControlType", - "TokenType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_container_registry_management_client_enums.py deleted file mode 100644 index 8578ee70d5bc..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_container_registry_management_client_enums.py +++ /dev/null @@ -1,96 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class BaseImageDependencyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the base image dependency.""" - - BUILD_TIME = "BuildTime" - RUN_TIME = "RunTime" - - -class BaseImageTriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the auto trigger for base image dependency updates.""" - - ALL = "All" - RUNTIME = "Runtime" - NONE = "None" - - -class BuildArgumentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the argument.""" - - DOCKER_BUILD_ARGUMENT = "DockerBuildArgument" - - -class BuildStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current status of the build.""" - - QUEUED = "Queued" - STARTED = "Started" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - ERROR = "Error" - TIMEOUT = "Timeout" - - -class BuildStepType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the step.""" - - DOCKER = "Docker" - - -class BuildTaskStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current status of build task.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - -class BuildType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of build.""" - - AUTO_BUILD = "AutoBuild" - QUICK_BUILD = "QuickBuild" - - -class OsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type required for the build.""" - - WINDOWS = "Windows" - LINUX = "Linux" - - -class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of a build.""" - - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - - -class SourceControlType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of source control service.""" - - GITHUB = "Github" - VISUAL_STUDIO_TEAM_SERVICE = "VisualStudioTeamService" - - -class TokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Auth token.""" - - PAT = "PAT" - O_AUTH = "OAuth" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_models_py3.py deleted file mode 100644 index f1833cb7bdd4..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_models_py3.py +++ /dev/null @@ -1,1659 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class BaseImageDependency(_serialization.Model): - """Properties that describe a base image dependency. - - :ivar type: The type of the base image dependency. Known values are: "BuildTime" and "RunTime". - :vartype type: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageDependencyType - :ivar registry: The registry login server. - :vartype registry: str - :ivar repository: The repository name. - :vartype repository: str - :ivar tag: The tag name. - :vartype tag: str - :ivar digest: The sha256-based digest of the image manifest. - :vartype digest: str - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "registry": {"key": "registry", "type": "str"}, - "repository": {"key": "repository", "type": "str"}, - "tag": {"key": "tag", "type": "str"}, - "digest": {"key": "digest", "type": "str"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.BaseImageDependencyType"]] = None, - registry: Optional[str] = None, - repository: Optional[str] = None, - tag: Optional[str] = None, - digest: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The type of the base image dependency. Known values are: "BuildTime" and - "RunTime". - :paramtype type: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageDependencyType - :keyword registry: The registry login server. - :paramtype registry: str - :keyword repository: The repository name. - :paramtype repository: str - :keyword tag: The tag name. - :paramtype tag: str - :keyword digest: The sha256-based digest of the image manifest. - :paramtype digest: str - """ - super().__init__(**kwargs) - self.type = type - self.registry = registry - self.repository = repository - self.tag = tag - self.digest = digest - - -class ProxyResource(_serialization.Model): - """The resource model definition for a ARM proxy resource. It will have everything other than - required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Build(ProxyResource): # pylint: disable=too-many-instance-attributes - """Build resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar build_id: The unique identifier for the build. - :vartype build_id: str - :ivar status: The current status of the build. Known values are: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", and "Timeout". - :vartype status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStatus - :ivar last_updated_time: The last updated time for the build. - :vartype last_updated_time: ~datetime.datetime - :ivar build_type: The type of build. Known values are: "AutoBuild" and "QuickBuild". - :vartype build_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildType - :ivar create_time: The time the build was created. - :vartype create_time: ~datetime.datetime - :ivar start_time: The time the build started. - :vartype start_time: ~datetime.datetime - :ivar finish_time: The time the build finished. - :vartype finish_time: ~datetime.datetime - :ivar output_images: The list of all images that were generated from the build. - :vartype output_images: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageDescriptor] - :ivar build_task: The build task with which the build was started. - :vartype build_task: str - :ivar image_update_trigger: The image update trigger that caused the build. - :vartype image_update_trigger: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageUpdateTrigger - :ivar git_commit_trigger: The git commit trigger that caused the build. - :vartype git_commit_trigger: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.GitCommitTrigger - :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. - :vartype is_archive_enabled: bool - :ivar platform: The platform properties against which the build will happen. - :vartype platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :ivar provisioning_state: The provisioning state of a build. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "build_id": {"key": "properties.buildId", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "last_updated_time": {"key": "properties.lastUpdatedTime", "type": "iso-8601"}, - "build_type": {"key": "properties.buildType", "type": "str"}, - "create_time": {"key": "properties.createTime", "type": "iso-8601"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "finish_time": {"key": "properties.finishTime", "type": "iso-8601"}, - "output_images": {"key": "properties.outputImages", "type": "[ImageDescriptor]"}, - "build_task": {"key": "properties.buildTask", "type": "str"}, - "image_update_trigger": {"key": "properties.imageUpdateTrigger", "type": "ImageUpdateTrigger"}, - "git_commit_trigger": {"key": "properties.gitCommitTrigger", "type": "GitCommitTrigger"}, - "is_archive_enabled": {"key": "properties.isArchiveEnabled", "type": "bool"}, - "platform": {"key": "properties.platform", "type": "PlatformProperties"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - build_id: Optional[str] = None, - status: Optional[Union[str, "_models.BuildStatus"]] = None, - last_updated_time: Optional[datetime.datetime] = None, - build_type: Optional[Union[str, "_models.BuildType"]] = None, - create_time: Optional[datetime.datetime] = None, - start_time: Optional[datetime.datetime] = None, - finish_time: Optional[datetime.datetime] = None, - output_images: Optional[List["_models.ImageDescriptor"]] = None, - build_task: Optional[str] = None, - image_update_trigger: Optional["_models.ImageUpdateTrigger"] = None, - git_commit_trigger: Optional["_models.GitCommitTrigger"] = None, - is_archive_enabled: bool = False, - platform: Optional["_models.PlatformProperties"] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword build_id: The unique identifier for the build. - :paramtype build_id: str - :keyword status: The current status of the build. Known values are: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", and "Timeout". - :paramtype status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStatus - :keyword last_updated_time: The last updated time for the build. - :paramtype last_updated_time: ~datetime.datetime - :keyword build_type: The type of build. Known values are: "AutoBuild" and "QuickBuild". - :paramtype build_type: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildType - :keyword create_time: The time the build was created. - :paramtype create_time: ~datetime.datetime - :keyword start_time: The time the build started. - :paramtype start_time: ~datetime.datetime - :keyword finish_time: The time the build finished. - :paramtype finish_time: ~datetime.datetime - :keyword output_images: The list of all images that were generated from the build. - :paramtype output_images: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageDescriptor] - :keyword build_task: The build task with which the build was started. - :paramtype build_task: str - :keyword image_update_trigger: The image update trigger that caused the build. - :paramtype image_update_trigger: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageUpdateTrigger - :keyword git_commit_trigger: The git commit trigger that caused the build. - :paramtype git_commit_trigger: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.GitCommitTrigger - :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. - :paramtype is_archive_enabled: bool - :keyword platform: The platform properties against which the build will happen. - :paramtype platform: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :keyword provisioning_state: The provisioning state of a build. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :paramtype provisioning_state: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState - """ - super().__init__(**kwargs) - self.build_id = build_id - self.status = status - self.last_updated_time = last_updated_time - self.build_type = build_type - self.create_time = create_time - self.start_time = start_time - self.finish_time = finish_time - self.output_images = output_images - self.build_task = build_task - self.image_update_trigger = image_update_trigger - self.git_commit_trigger = git_commit_trigger - self.is_archive_enabled = is_archive_enabled - self.platform = platform - self.provisioning_state = provisioning_state - - -class BuildArgument(_serialization.Model): - """Properties of a build argument. - - All required parameters must be populated in order to send to Azure. - - :ivar type: The type of the argument. Required. "DockerBuildArgument" - :vartype type: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgumentType - :ivar name: The name of the argument. Required. - :vartype name: str - :ivar value: The value of the argument. Required. - :vartype value: str - :ivar is_secret: Flag to indicate whether the argument represents a secret and want to be - removed from build logs. - :vartype is_secret: bool - """ - - _validation = { - "type": {"required": True}, - "name": {"required": True}, - "value": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "is_secret": {"key": "isSecret", "type": "bool"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.BuildArgumentType"], - name: str, - value: str, - is_secret: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword type: The type of the argument. Required. "DockerBuildArgument" - :paramtype type: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgumentType - :keyword name: The name of the argument. Required. - :paramtype name: str - :keyword value: The value of the argument. Required. - :paramtype value: str - :keyword is_secret: Flag to indicate whether the argument represents a secret and want to be - removed from build logs. - :paramtype is_secret: bool - """ - super().__init__(**kwargs) - self.type = type - self.name = name - self.value = value - self.is_secret = is_secret - - -class BuildArgumentList(_serialization.Model): - """The list of build arguments for a build step. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :ivar next_link: The URI that can be used to request the next set of paged results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BuildArgument]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BuildArgument"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildFilter(_serialization.Model): - """Properties that are enabled for Odata querying. - - :ivar build_id: The unique identifier for the build. - :vartype build_id: str - :ivar build_type: The type of build. Known values are: "AutoBuild" and "QuickBuild". - :vartype build_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildType - :ivar status: The current status of the build. Known values are: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", and "Timeout". - :vartype status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStatus - :ivar create_time: The create time for a build. - :vartype create_time: ~datetime.datetime - :ivar finish_time: The time the build finished. - :vartype finish_time: ~datetime.datetime - :ivar output_image_manifests: The list of comma-separated image manifests that were generated - from the build. - :vartype output_image_manifests: str - :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. - :vartype is_archive_enabled: bool - :ivar build_task_name: The name of the build task that the build corresponds to. - :vartype build_task_name: str - """ - - _attribute_map = { - "build_id": {"key": "buildId", "type": "str"}, - "build_type": {"key": "buildType", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "create_time": {"key": "createTime", "type": "iso-8601"}, - "finish_time": {"key": "finishTime", "type": "iso-8601"}, - "output_image_manifests": {"key": "outputImageManifests", "type": "str"}, - "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, - "build_task_name": {"key": "buildTaskName", "type": "str"}, - } - - def __init__( - self, - *, - build_id: Optional[str] = None, - build_type: Optional[Union[str, "_models.BuildType"]] = None, - status: Optional[Union[str, "_models.BuildStatus"]] = None, - create_time: Optional[datetime.datetime] = None, - finish_time: Optional[datetime.datetime] = None, - output_image_manifests: Optional[str] = None, - is_archive_enabled: Optional[bool] = None, - build_task_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword build_id: The unique identifier for the build. - :paramtype build_id: str - :keyword build_type: The type of build. Known values are: "AutoBuild" and "QuickBuild". - :paramtype build_type: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildType - :keyword status: The current status of the build. Known values are: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", and "Timeout". - :paramtype status: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStatus - :keyword create_time: The create time for a build. - :paramtype create_time: ~datetime.datetime - :keyword finish_time: The time the build finished. - :paramtype finish_time: ~datetime.datetime - :keyword output_image_manifests: The list of comma-separated image manifests that were - generated from the build. - :paramtype output_image_manifests: str - :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. - :paramtype is_archive_enabled: bool - :keyword build_task_name: The name of the build task that the build corresponds to. - :paramtype build_task_name: str - """ - super().__init__(**kwargs) - self.build_id = build_id - self.build_type = build_type - self.status = status - self.create_time = create_time - self.finish_time = finish_time - self.output_image_manifests = output_image_manifests - self.is_archive_enabled = is_archive_enabled - self.build_task_name = build_task_name - - -class BuildGetLogResult(_serialization.Model): - """The result of get log link operation. - - :ivar log_link: The link to logs for a azure container registry build. - :vartype log_link: str - """ - - _attribute_map = { - "log_link": {"key": "logLink", "type": "str"}, - } - - def __init__(self, *, log_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword log_link: The link to logs for a azure container registry build. - :paramtype log_link: str - """ - super().__init__(**kwargs) - self.log_link = log_link - - -class BuildListResult(_serialization.Model): - """Collection of builds. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :ivar next_link: The URI that can be used to request the next set of paged results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Build]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Build"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildStep(ProxyResource): - """Build step resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar properties: The properties of a build step. - :vartype properties: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "BuildStepProperties"}, - } - - def __init__(self, *, properties: Optional["_models.BuildStepProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: The properties of a build step. - :paramtype properties: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class BuildStepList(_serialization.Model): - """The collection of build items. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :ivar next_link: The URI that can be used to request the next set of paged results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BuildStep]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BuildStep"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildStepProperties(_serialization.Model): - """Base properties for any build step. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - DockerBuildStep - - 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. - - :ivar provisioning_state: The provisioning state of the build step. Known values are: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState - :ivar type: The type of the step. Required. "Docker" - :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepType - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "type": {"required": True, "readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = {"type": {"Docker": "DockerBuildStep"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provisioning_state = None - self.type: Optional[str] = None - - -class BuildStepPropertiesUpdateParameters(_serialization.Model): - """The properties for updating a build step. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - DockerBuildStepUpdateParameters - - 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. - - :ivar type: The type of the step. Required. "Docker" - :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepType - """ - - _validation = { - "type": {"required": True, "readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = {"type": {"Docker": "DockerBuildStepUpdateParameters"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class BuildStepUpdateParameters(_serialization.Model): - """The parameters for updating a build step. - - :ivar properties: The properties for updating a build step. - :vartype properties: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepPropertiesUpdateParameters - :ivar tags: The ARM resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "BuildStepPropertiesUpdateParameters"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__( - self, - *, - properties: Optional["_models.BuildStepPropertiesUpdateParameters"] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: The properties for updating a build step. - :paramtype properties: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepPropertiesUpdateParameters - :keyword tags: The ARM resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.properties = properties - self.tags = tags - - -class Resource(_serialization.Model): - """An Azure 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. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar location: The location of the resource. This cannot be changed after the resource is - created. Required. - :vartype location: str - :ivar tags: The tags of the resource. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: The location of the resource. This cannot be changed after the resource is - created. Required. - :paramtype location: str - :keyword tags: The tags of the resource. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - - -class BuildTask(Resource): # pylint: disable=too-many-instance-attributes - """The build task that has the resource properties and all build items. The build task will have - all information to schedule a build against it. - - 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. - - :ivar id: The resource ID. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar location: The location of the resource. This cannot be changed after the resource is - created. Required. - :vartype location: str - :ivar tags: The tags of the resource. - :vartype tags: dict[str, str] - :ivar provisioning_state: The provisioning state of the build task. Known values are: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState - :ivar creation_date: The creation date of build task. - :vartype creation_date: ~datetime.datetime - :ivar alias: The alternative updatable name for a build task. - :vartype alias: str - :ivar status: The current status of build task. Known values are: "Disabled" and "Enabled". - :vartype status: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskStatus - :ivar source_repository: The properties that describes the source(code) for the build task. - :vartype source_repository: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceRepositoryProperties - :ivar platform: The platform properties against which the build has to happen. - :vartype platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :ivar timeout: Build timeout in seconds. - :vartype timeout: int - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "creation_date": {"readonly": True}, - "timeout": {"maximum": 28800, "minimum": 300}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "creation_date": {"key": "properties.creationDate", "type": "iso-8601"}, - "alias": {"key": "properties.alias", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "source_repository": {"key": "properties.sourceRepository", "type": "SourceRepositoryProperties"}, - "platform": {"key": "properties.platform", "type": "PlatformProperties"}, - "timeout": {"key": "properties.timeout", "type": "int"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - alias: Optional[str] = None, - status: Optional[Union[str, "_models.BuildTaskStatus"]] = None, - source_repository: Optional["_models.SourceRepositoryProperties"] = None, - platform: Optional["_models.PlatformProperties"] = None, - timeout: int = 3600, - **kwargs: Any - ) -> None: - """ - :keyword location: The location of the resource. This cannot be changed after the resource is - created. Required. - :paramtype location: str - :keyword tags: The tags of the resource. - :paramtype tags: dict[str, str] - :keyword alias: The alternative updatable name for a build task. - :paramtype alias: str - :keyword status: The current status of build task. Known values are: "Disabled" and "Enabled". - :paramtype status: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskStatus - :keyword source_repository: The properties that describes the source(code) for the build task. - :paramtype source_repository: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceRepositoryProperties - :keyword platform: The platform properties against which the build has to happen. - :paramtype platform: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :keyword timeout: Build timeout in seconds. - :paramtype timeout: int - """ - super().__init__(location=location, tags=tags, **kwargs) - self.provisioning_state = None - self.creation_date = None - self.alias = alias - self.status = status - self.source_repository = source_repository - self.platform = platform - self.timeout = timeout - - -class QueueBuildRequest(_serialization.Model): - """The queue build request parameters. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - BuildTaskBuildRequest, QuickBuildRequest - - 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. - - :ivar type: The type of the build request. Required. - :vartype type: str - """ - - _validation = { - "type": {"required": True, "readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = {"type": {"BuildTask": "BuildTaskBuildRequest", "QuickBuild": "QuickBuildRequest"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class BuildTaskBuildRequest(QueueBuildRequest): - """The queue build parameters based on a build task. - - 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. - - :ivar type: The type of the build request. Required. - :vartype type: str - :ivar build_task_name: The name of build task against which build has to be queued. Required. - :vartype build_task_name: str - """ - - _validation = { - "type": {"required": True, "readonly": True}, - "build_task_name": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "build_task_name": {"key": "buildTaskName", "type": "str"}, - } - - def __init__(self, *, build_task_name: str, **kwargs: Any) -> None: - """ - :keyword build_task_name: The name of build task against which build has to be queued. - Required. - :paramtype build_task_name: str - """ - super().__init__(**kwargs) - self.type: str = "BuildTask" - self.build_task_name = build_task_name - - -class BuildTaskFilter(_serialization.Model): - """The filter that can be used for listing build tasks. - - :ivar alias: The alternative name for build task. - :vartype alias: str - """ - - _attribute_map = { - "alias": {"key": "alias", "type": "str"}, - } - - def __init__(self, *, alias: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword alias: The alternative name for build task. - :paramtype alias: str - """ - super().__init__(**kwargs) - self.alias = alias - - -class BuildTaskListResult(_serialization.Model): - """The collection of build tasks. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :ivar next_link: The URI that can be used to request the next set of paged results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[BuildTask]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.BuildTask"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildTaskUpdateParameters(_serialization.Model): - """The parameters for updating a build task. - - :ivar tags: The ARM resource tags. - :vartype tags: dict[str, str] - :ivar alias: The alternative updatable name for a build task. - :vartype alias: str - :ivar status: The current status of build task. Known values are: "Disabled" and "Enabled". - :vartype status: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskStatus - :ivar platform: The platform properties against which the build has to happen. - :vartype platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :ivar timeout: Build timeout in seconds. - :vartype timeout: int - :ivar source_repository: The properties that describes the source(code) for the build task. - :vartype source_repository: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceRepositoryUpdateParameters - """ - - _validation = { - "timeout": {"maximum": 28800, "minimum": 300}, - } - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "alias": {"key": "properties.alias", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "platform": {"key": "properties.platform", "type": "PlatformProperties"}, - "timeout": {"key": "properties.timeout", "type": "int"}, - "source_repository": {"key": "properties.sourceRepository", "type": "SourceRepositoryUpdateParameters"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - alias: Optional[str] = None, - status: Optional[Union[str, "_models.BuildTaskStatus"]] = None, - platform: Optional["_models.PlatformProperties"] = None, - timeout: Optional[int] = None, - source_repository: Optional["_models.SourceRepositoryUpdateParameters"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The ARM resource tags. - :paramtype tags: dict[str, str] - :keyword alias: The alternative updatable name for a build task. - :paramtype alias: str - :keyword status: The current status of build task. Known values are: "Disabled" and "Enabled". - :paramtype status: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskStatus - :keyword platform: The platform properties against which the build has to happen. - :paramtype platform: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :keyword timeout: Build timeout in seconds. - :paramtype timeout: int - :keyword source_repository: The properties that describes the source(code) for the build task. - :paramtype source_repository: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceRepositoryUpdateParameters - """ - super().__init__(**kwargs) - self.tags = tags - self.alias = alias - self.status = status - self.platform = platform - self.timeout = timeout - self.source_repository = source_repository - - -class BuildUpdateParameters(_serialization.Model): - """The set of build properties that can be updated. - - :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. - :vartype is_archive_enabled: bool - """ - - _attribute_map = { - "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, - } - - def __init__(self, *, is_archive_enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. - :paramtype is_archive_enabled: bool - """ - super().__init__(**kwargs) - self.is_archive_enabled = is_archive_enabled - - -class DockerBuildStep(BuildStepProperties): # pylint: disable=too-many-instance-attributes - """The Docker build step. - - 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. - - :ivar provisioning_state: The provisioning state of the build step. Known values are: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.ProvisioningState - :ivar type: The type of the step. Required. "Docker" - :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepType - :ivar branch: The repository branch name. - :vartype branch: str - :ivar image_names: The fully qualified image names including the repository and tag. - :vartype image_names: list[str] - :ivar is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :vartype is_push_enabled: bool - :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. - :vartype no_cache: bool - :ivar docker_file_path: The Docker file path relative to the source control root. - :vartype docker_file_path: str - :ivar context_path: The relative context path for a docker build in the source. - :vartype context_path: str - :ivar build_arguments: The custom arguments for building this build step. - :vartype build_arguments: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageDependency] - :ivar base_image_trigger: The type of the auto trigger for base image dependency updates. Known - values are: "All", "Runtime", and "None". - :vartype base_image_trigger: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageTriggerType - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "type": {"required": True, "readonly": True}, - "base_image_dependencies": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "branch": {"key": "branch", "type": "str"}, - "image_names": {"key": "imageNames", "type": "[str]"}, - "is_push_enabled": {"key": "isPushEnabled", "type": "bool"}, - "no_cache": {"key": "noCache", "type": "bool"}, - "docker_file_path": {"key": "dockerFilePath", "type": "str"}, - "context_path": {"key": "contextPath", "type": "str"}, - "build_arguments": {"key": "buildArguments", "type": "[BuildArgument]"}, - "base_image_dependencies": {"key": "baseImageDependencies", "type": "[BaseImageDependency]"}, - "base_image_trigger": {"key": "baseImageTrigger", "type": "str"}, - } - - def __init__( - self, - *, - branch: Optional[str] = None, - image_names: Optional[List[str]] = None, - is_push_enabled: bool = True, - no_cache: bool = False, - docker_file_path: Optional[str] = None, - context_path: Optional[str] = None, - build_arguments: Optional[List["_models.BuildArgument"]] = None, - base_image_trigger: Optional[Union[str, "_models.BaseImageTriggerType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword branch: The repository branch name. - :paramtype branch: str - :keyword image_names: The fully qualified image names including the repository and tag. - :paramtype image_names: list[str] - :keyword is_push_enabled: The value of this property indicates whether the image built should - be pushed to the registry or not. - :paramtype is_push_enabled: bool - :keyword no_cache: The value of this property indicates whether the image cache is enabled or - not. - :paramtype no_cache: bool - :keyword docker_file_path: The Docker file path relative to the source control root. - :paramtype docker_file_path: str - :keyword context_path: The relative context path for a docker build in the source. - :paramtype context_path: str - :keyword build_arguments: The custom arguments for building this build step. - :paramtype build_arguments: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :keyword base_image_trigger: The type of the auto trigger for base image dependency updates. - Known values are: "All", "Runtime", and "None". - :paramtype base_image_trigger: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageTriggerType - """ - super().__init__(**kwargs) - self.type: str = "Docker" - self.branch = branch - self.image_names = image_names - self.is_push_enabled = is_push_enabled - self.no_cache = no_cache - self.docker_file_path = docker_file_path - self.context_path = context_path - self.build_arguments = build_arguments - self.base_image_dependencies = None - self.base_image_trigger = base_image_trigger - - -class DockerBuildStepUpdateParameters(BuildStepPropertiesUpdateParameters): - """The properties for updating a docker build step. - - 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. - - :ivar type: The type of the step. Required. "Docker" - :vartype type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepType - :ivar branch: The repository branch name. - :vartype branch: str - :ivar image_names: The fully qualified image names including the repository and tag. - :vartype image_names: list[str] - :ivar is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :vartype is_push_enabled: bool - :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. - :vartype no_cache: bool - :ivar docker_file_path: The Docker file path relative to the source control root. - :vartype docker_file_path: str - :ivar context_path: The relative context path for a docker build in the source. - :vartype context_path: str - :ivar build_arguments: The custom arguments for building this build step. - :vartype build_arguments: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :ivar base_image_trigger: The type of the auto trigger for base image dependency updates. Known - values are: "All", "Runtime", and "None". - :vartype base_image_trigger: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageTriggerType - """ - - _validation = { - "type": {"required": True, "readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "branch": {"key": "branch", "type": "str"}, - "image_names": {"key": "imageNames", "type": "[str]"}, - "is_push_enabled": {"key": "isPushEnabled", "type": "bool"}, - "no_cache": {"key": "noCache", "type": "bool"}, - "docker_file_path": {"key": "dockerFilePath", "type": "str"}, - "context_path": {"key": "contextPath", "type": "str"}, - "build_arguments": {"key": "buildArguments", "type": "[BuildArgument]"}, - "base_image_trigger": {"key": "baseImageTrigger", "type": "str"}, - } - - def __init__( - self, - *, - branch: Optional[str] = None, - image_names: Optional[List[str]] = None, - is_push_enabled: Optional[bool] = None, - no_cache: Optional[bool] = None, - docker_file_path: Optional[str] = None, - context_path: Optional[str] = None, - build_arguments: Optional[List["_models.BuildArgument"]] = None, - base_image_trigger: Optional[Union[str, "_models.BaseImageTriggerType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword branch: The repository branch name. - :paramtype branch: str - :keyword image_names: The fully qualified image names including the repository and tag. - :paramtype image_names: list[str] - :keyword is_push_enabled: The value of this property indicates whether the image built should - be pushed to the registry or not. - :paramtype is_push_enabled: bool - :keyword no_cache: The value of this property indicates whether the image cache is enabled or - not. - :paramtype no_cache: bool - :keyword docker_file_path: The Docker file path relative to the source control root. - :paramtype docker_file_path: str - :keyword context_path: The relative context path for a docker build in the source. - :paramtype context_path: str - :keyword build_arguments: The custom arguments for building this build step. - :paramtype build_arguments: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :keyword base_image_trigger: The type of the auto trigger for base image dependency updates. - Known values are: "All", "Runtime", and "None". - :paramtype base_image_trigger: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BaseImageTriggerType - """ - super().__init__(**kwargs) - self.type: str = "Docker" - self.branch = branch - self.image_names = image_names - self.is_push_enabled = is_push_enabled - self.no_cache = no_cache - self.docker_file_path = docker_file_path - self.context_path = context_path - self.build_arguments = build_arguments - self.base_image_trigger = base_image_trigger - - -class GitCommitTrigger(_serialization.Model): - """The git commit trigger that caused a build. - - :ivar id: The unique ID of the trigger. - :vartype id: str - :ivar commit_id: The unique ID that identifies a commit. - :vartype commit_id: str - :ivar repository_url: The repository URL. - :vartype repository_url: str - :ivar branch_name: The branch name in the repository. - :vartype branch_name: str - :ivar provider_type: The source control provider type. - :vartype provider_type: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "commit_id": {"key": "commitId", "type": "str"}, - "repository_url": {"key": "repositoryUrl", "type": "str"}, - "branch_name": {"key": "branchName", "type": "str"}, - "provider_type": {"key": "providerType", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - commit_id: Optional[str] = None, - repository_url: Optional[str] = None, - branch_name: Optional[str] = None, - provider_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The unique ID of the trigger. - :paramtype id: str - :keyword commit_id: The unique ID that identifies a commit. - :paramtype commit_id: str - :keyword repository_url: The repository URL. - :paramtype repository_url: str - :keyword branch_name: The branch name in the repository. - :paramtype branch_name: str - :keyword provider_type: The source control provider type. - :paramtype provider_type: str - """ - super().__init__(**kwargs) - self.id = id - self.commit_id = commit_id - self.repository_url = repository_url - self.branch_name = branch_name - self.provider_type = provider_type - - -class ImageDescriptor(_serialization.Model): - """Properties for a registry image. - - :ivar registry: The registry login server. - :vartype registry: str - :ivar repository: The repository name. - :vartype repository: str - :ivar tag: The tag name. - :vartype tag: str - :ivar digest: The sha256-based digest of the image manifest. - :vartype digest: str - """ - - _attribute_map = { - "registry": {"key": "registry", "type": "str"}, - "repository": {"key": "repository", "type": "str"}, - "tag": {"key": "tag", "type": "str"}, - "digest": {"key": "digest", "type": "str"}, - } - - def __init__( - self, - *, - registry: Optional[str] = None, - repository: Optional[str] = None, - tag: Optional[str] = None, - digest: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword registry: The registry login server. - :paramtype registry: str - :keyword repository: The repository name. - :paramtype repository: str - :keyword tag: The tag name. - :paramtype tag: str - :keyword digest: The sha256-based digest of the image manifest. - :paramtype digest: str - """ - super().__init__(**kwargs) - self.registry = registry - self.repository = repository - self.tag = tag - self.digest = digest - - -class ImageUpdateTrigger(_serialization.Model): - """The image update trigger that caused a build. - - :ivar id: The unique ID of the trigger. - :vartype id: str - :ivar timestamp: The timestamp when the image update happened. - :vartype timestamp: ~datetime.datetime - :ivar images: The list of image updates that caused the build. - :vartype images: list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageDescriptor] - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "timestamp": {"key": "timestamp", "type": "iso-8601"}, - "images": {"key": "images", "type": "[ImageDescriptor]"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - timestamp: Optional[datetime.datetime] = None, - images: Optional[List["_models.ImageDescriptor"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The unique ID of the trigger. - :paramtype id: str - :keyword timestamp: The timestamp when the image update happened. - :paramtype timestamp: ~datetime.datetime - :keyword images: The list of image updates that caused the build. - :paramtype images: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.ImageDescriptor] - """ - super().__init__(**kwargs) - self.id = id - self.timestamp = timestamp - self.images = images - - -class PlatformProperties(_serialization.Model): - """The platform properties against which the build has to happen. - - All required parameters must be populated in order to send to Azure. - - :ivar os_type: The operating system type required for the build. Required. Known values are: - "Windows" and "Linux". - :vartype os_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.OsType - :ivar cpu: The CPU configuration in terms of number of cores required for the build. - :vartype cpu: int - """ - - _validation = { - "os_type": {"required": True}, - } - - _attribute_map = { - "os_type": {"key": "osType", "type": "str"}, - "cpu": {"key": "cpu", "type": "int"}, - } - - def __init__(self, *, os_type: Union[str, "_models.OsType"], cpu: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword os_type: The operating system type required for the build. Required. Known values are: - "Windows" and "Linux". - :paramtype os_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.OsType - :keyword cpu: The CPU configuration in terms of number of cores required for the build. - :paramtype cpu: int - """ - super().__init__(**kwargs) - self.os_type = os_type - self.cpu = cpu - - -class QuickBuildRequest(QueueBuildRequest): - """The queue build request parameters for a quick build. - - 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. - - :ivar type: The type of the build request. Required. - :vartype type: str - :ivar image_names: The fully qualified image names including the repository and tag. - :vartype image_names: list[str] - :ivar source_location: The URL(absolute or relative) of the source that needs to be built. For - Docker build, it can be an URL to a tar or github repository as supported by Docker. - If it is relative URL, the relative path should be obtained from calling getSourceUploadUrl - API. Required. - :vartype source_location: str - :ivar build_arguments: The collection of build arguments to be used. - :vartype build_arguments: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :ivar is_push_enabled: The value of this property indicates whether the image built should be - pushed to the registry or not. - :vartype is_push_enabled: bool - :ivar no_cache: The value of this property indicates whether the image cache is enabled or not. - :vartype no_cache: bool - :ivar timeout: Build timeout in seconds. - :vartype timeout: int - :ivar platform: The platform properties against which the build will happen. Required. - :vartype platform: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :ivar docker_file_path: The Docker file path relative to the source location. Required. - :vartype docker_file_path: str - """ - - _validation = { - "type": {"required": True, "readonly": True}, - "source_location": {"required": True}, - "timeout": {"maximum": 28800, "minimum": 300}, - "platform": {"required": True}, - "docker_file_path": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "image_names": {"key": "imageNames", "type": "[str]"}, - "source_location": {"key": "sourceLocation", "type": "str"}, - "build_arguments": {"key": "buildArguments", "type": "[BuildArgument]"}, - "is_push_enabled": {"key": "isPushEnabled", "type": "bool"}, - "no_cache": {"key": "noCache", "type": "bool"}, - "timeout": {"key": "timeout", "type": "int"}, - "platform": {"key": "platform", "type": "PlatformProperties"}, - "docker_file_path": {"key": "dockerFilePath", "type": "str"}, - } - - def __init__( - self, - *, - source_location: str, - platform: "_models.PlatformProperties", - docker_file_path: str, - image_names: Optional[List[str]] = None, - build_arguments: Optional[List["_models.BuildArgument"]] = None, - is_push_enabled: bool = True, - no_cache: bool = False, - timeout: int = 3600, - **kwargs: Any - ) -> None: - """ - :keyword image_names: The fully qualified image names including the repository and tag. - :paramtype image_names: list[str] - :keyword source_location: The URL(absolute or relative) of the source that needs to be built. - For Docker build, it can be an URL to a tar or github repository as supported by Docker. - If it is relative URL, the relative path should be obtained from calling getSourceUploadUrl - API. Required. - :paramtype source_location: str - :keyword build_arguments: The collection of build arguments to be used. - :paramtype build_arguments: - list[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :keyword is_push_enabled: The value of this property indicates whether the image built should - be pushed to the registry or not. - :paramtype is_push_enabled: bool - :keyword no_cache: The value of this property indicates whether the image cache is enabled or - not. - :paramtype no_cache: bool - :keyword timeout: Build timeout in seconds. - :paramtype timeout: int - :keyword platform: The platform properties against which the build will happen. Required. - :paramtype platform: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.PlatformProperties - :keyword docker_file_path: The Docker file path relative to the source location. Required. - :paramtype docker_file_path: str - """ - super().__init__(**kwargs) - self.type: str = "QuickBuild" - self.image_names = image_names - self.source_location = source_location - self.build_arguments = build_arguments - self.is_push_enabled = is_push_enabled - self.no_cache = no_cache - self.timeout = timeout - self.platform = platform - self.docker_file_path = docker_file_path - - -class SourceControlAuthInfo(_serialization.Model): - """The authorization properties for accessing the source code repository. - - All required parameters must be populated in order to send to Azure. - - :ivar token_type: The type of Auth token. Known values are: "PAT" and "OAuth". - :vartype token_type: str or ~azure.mgmt.containerregistry.v2018_02_01_preview.models.TokenType - :ivar token: The access token used to access the source control provider. Required. - :vartype token: str - :ivar refresh_token: The refresh token used to refresh the access token. - :vartype refresh_token: str - :ivar scope: The scope of the access token. - :vartype scope: str - :ivar expires_in: Time in seconds that the token remains valid. - :vartype expires_in: int - """ - - _validation = { - "token": {"required": True}, - } - - _attribute_map = { - "token_type": {"key": "tokenType", "type": "str"}, - "token": {"key": "token", "type": "str"}, - "refresh_token": {"key": "refreshToken", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, - "expires_in": {"key": "expiresIn", "type": "int"}, - } - - def __init__( - self, - *, - token: str, - token_type: Optional[Union[str, "_models.TokenType"]] = None, - refresh_token: Optional[str] = None, - scope: Optional[str] = None, - expires_in: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword token_type: The type of Auth token. Known values are: "PAT" and "OAuth". - :paramtype token_type: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.TokenType - :keyword token: The access token used to access the source control provider. Required. - :paramtype token: str - :keyword refresh_token: The refresh token used to refresh the access token. - :paramtype refresh_token: str - :keyword scope: The scope of the access token. - :paramtype scope: str - :keyword expires_in: Time in seconds that the token remains valid. - :paramtype expires_in: int - """ - super().__init__(**kwargs) - self.token_type = token_type - self.token = token - self.refresh_token = refresh_token - self.scope = scope - self.expires_in = expires_in - - -class SourceRepositoryProperties(_serialization.Model): - """The properties of the source code repository. - - All required parameters must be populated in order to send to Azure. - - :ivar source_control_type: The type of source control service. Required. Known values are: - "Github" and "VisualStudioTeamService". - :vartype source_control_type: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlType - :ivar repository_url: The full URL to the source code repository. Required. - :vartype repository_url: str - :ivar is_commit_trigger_enabled: The value of this property indicates whether the source - control commit trigger is enabled or not. - :vartype is_commit_trigger_enabled: bool - :ivar source_control_auth_properties: The authorization properties for accessing the source - code repository. - :vartype source_control_auth_properties: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlAuthInfo - """ - - _validation = { - "source_control_type": {"required": True}, - "repository_url": {"required": True}, - } - - _attribute_map = { - "source_control_type": {"key": "sourceControlType", "type": "str"}, - "repository_url": {"key": "repositoryUrl", "type": "str"}, - "is_commit_trigger_enabled": {"key": "isCommitTriggerEnabled", "type": "bool"}, - "source_control_auth_properties": {"key": "sourceControlAuthProperties", "type": "SourceControlAuthInfo"}, - } - - def __init__( - self, - *, - source_control_type: Union[str, "_models.SourceControlType"], - repository_url: str, - is_commit_trigger_enabled: bool = False, - source_control_auth_properties: Optional["_models.SourceControlAuthInfo"] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_control_type: The type of source control service. Required. Known values are: - "Github" and "VisualStudioTeamService". - :paramtype source_control_type: str or - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlType - :keyword repository_url: The full URL to the source code repository. Required. - :paramtype repository_url: str - :keyword is_commit_trigger_enabled: The value of this property indicates whether the source - control commit trigger is enabled or not. - :paramtype is_commit_trigger_enabled: bool - :keyword source_control_auth_properties: The authorization properties for accessing the source - code repository. - :paramtype source_control_auth_properties: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlAuthInfo - """ - super().__init__(**kwargs) - self.source_control_type = source_control_type - self.repository_url = repository_url - self.is_commit_trigger_enabled = is_commit_trigger_enabled - self.source_control_auth_properties = source_control_auth_properties - - -class SourceRepositoryUpdateParameters(_serialization.Model): - """The properties for updating the source code repository configuration. - - :ivar source_control_auth_properties: The authorization properties for accessing the source - code repository. - :vartype source_control_auth_properties: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlAuthInfo - :ivar is_commit_trigger_enabled: The value of this property indicates whether the source - control commit trigger is enabled or not. - :vartype is_commit_trigger_enabled: bool - """ - - _attribute_map = { - "source_control_auth_properties": {"key": "sourceControlAuthProperties", "type": "SourceControlAuthInfo"}, - "is_commit_trigger_enabled": {"key": "isCommitTriggerEnabled", "type": "bool"}, - } - - def __init__( - self, - *, - source_control_auth_properties: Optional["_models.SourceControlAuthInfo"] = None, - is_commit_trigger_enabled: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_control_auth_properties: The authorization properties for accessing the source - code repository. - :paramtype source_control_auth_properties: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceControlAuthInfo - :keyword is_commit_trigger_enabled: The value of this property indicates whether the source - control commit trigger is enabled or not. - :paramtype is_commit_trigger_enabled: bool - """ - super().__init__(**kwargs) - self.source_control_auth_properties = source_control_auth_properties - self.is_commit_trigger_enabled = is_commit_trigger_enabled - - -class SourceUploadDefinition(_serialization.Model): - """The properties of a response to source upload request. - - :ivar upload_url: The URL where the client can upload the source. - :vartype upload_url: str - :ivar relative_path: The relative path to the source. This is used to submit the subsequent - queue build request. - :vartype relative_path: str - """ - - _attribute_map = { - "upload_url": {"key": "uploadUrl", "type": "str"}, - "relative_path": {"key": "relativePath", "type": "str"}, - } - - def __init__(self, *, upload_url: Optional[str] = None, relative_path: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword upload_url: The URL where the client can upload the source. - :paramtype upload_url: str - :keyword relative_path: The relative path to the source. This is used to submit the subsequent - queue build request. - :paramtype relative_path: str - """ - super().__init__(**kwargs) - self.upload_url = upload_url - self.relative_path = relative_path diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/__init__.py deleted file mode 100644 index cf2f497714be..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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 ._builds_operations import BuildsOperations -from ._build_steps_operations import BuildStepsOperations -from ._build_tasks_operations import BuildTasksOperations -from ._registries_operations import RegistriesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "BuildsOperations", - "BuildStepsOperations", - "BuildTasksOperations", - "RegistriesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_steps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_steps_operations.py deleted file mode 100644 index 4b086dbdffaf..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_steps_operations.py +++ /dev/null @@ -1,1220 +0,0 @@ -# pylint: disable=too-many-lines -# 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 _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, registry_name: str, build_task_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", "2018-02-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildTaskName": _SERIALIZER.url( - "build_task_name", build_task_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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, - registry_name: str, - build_task_name: str, - step_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", "2018-02-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildTaskName": _SERIALIZER.url( - "build_task_name", build_task_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "stepName": _SERIALIZER.url( - "step_name", step_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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_request( - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_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", "2018-02-01-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildTaskName": _SERIALIZER.url( - "build_task_name", build_task_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "stepName": _SERIALIZER.url( - "step_name", step_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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, - registry_name: str, - build_task_name: str, - step_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-02-01-preview")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildTaskName": _SERIALIZER.url( - "build_task_name", build_task_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "stepName": _SERIALIZER.url( - "step_name", step_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_update_request( - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_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", "2018-02-01-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildTaskName": _SERIALIZER.url( - "build_task_name", build_task_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "stepName": _SERIALIZER.url( - "step_name", step_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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_list_build_arguments_request( - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_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", "2018-02-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}/listBuildArguments", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildTaskName": _SERIALIZER.url( - "build_task_name", build_task_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "stepName": _SERIALIZER.url( - "step_name", step_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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 BuildStepsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.v2018_02_01_preview.ContainerRegistryManagementClient`'s - :attr:`build_steps` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, resource_group_name: str, registry_name: str, build_task_name: str, **kwargs: Any - ) -> Iterable["_models.BuildStep"]: - """List all the build steps for a given build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildStep or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildStepList] = 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, - registry_name=registry_name, - build_task_name=build_task_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) - - 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("BuildStepList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps" - } - - @distributed_trace - def get( - self, resource_group_name: str, registry_name: str, build_task_name: str, step_name: str, **kwargs: Any - ) -> _models.BuildStep: - """Gets the build step for a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildStep or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildStep] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BuildStep", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - def _create_initial( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_create_parameters: Union[_models.BuildStep, IO], - **kwargs: Any - ) -> _models.BuildStep: - 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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildStep] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_step_create_parameters, (IOBase, bytes)): - _content = build_step_create_parameters - else: - _json = self._serialize.body(build_step_create_parameters, "BuildStep") - - request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BuildStep", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BuildStep", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_create_parameters: _models.BuildStep, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildStep]: - """Creates a build step for a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :param build_step_create_parameters: The parameters for creating a build step. Required. - :type build_step_create_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep - :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 BuildStep or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_create_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildStep]: - """Creates a build step for a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :param build_step_create_parameters: The parameters for creating a build step. Required. - :type build_step_create_parameters: IO - :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 BuildStep or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_create_parameters: Union[_models.BuildStep, IO], - **kwargs: Any - ) -> LROPoller[_models.BuildStep]: - """Creates a build step for a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :param build_step_create_parameters: The parameters for creating a build step. Is either a - BuildStep type or a IO type. Required. - :type build_step_create_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep 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. - :return: An instance of LROPoller that returns either BuildStep or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildStep] = 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_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_name, - build_step_create_parameters=build_step_create_parameters, - 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("BuildStep", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, registry_name: str, build_task_name: str, step_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._api_version or "2018-02-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, registry_name: str, build_task_name: str, step_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a build step from the build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_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: - """ - _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._api_version or "2018-02-01-preview") - ) - 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, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_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, {}) - - 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.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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_update_parameters: Union[_models.BuildStepUpdateParameters, IO], - **kwargs: Any - ) -> _models.BuildStep: - 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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildStep] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_step_update_parameters, (IOBase, bytes)): - _content = build_step_update_parameters - else: - _json = self._serialize.body(build_step_update_parameters, "BuildStepUpdateParameters") - - request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BuildStep", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BuildStep", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_update_parameters: _models.BuildStepUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildStep]: - """Updates a build step in a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :param build_step_update_parameters: The parameters for updating a build step. Required. - :type build_step_update_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepUpdateParameters - :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 BuildStep or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_update_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildStep]: - """Updates a build step in a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :param build_step_update_parameters: The parameters for updating a build step. Required. - :type build_step_update_parameters: IO - :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 BuildStep or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - step_name: str, - build_step_update_parameters: Union[_models.BuildStepUpdateParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.BuildStep]: - """Updates a build step in a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :param build_step_update_parameters: The parameters for updating a build step. Is either a - BuildStepUpdateParameters type or a IO type. Required. - :type build_step_update_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStepUpdateParameters 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. - :return: An instance of LROPoller that returns either BuildStep or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildStep] - :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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildStep] = 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, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_name, - build_step_update_parameters=build_step_update_parameters, - 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("BuildStep", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}" - } - - @distributed_trace - def list_build_arguments( - self, resource_group_name: str, registry_name: str, build_task_name: str, step_name: str, **kwargs: Any - ) -> Iterable["_models.BuildArgument"]: - """List the build arguments for a step including the secret arguments. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param step_name: The name of a build step for a container registry build task. Required. - :type step_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildArgument or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildArgument] - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildArgumentList] = 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_build_arguments_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - step_name=step_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_build_arguments.metadata["url"], - 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("BuildArgumentList", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_build_arguments.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/steps/{stepName}/listBuildArguments" - } diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_tasks_operations.py deleted file mode 100644 index aae3c2dccae0..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_build_tasks_operations.py +++ /dev/null @@ -1,1134 +0,0 @@ -# pylint: disable=too-many-lines -# 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 _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, - registry_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - skip_token: Optional[str] = None, - **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", "2018-02-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, registry_name: str, build_task_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", "2018-02-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildTaskName": _SERIALIZER.url( - "build_task_name", build_task_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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_request( - resource_group_name: str, registry_name: str, build_task_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", "2018-02-01-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildTaskName": _SERIALIZER.url( - "build_task_name", build_task_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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, registry_name: str, build_task_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-02-01-preview")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildTaskName": _SERIALIZER.url( - "build_task_name", build_task_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, build_task_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", "2018-02-01-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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildTaskName": _SERIALIZER.url( - "build_task_name", build_task_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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_list_source_repository_properties_request( - resource_group_name: str, registry_name: str, build_task_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", "2018-02-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/listSourceRepositoryProperties", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildTaskName": _SERIALIZER.url( - "build_task_name", build_task_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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 BuildTasksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.v2018_02_01_preview.ContainerRegistryManagementClient`'s - :attr:`build_tasks` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, - resource_group_name: str, - registry_name: str, - filter: Optional[str] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.BuildTask"]: - """Lists all the build tasks for a specified container registry. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param filter: The build task filter to apply on the operation. Default value is None. - :type filter: str - :param skip_token: $skipToken is supported on get list of build tasks, which provides the next - page in the list of tasks. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildTask or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildTaskListResult] = 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, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - filter=filter, - skip_token=skip_token, - 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) - - 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("BuildTaskListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks" - } - - @distributed_trace - def get( - self, resource_group_name: str, registry_name: str, build_task_name: str, **kwargs: Any - ) -> _models.BuildTask: - """Get the properties of a specified build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildTask or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildTask] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BuildTask", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - def _create_initial( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_create_parameters: Union[_models.BuildTask, IO], - **kwargs: Any - ) -> _models.BuildTask: - 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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildTask] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_task_create_parameters, (IOBase, bytes)): - _content = build_task_create_parameters - else: - _json = self._serialize.body(build_task_create_parameters, "BuildTask") - - request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_initial.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BuildTask", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BuildTask", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_create_parameters: _models.BuildTask, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildTask]: - """Creates a build task for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param build_task_create_parameters: The parameters for creating a build task. Required. - :type build_task_create_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask - :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 BuildTask or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_create_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildTask]: - """Creates a build task for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param build_task_create_parameters: The parameters for creating a build task. Required. - :type build_task_create_parameters: IO - :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 BuildTask or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_create_parameters: Union[_models.BuildTask, IO], - **kwargs: Any - ) -> LROPoller[_models.BuildTask]: - """Creates a build task for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param build_task_create_parameters: The parameters for creating a build task. Is either a - BuildTask type or a IO type. Required. - :type build_task_create_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask 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. - :return: An instance of LROPoller that returns either BuildTask or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildTask] = 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_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - build_task_create_parameters=build_task_create_parameters, - 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("BuildTask", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, registry_name: str, build_task_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._api_version or "2018-02-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_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) - - _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, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, registry_name: str, build_task_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a specified build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_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: - """ - _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._api_version or "2018-02-01-preview") - ) - 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, - registry_name=registry_name, - build_task_name=build_task_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, {}) - - 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.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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_update_parameters: Union[_models.BuildTaskUpdateParameters, IO], - **kwargs: Any - ) -> _models.BuildTask: - 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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildTask] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_task_update_parameters, (IOBase, bytes)): - _content = build_task_update_parameters - else: - _json = self._serialize.body(build_task_update_parameters, "BuildTaskUpdateParameters") - - request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("BuildTask", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BuildTask", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_update_parameters: _models.BuildTaskUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildTask]: - """Updates a build task with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param build_task_update_parameters: The parameters for updating a build task. Required. - :type build_task_update_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskUpdateParameters - :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 BuildTask or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_update_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BuildTask]: - """Updates a build task with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param build_task_update_parameters: The parameters for updating a build task. Required. - :type build_task_update_parameters: IO - :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 BuildTask or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_task_name: str, - build_task_update_parameters: Union[_models.BuildTaskUpdateParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.BuildTask]: - """Updates a build task with the specified parameters. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :param build_task_update_parameters: The parameters for updating a build task. Is either a - BuildTaskUpdateParameters type or a IO type. Required. - :type build_task_update_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTaskUpdateParameters 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. - :return: An instance of LROPoller that returns either BuildTask or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildTask] - :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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BuildTask] = 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, - registry_name=registry_name, - build_task_name=build_task_name, - build_task_update_parameters=build_task_update_parameters, - 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("BuildTask", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}" - } - - @distributed_trace - def list_source_repository_properties( - self, resource_group_name: str, registry_name: str, build_task_name: str, **kwargs: Any - ) -> _models.SourceRepositoryProperties: - """Get the source control properties for a build task. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_task_name: The name of the container registry build task. Required. - :type build_task_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SourceRepositoryProperties or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceRepositoryProperties - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.SourceRepositoryProperties] = kwargs.pop("cls", None) - - request = build_list_source_repository_properties_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_task_name=build_task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_source_repository_properties.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SourceRepositoryProperties", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_source_repository_properties.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/buildTasks/{buildTaskName}/listSourceRepositoryProperties" - } diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_builds_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_builds_operations.py deleted file mode 100644 index a7272deae60c..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_builds_operations.py +++ /dev/null @@ -1,850 +0,0 @@ -# pylint: disable=too-many-lines -# 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 _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, - registry_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **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", "2018-02-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if skip_token is not None: - _params["$skipToken"] = _SERIALIZER.query("skip_token", skip_token, "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, registry_name: str, build_id: 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", "2018-02-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildId": _SERIALIZER.url("build_id", build_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_update_request( - resource_group_name: str, registry_name: str, build_id: 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", "2018-02-01-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.ContainerRegistry/registries/{registryName}/builds/{buildId}", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildId": _SERIALIZER.url("build_id", build_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 - 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_get_log_link_request( - resource_group_name: str, registry_name: str, build_id: 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", "2018-02-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/getLogLink", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildId": _SERIALIZER.url("build_id", build_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) - - -def build_cancel_request( - resource_group_name: str, registry_name: str, build_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-02-01-preview")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/cancel", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "buildId": _SERIALIZER.url("build_id", build_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - - -class BuildsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.v2018_02_01_preview.ContainerRegistryManagementClient`'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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, - resource_group_name: str, - registry_name: str, - filter: Optional[str] = None, - top: Optional[int] = None, - skip_token: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.Build"]: - """Gets all the builds for a registry. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param filter: The builds filter to apply on the operation. Default value is None. - :type filter: str - :param top: $top is supported for get list of builds, which limits the maximum number of builds - to return. Default value is None. - :type top: int - :param skip_token: $skipToken is supported on get list of builds, which provides the next page - in the list of builds. Default value is None. - :type skip_token: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Build or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildListResult] = 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, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - skip_token=skip_token, - 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) - - 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("BuildListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds" - } - - @distributed_trace - def get(self, resource_group_name: str, registry_name: str, build_id: str, **kwargs: Any) -> _models.Build: - """Gets the detailed information for a given build. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_id: The build ID. Required. - :type build_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Build or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_id=build_id, - 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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Build", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}" - } - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - build_id: str, - build_update_parameters: Union[_models.BuildUpdateParameters, IO], - **kwargs: Any - ) -> _models.Build: - 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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_update_parameters, (IOBase, bytes)): - _content = build_update_parameters - else: - _json = self._serialize.body(build_update_parameters, "BuildUpdateParameters") - - request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_id=build_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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) - - _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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize("Build", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Build", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}" - } - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_id: str, - build_update_parameters: _models.BuildUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Build]: - """Patch the build properties. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_id: The build ID. Required. - :type build_id: str - :param build_update_parameters: The build update properties. Required. - :type build_update_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildUpdateParameters - :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 Build or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_id: str, - build_update_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Build]: - """Patch the build properties. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_id: The build ID. Required. - :type build_id: str - :param build_update_parameters: The build update properties. Required. - :type build_update_parameters: IO - :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 Build or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - build_id: str, - build_update_parameters: Union[_models.BuildUpdateParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.Build]: - """Patch the build properties. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_id: The build ID. Required. - :type build_id: str - :param build_update_parameters: The build update properties. Is either a BuildUpdateParameters - type or a IO type. Required. - :type build_update_parameters: - ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildUpdateParameters 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. - :return: An instance of LROPoller that returns either Build or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = 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, - registry_name=registry_name, - build_id=build_id, - build_update_parameters=build_update_parameters, - 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("Build", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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.ContainerRegistry/registries/{registryName}/builds/{buildId}" - } - - @distributed_trace - def get_log_link( - self, resource_group_name: str, registry_name: str, build_id: str, **kwargs: Any - ) -> _models.BuildGetLogResult: - """Gets a link to download the build logs. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_id: The build ID. Required. - :type build_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildGetLogResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.BuildGetLogResult - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.BuildGetLogResult] = kwargs.pop("cls", None) - - request = build_get_log_link_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_id=build_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_log_link.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("BuildGetLogResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_log_link.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/getLogLink" - } - - def _cancel_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, registry_name: str, build_id: 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._api_version or "2018-02-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_cancel_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_id=build_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._cancel_initial.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _cancel_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/cancel" - } - - @distributed_trace - def begin_cancel( - self, resource_group_name: str, registry_name: str, build_id: str, **kwargs: Any - ) -> LROPoller[None]: - """Cancel an existing build. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_id: The build ID. Required. - :type build_id: 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: - """ - _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._api_version or "2018-02-01-preview") - ) - 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._cancel_initial( # type: ignore - resource_group_name=resource_group_name, - registry_name=registry_name, - build_id=build_id, - 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, {}) - - 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.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_cancel.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/builds/{buildId}/cancel" - } diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_registries_operations.py deleted file mode 100644 index 065c23097dd4..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/operations/_registries_operations.py +++ /dev/null @@ -1,421 +0,0 @@ -# pylint: disable=too-many-lines -# 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 _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_queue_build_request( - resource_group_name: str, registry_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", "2018-02-01-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.ContainerRegistry/registries/{registryName}/queueBuild", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_source_upload_url_request( - resource_group_name: str, registry_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", "2018-02-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/getBuildSourceUploadUrl", - ) # 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"), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _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 RegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.v2018_02_01_preview.ContainerRegistryManagementClient`'s - :attr:`registries` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - def _queue_build_initial( - self, - resource_group_name: str, - registry_name: str, - build_request: Union[_models.QueueBuildRequest, IO], - **kwargs: Any - ) -> Optional[_models.Build]: - 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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Build]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(build_request, (IOBase, bytes)): - _content = build_request - else: - _json = self._serialize.body(build_request, "QueueBuildRequest") - - request = build_queue_build_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._queue_build_initial.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Build", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _queue_build_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/queueBuild" - } - - @overload - def begin_queue_build( - self, - resource_group_name: str, - registry_name: str, - build_request: _models.QueueBuildRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Build]: - """Creates a new build based on the request parameters and add it to the build queue. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_request: The parameters of a build that needs to queued. Required. - :type build_request: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.QueueBuildRequest - :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 Build or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_queue_build( - self, - resource_group_name: str, - registry_name: str, - build_request: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Build]: - """Creates a new build based on the request parameters and add it to the build queue. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_request: The parameters of a build that needs to queued. Required. - :type build_request: IO - :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 Build or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_queue_build( - self, - resource_group_name: str, - registry_name: str, - build_request: Union[_models.QueueBuildRequest, IO], - **kwargs: Any - ) -> LROPoller[_models.Build]: - """Creates a new build based on the request parameters and add it to the build queue. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param build_request: The parameters of a build that needs to queued. Is either a - QueueBuildRequest type or a IO type. Required. - :type build_request: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.QueueBuildRequest - 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. - :return: An instance of LROPoller that returns either Build or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.v2018_02_01_preview.models.Build] - :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._api_version or "2018-02-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Build] = 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._queue_build_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - build_request=build_request, - 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("Build", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - 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.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_queue_build.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/queueBuild" - } - - @distributed_trace - def get_build_source_upload_url( - self, resource_group_name: str, registry_name: str, **kwargs: Any - ) -> _models.SourceUploadDefinition: - """Get the upload location for the user to be able to upload the source. - - :param resource_group_name: The name of the resource group to which the container registry - belongs. Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.v2018_02_01_preview.models.SourceUploadDefinition - :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._api_version or "2018-02-01-preview") - ) - cls: ClsType[_models.SourceUploadDefinition] = kwargs.pop("cls", None) - - request = build_get_build_source_upload_url_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get_build_source_upload_url.metadata["url"], - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SourceUploadDefinition", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_source_upload_url.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/getBuildSourceUploadUrl" - } diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/py.typed b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2018_02_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file