Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/devops_fake/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:

Release History
===============

0.1.0
++++++
* Initial release.
5 changes: 5 additions & 0 deletions src/devops_fake/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Microsoft Azure CLI 'devops' Extension
==========================================

This package is for the 'devops' extension.
i.e. 'az devops'
46 changes: 46 additions & 0 deletions src/devops_fake/azext_devops/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# --------------------------------------------------------------------------
# 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_devops.generated._help import helps # pylint: disable=unused-import


class AzureDevOpsCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_devops.generated._client_factory import cf_devops
devops_custom = CliCommandType(
operations_tmpl='azext_devops.custom#{}',
client_factory=cf_devops)
super(AzureDevOpsCommandsLoader, self).__init__(cli_ctx=cli_ctx,
custom_command_type=devops_custom)

def load_command_table(self, args):
from azext_devops.generated.commands import load_command_table
load_command_table(self, args)
try:
from azext_devops.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_devops.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_devops.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = AzureDevOpsCommandsLoader
17 changes: 17 additions & 0 deletions src/devops_fake/azext_devops/action.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions src/devops_fake/azext_devops/azext_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"azext.isExperimental": true,
"azext.minCliCoreVersion": "2.3.1"
}
17 changes: 17 additions & 0 deletions src/devops_fake/azext_devops/custom.py
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions src/devops_fake/azext_devops/generated/__init__.py
Original file line number Diff line number Diff line change
@@ -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__)
23 changes: 23 additions & 0 deletions src/devops_fake/azext_devops/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------
# 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_devops(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from ..vendored_sdks.1 import AzureDevOps
return get_mgmt_service_client(cli_ctx, AzureDevOps)


def cf_pipeline_template_definition(cli_ctx, *_):
return cf_devops(cli_ctx).pipeline_template_definition


