diff --git a/common/changes/@autorest/openapi-to-typespec/someFix_2024-09-24-07-17.json b/common/changes/@autorest/openapi-to-typespec/someFix_2024-09-24-07-17.json new file mode 100644 index 0000000000..106a2d1e85 --- /dev/null +++ b/common/changes/@autorest/openapi-to-typespec/someFix_2024-09-24-07-17.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@autorest/openapi-to-typespec", + "comment": "Fix some issues in convertion tool", + "type": "patch" + } + ], + "packageName": "@autorest/openapi-to-typespec" +} \ No newline at end of file diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 83cbadb970..95d88842c4 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -23,6 +23,9 @@ dependencies: '@azure-tools/typespec-azure-resource-manager': specifier: ^0.45.0 version: 0.45.0(@azure-tools/typespec-azure-core@0.45.0)(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/rest@0.59.1)(@typespec/versioning@0.59.0) + '@azure-tools/typespec-azure-rulesets': + specifier: ^0.45.0 + version: 0.45.0(@azure-tools/typespec-azure-core@0.45.0)(@azure-tools/typespec-azure-resource-manager@0.45.0)(@azure-tools/typespec-client-generator-core@0.45.3)(@typespec/compiler@0.59.1) '@azure-tools/typespec-client-generator-core': specifier: ^0.45.0 version: 0.45.3(@azure-tools/typespec-azure-core@0.45.0)(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/rest@0.59.1)(@typespec/versioning@0.59.0) @@ -178,7 +181,7 @@ dependencies: version: 0.59.0(@typespec/compiler@0.59.1)(@typespec/http@0.59.1) '@typespec/openapi3': specifier: ^0.59.0 - version: 0.59.1(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/versioning@0.59.0) + version: 0.59.1(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/versioning@0.59.0)(openapi-types@12.1.3) '@typespec/prettier-plugin-typespec': specifier: ^0.59.0 version: 0.59.0 @@ -278,6 +281,9 @@ dependencies: npm-package-arg: specifier: ^9.0.0 version: 9.1.2 + openapi-types: + specifier: ~12.1.3 + version: 12.1.3 pacote: specifier: ~9.5.12 version: 9.5.12 @@ -457,6 +463,21 @@ packages: pluralize: 8.0.0 dev: false + /@azure-tools/typespec-azure-rulesets@0.45.0(@azure-tools/typespec-azure-core@0.45.0)(@azure-tools/typespec-azure-resource-manager@0.45.0)(@azure-tools/typespec-client-generator-core@0.45.3)(@typespec/compiler@0.59.1): + resolution: {integrity: sha512-OpMYYc0ElxnswABud22GSqE24ZoJCRGh9fwSA8SoqsJr0uXRX7D6D5pA1FHFT3b5uBVHy0l+FFHvjz9wxfsbUw==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@azure-tools/typespec-azure-core': ~0.45.0 + '@azure-tools/typespec-azure-resource-manager': ~0.45.0 + '@azure-tools/typespec-client-generator-core': ~0.45.0 + '@typespec/compiler': ~0.59.0 + dependencies: + '@azure-tools/typespec-azure-core': 0.45.0(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/rest@0.59.1) + '@azure-tools/typespec-azure-resource-manager': 0.45.0(@azure-tools/typespec-azure-core@0.45.0)(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/rest@0.59.1)(@typespec/versioning@0.59.0) + '@azure-tools/typespec-client-generator-core': 0.45.3(@azure-tools/typespec-azure-core@0.45.0)(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/rest@0.59.1)(@typespec/versioning@0.59.0) + '@typespec/compiler': 0.59.1 + dev: false + /@azure-tools/typespec-client-generator-core@0.45.3(@azure-tools/typespec-azure-core@0.45.0)(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/rest@0.59.1)(@typespec/versioning@0.59.0): resolution: {integrity: sha512-o1E38DJnJ71ixK3jHTy42QgY1ztXPGEOhJjdzSb9aI0aXlqqBt0Klgg52RuBHBajQ+RI+nWtGLE+LJaVDSHAqw==} engines: {node: '>=18.0.0'} @@ -1380,7 +1401,7 @@ packages: js-yaml: 4.1.0 dev: false - /@readme/openapi-parser@2.6.0: + /@readme/openapi-parser@2.6.0(openapi-types@12.1.3): resolution: {integrity: sha512-pyFJXezWj9WI1O+gdp95CoxfY+i+Uq3kKk4zXIFuRAZi9YnHpHOpjumWWr67wkmRTw19Hskh9spyY0Iyikf3fA==} engines: {node: '>=18'} peerDependencies: @@ -1394,6 +1415,7 @@ packages: ajv: 8.16.0 ajv-draft-04: 1.0.0(ajv@8.16.0) call-me-maybe: 1.0.2 + openapi-types: 12.1.3 dev: false /@readme/openapi-schemas@3.1.0: @@ -1917,7 +1939,7 @@ packages: '@typespec/compiler': 0.59.1 dev: false - /@typespec/openapi3@0.59.1(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/versioning@0.59.0): + /@typespec/openapi3@0.59.1(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/versioning@0.59.0)(openapi-types@12.1.3): resolution: {integrity: sha512-89VbUbkWKxeFgE0w0hpVyk1UZ6ZHRxOhcAHvF5MgxQxEhs2ALXKAqapWjFQsYrLBhAUoWzdPFrJJUMbwF9kX0Q==} engines: {node: '>=18.0.0'} hasBin: true @@ -1927,7 +1949,7 @@ packages: '@typespec/openapi': ~0.59.0 '@typespec/versioning': ~0.59.0 dependencies: - '@readme/openapi-parser': 2.6.0 + '@readme/openapi-parser': 2.6.0(openapi-types@12.1.3) '@typespec/compiler': 0.59.1 '@typespec/http': 0.59.1(@typespec/compiler@0.59.1) '@typespec/openapi': 0.59.0(@typespec/compiler@0.59.1)(@typespec/http@0.59.1) @@ -6611,6 +6633,10 @@ packages: is-wsl: 2.2.0 dev: false + /openapi-types@12.1.3: + resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==} + dev: false + /optionator@0.9.3: resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==} engines: {node: '>= 0.8.0'} @@ -9626,7 +9652,7 @@ packages: dev: false file:projects/openapi-to-typespec.tgz(jest@29.7.0): - resolution: {integrity: sha512-XYcfOzdr4QGpFmGHhLSSoAkZiSsDaTQeyRKQrlmkybsAihGAuiR62N3nsAgz8WlDJCiem2ZgyreK/Pck7I4KiQ==, tarball: file:projects/openapi-to-typespec.tgz} + resolution: {integrity: sha512-nh3UlsBqlhoEFMHYWTmrPian6diNDD4vT/dW8mc37n/UvLzIfoOcKwTUY1vMZBnEU1qrXBX/w0KGiouUFemYFA==, tarball: file:projects/openapi-to-typespec.tgz} id: file:projects/openapi-to-typespec.tgz name: '@rush-temp/openapi-to-typespec' version: 0.0.0 @@ -9634,6 +9660,7 @@ packages: '@azure-tools/typespec-autorest': 0.45.0(@azure-tools/typespec-azure-core@0.45.0)(@azure-tools/typespec-azure-resource-manager@0.45.0)(@azure-tools/typespec-client-generator-core@0.45.3)(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/rest@0.59.1)(@typespec/versioning@0.59.0) '@azure-tools/typespec-azure-core': 0.45.0(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/rest@0.59.1) '@azure-tools/typespec-azure-resource-manager': 0.45.0(@azure-tools/typespec-azure-core@0.45.0)(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/rest@0.59.1)(@typespec/versioning@0.59.0) + '@azure-tools/typespec-azure-rulesets': 0.45.0(@azure-tools/typespec-azure-core@0.45.0)(@azure-tools/typespec-azure-resource-manager@0.45.0)(@azure-tools/typespec-client-generator-core@0.45.3)(@typespec/compiler@0.59.1) '@azure-tools/typespec-client-generator-core': 0.45.3(@azure-tools/typespec-azure-core@0.45.0)(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/rest@0.59.1)(@typespec/versioning@0.59.0) '@types/fs-extra': 9.0.13 '@types/lodash': 4.14.201 @@ -9646,7 +9673,7 @@ packages: '@typespec/compiler': 0.59.1 '@typespec/http': 0.59.1(@typespec/compiler@0.59.1) '@typespec/openapi': 0.59.0(@typespec/compiler@0.59.1)(@typespec/http@0.59.1) - '@typespec/openapi3': 0.59.1(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/versioning@0.59.0) + '@typespec/openapi3': 0.59.1(@typespec/compiler@0.59.1)(@typespec/http@0.59.1)(@typespec/openapi@0.59.0)(@typespec/versioning@0.59.0)(openapi-types@12.1.3) '@typespec/prettier-plugin-typespec': 0.59.0 '@typespec/rest': 0.59.1(@typespec/compiler@0.59.1)(@typespec/http@0.59.1) '@typespec/versioning': 0.59.0(@typespec/compiler@0.59.1) @@ -9661,6 +9688,7 @@ packages: eslint-plugin-unicorn: 49.0.0(eslint@8.53.0) fs-extra: 10.1.0 lodash: 4.17.21 + openapi-types: 12.1.3 pluralize: 8.0.0 prettier: 3.1.0 rimraf: 5.0.5 @@ -9677,7 +9705,6 @@ packages: - esbuild - eslint-config-prettier - jest - - openapi-types - supports-color - uglify-js - webpack-bundle-analyzer diff --git a/packages/extensions/openapi-to-typespec/package.json b/packages/extensions/openapi-to-typespec/package.json index 195f13ea12..1eff22b3db 100644 --- a/packages/extensions/openapi-to-typespec/package.json +++ b/packages/extensions/openapi-to-typespec/package.json @@ -70,6 +70,7 @@ "chalk": "^4.1.0", "@azure-tools/typespec-autorest": "^0.45.0", "@azure-tools/typespec-client-generator-core": "^0.45.0", + "@azure-tools/typespec-azure-rulesets": "^0.45.0", "webpack-cli": "~5.1.4", "webpack": "~5.89.0", "@typescript-eslint/eslint-plugin": "^6.11.0", diff --git a/packages/extensions/openapi-to-typespec/src/emiters/emit-models.ts b/packages/extensions/openapi-to-typespec/src/emiters/emit-models.ts index 1489258290..fcb908c674 100644 --- a/packages/extensions/openapi-to-typespec/src/emiters/emit-models.ts +++ b/packages/extensions/openapi-to-typespec/src/emiters/emit-models.ts @@ -5,7 +5,7 @@ import { TypespecEnum, TypespecProgram } from "../interfaces"; import { getOptions } from "../options"; import { formatTypespecFile } from "../utils/format"; import { getModelsImports } from "../utils/imports"; -import { getNamespaceStatement } from "../utils/namespace"; +import { getNamespace, getNamespaceStatement } from "../utils/namespace"; export async function emitModels(filePath: string, program: TypespecProgram): Promise { const content = generateModels(program); @@ -33,7 +33,9 @@ function generateModels(program: TypespecProgram) { namespaces, "\n", getNamespaceStatement(program), - isArm ? "\ninterface Operations extends Azure.ResourceManager.Operations {} \n" : "\n", + isArm && containsListOperation(program) + ? "\ninterface Operations extends Azure.ResourceManager.Operations {} \n" + : "\n", enums, "\n", objects, @@ -45,3 +47,14 @@ function flattenEnums(enums: TypespecEnum[]) { return [...a, ...generateEnums(c)]; }, []); } + +function containsListOperation(program: TypespecProgram): boolean { + const providerNamespace = getNamespace(program); + const listOperationRoute = `/providers/${providerNamespace}/operations`; + return ( + program.operationGroups + .flatMap((g) => g.operations) + .map((o) => o.route) + .find((r) => r === listOperationRoute) !== undefined + ); +} diff --git a/packages/extensions/openapi-to-typespec/src/emiters/emit-typespec-config.ts b/packages/extensions/openapi-to-typespec/src/emiters/emit-typespec-config.ts index c8b20e9f46..845d468132 100644 --- a/packages/extensions/openapi-to-typespec/src/emiters/emit-typespec-config.ts +++ b/packages/extensions/openapi-to-typespec/src/emiters/emit-typespec-config.ts @@ -51,7 +51,7 @@ options: } linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" `; } diff --git a/packages/extensions/openapi-to-typespec/src/main.ts b/packages/extensions/openapi-to-typespec/src/main.ts index 5816a28912..b2471c9575 100644 --- a/packages/extensions/openapi-to-typespec/src/main.ts +++ b/packages/extensions/openapi-to-typespec/src/main.ts @@ -33,7 +33,7 @@ export async function processConverter(host: AutorestExtensionHost) { const { isArm } = getOptions(); let metadata = undefined; if (isArm) { - // await host.writeFile({ filename: "codeModel.yaml", content: serialize(codeModel, codeModelSchema)} ); + // await host.writeFile({ filename: "codeModel.yaml", content: serialize(codeModel, codeModelSchema) }); metadata = parseMetadata(codeModel); await host.writeFile({ filename: "resources.json", content: JSON.stringify(metadata, null, 2) }); pretransformArmResources(codeModel, metadata); diff --git a/packages/extensions/openapi-to-typespec/src/resource/utils.ts b/packages/extensions/openapi-to-typespec/src/resource/utils.ts index 12b0bcd9bb..67abdc68ed 100644 --- a/packages/extensions/openapi-to-typespec/src/resource/utils.ts +++ b/packages/extensions/openapi-to-typespec/src/resource/utils.ts @@ -65,7 +65,7 @@ export function isScopedPath(path: string): boolean { export function isSingleton(set: OperationSet): boolean { const lastSegment = getLastSegment(set.RequestPath); - if (lastSegment.match(/^\{\w+\}$/) === null) return true; + if (!isVariable(lastSegment)) return true; const resourceKey = lastSegment.replace(/^\{(\w+)\}$/, "$1"); const resourceKeyParameter = set.Operations[0].parameters?.find( @@ -79,8 +79,22 @@ export function isSingleton(set: OperationSet): boolean { export function pathIncludes(path1: string, path2: string): boolean { const lowerPath1 = path1.toLowerCase(); const lowerPath2 = path2.toLowerCase(); - // TO-DO: escape the variable case - return lowerPath1.includes(lowerPath2); + const segments1 = lowerPath1.split("/"); + const segments2 = lowerPath2.split("/"); + if (segments2.length > segments1.length) return false; + + // If the segment is a variable, then different variable names are still equivalent + for (let index = 0; index < segments2.length; ++index) { + if (isVariable(segments1[index])) { + if (!isVariable(segments2[index])) return false; + } else if (segments1[index] !== segments2[index]) return false; + } + return true; +} + +// {variableName} +function isVariable(segment: string): boolean { + return segment.match(/^\{\w+\}$/) !== null; } function getLastSegment(path: string): string { diff --git a/packages/extensions/openapi-to-typespec/src/transforms/transform-arm-resources.ts b/packages/extensions/openapi-to-typespec/src/transforms/transform-arm-resources.ts index 2dddbc2a59..b20cc2bb1c 100644 --- a/packages/extensions/openapi-to-typespec/src/transforms/transform-arm-resources.ts +++ b/packages/extensions/openapi-to-typespec/src/transforms/transform-arm-resources.ts @@ -53,7 +53,10 @@ function addGeneratedResourceObjectIfNotExits(name: string, mapping: string) { generatedResourceObjects.set(name, mapping); } +const armResourceCache: Map = new Map(); export function transformTspArmResource(schema: ArmResourceSchema): TspArmResource { + if (armResourceCache.has(schema)) return armResourceCache.get(schema)!; + const { isFullCompatible } = getOptions(); const fixMe: string[] = []; @@ -142,7 +145,7 @@ export function transformTspArmResource(schema: ArmResourceSchema): TspArmResour }); } - return { + const tspResource: TspArmResource = { fixMe, resourceKind: getResourceKind(schema), kind: "object", @@ -165,6 +168,8 @@ export function transformTspArmResource(schema: ArmResourceSchema): TspArmResour baseModelName, locationParent: getLocationParent(schema), }; + armResourceCache.set(schema, tspResource); + return tspResource; } function getOtherProperties(schema: ArmResourceSchema, noCommonTypes: boolean): TypespecObjectProperty[] { @@ -228,7 +233,7 @@ function convertResourceReadOperation( { doc: resourceMetadata.GetOperations[0].Description, // TODO: resource have duplicated CRUD operations kind: "ArmResourceRead", - name: getOperationName(operation.OperationID), + name: getOperationName(resourceMetadata.Name, operation.OperationID), operationId: operation.OperationID, clientDecorators: getOperationClientDecorators(swaggerOperation), templateParameters: baseParameters @@ -246,7 +251,9 @@ function convertResourceExistsOperation(resourceMetadata: ArmResource): TspArmRe { doc: swaggerOperation.language.default.description, kind: "ArmResourceExists", - name: swaggerOperation.operationId ? getOperationName(swaggerOperation.operationId) : "exists", + name: swaggerOperation.operationId + ? getOperationName(resourceMetadata.Name, swaggerOperation.operationId) + : "exists", clientDecorators: getOperationClientDecorators(swaggerOperation), operationId: swaggerOperation.operationId, parameters: [ @@ -285,7 +292,7 @@ function convertResourceCreateOrReplaceOperation( templateParameters.push(baseParameters); } const tspOperationGroupName = getTSPOperationGroupName(resourceMetadata.SwaggerModelName); - const operationName = getOperationName(operation.OperationID); + const operationName = getOperationName(resourceMetadata.Name, operation.OperationID); const customizations = getCustomizations( bodyParam, tspOperationGroupName, @@ -359,7 +366,7 @@ function convertResourceUpdateOperation( } const tspOperationGroupName = getTSPOperationGroupName(resourceMetadata.SwaggerModelName); - const operationName = getOperationName(operation.OperationID); + const operationName = getOperationName(resourceMetadata.Name, operation.OperationID); const customizations = getCustomizations( bodyParam, tspOperationGroupName, @@ -385,7 +392,7 @@ function convertResourceUpdateOperation( fixMe, doc: operation.Description, kind: kind as any, - name: getOperationName(operation.OperationID), + name: operationName, clientDecorators: getOperationClientDecorators(swaggerOperation), operationId: operation.OperationID, templateParameters, @@ -429,7 +436,7 @@ function convertResourceDeleteOperation( { doc: operation.Description, kind: kind, - name: getOperationName(operation.OperationID), + name: getOperationName(resourceMetadata.Name, operation.OperationID), clientDecorators: getOperationClientDecorators(swaggerOperation), operationId: operation.OperationID, templateParameters, @@ -467,7 +474,7 @@ function convertResourceListOperations( converted.push({ doc: operation.Description, kind: "ArmResourceListByParent", - name: getOperationName(operation.OperationID), + name: getOperationName(resourceMetadata.Name, operation.OperationID), clientDecorators: getOperationClientDecorators(swaggerOperation), operationId: operation.OperationID, templateParameters: templateParameters, @@ -501,7 +508,7 @@ function convertResourceListOperations( converted.push({ doc: operation.Description, kind: "ArmResourceListAtScope", - name: getOperationName(operation.OperationID), + name: getOperationName(resourceMetadata.Name, operation.OperationID), clientDecorators: getOperationClientDecorators(swaggerOperation), operationId: operation.OperationID, templateParameters, @@ -511,7 +518,7 @@ function convertResourceListOperations( converted.push({ doc: operation.Description, kind: "ArmListBySubscription", - name: getOperationName(operation.OperationID), + name: getOperationName(resourceMetadata.Name, operation.OperationID), clientDecorators: getOperationClientDecorators(swaggerOperation), operationId: operation.OperationID, templateParameters: [resourceMetadata.SwaggerModelName], @@ -566,7 +573,7 @@ function convertResourceActionOperations( } const tspOperationGroupName = getTSPOperationGroupName(resourceMetadata.SwaggerModelName); - const operationName = getOperationName(operation.OperationID); + const operationName = getOperationName(resourceMetadata.Name, operation.OperationID); const customizations = getCustomizations( bodyParam, tspOperationGroupName, @@ -614,7 +621,7 @@ function convertCheckNameAvailabilityOperations( converted.push({ doc: operation.Description, kind: "checkLocalNameAvailability", - name: getOperationName(operation.OperationID), + name: getOperationName(resourceMetadata.Name, operation.OperationID), clientDecorators: getOperationClientDecorators(swaggerOperation), operationId: operation.OperationID, examples: swaggerOperation.extensions?.["x-ms-examples"], @@ -624,7 +631,7 @@ function convertCheckNameAvailabilityOperations( converted.push({ doc: operation.Description, kind: "checkGlobalNameAvailability", - name: getOperationName(operation.OperationID), + name: getOperationName(resourceMetadata.Name, operation.OperationID), clientDecorators: getOperationClientDecorators(swaggerOperation), operationId: operation.OperationID, examples: swaggerOperation.extensions?.["x-ms-examples"], @@ -704,8 +711,24 @@ function getTspOperations(armSchema: ArmResourceSchema): [TspArmResourceOperatio return [tspOperations, normalOperations]; } -function getOperationName(name: string): string { - return _.lowerFirst(_.last(name.split("_"))); +const existingNames: { [resourceName: string]: Set } = {}; +// TO-DO: Figure out a way to create a new name if the name exists +function getOperationName(resourceName: string, operationId: string): string { + let operationName = _.lowerFirst(_.last(operationId.split("_"))); + if (resourceName in existingNames) { + if (existingNames[resourceName].has(operationName)) { + operationName = _.lowerFirst( + operationId + .split("_") + .map((n) => _.upperFirst(n)) + .join(""), + ); + } + existingNames[resourceName].add(operationName); + } else { + existingNames[resourceName] = new Set([operationName]); + } + return operationName; } function getOperationGroupName(name: string | undefined): string { diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-agrifood/swagger-output/swagger.json index a0c0b0058c..658c77326d 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/swagger-output/swagger.json @@ -40,9 +40,6 @@ } }, "tags": [ - { - "name": "Operations" - }, { "name": "DataConnectors" }, @@ -311,37 +308,6 @@ } } }, - "/providers/Azure.ResourceManager.AgFoodPlatform/operations": { - "get": { - "operationId": "Operations_List", - "tags": [ - "Operations" - ], - "description": "List the operations for the provider", - "parameters": [ - { - "$ref": "../../common-types/resource-management/v4/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "../../common-types/resource-management/v4/types.json#/definitions/OperationListResult" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../common-types/resource-management/v4/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, "/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.AgFoodPlatform/farmBeats": { "get": { "operationId": "DataManagerForAgricultureResources_ListBySubscription", diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/models.tsp index ee8fd732af..149c9c5a89 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/models.tsp @@ -9,8 +9,6 @@ using Azure.ResourceManager.Foundations; namespace Azure.ResourceManager.AgFoodPlatform; -interface Operations extends Azure.ResourceManager.Operations {} - /** * Enum for different types of AuthCredentials supported. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/tspconfig.yaml index 4d8081ad3a..ba01d4aa16 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-agrifood/tsp-output/tspconfig.yaml @@ -11,4 +11,4 @@ options: arm-resource-flattening: true linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/models.tsp index 5fac4946c0..50f8d2da2d 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/models.tsp @@ -11,8 +11,6 @@ using Azure.ResourceManager.Foundations; namespace Azure.ResourceManager.AlertsManagement; -interface Operations extends Azure.ResourceManager.Operations {} - /** * Field for a given condition. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/tspconfig.yaml index 7768960f4b..242df89076 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-alertsmanagement/tsp-output/tspconfig.yaml @@ -11,4 +11,4 @@ options: arm-resource-flattening: true linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/models.tsp index bfb8131210..ef195e6680 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/models.tsp @@ -11,8 +11,6 @@ using Azure.ResourceManager.Foundations; namespace Azure.ResourceManager.Analysis; -interface Operations extends Azure.ResourceManager.Operations {} - /** * The current state of Analysis Services resource. The state is to indicate more states outside of resource provisioning. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/tspconfig.yaml index ec71a41ea8..a85a6b68de 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-analysisservices/tsp-output/tspconfig.yaml @@ -11,4 +11,4 @@ options: arm-resource-flattening: true linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/resources.json b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/resources.json index c475abe3dc..0ead10e073 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/resources.json +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/resources.json @@ -2050,42 +2050,6 @@ "NextLinkName": "nextLink" }, "Description": "Lists a collection of resources associated with tags." - }, - { - "Name": "Deploy", - "Path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy", - "Method": "POST", - "OperationID": "TenantConfiguration_Deploy", - "IsLongRunning": true, - "PagingMetadata": null, - "Description": "This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete." - }, - { - "Name": "Save", - "Path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save", - "Method": "POST", - "OperationID": "TenantConfiguration_Save", - "IsLongRunning": true, - "PagingMetadata": null, - "Description": "This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete." - }, - { - "Name": "Validate", - "Path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate", - "Method": "POST", - "OperationID": "TenantConfiguration_Validate", - "IsLongRunning": true, - "PagingMetadata": null, - "Description": "This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete." - }, - { - "Name": "GetSyncState", - "Path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState", - "Method": "GET", - "OperationID": "TenantConfiguration_GetSyncState", - "IsLongRunning": false, - "PagingMetadata": null, - "Description": "Gets the status of the most recent synchronization between the configuration database and the Git repository." } ], "Parents": [ @@ -4035,6 +3999,42 @@ "IsLongRunning": false, "PagingMetadata": null, "Description": "Regenerate secondary access key for GIT." + }, + { + "Name": "Deploy", + "Path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/deploy", + "Method": "POST", + "OperationID": "TenantConfiguration_Deploy", + "IsLongRunning": true, + "PagingMetadata": null, + "Description": "This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete." + }, + { + "Name": "Save", + "Path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/save", + "Method": "POST", + "OperationID": "TenantConfiguration_Save", + "IsLongRunning": true, + "PagingMetadata": null, + "Description": "This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete." + }, + { + "Name": "Validate", + "Path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/validate", + "Method": "POST", + "OperationID": "TenantConfiguration_Validate", + "IsLongRunning": true, + "PagingMetadata": null, + "Description": "This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete." + }, + { + "Name": "GetSyncState", + "Path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState", + "Method": "GET", + "OperationID": "TenantConfiguration_GetSyncState", + "IsLongRunning": false, + "PagingMetadata": null, + "Description": "Gets the status of the most recent synchronization between the configuration database and the Git repository." } ], "Parents": [ diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/AccessInformationContract.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/AccessInformationContract.tsp index 5896e7064b..9561637c70 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/AccessInformationContract.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/AccessInformationContract.tsp @@ -140,7 +140,7 @@ interface AccessInformationContracts { */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" @operationId("TenantAccessGit_RegeneratePrimaryKey") - regeneratePrimaryKey is ArmResourceActionNoContentSync< + tenantAccessGitRegeneratePrimaryKey is ArmResourceActionNoContentSync< AccessInformationContract, void >; @@ -150,10 +150,100 @@ interface AccessInformationContracts { */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" @operationId("TenantAccessGit_RegenerateSecondaryKey") - regenerateSecondaryKey is ArmResourceActionNoContentSync< + tenantAccessGitRegenerateSecondaryKey is ArmResourceActionNoContentSync< AccessInformationContract, void >; + + /** + * This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. + */ + #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + @operationId("TenantConfiguration_Deploy") + deploy is ArmResourceActionAsync< + AccessInformationContract, + DeployConfigurationParameters, + OperationResultContract, + { + ...Azure.ResourceManager.Foundations.BaseParameters; + + /** + * The identifier of the Git Configuration Operation. + */ + @path + configurationName: ConfigurationIdName; + } + >; + + /** + * This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. + */ + #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + @operationId("TenantConfiguration_Save") + save is ArmResourceActionAsync< + AccessInformationContract, + SaveConfigurationParameter, + OperationResultContract, + { + ...Azure.ResourceManager.Foundations.BaseParameters; + + /** + * The identifier of the Git Configuration Operation. + */ + @path + configurationName: ConfigurationIdName; + } + >; + + /** + * This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. + */ + #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + @operationId("TenantConfiguration_Validate") + validate is ArmResourceActionAsync< + AccessInformationContract, + DeployConfigurationParameters, + OperationResultContract, + { + ...Azure.ResourceManager.Foundations.BaseParameters; + + /** + * The identifier of the Git Configuration Operation. + */ + @path + configurationName: ConfigurationIdName; + } + >; + + /** + * Gets the status of the most recent synchronization between the configuration database and the Git repository. + */ + // FIXME: TenantConfiguration_GetSyncState could not be converted to a resource operation + #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + @operationId("TenantConfiguration_GetSyncState") + @route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState") + @get + getSyncState( + ...ApiVersionParameter, + ...ResourceGroupParameter, + + /** + * The name of the API Management service. + */ + @maxLength(50) + @minLength(1) + @pattern("^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$") + @path + serviceName: string, + + ...SubscriptionIdParameter, + + /** + * The identifier of the Git Configuration Operation. + */ + @path + configurationName: ConfigurationIdName, + ): ArmResponse | ErrorResponse; } @@doc(AccessInformationContract.name, @@ -184,3 +274,36 @@ interface AccessInformationContracts { @@doc(AccessInformationContracts.update::parameters.properties, "Parameters supplied to retrieve the Tenant Access Information." ); +@@encodedName(AccessInformationContracts.deploy::parameters.body, + "application/json", + "parameters" +); +@@extension(AccessInformationContracts.deploy::parameters.body, + "x-ms-client-name", + "parameters" +); +@@doc(AccessInformationContracts.deploy::parameters.body, + "Deploy Configuration parameters." +); +@@encodedName(AccessInformationContracts.save::parameters.body, + "application/json", + "parameters" +); +@@extension(AccessInformationContracts.save::parameters.body, + "x-ms-client-name", + "parameters" +); +@@doc(AccessInformationContracts.save::parameters.body, + "Save Configuration parameters." +); +@@encodedName(AccessInformationContracts.validate::parameters.body, + "application/json", + "parameters" +); +@@extension(AccessInformationContracts.validate::parameters.body, + "x-ms-client-name", + "parameters" +); +@@doc(AccessInformationContracts.validate::parameters.body, + "Validate Configuration parameters." +); diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiManagementServiceResource.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiManagementServiceResource.tsp index 0946d36292..f3dd15172e 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiManagementServiceResource.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/ApiManagementServiceResource.tsp @@ -146,66 +146,6 @@ interface ApiManagementServiceResources { ApiManagementServiceResource >; - /** - * This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could take several minutes to complete. - */ - #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @operationId("TenantConfiguration_Deploy") - deploy is ArmResourceActionAsync< - ApiManagementServiceResource, - DeployConfigurationParameters, - OperationResultContract, - { - ...Azure.ResourceManager.Foundations.BaseParameters; - - /** - * The identifier of the Git Configuration Operation. - */ - @path - configurationName: ConfigurationIdName; - } - >; - - /** - * This operation creates a commit with the current configuration snapshot to the specified branch in the repository. This is a long running operation and could take several minutes to complete. - */ - #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @operationId("TenantConfiguration_Save") - save is ArmResourceActionAsync< - ApiManagementServiceResource, - SaveConfigurationParameter, - OperationResultContract, - { - ...Azure.ResourceManager.Foundations.BaseParameters; - - /** - * The identifier of the Git Configuration Operation. - */ - @path - configurationName: ConfigurationIdName; - } - >; - - /** - * This operation validates the changes in the specified Git branch. This is a long running operation and could take several minutes to complete. - */ - #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @operationId("TenantConfiguration_Validate") - validate is ArmResourceActionAsync< - ApiManagementServiceResource, - DeployConfigurationParameters, - OperationResultContract, - { - ...Azure.ResourceManager.Foundations.BaseParameters; - - /** - * The identifier of the Git Configuration Operation. - */ - @path - configurationName: ConfigurationIdName; - } - >; - /** * Lists a collection of apis associated with tags. */ @@ -973,36 +913,6 @@ interface ApiManagementServiceResources { ...SubscriptionIdParameter, ): ArmResponse | ErrorResponse; - - /** - * Gets the status of the most recent synchronization between the configuration database and the Git repository. - */ - // FIXME: TenantConfiguration_GetSyncState could not be converted to a resource operation - #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" - @operationId("TenantConfiguration_GetSyncState") - @route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{configurationName}/syncState") - @get - getSyncState( - ...ApiVersionParameter, - ...ResourceGroupParameter, - - /** - * The name of the API Management service. - */ - @maxLength(50) - @minLength(1) - @pattern("^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$") - @path - serviceName: string, - - ...SubscriptionIdParameter, - - /** - * The identifier of the Git Configuration Operation. - */ - @path - configurationName: ConfigurationIdName, - ): ArmResponse | ErrorResponse; } @@maxLength(ApiManagementServiceResource.name, 50); @@ -1079,36 +989,3 @@ interface ApiManagementServiceResources { @@doc(ApiManagementServiceResources.applyNetworkConfigurationUpdates::parameters.body, "Parameters supplied to the Apply Network Configuration operation. If the parameters are empty, all the regions in which the Api Management service is deployed will be updated sequentially without incurring downtime in the region." ); -@@encodedName(ApiManagementServiceResources.deploy::parameters.body, - "application/json", - "parameters" -); -@@extension(ApiManagementServiceResources.deploy::parameters.body, - "x-ms-client-name", - "parameters" -); -@@doc(ApiManagementServiceResources.deploy::parameters.body, - "Deploy Configuration parameters." -); -@@encodedName(ApiManagementServiceResources.save::parameters.body, - "application/json", - "parameters" -); -@@extension(ApiManagementServiceResources.save::parameters.body, - "x-ms-client-name", - "parameters" -); -@@doc(ApiManagementServiceResources.save::parameters.body, - "Save Configuration parameters." -); -@@encodedName(ApiManagementServiceResources.validate::parameters.body, - "application/json", - "parameters" -); -@@extension(ApiManagementServiceResources.validate::parameters.body, - "x-ms-client-name", - "parameters" -); -@@doc(ApiManagementServiceResources.validate::parameters.body, - "Validate Configuration parameters." -); diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/models.tsp index 5d3af8e643..9f4cb762e9 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/models.tsp @@ -13,8 +13,6 @@ using Azure.ResourceManager.Foundations; namespace Azure.ResourceManager.ApiManagement; -interface Operations extends Azure.ResourceManager.Operations {} - union Protocol { string, http: "http", diff --git a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/tspconfig.yaml index 7768960f4b..242df89076 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-apimanagement/tsp-output/tspconfig.yaml @@ -11,4 +11,4 @@ options: arm-resource-flattening: true linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/models.tsp index be571fe5dc..72779d151a 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/models.tsp @@ -12,8 +12,6 @@ using Azure.ResourceManager.Foundations; namespace Azure.ResourceManager.Authorization; -interface Operations extends Azure.ResourceManager.Operations {} - /** * The principal type of the assigned principal ID. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/tspconfig.yaml index 7768960f4b..242df89076 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-authorization/tsp-output/tspconfig.yaml @@ -11,4 +11,4 @@ options: arm-resource-flattening: true linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/models.tsp index 61c7f16fde..bcbc76c22a 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/models.tsp @@ -11,8 +11,6 @@ using Azure.ResourceManager.Foundations; namespace Microsoft.IntegrationSpaces; -interface Operations extends Azure.ResourceManager.Operations {} - /** * The status of the current operation. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/tspconfig.yaml index 7768960f4b..242df89076 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-azureintegrationspaces/tsp-output/tspconfig.yaml @@ -11,4 +11,4 @@ options: arm-resource-flattening: true linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/resources.json b/packages/extensions/openapi-to-typespec/test/arm-compute/resources.json index db533e94cb..9879cc6a2d 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/resources.json +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/resources.json @@ -525,7 +525,21 @@ "Description": "Deletes a virtual machine from a VM scale set." } ], - "ListOperations": [], + "ListOperations": [ + { + "Name": "GetAll", + "Path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", + "Method": "GET", + "OperationID": "VirtualMachineScaleSetVMs_List", + "IsLongRunning": false, + "PagingMetadata": { + "Method": "List", + "ItemName": "value", + "NextLinkName": "nextLink" + }, + "Description": "Gets a list of all virtual machines in a VM scale sets." + } + ], "OperationsFromResourceGroupExtension": [], "OperationsFromSubscriptionExtension": [], "OperationsFromManagementGroupExtension": [], diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Gallery.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Gallery.tsp index de0b6fdb92..2a5a83e19a 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Gallery.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/Gallery.tsp @@ -82,7 +82,11 @@ interface Galleries { */ #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" @operationId("GallerySharingProfile_Update") - update is ArmResourceActionAsync; + gallerySharingProfileUpdate is ArmResourceActionAsync< + Gallery, + SharingUpdate, + SharingUpdate + >; } @@doc(Gallery.name, "The name of the Shared Image Gallery."); @@ -111,14 +115,14 @@ interface Galleries { @@doc(Galleries.update::parameters.properties, "Parameters supplied to the update Shared Image Gallery operation." ); -@@encodedName(Galleries.update::parameters.body, +@@encodedName(Galleries.gallerySharingProfileUpdate::parameters.body, "application/json", "sharingUpdate" ); -@@extension(Galleries.update::parameters.body, +@@extension(Galleries.gallerySharingProfileUpdate::parameters.body, "x-ms-client-name", "sharingUpdate" ); -@@doc(Galleries.update::parameters.body, +@@doc(Galleries.gallerySharingProfileUpdate::parameters.body, "Parameters supplied to the update gallery sharing profile." ); diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetVM.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetVM.tsp index b5b48453d4..abf578539f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetVM.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/VirtualMachineScaleSetVM.tsp @@ -107,6 +107,42 @@ interface VirtualMachineScaleSetVMS { } >; + /** + * Gets a list of all virtual machines in a VM scale sets. + */ + #suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility" + @operationId("VirtualMachineScaleSetVMs_List") + list is ArmResourceListByParent< + VirtualMachineScaleSetVM, + { + ...Azure.ResourceManager.Foundations.BaseParameters; + + /** + * The name of the VM scale set. + */ + @path + virtualMachineScaleSetName: string; + + /** + * The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'. + */ + @query("$filter") + $filter?: string; + + /** + * The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + */ + @query("$select") + $select?: string; + + /** + * The expand expression to apply to the operation. Allowed values are 'instanceView'. + */ + @query("$expand") + $expand?: string; + } + >; + /** * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/examples/2023-07-01/VirtualMachineScaleSetVMs_List_Virtual_Machine_Scale_Set_Vm_List_Maximum_Set_Gen.json b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/examples/2023-07-01/VirtualMachineScaleSetVMs_List_Virtual_Machine_Scale_Set_Vm_List_Maximum_Set_Gen.json new file mode 100644 index 0000000000..83795449f7 --- /dev/null +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/examples/2023-07-01/VirtualMachineScaleSetVMs_List_Virtual_Machine_Scale_Set_Vm_List_Maximum_Set_Gen.json @@ -0,0 +1,548 @@ +{ + "parameters": { + "$expand": "aaaaaaaaaaaaa", + "$filter": "aaaaaaaaaaaaaa", + "$select": "aaaaaaaaaaaaaaaaaaaaa", + "api-version": "2023-07-01", + "resourceGroupName": "rgcompute", + "subscriptionId": "{subscription-id}", + "virtualMachineScaleSetName": "aaaaaaaaaaaaaaaaaaaaaa" + }, + "responses": { + "200": { + "body": { + "nextLink": "aaaaaaaaaaaaaa", + "value": [ + { + "name": "{vmss-vm-name}", + "type": "Microsoft.Compute/virtualMachines", + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0", + "instanceId": "aaaaaaaaaaaa", + "location": "westus", + "plan": { + "name": "aaaaaaaaaa", + "product": "aaaaaaaaaaaaaaaaaaaa", + "promotionCode": "aaaaaaaaaaaaaaaaaaaa", + "publisher": "aaaaaaaaaaaaaaaaaaaaaa" + }, + "properties": { + "additionalCapabilities": { + "hibernationEnabled": true, + "ultraSSDEnabled": true + }, + "availabilitySet": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": true, + "storageUri": "aaaaaaaaaaaaa" + } + }, + "hardwareProfile": { + "vmSize": "Basic_A0", + "vmSizeProperties": { + "vCPUsAvailable": 9, + "vCPUsPerCore": 12 + } + }, + "instanceView": { + "assignedHost": "aaaaaaa", + "bootDiagnostics": { + "consoleScreenshotBlobUri": "aaaaaaaaaaaaaaaaaaaaaaaaa", + "serialConsoleLogBlobUri": "aaaaaaaa", + "status": { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z" + } + }, + "disks": [ + { + "name": "aaaaaaaaaaa", + "encryptionSettings": [ + { + "diskEncryptionKey": { + "secretUrl": "aaaaaaaa", + "sourceVault": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + }, + "enabled": true, + "keyEncryptionKey": { + "keyUrl": "aaaaaaaaaaaaaa", + "sourceVault": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + } + } + ], + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z" + } + ] + } + ], + "maintenanceRedeployStatus": { + "isCustomerInitiatedMaintenanceAllowed": true, + "lastOperationMessage": "aaaaaa", + "lastOperationResultCode": "None", + "maintenanceWindowEndTime": "2021-11-30T12:58:26.531Z", + "maintenanceWindowStartTime": "2021-11-30T12:58:26.531Z", + "preMaintenanceWindowEndTime": "2021-11-30T12:58:26.531Z", + "preMaintenanceWindowStartTime": "2021-11-30T12:58:26.531Z" + }, + "placementGroupId": "aaa", + "platformFaultDomain": 14, + "platformUpdateDomain": 23, + "rdpThumbPrint": "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z" + } + ], + "vmAgent": { + "extensionHandlers": [ + { + "type": "aaaaaaaaaaaaa", + "status": { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z" + }, + "typeHandlerVersion": "aaaaa" + } + ], + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z" + } + ], + "vmAgentVersion": "aaaaaaaaaaaaaaaaaaaaaaa" + }, + "vmHealth": { + "status": { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z" + } + }, + "extensions": [ + { + "name": "aaaaaaaaaaaaaaaaa", + "type": "aaaaaaaaa", + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z" + } + ], + "substatuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z" + } + ], + "typeHandlerVersion": "aaaaaaaaaaaaaaaaaaaaaaaaaa" + } + ] + }, + "latestModelApplied": true, + "licenseType": "aaaaaaaaaa", + "modelDefinitionApplied": "VirtualMachineScaleSet", + "networkProfile": { + "networkApiVersion": "2020-11-01", + "networkInterfaceConfigurations": [ + { + "name": "aaaaaaaaaaa", + "properties": { + "deleteOption": "Delete", + "dnsSettings": { + "dnsServers": [ + "aaaaaa" + ] + }, + "dscpConfiguration": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + "enableAcceleratedNetworking": true, + "enableFpga": true, + "enableIPForwarding": true, + "ipConfigurations": [ + { + "name": "aa", + "properties": { + "applicationGatewayBackendAddressPools": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "applicationSecurityGroups": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "loadBalancerBackendAddressPools": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "primary": true, + "privateIPAddressVersion": "IPv4", + "publicIPAddressConfiguration": { + "name": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "properties": { + "deleteOption": "Delete", + "dnsSettings": { + "domainNameLabel": "aaaaaaaaaaaaaaaaaaaaaaaaa" + }, + "idleTimeoutInMinutes": 2, + "ipTags": [ + { + "ipTagType": "aaaaaaaaaaaaaaaaaaaaaaaaa", + "tag": "aaaaaaaaaaaaaaaaaaaa" + } + ], + "publicIPAddressVersion": "IPv4", + "publicIPAllocationMethod": "Dynamic", + "publicIPPrefix": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + }, + "sku": { + "name": "Basic", + "tier": "Regional" + } + }, + "subnet": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + } + } + ], + "networkSecurityGroup": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + "primary": true + } + } + ], + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415", + "properties": { + "deleteOption": "Delete", + "primary": true + } + } + ] + }, + "networkProfileConfiguration": { + "networkInterfaceConfigurations": [ + { + "name": "vmsstestnetconfig5415", + "properties": { + "deleteOption": "Delete", + "dnsSettings": { + "dnsServers": [] + }, + "enableAcceleratedNetworking": true, + "enableFpga": true, + "enableIPForwarding": true, + "ipConfigurations": [ + { + "name": "vmsstestnetconfig9693", + "properties": { + "applicationGatewayBackendAddressPools": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "applicationSecurityGroups": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "loadBalancerBackendAddressPools": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "loadBalancerInboundNatPools": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "primary": true, + "privateIPAddressVersion": "IPv4", + "publicIPAddressConfiguration": { + "name": "aaaaaaaaaaaaaaaaaa", + "properties": { + "deleteOption": "Delete", + "dnsSettings": { + "domainNameLabel": "aaaaaaaaaaaaaaaaaa" + }, + "idleTimeoutInMinutes": 18, + "ipTags": [ + { + "ipTagType": "aaaaaaa", + "tag": "aaaaaaaaaaaaaaaaaaaaaaaaaaa" + } + ], + "publicIPAddressVersion": "IPv4", + "publicIPPrefix": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + }, + "sku": { + "name": "Basic", + "tier": "Regional" + } + }, + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503" + } + } + } + ], + "networkSecurityGroup": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + "primary": true + } + } + ] + }, + "osProfile": { + "adminUsername": "Foo12", + "allowExtensionOperations": true, + "computerName": "test000000", + "customData": "aaaa", + "linuxConfiguration": { + "disablePasswordAuthentication": true, + "patchSettings": { + "assessmentMode": "ImageDefault", + "patchMode": "ImageDefault" + }, + "provisionVMAgent": true, + "ssh": { + "publicKeys": [ + { + "path": "aaa", + "keyData": "aaaaaa" + } + ] + } + }, + "requireGuestProvisionSignal": true, + "secrets": [], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "aaaaaaaaaaaaaaaaaaaa", + "passName": "OobeSystem", + "settingName": "AutoLogon" + } + ], + "enableAutomaticUpdates": true, + "patchSettings": { + "assessmentMode": "ImageDefault", + "enableHotpatching": true, + "patchMode": "Manual" + }, + "provisionVMAgent": true, + "timeZone": "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + "winRM": { + "listeners": [ + { + "certificateUrl": "aaaaaaaaaaaaaaaaaaaaaa", + "protocol": "Http" + } + ] + } + } + }, + "protectionPolicy": { + "protectFromScaleIn": true, + "protectFromScaleSetActions": true + }, + "provisioningState": "Succeeded", + "securityProfile": { + "encryptionAtHost": true, + "securityType": "TrustedLaunch", + "uefiSettings": { + "secureBootEnabled": true, + "vTpmEnabled": true + } + }, + "storageProfile": { + "dataDisks": [ + { + "name": "vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d", + "caching": "None", + "createOption": "Empty", + "deleteOption": "Delete", + "detachOption": "ForceDetach", + "diskIOPSReadWrite": 18, + "diskMBpsReadWrite": 29, + "diskSizeGB": 128, + "image": { + "uri": "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd" + }, + "lun": 1, + "managedDisk": { + "diskEncryptionSet": { + "id": "aaaaaaaaaaaa" + }, + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d", + "storageAccountType": "Standard_LRS" + }, + "toBeDetached": true, + "vhd": { + "uri": "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd" + }, + "writeAcceleratorEnabled": true + } + ], + "imageReference": { + "exactVersion": "4.127.20180315", + "id": "a", + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sharedGalleryImageId": "aaaaaaaaaaaaaaaaaaaa", + "sku": "2012-R2-Datacenter", + "version": "4.127.20180315" + }, + "osDisk": { + "name": "vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc", + "caching": "None", + "createOption": "FromImage", + "deleteOption": "Delete", + "diffDiskSettings": { + "option": "Local", + "placement": "CacheDisk" + }, + "diskSizeGB": 127, + "encryptionSettings": { + "diskEncryptionKey": { + "secretUrl": "aaaaaaaa", + "sourceVault": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + }, + "enabled": true, + "keyEncryptionKey": { + "keyUrl": "aaaaaaaaaaaaaa", + "sourceVault": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + } + }, + "image": { + "uri": "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd" + }, + "managedDisk": { + "diskEncryptionSet": { + "id": "aaaaaaaaaaaa" + }, + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc", + "storageAccountType": "Standard_LRS" + }, + "osType": "Windows", + "vhd": { + "uri": "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd" + }, + "writeAcceleratorEnabled": true + } + }, + "timeCreated": "2021-06-27T01:02:38.3138469+00:00", + "userData": "RXhhbXBsZSBVc2VyRGF0YQ==", + "vmId": "42af9fdf-b906-4ad7-9905-8316209ff619" + }, + "resources": [ + { + "name": "CustomScriptExtension-DSC", + "type": "Microsoft.Compute/virtualMachines/extensions", + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/extensions/CustomScriptExtension-DSC", + "location": "westus", + "properties": { + "type": "CustomScriptExtension", + "autoUpgradeMinorVersion": true, + "enableAutomaticUpgrade": true, + "forceUpdateTag": "aaaaaaa", + "instanceView": { + "name": "aaaaaaaaaaaaaaaaa", + "type": "aaaaaaaaa", + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z" + } + ], + "substatuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z" + } + ], + "typeHandlerVersion": "aaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + "protectedSettings": {}, + "provisioningState": "Succeeded", + "publisher": "Microsoft.Compute", + "settings": {}, + "suppressFailures": true, + "typeHandlerVersion": "1.9" + }, + "tags": {} + } + ], + "sku": { + "name": "Classic", + "capacity": 29, + "tier": "aaaaaaaaaaaaaa" + }, + "tags": {}, + "zones": [ + "a" + ] + } + ] + } + } + }, + "operationId": "VirtualMachineScaleSetVMs_List", + "title": "VirtualMachineScaleSetVM_List_MaximumSet_Gen" +} \ No newline at end of file diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/examples/2023-07-01/VirtualMachineScaleSetVMs_List_Virtual_Machine_Scale_Set_Vm_List_Minimum_Set_Gen.json b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/examples/2023-07-01/VirtualMachineScaleSetVMs_List_Virtual_Machine_Scale_Set_Vm_List_Minimum_Set_Gen.json new file mode 100644 index 0000000000..419d0fbf7e --- /dev/null +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/examples/2023-07-01/VirtualMachineScaleSetVMs_List_Virtual_Machine_Scale_Set_Vm_List_Minimum_Set_Gen.json @@ -0,0 +1,22 @@ +{ + "parameters": { + "api-version": "2023-07-01", + "resourceGroupName": "rgcompute", + "subscriptionId": "{subscription-id}", + "virtualMachineScaleSetName": "aaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0", + "location": "westus" + } + ] + } + } + }, + "operationId": "VirtualMachineScaleSetVMs_List", + "title": "VirtualMachineScaleSetVM_List_MinimumSet_Gen" +} \ No newline at end of file diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/models.tsp index 9f9d96673e..6e0ad9d510 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/models.tsp @@ -13,8 +13,6 @@ using Azure.ResourceManager.Foundations; namespace Microsoft.Compute; -interface Operations extends Azure.ResourceManager.Operations {} - /** * Type of repair action (replace, restart, reimage) that will be used for repairing unhealthy virtual machines in the scale set. Default value is replace. */ @@ -5562,12 +5560,6 @@ model VirtualMachineIdentity { userAssignedIdentities?: Record; } -/** - * The List Virtual Machine Scale Set VMs operation response. - */ -model VirtualMachineScaleSetVMListResult - is Azure.Core.Page; - /** * The SAS URIs of the console screenshot and serial log blobs. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/routes.tsp b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/routes.tsp index dd7b5aee43..b49549acdb 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/routes.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/routes.tsp @@ -50,44 +50,6 @@ interface VirtualMachineScaleSetsOperations { ): ArmResponse> | ErrorResponse; } -interface VirtualMachineScaleSetVMsOperations { - /** - * Gets a list of all virtual machines in a VM scale sets. - */ - @route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines") - @get - list( - ...ApiVersionParameter, - ...ResourceGroupParameter, - - /** - * The name of the VM scale set. - */ - @path - virtualMachineScaleSetName: string, - - /** - * The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'. - */ - @query("$filter") - $filter?: string, - - /** - * The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. - */ - @query("$select") - $select?: string, - - /** - * The expand expression to apply to the operation. Allowed values are 'instanceView'. - */ - @query("$expand") - $expand?: string, - - ...SubscriptionIdParameter, - ): ArmResponse | ErrorResponse; -} - interface VirtualMachinesOperations { /** * Gets all the virtual machines under the specified subscription for the specified location. diff --git a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/tspconfig.yaml index 7768960f4b..242df89076 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-compute/tsp-output/tspconfig.yaml @@ -11,4 +11,4 @@ options: arm-resource-flattening: true linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/models.tsp index 8b51364eef..24f893c043 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/models.tsp @@ -13,8 +13,6 @@ using Azure.ResourceManager.Foundations; namespace Azure.ResourceManager.MachineLearning; -interface Operations extends Azure.ResourceManager.Operations {} - /** * An enum describing the unit of usage measurement. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/tspconfig.yaml index 7768960f4b..242df89076 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-machinelearningservices/tsp-output/tspconfig.yaml @@ -11,4 +11,4 @@ options: arm-resource-flattening: true linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/swagger-output/swagger.json index c37d106404..e8dd3aa827 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/swagger-output/swagger.json @@ -40,9 +40,6 @@ } }, "tags": [ - { - "name": "Operations" - }, { "name": "DataProducts" }, @@ -54,37 +51,6 @@ } ], "paths": { - "/providers/Microsoft.NetworkAnalytics/operations": { - "get": { - "operationId": "Operations_List", - "tags": [ - "Operations" - ], - "description": "List the operations for the provider", - "parameters": [ - { - "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/OperationListResult" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkAnalytics/dataProducts": { "get": { "operationId": "DataProducts_ListBySubscription", diff --git a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/models.tsp index 5abf999b4f..77c7a6da44 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/models.tsp @@ -9,8 +9,6 @@ using Azure.ResourceManager.Foundations; namespace Microsoft.NetworkAnalytics; -interface Operations extends Azure.ResourceManager.Operations {} - /** * The status of the current operation. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/tspconfig.yaml index 95a9fd1584..9f0ba7629f 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-networkanalytics/tsp-output/tspconfig.yaml @@ -10,4 +10,4 @@ options: examples-directory: "{project-root}/examples" linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-playwrighttesting/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-playwrighttesting/swagger-output/swagger.json index 18226b7d46..f02c260ce6 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-playwrighttesting/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-playwrighttesting/swagger-output/swagger.json @@ -40,9 +40,6 @@ } }, "tags": [ - { - "name": "Operations" - }, { "name": "Accounts" }, @@ -51,37 +48,6 @@ } ], "paths": { - "/providers/Microsoft.AzurePlaywrightService/operations": { - "get": { - "operationId": "Operations_List", - "tags": [ - "Operations" - ], - "description": "List the operations for the provider", - "parameters": [ - { - "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/OperationListResult" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/accounts": { "get": { "operationId": "Accounts_ListBySubscription", diff --git a/packages/extensions/openapi-to-typespec/test/arm-playwrighttesting/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-playwrighttesting/tsp-output/models.tsp index a79263adcb..6e0dea38b0 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-playwrighttesting/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-playwrighttesting/tsp-output/models.tsp @@ -9,8 +9,6 @@ using Azure.ResourceManager.Foundations; namespace Microsoft.AzurePlaywrightService; -interface Operations extends Azure.ResourceManager.Operations {} - /** * The enablement status of a feature. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-playwrighttesting/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-playwrighttesting/tsp-output/tspconfig.yaml index 7d187dd2b1..54c015c92b 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-playwrighttesting/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-playwrighttesting/tsp-output/tspconfig.yaml @@ -10,4 +10,4 @@ options: examples-directory: "{project-root}/examples" linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/swagger-output/swagger.json index 2fcf16fd90..0fbf212acd 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/swagger-output/swagger.json @@ -40,9 +40,6 @@ } }, "tags": [ - { - "name": "Operations" - }, { "name": "TrafficControllers" }, @@ -54,37 +51,6 @@ } ], "paths": { - "/providers/Microsoft.ServiceNetworking/operations": { - "get": { - "operationId": "Operations_List", - "tags": [ - "Operations" - ], - "description": "List the operations for the provider", - "parameters": [ - { - "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/OperationListResult" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceNetworking/trafficControllers": { "get": { "operationId": "TrafficControllers_ListBySubscription", diff --git a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/models.tsp index 4785a22d9b..b8af394460 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/models.tsp @@ -9,8 +9,6 @@ using Azure.ResourceManager.Foundations; namespace Microsoft.ServiceNetworking; -interface Operations extends Azure.ResourceManager.Operations {} - union ProvisioningState { string, Provisioning: "Provisioning", diff --git a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/tspconfig.yaml index 302742877d..52b5751475 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-servicenetworking/tsp-output/tspconfig.yaml @@ -10,4 +10,4 @@ options: examples-directory: "{project-root}/examples" linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-sphere/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-sphere/swagger-output/swagger.json index 770eacf141..af3f751fee 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-sphere/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-sphere/swagger-output/swagger.json @@ -40,9 +40,6 @@ } }, "tags": [ - { - "name": "Operations" - }, { "name": "Catalogs" }, @@ -66,37 +63,6 @@ } ], "paths": { - "/providers/Microsoft.AzureSphere/operations": { - "get": { - "operationId": "Operations_List", - "tags": [ - "Operations" - ], - "description": "List the operations for the provider", - "parameters": [ - { - "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/OperationListResult" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, "/subscriptions/{subscriptionId}/providers/Microsoft.AzureSphere/catalogs": { "get": { "operationId": "Catalogs_ListBySubscription", diff --git a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/models.tsp index 745f644271..31f3821996 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/models.tsp @@ -10,8 +10,6 @@ using Azure.ResourceManager.Foundations; namespace Microsoft.AzureSphere; -interface Operations extends Azure.ResourceManager.Operations {} - /** * Provisioning state of the resource. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/tspconfig.yaml index 330cee0414..987286cde3 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-sphere/tsp-output/tspconfig.yaml @@ -10,4 +10,4 @@ options: examples-directory: "{project-root}/examples" linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-storage/swagger-output/swagger.json index 3301a6218e..e383cd113d 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/swagger-output/swagger.json @@ -40,9 +40,6 @@ } }, "tags": [ - { - "name": "Operations" - }, { "name": "StorageAccounts" }, @@ -96,37 +93,6 @@ } ], "paths": { - "/providers/Microsoft.Storage/operations": { - "get": { - "operationId": "Operations_List", - "tags": [ - "Operations" - ], - "description": "List the operations for the provider", - "parameters": [ - { - "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/OperationListResult" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability": { "post": { "operationId": "StorageAccountsOperations_CheckNameAvailability", diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/models.tsp index 6e0b162923..578d72a745 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/models.tsp @@ -13,8 +13,6 @@ using Azure.ResourceManager.Foundations; namespace Microsoft.Storage; -interface Operations extends Azure.ResourceManager.Operations {} - /** * The SKU name. Required for account creation; optional for update. Note that in older versions, SKU name was called accountType. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/tspconfig.yaml index 7768960f4b..242df89076 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-storage/tsp-output/tspconfig.yaml @@ -11,4 +11,4 @@ options: arm-resource-flattening: true linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/packages/extensions/openapi-to-typespec/test/arm-test/swagger-output/swagger.json b/packages/extensions/openapi-to-typespec/test/arm-test/swagger-output/swagger.json index 767b17e69f..66f730794a 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-test/swagger-output/swagger.json +++ b/packages/extensions/openapi-to-typespec/test/arm-test/swagger-output/swagger.json @@ -40,9 +40,6 @@ } }, "tags": [ - { - "name": "Operations" - }, { "name": "Employees" }, @@ -57,37 +54,6 @@ } ], "paths": { - "/providers/Microsoft.Test/operations": { - "get": { - "operationId": "Operations_List", - "tags": [ - "Operations" - ], - "description": "List the operations for the provider", - "parameters": [ - { - "$ref": "../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/OperationListResult" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, "/subscriptions/{subscriptionId}/providers/Microsoft.Test/employees": { "get": { "operationId": "Employees_ListBySubscription", diff --git a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/models.tsp b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/models.tsp index 1afa80c7de..d962684f3c 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/models.tsp +++ b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/models.tsp @@ -9,8 +9,6 @@ using Azure.ResourceManager.Foundations; namespace Microsoft.Test; -interface Operations extends Azure.ResourceManager.Operations {} - /** * The provisioning state of a resource. */ diff --git a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/tspconfig.yaml b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/tspconfig.yaml index 3c7a890db8..5daf53564c 100644 --- a/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/tspconfig.yaml +++ b/packages/extensions/openapi-to-typespec/test/arm-test/tsp-output/tspconfig.yaml @@ -10,4 +10,4 @@ options: examples-directory: "{project-root}/examples" linter: extends: - - "@azure-tools/typespec-azure-resource-manager/all" + - "@azure-tools/typespec-azure-rulesets/resource-manager"