From d0c2e36e8e36371ed2b82cafdd6e47926dc7d4b7 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 Jan 2022 07:30:53 +0000 Subject: [PATCH] CodeGen from PR 16902 in Azure/azure-rest-api-specs Track2 modify readme.go.md 4 (#16902) * Track2 modify readme.go.md 4 * devops --- sdk/devops/azure-mgmt-devops/CHANGELOG.md | 5 + sdk/devops/azure-mgmt-devops/MANIFEST.in | 6 + sdk/devops/azure-mgmt-devops/README.md | 27 + sdk/devops/azure-mgmt-devops/_meta.json | 8 + .../azure-mgmt-devops/azure/__init__.py | 1 + .../azure-mgmt-devops/azure/mgmt/__init__.py | 1 + .../azure/mgmt/devops/__init__.py | 19 + .../azure/mgmt/devops/_configuration.py | 49 ++ .../azure/mgmt/devops/_dev_ops_client.py | 60 ++ .../azure/mgmt/devops/models/__init__.py | 67 +++ .../devops/models/_dev_ops_client_enums.py | 27 + .../azure/mgmt/devops/models/_models.py | 518 ++++++++++++++++++ .../azure/mgmt/devops/models/_models_py3.py | 518 ++++++++++++++++++ .../azure/mgmt/devops/models/_paged_models.py | 53 ++ .../azure/mgmt/devops/operations/__init__.py | 20 + .../mgmt/devops/operations/_operations.py | 103 ++++ ...ipeline_template_definitions_operations.py | 103 ++++ .../operations/_pipelines_operations.py | 468 ++++++++++++++++ .../azure/mgmt/devops/version.py | 13 + .../azure-mgmt-devops/sdk_packaging.toml | 8 + sdk/devops/azure-mgmt-devops/setup.cfg | 2 + sdk/devops/azure-mgmt-devops/setup.py | 91 +++ sdk/devops/ci.yml | 35 ++ 23 files changed, 2202 insertions(+) create mode 100644 sdk/devops/azure-mgmt-devops/CHANGELOG.md create mode 100644 sdk/devops/azure-mgmt-devops/MANIFEST.in create mode 100644 sdk/devops/azure-mgmt-devops/README.md create mode 100644 sdk/devops/azure-mgmt-devops/_meta.json create mode 100644 sdk/devops/azure-mgmt-devops/azure/__init__.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/__init__.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/__init__.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/_configuration.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/_dev_ops_client.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/__init__.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_dev_ops_client_enums.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_models.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_models_py3.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_paged_models.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/__init__.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/_operations.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/_pipeline_template_definitions_operations.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/_pipelines_operations.py create mode 100644 sdk/devops/azure-mgmt-devops/azure/mgmt/devops/version.py create mode 100644 sdk/devops/azure-mgmt-devops/sdk_packaging.toml create mode 100644 sdk/devops/azure-mgmt-devops/setup.cfg create mode 100644 sdk/devops/azure-mgmt-devops/setup.py create mode 100644 sdk/devops/ci.yml diff --git a/sdk/devops/azure-mgmt-devops/CHANGELOG.md b/sdk/devops/azure-mgmt-devops/CHANGELOG.md new file mode 100644 index 0000000000000..578ed6acf4796 --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/devops/azure-mgmt-devops/MANIFEST.in b/sdk/devops/azure-mgmt-devops/MANIFEST.in new file mode 100644 index 0000000000000..3a9b6517412bc --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/devops/azure-mgmt-devops/README.md b/sdk/devops/azure-mgmt-devops/README.md new file mode 100644 index 0000000000000..3ed54899306bd --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-devops%2FREADME.png) diff --git a/sdk/devops/azure-mgmt-devops/_meta.json b/sdk/devops/azure-mgmt-devops/_meta.json new file mode 100644 index 0000000000000..40ed3ac8c18ee --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "V2", + "use": "@microsoft.azure/autorest.python@~4.0.71", + "commit": "cea6492a1e41b3f3b4f8b4f69bdcc10431e79c0e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/devops/resource-manager/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2", + "readme": "specification/devops/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/devops/azure-mgmt-devops/azure/__init__.py b/sdk/devops/azure-mgmt-devops/azure/__init__.py new file mode 100644 index 0000000000000..0260537a02bb9 --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/__init__.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/__init__.py new file mode 100644 index 0000000000000..0260537a02bb9 --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/__init__.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/__init__.py new file mode 100644 index 0000000000000..e1de6280b77ce --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/__init__.py @@ -0,0 +1,19 @@ +# 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 ._configuration import DevOpsClientConfiguration +from ._dev_ops_client import DevOpsClient +__all__ = ['DevOpsClient', 'DevOpsClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/_configuration.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/_configuration.py new file mode 100644 index 0000000000000..33b981ea8ca6b --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/_configuration.py @@ -0,0 +1,49 @@ +# 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 msrestazure import AzureConfiguration + +from .version import VERSION + + +class DevOpsClientConfiguration(AzureConfiguration): + """Configuration for DevOpsClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Unique identifier of the Azure subscription. This + is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(DevOpsClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-devops/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/_dev_ops_client.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/_dev_ops_client.py new file mode 100644 index 0000000000000..fc3f9595a47bb --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/_dev_ops_client.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import DevOpsClientConfiguration +from .operations import Operations +from .operations import PipelineTemplateDefinitionsOperations +from .operations import PipelinesOperations +from . import models + + +class DevOpsClient(SDKClient): + """Azure DevOps Resource Provider + + :ivar config: Configuration for client. + :vartype config: DevOpsClientConfiguration + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.devops.operations.Operations + :ivar pipeline_template_definitions: PipelineTemplateDefinitions operations + :vartype pipeline_template_definitions: azure.mgmt.devops.operations.PipelineTemplateDefinitionsOperations + :ivar pipelines: Pipelines operations + :vartype pipelines: azure.mgmt.devops.operations.PipelinesOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Unique identifier of the Azure subscription. This + is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = DevOpsClientConfiguration(credentials, subscription_id, base_url) + super(DevOpsClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = '2019-07-01-preview' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.pipeline_template_definitions = PipelineTemplateDefinitionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.pipelines = PipelinesOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/__init__.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/__init__.py new file mode 100644 index 0000000000000..5b1b63488ff50 --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/__init__.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Authorization + from ._models_py3 import BootstrapConfiguration + from ._models_py3 import CodeRepository + from ._models_py3 import InputDescriptor + from ._models_py3 import InputValue + from ._models_py3 import Operation + from ._models_py3 import OrganizationReference + from ._models_py3 import Pipeline + from ._models_py3 import PipelineTemplate + from ._models_py3 import PipelineTemplateDefinition + from ._models_py3 import PipelineUpdateParameters + from ._models_py3 import ProjectReference + from ._models_py3 import Resource +except (SyntaxError, ImportError): + from ._models import Authorization + from ._models import BootstrapConfiguration + from ._models import CodeRepository + from ._models import InputDescriptor + from ._models import InputValue + from ._models import Operation + from ._models import OrganizationReference + from ._models import Pipeline + from ._models import PipelineTemplate + from ._models import PipelineTemplateDefinition + from ._models import PipelineUpdateParameters + from ._models import ProjectReference + from ._models import Resource +from ._paged_models import OperationPaged +from ._paged_models import PipelinePaged +from ._paged_models import PipelineTemplateDefinitionPaged +from ._dev_ops_client_enums import ( + InputDataType, + CodeRepositoryType, +) + +__all__ = [ + 'Authorization', + 'BootstrapConfiguration', + 'CodeRepository', + 'InputDescriptor', + 'InputValue', + 'Operation', + 'OrganizationReference', + 'Pipeline', + 'PipelineTemplate', + 'PipelineTemplateDefinition', + 'PipelineUpdateParameters', + 'ProjectReference', + 'Resource', + 'OperationPaged', + 'PipelineTemplateDefinitionPaged', + 'PipelinePaged', + 'InputDataType', + 'CodeRepositoryType', +] diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_dev_ops_client_enums.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_dev_ops_client_enums.py new file mode 100644 index 0000000000000..6ea349abbf419 --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_dev_ops_client_enums.py @@ -0,0 +1,27 @@ +# 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 + + +class InputDataType(str, Enum): + + string = "String" + secure_string = "SecureString" + int_enum = "Int" + bool_enum = "Bool" + authorization = "Authorization" + + +class CodeRepositoryType(str, Enum): + + git_hub = "gitHub" + vsts_git = "vstsGit" diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_models.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_models.py new file mode 100644 index 0000000000000..620a8f9dfc14a --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_models.py @@ -0,0 +1,518 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Authorization(Model): + """Authorization info used to access a resource (like code repository). + + 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 authorization_type: Required. Type of authorization. Default value: + "personalAccessToken" . + :vartype authorization_type: str + :param parameters: Authorization parameters corresponding to the + authorization type. + :type parameters: dict[str, str] + """ + + _validation = { + 'authorization_type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'authorization_type': {'key': 'authorizationType', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{str}'}, + } + + authorization_type = "personalAccessToken" + + def __init__(self, **kwargs): + super(Authorization, self).__init__(**kwargs) + self.parameters = kwargs.get('parameters', None) + + +class BootstrapConfiguration(Model): + """Configuration used to bootstrap a Pipeline. + + All required parameters must be populated in order to send to Azure. + + :param repository: Repository containing the source code for the pipeline. + :type repository: ~azure.mgmt.devops.models.CodeRepository + :param template: Required. Template used to bootstrap the pipeline. + :type template: ~azure.mgmt.devops.models.PipelineTemplate + """ + + _validation = { + 'template': {'required': True}, + } + + _attribute_map = { + 'repository': {'key': 'repository', 'type': 'CodeRepository'}, + 'template': {'key': 'template', 'type': 'PipelineTemplate'}, + } + + def __init__(self, **kwargs): + super(BootstrapConfiguration, self).__init__(**kwargs) + self.repository = kwargs.get('repository', None) + self.template = kwargs.get('template', None) + + +class CloudError(Model): + """An error response from the Pipelines Resource Provider. + + :param error: Details of the error from the Pipelines Resource Provider. + :type error: ~azure.mgmt.devops.models.CloudErrorBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + } + + def __init__(self, **kwargs): + super(CloudError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class CloudErrorBody(Model): + """An error response from the Pipelines Resource Provider. + + :param code: An identifier for the error. Codes are invariant and are + intended to be consumed programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable + for display in a user interface. + :type message: str + :param target: The target of the particular error. For example, the name + of the property in error or the method where the error occurred. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.devops.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__(self, **kwargs): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + + +class CodeRepository(Model): + """Repository containing the source code for a pipeline. + + All required parameters must be populated in order to send to Azure. + + :param repository_type: Required. Type of code repository. Possible values + include: 'gitHub', 'vstsGit' + :type repository_type: str or ~azure.mgmt.devops.models.CodeRepositoryType + :param id: Required. Unique immutable identifier of the code repository. + :type id: str + :param default_branch: Required. Default branch used to configure + Continuous Integration (CI) in the pipeline. + :type default_branch: str + :param authorization: Authorization info to access the code repository. + :type authorization: ~azure.mgmt.devops.models.Authorization + :param properties: Repository-specific properties. + :type properties: dict[str, str] + """ + + _validation = { + 'repository_type': {'required': True}, + 'id': {'required': True}, + 'default_branch': {'required': True}, + } + + _attribute_map = { + 'repository_type': {'key': 'repositoryType', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'default_branch': {'key': 'defaultBranch', 'type': 'str'}, + 'authorization': {'key': 'authorization', 'type': 'Authorization'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(CodeRepository, self).__init__(**kwargs) + self.repository_type = kwargs.get('repository_type', None) + self.id = kwargs.get('id', None) + self.default_branch = kwargs.get('default_branch', None) + self.authorization = kwargs.get('authorization', None) + self.properties = kwargs.get('properties', None) + + +class InputDescriptor(Model): + """Representation of a pipeline template input parameter. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Identifier of the input parameter. + :type id: str + :param description: Description of the input parameter. + :type description: str + :param type: Required. Data type of the value of the input parameter. + Possible values include: 'String', 'SecureString', 'Int', 'Bool', + 'Authorization' + :type type: str or ~azure.mgmt.devops.models.InputDataType + :param possible_values: List of possible values for the input parameter. + :type possible_values: list[~azure.mgmt.devops.models.InputValue] + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'possible_values': {'key': 'possibleValues', 'type': '[InputValue]'}, + } + + def __init__(self, **kwargs): + super(InputDescriptor, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.description = kwargs.get('description', None) + self.type = kwargs.get('type', None) + self.possible_values = kwargs.get('possible_values', None) + + +class InputValue(Model): + """Representation of a pipeline template input parameter value. + + :param value: Value of an input parameter. + :type value: str + :param display_value: Description of the input parameter value. + :type display_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'display_value': {'key': 'displayValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(InputValue, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.display_value = kwargs.get('display_value', None) + + +class Operation(Model): + """Properties of an Operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :param is_data_action: Indicates whether the operation applies to + data-plane. + :type is_data_action: str + :ivar operation: Friendly name of the operation. + :vartype operation: str + :ivar resource: Friendly name of the resource type the operation applies + to. + :vartype resource: str + :ivar description: Friendly description of the operation. + :vartype description: str + :ivar provider: Friendly name of the resource provider. + :vartype provider: str + """ + + _validation = { + 'name': {'readonly': True}, + 'operation': {'readonly': True}, + 'resource': {'readonly': True}, + 'description': {'readonly': True}, + 'provider': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'str'}, + 'operation': {'key': 'display.operation', 'type': 'str'}, + 'resource': {'key': 'display.resource', 'type': 'str'}, + 'description': {'key': 'display.description', 'type': 'str'}, + 'provider': {'key': 'display.provider', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = kwargs.get('is_data_action', None) + self.operation = None + self.resource = None + self.description = None + self.provider = None + + +class OrganizationReference(Model): + """Reference to an Azure DevOps Organization. + + 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: Unique immutable identifier for the Azure DevOps Organization. + :vartype id: str + :param name: Required. Name of the Azure DevOps Organization. + :type name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OrganizationReference, self).__init__(**kwargs) + self.id = None + self.name = kwargs.get('name', None) + + +class Resource(Model): + """An Azure Resource Manager (ARM) resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar type: Resource Type + :vartype type: str + :param tags: Resource Tags + :type tags: dict[str, str] + :param location: Resource Location + :type location: str + :ivar name: Resource Name + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.type = None + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + self.name = None + + +class Pipeline(Resource): + """Azure DevOps Pipeline used to configure Continuous Integration (CI) & + Continuous Delivery (CD) for Azure resources. + + 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: Resource Id + :vartype id: str + :ivar type: Resource Type + :vartype type: str + :param tags: Resource Tags + :type tags: dict[str, str] + :param location: Resource Location + :type location: str + :ivar name: Resource Name + :vartype name: str + :ivar pipeline_id: Unique identifier of the Azure Pipeline within the + Azure DevOps Project. + :vartype pipeline_id: int + :param organization: Required. Reference to the Azure DevOps Organization + containing the Pipeline. + :type organization: ~azure.mgmt.devops.models.OrganizationReference + :param project: Required. Reference to the Azure DevOps Project containing + the Pipeline. + :type project: ~azure.mgmt.devops.models.ProjectReference + :param bootstrap_configuration: Required. Configuration used to bootstrap + the Pipeline. + :type bootstrap_configuration: + ~azure.mgmt.devops.models.BootstrapConfiguration + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'pipeline_id': {'readonly': True}, + 'organization': {'required': True}, + 'project': {'required': True}, + 'bootstrap_configuration': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'pipeline_id': {'key': 'properties.pipelineId', 'type': 'int'}, + 'organization': {'key': 'properties.organization', 'type': 'OrganizationReference'}, + 'project': {'key': 'properties.project', 'type': 'ProjectReference'}, + 'bootstrap_configuration': {'key': 'properties.bootstrapConfiguration', 'type': 'BootstrapConfiguration'}, + } + + def __init__(self, **kwargs): + super(Pipeline, self).__init__(**kwargs) + self.pipeline_id = None + self.organization = kwargs.get('organization', None) + self.project = kwargs.get('project', None) + self.bootstrap_configuration = kwargs.get('bootstrap_configuration', None) + + +class PipelineTemplate(Model): + """Template used to bootstrap the pipeline. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique identifier of the pipeline template. + :type id: str + :param parameters: Dictionary of input parameters used in the pipeline + template. + :type parameters: dict[str, str] + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(PipelineTemplate, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.parameters = kwargs.get('parameters', None) + + +class PipelineTemplateDefinition(Model): + """Definition of a pipeline template. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique identifier of the pipeline template. + :type id: str + :param description: Description of the pipeline enabled by the template. + :type description: str + :param inputs: List of input parameters required by the template to create + a pipeline. + :type inputs: list[~azure.mgmt.devops.models.InputDescriptor] + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'inputs': {'key': 'inputs', 'type': '[InputDescriptor]'}, + } + + def __init__(self, **kwargs): + super(PipelineTemplateDefinition, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.description = kwargs.get('description', None) + self.inputs = kwargs.get('inputs', None) + + +class PipelineUpdateParameters(Model): + """Request payload used to update an existing Azure Pipeline. + + :param tags: Dictionary of key-value pairs to be set as tags on the Azure + Pipeline. This will overwrite any existing tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(PipelineUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class ProjectReference(Model): + """Reference to an Azure DevOps Project. + + 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: Unique immutable identifier of the Azure DevOps Project. + :vartype id: str + :param name: Required. Name of the Azure DevOps Project. + :type name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ProjectReference, self).__init__(**kwargs) + self.id = None + self.name = kwargs.get('name', None) diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_models_py3.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_models_py3.py new file mode 100644 index 0000000000000..96929867181e2 --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_models_py3.py @@ -0,0 +1,518 @@ +# 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 msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class Authorization(Model): + """Authorization info used to access a resource (like code repository). + + 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 authorization_type: Required. Type of authorization. Default value: + "personalAccessToken" . + :vartype authorization_type: str + :param parameters: Authorization parameters corresponding to the + authorization type. + :type parameters: dict[str, str] + """ + + _validation = { + 'authorization_type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'authorization_type': {'key': 'authorizationType', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{str}'}, + } + + authorization_type = "personalAccessToken" + + def __init__(self, *, parameters=None, **kwargs) -> None: + super(Authorization, self).__init__(**kwargs) + self.parameters = parameters + + +class BootstrapConfiguration(Model): + """Configuration used to bootstrap a Pipeline. + + All required parameters must be populated in order to send to Azure. + + :param repository: Repository containing the source code for the pipeline. + :type repository: ~azure.mgmt.devops.models.CodeRepository + :param template: Required. Template used to bootstrap the pipeline. + :type template: ~azure.mgmt.devops.models.PipelineTemplate + """ + + _validation = { + 'template': {'required': True}, + } + + _attribute_map = { + 'repository': {'key': 'repository', 'type': 'CodeRepository'}, + 'template': {'key': 'template', 'type': 'PipelineTemplate'}, + } + + def __init__(self, *, template, repository=None, **kwargs) -> None: + super(BootstrapConfiguration, self).__init__(**kwargs) + self.repository = repository + self.template = template + + +class CloudError(Model): + """An error response from the Pipelines Resource Provider. + + :param error: Details of the error from the Pipelines Resource Provider. + :type error: ~azure.mgmt.devops.models.CloudErrorBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(CloudError, self).__init__(**kwargs) + self.error = error + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class CloudErrorBody(Model): + """An error response from the Pipelines Resource Provider. + + :param code: An identifier for the error. Codes are invariant and are + intended to be consumed programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable + for display in a user interface. + :type message: str + :param target: The target of the particular error. For example, the name + of the property in error or the method where the error occurred. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.devops.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None: + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class CodeRepository(Model): + """Repository containing the source code for a pipeline. + + All required parameters must be populated in order to send to Azure. + + :param repository_type: Required. Type of code repository. Possible values + include: 'gitHub', 'vstsGit' + :type repository_type: str or ~azure.mgmt.devops.models.CodeRepositoryType + :param id: Required. Unique immutable identifier of the code repository. + :type id: str + :param default_branch: Required. Default branch used to configure + Continuous Integration (CI) in the pipeline. + :type default_branch: str + :param authorization: Authorization info to access the code repository. + :type authorization: ~azure.mgmt.devops.models.Authorization + :param properties: Repository-specific properties. + :type properties: dict[str, str] + """ + + _validation = { + 'repository_type': {'required': True}, + 'id': {'required': True}, + 'default_branch': {'required': True}, + } + + _attribute_map = { + 'repository_type': {'key': 'repositoryType', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'default_branch': {'key': 'defaultBranch', 'type': 'str'}, + 'authorization': {'key': 'authorization', 'type': 'Authorization'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__(self, *, repository_type, id: str, default_branch: str, authorization=None, properties=None, **kwargs) -> None: + super(CodeRepository, self).__init__(**kwargs) + self.repository_type = repository_type + self.id = id + self.default_branch = default_branch + self.authorization = authorization + self.properties = properties + + +class InputDescriptor(Model): + """Representation of a pipeline template input parameter. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Identifier of the input parameter. + :type id: str + :param description: Description of the input parameter. + :type description: str + :param type: Required. Data type of the value of the input parameter. + Possible values include: 'String', 'SecureString', 'Int', 'Bool', + 'Authorization' + :type type: str or ~azure.mgmt.devops.models.InputDataType + :param possible_values: List of possible values for the input parameter. + :type possible_values: list[~azure.mgmt.devops.models.InputValue] + """ + + _validation = { + 'id': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'possible_values': {'key': 'possibleValues', 'type': '[InputValue]'}, + } + + def __init__(self, *, id: str, type, description: str=None, possible_values=None, **kwargs) -> None: + super(InputDescriptor, self).__init__(**kwargs) + self.id = id + self.description = description + self.type = type + self.possible_values = possible_values + + +class InputValue(Model): + """Representation of a pipeline template input parameter value. + + :param value: Value of an input parameter. + :type value: str + :param display_value: Description of the input parameter value. + :type display_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'display_value': {'key': 'displayValue', 'type': 'str'}, + } + + def __init__(self, *, value: str=None, display_value: str=None, **kwargs) -> None: + super(InputValue, self).__init__(**kwargs) + self.value = value + self.display_value = display_value + + +class Operation(Model): + """Properties of an Operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Name of the operation. + :vartype name: str + :param is_data_action: Indicates whether the operation applies to + data-plane. + :type is_data_action: str + :ivar operation: Friendly name of the operation. + :vartype operation: str + :ivar resource: Friendly name of the resource type the operation applies + to. + :vartype resource: str + :ivar description: Friendly description of the operation. + :vartype description: str + :ivar provider: Friendly name of the resource provider. + :vartype provider: str + """ + + _validation = { + 'name': {'readonly': True}, + 'operation': {'readonly': True}, + 'resource': {'readonly': True}, + 'description': {'readonly': True}, + 'provider': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'str'}, + 'operation': {'key': 'display.operation', 'type': 'str'}, + 'resource': {'key': 'display.resource', 'type': 'str'}, + 'description': {'key': 'display.description', 'type': 'str'}, + 'provider': {'key': 'display.provider', 'type': 'str'}, + } + + def __init__(self, *, is_data_action: str=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = is_data_action + self.operation = None + self.resource = None + self.description = None + self.provider = None + + +class OrganizationReference(Model): + """Reference to an Azure DevOps Organization. + + 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: Unique immutable identifier for the Azure DevOps Organization. + :vartype id: str + :param name: Required. Name of the Azure DevOps Organization. + :type name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str, **kwargs) -> None: + super(OrganizationReference, self).__init__(**kwargs) + self.id = None + self.name = name + + +class Resource(Model): + """An Azure Resource Manager (ARM) resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource Id + :vartype id: str + :ivar type: Resource Type + :vartype type: str + :param tags: Resource Tags + :type tags: dict[str, str] + :param location: Resource Location + :type location: str + :ivar name: Resource Name + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, tags=None, location: str=None, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.type = None + self.tags = tags + self.location = location + self.name = None + + +class Pipeline(Resource): + """Azure DevOps Pipeline used to configure Continuous Integration (CI) & + Continuous Delivery (CD) for Azure resources. + + 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: Resource Id + :vartype id: str + :ivar type: Resource Type + :vartype type: str + :param tags: Resource Tags + :type tags: dict[str, str] + :param location: Resource Location + :type location: str + :ivar name: Resource Name + :vartype name: str + :ivar pipeline_id: Unique identifier of the Azure Pipeline within the + Azure DevOps Project. + :vartype pipeline_id: int + :param organization: Required. Reference to the Azure DevOps Organization + containing the Pipeline. + :type organization: ~azure.mgmt.devops.models.OrganizationReference + :param project: Required. Reference to the Azure DevOps Project containing + the Pipeline. + :type project: ~azure.mgmt.devops.models.ProjectReference + :param bootstrap_configuration: Required. Configuration used to bootstrap + the Pipeline. + :type bootstrap_configuration: + ~azure.mgmt.devops.models.BootstrapConfiguration + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'name': {'readonly': True}, + 'pipeline_id': {'readonly': True}, + 'organization': {'required': True}, + 'project': {'required': True}, + 'bootstrap_configuration': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'pipeline_id': {'key': 'properties.pipelineId', 'type': 'int'}, + 'organization': {'key': 'properties.organization', 'type': 'OrganizationReference'}, + 'project': {'key': 'properties.project', 'type': 'ProjectReference'}, + 'bootstrap_configuration': {'key': 'properties.bootstrapConfiguration', 'type': 'BootstrapConfiguration'}, + } + + def __init__(self, *, organization, project, bootstrap_configuration, tags=None, location: str=None, **kwargs) -> None: + super(Pipeline, self).__init__(tags=tags, location=location, **kwargs) + self.pipeline_id = None + self.organization = organization + self.project = project + self.bootstrap_configuration = bootstrap_configuration + + +class PipelineTemplate(Model): + """Template used to bootstrap the pipeline. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique identifier of the pipeline template. + :type id: str + :param parameters: Dictionary of input parameters used in the pipeline + template. + :type parameters: dict[str, str] + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '{str}'}, + } + + def __init__(self, *, id: str, parameters=None, **kwargs) -> None: + super(PipelineTemplate, self).__init__(**kwargs) + self.id = id + self.parameters = parameters + + +class PipelineTemplateDefinition(Model): + """Definition of a pipeline template. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique identifier of the pipeline template. + :type id: str + :param description: Description of the pipeline enabled by the template. + :type description: str + :param inputs: List of input parameters required by the template to create + a pipeline. + :type inputs: list[~azure.mgmt.devops.models.InputDescriptor] + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'inputs': {'key': 'inputs', 'type': '[InputDescriptor]'}, + } + + def __init__(self, *, id: str, description: str=None, inputs=None, **kwargs) -> None: + super(PipelineTemplateDefinition, self).__init__(**kwargs) + self.id = id + self.description = description + self.inputs = inputs + + +class PipelineUpdateParameters(Model): + """Request payload used to update an existing Azure Pipeline. + + :param tags: Dictionary of key-value pairs to be set as tags on the Azure + Pipeline. This will overwrite any existing tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(PipelineUpdateParameters, self).__init__(**kwargs) + self.tags = tags + + +class ProjectReference(Model): + """Reference to an Azure DevOps Project. + + 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: Unique immutable identifier of the Azure DevOps Project. + :vartype id: str + :param name: Required. Name of the Azure DevOps Project. + :type name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str, **kwargs) -> None: + super(ProjectReference, self).__init__(**kwargs) + self.id = None + self.name = name diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_paged_models.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_paged_models.py new file mode 100644 index 0000000000000..bcffe9fccc6d9 --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/models/_paged_models.py @@ -0,0 +1,53 @@ +# 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 msrest.paging import Paged + + +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class PipelineTemplateDefinitionPaged(Paged): + """ + A paging container for iterating over a list of :class:`PipelineTemplateDefinition ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PipelineTemplateDefinition]'} + } + + def __init__(self, *args, **kwargs): + + super(PipelineTemplateDefinitionPaged, self).__init__(*args, **kwargs) +class PipelinePaged(Paged): + """ + A paging container for iterating over a list of :class:`Pipeline ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Pipeline]'} + } + + def __init__(self, *args, **kwargs): + + super(PipelinePaged, self).__init__(*args, **kwargs) diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/__init__.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/__init__.py new file mode 100644 index 0000000000000..203dd8e671558 --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/__init__.py @@ -0,0 +1,20 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._pipeline_template_definitions_operations import PipelineTemplateDefinitionsOperations +from ._pipelines_operations import PipelinesOperations + +__all__ = [ + 'Operations', + 'PipelineTemplateDefinitionsOperations', + 'PipelinesOperations', +] diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/_operations.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/_operations.py new file mode 100644 index 0000000000000..e9076f13f25c1 --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/_operations.py @@ -0,0 +1,103 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: API version to be used with the HTTP request. Constant value: "2019-07-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-07-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all the operations supported by Microsoft.DevOps resource + provider. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.devops.models.OperationPaged[~azure.mgmt.devops.models.Operation] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.DevOps/operations'} diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/_pipeline_template_definitions_operations.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/_pipeline_template_definitions_operations.py new file mode 100644 index 0000000000000..29f44b4772fad --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/_pipeline_template_definitions_operations.py @@ -0,0 +1,103 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PipelineTemplateDefinitionsOperations(object): + """PipelineTemplateDefinitionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: API version to be used with the HTTP request. Constant value: "2019-07-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-07-01-preview" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all pipeline templates which can be used to configure an Azure + Pipeline. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PipelineTemplateDefinition + :rtype: + ~azure.mgmt.devops.models.PipelineTemplateDefinitionPaged[~azure.mgmt.devops.models.PipelineTemplateDefinition] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PipelineTemplateDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.DevOps/pipelineTemplateDefinitions'} diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/_pipelines_operations.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/_pipelines_operations.py new file mode 100644 index 0000000000000..13795d421b6c5 --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/operations/_pipelines_operations.py @@ -0,0 +1,468 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class PipelinesOperations(object): + """PipelinesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: API version to be used with the HTTP request. Constant value: "2019-07-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-07-01-preview" + + self.config = config + + + def _create_or_update_initial( + self, resource_group_name, pipeline_name, create_operation_parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'pipelineName': self._serialize.url("pipeline_name", pipeline_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(create_operation_parameters, 'Pipeline') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Pipeline', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, pipeline_name, create_operation_parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates an Azure Pipeline. + + :param resource_group_name: Name of the resource group within the + Azure subscription. + :type resource_group_name: str + :param pipeline_name: The name of the Azure Pipeline resource in ARM. + :type pipeline_name: str + :param create_operation_parameters: The request payload to create the + Azure Pipeline. + :type create_operation_parameters: ~azure.mgmt.devops.models.Pipeline + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Pipeline or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.devops.models.Pipeline] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.devops.models.Pipeline]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + pipeline_name=pipeline_name, + create_operation_parameters=create_operation_parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Pipeline', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOps/pipelines/{pipelineName}'} + + def get( + self, resource_group_name, pipeline_name, custom_headers=None, raw=False, **operation_config): + """Gets an existing Azure Pipeline. + + :param resource_group_name: Name of the resource group within the + Azure subscription. + :type resource_group_name: str + :param pipeline_name: The name of the Azure Pipeline resource in ARM. + :type pipeline_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Pipeline or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.devops.models.Pipeline or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'pipelineName': self._serialize.url("pipeline_name", pipeline_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Pipeline', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOps/pipelines/{pipelineName}'} + + def update( + self, resource_group_name, pipeline_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates the properties of an Azure Pipeline. Currently, only tags can + be updated. + + :param resource_group_name: Name of the resource group within the + Azure subscription. + :type resource_group_name: str + :param pipeline_name: The name of the Azure Pipeline resource. + :type pipeline_name: str + :param tags: Dictionary of key-value pairs to be set as tags on the + Azure Pipeline. This will overwrite any existing tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Pipeline or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.devops.models.Pipeline or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + update_operation_parameters = models.PipelineUpdateParameters(tags=tags) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'pipelineName': self._serialize.url("pipeline_name", pipeline_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(update_operation_parameters, 'PipelineUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Pipeline', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOps/pipelines/{pipelineName}'} + + def delete( + self, resource_group_name, pipeline_name, custom_headers=None, raw=False, **operation_config): + """Deletes an Azure Pipeline. + + :param resource_group_name: Name of the resource group within the + Azure subscription. + :type resource_group_name: str + :param pipeline_name: The name of the Azure Pipeline resource. + :type pipeline_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'pipelineName': self._serialize.url("pipeline_name", pipeline_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOps/pipelines/{pipelineName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Lists all Azure Pipelines under the specified resource group. + + :param resource_group_name: Name of the resource group within the + Azure subscription. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Pipeline + :rtype: + ~azure.mgmt.devops.models.PipelinePaged[~azure.mgmt.devops.models.Pipeline] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PipelinePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOps/pipelines'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Lists all Azure Pipelines under the specified subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Pipeline + :rtype: + ~azure.mgmt.devops.models.PipelinePaged[~azure.mgmt.devops.models.Pipeline] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PipelinePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DevOps/pipelines'} diff --git a/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/version.py b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/version.py new file mode 100644 index 0000000000000..5f9d05736100a --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/azure/mgmt/devops/version.py @@ -0,0 +1,13 @@ +# 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 = "2020-07-13-preview" + diff --git a/sdk/devops/azure-mgmt-devops/sdk_packaging.toml b/sdk/devops/azure-mgmt-devops/sdk_packaging.toml new file mode 100644 index 0000000000000..fc797d0b1ebec --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-mgmt-devops" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/devops/azure-mgmt-devops/setup.cfg b/sdk/devops/azure-mgmt-devops/setup.cfg new file mode 100644 index 0000000000000..3c6e79cf31da1 --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/devops/azure-mgmt-devops/setup.py b/sdk/devops/azure-mgmt-devops/setup.py new file mode 100644 index 0000000000000..21df68721e459 --- /dev/null +++ b/sdk/devops/azure-mgmt-devops/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-devops" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'msrestazure>=0.4.32,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/devops/ci.yml b/sdk/devops/ci.yml new file mode 100644 index 0000000000000..529aea3c2a46e --- /dev/null +++ b/sdk/devops/ci.yml @@ -0,0 +1,35 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/devops/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/devops/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: devops + Artifacts: + - name: azure-mgmt-devops + safeName: azuremgmtdevops