def cf_pipeline(cli_ctx, *_):
return cf_devops(cli_ctx).pipeline
87 changes: 87 additions & 0 deletions src/devops_fake/azext_devops/generated/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# --------------------------------------------------------------------------
# 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['devops pipeline-template-definition'] = """
type: group
short-summary: devops pipeline-template-definition
"""

helps['devops pipeline-template-definition list'] = """
type: command
short-summary: Lists all pipeline templates which can be used to configure an Azure Pipeline.
examples:
- name: Get the list of pipeline template definitions
text: |-
az devops pipeline-template-definition list
"""

helps['devops pipeline'] = """
type: group
short-summary: devops pipeline
"""

helps['devops pipeline list'] = """
type: command
short-summary: Lists all Azure Pipelines under the specified subscription.
examples:
- name: List all Azure Pipelines under the specified resource group
text: |-
az devops pipeline list --resource-group "myAspNetWebAppPipeline-rg"
"""

helps['devops pipeline show'] = """
type: command
short-summary: Gets an existing Azure Pipeline.
examples:
- name: Get an existing Azure pipeline
text: |-
az devops pipeline show --pipeline-name "myAspNetWebAppPipeline" --resource-group "myAspNetWebAppPipelin\
e-rg"
"""

helps['devops pipeline create'] = """
type: command
short-summary: Creates or updates an Azure Pipeline.
examples:
- name: Create an Azure pipeline to deploy a sample ASP.Net application to Azure web-app
text: |-
az devops pipeline create --location "South India" --bootstrap-configuration-repository-properties boots\
trapConfiguration={"template":{"id":"ms.vss-continuous-delivery-pipeline-templates.aspnet-windowswebapp","parameters":{\
"appInsightLocation":"South India","appServicePlan":"S1 Standard","azureAuth":"{\\"scheme\\":\\"ServicePrincipal\\",\\"\
parameters\\":{\\"tenantid\\":\\"{subscriptionTenantId}\\",\\"objectid\\":\\"{appObjectId}\\",\\"serviceprincipalid\\":\
\\"{appId}\\",\\"serviceprincipalkey\\":\\"{appSecret}\\"}}","location":"South India","resourceGroup":"myAspNetWebAppPi\
peline-rg","subscriptionId":"{subscriptionId}","webAppName":"myAspNetWebApp"}}} organization={"name":"myAspNetWebAppPip\
eline-org"} project={"name":"myAspNetWebAppPipeline-project"} --pipeline-name "myAspNetWebAppPipeline" --resource-group\
"myAspNetWebAppPipeline-rg"
"""

helps['devops pipeline update'] = """
type: command
short-summary: Updates the properties of an Azure Pipeline. Currently, only tags can be updated.
examples:
- name: Get an existing Azure pipeline
text: |-
az devops pipeline update --pipeline-name "myAspNetWebAppPipeline" --resource-group "myAspNetWebAppPipel\
ine-rg" --tags tagKey="tagvalue"
"""

helps['devops pipeline delete'] = """
type: command
short-summary: Deletes an Azure Pipeline.
examples:
- name: Get an existing Azure pipeline
text: |-
az devops pipeline delete --pipeline-name "myAspNetWebAppPipeline" --resource-group "myAspNetWebAppPipel\
ine-rg"
"""
76 changes: 76 additions & 0 deletions src/devops_fake/azext_devops/generated/_params.py
Original file line number Diff line number Diff line change
@@ -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.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements

from knack.arguments import CLIArgumentType
from azure.cli.core.commands.parameters import (
tags_type,
get_enum_type,
resource_group_name_type,
get_location_type
)
from azure.cli.core.commands.validators import get_default_location_from_resource_group
from azext_devops.action import (
AddOrganization,
AddProject,
AddBootstrapConfigurationTemplateParameters,
AddBootstrapConfigurationRepositoryProperties,
AddBootstrapConfigurationRepositoryAuthorizationParameters
)


def load_arguments(self, _):

with self.argument_context('devops pipeline-template-definition list') as c:
pass

with self.argument_context('devops pipeline list') as c:
c.argument('resource_group_name', resource_group_name_type)

with self.argument_context('devops pipeline show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('pipeline_name', help='The name of the Azure Pipeline resource in ARM.')

with self.argument_context('devops pipeline create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('pipeline_name', help='The name of the Azure Pipeline resource in ARM.')
c.argument('tags', tags_type)
c.argument('location', arg_type=get_location_type(self.cli_ctx),
validator=get_default_location_from_resource_group)
c.argument('organization', action=AddOrganization, nargs='+', help='Reference to the Azure DevOps Organization '
'containing the Pipeline. Expect value: name=xx.')
c.argument('project', action=AddProject, nargs='+', help='Reference to the Azure DevOps Project containing the '
'Pipeline. Expect value: name=xx.')
c.argument('bootstrap_configuration_template_id', help='Unique identifier of the pipeline template.')
c.argument('bootstrap_configuration_template_parameters', action=AddBootstrapConfigurationTemplateParameters,
nargs='+', help='Dictionary of input parameters used in the pipeline template. Expect value: KEY1=VA'
'LUE1 KEY2=VALUE2 ...')
c.argument('bootstrap_configuration_repository_repository_type', arg_type=get_enum_type(['gitHub', 'vstsGit']),
help='Type of code repository.')
c.argument('bootstrap_configuration_repository_id',
help='Unique immutable identifier of the code repository.')
c.argument('bootstrap_configuration_repository_default_branch', help='Default branch used to configure Continuo'
'us Integration (CI) in the pipeline.')
c.argument('bootstrap_configuration_repository_properties',
action=AddBootstrapConfigurationRepositoryProperties, nargs='+', help='Repository-specific propertie'
's. Expect value: KEY1=VALUE1 KEY2=VALUE2 ...')
c.argument('bootstrap_configuration_repository_authorization_parameters',
action=AddBootstrapConfigurationRepositoryAuthorizationParameters, nargs='+', help='Authorization pa'
'rameters corresponding to the authorization type. Expect value: KEY1=VALUE1 KEY2=VALUE2 ...')

with self.argument_context('devops pipeline update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('pipeline_name', help='The name of the Azure Pipeline resource.')
c.argument('tags', tags_type)

with self.argument_context('devops pipeline delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('pipeline_name', help='The name of the Azure Pipeline resource.')
23 changes: 23 additions & 0 deletions src/devops_fake/azext_devops/generated/_validators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------
# 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 example_name_or_id_validator(cmd, namespace):
from azure.cli.core.commands.client_factory import get_subscription_id
from msrestazure.tools import is_valid_resource_id, resource_id
if namespace.storage_account:
if not is_valid_resource_id(namespace.RESOURCE):
namespace.storage_account = resource_id(
subscription=get_subscription_id(cmd.cli_ctx),
resource_group=namespace.resource_group_name,
namespace='Microsoft.Storage',
type='storageAccounts',
name=namespace.storage_account
)
Loading