diff --git a/src/codesigning/HISTORY.rst b/src/codesigning/HISTORY.rst new file mode 100644 index 00000000000..1c139576ba0 --- /dev/null +++ b/src/codesigning/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/codesigning/README.md b/src/codesigning/README.md new file mode 100644 index 00000000000..4607b256867 --- /dev/null +++ b/src/codesigning/README.md @@ -0,0 +1,50 @@ +# Azure CLI codesigning Extension # +This is the extension for codesigning + +### How to use ### +Install this extension using the below CLI command +``` +az extension add --name codesigning +``` + +### Included Features ### +#### codesigning #### +##### Create ##### +``` +az codesigning create --name "MyAccount" --location "eastus" --resource-group "MyResourceGroup" +``` +##### Show ##### +``` +az codesigning show --name "MyAccount" --resource-group "MyResourceGroup" +``` +##### List ##### +``` +az codesigning list --resource-group "MyResourceGroup" +``` +##### Update ##### +``` +az codesigning update --name "MyAccount" --tags key1="value1" --resource-group "MyResourceGroup" +``` +##### Delete ##### +``` +az codesigning delete --name "MyAccount" --resource-group "MyResourceGroup" +``` +#### codesigning certificate-profile #### +##### Create ##### +``` +az codesigning certificate-profile create --account-name "MyAccount" --common-name "Contoso Inc" \ + --organization "Contoso Inc" --name "profileA" --resource-group "MyResourceGroup" +``` +##### Show ##### +``` +az codesigning certificate-profile show --account-name "MyAccount" --name "profileA" --resource-group "MyResourceGroup" +``` +##### List ##### +``` +az codesigning certificate-profile list --account-name "MyAccount" --resource-group "MyResourceGroup" +``` +##### Delete ##### +``` +az codesigning certificate-profile delete --account-name "MyAccount" --name "profileA" \ + --resource-group "MyResourceGroup" +``` \ No newline at end of file diff --git a/src/codesigning/azext_codesigning/__init__.py b/src/codesigning/azext_codesigning/__init__.py new file mode 100644 index 00000000000..5ea9994ec54 --- /dev/null +++ b/src/codesigning/azext_codesigning/__init__.py @@ -0,0 +1,50 @@ +# -------------------------------------------------------------------------- +# 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.cli.core import AzCommandsLoader +from azext_codesigning.generated._help import helps # pylint: disable=unused-import +try: + from azext_codesigning.manual._help import helps # pylint: disable=reimported +except ImportError: + pass + + +class CodeSigningManagementClientCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_codesigning.generated._client_factory import cf_codesigning_cl + codesigning_custom = CliCommandType( + operations_tmpl='azext_codesigning.custom#{}', + client_factory=cf_codesigning_cl) + parent = super(CodeSigningManagementClientCommandsLoader, self) + parent.__init__(cli_ctx=cli_ctx, custom_command_type=codesigning_custom) + + def load_command_table(self, args): + from azext_codesigning.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_codesigning.manual.commands import load_command_table as load_command_table_manual + load_command_table_manual(self, args) + except ImportError: + pass + return self.command_table + + def load_arguments(self, command): + from azext_codesigning.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_codesigning.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = CodeSigningManagementClientCommandsLoader diff --git a/src/codesigning/azext_codesigning/action.py b/src/codesigning/azext_codesigning/action.py new file mode 100644 index 00000000000..d95d53bf711 --- /dev/null +++ b/src/codesigning/azext_codesigning/action.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.action import * # noqa: F403 +try: + from .manual.action import * # noqa: F403 +except ImportError: + pass diff --git a/src/codesigning/azext_codesigning/azext_metadata.json b/src/codesigning/azext_codesigning/azext_metadata.json new file mode 100644 index 00000000000..cfc30c747c7 --- /dev/null +++ b/src/codesigning/azext_codesigning/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.15.0" +} \ No newline at end of file diff --git a/src/codesigning/azext_codesigning/custom.py b/src/codesigning/azext_codesigning/custom.py new file mode 100644 index 00000000000..dbe9d5f9742 --- /dev/null +++ b/src/codesigning/azext_codesigning/custom.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.custom import * # noqa: F403 +try: + from .manual.custom import * # noqa: F403 +except ImportError: + pass diff --git a/src/codesigning/azext_codesigning/generated/__init__.py b/src/codesigning/azext_codesigning/generated/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/codesigning/azext_codesigning/generated/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/codesigning/azext_codesigning/generated/_client_factory.py b/src/codesigning/azext_codesigning/generated/_client_factory.py new file mode 100644 index 00000000000..9db5734aa84 --- /dev/null +++ b/src/codesigning/azext_codesigning/generated/_client_factory.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + + +def cf_codesigning_cl(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from azext_codesigning.vendored_sdks.codesigning import CodeSigningManagementClient + return get_mgmt_service_client(cli_ctx, + CodeSigningManagementClient) + + +def cf_code_signing_account(cli_ctx, *_): + return cf_codesigning_cl(cli_ctx).code_signing_account + + +def cf_certificate_profile(cli_ctx, *_): + return cf_codesigning_cl(cli_ctx).certificate_profile diff --git a/src/codesigning/azext_codesigning/generated/_help.py b/src/codesigning/azext_codesigning/generated/_help.py new file mode 100644 index 00000000000..9eb274bc4ab --- /dev/null +++ b/src/codesigning/azext_codesigning/generated/_help.py @@ -0,0 +1,139 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['codesigning'] = """ + type: group + short-summary: Manage code signing account with codesigning +""" + +helps['codesigning list'] = """ + type: command + short-summary: "List Code Signing Accounts within a resource group And Lists Code Signing Accounts within a \ +subscription." + examples: + - name: List Code Signing Accounts by Resource Group + text: |- + az codesigning list --resource-group "MyResourceGroup" + - name: List Code Signing Accounts by Subscription + text: |- + az codesigning list +""" + +helps['codesigning show'] = """ + type: command + short-summary: "Get a Code Signing Account." + examples: + - name: Get Code Signing Account + text: |- + az codesigning show --name "MyAccount" --resource-group "MyResourceGroup" +""" + +helps['codesigning create'] = """ + type: command + short-summary: "Create a Code Signing Account." + examples: + - name: Create Code Signing Account + text: |- + az codesigning create --name "MyAccount" --location "eastus" --resource-group "MyResourceGroup" +""" + +helps['codesigning update'] = """ + type: command + short-summary: "Update a code signing account." + examples: + - name: Update Code Signing Account + text: |- + az codesigning update --name "MyAccount" --tags key1="value1" --resource-group "MyResourceGroup" +""" + +helps['codesigning delete'] = """ + type: command + short-summary: "Delete Code Signing Account." + examples: + - name: Delete Code Signing Account + text: |- + az codesigning delete --name "MyAccount" --resource-group "MyResourceGroup" +""" + +helps['codesigning wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the codesigning is met. + examples: + - name: Pause executing next line of CLI script until the codesigning is successfully created. + text: |- + az codesigning wait --name "MyAccount" --resource-group "MyResourceGroup" --created + - name: Pause executing next line of CLI script until the codesigning is successfully deleted. + text: |- + az codesigning wait --name "MyAccount" --resource-group "MyResourceGroup" --deleted +""" + +helps['codesigning certificate-profile'] = """ + type: group + short-summary: Manage certificate profile with codesigning +""" + +helps['codesigning certificate-profile list'] = """ + type: command + short-summary: "List certificate profiles within a code signing account." + examples: + - name: List Certificate Profiles + text: |- + az codesigning certificate-profile list --account-name "MyAccount" --resource-group "MyResourceGroup" +""" + +helps['codesigning certificate-profile show'] = """ + type: command + short-summary: "Get details of a certificate profile." + examples: + - name: Get Certificate Profile + text: |- + az codesigning certificate-profile show --account-name "MyAccount" --name "profileA" --resource-group \ +"MyResourceGroup" +""" + +helps['codesigning certificate-profile create'] = """ + type: command + short-summary: "Create a certificate profile." + examples: + - name: Create Certificate Profile + text: |- + az codesigning certificate-profile create --account-name "MyAccount" --common-name "Contoso Inc" \ +--organization "Contoso Inc" --name "profileA" --resource-group "MyResourceGroup" +""" + +helps['codesigning certificate-profile delete'] = """ + type: command + short-summary: "Delete a Certificate Profile." + examples: + - name: Delete Certificate Profile + text: |- + az codesigning certificate-profile delete --account-name "MyAccount" --name "profileA" --resource-group \ +"MyResourceGroup" +""" + +helps['codesigning certificate-profile wait'] = """ + type: command + short-summary: Place the CLI in a waiting state until a condition of the codesigning certificate-profile is met. + examples: + - name: Pause executing next line of CLI script until the codesigning certificate-profile is successfully \ +created. + text: |- + az codesigning certificate-profile wait --account-name "MyAccount" --name "profileA" --resource-group \ +"MyResourceGroup" --created + - name: Pause executing next line of CLI script until the codesigning certificate-profile is successfully \ +deleted. + text: |- + az codesigning certificate-profile wait --account-name "MyAccount" --name "profileA" --resource-group \ +"MyResourceGroup" --deleted +""" diff --git a/src/codesigning/azext_codesigning/generated/_params.py b/src/codesigning/azext_codesigning/generated/_params.py new file mode 100644 index 00000000000..a4788955e9a --- /dev/null +++ b/src/codesigning/azext_codesigning/generated/_params.py @@ -0,0 +1,77 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from azure.cli.core.commands.parameters import ( + tags_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group + + +def load_arguments(self, _): + + with self.argument_context('codesigning list') as c: + c.argument('resource_group_name', resource_group_name_type) + + with self.argument_context('codesigning show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('name', options_list=['--name', '-n'], type=str, help='Code Signing account name', id_part='name') + + with self.argument_context('codesigning create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('name', options_list=['--name', '-n'], type=str, help='Code Signing account name') + c.argument('tags', tags_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, + validator=get_default_location_from_resource_group) + + with self.argument_context('codesigning update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('name', options_list=['--name', '-n'], type=str, help='Code Signing account name', id_part='name') + c.argument('tags', tags_type) + + with self.argument_context('codesigning delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('name', options_list=['--name', '-n'], type=str, help='Code Signing account name', id_part='name') + + with self.argument_context('codesigning wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('name', options_list=['--name', '-n'], type=str, help='Code Signing account name', id_part='name') + + with self.argument_context('codesigning certificate-profile list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', type=str, help='Code Signing account name') + + with self.argument_context('codesigning certificate-profile show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', type=str, help='Code Signing account name', id_part='name') + c.argument('name', options_list=['--name', '-n'], type=str, help='Certificate profile name', + id_part='child_name_1') + + with self.argument_context('codesigning certificate-profile create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', type=str, help='Code Signing account name') + c.argument('name', options_list=['--name', '-n'], type=str, help='Certificate profile name') + c.argument('common_name', type=str, help='Used as CN in the subject name of the certificate') + c.argument('organization', type=str, help='Used as O in the subject name of the certificate') + + with self.argument_context('codesigning certificate-profile delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', type=str, help='Code Signing account name', id_part='name') + c.argument('name', options_list=['--name', '-n'], type=str, help='Certificate profile name', + id_part='child_name_1') + + with self.argument_context('codesigning certificate-profile wait') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('account_name', type=str, help='Code Signing account name', id_part='name') + c.argument('name', options_list=['--name', '-n'], type=str, help='Certificate profile name', + id_part='child_name_1') diff --git a/src/codesigning/azext_codesigning/generated/_validators.py b/src/codesigning/azext_codesigning/generated/_validators.py new file mode 100644 index 00000000000..b33a44c1ebf --- /dev/null +++ b/src/codesigning/azext_codesigning/generated/_validators.py @@ -0,0 +1,9 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- diff --git a/src/codesigning/azext_codesigning/generated/action.py b/src/codesigning/azext_codesigning/generated/action.py new file mode 100644 index 00000000000..b49bfaeeefe --- /dev/null +++ b/src/codesigning/azext_codesigning/generated/action.py @@ -0,0 +1,10 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access diff --git a/src/codesigning/azext_codesigning/generated/commands.py b/src/codesigning/azext_codesigning/generated/commands.py new file mode 100644 index 00000000000..522c6ab501f --- /dev/null +++ b/src/codesigning/azext_codesigning/generated/commands.py @@ -0,0 +1,43 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-statements +# pylint: disable=too-many-locals + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_codesigning.generated._client_factory import cf_code_signing_account + codesigning_code_signing_account = CliCommandType( + operations_tmpl='azext_codesigning.vendored_sdks.codesigning.operations._code_signing_account_operations#CodeSi' + 'gningAccountOperations.{}', + client_factory=cf_code_signing_account) + with self.command_group('codesigning', codesigning_code_signing_account, client_factory=cf_code_signing_account, + is_experimental=True) as g: + g.custom_command('list', 'codesigning_list') + g.custom_show_command('show', 'codesigning_show') + g.custom_command('create', 'codesigning_create', supports_no_wait=True) + g.custom_command('update', 'codesigning_update') + g.custom_command('delete', 'codesigning_delete', supports_no_wait=True, confirmation=True) + g.custom_wait_command('wait', 'codesigning_show') + + from azext_codesigning.generated._client_factory import cf_certificate_profile + codesigning_certificate_profile = CliCommandType( + operations_tmpl='azext_codesigning.vendored_sdks.codesigning.operations._certificate_profile_operations#Certifi' + 'cateProfileOperations.{}', + client_factory=cf_certificate_profile) + with self.command_group('codesigning certificate-profile', codesigning_certificate_profile, + client_factory=cf_certificate_profile) as g: + g.custom_command('list', 'codesigning_certificate_profile_list') + g.custom_show_command('show', 'codesigning_certificate_profile_show') + g.custom_command('create', 'codesigning_certificate_profile_create', supports_no_wait=True) + g.custom_command('delete', 'codesigning_certificate_profile_delete', supports_no_wait=True, confirmation=True) + g.custom_wait_command('wait', 'codesigning_certificate_profile_show') diff --git a/src/codesigning/azext_codesigning/generated/custom.py b/src/codesigning/azext_codesigning/generated/custom.py new file mode 100644 index 00000000000..412bd50dc5a --- /dev/null +++ b/src/codesigning/azext_codesigning/generated/custom.py @@ -0,0 +1,111 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from azure.cli.core.util import sdk_no_wait + + +def codesigning_list(client, + resource_group_name=None): + if resource_group_name: + return client.list_by_resource_group(resource_group_name=resource_group_name) + return client.list_by_subscription() + + +def codesigning_show(client, + resource_group_name, + name): + return client.get(resource_group_name=resource_group_name, + account_name=name) + + +def codesigning_create(client, + resource_group_name, + name, + tags=None, + location=None, + no_wait=False): + code_signing_account = {} + code_signing_account['tags'] = tags + code_signing_account['location'] = location + return sdk_no_wait(no_wait, + client.begin_create, + resource_group_name=resource_group_name, + account_name=name, + code_signing_account=code_signing_account) + + +def codesigning_update(client, + resource_group_name, + name, + tags=None): + code_signing_account_patch = {} + code_signing_account_patch['tags'] = tags + return client.update(resource_group_name=resource_group_name, + account_name=name, + code_signing_account_patch=code_signing_account_patch) + + +def codesigning_delete(client, + resource_group_name, + name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + account_name=name) + + +def codesigning_certificate_profile_list(client, + resource_group_name, + account_name): + return client.list_by_code_signing_account(resource_group_name=resource_group_name, + account_name=account_name) + + +def codesigning_certificate_profile_show(client, + resource_group_name, + account_name, + name): + return client.get(resource_group_name=resource_group_name, + account_name=account_name, + profile_name=name) + + +def codesigning_certificate_profile_create(client, + resource_group_name, + account_name, + name, + common_name, + organization, + no_wait=False): + certificate_profile = {} + certificate_profile['profile_type'] = "PublicTrust" + certificate_profile['rotation_policy'] = "30 Days" + certificate_profile['common_name'] = common_name + certificate_profile['organization'] = organization + return sdk_no_wait(no_wait, + client.begin_create, + resource_group_name=resource_group_name, + account_name=account_name, + profile_name=name, + certificate_profile=certificate_profile) + + +def codesigning_certificate_profile_delete(client, + resource_group_name, + account_name, + name, + no_wait=False): + return sdk_no_wait(no_wait, + client.begin_delete, + resource_group_name=resource_group_name, + account_name=account_name, + profile_name=name) diff --git a/src/codesigning/azext_codesigning/manual/__init__.py b/src/codesigning/azext_codesigning/manual/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/codesigning/azext_codesigning/manual/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/codesigning/azext_codesigning/tests/__init__.py b/src/codesigning/azext_codesigning/tests/__init__.py new file mode 100644 index 00000000000..70488e93851 --- /dev/null +++ b/src/codesigning/azext_codesigning/tests/__init__.py @@ -0,0 +1,116 @@ +# 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 inspect +import logging +import os +import sys +import traceback +import datetime as dt + +from azure.core.exceptions import AzureError +from azure.cli.testsdk.exceptions import CliTestError, CliExecutionError, JMESPathCheckAssertionError + + +logger = logging.getLogger('azure.cli.testsdk') +logger.addHandler(logging.StreamHandler()) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) +exceptions = [] +test_map = dict() +SUCCESSED = "successed" +FAILED = "failed" + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func).lower() + module_path = __path__[0].lower() + if not decorated_path.startswith(module_path): + raise Exception("Decorator can only be used in submodules!") + manual_path = os.path.join( + decorated_path[module_path.rfind(os.path.sep) + 1:]) + manual_file_path, manual_file_name = os.path.split(manual_path) + module_name, _ = os.path.splitext(manual_file_name) + manual_module = "..manual." + \ + ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) + return getattr(import_module(manual_module, package=__name__), origin_func.__name__) + + def get_func_to_call(): + func_to_call = func + try: + func_to_call = import_manual_function(func) + logger.info("Found manual override for %s(...)", func.__name__) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + logger.info("running %s()...", func.__name__) + try: + test_map[func.__name__] = dict() + test_map[func.__name__]["result"] = SUCCESSED + test_map[func.__name__]["error_message"] = "" + test_map[func.__name__]["error_stack"] = "" + test_map[func.__name__]["error_normalized"] = "" + test_map[func.__name__]["start_dt"] = dt.datetime.utcnow() + ret = func_to_call(*args, **kwargs) + except (AssertionError, AzureError, CliTestError, CliExecutionError, SystemExit, + JMESPathCheckAssertionError) as e: + use_exception_cache = os.getenv("TEST_EXCEPTION_CACHE") + if use_exception_cache is None or use_exception_cache.lower() != "true": + raise + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + test_map[func.__name__]["result"] = FAILED + test_map[func.__name__]["error_message"] = str(e).replace("\r\n", " ").replace("\n", " ")[:500] + test_map[func.__name__]["error_stack"] = traceback.format_exc().replace( + "\r\n", " ").replace("\n", " ")[:500] + logger.info("--------------------------------------") + logger.info("step exception: %s", e) + logger.error("--------------------------------------") + logger.error("step exception in %s: %s", func.__name__, e) + logger.info(traceback.format_exc()) + exceptions.append((func.__name__, sys.exc_info())) + else: + test_map[func.__name__]["end_dt"] = dt.datetime.utcnow() + return ret + + if inspect.isclass(func): + return get_func_to_call() + return wrapper + + +def calc_coverage(filename): + filename = filename.split(".")[0] + coverage_name = filename + "_coverage.md" + with open(coverage_name, "w") as f: + f.write("|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt|\n") + total = len(test_map) + covered = 0 + for k, v in test_map.items(): + if not k.startswith("step_"): + total -= 1 + continue + if v["result"] == SUCCESSED: + covered += 1 + f.write("|{step_name}|{result}|{error_message}|{error_stack}|{error_normalized}|{start_dt}|" + "{end_dt}|\n".format(step_name=k, **v)) + f.write("Coverage: {}/{}\n".format(covered, total)) + print("Create coverage\n", file=sys.stderr) + + +def raise_if(): + if exceptions: + if len(exceptions) <= 1: + raise exceptions[0][1][1] + message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1])) + message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]]) + raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2]) diff --git a/src/codesigning/azext_codesigning/tests/latest/__init__.py b/src/codesigning/azext_codesigning/tests/latest/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/codesigning/azext_codesigning/tests/latest/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/codesigning/azext_codesigning/tests/latest/example_steps.py b/src/codesigning/azext_codesigning/tests/latest/example_steps.py new file mode 100644 index 00000000000..50126f3cbd8 --- /dev/null +++ b/src/codesigning/azext_codesigning/tests/latest/example_steps.py @@ -0,0 +1,127 @@ +# -------------------------------------------------------------------------- +# 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 .. import try_manual + + +# EXAMPLE: /CertificateProfile/put/Create Certificate Profile +@try_manual +def step_certificate_profile_create(test, rg, checks=None): # pylint: disable=unused-argument + if checks is None: + checks = [] + test.cmd('az codesigning certificate-profile create ' + '--account-name "MyAccount" ' + '--common-name "Contoso Inc" ' + '--organization "Contoso Inc" ' + '--name "profileA" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /CertificateProfile/get/Get Certificate Profile +@try_manual +def step_certificate_profile_show(test, rg, checks=None): # pylint: disable=unused-argument + if checks is None: + checks = [] + test.cmd('az codesigning certificate-profile show ' + '--account-name "MyAccount" ' + '--name "profileA" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /CertificateProfile/get/List Certificate Profiles +@try_manual +def step_certificate_profile_list(test, rg, checks=None): # pylint: disable=unused-argument + if checks is None: + checks = [] + test.cmd('az codesigning certificate-profile list ' + '--account-name "MyAccount" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /CertificateProfile/delete/Delete Certificate Profile +@try_manual +def step_certificate_profile_delete(test, rg, checks=None): # pylint: disable=unused-argument + if checks is None: + checks = [] + test.cmd('az codesigning certificate-profile delete -y ' + '--account-name "MyAccount" ' + '--name "profileA" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /CodeSigningAccount/put/Create Code Signing Account +@try_manual +def step_create(test, rg, checks=None): # pylint: disable=unused-argument + if checks is None: + checks = [] + test.cmd('az codesigning create ' + '--name "MyAccount" ' + '--location "eastus" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /CodeSigningAccount/get/Get Code Signing Account +@try_manual +def step_show(test, rg, checks=None): # pylint: disable=unused-argument + if checks is None: + checks = [] + test.cmd('az codesigning show ' + '--name "MyAccount" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /CodeSigningAccount/get/List Code Signing Accounts by Resource Group +@try_manual +def step_list(test, rg, checks=None): # pylint: disable=unused-argument + if checks is None: + checks = [] + test.cmd('az codesigning list ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /CodeSigningAccount/get/List Code Signing Accounts by Subscription +@try_manual +def step_list2(test, rg, checks=None): # pylint: disable=unused-argument + if checks is None: + checks = [] + test.cmd('az codesigning list ' + '-g ""', + checks=checks) + + +# EXAMPLE: /CodeSigningAccount/patch/Update Code Signing Account +@try_manual +def step_update(test, rg, checks=None): # pylint: disable=unused-argument + if checks is None: + checks = [] + test.cmd('az codesigning update ' + '--name "MyAccount" ' + '--tags key1="value1" ' + '--resource-group "{rg}"', + checks=checks) + + +# EXAMPLE: /CodeSigningAccount/delete/Delete Code Signing Account +@try_manual +def step_delete(test, rg, checks=None): # pylint: disable=unused-argument + if checks is None: + checks = [] + test.cmd('az codesigning delete -y ' + '--name "MyAccount" ' + '--resource-group "{rg}"', + checks=checks) diff --git a/src/codesigning/azext_codesigning/tests/latest/recordings/test_codesigning_Scenario.yaml b/src/codesigning/azext_codesigning/tests/latest/recordings/test_codesigning_Scenario.yaml new file mode 100644 index 00000000000..a6c9b32715c --- /dev/null +++ b/src/codesigning/azext_codesigning/tests/latest/recordings/test_codesigning_Scenario.yaml @@ -0,0 +1,1100 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F8c0f0bff-5806-4d21-8802-ebe21a1afa4f%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/8c0f0bff-5806-4d21-8802-ebe21a1afa4f/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:09:45 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=AoFi0qrsTuxDoJ9BOl10KPo; expires=Fri, 02-Jul-2021 11:09:46 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevrzt2CFVGyKjLTBxUuaLBt401CiR-wqS4SM9ATwUcIAdCksyAoYhrfrTH1PhT-CjSh1Td-ZflG3tvAfmwidNp3H3QeZUmDUmTL38Fx4AqX8yNHc7ju4tn1DIdYg_8v5YrT8ookqAPwnQebqGOf3GudLsYepkXlOSB2MT3bcqgyeBcgAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11722.21 - KRSLR2 ProdSlices + status: + code: 200 + message: OK +- request: + body: '{"location": "eastus"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - codesigning create + Connection: + - keep-alive + Content-Length: + - '22' + Content-Type: + - application/json + ParameterSetName: + - --name --location --resource-group + User-Agent: + - AZURECLI/2.17.1 azsdk-python-mgmt-codesigning/0.1.0 Python/3.7.9 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount?api-version=2020-12-14-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount","name":"MyAccount","type":"microsoft.codesigning/codesigningaccounts","location":"eastus","systemData":{"createdBy":"billtest124476@outlook.com","createdByType":"User","createdAt":"2021-06-02T11:09:52.2908382Z","lastModifiedBy":"billtest124476@outlook.com","lastModifiedByType":"User","lastModifiedAt":"2021-06-02T11:09:52.2908382Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '594' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:09:55 GMT + etag: + - '"00001b57-0000-0700-0000-60b767030000"' + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId= + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-msedge-ref: + - 'Ref A: 75CD3DDF37904736BE88E2C1D6010B19 Ref B: MAA01EDGE0407 Ref C: 2021-06-02T11:09:46Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F8c0f0bff-5806-4d21-8802-ebe21a1afa4f%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/8c0f0bff-5806-4d21-8802-ebe21a1afa4f/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:09:56 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=AvnsSycYX9VIu5jaOAC12_c; expires=Fri, 02-Jul-2021 11:09:56 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrkHMHlKTieOuQGMZAYQTihsYznEtTf1IqzwQtavoAQZl6muQVOi6T7QcJS_3RUEmWAmf9nrOTTM7OIFgXElV9o4F9z-2qXhW3lZvY8HiT8njtY_1P1LEF7GXeX2dOWQkQf_dlzPHcAVxZFVu6HwFipRzOhkSgboYMv_2TsO-BPd4gAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11722.21 - SEASLR1 ProdSlices + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - codesigning show + Connection: + - keep-alive + ParameterSetName: + - --name --resource-group + User-Agent: + - AZURECLI/2.17.1 azsdk-python-mgmt-codesigning/0.1.0 Python/3.7.9 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount?api-version=2020-12-14-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount","name":"MyAccount","type":"microsoft.codesigning/codesigningaccounts","location":"eastus","systemData":{"createdBy":"billtest124476@outlook.com","createdByType":"User","createdAt":"2021-06-02T11:09:52.2908382Z","lastModifiedBy":"billtest124476@outlook.com","lastModifiedByType":"User","lastModifiedAt":"2021-06-02T11:09:52.2908382Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '594' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:09:57 GMT + etag: + - '"00001b57-0000-0700-0000-60b767030000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: 637CB604001C40AEB97CCCDF71A602C7 Ref B: MAA01EDGE0605 Ref C: 2021-06-02T11:09:56Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F8c0f0bff-5806-4d21-8802-ebe21a1afa4f%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/8c0f0bff-5806-4d21-8802-ebe21a1afa4f/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:09:57 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=Ak24b3oMCqtLpvoAXyZBa9M; expires=Fri, 02-Jul-2021 11:09:58 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevrt3fx2VKXKcnIRgudIipIIUbYgcSjdWU_sA4Rgi2H2VZdqqDAaU3JTWGX0xWXWKMXIGJFRpabs2B9ygdNweOJSmYfmEKcB8ybkil6j9yKRnQkP8ohVCW2Cm_Zntb9W9mIVLnHnvJ3AoOsovvFthkm2GzjJrhHw8TIrHC2GbO2_gAgAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11722.21 - KRSLR1 ProdSlices + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - codesigning list + Connection: + - keep-alive + ParameterSetName: + - --resource-group + User-Agent: + - AZURECLI/2.17.1 azsdk-python-mgmt-codesigning/0.1.0 Python/3.7.9 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts?api-version=2020-12-14-preview + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount","name":"MyAccount","type":"microsoft.codesigning/codesigningaccounts","location":"eastus","systemData":{"createdBy":"billtest124476@outlook.com","createdByType":"User","createdAt":"2021-06-02T11:09:52.2908382Z","lastModifiedBy":"billtest124476@outlook.com","lastModifiedByType":"User","lastModifiedAt":"2021-06-02T11:09:52.2908382Z"},"properties":{"provisioningState":"Succeeded"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '606' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:09:58 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - f385673a-3701-493c-90e5-bf733e4cd919 + - f5ddfbda-27d1-490b-afdc-ddf4d17be517 + - 85a2b7ef-69e2-4572-9ee6-21e28a2a72ff + x-msedge-ref: + - 'Ref A: 24863C86222E4CEFA6C02757D60359AD Ref B: MAA01EDGE0508 Ref C: 2021-06-02T11:09:58Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F8c0f0bff-5806-4d21-8802-ebe21a1afa4f%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/8c0f0bff-5806-4d21-8802-ebe21a1afa4f/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:09:59 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=ApqzJACJ5dlIs3g73L0Tb3U; expires=Fri, 02-Jul-2021 11:09:59 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrjMQxeBHW2gNWFoFwzvogMq_3MoAlcrQR4zyf0D5Jw8LAZCzeBTIn_b1pNM7biaTjWVLC_uSLG0sdLmwHxXCyHrtH2qud3Yc4ke5O5n8rNVk9bFkKsrOB_07GoZ9yrXmYBMAI5TwpTxQWO-lO9VSG_T734zSGTDtPj2WB8MMqMLsgAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11722.21 - SEASLR1 ProdSlices + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - codesigning list + Connection: + - keep-alive + ParameterSetName: + - -g + User-Agent: + - AZURECLI/2.17.1 azsdk-python-mgmt-codesigning/0.1.0 Python/3.7.9 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.CodeSigning/codeSigningAccounts?api-version=2020-12-14-preview + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/amritarg/providers/Microsoft.CodeSigning/codeSigningAccounts/account1","name":"account1","type":"microsoft.codesigning/codesigningaccounts","location":"eastus","systemData":{"createdBy":"billtest124476@outlook.com","createdByType":"User","createdAt":"2021-06-02T09:07:18.735511Z","lastModifiedBy":"billtest124476@outlook.com","lastModifiedByType":"User","lastModifiedAt":"2021-06-02T09:07:18.735511Z"},"properties":{"provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount","name":"MyAccount","type":"microsoft.codesigning/codesigningaccounts","location":"eastus","systemData":{"createdBy":"billtest124476@outlook.com","createdByType":"User","createdAt":"2021-06-02T11:09:52.2908382Z","lastModifiedBy":"billtest124476@outlook.com","lastModifiedByType":"User","lastModifiedAt":"2021-06-02T11:09:52.2908382Z"},"properties":{"provisioningState":"Succeeded"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '1130' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:10:00 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - aa4f7a0d-4940-445a-ad2f-b5e055110299 + - f888cb19-4a23-429f-97f5-565b016926a9 + - 539d6220-b2d1-433f-a178-ca81baa4365f + x-msedge-ref: + - 'Ref A: 12284080070248C0A1763F7F2E69106F Ref B: MAA01EDGE0506 Ref C: 2021-06-02T11:09:59Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F8c0f0bff-5806-4d21-8802-ebe21a1afa4f%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/8c0f0bff-5806-4d21-8802-ebe21a1afa4f/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:10:00 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=Am-yQradxTJIjttWwFAGZ2A; expires=Fri, 02-Jul-2021 11:10:01 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr3440iJkFKSBWwENLKYR5FINk61rHQcZb59iIF0X6uMQs_UIXNewlpNjEOBJ-jdlBzpc09Y8CaegQ03-Y7FyrHubO288rYUTc-7M_D6SIHWfDzvAe0ZeW-8Z6D4Uoi2Lacq81Z67N5DfSFeLKCbEkOSOY21uyT-cWkO5f_mPFiPIgAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11722.21 - KRSLR1 ProdSlices + status: + code: 200 + message: OK +- request: + body: '{"tags": {"key1": "value1"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - codesigning update + Connection: + - keep-alive + Content-Length: + - '28' + Content-Type: + - application/json + ParameterSetName: + - --name --tags --resource-group + User-Agent: + - AZURECLI/2.17.1 azsdk-python-mgmt-codesigning/0.1.0 Python/3.7.9 (Windows-10-10.0.19041-SP0) + method: PATCH + uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount?api-version=2020-12-14-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount","name":"MyAccount","type":"microsoft.codesigning/codesigningaccounts","location":"eastus","tags":{"key1":"value1"},"systemData":{"createdBy":"billtest124476@outlook.com","createdByType":"User","createdAt":"2021-06-02T11:09:52.2908382Z","lastModifiedBy":"billtest124476@outlook.com","lastModifiedByType":"User","lastModifiedAt":"2021-06-02T11:10:02.5447071Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '619' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:10:05 GMT + etag: + - '"00004557-0000-0700-0000-60b7670b0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1197' + x-msedge-ref: + - 'Ref A: 157A72FDBD0745798AD36DA21D05501C Ref B: MAA01EDGE0616 Ref C: 2021-06-02T11:10:01Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F8c0f0bff-5806-4d21-8802-ebe21a1afa4f%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/8c0f0bff-5806-4d21-8802-ebe21a1afa4f/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:10:05 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=AmhZn0A98VlIlijIl3jpDuo; expires=Fri, 02-Jul-2021 11:10:05 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrHjThGnB7_dZEYpT8Pv2NxB6my8QLaIQSmyZXBBphYm8yNj3rPAma5NKHxyLxttBV73LHi2falOLQsIy2ZV-HScc0D52HX2ZThiQbH3UuRSzzxWV7VY2r-Vp4SWlXly919FJHBFumNmmNoVtOdU3IqwdQ-uPFQCDYHx82-kq2W8YgAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11722.21 - SEASLR2 ProdSlices + status: + code: 200 + message: OK +- request: + body: '{"properties": {"profileType": "PublicTrust", "rotationPolicy": "30 Days", + "commonName": "Contoso Inc", "organization": "Contoso Inc"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - codesigning certificate-profile create + Connection: + - keep-alive + Content-Length: + - '135' + Content-Type: + - application/json + ParameterSetName: + - --account-name --common-name --organization --name --resource-group + User-Agent: + - AZURECLI/2.17.1 azsdk-python-mgmt-codesigning/0.1.0 Python/3.7.9 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount/certificateProfiles/profileA?api-version=2020-12-14-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount/certificateProfiles/profileA","name":"profileA","type":"microsoft.codesigning/codesigningaccounts/certificateprofiles","systemData":{"createdBy":"billtest124476@outlook.com","createdByType":"User","createdAt":"2021-06-02T11:10:06.6020053Z","lastModifiedBy":"billtest124476@outlook.com","lastModifiedByType":"User","lastModifiedAt":"2021-06-02T11:10:06.6020053Z"},"properties":{"profileType":"PublicTrust","rotationPolicy":"30 + Days","commonName":"Contoso Inc","organization":"Contoso Inc","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '733' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:10:07 GMT + etag: + - '"05006708-0000-0700-0000-60b767100000"' + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId= + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + x-msedge-ref: + - 'Ref A: 5F25B257D15D4B8A84D146EBF3F65A0D Ref B: MAA01EDGE0515 Ref C: 2021-06-02T11:10:05Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F8c0f0bff-5806-4d21-8802-ebe21a1afa4f%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/8c0f0bff-5806-4d21-8802-ebe21a1afa4f/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:10:08 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=AkqglEZnuNpLh_7b8ifj7hY; expires=Fri, 02-Jul-2021 11:10:08 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrqeIG73gKp58oBhB-ZDsnMzcs6ARyrnkM2oyLRnnQYHlSiH0-HXhlQ6y9vavxcFVr5U9h2ZN0TfhAVQOumb7ROTNmLWcUirjzXu15eoDi8Z7r7cct1ypdrLFJauGJYpXuLvWzmht5Y8w9Q5LzAoxkQyJYK3N8MBAssf9Q7noHuc0gAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11722.26 - KRSLR2 ProdSlices + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - codesigning certificate-profile show + Connection: + - keep-alive + ParameterSetName: + - --account-name --name --resource-group + User-Agent: + - AZURECLI/2.17.1 azsdk-python-mgmt-codesigning/0.1.0 Python/3.7.9 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount/certificateProfiles/profileA?api-version=2020-12-14-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount/certificateProfiles/profileA","name":"profileA","type":"microsoft.codesigning/codesigningaccounts/certificateprofiles","systemData":{"createdBy":"billtest124476@outlook.com","createdByType":"User","createdAt":"2021-06-02T11:10:06.6020053Z","lastModifiedBy":"billtest124476@outlook.com","lastModifiedByType":"User","lastModifiedAt":"2021-06-02T11:10:06.6020053Z"},"properties":{"profileType":"PublicTrust","rotationPolicy":"30 + Days","commonName":"Contoso Inc","organization":"Contoso Inc","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '733' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:10:09 GMT + etag: + - '"05006708-0000-0700-0000-60b767100000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: C61472987504411B906EFEDFB58E5D90 Ref B: MAA01EDGE0621 Ref C: 2021-06-02T11:10:08Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F8c0f0bff-5806-4d21-8802-ebe21a1afa4f%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/8c0f0bff-5806-4d21-8802-ebe21a1afa4f/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:10:09 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=AsTKY75RmlRJlBUYKplvyrU; expires=Fri, 02-Jul-2021 11:10:09 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrixCumsZx0fW6DcvxK1p2GRvVbn2vetDxikt34hSqULq2xLbGKnZhjkdnJjbMg4NrqCi_dEy879qbBxEQf487LD7mjO3kurRmY_25ekyXR6ia-vsnTZ4MAfeLP4nj5fN1kxhLwrW5OsGouZYZ-zEA5gSIy68oN-9aDuARNKvqT4ggAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11722.21 - KRSLR1 ProdSlices + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - codesigning certificate-profile list + Connection: + - keep-alive + ParameterSetName: + - --account-name --resource-group + User-Agent: + - AZURECLI/2.17.1 azsdk-python-mgmt-codesigning/0.1.0 Python/3.7.9 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount/certificateProfiles?api-version=2020-12-14-preview + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount/certificateProfiles/profileA","name":"profileA","type":"microsoft.codesigning/codesigningaccounts/certificateprofiles","systemData":{"createdBy":"billtest124476@outlook.com","createdByType":"User","createdAt":"2021-06-02T11:10:06.6020053Z","lastModifiedBy":"billtest124476@outlook.com","lastModifiedByType":"User","lastModifiedAt":"2021-06-02T11:10:06.6020053Z"},"properties":{"profileType":"PublicTrust","rotationPolicy":"30 + Days","commonName":"Contoso Inc","organization":"Contoso Inc","provisioningState":"Succeeded"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '745' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:10:10 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-msedge-ref: + - 'Ref A: A448170968AC4530BE757FF31304264C Ref B: MAA01EDGE0616 Ref C: 2021-06-02T11:10:10Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F8c0f0bff-5806-4d21-8802-ebe21a1afa4f%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/8c0f0bff-5806-4d21-8802-ebe21a1afa4f/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:10:10 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=Ak2KlVy26spHk5oekdSL5Ug; expires=Fri, 02-Jul-2021 11:10:10 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr1lq0YD1eqskBa7V38fZyNaFI3ITKVKCm3pI2nuMOMMLbs3bsdwT9o5VvFJBxPgqsR_WNCI7tyR1EiNLYhhv_Wf78o0RFne1FJylX_Wryd2-lS_rf5wRKyYt3486mGe_MYlFXvGy2jvWt8XV1qJm5ZkMb2tHxmMjnnfX1DjMBNkQgAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11722.26 - SEASLR1 ProdSlices + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - codesigning certificate-profile delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -y --account-name --name --resource-group + User-Agent: + - AZURECLI/2.17.1 azsdk-python-mgmt-codesigning/0.1.0 Python/3.7.9 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount/certificateProfiles/profileA?api-version=2020-12-14-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 02 Jun 2021 11:10:13 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId= + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: D521AE37F0C040F29733E094A3D86E09 Ref B: MAA01EDGE0606 Ref C: 2021-06-02T11:10:11Z' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.22.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.3 + method: GET + uri: https://login.microsoftonline.com/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2F8c0f0bff-5806-4d21-8802-ebe21a1afa4f%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/8c0f0bff-5806-4d21-8802-ebe21a1afa4f/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - max-age=86400, private + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 02 Jun 2021 11:10:14 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=Aidk_XMcvu9AvEMCE0-siuQ; expires=Fri, 02-Jul-2021 11:10:14 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrSRQu_DV82mVCAHaHKEUCUhlf0emGFghgYsvrYCKTazbTAQCeCr9CRmdzlQOHwduuZV4qJ-LXsic1EztCVle7uPvWMTFr3j5osr-VpNytwHn8-y5YOkEkjGyGzjySG2u8x9_HXHidG__NuqZ8JqsSRSFsQLY4PXBmymHS79HqZmggAA; + domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly + - stsservicecookie=estsfd; path=/; secure; samesite=none; httponly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.11722.21 - KRSLR1 ProdSlices + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - codesigning delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -y --name --resource-group + User-Agent: + - AZURECLI/2.17.1 azsdk-python-mgmt-codesigning/0.1.0 Python/3.7.9 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.CodeSigning/codeSigningAccounts/MyAccount?api-version=2020-12-14-preview + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 02 Jun 2021 11:10:17 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId= + strict-transport-security: + - max-age=31536000; includeSubDomains + x-cache: + - CONFIG_NOCACHE + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14999' + x-msedge-ref: + - 'Ref A: FEDE9F16D9D24F76AEE6A9CE8133784F Ref B: MAA01EDGE0616 Ref C: 2021-06-02T11:10:14Z' + status: + code: 200 + message: OK +version: 1 diff --git a/src/codesigning/azext_codesigning/tests/latest/test_codesigning_scenario.py b/src/codesigning/azext_codesigning/tests/latest/test_codesigning_scenario.py new file mode 100644 index 00000000000..7240790a5e9 --- /dev/null +++ b/src/codesigning/azext_codesigning/tests/latest/test_codesigning_scenario.py @@ -0,0 +1,76 @@ +# -------------------------------------------------------------------------- +# 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 os +from azure.cli.testsdk import ScenarioTest +from azure.cli.testsdk import ResourceGroupPreparer +from .example_steps import step_create +from .example_steps import step_show +from .example_steps import step_list +from .example_steps import step_list2 +from .example_steps import step_update +from .example_steps import step_certificate_profile_create +from .example_steps import step_certificate_profile_show +from .example_steps import step_certificate_profile_list +from .example_steps import step_certificate_profile_delete +from .example_steps import step_delete +from .. import ( + try_manual, + raise_if, + calc_coverage +) + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +# Env setup_scenario +@try_manual +def setup_scenario(test, rg): + pass + + +# Env cleanup_scenario +@try_manual +def cleanup_scenario(test, rg): + pass + + +# Testcase: Scenario +@try_manual +def call_scenario(test, rg): + setup_scenario(test, rg) + step_create(test, rg, checks=[]) + step_show(test, rg, checks=[]) + step_list(test, rg, checks=[]) + step_list2(test, rg, checks=[]) + step_update(test, rg, checks=[]) + step_certificate_profile_create(test, rg, checks=[]) + step_certificate_profile_show(test, rg, checks=[]) + step_certificate_profile_list(test, rg, checks=[]) + # STEP NOT FOUND: Update Certificate Profile + step_certificate_profile_delete(test, rg, checks=[]) + step_delete(test, rg, checks=[]) + # STEP NOT FOUND: List Code Signing Account operations + cleanup_scenario(test, rg) + + +# Test class for Scenario +@try_manual +class CodesigningScenarioTest(ScenarioTest): + def __init__(self, *args, **kwargs): + super(CodesigningScenarioTest, self).__init__(*args, **kwargs) + + +@ResourceGroupPreparer(name_prefix='clitestcodesigning_MyResourceGroup'[:7], key='rg', parameter_name='rg') +def test_codesigning_Scenario(self, rg): + call_scenario(self, rg) + calc_coverage(__file__) + raise_if() diff --git a/src/codesigning/azext_codesigning/tests/latest/test_codesigning_scenario_coverage.md b/src/codesigning/azext_codesigning/tests/latest/test_codesigning_scenario_coverage.md new file mode 100644 index 00000000000..38b427e1356 --- /dev/null +++ b/src/codesigning/azext_codesigning/tests/latest/test_codesigning_scenario_coverage.md @@ -0,0 +1,12 @@ +|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt| +|step_create|successed||||2021-06-02 11:09:45.898644|2021-06-02 11:09:56.320676| +|step_show|successed||||2021-06-02 11:09:56.321676|2021-06-02 11:09:57.738642| +|step_list|successed||||2021-06-02 11:09:57.739629|2021-06-02 11:09:59.530042| +|step_list2|successed||||2021-06-02 11:09:59.530042|2021-06-02 11:10:00.709533| +|step_update|successed||||2021-06-02 11:10:00.710534|2021-06-02 11:10:05.372782| +|step_certificate_profile_create|successed||||2021-06-02 11:10:05.372782|2021-06-02 11:10:08.227837| +|step_certificate_profile_show|successed||||2021-06-02 11:10:08.228862|2021-06-02 11:10:09.616964| +|step_certificate_profile_list|successed||||2021-06-02 11:10:09.616964|2021-06-02 11:10:10.519435| +|step_certificate_profile_delete|successed||||2021-06-02 11:10:10.520222|2021-06-02 11:10:14.239729| +|step_delete|successed||||2021-06-02 11:10:14.240777|2021-06-02 11:10:17.941814| +Coverage: 10/10 diff --git a/src/codesigning/azext_codesigning/vendored_sdks/__init__.py b/src/codesigning/azext_codesigning/vendored_sdks/__init__.py new file mode 100644 index 00000000000..c9cfdc73e77 --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/__init__.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/__init__.py new file mode 100644 index 00000000000..0bad1040fb8 --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/__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 ._code_signing_management_client import CodeSigningManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['CodeSigningManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/_code_signing_management_client.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/_code_signing_management_client.py new file mode 100644 index 00000000000..6f8961b6f5e --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/_code_signing_management_client.py @@ -0,0 +1,80 @@ +# 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 TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + +from ._configuration import CodeSigningManagementClientConfiguration +from .operations import CodeSigningAccountOperations +from .operations import CertificateProfileOperations +from .operations import Operations +from . import models + + +class CodeSigningManagementClient(object): + """Code Signing Resource Provider Account and Certificate Profile management API. + + :ivar code_signing_account: CodeSigningAccountOperations operations + :vartype code_signing_account: azure.mgmt.codesigning.operations.CodeSigningAccountOperations + :ivar certificate_profile: CertificateProfileOperations operations + :vartype certificate_profile: azure.mgmt.codesigning.operations.CertificateProfileOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.codesigning.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = CodeSigningManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.code_signing_account = CodeSigningAccountOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificate_profile = CertificateProfileOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> CodeSigningManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/_configuration.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/_configuration.py new file mode 100644 index 00000000000..d20f7490494 --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/_configuration.py @@ -0,0 +1,71 @@ +# 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 TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class CodeSigningManagementClientConfiguration(Configuration): + """Configuration for CodeSigningManagementClient. + + 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. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(CodeSigningManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-12-14-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-codesigning/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> 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 = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/_version.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/_version.py new file mode 100644 index 00000000000..eae7c95b6fb --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/_version.py @@ -0,0 +1,9 @@ +# 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 = "0.1.0" diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/__init__.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/__init__.py new file mode 100644 index 00000000000..8c7bd4e02df --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._code_signing_management_client import CodeSigningManagementClient +__all__ = ['CodeSigningManagementClient'] diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/_code_signing_management_client.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/_code_signing_management_client.py new file mode 100644 index 00000000000..cde951fbcee --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/_code_signing_management_client.py @@ -0,0 +1,74 @@ +# 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, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import CodeSigningManagementClientConfiguration +from .operations import CodeSigningAccountOperations +from .operations import CertificateProfileOperations +from .operations import Operations +from .. import models + + +class CodeSigningManagementClient(object): + """Code Signing Resource Provider Account and Certificate Profile management API. + + :ivar code_signing_account: CodeSigningAccountOperations operations + :vartype code_signing_account: azure.mgmt.codesigning.aio.operations.CodeSigningAccountOperations + :ivar certificate_profile: CertificateProfileOperations operations + :vartype certificate_profile: azure.mgmt.codesigning.aio.operations.CertificateProfileOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.codesigning.aio.operations.Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = CodeSigningManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = 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._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.code_signing_account = CodeSigningAccountOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificate_profile = CertificateProfileOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "CodeSigningManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/_configuration.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/_configuration.py new file mode 100644 index 00000000000..730b8a9e72f --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class CodeSigningManagementClientConfiguration(Configuration): + """Configuration for CodeSigningManagementClient. + + 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. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(CodeSigningManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2020-12-14-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-codesigning/{}'.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 = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/__init__.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/__init__.py new file mode 100644 index 00000000000..bd81555bcaa --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/__init__.py @@ -0,0 +1,17 @@ +# 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 ._code_signing_account_operations import CodeSigningAccountOperations +from ._certificate_profile_operations import CertificateProfileOperations +from ._operations import Operations + +__all__ = [ + 'CodeSigningAccountOperations', + 'CertificateProfileOperations', + 'Operations', +] diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/_certificate_profile_operations.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/_certificate_profile_operations.py new file mode 100644 index 00000000000..c64b5c5bcb5 --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/_certificate_profile_operations.py @@ -0,0 +1,505 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificateProfileOperations: + """CertificateProfileOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.codesigning.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_code_signing_account( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> AsyncIterable["models.CertificateProfiles"]: + """List certificate profiles within a code signing account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateProfiles or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.codesigning.models.CertificateProfiles] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateProfiles"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_code_signing_account.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateProfiles', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_code_signing_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + account_name: str, + profile_name: str, + certificate_profile: "models.CertificateProfile", + **kwargs + ) -> "models.CertificateProfile": + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateProfile"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^(?=.{5,100}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_profile, 'CertificateProfile') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateProfile', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + account_name: str, + profile_name: str, + certificate_profile: "models.CertificateProfile", + **kwargs + ) -> AsyncLROPoller["models.CertificateProfile"]: + """Create a certificate profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param profile_name: Certificate profile name. + :type profile_name: str + :param certificate_profile: Parameters to create the certificate profile. + :type certificate_profile: ~azure.mgmt.codesigning.models.CertificateProfile + :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: True for ARMPolling, False for no polling, or a + polling object for 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 CertificateProfile or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.codesigning.models.CertificateProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateProfile"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + profile_name=profile_name, + certificate_profile=certificate_profile, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CertificateProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^(?=.{5,100}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + account_name: str, + profile_name: str, + certificate_profile_patch: "models.CertificateProfilePatch", + **kwargs + ) -> "models.CertificateProfile": + """Update a certificate profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param profile_name: Certificate profile name. + :type profile_name: str + :param certificate_profile_patch: Parameters supplied to update certificate profile. + :type certificate_profile_patch: ~azure.mgmt.codesigning.models.CertificateProfilePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateProfile, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CertificateProfile + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateProfile"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^(?=.{5,100}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_profile_patch, 'CertificateProfilePatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + account_name: str, + profile_name: str, + **kwargs + ) -> "models.CertificateProfile": + """Get details of a certificate profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param profile_name: Certificate profile name. + :type profile_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateProfile, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CertificateProfile + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateProfile"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^(?=.{5,100}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + profile_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^(?=.{5,100}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + profile_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete a Certificate Profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param profile_name: Certificate profile name. + :type profile_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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + profile_name=profile_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^(?=.{5,100}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}'} # type: ignore diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/_code_sign_account_operations.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/_code_sign_account_operations.py new file mode 100644 index 00000000000..4f6330ebddd --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/_code_sign_account_operations.py @@ -0,0 +1,436 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CodeSignAccountOperations: + """CodeSignAccountOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.codesigning.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create( + self, + resource_group_name: str, + account_name: str, + code_sign_account: Optional["models.CodeSignAccount"] = None, + **kwargs + ) -> "models.CodeSignAccount": + """Create a Code Sign Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param code_sign_account: + :type code_sign_account: ~azure.mgmt.codesigning.models.CodeSignAccount + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeSignAccount, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CodeSignAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSignAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if code_sign_account is not None: + body_content = self._serialize.body(code_sign_account, 'CodeSignAccount') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CodeSignAccount', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CodeSignAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSignAccounts/{accountName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + account_name: str, + code_sign_account_patch: "models.CodeSignAccountPatch", + **kwargs + ) -> "models.CodeSignAccount": + """Update a code sign account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param code_sign_account_patch: + :type code_sign_account_patch: ~azure.mgmt.codesigning.models.CodeSignAccountPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeSignAccount, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CodeSignAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSignAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(code_sign_account_patch, 'CodeSignAccountPatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CodeSignAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSignAccounts/{accountName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> "models.CodeSignAccount": + """Get a Code Sign Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeSignAccount, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CodeSignAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSignAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CodeSignAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSignAccounts/{accountName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> None: + """Delete a Code Sign Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSignAccounts/{accountName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["models.CodeSignAccounts"]: + """Lists Code Sign Accounts within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CodeSignAccounts or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.codesigning.models.CodeSignAccounts] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSignAccounts"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CodeSignAccounts', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/codeSignAccounts'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.CodeSignAccounts"]: + """List Code Sign Accounts within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CodeSignAccounts or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.codesigning.models.CodeSignAccounts] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSignAccounts"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CodeSignAccounts', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSignAccounts'} # type: ignore diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/_code_signing_account_operations.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/_code_signing_account_operations.py new file mode 100644 index 00000000000..40965c931c9 --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/_code_signing_account_operations.py @@ -0,0 +1,549 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CodeSigningAccountOperations: + """CodeSigningAccountOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.codesigning.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_initial( + self, + resource_group_name: str, + account_name: str, + code_signing_account: Optional["models.CodeSigningAccount"] = None, + **kwargs + ) -> "models.CodeSigningAccount": + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSigningAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if code_signing_account is not None: + body_content = self._serialize.body(code_signing_account, 'CodeSigningAccount') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CodeSigningAccount', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CodeSigningAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + account_name: str, + code_signing_account: Optional["models.CodeSigningAccount"] = None, + **kwargs + ) -> AsyncLROPoller["models.CodeSigningAccount"]: + """Create a Code Signing Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param code_signing_account: Parameters to create the code signing account. + :type code_signing_account: ~azure.mgmt.codesigning.models.CodeSigningAccount + :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: True for ARMPolling, False for no polling, or a + polling object for 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 CodeSigningAccount or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.codesigning.models.CodeSigningAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSigningAccount"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + code_signing_account=code_signing_account, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CodeSigningAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + account_name: str, + code_signing_account_patch: "models.CodeSigningAccountPatch", + **kwargs + ) -> "models.CodeSigningAccount": + """Update a code signing account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param code_signing_account_patch: Parameters supplied to update code signing account. + :type code_signing_account_patch: ~azure.mgmt.codesigning.models.CodeSigningAccountPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeSigningAccount, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CodeSigningAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSigningAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(code_signing_account_patch, 'CodeSigningAccountPatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CodeSigningAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> "models.CodeSigningAccount": + """Get a Code Signing Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeSigningAccount, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CodeSigningAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSigningAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CodeSigningAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete Code Signing Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["models.CodeSigningAccounts"]: + """Lists Code Signing Accounts within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CodeSigningAccounts or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.codesigning.models.CodeSigningAccounts] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSigningAccounts"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CodeSigningAccounts', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/codeSigningAccounts'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["models.CodeSigningAccounts"]: + """List Code Signing Accounts within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CodeSigningAccounts or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.codesigning.models.CodeSigningAccounts] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSigningAccounts"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CodeSigningAccounts', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts'} # type: ignore diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/_operations.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/_operations.py new file mode 100644 index 00000000000..5132ab8e3bf --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.codesigning.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["models.OperationList"]: + """Lists all of the available API operations for code signing resource. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.codesigning.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.CodeSigning/operations'} # type: ignore diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/models/__init__.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/models/__init__.py new file mode 100644 index 00000000000..dd6ae2ced0b --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/models/__init__.py @@ -0,0 +1,75 @@ +# 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 Certificate + from ._models_py3 import CertificateProfile + from ._models_py3 import CertificateProfilePatch + from ._models_py3 import CertificateProfiles + from ._models_py3 import CodeSigningAccount + from ._models_py3 import CodeSigningAccountPatch + from ._models_py3 import CodeSigningAccounts + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationList + from ._models_py3 import ProxyResource + from ._models_py3 import Resource + from ._models_py3 import SystemData + from ._models_py3 import TrackedResource +except (SyntaxError, ImportError): + from ._models import Certificate # type: ignore + from ._models import CertificateProfile # type: ignore + from ._models import CertificateProfilePatch # type: ignore + from ._models import CertificateProfiles # type: ignore + from ._models import CodeSigningAccount # type: ignore + from ._models import CodeSigningAccountPatch # type: ignore + from ._models import CodeSigningAccounts # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationList # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import Resource # type: ignore + from ._models import SystemData # type: ignore + from ._models import TrackedResource # type: ignore + +from ._code_signing_management_client_enums import ( + CreatedByType, + ProfileType, + ProvisioningState, + RotationPolicy, +) + +__all__ = [ + 'Certificate', + 'CertificateProfile', + 'CertificateProfilePatch', + 'CertificateProfiles', + 'CodeSigningAccount', + 'CodeSigningAccountPatch', + 'CodeSigningAccounts', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'Operation', + 'OperationDisplay', + 'OperationList', + 'ProxyResource', + 'Resource', + 'SystemData', + 'TrackedResource', + 'CreatedByType', + 'ProfileType', + 'ProvisioningState', + 'RotationPolicy', +] diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/models/_code_signing_management_client_enums.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/models/_code_signing_management_client_enums.py new file mode 100644 index 00000000000..f1f59c23980 --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/models/_code_signing_management_client_enums.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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class ProfileType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Profile type of the certificate + """ + + PUBLIC_TRUST = "PublicTrust" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the vault + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + PROVISIONING = "Provisioning" + UPDATING = "Updating" + DELETING = "Deleting" + ACCEPTED = "Accepted" + +class RotationPolicy(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Rotation policy of the certificate + """ + + THIRTY_DAYS = "30 Days" diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/models/_models.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/models/_models.py new file mode 100644 index 00000000000..f27cd799584 --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/models/_models.py @@ -0,0 +1,648 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class Certificate(msrest.serialization.Model): + """Properties of the certificate. + + :param serial_number: Id of the certificate. + :type serial_number: str + :param subject_name: Subject name of the certificate. + :type subject_name: str + :param thumbprint: Thumbprint of the certificate. + :type thumbprint: str + :param created_date: Certificate created date. + :type created_date: str + :param expiry_date: Certificate expiry date. + :type expiry_date: str + """ + + _attribute_map = { + 'serial_number': {'key': 'serialNumber', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'created_date': {'key': 'createdDate', 'type': 'str'}, + 'expiry_date': {'key': 'expiryDate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Certificate, self).__init__(**kwargs) + self.serial_number = kwargs.get('serial_number', None) + self.subject_name = kwargs.get('subject_name', None) + self.thumbprint = kwargs.get('thumbprint', None) + self.created_date = kwargs.get('created_date', None) + self.expiry_date = kwargs.get('expiry_date', None) + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _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 + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class CertificateProfile(Resource): + """Certificate profile 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.codesigning.models.SystemData + :param profile_type: Required. Profile type of the certificate. Possible values include: + "PublicTrust". + :type profile_type: str or ~azure.mgmt.codesigning.models.ProfileType + :param rotation_policy: Required. Rotation policy of the certificate. Possible values include: + "30 Days". + :type rotation_policy: str or ~azure.mgmt.codesigning.models.RotationPolicy + :param common_name: Required. Used as CN in the subject name of the certificate. + :type common_name: str + :ivar authority: Certificate authority of the certificate. + :vartype authority: str + :param organization: Required. Used as O in the subject name of the certificate. + :type organization: str + :ivar street_address: + :vartype street_address: str + :ivar country: + :vartype country: str + :ivar state: + :vartype state: str + :ivar city: + :vartype city: str + :ivar certificates: + :vartype certificates: list[~azure.mgmt.codesigning.models.Certificate] + :ivar provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.codesigning.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'profile_type': {'required': True}, + 'rotation_policy': {'required': True}, + 'common_name': {'required': True}, + 'authority': {'readonly': True}, + 'organization': {'required': True}, + 'street_address': {'readonly': True}, + 'country': {'readonly': True}, + 'state': {'readonly': True}, + 'city': {'readonly': True}, + 'certificates': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'profile_type': {'key': 'properties.profileType', 'type': 'str'}, + 'rotation_policy': {'key': 'properties.rotationPolicy', 'type': 'str'}, + 'common_name': {'key': 'properties.commonName', 'type': 'str'}, + 'authority': {'key': 'properties.authority', 'type': 'str'}, + 'organization': {'key': 'properties.organization', 'type': 'str'}, + 'street_address': {'key': 'properties.streetAddress', 'type': 'str'}, + 'country': {'key': 'properties.country', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'city': {'key': 'properties.city', 'type': 'str'}, + 'certificates': {'key': 'properties.certificates', 'type': '[Certificate]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateProfile, self).__init__(**kwargs) + self.system_data = None + self.profile_type = kwargs['profile_type'] + self.rotation_policy = kwargs['rotation_policy'] + self.common_name = kwargs['common_name'] + self.authority = None + self.organization = kwargs['organization'] + self.street_address = None + self.country = None + self.state = None + self.city = None + self.certificates = None + self.provisioning_state = None + + +class CertificateProfilePatch(msrest.serialization.Model): + """Certificate Profile Patch Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar certificates: + :vartype certificates: list[~azure.mgmt.codesigning.models.Certificate] + """ + + _validation = { + 'certificates': {'readonly': True}, + } + + _attribute_map = { + 'certificates': {'key': 'properties.certificates', 'type': '[Certificate]'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateProfilePatch, self).__init__(**kwargs) + self.certificates = None + + +class CertificateProfiles(msrest.serialization.Model): + """The paginated list of certificate profiles. + + :param value: The list of certificate profiles. + :type value: list[~azure.mgmt.codesigning.models.CertificateProfile] + :param next_link: The link to fetch the next page of certificate profile. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateProfile]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateProfiles, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: 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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class CodeSigningAccount(TrackedResource): + """Code signing account 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.codesigning.models.SystemData + :ivar account_uri: The URI of the code signing account for performing operations on certificate + profiles. This property is readonly. + :vartype account_uri: str + :ivar provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.codesigning.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'account_uri': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'account_uri': {'key': 'properties.accountUri', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CodeSigningAccount, self).__init__(**kwargs) + self.system_data = None + self.account_uri = None + self.provisioning_state = None + + +class CodeSigningAccountPatch(msrest.serialization.Model): + """Parameters for creating or updating a code signing account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar account_uri: Account Uri of the code signing account. + :vartype account_uri: str + """ + + _validation = { + 'account_uri': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'account_uri': {'key': 'properties.accountUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CodeSigningAccountPatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.account_uri = None + + +class CodeSigningAccounts(msrest.serialization.Model): + """The paginated list of code signing accounts. + + :param value: List of code signing accounts. + :type value: list[~azure.mgmt.codesigning.models.CodeSigningAccount] + :param next_link: The link to fetch the next page of code signing account. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CodeSigningAccount]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CodeSigningAccounts, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.codesigning.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.codesigning.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.mgmt.codesigning.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class Operation(msrest.serialization.Model): + """The code signing API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {Microsoft.CodeSigning}/{resource}/{operation}. + :vartype name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Display of the operation. + :type display: ~azure.mgmt.codesigning.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = kwargs.get('is_data_action', None) + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """Operation display payload. + + :param provider: Resource provider of the operation. + :type provider: str + :param resource: Code signing resource on which the operation is performed. + :type resource: str + :param operation: Localized friendly name for the operation read, write, etc. + :type operation: str + :param description: Localized friendly description for the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationList(msrest.serialization.Model): + """The paginated list of code signing API operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of code signing API operations. + :vartype value: list[~azure.mgmt.codesigning.models.Operation] + :param next_link: The link to fetch the next page of code signing API operations. + :type next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationList, self).__init__(**kwargs) + self.value = None + self.next_link = kwargs.get('next_link', None) + + +class ProxyResource(Resource): + """The resource model definition for an Azure Resource Manager 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _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 + ): + super(ProxyResource, self).__init__(**kwargs) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.codesigning.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.codesigning.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/models/_models_py3.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/models/_models_py3.py new file mode 100644 index 00000000000..e38c6f7b289 --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/models/_models_py3.py @@ -0,0 +1,697 @@ +# 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 datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._code_signing_management_client_enums import * + + +class Certificate(msrest.serialization.Model): + """Properties of the certificate. + + :param serial_number: Id of the certificate. + :type serial_number: str + :param subject_name: Subject name of the certificate. + :type subject_name: str + :param thumbprint: Thumbprint of the certificate. + :type thumbprint: str + :param created_date: Certificate created date. + :type created_date: str + :param expiry_date: Certificate expiry date. + :type expiry_date: str + """ + + _attribute_map = { + 'serial_number': {'key': 'serialNumber', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'created_date': {'key': 'createdDate', 'type': 'str'}, + 'expiry_date': {'key': 'expiryDate', 'type': 'str'}, + } + + def __init__( + self, + *, + serial_number: Optional[str] = None, + subject_name: Optional[str] = None, + thumbprint: Optional[str] = None, + created_date: Optional[str] = None, + expiry_date: Optional[str] = None, + **kwargs + ): + super(Certificate, self).__init__(**kwargs) + self.serial_number = serial_number + self.subject_name = subject_name + self.thumbprint = thumbprint + self.created_date = created_date + self.expiry_date = expiry_date + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _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 + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class CertificateProfile(Resource): + """Certificate profile 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.codesigning.models.SystemData + :param profile_type: Required. Profile type of the certificate. Possible values include: + "PublicTrust". + :type profile_type: str or ~azure.mgmt.codesigning.models.ProfileType + :param rotation_policy: Required. Rotation policy of the certificate. Possible values include: + "30 Days". + :type rotation_policy: str or ~azure.mgmt.codesigning.models.RotationPolicy + :param common_name: Required. Used as CN in the subject name of the certificate. + :type common_name: str + :ivar authority: Certificate authority of the certificate. + :vartype authority: str + :param organization: Required. Used as O in the subject name of the certificate. + :type organization: str + :ivar street_address: + :vartype street_address: str + :ivar country: + :vartype country: str + :ivar state: + :vartype state: str + :ivar city: + :vartype city: str + :ivar certificates: + :vartype certificates: list[~azure.mgmt.codesigning.models.Certificate] + :ivar provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.codesigning.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'profile_type': {'required': True}, + 'rotation_policy': {'required': True}, + 'common_name': {'required': True}, + 'authority': {'readonly': True}, + 'organization': {'required': True}, + 'street_address': {'readonly': True}, + 'country': {'readonly': True}, + 'state': {'readonly': True}, + 'city': {'readonly': True}, + 'certificates': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'profile_type': {'key': 'properties.profileType', 'type': 'str'}, + 'rotation_policy': {'key': 'properties.rotationPolicy', 'type': 'str'}, + 'common_name': {'key': 'properties.commonName', 'type': 'str'}, + 'authority': {'key': 'properties.authority', 'type': 'str'}, + 'organization': {'key': 'properties.organization', 'type': 'str'}, + 'street_address': {'key': 'properties.streetAddress', 'type': 'str'}, + 'country': {'key': 'properties.country', 'type': 'str'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'city': {'key': 'properties.city', 'type': 'str'}, + 'certificates': {'key': 'properties.certificates', 'type': '[Certificate]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + profile_type: Union[str, "ProfileType"], + rotation_policy: Union[str, "RotationPolicy"], + common_name: str, + organization: str, + **kwargs + ): + super(CertificateProfile, self).__init__(**kwargs) + self.system_data = None + self.profile_type = profile_type + self.rotation_policy = rotation_policy + self.common_name = common_name + self.authority = None + self.organization = organization + self.street_address = None + self.country = None + self.state = None + self.city = None + self.certificates = None + self.provisioning_state = None + + +class CertificateProfilePatch(msrest.serialization.Model): + """Certificate Profile Patch Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar certificates: + :vartype certificates: list[~azure.mgmt.codesigning.models.Certificate] + """ + + _validation = { + 'certificates': {'readonly': True}, + } + + _attribute_map = { + 'certificates': {'key': 'properties.certificates', 'type': '[Certificate]'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateProfilePatch, self).__init__(**kwargs) + self.certificates = None + + +class CertificateProfiles(msrest.serialization.Model): + """The paginated list of certificate profiles. + + :param value: The list of certificate profiles. + :type value: list[~azure.mgmt.codesigning.models.CertificateProfile] + :param next_link: The link to fetch the next page of certificate profile. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateProfile]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CertificateProfile"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(CertificateProfiles, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: 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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class CodeSigningAccount(TrackedResource): + """Code signing account 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.codesigning.models.SystemData + :ivar account_uri: The URI of the code signing account for performing operations on certificate + profiles. This property is readonly. + :vartype account_uri: str + :ivar provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.codesigning.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'account_uri': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'account_uri': {'key': 'properties.accountUri', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(CodeSigningAccount, self).__init__(tags=tags, location=location, **kwargs) + self.system_data = None + self.account_uri = None + self.provisioning_state = None + + +class CodeSigningAccountPatch(msrest.serialization.Model): + """Parameters for creating or updating a code signing account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar account_uri: Account Uri of the code signing account. + :vartype account_uri: str + """ + + _validation = { + 'account_uri': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'account_uri': {'key': 'properties.accountUri', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(CodeSigningAccountPatch, self).__init__(**kwargs) + self.tags = tags + self.account_uri = None + + +class CodeSigningAccounts(msrest.serialization.Model): + """The paginated list of code signing accounts. + + :param value: List of code signing accounts. + :type value: list[~azure.mgmt.codesigning.models.CodeSigningAccount] + :param next_link: The link to fetch the next page of code signing account. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CodeSigningAccount]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CodeSigningAccount"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(CodeSigningAccounts, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: object + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.codesigning.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.codesigning.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.mgmt.codesigning.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class Operation(msrest.serialization.Model): + """The code signing API operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Operation name: {Microsoft.CodeSigning}/{resource}/{operation}. + :vartype name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Display of the operation. + :type display: ~azure.mgmt.codesigning.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.is_data_action = is_data_action + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """Operation display payload. + + :param provider: Resource provider of the operation. + :type provider: str + :param resource: Code signing resource on which the operation is performed. + :type resource: str + :param operation: Localized friendly name for the operation read, write, etc. + :type operation: str + :param description: Localized friendly description for the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationList(msrest.serialization.Model): + """The paginated list of code signing API operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of code signing API operations. + :vartype value: list[~azure.mgmt.codesigning.models.Operation] + :param next_link: The link to fetch the next page of code signing API operations. + :type next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationList, self).__init__(**kwargs) + self.value = None + self.next_link = next_link + + +class ProxyResource(Resource): + """The resource model definition for an Azure Resource Manager 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _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 + ): + super(ProxyResource, self).__init__(**kwargs) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.codesigning.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.codesigning.models.CreatedByType + :param last_modified_at: The type of identity that last modified the resource. + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/__init__.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/__init__.py new file mode 100644 index 00000000000..bd81555bcaa --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/__init__.py @@ -0,0 +1,17 @@ +# 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 ._code_signing_account_operations import CodeSigningAccountOperations +from ._certificate_profile_operations import CertificateProfileOperations +from ._operations import Operations + +__all__ = [ + 'CodeSigningAccountOperations', + 'CertificateProfileOperations', + 'Operations', +] diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/_certificate_profile_operations.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/_certificate_profile_operations.py new file mode 100644 index 00000000000..25ae9dba59e --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/_certificate_profile_operations.py @@ -0,0 +1,516 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CertificateProfileOperations(object): + """CertificateProfileOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.codesigning.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_code_signing_account( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateProfiles"] + """List certificate profiles within a code signing account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateProfiles or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.codesigning.models.CertificateProfiles] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateProfiles"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_code_signing_account.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateProfiles', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_code_signing_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles'} # type: ignore + + def _create_initial( + self, + resource_group_name, # type: str + account_name, # type: str + profile_name, # type: str + certificate_profile, # type: "models.CertificateProfile" + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateProfile" + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateProfile"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^(?=.{5,100}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_profile, 'CertificateProfile') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateProfile', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + account_name, # type: str + profile_name, # type: str + certificate_profile, # type: "models.CertificateProfile" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.CertificateProfile"] + """Create a certificate profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param profile_name: Certificate profile name. + :type profile_name: str + :param certificate_profile: Parameters to create the certificate profile. + :type certificate_profile: ~azure.mgmt.codesigning.models.CertificateProfile + :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: True for ARMPolling, False for no polling, or a + polling object for 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 CertificateProfile or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.codesigning.models.CertificateProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateProfile"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + profile_name=profile_name, + certificate_profile=certificate_profile, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CertificateProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^(?=.{5,100}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + account_name, # type: str + profile_name, # type: str + certificate_profile_patch, # type: "models.CertificateProfilePatch" + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateProfile" + """Update a certificate profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param profile_name: Certificate profile name. + :type profile_name: str + :param certificate_profile_patch: Parameters supplied to update certificate profile. + :type certificate_profile_patch: ~azure.mgmt.codesigning.models.CertificateProfilePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateProfile, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CertificateProfile + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateProfile"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^(?=.{5,100}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_profile_patch, 'CertificateProfilePatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + account_name, # type: str + profile_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateProfile" + """Get details of a certificate profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param profile_name: Certificate profile name. + :type profile_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateProfile, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CertificateProfile + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateProfile"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^(?=.{5,100}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + account_name, # type: str + profile_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^(?=.{5,100}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + account_name, # type: str + profile_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a Certificate Profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param profile_name: Certificate profile name. + :type profile_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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + profile_name=profile_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + 'profileName': self._serialize.url("profile_name", profile_name, 'str', pattern=r'^(?=.{5,100}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}'} # type: ignore diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/_code_sign_account_operations.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/_code_sign_account_operations.py new file mode 100644 index 00000000000..3589d0749dd --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/_code_sign_account_operations.py @@ -0,0 +1,446 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CodeSignAccountOperations(object): + """CodeSignAccountOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.codesigning.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create( + self, + resource_group_name, # type: str + account_name, # type: str + code_sign_account=None, # type: Optional["models.CodeSignAccount"] + **kwargs # type: Any + ): + # type: (...) -> "models.CodeSignAccount" + """Create a Code Sign Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param code_sign_account: + :type code_sign_account: ~azure.mgmt.codesigning.models.CodeSignAccount + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeSignAccount, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CodeSignAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSignAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if code_sign_account is not None: + body_content = self._serialize.body(code_sign_account, 'CodeSignAccount') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CodeSignAccount', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CodeSignAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSignAccounts/{accountName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + account_name, # type: str + code_sign_account_patch, # type: "models.CodeSignAccountPatch" + **kwargs # type: Any + ): + # type: (...) -> "models.CodeSignAccount" + """Update a code sign account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param code_sign_account_patch: + :type code_sign_account_patch: ~azure.mgmt.codesigning.models.CodeSignAccountPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeSignAccount, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CodeSignAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSignAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(code_sign_account_patch, 'CodeSignAccountPatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CodeSignAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSignAccounts/{accountName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CodeSignAccount" + """Get a Code Sign Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeSignAccount, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CodeSignAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSignAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CodeSignAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSignAccounts/{accountName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a Code Sign Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSignAccounts/{accountName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CodeSignAccounts"] + """Lists Code Sign Accounts within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CodeSignAccounts or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.codesigning.models.CodeSignAccounts] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSignAccounts"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CodeSignAccounts', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/codeSignAccounts'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CodeSignAccounts"] + """List Code Sign Accounts within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CodeSignAccounts or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.codesigning.models.CodeSignAccounts] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSignAccounts"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CodeSignAccounts', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSignAccounts'} # type: ignore diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/_code_signing_account_operations.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/_code_signing_account_operations.py new file mode 100644 index 00000000000..b8b7acd5334 --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/_code_signing_account_operations.py @@ -0,0 +1,561 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CodeSigningAccountOperations(object): + """CodeSigningAccountOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.codesigning.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_initial( + self, + resource_group_name, # type: str + account_name, # type: str + code_signing_account=None, # type: Optional["models.CodeSigningAccount"] + **kwargs # type: Any + ): + # type: (...) -> "models.CodeSigningAccount" + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSigningAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if code_signing_account is not None: + body_content = self._serialize.body(code_signing_account, 'CodeSigningAccount') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CodeSigningAccount', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CodeSigningAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}'} # type: ignore + + def begin_create( + self, + resource_group_name, # type: str + account_name, # type: str + code_signing_account=None, # type: Optional["models.CodeSigningAccount"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["models.CodeSigningAccount"] + """Create a Code Signing Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param code_signing_account: Parameters to create the code signing account. + :type code_signing_account: ~azure.mgmt.codesigning.models.CodeSigningAccount + :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: True for ARMPolling, False for no polling, or a + polling object for 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 CodeSigningAccount or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.codesigning.models.CodeSigningAccount] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSigningAccount"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + code_signing_account=code_signing_account, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('CodeSigningAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + account_name, # type: str + code_signing_account_patch, # type: "models.CodeSigningAccountPatch" + **kwargs # type: Any + ): + # type: (...) -> "models.CodeSigningAccount" + """Update a code signing account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :param code_signing_account_patch: Parameters supplied to update code signing account. + :type code_signing_account_patch: ~azure.mgmt.codesigning.models.CodeSigningAccountPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeSigningAccount, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CodeSigningAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSigningAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(code_signing_account_patch, 'CodeSigningAccountPatch') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CodeSigningAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CodeSigningAccount" + """Get a Code Signing Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeSigningAccount, or the result of cls(response) + :rtype: ~azure.mgmt.codesigning.models.CodeSigningAccount + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSigningAccount"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CodeSigningAccount', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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) + error = self._deserialize(models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete Code Signing Account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param account_name: Code Signing account name. + :type account_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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', pattern=r'^(?=.{3,24}$)[^0-9][A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CodeSigningAccounts"] + """Lists Code Signing Accounts within a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CodeSigningAccounts or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.codesigning.models.CodeSigningAccounts] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSigningAccounts"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CodeSigningAccounts', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/codeSigningAccounts'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CodeSigningAccounts"] + """List Code Signing Accounts within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CodeSigningAccounts or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.codesigning.models.CodeSigningAccounts] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CodeSigningAccounts"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CodeSigningAccounts', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts'} # type: ignore diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/_operations.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/_operations.py new file mode 100644 index 00000000000..e8764ea193c --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/operations/_operations.py @@ -0,0 +1,110 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.codesigning.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.OperationList"] + """Lists all of the available API operations for code signing resource. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.codesigning.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-12-14-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.CodeSigning/operations'} # type: ignore diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/py.typed b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/codesigning/azext_codesigning/vendored_sdks/codesigning/setup.py b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/setup.py new file mode 100644 index 00000000000..194d2e34a08 --- /dev/null +++ b/src/codesigning/azext_codesigning/vendored_sdks/codesigning/setup.py @@ -0,0 +1,37 @@ +# 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. +# -------------------------------------------------------------------------- +# coding: utf-8 + +from setuptools import setup, find_packages + +NAME = "azure-mgmt-codesigning" +VERSION = "0.1.0" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["msrest>=0.6.18", "azure-core<2.0.0,>=1.8.2", "azure-mgmt-core<2.0.0,>=1.2.1"] + +setup( + name=NAME, + version=VERSION, + description="azure-mgmt-codesigning", + author_email="", + url="", + keywords=["Swagger", "CodeSigningManagementClient"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + Code Signing Resource Provider Account and Certificate Profile management API. + """ +) diff --git a/src/codesigning/report.md b/src/codesigning/report.md new file mode 100644 index 00000000000..81cc8732271 --- /dev/null +++ b/src/codesigning/report.md @@ -0,0 +1,164 @@ +# Azure CLI Module Creation Report + +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az codesigning|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az codesigning` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az codesigning|CodeSigningAccount|[commands](#CommandsInCodeSigningAccount)| +|az codesigning certificate-profile|CertificateProfile|[commands](#CommandsInCertificateProfile)| + +## COMMANDS +### Commands in `az codesigning` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az codesigning list](#CodeSigningAccountListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersCodeSigningAccountListByResourceGroup)|[Example](#ExamplesCodeSigningAccountListByResourceGroup)| +|[az codesigning list](#CodeSigningAccountListBySubscription)|ListBySubscription|[Parameters](#ParametersCodeSigningAccountListBySubscription)|[Example](#ExamplesCodeSigningAccountListBySubscription)| +|[az codesigning show](#CodeSigningAccountGet)|Get|[Parameters](#ParametersCodeSigningAccountGet)|[Example](#ExamplesCodeSigningAccountGet)| +|[az codesigning create](#CodeSigningAccountCreate)|Create|[Parameters](#ParametersCodeSigningAccountCreate)|[Example](#ExamplesCodeSigningAccountCreate)| +|[az codesigning update](#CodeSigningAccountUpdate)|Update|[Parameters](#ParametersCodeSigningAccountUpdate)|[Example](#ExamplesCodeSigningAccountUpdate)| +|[az codesigning delete](#CodeSigningAccountDelete)|Delete|[Parameters](#ParametersCodeSigningAccountDelete)|[Example](#ExamplesCodeSigningAccountDelete)| + +### Commands in `az codesigning certificate-profile` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az codesigning certificate-profile list](#CertificateProfileListByCodeSigningAccount)|ListByCodeSigningAccount|[Parameters](#ParametersCertificateProfileListByCodeSigningAccount)|[Example](#ExamplesCertificateProfileListByCodeSigningAccount)| +|[az codesigning certificate-profile show](#CertificateProfileGet)|Get|[Parameters](#ParametersCertificateProfileGet)|[Example](#ExamplesCertificateProfileGet)| +|[az codesigning certificate-profile create](#CertificateProfileCreate)|Create|[Parameters](#ParametersCertificateProfileCreate)|[Example](#ExamplesCertificateProfileCreate)| +|[az codesigning certificate-profile delete](#CertificateProfileDelete)|Delete|[Parameters](#ParametersCertificateProfileDelete)|[Example](#ExamplesCertificateProfileDelete)| + + +## COMMAND DETAILS + +### group `az codesigning` +#### Command `az codesigning list` + +##### Example +``` +az codesigning list --resource-group "MyResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az codesigning list` + +##### Example +``` +az codesigning list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +#### Command `az codesigning show` + +##### Example +``` +az codesigning show --name "MyAccount" --resource-group "MyResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--name**|string|Code Signing account name|name|accountName| + +#### Command `az codesigning create` + +##### Example +``` +az codesigning create --name "MyAccount" --location "eastus" --resource-group "MyResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--name**|string|Code Signing account name|name|accountName| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--location**|string|The geo-location where the resource lives|location|location| + +#### Command `az codesigning update` + +##### Example +``` +az codesigning update --name "MyAccount" --tags key1="value1" --resource-group "MyResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--name**|string|Code Signing account name|name|accountName| +|**--tags**|dictionary|Resource tags.|tags|tags| + +#### Command `az codesigning delete` + +##### Example +``` +az codesigning delete --name "MyAccount" --resource-group "MyResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--name**|string|Code Signing account name|name|accountName| + +### group `az codesigning certificate-profile` +#### Command `az codesigning certificate-profile list` + +##### Example +``` +az codesigning certificate-profile list --account-name "MyAccount" --resource-group "MyResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|Code Signing account name|account_name|accountName| + +#### Command `az codesigning certificate-profile show` + +##### Example +``` +az codesigning certificate-profile show --account-name "MyAccount" --name "profileA" --resource-group \ +"MyResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|Code Signing account name|account_name|accountName| +|**--name**|string|Certificate profile name|name|profileName| + +#### Command `az codesigning certificate-profile create` + +##### Example +``` +az codesigning certificate-profile create --account-name "MyAccount" --common-name "Contoso Inc" --organization \ +"Contoso Inc" --name "profileA" --resource-group "MyResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|Code Signing account name|account_name|accountName| +|**--name**|string|Certificate profile name|name|profileName| +|**--common-name**|string|Used as CN in the subject name of the certificate|common_name|commonName| +|**--organization**|string|Used as O in the subject name of the certificate|organization|organization| + +#### Command `az codesigning certificate-profile delete` + +##### Example +``` +az codesigning certificate-profile delete --account-name "MyAccount" --name "profileA" --resource-group \ +"MyResourceGroup" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--account-name**|string|Code Signing account name|account_name|accountName| +|**--name**|string|Certificate profile name|name|profileName| diff --git a/src/codesigning/setup.cfg b/src/codesigning/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/codesigning/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/codesigning/setup.py b/src/codesigning/setup.py new file mode 100644 index 00000000000..747a3c43295 --- /dev/null +++ b/src/codesigning/setup.py @@ -0,0 +1,58 @@ +#!/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. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages + +# HISTORY.rst entry. +VERSION = '0.1.0' +try: + from azext_codesigning.manual.version import VERSION +except ImportError: + pass + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +try: + from azext_codesigning.manual.dependency import DEPENDENCIES +except ImportError: + pass + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='codesigning', + version=VERSION, + description='Microsoft Azure Command-Line Tools CodeSigningManagementClient Extension', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/master/src/codesigning', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_codesigning': ['azext_metadata.json']}, +)