* for #814

* clean

* for #820

* clean

* for #802

* gen output after merge

Co-authored-by: Qiaoqiao Zhang <55688292+qiaozha@users.noreply.github.com>
This commit is contained in:
changlong-liu 2021-04-14 19:45:40 +08:00 коммит произвёл GitHub
Родитель 0d9d62903d
Коммит 1b68eeb0db
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
23 изменённых файлов: 84 добавлений и 42 удалений

Просмотреть файл

@ -67,6 +67,7 @@ export class ExampleParam {
export class CommandExample {
// this should be "create", "update", "list", "show", or custom name
public Method: string;
public Command: string;
public Id: string;
public Title: string;
public Parameters: ExampleParam[];
@ -80,7 +81,6 @@ export class CommandExample {
public ExampleObj: any;
public commandStringItems: string[];
public CommandString: string;
public WaitCommandString: string;
}
export interface CodeModelAz {
@ -267,6 +267,7 @@ export interface CodeModelAz {
minimum: boolean,
step?: TestStepExampleFileRestCall,
): string[][];
GetExampleWait(example: CommandExample): string[];
SelectFirstAzExample(): boolean;
SelectNextAzExample(): boolean;
AzExample: CommandExample;

Просмотреть файл

@ -1148,6 +1148,14 @@ export class CodeModelCliImpl implements CodeModelAz {
return customName;
}
public get CommandGroup_ShowExample(): CommandExample {
return this.CommandGroup?.['az-show-example'];
}
public set CommandGroup_ShowExample(example: CommandExample) {
if (this.CommandGroup) this.CommandGroup['az-show-example'] = example;
}
// -----------------------------------------------------------------------------------------------------------------
// Commands
//
@ -3048,7 +3056,7 @@ export class CodeModelCliImpl implements CodeModelAz {
let rawValue = deepCopy(netValue);
if (methodParam.value['isPolyOfSimple']) {
const keyToMatch =
methodParam.value.schema.discriminator?.property?.language?.default?.name;
methodParam.value.schema.discriminator?.property?.language?.cli?.cliKey;
if (keyToMatch) {
for (const methodParam of methodParamList) {
const polySubParamObj = methodParam.value;
@ -3232,7 +3240,12 @@ export class CodeModelCliImpl implements CodeModelAz {
Object.entries(this.Examples).forEach(([id, exampleObj]) => {
if (includeGenerated || !isGeneratedExampleId(id)) {
const example = this.CreateCommandExample(id, exampleObj);
if (!isNullOrUndefined(example)) examples.push(example);
if (!isNullOrUndefined(example)) {
examples.push(example);
if (this.Command_MethodName === 'show') {
this.CommandGroup_ShowExample = example;
}
}
}
});
}
@ -3267,6 +3280,7 @@ export class CodeModelCliImpl implements CodeModelAz {
const example = new CommandExample();
example.Method = this.Command_MethodName;
example.Command = this.Command_Name;
example.Id = `/${this.CommandGroup_Key}/${this.Method_HttpMethod}/${id}`;
example.Title = exampleObj.title || id;
example.Path = this.Method_Path;
@ -3295,7 +3309,6 @@ export class CodeModelCliImpl implements CodeModelAz {
}
example.commandStringItems = this.GetExampleItems(example, false, undefined);
example.CommandString = example.commandStringItems.join(' ');
example.WaitCommandString = this.GetExampleWait(example).join(' ');
return example;
}
return undefined;
@ -3435,16 +3448,23 @@ export class CodeModelCliImpl implements CodeModelAz {
return property?.language?.['cli']?.cliKey === 'provisioningState';
})
) {
let words = this.Command_Name.split(' ');
const showExample = this.CommandGroup_ShowExample;
if (isNullOrUndefined(showExample)) return [];
let words = showExample.Command.split(' ');
words = words.slice(0, words.length - 1);
words.push('wait');
parameters.push(`az ${words.join(' ')} --created`);
for (const param of example.Parameters) {
const paramKey = param.methodParam.value.language?.['cli']?.cliKey;
if (
paramKey === 'resourceGroupName' ||
this.resourcePool.isResource(paramKey, param.rawValue) ===
example.ResourceClassName
showExample.Parameters.some((showParam) => {
return (
showParam.methodParam.value.language?.['cli']?.cliKey ==
param.methodParam.value.language?.['cli']?.cliKey &&
showParam.methodParam.value.language?.['default']?.cliKey ==
param.methodParam.value.language?.['default']?.cliKey
);
})
) {
let paramValue = param.value;
let replacedValue = this.resourcePool.addParamResource(

Просмотреть файл

@ -65,7 +65,7 @@ export class CliTopAction extends TemplateBase {
const keepLineIdx = keepHeaderLines(baseSplit);
let hasLoadLogic = false;
if (skipLineIdx !== -1) {
for (let i: number = skipLineIdx + 1; i < baseSplit.length; ++i) {
for (let i: number = skipLineIdx; i < baseSplit.length; ++i) {
if (baseSplit[i].indexOf('from .generated.action import *') > -1) {
hasLoadLogic = true;
break;

Просмотреть файл

@ -58,7 +58,7 @@ export class CliTopCustom extends TemplateBase {
const keepLineIdx = keepHeaderLines(baseSplit);
let hasLoadLogic = false;
if (skipLineIdx !== -1) {
for (let i: number = skipLineIdx + 1; i < baseSplit.length; ++i) {
for (let i: number = skipLineIdx; i < baseSplit.length; ++i) {
if (baseSplit[i].indexOf('from .generated.custom import *') > -1) {
hasLoadLogic = true;
break;

Просмотреть файл

@ -53,7 +53,7 @@ export class CliTopHelp extends TemplateBase {
let hasLoadLogic = false;
if (skipLineIdx !== -1) {
for (let i: number = skipLineIdx + 1; i < baseSplit.length; ++i) {
for (let i: number = skipLineIdx; i < baseSplit.length; ++i) {
if (baseSplit[i].indexOf('from .generated._help import helps') > -1) {
hasLoadLogic = true;
break;

Просмотреть файл

@ -62,12 +62,10 @@ export class CliExtReadme extends TemplateBase {
const temp = CmdToMultiLines(example.CommandString);
exampleCommandList.push(...temp);
}
if (
!isNullOrUndefined(example.WaitCommandString) &&
example.WaitCommandString !== ''
) {
const waitCommandString = this.model.GetExampleWait(example).join(' ');
if (!isNullOrUndefined(waitCommandString) && waitCommandString !== '') {
exampleCommandList.push('');
const temp = CmdToMultiLines(example.WaitCommandString);
const temp = CmdToMultiLines(waitCommandString);
exampleCommandList.push(...temp);
}
exampleCommandList.push('```');

Просмотреть файл

@ -9,7 +9,6 @@
#
# Generation mode: Incremental
# --------------------------------------------------------------------------
from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403

Просмотреть файл

@ -9,7 +9,6 @@
#
# Generation mode: Incremental
# --------------------------------------------------------------------------
from .generated.action import * # noqa: F403
try:
from .manual.action import * # noqa: F403

Просмотреть файл

@ -29,6 +29,7 @@ def step_attached_database_configuration_create(test, checks=None):
checks=[])
test.cmd('az kusto attached-database-configuration wait --created '
'--name "{myAttachedDatabaseConfiguration2}" '
'--cluster-name "{myCluster}" '
'--resource-group "{rg}"',
checks=checks)

Просмотреть файл

@ -29,6 +29,7 @@ def step_attached_database_configuration_create(test, checks=None):
checks=[])
test.cmd('az kusto attached-database-configuration wait --created '
'--name "{myAttachedDatabaseConfiguration2}" '
'--cluster-name "{myCluster}" '
'--resource-group "{rg}"',
checks=checks)

Просмотреть файл

@ -177,7 +177,7 @@ az kusto attached-database-configuration create --name "attachedDatabaseConfigur
--database-name "kustodatabase" --default-principals-modification-kind "Union" --resource-group "kustorptest"
az kusto attached-database-configuration wait --created --name "{myAttachedDatabaseConfiguration2}" \
--resource-group "{rg}"
--cluster-name "{myCluster}" --resource-group "{rg}"
```
##### Show #####
```

Просмотреть файл

@ -29,6 +29,7 @@ def step_attached_database_configuration_create(test, checks=None):
checks=[])
test.cmd('az kusto attached-database-configuration wait --created '
'--name "{myAttachedDatabaseConfiguration2}" '
'--cluster-name "{myCluster}" '
'--resource-group "{rg}"',
checks=checks)

Просмотреть файл

@ -177,7 +177,7 @@ az kusto attached-database-configuration create --name "attachedDatabaseConfigur
--database-name "kustodatabase" --default-principals-modification-kind "Union" --resource-group "kustorptest"
az kusto attached-database-configuration wait --created --name "{myAttachedDatabaseConfiguration2}" \
--resource-group "{rg}"
--cluster-name "{myCluster}" --resource-group "{rg}"
```
##### Show #####
```

Просмотреть файл

@ -29,6 +29,7 @@ def step_attached_database_configuration_create(test, checks=None):
checks=[])
test.cmd('az kusto attached-database-configuration wait --created '
'--name "{myAttachedDatabaseConfiguration2}" '
'--cluster-name "{myCluster}" '
'--resource-group "{rg}"',
checks=checks)

Просмотреть файл

@ -59,7 +59,8 @@ az managed-network mn group create --management-groups "[]" \
--virtual-networks id="/subscriptionB/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/VnetB" \
--group-name "myManagedNetworkGroup" --managed-network-name "myManagedNetwork" --resource-group "myResourceGroup"
az managed-network mn group wait --created --group-name "{myManagedNetworkGroup}" --resource-group "{rg}"
az managed-network mn group wait --created --group-name "{myManagedNetworkGroup}" \
--managed-network-name "{myManagedNetwork}" --resource-group "{rg}"
```
##### Show #####
```

Просмотреть файл

@ -115,6 +115,7 @@ def step_mn_group_create(test, checks=None):
checks=[])
test.cmd('az managed-network mn group wait --created '
'--group-name "{myManagedNetworkGroup}" '
'--managed-network-name "{myManagedNetwork}" '
'--resource-group "{rg}"',
checks=checks)
@ -129,6 +130,7 @@ def step_mn_group_create_min(test, checks=None):
checks=[])
test.cmd('az managed-network mn group wait --created '
'--group-name "{myManagedNetworkGroup}" '
'--managed-network-name "{myManagedNetwork}" '
'--resource-group "{rg}"',
checks=checks)

Просмотреть файл

@ -104,7 +104,8 @@ def step_big_data_pool_create(test, checks=None):
checks=[])
test.cmd('az synapse big-data-pool wait --created '
'--name "{myBigDataPool}" '
'--resource-group "{rg}"',
'--resource-group "{rg}" '
'--workspace-name "{myWorkspace}"',
checks=checks)
@ -504,7 +505,8 @@ def step_private_endpoint_connection_create(test, checks=None):
checks=[])
test.cmd('az synapse private-endpoint-connection wait --created '
'--name "{myPrivateEndpointConnection}" '
'--resource-group "{rg}"',
'--resource-group "{rg}" '
'--workspace-name "{myWorkspace}"',
checks=checks)
@ -642,7 +644,8 @@ def step_sql_pool_create(test, checks=None):
checks=[])
test.cmd('az synapse sql-pool wait --created '
'--resource-group "{rg}" '
'--name "{mySqlPool2}"',
'--name "{mySqlPool2}" '
'--workspace-name "{myWorkspace}"',
checks=checks)

Просмотреть файл

@ -17,7 +17,8 @@ az synapse big-data-pool create --location "West US 2" --auto-pause delay-in-min
--node-size-family "MemoryOptimized" --spark-events-folder "/events" --spark-version "2.4" --tags key="value" \
--name "ExamplePool" --resource-group "ExampleResourceGroup" --workspace-name "ExampleWorkspace"
az synapse big-data-pool wait --created --name "{myBigDataPool}" --resource-group "{rg}"
az synapse big-data-pool wait --created --name "{myBigDataPool}" --resource-group "{rg}" \
--workspace-name "{myWorkspace}"
```
##### Show #####
```
@ -82,7 +83,7 @@ az synapse sql-pool create --resource-group "ExampleResourceGroup" --location "W
--restore-point-in-time "1970-01-01T00:00:00.000Z" --source-database-id "" --sku name="" tier="" \
--name "ExampleSqlPool" --workspace-name "ExampleWorkspace"
az synapse sql-pool wait --created --resource-group "{rg}" --name "{mySqlPool2}"
az synapse sql-pool wait --created --resource-group "{rg}" --name "{mySqlPool2}" --workspace-name "{myWorkspace}"
```
##### List #####
```
@ -546,7 +547,8 @@ az synapse private-link-resource show --name "sql" --resource-group "ExampleReso
az synapse private-endpoint-connection create --name "ExamplePrivateEndpointConnection" \
--resource-group "ExampleResourceGroup" --workspace-name "ExampleWorkspace"
az synapse private-endpoint-connection wait --created --name "{myPrivateEndpointConnection}" --resource-group "{rg}"
az synapse private-endpoint-connection wait --created --name "{myPrivateEndpointConnection}" --resource-group "{rg}" \
--workspace-name "{myWorkspace}"
```
##### Show #####
```

Просмотреть файл

@ -104,7 +104,8 @@ def step_big_data_pool_create(test, checks=None):
checks=[])
test.cmd('az synapse big-data-pool wait --created '
'--name "{myBigDataPool}" '
'--resource-group "{rg}"',
'--resource-group "{rg}" '
'--workspace-name "{myWorkspace}"',
checks=checks)
@ -504,7 +505,8 @@ def step_private_endpoint_connection_create(test, checks=None):
checks=[])
test.cmd('az synapse private-endpoint-connection wait --created '
'--name "{myPrivateEndpointConnection}" '
'--resource-group "{rg}"',
'--resource-group "{rg}" '
'--workspace-name "{myWorkspace}"',
checks=checks)
@ -642,7 +644,8 @@ def step_sql_pool_create(test, checks=None):
checks=[])
test.cmd('az synapse sql-pool wait --created '
'--resource-group "{rg}" '
'--name "{mySqlPool2}"',
'--name "{mySqlPool2}" '
'--workspace-name "{myWorkspace}"',
checks=checks)

Просмотреть файл

@ -17,7 +17,8 @@ az synapse big-data-pool create --location "West US 2" --auto-pause delay-in-min
--node-size-family "MemoryOptimized" --spark-events-folder "/events" --spark-version "2.4" --tags key="value" \
--name "ExamplePool" --resource-group "ExampleResourceGroup" --workspace-name "ExampleWorkspace"
az synapse big-data-pool wait --created --name "{myBigDataPool}" --resource-group "{rg}"
az synapse big-data-pool wait --created --name "{myBigDataPool}" --resource-group "{rg}" \
--workspace-name "{myWorkspace}"
```
##### Show #####
```
@ -82,7 +83,7 @@ az synapse sql-pool create --resource-group "ExampleResourceGroup" --location "W
--restore-point-in-time "1970-01-01T00:00:00.000Z" --source-database-id "" --sku name="" tier="" \
--name "ExampleSqlPool" --workspace-name "ExampleWorkspace"
az synapse sql-pool wait --created --resource-group "{rg}" --name "{mySqlPool2}"
az synapse sql-pool wait --created --resource-group "{rg}" --name "{mySqlPool2}" --workspace-name "{myWorkspace}"
```
##### List #####
```
@ -546,7 +547,8 @@ az synapse private-link-resource show --name "sql" --resource-group "ExampleReso
az synapse private-endpoint-connection create --name "ExamplePrivateEndpointConnection" \
--resource-group "ExampleResourceGroup" --workspace-name "ExampleWorkspace"
az synapse private-endpoint-connection wait --created --name "{myPrivateEndpointConnection}" --resource-group "{rg}"
az synapse private-endpoint-connection wait --created --name "{myPrivateEndpointConnection}" --resource-group "{rg}" \
--workspace-name "{myWorkspace}"
```
##### Show #####
```

Просмотреть файл

@ -104,7 +104,8 @@ def step_big_data_pool_create(test, checks=None):
checks=[])
test.cmd('az synapse big-data-pool wait --created '
'--name "{myBigDataPool}" '
'--resource-group "{rg}"',
'--resource-group "{rg}" '
'--workspace-name "{myWorkspace}"',
checks=checks)
@ -504,7 +505,8 @@ def step_private_endpoint_connection_create(test, checks=None):
checks=[])
test.cmd('az synapse private-endpoint-connection wait --created '
'--name "{myPrivateEndpointConnection}" '
'--resource-group "{rg}"',
'--resource-group "{rg}" '
'--workspace-name "{myWorkspace}"',
checks=checks)
@ -642,7 +644,8 @@ def step_sql_pool_create(test, checks=None):
checks=[])
test.cmd('az synapse sql-pool wait --created '
'--resource-group "{rg}" '
'--name "{mySqlPool2}"',
'--name "{mySqlPool2}" '
'--workspace-name "{myWorkspace}"',
checks=checks)

Просмотреть файл

@ -17,7 +17,8 @@ az synapse big-data-pool create --location "West US 2" --auto-pause delay-in-min
--node-size-family "MemoryOptimized" --spark-events-folder "/events" --spark-version "2.4" --tags key="value" \
--name "ExamplePool" --resource-group "ExampleResourceGroup" --workspace-name "ExampleWorkspace"
az synapse big-data-pool wait --created --name "{myBigDataPool}" --resource-group "{rg}"
az synapse big-data-pool wait --created --name "{myBigDataPool}" --resource-group "{rg}" \
--workspace-name "{myWorkspace}"
```
##### Show #####
```
@ -82,7 +83,7 @@ az synapse sql-pool create --resource-group "ExampleResourceGroup" --location "W
--restore-point-in-time "1970-01-01T00:00:00.000Z" --source-database-id "" --sku name="" tier="" \
--name "ExampleSqlPool" --workspace-name "ExampleWorkspace"
az synapse sql-pool wait --created --resource-group "{rg}" --name "{mySqlPool2}"
az synapse sql-pool wait --created --resource-group "{rg}" --name "{mySqlPool2}" --workspace-name "{myWorkspace}"
```
##### List #####
```
@ -546,7 +547,8 @@ az synapse private-link-resource show --name "sql" --resource-group "ExampleReso
az synapse private-endpoint-connection create --name "ExamplePrivateEndpointConnection" \
--resource-group "ExampleResourceGroup" --workspace-name "ExampleWorkspace"
az synapse private-endpoint-connection wait --created --name "{myPrivateEndpointConnection}" --resource-group "{rg}"
az synapse private-endpoint-connection wait --created --name "{myPrivateEndpointConnection}" --resource-group "{rg}" \
--workspace-name "{myWorkspace}"
```
##### Show #####
```

Просмотреть файл

@ -104,7 +104,8 @@ def step_big_data_pool_create(test, checks=None):
checks=[])
test.cmd('az synapse big-data-pool wait --created '
'--name "{myBigDataPool}" '
'--resource-group "{rg}"',
'--resource-group "{rg}" '
'--workspace-name "{myWorkspace}"',
checks=checks)
@ -504,7 +505,8 @@ def step_private_endpoint_connection_create(test, checks=None):
checks=[])
test.cmd('az synapse private-endpoint-connection wait --created '
'--name "{myPrivateEndpointConnection}" '
'--resource-group "{rg}"',
'--resource-group "{rg}" '
'--workspace-name "{myWorkspace}"',
checks=checks)
@ -642,7 +644,8 @@ def step_sql_pool_create(test, checks=None):
checks=[])
test.cmd('az synapse sql-pool wait --created '
'--resource-group "{rg}" '
'--name "{mySqlPool2}"',
'--name "{mySqlPool2}" '
'--workspace-name "{myWorkspace}"',
checks=checks)