Skip to content

Commit

Permalink
CodeGen from PR 13227 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 18823c21383323bcec69bc32d7adc394af69b049 into 717f252
  • Loading branch information
SDKAuto committed Mar 2, 2021
1 parent 32ccfec commit 9ba7908
Show file tree
Hide file tree
Showing 42 changed files with 4,193 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/devops/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. :changelog:
Release History
===============

0.1.0
++++++
* Initial release.
39 changes: 39 additions & 0 deletions src/devops/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Azure CLI devops Extension #
This is the extension for devops

### How to use ###
Install this extension using the below CLI command
```
az extension add --name devops
```

### Included Features ###
#### devops pipeline-template-definition ####
##### List #####
```
az devops pipeline-template-definition list
```
#### devops pipeline ####
##### Create #####
```
az devops pipeline create --location "South India" \
--properties bootstrapConfiguration={"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":"myAspNetWebAppPipeline-rg","subscriptionId":"{subscriptionId}","webAppName":"myAspNetWebApp"}}} organization={"name":"myAspNetWebAppPipeline-org"} project={"name":"myAspNetWebAppPipeline-project"} \
--pipeline-name "myAspNetWebAppPipeline" --resource-group "myAspNetWebAppPipeline-rg"
```
##### Show #####
```
az devops pipeline show --name "myAspNetWebAppPipeline" --resource-group "myAspNetWebAppPipeline-rg"
```
##### List #####
```
az devops pipeline list --resource-group "myAspNetWebAppPipeline-rg"
```
##### Update #####
```
az devops pipeline update --name "myAspNetWebAppPipeline" --resource-group "myAspNetWebAppPipeline-rg" \
--tags tagKey="tagvalue"
```
##### Delete #####
```
az devops pipeline delete --name "myAspNetWebAppPipeline" --resource-group "myAspNetWebAppPipeline-rg"
```
50 changes: 50 additions & 0 deletions src/devops/azext_devops/__init__.py
Original file line number Diff line number Diff line change
@@ -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_devops.generated._help import helps # pylint: disable=unused-import
try:
from azext_devops.manual._help import helps # pylint: disable=reimported
except ImportError:
pass


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_cl
devops_custom = CliCommandType(
operations_tmpl='azext_devops.custom#{}',
client_factory=cf_devops_cl)
parent = super(AzureDevOpsCommandsLoader, self)
parent.__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/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/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.15.0"
}
17 changes: 17 additions & 0 deletions src/devops/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/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__)
24 changes: 24 additions & 0 deletions src/devops/azext_devops/generated/_client_factory.py
Original file line number Diff line number Diff line change
@@ -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_devops_cl(cli_ctx, *_):
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azext_devops.vendored_sdks.devops import AzureDevOps
return get_mgmt_service_client(cli_ctx,
AzureDevOps)


def cf_pipeline_template_definition(cli_ctx, *_):
return cf_devops_cl(cli_ctx).pipeline_template_definitions


def cf_pipeline(cli_ctx, *_):
return cf_devops_cl(cli_ctx).pipelines
99 changes: 99 additions & 0 deletions src/devops/azext_devops/generated/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# --------------------------------------------------------------------------
# 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: Manage pipeline template definition with devops
"""

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: Manage pipeline with devops
"""

helps['devops pipeline list'] = """
type: command
short-summary: "Lists all Azure Pipelines under the specified resource group. And 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"
- name: List all Azure pipelines under the specified subscription
text: |-
az devops pipeline list
"""

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 --name "myAspNetWebAppPipeline" --resource-group "myAspNetWebAppPipeline-rg"
"""

helps['devops pipeline create'] = """
type: command
short-summary: "Create 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" --properties bootstrapConfiguration={"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}\\",\\"serviceprin\
cipalkey\\":\\"{appSecret}\\"}}","location":"South India","resourceGroup":"myAspNetWebAppPipeline-rg","subscriptionId":\
"{subscriptionId}","webAppName":"myAspNetWebApp"}}} organization={"name":"myAspNetWebAppPipeline-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 --name "myAspNetWebAppPipeline" --resource-group "myAspNetWebAppPipeline-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 --name "myAspNetWebAppPipeline" --resource-group "myAspNetWebAppPipeline-rg"
"""

helps['devops pipeline wait'] = """
type: command
short-summary: Place the CLI in a waiting state until a condition of the devops pipeline is met.
examples:
- name: Pause executing next line of CLI script until the devops pipeline is successfully created.
text: |-
az devops pipeline wait --name "myAspNetWebAppPipeline" --resource-group "myAspNetWebAppPipeline-rg" \
--created
"""
77 changes: 77 additions & 0 deletions src/devops/azext_devops/generated/_params.py
Original file line number Diff line number Diff line change
@@ -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,
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 (
AddParameters,
AddProperties,
AddAuthorizationParameters
)


def load_arguments(self, _):

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', options_list=['--name', '-n', '--pipeline-name'], type=str, help='The name of the '
'Azure Pipeline resource in ARM.', id_part='name')

with self.argument_context('devops pipeline create') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('pipeline_name', type=str, 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), required=False,
validator=get_default_location_from_resource_group)
c.argument('id_', options_list=['--id'], type=str, help='Unique identifier of the pipeline template.',
arg_group='Bootstrap Configuration Template')
c.argument('parameters', action=AddParameters, nargs='+', help='Dictionary of input parameters used in the '
'pipeline template. Expect value: KEY1=VALUE1 KEY2=VALUE2 ...', arg_group='Bootstrap Configuration '
'Template')
c.argument('repository_type', arg_type=get_enum_type(['gitHub', 'vstsGit']), help='Type of code repository.',
arg_group='Bootstrap Configuration Repository')
c.argument('code_repository_id', type=str, help='Unique immutable identifier of the code repository.',
arg_group='Bootstrap Configuration Repository')
c.argument('default_branch', type=str, help='Default branch used to configure Continuous Integration (CI) in '
'the pipeline.', arg_group='Bootstrap Configuration Repository')
c.argument('properties', action=AddProperties, nargs='+', help='Repository-specific properties. Expect value: '
'KEY1=VALUE1 KEY2=VALUE2 ...', arg_group='Bootstrap Configuration Repository')
c.argument('authorization_parameters', action=AddAuthorizationParameters, nargs='+', help='Authorization '
'parameters corresponding to the authorization type. Expect value: KEY1=VALUE1 KEY2=VALUE2 ...',
arg_group='Bootstrap Configuration Repository Authorization')
c.argument('name', type=str, help='Name of the Azure DevOps Project.', arg_group='Project')
c.argument('organization_reference_name', type=str, help='Name of the Azure DevOps Organization.',
arg_group='Organization')

with self.argument_context('devops pipeline update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('pipeline_name', options_list=['--name', '-n', '--pipeline-name'], type=str, help='The name of the '
'Azure Pipeline resource.', id_part='name')
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', options_list=['--name', '-n', '--pipeline-name'], type=str, help='The name of the '
'Azure Pipeline resource.', id_part='name')

with self.argument_context('devops pipeline wait') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('pipeline_name', options_list=['--name', '-n', '--pipeline-name'], type=str, help='The name of the '
'Azure Pipeline resource in ARM.', id_part='name')
9 changes: 9 additions & 0 deletions src/devops/azext_devops/generated/_validators.py
Original file line number Diff line number Diff line change
@@ -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.
# --------------------------------------------------------------------------
Loading

0 comments on commit 9ba7908

Please sign in to comment.