Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Fix single enum path parameter #809

Merged
merged 2 commits into from
Apr 6, 2021
Merged
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: 4 additions & 4 deletions src/generate/CodeModelAzImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,7 @@ export class CodeModelCliImpl implements CodeModelAz {
this.currentSubOptionIndex = 0;
const parameter = this.submethodparameters[this.currentSubOptionIndex];
if (this.Parameter_IsHidden(parameter) && !containHidden) {
if (!this.SelectNextMethodParameter()) {
if (!this.SelectNextMethodParameter(containHidden)) {
return false;
}
}
Expand All @@ -1525,7 +1525,7 @@ export class CodeModelCliImpl implements CodeModelAz {
(this.MethodParameter_IsHidden && !containHidden) ||
this.codeModel.globalParameters.indexOf(this.MethodParameter) > -1
) {
if (this.SelectNextMethodParameter()) {
if (this.SelectNextMethodParameter(containHidden)) {
return true;
} else {
return false;
Expand All @@ -1546,7 +1546,7 @@ export class CodeModelCliImpl implements CodeModelAz {
}
const parameter = this.submethodparameters[this.currentSubOptionIndex];
if (this.Parameter_IsHidden(parameter) && !containHidden) {
if (!this.SelectNextMethodParameter()) {
if (!this.SelectNextMethodParameter(containHidden)) {
return false;
}
}
Expand All @@ -1558,7 +1558,7 @@ export class CodeModelCliImpl implements CodeModelAz {
(this.MethodParameter_IsHidden && !containHidden) ||
this.codeModel.globalParameters.indexOf(this.MethodParameter) > -1
) {
if (this.SelectNextMethodParameter()) {
if (this.SelectNextMethodParameter(containHidden)) {
return true;
} else {
return false;
Expand Down
29 changes: 28 additions & 1 deletion test/scenarios/attestation/input/attestation.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}": {
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/offerType/{offerType}/attestationProviders/{providerName}": {
"get": {
"tags": ["AttestationProviders"],
"operationId": "AttestationProviders_Get",
Expand All @@ -69,6 +69,9 @@
{
"$ref": "#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/OfferTypeParameter"
},
{
"name": "providerName",
"in": "path",
Expand Down Expand Up @@ -117,6 +120,9 @@
{
"$ref": "#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/OfferTypeParameter"
},
{
"name": "providerName",
"in": "path",
Expand Down Expand Up @@ -175,6 +181,9 @@
{
"$ref": "#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/OfferTypeParameter"
},
{
"name": "providerName",
"in": "path",
Expand Down Expand Up @@ -227,6 +236,9 @@
{
"$ref": "#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/OfferTypeParameter"
},
{
"name": "providerName",
"in": "path",
Expand Down Expand Up @@ -645,6 +657,21 @@
"description": "The ID of the target subscription.",
"minLength": 1
},
"OfferTypeParameter": {
"name": "offerType",
"in": "path",
"required": true,
"description": "Offer Type, currently only virtualmachine type is supported.",
"x-ms-parameter-location": "method",
"enum": [
"virtualmachine"
],
"type": "string",
"x-ms-enum": {
"name": "OfferType",
"modelAsString": true
}
},
"ResourceGroupNameParameter": {
"name": "resourceGroupName",
"in": "path",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"resourceGroupName": "MyResourceGroup",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"api-version": "2018-09-01-preview",
"offerType": "virtualmachine",
"providerName": "myattestationprovider",
"creationParams": "test"
},
"responses": {
"200": {
"body": {
"id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Attestation/attestationProviders/myattestationprovider",
"id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Attestation/offerType/virtualmachine/attestationProviders/myattestationprovider",
"name": "myattestationprovider",
"type": "Microsoft.Attestation/attestationProviders",
"location": "East US",
Expand All @@ -27,7 +28,7 @@
},
"201": {
"body": {
"id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Attestation/attestationProviders/myattestationprovider",
"id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Attestation/offerType/virtualmachine/attestationProviders/myattestationprovider",
"name": "myattestationprovider",
"type": "Microsoft.Attestation/attestationProviders",
"location": "East US",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"serviceName": "sampleservicename",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"api-version": "2018-09-01-preview",
"offerType": "virtualmachine",
"providerName": "myattestationprovider"
},
"responses": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
"resourceGroupName": "MyResourceGroup",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"api-version": "2018-09-01-preview",
"offerType": "virtualmachine",
"providerName": "myattestationprovider"
},
"responses": {
"200": {
"body": {
"id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Attestation/attestationProviders/myattestationprovider",
"id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Attestation/offerType/virtualmachine/attestationProviders/myattestationprovider",
"name": "myattestationprovider",
"type": "Microsoft.Attestation/attestationProviders",
"location": "East US",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"parameters": {
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"api-version": "2018-09-01-preview"
"api-version": "2018-09-01-preview",
"offerType": "virtualmachine"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "subscriptions/6c96b33e-f5b8-40a6-9011-5cb1c58b0915/resourceGroups/testrg1/providers/Microsoft.Attestation/attestationProviders/myattestationprovider",
"id": "subscriptions/6c96b33e-f5b8-40a6-9011-5cb1c58b0915/resourceGroups/testrg1/providers/Microsoft.Attestation/offerType/virtualmachine/attestationProviders/myattestationprovider",
"name": "myattestationprovider",
"type": "Microsoft.Attestation/attestationProviders",
"location": "East US",
Expand All @@ -17,7 +18,7 @@
}
},
{
"id": "subscriptions/6c96b33e-f5b8-40a6-9011-5cb1c58b0915/resourceGroups/testrg2/providers/Microsoft.Attestation/attestationProviders/codes2",
"id": "subscriptions/6c96b33e-f5b8-40a6-9011-5cb1c58b0915/resourceGroups/testrg2/providers/Microsoft.Attestation/offerType/virtualmachine/attestationProviders/codes2",
"name": "codes2",
"type": "Microsoft.Attestation/attestationProviders",
"location": "East US",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"parameters": {
"resourceGroupName": "testrg1",
"subscriptionId": "6c96b33e-f5b8-40a6-9011-5cb1c58b0915",
"api-version": "2018-09-01-preview"
"api-version": "2018-09-01-preview",
"offerType": "virtualmachine"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "subscriptions/6c96b33e-f5b8-40a6-9011-5cb1c58b0915/resourceGroups/testrg1/providers/Microsoft.Attestation/attestationProviders/myattestationprovider",
"id": "subscriptions/6c96b33e-f5b8-40a6-9011-5cb1c58b0915/resourceGroups/testrg1/providers/Microsoft.Attestation/offerType/virtualmachine/attestationProviders/myattestationprovider",
"name": "myattestationprovider",
"type": "Microsoft.Attestation/attestationProviders",
"location": "East US",
Expand All @@ -18,7 +19,7 @@
}
},
{
"id": "subscriptions/6c96b33e-f5b8-40a6-9011-5cb1c58b0915/resourceGroups/testrg1/providers/Microsoft.Attestation/attestationProviders/codes2",
"id": "subscriptions/6c96b33e-f5b8-40a6-9011-5cb1c58b0915/resourceGroups/testrg1/providers/Microsoft.Attestation/offerType/virtualmachine/attestationProviders/codes2",
"name": "codes2",
"type": "Microsoft.Attestation/attestationProviders",
"location": "East US",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"resourceGroupName": "MyResourceGroup",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"api-version": "2018-09-01-preview",
"offerType": "virtualmachine",
"providerName": "myattestationprovider",
"updateParams": {
"tags": {
Expand All @@ -15,7 +16,7 @@
"responses": {
"200": {
"body": {
"id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Attestation/attestationProviders/myattestationprovider",
"id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Attestation/offerType/virtualmachine/attestationProviders/myattestationprovider",
"name": "myattestationprovider",
"type": "Microsoft.Attestation/attestationProviders",
"location": "East US",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def load_arguments(self, _):

with self.argument_context('attestation attestation-provider show') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('provider_name', type=str, help='Name of the attestation service instance', id_part='name')
c.argument('provider_name', type=str, help='Name of the attestation service instance', id_part='child_name_1')

with self.argument_context('attestation attestation-provider update') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('provider_name', type=str, help='Name of the attestation service', id_part='name')
c.argument('provider_name', type=str, help='Name of the attestation service', id_part='child_name_1')
c.argument('tags', tags_type)

with self.argument_context('attestation attestation-provider delete') as c:
c.argument('resource_group_name', resource_group_name_type)
c.argument('provider_name', type=str, help='Name of the attestation service', id_part='name')
c.argument('provider_name', type=str, help='Name of the attestation service', id_part='child_name_1')
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def attestation_create_provider(client,
creation_params['properties']['policy_signing_certificates'] = {}
creation_params['properties']['policy_signing_certificates']['keys'] = keys
return client.create(resource_group_name=resource_group_name,
offer_type="virtualmachine",
provider_name=provider_name,
creation_params=creation_params)

Expand All @@ -44,6 +45,7 @@ def attestation_attestation_provider_show(client,
resource_group_name,
provider_name):
return client.get(resource_group_name=resource_group_name,
offer_type="virtualmachine",
provider_name=provider_name)


Expand All @@ -54,6 +56,7 @@ def attestation_attestation_provider_update(client,
update_params = {}
update_params['tags'] = tags
return client.update(resource_group_name=resource_group_name,
offer_type="virtualmachine",
provider_name=provider_name,
update_params=update_params)

Expand All @@ -62,4 +65,5 @@ def attestation_attestation_provider_delete(client,
resource_group_name,
provider_name):
return client.delete(resource_group_name=resource_group_name,
offer_type="virtualmachine",
provider_name=provider_name)
Loading