From 70619d31a00a3cbe23f02003518d44f8475e4122 Mon Sep 17 00:00:00 2001 From: tadelesh Date: Mon, 29 Jul 2024 14:14:47 +0800 Subject: [PATCH 1/2] upgrade to tcgc 0.44.2 --- common/config/rush/pnpm-lock.yaml | 186 ++++++++---------- packages/typespec-go/package.json | 8 +- packages/typespec-go/src/emitter.ts | 2 +- .../typespec-go/src/tcgcadapter/adapter.ts | 4 +- packages/typespec-go/src/tcgcadapter/types.ts | 35 ++-- ...ver.go => zz_azurelargeinstance_server.go} | 110 +++++------ ...=> zz_azurelargestorageinstance_server.go} | 70 +++---- .../fake/zz_server_factory.go | 34 ++-- ...ent.go => zz_azurelargeinstance_client.go} | 138 ++++++------- ...=> zz_azurelargestorageinstance_client.go} | 96 ++++----- .../armlargeinstance/zz_client_factory.go | 12 +- .../test/armlargeinstance/zz_options.go | 44 ++--- .../test/armlargeinstance/zz_responses.go | 44 ++--- .../naminggroup/fake/zz_naming_server.go | 20 +- ...rver.go => zz_namingclientmodel_server.go} | 42 ++-- .../client/naminggroup/fakes_test.go | 8 +- .../client/naminggroup/model_client_test.go | 4 +- .../client/naminggroup/zz_naming_client.go | 6 +- ...ient.go => zz_namingclientmodel_client.go} | 40 ++-- .../client/naminggroup/zz_options.go | 20 +- .../client/naminggroup/zz_responses.go | 20 +- .../fake/zz_multipartformdata_server.go | 16 +- .../payload/multipartgroup/zz_models.go | 8 +- 23 files changed, 470 insertions(+), 497 deletions(-) rename packages/typespec-go/test/armlargeinstance/fake/{zz_azurelargeinstances_server.go => zz_azurelargeinstance_server.go} (75%) rename packages/typespec-go/test/armlargeinstance/fake/{zz_azurelargestorageinstances_server.go => zz_azurelargestorageinstance_server.go} (71%) rename packages/typespec-go/test/armlargeinstance/{zz_azurelargeinstances_client.go => zz_azurelargeinstance_client.go} (71%) rename packages/typespec-go/test/armlargeinstance/{zz_azurelargestorageinstances_client.go => zz_azurelargestorageinstance_client.go} (65%) rename packages/typespec-go/test/cadlranch/client/naminggroup/fake/{zz_namingmodel_server.go => zz_namingclientmodel_server.go} (59%) rename packages/typespec-go/test/cadlranch/client/naminggroup/{zz_namingmodel_client.go => zz_namingclientmodel_client.go} (57%) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 76c9f5890..2c71821a1 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -204,22 +204,22 @@ importers: version: 3.1.263 '@azure-tools/typespec-azure-core': specifier: '>=0.44.0 <1.0.0' - version: 0.44.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0) + version: 0.44.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0) '@azure-tools/typespec-client-generator-core': - specifier: 0.44.1 - version: 0.44.1(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) + specifier: 0.44.2 + version: 0.44.2(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) '@typespec/compiler': - specifier: 0.58.0 - version: 0.58.0 + specifier: 0.58.1 + version: 0.58.1 '@typespec/http': specifier: 0.58.0 - version: 0.58.0(@typespec/compiler@0.58.0) + version: 0.58.0(@typespec/compiler@0.58.1) '@typespec/rest': specifier: 0.58.0 - version: 0.58.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0) + version: 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) '@typespec/versioning': specifier: 0.58.0 - version: 0.58.0(@typespec/compiler@0.58.0) + version: 0.58.0(@typespec/compiler@0.58.1) js-yaml: specifier: ~4.1.0 version: 4.1.0 @@ -232,16 +232,16 @@ importers: version: 0.13.4(@typespec/versioning@0.58.0) '@azure-tools/cadl-ranch-expect': specifier: ~0.14.1 - version: 0.14.1(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) + version: 0.14.1(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) '@azure-tools/cadl-ranch-specs': specifier: 0.34.9 - version: 0.34.9(@azure-tools/cadl-ranch-expect@0.14.1)(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) + version: 0.34.9(@azure-tools/cadl-ranch-expect@0.14.1)(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) '@azure-tools/typespec-autorest': - specifier: 0.44.0 - version: 0.44.0(@azure-tools/typespec-azure-core@0.44.0)(@azure-tools/typespec-azure-resource-manager@0.44.0)(@azure-tools/typespec-client-generator-core@0.44.1)(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/openapi@0.57.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) + specifier: 0.44.1 + version: 0.44.1(@azure-tools/typespec-azure-core@0.44.0)(@azure-tools/typespec-azure-resource-manager@0.44.0)(@azure-tools/typespec-client-generator-core@0.44.2)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) '@azure-tools/typespec-azure-resource-manager': specifier: 0.44.0 - version: 0.44.0(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/openapi@0.57.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) + version: 0.44.0(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) '@types/jest': specifier: ~26.0.24 version: 26.0.24 @@ -258,8 +258,8 @@ importers: specifier: ~4.1.1 version: 4.1.1(eslint@6.6.0)(typescript@5.1.6) '@typespec/openapi': - specifier: ~0.57.0 - version: 0.57.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0) + specifier: ~0.58.0 + version: 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) eslint: specifier: ~6.6.0 version: 6.6.0 @@ -406,7 +406,7 @@ packages: - supports-color dev: true - /@azure-tools/cadl-ranch-expect@0.14.1(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): + /@azure-tools/cadl-ranch-expect@0.14.1(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): resolution: {integrity: sha512-JXvOPe0Uoz+bzciPATG1RQVrLqhBLHNwKI2lzkR/ZaB/ISPJ1vHMXLTyeGalPLtiOND1L9Q0XT0WB8qZ4OazhA==} engines: {node: '>=16.0.0'} peerDependencies: @@ -415,13 +415,13 @@ packages: '@typespec/rest': ~0.58.0 '@typespec/versioning': ~0.58.0 dependencies: - '@typespec/compiler': 0.58.0 - '@typespec/http': 0.58.0(@typespec/compiler@0.58.0) - '@typespec/rest': 0.58.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0) - '@typespec/versioning': 0.58.0(@typespec/compiler@0.58.0) + '@typespec/compiler': 0.58.1 + '@typespec/http': 0.58.0(@typespec/compiler@0.58.1) + '@typespec/rest': 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) + '@typespec/versioning': 0.58.0(@typespec/compiler@0.58.1) dev: true - /@azure-tools/cadl-ranch-specs@0.34.9(@azure-tools/cadl-ranch-expect@0.14.1)(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): + /@azure-tools/cadl-ranch-specs@0.34.9(@azure-tools/cadl-ranch-expect@0.14.1)(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): resolution: {integrity: sha512-eRW3o0xHVb62t2KELp3MSHGcSjknYFmTuGoys6ZEME3HmBXfpnfC1cIAIE+sCR+8o/oCJIpn77fpC7U4nVzstw==} engines: {node: '>=16.0.0'} peerDependencies: @@ -434,12 +434,12 @@ packages: dependencies: '@azure-tools/cadl-ranch': 0.13.4(@typespec/versioning@0.58.0) '@azure-tools/cadl-ranch-api': 0.4.4 - '@azure-tools/cadl-ranch-expect': 0.14.1(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) - '@azure-tools/typespec-azure-core': 0.44.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0) - '@typespec/compiler': 0.58.0 - '@typespec/http': 0.58.0(@typespec/compiler@0.58.0) - '@typespec/rest': 0.58.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0) - '@typespec/versioning': 0.58.0(@typespec/compiler@0.58.0) + '@azure-tools/cadl-ranch-expect': 0.14.1(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) + '@azure-tools/typespec-azure-core': 0.44.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0) + '@typespec/compiler': 0.58.1 + '@typespec/http': 0.58.0(@typespec/compiler@0.58.1) + '@typespec/rest': 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) + '@typespec/versioning': 0.58.0(@typespec/compiler@0.58.1) transitivePeerDependencies: - '@types/express' - encoding @@ -453,12 +453,12 @@ packages: dependencies: '@azure-tools/cadl-ranch-api': 0.4.4 '@azure-tools/cadl-ranch-coverage-sdk': 0.8.2 - '@azure-tools/cadl-ranch-expect': 0.14.1(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) + '@azure-tools/cadl-ranch-expect': 0.14.1(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) '@azure/identity': 4.4.0 '@types/js-yaml': 4.0.9 - '@typespec/compiler': 0.58.0 - '@typespec/http': 0.58.0(@typespec/compiler@0.58.0) - '@typespec/rest': 0.58.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0) + '@typespec/compiler': 0.58.1 + '@typespec/http': 0.58.0(@typespec/compiler@0.58.1) + '@typespec/rest': 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) ajv: 8.12.0 body-parser: 1.20.2 deep-equal: 2.2.3 @@ -516,30 +516,30 @@ packages: engines: {node: '>=10.12.0'} dev: false - /@azure-tools/typespec-autorest@0.44.0(@azure-tools/typespec-azure-core@0.44.0)(@azure-tools/typespec-azure-resource-manager@0.44.0)(@azure-tools/typespec-client-generator-core@0.44.1)(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/openapi@0.57.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): - resolution: {integrity: sha512-GlIQayA6HfKndq1T2qHBXtL6n8gTiShUEhi30zncoBaIUnwumkXSnx18uCQl0EzFmvAqLYt3kbHqQNzZIdGaeQ==} + /@azure-tools/typespec-autorest@0.44.1(@azure-tools/typespec-azure-core@0.44.0)(@azure-tools/typespec-azure-resource-manager@0.44.0)(@azure-tools/typespec-client-generator-core@0.44.2)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): + resolution: {integrity: sha512-lw/iM659GuFgckDeRFFu0vx6wGBy814n+mjzbpi0Qwjvj8/hYULSjpty9P4WBDE30rYCUde1pWX5nK6TnwhOkQ==} engines: {node: '>=18.0.0'} peerDependencies: '@azure-tools/typespec-azure-core': ~0.44.0 '@azure-tools/typespec-azure-resource-manager': ~0.44.0 - '@azure-tools/typespec-client-generator-core': ~0.44.0 + '@azure-tools/typespec-client-generator-core': ~0.44.2 '@typespec/compiler': ~0.58.0 '@typespec/http': ~0.58.0 '@typespec/openapi': ~0.58.0 '@typespec/rest': ~0.58.0 '@typespec/versioning': ~0.58.0 dependencies: - '@azure-tools/typespec-azure-core': 0.44.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0) - '@azure-tools/typespec-azure-resource-manager': 0.44.0(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/openapi@0.57.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) - '@azure-tools/typespec-client-generator-core': 0.44.1(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) - '@typespec/compiler': 0.58.0 - '@typespec/http': 0.58.0(@typespec/compiler@0.58.0) - '@typespec/openapi': 0.57.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0) - '@typespec/rest': 0.58.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0) - '@typespec/versioning': 0.58.0(@typespec/compiler@0.58.0) + '@azure-tools/typespec-azure-core': 0.44.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0) + '@azure-tools/typespec-azure-resource-manager': 0.44.0(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) + '@azure-tools/typespec-client-generator-core': 0.44.2(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) + '@typespec/compiler': 0.58.1 + '@typespec/http': 0.58.0(@typespec/compiler@0.58.1) + '@typespec/openapi': 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) + '@typespec/rest': 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) + '@typespec/versioning': 0.58.0(@typespec/compiler@0.58.1) dev: true - /@azure-tools/typespec-azure-core@0.44.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0): + /@azure-tools/typespec-azure-core@0.44.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0): resolution: {integrity: sha512-d11QK2v5fOZH8YUqf42FsqHEirKCHzeKFq4Uo/51BXCXmJJahsTaFMAG2M0GoJe8tmTHeMijStnVMfzcGNqCAA==} engines: {node: '>=18.0.0'} peerDependencies: @@ -547,11 +547,11 @@ packages: '@typespec/http': ~0.58.0 '@typespec/rest': ~0.58.0 dependencies: - '@typespec/compiler': 0.58.0 - '@typespec/http': 0.58.0(@typespec/compiler@0.58.0) - '@typespec/rest': 0.58.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0) + '@typespec/compiler': 0.58.1 + '@typespec/http': 0.58.0(@typespec/compiler@0.58.1) + '@typespec/rest': 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) - /@azure-tools/typespec-azure-resource-manager@0.44.0(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/openapi@0.57.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): + /@azure-tools/typespec-azure-resource-manager@0.44.0(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): resolution: {integrity: sha512-m4dG41at6En1swbxlvCDl1v4Mvrfp17acDnRxEcd4SdKP2R9eVS2mBy1tSuFtMcJlOnoBZ5CxQgk+Osg/Q9nmA==} engines: {node: '>=18.0.0'} peerDependencies: @@ -562,31 +562,33 @@ packages: '@typespec/rest': ~0.58.0 '@typespec/versioning': ~0.58.0 dependencies: - '@azure-tools/typespec-azure-core': 0.44.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0) - '@typespec/compiler': 0.58.0 - '@typespec/http': 0.58.0(@typespec/compiler@0.58.0) - '@typespec/openapi': 0.57.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0) - '@typespec/rest': 0.58.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0) - '@typespec/versioning': 0.58.0(@typespec/compiler@0.58.0) + '@azure-tools/typespec-azure-core': 0.44.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0) + '@typespec/compiler': 0.58.1 + '@typespec/http': 0.58.0(@typespec/compiler@0.58.1) + '@typespec/openapi': 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) + '@typespec/rest': 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) + '@typespec/versioning': 0.58.0(@typespec/compiler@0.58.1) change-case: 5.4.4 pluralize: 8.0.0 dev: true - /@azure-tools/typespec-client-generator-core@0.44.1(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): - resolution: {integrity: sha512-hpDYS4J329kPnXMAndburITh81jgOloxLrv6QXJadurnFhxFHb8AycGO8VWgFYTf04cWd7yDx7HutzGSN9C7TQ==} + /@azure-tools/typespec-client-generator-core@0.44.2(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): + resolution: {integrity: sha512-eIClpMxjMYxNeyYpdnD3BfWbPiDP0e7waTvBc5V1JQmFGKvh8H9dNeO4IaBqJ/O7WSDtuxweDmSUviZdBvuYNA==} engines: {node: '>=18.0.0'} peerDependencies: '@azure-tools/typespec-azure-core': ~0.44.0 '@typespec/compiler': ~0.58.0 '@typespec/http': ~0.58.0 + '@typespec/openapi': ~0.58.0 '@typespec/rest': ~0.58.0 '@typespec/versioning': ~0.58.0 dependencies: - '@azure-tools/typespec-azure-core': 0.44.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0)(@typespec/rest@0.58.0) - '@typespec/compiler': 0.58.0 - '@typespec/http': 0.58.0(@typespec/compiler@0.58.0) - '@typespec/rest': 0.58.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0) - '@typespec/versioning': 0.58.0(@typespec/compiler@0.58.0) + '@azure-tools/typespec-azure-core': 0.44.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0) + '@typespec/compiler': 0.58.1 + '@typespec/http': 0.58.0(@typespec/compiler@0.58.1) + '@typespec/openapi': 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) + '@typespec/rest': 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) + '@typespec/versioning': 0.58.0(@typespec/compiler@0.58.1) change-case: 5.4.4 pluralize: 8.0.0 @@ -978,7 +980,7 @@ packages: resolution: {integrity: sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==} engines: {node: '>=6.9.0'} dependencies: - '@babel/highlight': 7.24.2 + '@babel/highlight': 7.24.7 picocolors: 1.0.1 /@babel/code-frame@7.24.7: @@ -997,7 +999,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@ampproject/remapping': 2.3.0 - '@babel/code-frame': 7.24.2 + '@babel/code-frame': 7.24.7 '@babel/generator': 7.24.1 '@babel/helper-compilation-targets': 7.23.6 '@babel/helper-module-transforms': 7.23.3(@babel/core@7.24.3) @@ -1067,7 +1069,7 @@ packages: '@babel/helper-module-imports': 7.24.3 '@babel/helper-simple-access': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 - '@babel/helper-validator-identifier': 7.22.20 + '@babel/helper-validator-identifier': 7.24.7 /@babel/helper-plugin-utils@7.24.0: resolution: {integrity: sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w==} @@ -1090,10 +1092,6 @@ packages: resolution: {integrity: sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ==} engines: {node: '>=6.9.0'} - /@babel/helper-validator-identifier@7.22.20: - resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} - engines: {node: '>=6.9.0'} - /@babel/helper-validator-identifier@7.24.7: resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} engines: {node: '>=6.9.0'} @@ -1112,15 +1110,6 @@ packages: transitivePeerDependencies: - supports-color - /@babel/highlight@7.24.2: - resolution: {integrity: sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA==} - engines: {node: '>=6.9.0'} - dependencies: - '@babel/helper-validator-identifier': 7.22.20 - chalk: 2.4.2 - js-tokens: 4.0.0 - picocolors: 1.0.1 - /@babel/highlight@7.24.7: resolution: {integrity: sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==} engines: {node: '>=6.9.0'} @@ -1258,7 +1247,7 @@ packages: resolution: {integrity: sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/code-frame': 7.24.2 + '@babel/code-frame': 7.24.7 '@babel/parser': 7.24.1 '@babel/types': 7.24.0 @@ -1266,7 +1255,7 @@ packages: resolution: {integrity: sha512-xuU6o9m68KeqZbQuDt2TcKSxUw/mrsvavlEqQ1leZ/B+C9tk6E4sRWy97WaXgvq5E+nU3cXMxv3WKOCanVMCmQ==} engines: {node: '>=6.9.0'} dependencies: - '@babel/code-frame': 7.24.2 + '@babel/code-frame': 7.24.7 '@babel/generator': 7.24.1 '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-function-name': 7.23.0 @@ -1284,7 +1273,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/helper-string-parser': 7.24.1 - '@babel/helper-validator-identifier': 7.22.20 + '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 /@bcoe/v8-coverage@0.2.3: @@ -2011,7 +2000,7 @@ packages: globby: 11.1.0 is-glob: 4.0.3 lodash: 4.17.21 - semver: 7.6.0 + semver: 7.6.2 tsutils: 3.21.0(typescript@5.1.6) typescript: 5.1.6 transitivePeerDependencies: @@ -2026,8 +2015,8 @@ packages: eslint-visitor-keys: 2.1.0 dev: true - /@typespec/compiler@0.58.0: - resolution: {integrity: sha512-kyyXwjy9mLwOTYZyXbfPzGr2dpRwj2DASvUAKxax/BVKFLVxTfecIZKwWCLB42RxgraqYx2/t4RhviH+QbEtqA==} + /@typespec/compiler@0.58.1: + resolution: {integrity: sha512-bVxxM35r40OtuL4+/9W/g1EevlnWnW6i151nsZAFOJj1xWHoE2G9zkx5/Feic8OlzArjhGGLJOLH3Ez1Wrw35A==} engines: {node: '>=18.0.0'} hasBin: true dependencies: @@ -2046,42 +2035,41 @@ packages: yaml: 2.4.5 yargs: 17.7.2 - /@typespec/http@0.58.0(@typespec/compiler@0.58.0): + /@typespec/http@0.58.0(@typespec/compiler@0.58.1): resolution: {integrity: sha512-jQpkugg9AZVrNDMkDIgZRpIoRkkU2b0LtKWqMGg33MItYj9/DYSgDtY7xb7oCBppRtFFZ/h138HyhYl3zQxZRg==} engines: {node: '>=18.0.0'} peerDependencies: '@typespec/compiler': ~0.58.0 dependencies: - '@typespec/compiler': 0.58.0 + '@typespec/compiler': 0.58.1 - /@typespec/openapi@0.57.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0): - resolution: {integrity: sha512-35wK/BqjOXSlhWuGMwoYN3FSgIYFOKtw8ot4ErcgmxAGuKaS2GkUhZvtQJXUn2ByU0Fl4jqslPmTz8SEcz7rbw==} + /@typespec/openapi@0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0): + resolution: {integrity: sha512-gu6nXfmpfZrfq8Etpgl1dpMfsXii7EzQyhZgsPhIy7ZwV5bDmFk1/oyhTqIpWrnr4pD3r151T2BQjzJefjf15A==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.57.0 - '@typespec/http': ~0.57.0 + '@typespec/compiler': ~0.58.0 + '@typespec/http': ~0.58.0 dependencies: - '@typespec/compiler': 0.58.0 - '@typespec/http': 0.58.0(@typespec/compiler@0.58.0) - dev: true + '@typespec/compiler': 0.58.1 + '@typespec/http': 0.58.0(@typespec/compiler@0.58.1) - /@typespec/rest@0.58.0(@typespec/compiler@0.58.0)(@typespec/http@0.58.0): + /@typespec/rest@0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0): resolution: {integrity: sha512-QBxkED0/KQKG22pwzis0n7BY+uLMSZZPSoVe/ESBFika9n5/yyeQ0l58xbFFwwfxAxe4xwuZ5PNwTdEXZbzr5g==} engines: {node: '>=18.0.0'} peerDependencies: '@typespec/compiler': ~0.58.0 '@typespec/http': ~0.58.0 dependencies: - '@typespec/compiler': 0.58.0 - '@typespec/http': 0.58.0(@typespec/compiler@0.58.0) + '@typespec/compiler': 0.58.1 + '@typespec/http': 0.58.0(@typespec/compiler@0.58.1) - /@typespec/versioning@0.58.0(@typespec/compiler@0.58.0): + /@typespec/versioning@0.58.0(@typespec/compiler@0.58.1): resolution: {integrity: sha512-brnQQ3wKWh4AbgqmnVLj+8zyOaDk9VPWg4QBecdQxzz7PrSrlAzIzRfeIyr67+hwi/0SvkTAB6GNH7YYTypKGA==} engines: {node: '>=18.0.0'} peerDependencies: '@typespec/compiler': ~0.58.0 dependencies: - '@typespec/compiler': 0.58.0 + '@typespec/compiler': 0.58.1 /a-sync-waterfall@1.0.1: resolution: {integrity: sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA==} @@ -2489,7 +2477,7 @@ packages: engines: {node: '>=6'} deprecated: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates. dependencies: - '@babel/code-frame': 7.24.2 + '@babel/code-frame': 7.24.7 '@babel/parser': 7.24.1 '@babel/traverse': 7.24.1 '@babel/types': 7.24.0 @@ -5400,7 +5388,7 @@ packages: resolution: {integrity: sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: - '@babel/code-frame': 7.24.2 + '@babel/code-frame': 7.24.7 '@jest/types': 27.5.1 '@types/stack-utils': 2.0.3 chalk: 4.1.2 @@ -6831,7 +6819,7 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} dependencies: - '@babel/code-frame': 7.24.2 + '@babel/code-frame': 7.24.7 error-ex: 1.3.2 json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 diff --git a/packages/typespec-go/package.json b/packages/typespec-go/package.json index 35bb9de02..9dc52a810 100644 --- a/packages/typespec-go/package.json +++ b/packages/typespec-go/package.json @@ -49,13 +49,13 @@ "@azure-tools/cadl-ranch": "~0.13.4", "@azure-tools/cadl-ranch-expect": "~0.14.1", "@azure-tools/cadl-ranch-specs": "0.34.9", - "@azure-tools/typespec-autorest": "0.44.0", + "@azure-tools/typespec-autorest": "0.44.1", "@azure-tools/typespec-azure-resource-manager": "0.44.0", "@types/js-yaml": "~4.0.6", "@types/node": "^18.16.3", "@typescript-eslint/eslint-plugin": "~4.1.1", "@typescript-eslint/parser": "~4.1.1", - "@typespec/openapi": "~0.57.0", + "@typespec/openapi": "~0.58.0", "@types/jest": "~26.0.24", "eslint": "~6.6.0", "jest": "~27.0.6", @@ -66,8 +66,8 @@ "@azure-tools/codegen": "~2.9.2", "@azure-tools/linq": "~3.1.0", "@azure-tools/typespec-azure-core": ">=0.44.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": "0.44.1", - "@typespec/compiler": "0.58.0", + "@azure-tools/typespec-client-generator-core": "0.44.2", + "@typespec/compiler": "0.58.1", "@typespec/http": "0.58.0", "@typespec/rest": "0.58.0", "@typespec/versioning": "0.58.0", diff --git a/packages/typespec-go/src/emitter.ts b/packages/typespec-go/src/emitter.ts index 1ef34cab5..cc8b50ea0 100644 --- a/packages/typespec-go/src/emitter.ts +++ b/packages/typespec-go/src/emitter.ts @@ -23,7 +23,7 @@ import { EmitContext } from '@typespec/compiler'; import 'source-map-support/register.js'; export async function $onEmit(context: EmitContext) { - const codeModel = tcgcToGoCodeModel(context); + const codeModel = await tcgcToGoCodeModel(context); await mkdir(context.emitterOutputDir, {recursive: true}); // don't overwrite an existing go.mod file, update it if required diff --git a/packages/typespec-go/src/tcgcadapter/adapter.ts b/packages/typespec-go/src/tcgcadapter/adapter.ts index 6ad7c5acb..65cca271d 100644 --- a/packages/typespec-go/src/tcgcadapter/adapter.ts +++ b/packages/typespec-go/src/tcgcadapter/adapter.ts @@ -15,14 +15,14 @@ const headerText = `Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See License.txt in the project root for license information. Code generated by Microsoft (R) Go Code Generator.`; -export function tcgcToGoCodeModel(context: EmitContext): go.CodeModel { +export async function tcgcToGoCodeModel(context: EmitContext): Promise { const info = new go.Info('TODO Title'); const options = new go.Options(headerText, context.options['generate-fakes'] === true, context.options['inject-spans'] === true, context.options['disallow-unknown-fields'] === true); if (context.options['azcore-version']) { options.azcoreVersion = context.options['azcore-version']; } - const sdkContext = tcgc.createSdkContext(context); + const sdkContext = await tcgc.createSdkContext(context); let codeModelType: go.CodeModelType = 'data-plane'; if (sdkContext.arm === true) { codeModelType = 'azure-arm'; diff --git a/packages/typespec-go/src/tcgcadapter/types.ts b/packages/typespec-go/src/tcgcadapter/types.ts index c987b57b8..f8abad5f5 100644 --- a/packages/typespec-go/src/tcgcadapter/types.ts +++ b/packages/typespec-go/src/tcgcadapter/types.ts @@ -152,17 +152,13 @@ export class typeAdapter { getPossibleType(type: tcgc.SdkType, elementTypeByValue: boolean, substituteDiscriminator: boolean): go.PossibleType { switch (type.kind) { case 'any': - case 'armId': - case 'azureLocation': case 'boolean': case 'bytes': case 'decimal': case 'decimal128': - case 'eTag': case 'float': case 'float32': case 'float64': - case 'guid': case 'int8': case 'int16': case 'int32': @@ -174,9 +170,7 @@ export class typeAdapter { case 'plainDate': case 'plainTime': case 'string': - case 'uri': case 'url': - case 'uuid': return this.getBuiltInType(type); case 'array': { let elementType = type.valueType; @@ -352,16 +346,6 @@ export class typeAdapter { this.types.set(decimalKey, decimalType); return decimalType; } - case 'eTag': { - const etagKey = 'etag'; - let etag = this.types.get(etagKey); - if (etag) { - return etag; - } - etag = new go.QualifiedType('ETag', 'github.com/Azure/azure-sdk-for-go/sdk/azcore'); - this.types.set(etagKey, etag); - return etag; - } case 'float': // C# and Java define float as 32 bits so we're following suit case 'float32': { const float32Key = 'float32'; @@ -400,13 +384,19 @@ export class typeAdapter { this.types.set(keyName, intType); return intType; } - case 'armId': - case 'azureLocation': - case 'guid': case 'string': - case 'uuid': - case 'uri': case 'url': { + if (type.crossLanguageDefinitionId === 'Azure.Core.eTag') { + const etagKey = 'etag'; + let etag = this.types.get(etagKey); + if (etag) { + return etag; + } + etag = new go.QualifiedType('ETag', 'github.com/Azure/azure-sdk-for-go/sdk/azcore'); + this.types.set(etagKey, etag); + return etag; + } + const stringKey = 'string'; let stringType = this.types.get(stringKey); if (stringType) { @@ -734,9 +724,6 @@ export class typeAdapter { return literalFloat; } case 'string': - case 'guid': - case 'uuid': - case 'uri': case 'url': { const keyName = `literal-string-${constType.value}`; let literalString = this.types.get(keyName); diff --git a/packages/typespec-go/test/armlargeinstance/fake/zz_azurelargeinstances_server.go b/packages/typespec-go/test/armlargeinstance/fake/zz_azurelargeinstance_server.go similarity index 75% rename from packages/typespec-go/test/armlargeinstance/fake/zz_azurelargeinstances_server.go rename to packages/typespec-go/test/armlargeinstance/fake/zz_azurelargeinstance_server.go index dc0fde0e5..a705da3a3 100644 --- a/packages/typespec-go/test/armlargeinstance/fake/zz_azurelargeinstances_server.go +++ b/packages/typespec-go/test/armlargeinstance/fake/zz_azurelargeinstance_server.go @@ -19,64 +19,64 @@ import ( "regexp" ) -// AzureLargeInstancesServer is a fake server for instances of the armlargeinstance.AzureLargeInstancesClient type. -type AzureLargeInstancesServer struct { - // Get is the fake for method AzureLargeInstancesClient.Get +// AzureLargeInstanceServer is a fake server for instances of the armlargeinstance.AzureLargeInstanceClient type. +type AzureLargeInstanceServer struct { + // Get is the fake for method AzureLargeInstanceClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *armlargeinstance.AzureLargeInstancesClientGetOptions) (resp azfake.Responder[armlargeinstance.AzureLargeInstancesClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *armlargeinstance.AzureLargeInstanceClientGetOptions) (resp azfake.Responder[armlargeinstance.AzureLargeInstanceClientGetResponse], errResp azfake.ErrorResponder) - // NewListByResourceGroupPager is the fake for method AzureLargeInstancesClient.NewListByResourceGroupPager + // NewListByResourceGroupPager is the fake for method AzureLargeInstanceClient.NewListByResourceGroupPager // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armlargeinstance.AzureLargeInstancesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armlargeinstance.AzureLargeInstancesClientListByResourceGroupResponse]) + NewListByResourceGroupPager func(resourceGroupName string, options *armlargeinstance.AzureLargeInstanceClientListByResourceGroupOptions) (resp azfake.PagerResponder[armlargeinstance.AzureLargeInstanceClientListByResourceGroupResponse]) - // NewListBySubscriptionPager is the fake for method AzureLargeInstancesClient.NewListBySubscriptionPager + // NewListBySubscriptionPager is the fake for method AzureLargeInstanceClient.NewListBySubscriptionPager // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armlargeinstance.AzureLargeInstancesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armlargeinstance.AzureLargeInstancesClientListBySubscriptionResponse]) + NewListBySubscriptionPager func(options *armlargeinstance.AzureLargeInstanceClientListBySubscriptionOptions) (resp azfake.PagerResponder[armlargeinstance.AzureLargeInstanceClientListBySubscriptionResponse]) - // BeginRestart is the fake for method AzureLargeInstancesClient.BeginRestart + // BeginRestart is the fake for method AzureLargeInstanceClient.BeginRestart // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginRestart func(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *armlargeinstance.AzureLargeInstancesClientBeginRestartOptions) (resp azfake.PollerResponder[armlargeinstance.AzureLargeInstancesClientRestartResponse], errResp azfake.ErrorResponder) + BeginRestart func(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *armlargeinstance.AzureLargeInstanceClientBeginRestartOptions) (resp azfake.PollerResponder[armlargeinstance.AzureLargeInstanceClientRestartResponse], errResp azfake.ErrorResponder) - // BeginShutdown is the fake for method AzureLargeInstancesClient.BeginShutdown + // BeginShutdown is the fake for method AzureLargeInstanceClient.BeginShutdown // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginShutdown func(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *armlargeinstance.AzureLargeInstancesClientBeginShutdownOptions) (resp azfake.PollerResponder[armlargeinstance.AzureLargeInstancesClientShutdownResponse], errResp azfake.ErrorResponder) + BeginShutdown func(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *armlargeinstance.AzureLargeInstanceClientBeginShutdownOptions) (resp azfake.PollerResponder[armlargeinstance.AzureLargeInstanceClientShutdownResponse], errResp azfake.ErrorResponder) - // BeginStart is the fake for method AzureLargeInstancesClient.BeginStart + // BeginStart is the fake for method AzureLargeInstanceClient.BeginStart // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginStart func(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *armlargeinstance.AzureLargeInstancesClientBeginStartOptions) (resp azfake.PollerResponder[armlargeinstance.AzureLargeInstancesClientStartResponse], errResp azfake.ErrorResponder) + BeginStart func(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *armlargeinstance.AzureLargeInstanceClientBeginStartOptions) (resp azfake.PollerResponder[armlargeinstance.AzureLargeInstanceClientStartResponse], errResp azfake.ErrorResponder) - // Update is the fake for method AzureLargeInstancesClient.Update + // Update is the fake for method AzureLargeInstanceClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, properties armlargeinstance.TagsUpdate, options *armlargeinstance.AzureLargeInstancesClientUpdateOptions) (resp azfake.Responder[armlargeinstance.AzureLargeInstancesClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, properties armlargeinstance.TagsUpdate, options *armlargeinstance.AzureLargeInstanceClientUpdateOptions) (resp azfake.Responder[armlargeinstance.AzureLargeInstanceClientUpdateResponse], errResp azfake.ErrorResponder) } -// NewAzureLargeInstancesServerTransport creates a new instance of AzureLargeInstancesServerTransport with the provided implementation. -// The returned AzureLargeInstancesServerTransport instance is connected to an instance of armlargeinstance.AzureLargeInstancesClient via the +// NewAzureLargeInstanceServerTransport creates a new instance of AzureLargeInstanceServerTransport with the provided implementation. +// The returned AzureLargeInstanceServerTransport instance is connected to an instance of armlargeinstance.AzureLargeInstanceClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAzureLargeInstancesServerTransport(srv *AzureLargeInstancesServer) *AzureLargeInstancesServerTransport { - return &AzureLargeInstancesServerTransport{ +func NewAzureLargeInstanceServerTransport(srv *AzureLargeInstanceServer) *AzureLargeInstanceServerTransport { + return &AzureLargeInstanceServerTransport{ srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armlargeinstance.AzureLargeInstancesClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armlargeinstance.AzureLargeInstancesClientListBySubscriptionResponse]](), - beginRestart: newTracker[azfake.PollerResponder[armlargeinstance.AzureLargeInstancesClientRestartResponse]](), - beginShutdown: newTracker[azfake.PollerResponder[armlargeinstance.AzureLargeInstancesClientShutdownResponse]](), - beginStart: newTracker[azfake.PollerResponder[armlargeinstance.AzureLargeInstancesClientStartResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armlargeinstance.AzureLargeInstanceClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armlargeinstance.AzureLargeInstanceClientListBySubscriptionResponse]](), + beginRestart: newTracker[azfake.PollerResponder[armlargeinstance.AzureLargeInstanceClientRestartResponse]](), + beginShutdown: newTracker[azfake.PollerResponder[armlargeinstance.AzureLargeInstanceClientShutdownResponse]](), + beginStart: newTracker[azfake.PollerResponder[armlargeinstance.AzureLargeInstanceClientStartResponse]](), } } -// AzureLargeInstancesServerTransport connects instances of armlargeinstance.AzureLargeInstancesClient to instances of AzureLargeInstancesServer. -// Don't use this type directly, use NewAzureLargeInstancesServerTransport instead. -type AzureLargeInstancesServerTransport struct { - srv *AzureLargeInstancesServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armlargeinstance.AzureLargeInstancesClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armlargeinstance.AzureLargeInstancesClientListBySubscriptionResponse]] - beginRestart *tracker[azfake.PollerResponder[armlargeinstance.AzureLargeInstancesClientRestartResponse]] - beginShutdown *tracker[azfake.PollerResponder[armlargeinstance.AzureLargeInstancesClientShutdownResponse]] - beginStart *tracker[azfake.PollerResponder[armlargeinstance.AzureLargeInstancesClientStartResponse]] +// AzureLargeInstanceServerTransport connects instances of armlargeinstance.AzureLargeInstanceClient to instances of AzureLargeInstanceServer. +// Don't use this type directly, use NewAzureLargeInstanceServerTransport instead. +type AzureLargeInstanceServerTransport struct { + srv *AzureLargeInstanceServer + newListByResourceGroupPager *tracker[azfake.PagerResponder[armlargeinstance.AzureLargeInstanceClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armlargeinstance.AzureLargeInstanceClientListBySubscriptionResponse]] + beginRestart *tracker[azfake.PollerResponder[armlargeinstance.AzureLargeInstanceClientRestartResponse]] + beginShutdown *tracker[azfake.PollerResponder[armlargeinstance.AzureLargeInstanceClientShutdownResponse]] + beginStart *tracker[azfake.PollerResponder[armlargeinstance.AzureLargeInstanceClientStartResponse]] } -// Do implements the policy.Transporter interface for AzureLargeInstancesServerTransport. -func (a *AzureLargeInstancesServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for AzureLargeInstanceServerTransport. +func (a *AzureLargeInstanceServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { @@ -86,24 +86,24 @@ func (a *AzureLargeInstancesServerTransport) Do(req *http.Request) (*http.Respon return a.dispatchToMethodFake(req, method) } -func (a *AzureLargeInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { +func (a *AzureLargeInstanceServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { var resp *http.Response var err error switch method { - case "AzureLargeInstancesClient.Get": + case "AzureLargeInstanceClient.Get": resp, err = a.dispatchGet(req) - case "AzureLargeInstancesClient.NewListByResourceGroupPager": + case "AzureLargeInstanceClient.NewListByResourceGroupPager": resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AzureLargeInstancesClient.NewListBySubscriptionPager": + case "AzureLargeInstanceClient.NewListBySubscriptionPager": resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AzureLargeInstancesClient.BeginRestart": + case "AzureLargeInstanceClient.BeginRestart": resp, err = a.dispatchBeginRestart(req) - case "AzureLargeInstancesClient.BeginShutdown": + case "AzureLargeInstanceClient.BeginShutdown": resp, err = a.dispatchBeginShutdown(req) - case "AzureLargeInstancesClient.BeginStart": + case "AzureLargeInstanceClient.BeginStart": resp, err = a.dispatchBeginStart(req) - case "AzureLargeInstancesClient.Update": + case "AzureLargeInstanceClient.Update": resp, err = a.dispatchUpdate(req) default: err = fmt.Errorf("unhandled API %s", method) @@ -112,7 +112,7 @@ func (a *AzureLargeInstancesServerTransport) dispatchToMethodFake(req *http.Requ return resp, err } -func (a *AzureLargeInstancesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { +func (a *AzureLargeInstanceServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if a.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } @@ -145,7 +145,7 @@ func (a *AzureLargeInstancesServerTransport) dispatchGet(req *http.Request) (*ht return resp, nil } -func (a *AzureLargeInstancesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { +func (a *AzureLargeInstanceServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { if a.srv.NewListByResourceGroupPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} } @@ -164,7 +164,7 @@ func (a *AzureLargeInstancesServerTransport) dispatchNewListByResourceGroupPager resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) newListByResourceGroupPager = &resp a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armlargeinstance.AzureLargeInstancesClientListByResourceGroupResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armlargeinstance.AzureLargeInstanceClientListByResourceGroupResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -182,7 +182,7 @@ func (a *AzureLargeInstancesServerTransport) dispatchNewListByResourceGroupPager return resp, nil } -func (a *AzureLargeInstancesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { +func (a *AzureLargeInstanceServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { if a.srv.NewListBySubscriptionPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} } @@ -197,7 +197,7 @@ func (a *AzureLargeInstancesServerTransport) dispatchNewListBySubscriptionPager( resp := a.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armlargeinstance.AzureLargeInstancesClientListBySubscriptionResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armlargeinstance.AzureLargeInstanceClientListBySubscriptionResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -215,7 +215,7 @@ func (a *AzureLargeInstancesServerTransport) dispatchNewListBySubscriptionPager( return resp, nil } -func (a *AzureLargeInstancesServerTransport) dispatchBeginRestart(req *http.Request) (*http.Response, error) { +func (a *AzureLargeInstanceServerTransport) dispatchBeginRestart(req *http.Request) (*http.Response, error) { if a.srv.BeginRestart == nil { return nil, &nonRetriableError{errors.New("fake for method BeginRestart not implemented")} } @@ -239,9 +239,9 @@ func (a *AzureLargeInstancesServerTransport) dispatchBeginRestart(req *http.Requ if err != nil { return nil, err } - var options *armlargeinstance.AzureLargeInstancesClientBeginRestartOptions + var options *armlargeinstance.AzureLargeInstanceClientBeginRestartOptions if !reflect.ValueOf(body).IsZero() { - options = &armlargeinstance.AzureLargeInstancesClientBeginRestartOptions{ + options = &armlargeinstance.AzureLargeInstanceClientBeginRestartOptions{ ForceParameter: &body, } } @@ -269,7 +269,7 @@ func (a *AzureLargeInstancesServerTransport) dispatchBeginRestart(req *http.Requ return resp, nil } -func (a *AzureLargeInstancesServerTransport) dispatchBeginShutdown(req *http.Request) (*http.Response, error) { +func (a *AzureLargeInstanceServerTransport) dispatchBeginShutdown(req *http.Request) (*http.Response, error) { if a.srv.BeginShutdown == nil { return nil, &nonRetriableError{errors.New("fake for method BeginShutdown not implemented")} } @@ -313,7 +313,7 @@ func (a *AzureLargeInstancesServerTransport) dispatchBeginShutdown(req *http.Req return resp, nil } -func (a *AzureLargeInstancesServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { +func (a *AzureLargeInstanceServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { if a.srv.BeginStart == nil { return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} } @@ -357,7 +357,7 @@ func (a *AzureLargeInstancesServerTransport) dispatchBeginStart(req *http.Reques return resp, nil } -func (a *AzureLargeInstancesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { +func (a *AzureLargeInstanceServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { if a.srv.Update == nil { return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} } diff --git a/packages/typespec-go/test/armlargeinstance/fake/zz_azurelargestorageinstances_server.go b/packages/typespec-go/test/armlargeinstance/fake/zz_azurelargestorageinstance_server.go similarity index 71% rename from packages/typespec-go/test/armlargeinstance/fake/zz_azurelargestorageinstances_server.go rename to packages/typespec-go/test/armlargeinstance/fake/zz_azurelargestorageinstance_server.go index 09f141338..d1be64f3c 100644 --- a/packages/typespec-go/test/armlargeinstance/fake/zz_azurelargestorageinstances_server.go +++ b/packages/typespec-go/test/armlargeinstance/fake/zz_azurelargestorageinstance_server.go @@ -18,46 +18,46 @@ import ( "regexp" ) -// AzureLargeStorageInstancesServer is a fake server for instances of the armlargeinstance.AzureLargeStorageInstancesClient type. -type AzureLargeStorageInstancesServer struct { - // Get is the fake for method AzureLargeStorageInstancesClient.Get +// AzureLargeStorageInstanceServer is a fake server for instances of the armlargeinstance.AzureLargeStorageInstanceClient type. +type AzureLargeStorageInstanceServer struct { + // Get is the fake for method AzureLargeStorageInstanceClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, options *armlargeinstance.AzureLargeStorageInstancesClientGetOptions) (resp azfake.Responder[armlargeinstance.AzureLargeStorageInstancesClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, options *armlargeinstance.AzureLargeStorageInstanceClientGetOptions) (resp azfake.Responder[armlargeinstance.AzureLargeStorageInstanceClientGetResponse], errResp azfake.ErrorResponder) - // NewListByResourceGroupPager is the fake for method AzureLargeStorageInstancesClient.NewListByResourceGroupPager + // NewListByResourceGroupPager is the fake for method AzureLargeStorageInstanceClient.NewListByResourceGroupPager // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armlargeinstance.AzureLargeStorageInstancesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armlargeinstance.AzureLargeStorageInstancesClientListByResourceGroupResponse]) + NewListByResourceGroupPager func(resourceGroupName string, options *armlargeinstance.AzureLargeStorageInstanceClientListByResourceGroupOptions) (resp azfake.PagerResponder[armlargeinstance.AzureLargeStorageInstanceClientListByResourceGroupResponse]) - // NewListBySubscriptionPager is the fake for method AzureLargeStorageInstancesClient.NewListBySubscriptionPager + // NewListBySubscriptionPager is the fake for method AzureLargeStorageInstanceClient.NewListBySubscriptionPager // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armlargeinstance.AzureLargeStorageInstancesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armlargeinstance.AzureLargeStorageInstancesClientListBySubscriptionResponse]) + NewListBySubscriptionPager func(options *armlargeinstance.AzureLargeStorageInstanceClientListBySubscriptionOptions) (resp azfake.PagerResponder[armlargeinstance.AzureLargeStorageInstanceClientListBySubscriptionResponse]) - // Update is the fake for method AzureLargeStorageInstancesClient.Update + // Update is the fake for method AzureLargeStorageInstanceClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, properties armlargeinstance.AzureLargeStorageInstanceTagsUpdate, options *armlargeinstance.AzureLargeStorageInstancesClientUpdateOptions) (resp azfake.Responder[armlargeinstance.AzureLargeStorageInstancesClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, properties armlargeinstance.AzureLargeStorageInstanceTagsUpdate, options *armlargeinstance.AzureLargeStorageInstanceClientUpdateOptions) (resp azfake.Responder[armlargeinstance.AzureLargeStorageInstanceClientUpdateResponse], errResp azfake.ErrorResponder) } -// NewAzureLargeStorageInstancesServerTransport creates a new instance of AzureLargeStorageInstancesServerTransport with the provided implementation. -// The returned AzureLargeStorageInstancesServerTransport instance is connected to an instance of armlargeinstance.AzureLargeStorageInstancesClient via the +// NewAzureLargeStorageInstanceServerTransport creates a new instance of AzureLargeStorageInstanceServerTransport with the provided implementation. +// The returned AzureLargeStorageInstanceServerTransport instance is connected to an instance of armlargeinstance.AzureLargeStorageInstanceClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAzureLargeStorageInstancesServerTransport(srv *AzureLargeStorageInstancesServer) *AzureLargeStorageInstancesServerTransport { - return &AzureLargeStorageInstancesServerTransport{ +func NewAzureLargeStorageInstanceServerTransport(srv *AzureLargeStorageInstanceServer) *AzureLargeStorageInstanceServerTransport { + return &AzureLargeStorageInstanceServerTransport{ srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armlargeinstance.AzureLargeStorageInstancesClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armlargeinstance.AzureLargeStorageInstancesClientListBySubscriptionResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armlargeinstance.AzureLargeStorageInstanceClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armlargeinstance.AzureLargeStorageInstanceClientListBySubscriptionResponse]](), } } -// AzureLargeStorageInstancesServerTransport connects instances of armlargeinstance.AzureLargeStorageInstancesClient to instances of AzureLargeStorageInstancesServer. -// Don't use this type directly, use NewAzureLargeStorageInstancesServerTransport instead. -type AzureLargeStorageInstancesServerTransport struct { - srv *AzureLargeStorageInstancesServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armlargeinstance.AzureLargeStorageInstancesClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armlargeinstance.AzureLargeStorageInstancesClientListBySubscriptionResponse]] +// AzureLargeStorageInstanceServerTransport connects instances of armlargeinstance.AzureLargeStorageInstanceClient to instances of AzureLargeStorageInstanceServer. +// Don't use this type directly, use NewAzureLargeStorageInstanceServerTransport instead. +type AzureLargeStorageInstanceServerTransport struct { + srv *AzureLargeStorageInstanceServer + newListByResourceGroupPager *tracker[azfake.PagerResponder[armlargeinstance.AzureLargeStorageInstanceClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armlargeinstance.AzureLargeStorageInstanceClientListBySubscriptionResponse]] } -// Do implements the policy.Transporter interface for AzureLargeStorageInstancesServerTransport. -func (a *AzureLargeStorageInstancesServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for AzureLargeStorageInstanceServerTransport. +func (a *AzureLargeStorageInstanceServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { @@ -67,18 +67,18 @@ func (a *AzureLargeStorageInstancesServerTransport) Do(req *http.Request) (*http return a.dispatchToMethodFake(req, method) } -func (a *AzureLargeStorageInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { +func (a *AzureLargeStorageInstanceServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { var resp *http.Response var err error switch method { - case "AzureLargeStorageInstancesClient.Get": + case "AzureLargeStorageInstanceClient.Get": resp, err = a.dispatchGet(req) - case "AzureLargeStorageInstancesClient.NewListByResourceGroupPager": + case "AzureLargeStorageInstanceClient.NewListByResourceGroupPager": resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AzureLargeStorageInstancesClient.NewListBySubscriptionPager": + case "AzureLargeStorageInstanceClient.NewListBySubscriptionPager": resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AzureLargeStorageInstancesClient.Update": + case "AzureLargeStorageInstanceClient.Update": resp, err = a.dispatchUpdate(req) default: err = fmt.Errorf("unhandled API %s", method) @@ -87,7 +87,7 @@ func (a *AzureLargeStorageInstancesServerTransport) dispatchToMethodFake(req *ht return resp, err } -func (a *AzureLargeStorageInstancesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { +func (a *AzureLargeStorageInstanceServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if a.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } @@ -120,7 +120,7 @@ func (a *AzureLargeStorageInstancesServerTransport) dispatchGet(req *http.Reques return resp, nil } -func (a *AzureLargeStorageInstancesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { +func (a *AzureLargeStorageInstanceServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { if a.srv.NewListByResourceGroupPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} } @@ -139,7 +139,7 @@ func (a *AzureLargeStorageInstancesServerTransport) dispatchNewListByResourceGro resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) newListByResourceGroupPager = &resp a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armlargeinstance.AzureLargeStorageInstancesClientListByResourceGroupResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armlargeinstance.AzureLargeStorageInstanceClientListByResourceGroupResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -157,7 +157,7 @@ func (a *AzureLargeStorageInstancesServerTransport) dispatchNewListByResourceGro return resp, nil } -func (a *AzureLargeStorageInstancesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { +func (a *AzureLargeStorageInstanceServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { if a.srv.NewListBySubscriptionPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} } @@ -172,7 +172,7 @@ func (a *AzureLargeStorageInstancesServerTransport) dispatchNewListBySubscriptio resp := a.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armlargeinstance.AzureLargeStorageInstancesClientListBySubscriptionResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armlargeinstance.AzureLargeStorageInstanceClientListBySubscriptionResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -190,7 +190,7 @@ func (a *AzureLargeStorageInstancesServerTransport) dispatchNewListBySubscriptio return resp, nil } -func (a *AzureLargeStorageInstancesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { +func (a *AzureLargeStorageInstanceServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { if a.srv.Update == nil { return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} } diff --git a/packages/typespec-go/test/armlargeinstance/fake/zz_server_factory.go b/packages/typespec-go/test/armlargeinstance/fake/zz_server_factory.go index e595a33bd..bb96d534e 100644 --- a/packages/typespec-go/test/armlargeinstance/fake/zz_server_factory.go +++ b/packages/typespec-go/test/armlargeinstance/fake/zz_server_factory.go @@ -15,11 +15,11 @@ import ( // ServerFactory is a fake server for instances of the armlargeinstance.ClientFactory type. type ServerFactory struct { - // AzureLargeInstancesServer contains the fakes for client AzureLargeInstancesClient - AzureLargeInstancesServer AzureLargeInstancesServer + // AzureLargeInstanceServer contains the fakes for client AzureLargeInstanceClient + AzureLargeInstanceServer AzureLargeInstanceServer - // AzureLargeStorageInstancesServer contains the fakes for client AzureLargeStorageInstancesClient - AzureLargeStorageInstancesServer AzureLargeStorageInstancesServer + // AzureLargeStorageInstanceServer contains the fakes for client AzureLargeStorageInstanceClient + AzureLargeStorageInstanceServer AzureLargeStorageInstanceServer // OperationsServer contains the fakes for client OperationsClient OperationsServer OperationsServer @@ -37,11 +37,11 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armlargeinstance.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trAzureLargeInstancesServer *AzureLargeInstancesServerTransport - trAzureLargeStorageInstancesServer *AzureLargeStorageInstancesServerTransport - trOperationsServer *OperationsServerTransport + srv *ServerFactory + trMu sync.Mutex + trAzureLargeInstanceServer *AzureLargeInstanceServerTransport + trAzureLargeStorageInstanceServer *AzureLargeStorageInstanceServerTransport + trOperationsServer *OperationsServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -57,16 +57,16 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "AzureLargeInstancesClient": - initServer(s, &s.trAzureLargeInstancesServer, func() *AzureLargeInstancesServerTransport { - return NewAzureLargeInstancesServerTransport(&s.srv.AzureLargeInstancesServer) + case "AzureLargeInstanceClient": + initServer(s, &s.trAzureLargeInstanceServer, func() *AzureLargeInstanceServerTransport { + return NewAzureLargeInstanceServerTransport(&s.srv.AzureLargeInstanceServer) }) - resp, err = s.trAzureLargeInstancesServer.Do(req) - case "AzureLargeStorageInstancesClient": - initServer(s, &s.trAzureLargeStorageInstancesServer, func() *AzureLargeStorageInstancesServerTransport { - return NewAzureLargeStorageInstancesServerTransport(&s.srv.AzureLargeStorageInstancesServer) + resp, err = s.trAzureLargeInstanceServer.Do(req) + case "AzureLargeStorageInstanceClient": + initServer(s, &s.trAzureLargeStorageInstanceServer, func() *AzureLargeStorageInstanceServerTransport { + return NewAzureLargeStorageInstanceServerTransport(&s.srv.AzureLargeStorageInstanceServer) }) - resp, err = s.trAzureLargeStorageInstancesServer.Do(req) + resp, err = s.trAzureLargeStorageInstanceServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) diff --git a/packages/typespec-go/test/armlargeinstance/zz_azurelargeinstances_client.go b/packages/typespec-go/test/armlargeinstance/zz_azurelargeinstance_client.go similarity index 71% rename from packages/typespec-go/test/armlargeinstance/zz_azurelargeinstances_client.go rename to packages/typespec-go/test/armlargeinstance/zz_azurelargeinstance_client.go index 7d0e2767e..38dcef9da 100644 --- a/packages/typespec-go/test/armlargeinstance/zz_azurelargeinstances_client.go +++ b/packages/typespec-go/test/armlargeinstance/zz_azurelargeinstance_client.go @@ -16,23 +16,23 @@ import ( "strings" ) -// AzureLargeInstancesClient contains the methods for the AzureLargeInstances group. -// Don't use this type directly, use NewAzureLargeInstancesClient() instead. -type AzureLargeInstancesClient struct { +// AzureLargeInstanceClient contains the methods for the AzureLargeInstance group. +// Don't use this type directly, use NewAzureLargeInstanceClient() instead. +type AzureLargeInstanceClient struct { internal *arm.Client subscriptionID string } -// NewAzureLargeInstancesClient creates a new instance of AzureLargeInstancesClient with the specified values. +// NewAzureLargeInstanceClient creates a new instance of AzureLargeInstanceClient with the specified values. // - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewAzureLargeInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureLargeInstancesClient, error) { +func NewAzureLargeInstanceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureLargeInstanceClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &AzureLargeInstancesClient{ + client := &AzureLargeInstanceClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,31 +46,31 @@ func NewAzureLargeInstancesClient(subscriptionID string, credential azcore.Token // Generated from API version 2023-07-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - azureLargeInstanceName - Name of the AzureLargeInstance. -// - options - AzureLargeInstancesClientGetOptions contains the optional parameters for the AzureLargeInstancesClient.Get method. -func (client *AzureLargeInstancesClient) Get(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstancesClientGetOptions) (AzureLargeInstancesClientGetResponse, error) { +// - options - AzureLargeInstanceClientGetOptions contains the optional parameters for the AzureLargeInstanceClient.Get method. +func (client *AzureLargeInstanceClient) Get(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstanceClientGetOptions) (AzureLargeInstanceClientGetResponse, error) { var err error - const operationName = "AzureLargeInstancesClient.Get" + const operationName = "AzureLargeInstanceClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, azureLargeInstanceName, options) if err != nil { - return AzureLargeInstancesClientGetResponse{}, err + return AzureLargeInstanceClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return AzureLargeInstancesClientGetResponse{}, err + return AzureLargeInstanceClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return AzureLargeInstancesClientGetResponse{}, err + return AzureLargeInstanceClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *AzureLargeInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, _ *AzureLargeInstancesClientGetOptions) (*policy.Request, error) { +func (client *AzureLargeInstanceClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, _ *AzureLargeInstanceClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -96,10 +96,10 @@ func (client *AzureLargeInstancesClient) getCreateRequest(ctx context.Context, r } // getHandleResponse handles the Get response. -func (client *AzureLargeInstancesClient) getHandleResponse(resp *http.Response) (AzureLargeInstancesClientGetResponse, error) { - result := AzureLargeInstancesClientGetResponse{} +func (client *AzureLargeInstanceClient) getHandleResponse(resp *http.Response) (AzureLargeInstanceClientGetResponse, error) { + result := AzureLargeInstanceClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AzureLargeInstance); err != nil { - return AzureLargeInstancesClientGetResponse{}, err + return AzureLargeInstanceClientGetResponse{}, err } return result, nil } @@ -109,15 +109,15 @@ func (client *AzureLargeInstancesClient) getHandleResponse(resp *http.Response) // // Generated from API version 2023-07-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - AzureLargeInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureLargeInstancesClient.NewListByResourceGroupPager +// - options - AzureLargeInstanceClientListByResourceGroupOptions contains the optional parameters for the AzureLargeInstanceClient.NewListByResourceGroupPager // method. -func (client *AzureLargeInstancesClient) NewListByResourceGroupPager(resourceGroupName string, options *AzureLargeInstancesClientListByResourceGroupOptions) *runtime.Pager[AzureLargeInstancesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[AzureLargeInstancesClientListByResourceGroupResponse]{ - More: func(page AzureLargeInstancesClientListByResourceGroupResponse) bool { +func (client *AzureLargeInstanceClient) NewListByResourceGroupPager(resourceGroupName string, options *AzureLargeInstanceClientListByResourceGroupOptions) *runtime.Pager[AzureLargeInstanceClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureLargeInstanceClientListByResourceGroupResponse]{ + More: func(page AzureLargeInstanceClientListByResourceGroupResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *AzureLargeInstancesClientListByResourceGroupResponse) (AzureLargeInstancesClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureLargeInstancesClient.NewListByResourceGroupPager") + Fetcher: func(ctx context.Context, page *AzureLargeInstanceClientListByResourceGroupResponse) (AzureLargeInstanceClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureLargeInstanceClient.NewListByResourceGroupPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -126,7 +126,7 @@ func (client *AzureLargeInstancesClient) NewListByResourceGroupPager(resourceGro return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) }, nil) if err != nil { - return AzureLargeInstancesClientListByResourceGroupResponse{}, err + return AzureLargeInstanceClientListByResourceGroupResponse{}, err } return client.listByResourceGroupHandleResponse(resp) }, @@ -135,7 +135,7 @@ func (client *AzureLargeInstancesClient) NewListByResourceGroupPager(resourceGro } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AzureLargeInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AzureLargeInstancesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AzureLargeInstanceClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AzureLargeInstanceClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -157,10 +157,10 @@ func (client *AzureLargeInstancesClient) listByResourceGroupCreateRequest(ctx co } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *AzureLargeInstancesClient) listByResourceGroupHandleResponse(resp *http.Response) (AzureLargeInstancesClientListByResourceGroupResponse, error) { - result := AzureLargeInstancesClientListByResourceGroupResponse{} +func (client *AzureLargeInstanceClient) listByResourceGroupHandleResponse(resp *http.Response) (AzureLargeInstanceClientListByResourceGroupResponse, error) { + result := AzureLargeInstanceClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListResult); err != nil { - return AzureLargeInstancesClientListByResourceGroupResponse{}, err + return AzureLargeInstanceClientListByResourceGroupResponse{}, err } return result, nil } @@ -169,15 +169,15 @@ func (client *AzureLargeInstancesClient) listByResourceGroupHandleResponse(resp // operations returns various properties of each Azure Large Instance. // // Generated from API version 2023-07-20-preview -// - options - AzureLargeInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureLargeInstancesClient.NewListBySubscriptionPager +// - options - AzureLargeInstanceClientListBySubscriptionOptions contains the optional parameters for the AzureLargeInstanceClient.NewListBySubscriptionPager // method. -func (client *AzureLargeInstancesClient) NewListBySubscriptionPager(options *AzureLargeInstancesClientListBySubscriptionOptions) *runtime.Pager[AzureLargeInstancesClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[AzureLargeInstancesClientListBySubscriptionResponse]{ - More: func(page AzureLargeInstancesClientListBySubscriptionResponse) bool { +func (client *AzureLargeInstanceClient) NewListBySubscriptionPager(options *AzureLargeInstanceClientListBySubscriptionOptions) *runtime.Pager[AzureLargeInstanceClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureLargeInstanceClientListBySubscriptionResponse]{ + More: func(page AzureLargeInstanceClientListBySubscriptionResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *AzureLargeInstancesClientListBySubscriptionResponse) (AzureLargeInstancesClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureLargeInstancesClient.NewListBySubscriptionPager") + Fetcher: func(ctx context.Context, page *AzureLargeInstanceClientListBySubscriptionResponse) (AzureLargeInstanceClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureLargeInstanceClient.NewListBySubscriptionPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -186,7 +186,7 @@ func (client *AzureLargeInstancesClient) NewListBySubscriptionPager(options *Azu return client.listBySubscriptionCreateRequest(ctx, options) }, nil) if err != nil { - return AzureLargeInstancesClientListBySubscriptionResponse{}, err + return AzureLargeInstanceClientListBySubscriptionResponse{}, err } return client.listBySubscriptionHandleResponse(resp) }, @@ -195,7 +195,7 @@ func (client *AzureLargeInstancesClient) NewListBySubscriptionPager(options *Azu } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AzureLargeInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AzureLargeInstancesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *AzureLargeInstanceClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AzureLargeInstanceClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureLargeInstance/azureLargeInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -213,10 +213,10 @@ func (client *AzureLargeInstancesClient) listBySubscriptionCreateRequest(ctx con } // listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *AzureLargeInstancesClient) listBySubscriptionHandleResponse(resp *http.Response) (AzureLargeInstancesClientListBySubscriptionResponse, error) { - result := AzureLargeInstancesClientListBySubscriptionResponse{} +func (client *AzureLargeInstanceClient) listBySubscriptionHandleResponse(resp *http.Response) (AzureLargeInstanceClientListBySubscriptionResponse, error) { + result := AzureLargeInstanceClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ListResult); err != nil { - return AzureLargeInstancesClientListBySubscriptionResponse{}, err + return AzureLargeInstanceClientListBySubscriptionResponse{}, err } return result, nil } @@ -227,20 +227,20 @@ func (client *AzureLargeInstancesClient) listBySubscriptionHandleResponse(resp * // Generated from API version 2023-07-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - azureLargeInstanceName - Name of the AzureLargeInstance. -// - options - AzureLargeInstancesClientBeginRestartOptions contains the optional parameters for the AzureLargeInstancesClient.BeginRestart +// - options - AzureLargeInstanceClientBeginRestartOptions contains the optional parameters for the AzureLargeInstanceClient.BeginRestart // method. -func (client *AzureLargeInstancesClient) BeginRestart(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstancesClientBeginRestartOptions) (*runtime.Poller[AzureLargeInstancesClientRestartResponse], error) { +func (client *AzureLargeInstanceClient) BeginRestart(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstanceClientBeginRestartOptions) (*runtime.Poller[AzureLargeInstanceClientRestartResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.restart(ctx, resourceGroupName, azureLargeInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureLargeInstancesClientRestartResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureLargeInstanceClientRestartResponse]{ Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureLargeInstancesClientRestartResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureLargeInstanceClientRestartResponse]{ Tracer: client.internal.Tracer(), }) } @@ -250,9 +250,9 @@ func (client *AzureLargeInstancesClient) BeginRestart(ctx context.Context, resou // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-07-20-preview -func (client *AzureLargeInstancesClient) restart(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstancesClientBeginRestartOptions) (*http.Response, error) { +func (client *AzureLargeInstanceClient) restart(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstanceClientBeginRestartOptions) (*http.Response, error) { var err error - const operationName = "AzureLargeInstancesClient.BeginRestart" + const operationName = "AzureLargeInstanceClient.BeginRestart" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -272,7 +272,7 @@ func (client *AzureLargeInstancesClient) restart(ctx context.Context, resourceGr } // restartCreateRequest creates the Restart request. -func (client *AzureLargeInstancesClient) restartCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstancesClientBeginRestartOptions) (*policy.Request, error) { +func (client *AzureLargeInstanceClient) restartCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstanceClientBeginRestartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/restart" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -310,20 +310,20 @@ func (client *AzureLargeInstancesClient) restartCreateRequest(ctx context.Contex // Generated from API version 2023-07-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - azureLargeInstanceName - Name of the AzureLargeInstance. -// - options - AzureLargeInstancesClientBeginShutdownOptions contains the optional parameters for the AzureLargeInstancesClient.BeginShutdown +// - options - AzureLargeInstanceClientBeginShutdownOptions contains the optional parameters for the AzureLargeInstanceClient.BeginShutdown // method. -func (client *AzureLargeInstancesClient) BeginShutdown(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstancesClientBeginShutdownOptions) (*runtime.Poller[AzureLargeInstancesClientShutdownResponse], error) { +func (client *AzureLargeInstanceClient) BeginShutdown(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstanceClientBeginShutdownOptions) (*runtime.Poller[AzureLargeInstanceClientShutdownResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.shutdown(ctx, resourceGroupName, azureLargeInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureLargeInstancesClientShutdownResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureLargeInstanceClientShutdownResponse]{ Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureLargeInstancesClientShutdownResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureLargeInstanceClientShutdownResponse]{ Tracer: client.internal.Tracer(), }) } @@ -333,9 +333,9 @@ func (client *AzureLargeInstancesClient) BeginShutdown(ctx context.Context, reso // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-07-20-preview -func (client *AzureLargeInstancesClient) shutdown(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstancesClientBeginShutdownOptions) (*http.Response, error) { +func (client *AzureLargeInstanceClient) shutdown(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstanceClientBeginShutdownOptions) (*http.Response, error) { var err error - const operationName = "AzureLargeInstancesClient.BeginShutdown" + const operationName = "AzureLargeInstanceClient.BeginShutdown" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -355,7 +355,7 @@ func (client *AzureLargeInstancesClient) shutdown(ctx context.Context, resourceG } // shutdownCreateRequest creates the Shutdown request. -func (client *AzureLargeInstancesClient) shutdownCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, _ *AzureLargeInstancesClientBeginShutdownOptions) (*policy.Request, error) { +func (client *AzureLargeInstanceClient) shutdownCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, _ *AzureLargeInstanceClientBeginShutdownOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/shutdown" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -386,20 +386,20 @@ func (client *AzureLargeInstancesClient) shutdownCreateRequest(ctx context.Conte // Generated from API version 2023-07-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - azureLargeInstanceName - Name of the AzureLargeInstance. -// - options - AzureLargeInstancesClientBeginStartOptions contains the optional parameters for the AzureLargeInstancesClient.BeginStart +// - options - AzureLargeInstanceClientBeginStartOptions contains the optional parameters for the AzureLargeInstanceClient.BeginStart // method. -func (client *AzureLargeInstancesClient) BeginStart(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstancesClientBeginStartOptions) (*runtime.Poller[AzureLargeInstancesClientStartResponse], error) { +func (client *AzureLargeInstanceClient) BeginStart(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstanceClientBeginStartOptions) (*runtime.Poller[AzureLargeInstanceClientStartResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.start(ctx, resourceGroupName, azureLargeInstanceName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureLargeInstancesClientStartResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureLargeInstanceClientStartResponse]{ Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureLargeInstancesClientStartResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzureLargeInstanceClientStartResponse]{ Tracer: client.internal.Tracer(), }) } @@ -409,9 +409,9 @@ func (client *AzureLargeInstancesClient) BeginStart(ctx context.Context, resourc // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-07-20-preview -func (client *AzureLargeInstancesClient) start(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstancesClientBeginStartOptions) (*http.Response, error) { +func (client *AzureLargeInstanceClient) start(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, options *AzureLargeInstanceClientBeginStartOptions) (*http.Response, error) { var err error - const operationName = "AzureLargeInstancesClient.BeginStart" + const operationName = "AzureLargeInstanceClient.BeginStart" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -431,7 +431,7 @@ func (client *AzureLargeInstancesClient) start(ctx context.Context, resourceGrou } // startCreateRequest creates the Start request. -func (client *AzureLargeInstancesClient) startCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, _ *AzureLargeInstancesClientBeginStartOptions) (*policy.Request, error) { +func (client *AzureLargeInstanceClient) startCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, _ *AzureLargeInstanceClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -464,32 +464,32 @@ func (client *AzureLargeInstancesClient) startCreateRequest(ctx context.Context, // - resourceGroupName - The name of the resource group. The name is case insensitive. // - azureLargeInstanceName - Name of the AzureLargeInstance. // - properties - The resource properties to be updated. -// - options - AzureLargeInstancesClientUpdateOptions contains the optional parameters for the AzureLargeInstancesClient.Update +// - options - AzureLargeInstanceClientUpdateOptions contains the optional parameters for the AzureLargeInstanceClient.Update // method. -func (client *AzureLargeInstancesClient) Update(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, properties TagsUpdate, options *AzureLargeInstancesClientUpdateOptions) (AzureLargeInstancesClientUpdateResponse, error) { +func (client *AzureLargeInstanceClient) Update(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, properties TagsUpdate, options *AzureLargeInstanceClientUpdateOptions) (AzureLargeInstanceClientUpdateResponse, error) { var err error - const operationName = "AzureLargeInstancesClient.Update" + const operationName = "AzureLargeInstanceClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, azureLargeInstanceName, properties, options) if err != nil { - return AzureLargeInstancesClientUpdateResponse{}, err + return AzureLargeInstanceClientUpdateResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return AzureLargeInstancesClientUpdateResponse{}, err + return AzureLargeInstanceClientUpdateResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return AzureLargeInstancesClientUpdateResponse{}, err + return AzureLargeInstanceClientUpdateResponse{}, err } resp, err := client.updateHandleResponse(httpResp) return resp, err } // updateCreateRequest creates the Update request. -func (client *AzureLargeInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, properties TagsUpdate, _ *AzureLargeInstancesClientUpdateOptions) (*policy.Request, error) { +func (client *AzureLargeInstanceClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureLargeInstanceName string, properties TagsUpdate, _ *AzureLargeInstanceClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeInstances/{azureLargeInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -519,10 +519,10 @@ func (client *AzureLargeInstancesClient) updateCreateRequest(ctx context.Context } // updateHandleResponse handles the Update response. -func (client *AzureLargeInstancesClient) updateHandleResponse(resp *http.Response) (AzureLargeInstancesClientUpdateResponse, error) { - result := AzureLargeInstancesClientUpdateResponse{} +func (client *AzureLargeInstanceClient) updateHandleResponse(resp *http.Response) (AzureLargeInstanceClientUpdateResponse, error) { + result := AzureLargeInstanceClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AzureLargeInstance); err != nil { - return AzureLargeInstancesClientUpdateResponse{}, err + return AzureLargeInstanceClientUpdateResponse{}, err } return result, nil } diff --git a/packages/typespec-go/test/armlargeinstance/zz_azurelargestorageinstances_client.go b/packages/typespec-go/test/armlargeinstance/zz_azurelargestorageinstance_client.go similarity index 65% rename from packages/typespec-go/test/armlargeinstance/zz_azurelargestorageinstances_client.go rename to packages/typespec-go/test/armlargeinstance/zz_azurelargestorageinstance_client.go index 1245b2bf0..97835ffaf 100644 --- a/packages/typespec-go/test/armlargeinstance/zz_azurelargestorageinstances_client.go +++ b/packages/typespec-go/test/armlargeinstance/zz_azurelargestorageinstance_client.go @@ -16,23 +16,23 @@ import ( "strings" ) -// AzureLargeStorageInstancesClient contains the methods for the AzureLargeStorageInstances group. -// Don't use this type directly, use NewAzureLargeStorageInstancesClient() instead. -type AzureLargeStorageInstancesClient struct { +// AzureLargeStorageInstanceClient contains the methods for the AzureLargeStorageInstance group. +// Don't use this type directly, use NewAzureLargeStorageInstanceClient() instead. +type AzureLargeStorageInstanceClient struct { internal *arm.Client subscriptionID string } -// NewAzureLargeStorageInstancesClient creates a new instance of AzureLargeStorageInstancesClient with the specified values. +// NewAzureLargeStorageInstanceClient creates a new instance of AzureLargeStorageInstanceClient with the specified values. // - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewAzureLargeStorageInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureLargeStorageInstancesClient, error) { +func NewAzureLargeStorageInstanceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureLargeStorageInstanceClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &AzureLargeStorageInstancesClient{ + client := &AzureLargeStorageInstanceClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,32 +46,32 @@ func NewAzureLargeStorageInstancesClient(subscriptionID string, credential azcor // Generated from API version 2023-07-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - azureLargeStorageInstanceName - Name of the AzureLargeStorageInstance. -// - options - AzureLargeStorageInstancesClientGetOptions contains the optional parameters for the AzureLargeStorageInstancesClient.Get +// - options - AzureLargeStorageInstanceClientGetOptions contains the optional parameters for the AzureLargeStorageInstanceClient.Get // method. -func (client *AzureLargeStorageInstancesClient) Get(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, options *AzureLargeStorageInstancesClientGetOptions) (AzureLargeStorageInstancesClientGetResponse, error) { +func (client *AzureLargeStorageInstanceClient) Get(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, options *AzureLargeStorageInstanceClientGetOptions) (AzureLargeStorageInstanceClientGetResponse, error) { var err error - const operationName = "AzureLargeStorageInstancesClient.Get" + const operationName = "AzureLargeStorageInstanceClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, azureLargeStorageInstanceName, options) if err != nil { - return AzureLargeStorageInstancesClientGetResponse{}, err + return AzureLargeStorageInstanceClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return AzureLargeStorageInstancesClientGetResponse{}, err + return AzureLargeStorageInstanceClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return AzureLargeStorageInstancesClientGetResponse{}, err + return AzureLargeStorageInstanceClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *AzureLargeStorageInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, _ *AzureLargeStorageInstancesClientGetOptions) (*policy.Request, error) { +func (client *AzureLargeStorageInstanceClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, _ *AzureLargeStorageInstanceClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances/{azureLargeStorageInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,10 +97,10 @@ func (client *AzureLargeStorageInstancesClient) getCreateRequest(ctx context.Con } // getHandleResponse handles the Get response. -func (client *AzureLargeStorageInstancesClient) getHandleResponse(resp *http.Response) (AzureLargeStorageInstancesClientGetResponse, error) { - result := AzureLargeStorageInstancesClientGetResponse{} +func (client *AzureLargeStorageInstanceClient) getHandleResponse(resp *http.Response) (AzureLargeStorageInstanceClientGetResponse, error) { + result := AzureLargeStorageInstanceClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AzureLargeStorageInstance); err != nil { - return AzureLargeStorageInstancesClientGetResponse{}, err + return AzureLargeStorageInstanceClientGetResponse{}, err } return result, nil } @@ -111,15 +111,15 @@ func (client *AzureLargeStorageInstancesClient) getHandleResponse(resp *http.Res // // Generated from API version 2023-07-20-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - AzureLargeStorageInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureLargeStorageInstancesClient.NewListByResourceGroupPager +// - options - AzureLargeStorageInstanceClientListByResourceGroupOptions contains the optional parameters for the AzureLargeStorageInstanceClient.NewListByResourceGroupPager // method. -func (client *AzureLargeStorageInstancesClient) NewListByResourceGroupPager(resourceGroupName string, options *AzureLargeStorageInstancesClientListByResourceGroupOptions) *runtime.Pager[AzureLargeStorageInstancesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[AzureLargeStorageInstancesClientListByResourceGroupResponse]{ - More: func(page AzureLargeStorageInstancesClientListByResourceGroupResponse) bool { +func (client *AzureLargeStorageInstanceClient) NewListByResourceGroupPager(resourceGroupName string, options *AzureLargeStorageInstanceClientListByResourceGroupOptions) *runtime.Pager[AzureLargeStorageInstanceClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureLargeStorageInstanceClientListByResourceGroupResponse]{ + More: func(page AzureLargeStorageInstanceClientListByResourceGroupResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *AzureLargeStorageInstancesClientListByResourceGroupResponse) (AzureLargeStorageInstancesClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureLargeStorageInstancesClient.NewListByResourceGroupPager") + Fetcher: func(ctx context.Context, page *AzureLargeStorageInstanceClientListByResourceGroupResponse) (AzureLargeStorageInstanceClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureLargeStorageInstanceClient.NewListByResourceGroupPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -128,7 +128,7 @@ func (client *AzureLargeStorageInstancesClient) NewListByResourceGroupPager(reso return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) }, nil) if err != nil { - return AzureLargeStorageInstancesClientListByResourceGroupResponse{}, err + return AzureLargeStorageInstanceClientListByResourceGroupResponse{}, err } return client.listByResourceGroupHandleResponse(resp) }, @@ -137,7 +137,7 @@ func (client *AzureLargeStorageInstancesClient) NewListByResourceGroupPager(reso } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AzureLargeStorageInstancesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AzureLargeStorageInstancesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AzureLargeStorageInstanceClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AzureLargeStorageInstanceClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -159,10 +159,10 @@ func (client *AzureLargeStorageInstancesClient) listByResourceGroupCreateRequest } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *AzureLargeStorageInstancesClient) listByResourceGroupHandleResponse(resp *http.Response) (AzureLargeStorageInstancesClientListByResourceGroupResponse, error) { - result := AzureLargeStorageInstancesClientListByResourceGroupResponse{} +func (client *AzureLargeStorageInstanceClient) listByResourceGroupHandleResponse(resp *http.Response) (AzureLargeStorageInstanceClientListByResourceGroupResponse, error) { + result := AzureLargeStorageInstanceClientListByResourceGroupResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AzureLargeStorageInstanceListResult); err != nil { - return AzureLargeStorageInstancesClientListByResourceGroupResponse{}, err + return AzureLargeStorageInstanceClientListByResourceGroupResponse{}, err } return result, nil } @@ -171,15 +171,15 @@ func (client *AzureLargeStorageInstancesClient) listByResourceGroupHandleRespons // operations returns various properties of each Azure LargeStorage instance. // // Generated from API version 2023-07-20-preview -// - options - AzureLargeStorageInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureLargeStorageInstancesClient.NewListBySubscriptionPager +// - options - AzureLargeStorageInstanceClientListBySubscriptionOptions contains the optional parameters for the AzureLargeStorageInstanceClient.NewListBySubscriptionPager // method. -func (client *AzureLargeStorageInstancesClient) NewListBySubscriptionPager(options *AzureLargeStorageInstancesClientListBySubscriptionOptions) *runtime.Pager[AzureLargeStorageInstancesClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[AzureLargeStorageInstancesClientListBySubscriptionResponse]{ - More: func(page AzureLargeStorageInstancesClientListBySubscriptionResponse) bool { +func (client *AzureLargeStorageInstanceClient) NewListBySubscriptionPager(options *AzureLargeStorageInstanceClientListBySubscriptionOptions) *runtime.Pager[AzureLargeStorageInstanceClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AzureLargeStorageInstanceClientListBySubscriptionResponse]{ + More: func(page AzureLargeStorageInstanceClientListBySubscriptionResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *AzureLargeStorageInstancesClientListBySubscriptionResponse) (AzureLargeStorageInstancesClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureLargeStorageInstancesClient.NewListBySubscriptionPager") + Fetcher: func(ctx context.Context, page *AzureLargeStorageInstanceClientListBySubscriptionResponse) (AzureLargeStorageInstanceClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureLargeStorageInstanceClient.NewListBySubscriptionPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -188,7 +188,7 @@ func (client *AzureLargeStorageInstancesClient) NewListBySubscriptionPager(optio return client.listBySubscriptionCreateRequest(ctx, options) }, nil) if err != nil { - return AzureLargeStorageInstancesClientListBySubscriptionResponse{}, err + return AzureLargeStorageInstanceClientListBySubscriptionResponse{}, err } return client.listBySubscriptionHandleResponse(resp) }, @@ -197,7 +197,7 @@ func (client *AzureLargeStorageInstancesClient) NewListBySubscriptionPager(optio } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AzureLargeStorageInstancesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AzureLargeStorageInstancesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *AzureLargeStorageInstanceClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AzureLargeStorageInstanceClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -215,10 +215,10 @@ func (client *AzureLargeStorageInstancesClient) listBySubscriptionCreateRequest( } // listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *AzureLargeStorageInstancesClient) listBySubscriptionHandleResponse(resp *http.Response) (AzureLargeStorageInstancesClientListBySubscriptionResponse, error) { - result := AzureLargeStorageInstancesClientListBySubscriptionResponse{} +func (client *AzureLargeStorageInstanceClient) listBySubscriptionHandleResponse(resp *http.Response) (AzureLargeStorageInstanceClientListBySubscriptionResponse, error) { + result := AzureLargeStorageInstanceClientListBySubscriptionResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AzureLargeStorageInstanceListResult); err != nil { - return AzureLargeStorageInstancesClientListBySubscriptionResponse{}, err + return AzureLargeStorageInstanceClientListBySubscriptionResponse{}, err } return result, nil } @@ -231,32 +231,32 @@ func (client *AzureLargeStorageInstancesClient) listBySubscriptionHandleResponse // - resourceGroupName - The name of the resource group. The name is case insensitive. // - azureLargeStorageInstanceName - Name of the AzureLargeStorageInstance. // - properties - The resource properties to be updated. -// - options - AzureLargeStorageInstancesClientUpdateOptions contains the optional parameters for the AzureLargeStorageInstancesClient.Update +// - options - AzureLargeStorageInstanceClientUpdateOptions contains the optional parameters for the AzureLargeStorageInstanceClient.Update // method. -func (client *AzureLargeStorageInstancesClient) Update(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, properties AzureLargeStorageInstanceTagsUpdate, options *AzureLargeStorageInstancesClientUpdateOptions) (AzureLargeStorageInstancesClientUpdateResponse, error) { +func (client *AzureLargeStorageInstanceClient) Update(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, properties AzureLargeStorageInstanceTagsUpdate, options *AzureLargeStorageInstanceClientUpdateOptions) (AzureLargeStorageInstanceClientUpdateResponse, error) { var err error - const operationName = "AzureLargeStorageInstancesClient.Update" + const operationName = "AzureLargeStorageInstanceClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, azureLargeStorageInstanceName, properties, options) if err != nil { - return AzureLargeStorageInstancesClientUpdateResponse{}, err + return AzureLargeStorageInstanceClientUpdateResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return AzureLargeStorageInstancesClientUpdateResponse{}, err + return AzureLargeStorageInstanceClientUpdateResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return AzureLargeStorageInstancesClientUpdateResponse{}, err + return AzureLargeStorageInstanceClientUpdateResponse{}, err } resp, err := client.updateHandleResponse(httpResp) return resp, err } // updateCreateRequest creates the Update request. -func (client *AzureLargeStorageInstancesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, properties AzureLargeStorageInstanceTagsUpdate, _ *AzureLargeStorageInstancesClientUpdateOptions) (*policy.Request, error) { +func (client *AzureLargeStorageInstanceClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureLargeStorageInstanceName string, properties AzureLargeStorageInstanceTagsUpdate, _ *AzureLargeStorageInstanceClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureLargeInstance/azureLargeStorageInstances/{azureLargeStorageInstanceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -286,10 +286,10 @@ func (client *AzureLargeStorageInstancesClient) updateCreateRequest(ctx context. } // updateHandleResponse handles the Update response. -func (client *AzureLargeStorageInstancesClient) updateHandleResponse(resp *http.Response) (AzureLargeStorageInstancesClientUpdateResponse, error) { - result := AzureLargeStorageInstancesClientUpdateResponse{} +func (client *AzureLargeStorageInstanceClient) updateHandleResponse(resp *http.Response) (AzureLargeStorageInstanceClientUpdateResponse, error) { + result := AzureLargeStorageInstanceClientUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AzureLargeStorageInstance); err != nil { - return AzureLargeStorageInstancesClientUpdateResponse{}, err + return AzureLargeStorageInstanceClientUpdateResponse{}, err } return result, nil } diff --git a/packages/typespec-go/test/armlargeinstance/zz_client_factory.go b/packages/typespec-go/test/armlargeinstance/zz_client_factory.go index 216337f70..e96ac77bf 100644 --- a/packages/typespec-go/test/armlargeinstance/zz_client_factory.go +++ b/packages/typespec-go/test/armlargeinstance/zz_client_factory.go @@ -32,17 +32,17 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -// NewAzureLargeInstancesClient creates a new instance of AzureLargeInstancesClient. -func (c *ClientFactory) NewAzureLargeInstancesClient() *AzureLargeInstancesClient { - return &AzureLargeInstancesClient{ +// NewAzureLargeInstanceClient creates a new instance of AzureLargeInstanceClient. +func (c *ClientFactory) NewAzureLargeInstanceClient() *AzureLargeInstanceClient { + return &AzureLargeInstanceClient{ subscriptionID: c.subscriptionID, internal: c.internal, } } -// NewAzureLargeStorageInstancesClient creates a new instance of AzureLargeStorageInstancesClient. -func (c *ClientFactory) NewAzureLargeStorageInstancesClient() *AzureLargeStorageInstancesClient { - return &AzureLargeStorageInstancesClient{ +// NewAzureLargeStorageInstanceClient creates a new instance of AzureLargeStorageInstanceClient. +func (c *ClientFactory) NewAzureLargeStorageInstanceClient() *AzureLargeStorageInstanceClient { + return &AzureLargeStorageInstanceClient{ subscriptionID: c.subscriptionID, internal: c.internal, } diff --git a/packages/typespec-go/test/armlargeinstance/zz_options.go b/packages/typespec-go/test/armlargeinstance/zz_options.go index a1ab3e8e6..50f8f2b27 100644 --- a/packages/typespec-go/test/armlargeinstance/zz_options.go +++ b/packages/typespec-go/test/armlargeinstance/zz_options.go @@ -4,9 +4,9 @@ package armlargeinstance -// AzureLargeInstancesClientBeginRestartOptions contains the optional parameters for the AzureLargeInstancesClient.BeginRestart +// AzureLargeInstanceClientBeginRestartOptions contains the optional parameters for the AzureLargeInstanceClient.BeginRestart // method. -type AzureLargeInstancesClientBeginRestartOptions struct { +type AzureLargeInstanceClientBeginRestartOptions struct { // Resumes the long-running operation from the provided token. ResumeToken string @@ -15,63 +15,63 @@ type AzureLargeInstancesClientBeginRestartOptions struct { ForceParameter *ForceState } -// AzureLargeInstancesClientBeginShutdownOptions contains the optional parameters for the AzureLargeInstancesClient.BeginShutdown +// AzureLargeInstanceClientBeginShutdownOptions contains the optional parameters for the AzureLargeInstanceClient.BeginShutdown // method. -type AzureLargeInstancesClientBeginShutdownOptions struct { +type AzureLargeInstanceClientBeginShutdownOptions struct { // Resumes the long-running operation from the provided token. ResumeToken string } -// AzureLargeInstancesClientBeginStartOptions contains the optional parameters for the AzureLargeInstancesClient.BeginStart +// AzureLargeInstanceClientBeginStartOptions contains the optional parameters for the AzureLargeInstanceClient.BeginStart // method. -type AzureLargeInstancesClientBeginStartOptions struct { +type AzureLargeInstanceClientBeginStartOptions struct { // Resumes the long-running operation from the provided token. ResumeToken string } -// AzureLargeInstancesClientGetOptions contains the optional parameters for the AzureLargeInstancesClient.Get method. -type AzureLargeInstancesClientGetOptions struct { +// AzureLargeInstanceClientGetOptions contains the optional parameters for the AzureLargeInstanceClient.Get method. +type AzureLargeInstanceClientGetOptions struct { // placeholder for future optional parameters } -// AzureLargeInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureLargeInstancesClient.NewListByResourceGroupPager +// AzureLargeInstanceClientListByResourceGroupOptions contains the optional parameters for the AzureLargeInstanceClient.NewListByResourceGroupPager // method. -type AzureLargeInstancesClientListByResourceGroupOptions struct { +type AzureLargeInstanceClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// AzureLargeInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureLargeInstancesClient.NewListBySubscriptionPager +// AzureLargeInstanceClientListBySubscriptionOptions contains the optional parameters for the AzureLargeInstanceClient.NewListBySubscriptionPager // method. -type AzureLargeInstancesClientListBySubscriptionOptions struct { +type AzureLargeInstanceClientListBySubscriptionOptions struct { // placeholder for future optional parameters } -// AzureLargeInstancesClientUpdateOptions contains the optional parameters for the AzureLargeInstancesClient.Update method. -type AzureLargeInstancesClientUpdateOptions struct { +// AzureLargeInstanceClientUpdateOptions contains the optional parameters for the AzureLargeInstanceClient.Update method. +type AzureLargeInstanceClientUpdateOptions struct { // placeholder for future optional parameters } -// AzureLargeStorageInstancesClientGetOptions contains the optional parameters for the AzureLargeStorageInstancesClient.Get +// AzureLargeStorageInstanceClientGetOptions contains the optional parameters for the AzureLargeStorageInstanceClient.Get // method. -type AzureLargeStorageInstancesClientGetOptions struct { +type AzureLargeStorageInstanceClientGetOptions struct { // placeholder for future optional parameters } -// AzureLargeStorageInstancesClientListByResourceGroupOptions contains the optional parameters for the AzureLargeStorageInstancesClient.NewListByResourceGroupPager +// AzureLargeStorageInstanceClientListByResourceGroupOptions contains the optional parameters for the AzureLargeStorageInstanceClient.NewListByResourceGroupPager // method. -type AzureLargeStorageInstancesClientListByResourceGroupOptions struct { +type AzureLargeStorageInstanceClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// AzureLargeStorageInstancesClientListBySubscriptionOptions contains the optional parameters for the AzureLargeStorageInstancesClient.NewListBySubscriptionPager +// AzureLargeStorageInstanceClientListBySubscriptionOptions contains the optional parameters for the AzureLargeStorageInstanceClient.NewListBySubscriptionPager // method. -type AzureLargeStorageInstancesClientListBySubscriptionOptions struct { +type AzureLargeStorageInstanceClientListBySubscriptionOptions struct { // placeholder for future optional parameters } -// AzureLargeStorageInstancesClientUpdateOptions contains the optional parameters for the AzureLargeStorageInstancesClient.Update +// AzureLargeStorageInstanceClientUpdateOptions contains the optional parameters for the AzureLargeStorageInstanceClient.Update // method. -type AzureLargeStorageInstancesClientUpdateOptions struct { +type AzureLargeStorageInstanceClientUpdateOptions struct { // placeholder for future optional parameters } diff --git a/packages/typespec-go/test/armlargeinstance/zz_responses.go b/packages/typespec-go/test/armlargeinstance/zz_responses.go index 8bf4b110e..58a894a3e 100644 --- a/packages/typespec-go/test/armlargeinstance/zz_responses.go +++ b/packages/typespec-go/test/armlargeinstance/zz_responses.go @@ -4,70 +4,70 @@ package armlargeinstance -// AzureLargeInstancesClientGetResponse contains the response from method AzureLargeInstancesClient.Get. -type AzureLargeInstancesClientGetResponse struct { +// AzureLargeInstanceClientGetResponse contains the response from method AzureLargeInstanceClient.Get. +type AzureLargeInstanceClientGetResponse struct { // Azure Large Instance info on Azure (ARM properties and AzureLargeInstance // properties) AzureLargeInstance } -// AzureLargeInstancesClientListByResourceGroupResponse contains the response from method AzureLargeInstancesClient.NewListByResourceGroupPager. -type AzureLargeInstancesClientListByResourceGroupResponse struct { +// AzureLargeInstanceClientListByResourceGroupResponse contains the response from method AzureLargeInstanceClient.NewListByResourceGroupPager. +type AzureLargeInstanceClientListByResourceGroupResponse struct { // The response of a AzureLargeInstance list operation. ListResult } -// AzureLargeInstancesClientListBySubscriptionResponse contains the response from method AzureLargeInstancesClient.NewListBySubscriptionPager. -type AzureLargeInstancesClientListBySubscriptionResponse struct { +// AzureLargeInstanceClientListBySubscriptionResponse contains the response from method AzureLargeInstanceClient.NewListBySubscriptionPager. +type AzureLargeInstanceClientListBySubscriptionResponse struct { // The response of a AzureLargeInstance list operation. ListResult } -// AzureLargeInstancesClientRestartResponse contains the response from method AzureLargeInstancesClient.BeginRestart. -type AzureLargeInstancesClientRestartResponse struct { +// AzureLargeInstanceClientRestartResponse contains the response from method AzureLargeInstanceClient.BeginRestart. +type AzureLargeInstanceClientRestartResponse struct { // placeholder for future response values } -// AzureLargeInstancesClientShutdownResponse contains the response from method AzureLargeInstancesClient.BeginShutdown. -type AzureLargeInstancesClientShutdownResponse struct { +// AzureLargeInstanceClientShutdownResponse contains the response from method AzureLargeInstanceClient.BeginShutdown. +type AzureLargeInstanceClientShutdownResponse struct { // The current status of an async operation. OperationStatusResult } -// AzureLargeInstancesClientStartResponse contains the response from method AzureLargeInstancesClient.BeginStart. -type AzureLargeInstancesClientStartResponse struct { +// AzureLargeInstanceClientStartResponse contains the response from method AzureLargeInstanceClient.BeginStart. +type AzureLargeInstanceClientStartResponse struct { // The current status of an async operation. OperationStatusResult } -// AzureLargeInstancesClientUpdateResponse contains the response from method AzureLargeInstancesClient.Update. -type AzureLargeInstancesClientUpdateResponse struct { +// AzureLargeInstanceClientUpdateResponse contains the response from method AzureLargeInstanceClient.Update. +type AzureLargeInstanceClientUpdateResponse struct { // Azure Large Instance info on Azure (ARM properties and AzureLargeInstance // properties) AzureLargeInstance } -// AzureLargeStorageInstancesClientGetResponse contains the response from method AzureLargeStorageInstancesClient.Get. -type AzureLargeStorageInstancesClientGetResponse struct { +// AzureLargeStorageInstanceClientGetResponse contains the response from method AzureLargeStorageInstanceClient.Get. +type AzureLargeStorageInstanceClientGetResponse struct { // AzureLargeStorageInstance info on Azure (ARM properties and // AzureLargeStorageInstance properties) AzureLargeStorageInstance } -// AzureLargeStorageInstancesClientListByResourceGroupResponse contains the response from method AzureLargeStorageInstancesClient.NewListByResourceGroupPager. -type AzureLargeStorageInstancesClientListByResourceGroupResponse struct { +// AzureLargeStorageInstanceClientListByResourceGroupResponse contains the response from method AzureLargeStorageInstanceClient.NewListByResourceGroupPager. +type AzureLargeStorageInstanceClientListByResourceGroupResponse struct { // The response of a AzureLargeStorageInstance list operation. AzureLargeStorageInstanceListResult } -// AzureLargeStorageInstancesClientListBySubscriptionResponse contains the response from method AzureLargeStorageInstancesClient.NewListBySubscriptionPager. -type AzureLargeStorageInstancesClientListBySubscriptionResponse struct { +// AzureLargeStorageInstanceClientListBySubscriptionResponse contains the response from method AzureLargeStorageInstanceClient.NewListBySubscriptionPager. +type AzureLargeStorageInstanceClientListBySubscriptionResponse struct { // The response of a AzureLargeStorageInstance list operation. AzureLargeStorageInstanceListResult } -// AzureLargeStorageInstancesClientUpdateResponse contains the response from method AzureLargeStorageInstancesClient.Update. -type AzureLargeStorageInstancesClientUpdateResponse struct { +// AzureLargeStorageInstanceClientUpdateResponse contains the response from method AzureLargeStorageInstanceClient.Update. +type AzureLargeStorageInstanceClientUpdateResponse struct { // AzureLargeStorageInstance info on Azure (ARM properties and // AzureLargeStorageInstance properties) AzureLargeStorageInstance diff --git a/packages/typespec-go/test/cadlranch/client/naminggroup/fake/zz_naming_server.go b/packages/typespec-go/test/cadlranch/client/naminggroup/fake/zz_naming_server.go index 90ed9e48f..ce5f39482 100644 --- a/packages/typespec-go/test/cadlranch/client/naminggroup/fake/zz_naming_server.go +++ b/packages/typespec-go/test/cadlranch/client/naminggroup/fake/zz_naming_server.go @@ -20,8 +20,8 @@ import ( // NamingServer is a fake server for instances of the naminggroup.NamingClient type. type NamingServer struct { - // NamingModelServer contains the fakes for client NamingModelClient - NamingModelServer NamingModelServer + // NamingClientModelServer contains the fakes for client NamingClientModelClient + NamingClientModelServer NamingClientModelServer // NamingUnionEnumServer contains the fakes for client NamingUnionEnumClient NamingUnionEnumServer NamingUnionEnumServer @@ -65,10 +65,10 @@ func NewNamingServerTransport(srv *NamingServer) *NamingServerTransport { // NamingServerTransport connects instances of naminggroup.NamingClient to instances of NamingServer. // Don't use this type directly, use NewNamingServerTransport instead. type NamingServerTransport struct { - srv *NamingServer - trMu sync.Mutex - trNamingModelServer *NamingModelServerTransport - trNamingUnionEnumServer *NamingUnionEnumServerTransport + srv *NamingServer + trMu sync.Mutex + trNamingClientModelServer *NamingClientModelServerTransport + trNamingUnionEnumServer *NamingUnionEnumServerTransport } // Do implements the policy.Transporter interface for NamingServerTransport. @@ -90,11 +90,11 @@ func (n *NamingServerTransport) dispatchToClientFake(req *http.Request, client s var err error switch client { - case "NamingModelClient": - initServer(&n.trMu, &n.trNamingModelServer, func() *NamingModelServerTransport { - return NewNamingModelServerTransport(&n.srv.NamingModelServer) + case "NamingClientModelClient": + initServer(&n.trMu, &n.trNamingClientModelServer, func() *NamingClientModelServerTransport { + return NewNamingClientModelServerTransport(&n.srv.NamingClientModelServer) }) - resp, err = n.trNamingModelServer.Do(req) + resp, err = n.trNamingClientModelServer.Do(req) case "NamingUnionEnumClient": initServer(&n.trMu, &n.trNamingUnionEnumServer, func() *NamingUnionEnumServerTransport { return NewNamingUnionEnumServerTransport(&n.srv.NamingUnionEnumServer) diff --git a/packages/typespec-go/test/cadlranch/client/naminggroup/fake/zz_namingmodel_server.go b/packages/typespec-go/test/cadlranch/client/naminggroup/fake/zz_namingclientmodel_server.go similarity index 59% rename from packages/typespec-go/test/cadlranch/client/naminggroup/fake/zz_namingmodel_server.go rename to packages/typespec-go/test/cadlranch/client/naminggroup/fake/zz_namingclientmodel_server.go index 58edf7a6c..5b530a5a9 100644 --- a/packages/typespec-go/test/cadlranch/client/naminggroup/fake/zz_namingmodel_server.go +++ b/packages/typespec-go/test/cadlranch/client/naminggroup/fake/zz_namingclientmodel_server.go @@ -15,32 +15,32 @@ import ( "net/http" ) -// NamingModelServer is a fake server for instances of the naminggroup.NamingModelClient type. -type NamingModelServer struct { - // Client is the fake for method NamingModelClient.Client +// NamingClientModelServer is a fake server for instances of the naminggroup.NamingClientModelClient type. +type NamingClientModelServer struct { + // Client is the fake for method NamingClientModelClient.Client // HTTP status codes to indicate success: http.StatusNoContent - Client func(ctx context.Context, body naminggroup.ClientModel, options *naminggroup.NamingModelClientClientOptions) (resp azfake.Responder[naminggroup.NamingModelClientClientResponse], errResp azfake.ErrorResponder) + Client func(ctx context.Context, body naminggroup.ClientModel, options *naminggroup.NamingClientModelClientClientOptions) (resp azfake.Responder[naminggroup.NamingClientModelClientClientResponse], errResp azfake.ErrorResponder) - // Language is the fake for method NamingModelClient.Language + // Language is the fake for method NamingClientModelClient.Language // HTTP status codes to indicate success: http.StatusNoContent - Language func(ctx context.Context, body naminggroup.GoModel, options *naminggroup.NamingModelClientLanguageOptions) (resp azfake.Responder[naminggroup.NamingModelClientLanguageResponse], errResp azfake.ErrorResponder) + Language func(ctx context.Context, body naminggroup.GoModel, options *naminggroup.NamingClientModelClientLanguageOptions) (resp azfake.Responder[naminggroup.NamingClientModelClientLanguageResponse], errResp azfake.ErrorResponder) } -// NewNamingModelServerTransport creates a new instance of NamingModelServerTransport with the provided implementation. -// The returned NamingModelServerTransport instance is connected to an instance of naminggroup.NamingModelClient via the +// NewNamingClientModelServerTransport creates a new instance of NamingClientModelServerTransport with the provided implementation. +// The returned NamingClientModelServerTransport instance is connected to an instance of naminggroup.NamingClientModelClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewNamingModelServerTransport(srv *NamingModelServer) *NamingModelServerTransport { - return &NamingModelServerTransport{srv: srv} +func NewNamingClientModelServerTransport(srv *NamingClientModelServer) *NamingClientModelServerTransport { + return &NamingClientModelServerTransport{srv: srv} } -// NamingModelServerTransport connects instances of naminggroup.NamingModelClient to instances of NamingModelServer. -// Don't use this type directly, use NewNamingModelServerTransport instead. -type NamingModelServerTransport struct { - srv *NamingModelServer +// NamingClientModelServerTransport connects instances of naminggroup.NamingClientModelClient to instances of NamingClientModelServer. +// Don't use this type directly, use NewNamingClientModelServerTransport instead. +type NamingClientModelServerTransport struct { + srv *NamingClientModelServer } -// Do implements the policy.Transporter interface for NamingModelServerTransport. -func (n *NamingModelServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for NamingClientModelServerTransport. +func (n *NamingClientModelServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { @@ -50,14 +50,14 @@ func (n *NamingModelServerTransport) Do(req *http.Request) (*http.Response, erro return n.dispatchToMethodFake(req, method) } -func (n *NamingModelServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { +func (n *NamingClientModelServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { var resp *http.Response var err error switch method { - case "NamingModelClient.Client": + case "NamingClientModelClient.Client": resp, err = n.dispatchClient(req) - case "NamingModelClient.Language": + case "NamingClientModelClient.Language": resp, err = n.dispatchLanguage(req) default: err = fmt.Errorf("unhandled API %s", method) @@ -66,7 +66,7 @@ func (n *NamingModelServerTransport) dispatchToMethodFake(req *http.Request, met return resp, err } -func (n *NamingModelServerTransport) dispatchClient(req *http.Request) (*http.Response, error) { +func (n *NamingClientModelServerTransport) dispatchClient(req *http.Request) (*http.Response, error) { if n.srv.Client == nil { return nil, &nonRetriableError{errors.New("fake for method Client not implemented")} } @@ -89,7 +89,7 @@ func (n *NamingModelServerTransport) dispatchClient(req *http.Request) (*http.Re return resp, nil } -func (n *NamingModelServerTransport) dispatchLanguage(req *http.Request) (*http.Response, error) { +func (n *NamingClientModelServerTransport) dispatchLanguage(req *http.Request) (*http.Response, error) { if n.srv.Language == nil { return nil, &nonRetriableError{errors.New("fake for method Language not implemented")} } diff --git a/packages/typespec-go/test/cadlranch/client/naminggroup/fakes_test.go b/packages/typespec-go/test/cadlranch/client/naminggroup/fakes_test.go index 9727647db..eb068b28f 100644 --- a/packages/typespec-go/test/cadlranch/client/naminggroup/fakes_test.go +++ b/packages/typespec-go/test/cadlranch/client/naminggroup/fakes_test.go @@ -20,12 +20,12 @@ func TestFakeNamingServer(t *testing.T) { calledModelServerClient := false calledNamingServerClient := false server := fake.NamingServer{ - NamingModelServer: fake.NamingModelServer{ - Client: func(ctx context.Context, body naminggroup.ClientModel, options *naminggroup.NamingModelClientClientOptions) (resp azfake.Responder[naminggroup.NamingModelClientClientResponse], errResp azfake.ErrorResponder) { + NamingClientModelServer: fake.NamingClientModelServer{ + Client: func(ctx context.Context, body naminggroup.ClientModel, options *naminggroup.NamingClientModelClientClientOptions) (resp azfake.Responder[naminggroup.NamingClientModelClientClientResponse], errResp azfake.ErrorResponder) { require.NotNil(t, body.DefaultName) require.True(t, *body.DefaultName) calledModelServerClient = true - resp.SetResponse(http.StatusNoContent, naminggroup.NamingModelClientClientResponse{}, nil) + resp.SetResponse(http.StatusNoContent, naminggroup.NamingClientModelClientClientResponse{}, nil) return }, }, @@ -42,7 +42,7 @@ func TestFakeNamingServer(t *testing.T) { }) require.NoError(t, err) - _, err = client.NewNamingModelClient().Client(context.Background(), naminggroup.ClientModel{ + _, err = client.NewNamingClientModelClient().Client(context.Background(), naminggroup.ClientModel{ DefaultName: to.Ptr(true), }, nil) require.NoError(t, err) diff --git a/packages/typespec-go/test/cadlranch/client/naminggroup/model_client_test.go b/packages/typespec-go/test/cadlranch/client/naminggroup/model_client_test.go index 3185a50f4..60d27b6c7 100644 --- a/packages/typespec-go/test/cadlranch/client/naminggroup/model_client_test.go +++ b/packages/typespec-go/test/cadlranch/client/naminggroup/model_client_test.go @@ -15,7 +15,7 @@ import ( func TestModelClient_Client(t *testing.T) { client, err := naminggroup.NewNamingClient(nil) require.NoError(t, err) - resp, err := client.NewNamingModelClient().Client(context.Background(), naminggroup.ClientModel{ + resp, err := client.NewNamingClientModelClient().Client(context.Background(), naminggroup.ClientModel{ DefaultName: to.Ptr(true), }, nil) require.NoError(t, err) @@ -25,7 +25,7 @@ func TestModelClient_Client(t *testing.T) { func TestModelClient_Language(t *testing.T) { client, err := naminggroup.NewNamingClient(nil) require.NoError(t, err) - resp, err := client.NewNamingModelClient().Language(context.Background(), naminggroup.GoModel{ + resp, err := client.NewNamingClientModelClient().Language(context.Background(), naminggroup.GoModel{ DefaultName: to.Ptr(true), }, nil) require.NoError(t, err) diff --git a/packages/typespec-go/test/cadlranch/client/naminggroup/zz_naming_client.go b/packages/typespec-go/test/cadlranch/client/naminggroup/zz_naming_client.go index 2932537e5..475805975 100644 --- a/packages/typespec-go/test/cadlranch/client/naminggroup/zz_naming_client.go +++ b/packages/typespec-go/test/cadlranch/client/naminggroup/zz_naming_client.go @@ -18,9 +18,9 @@ type NamingClient struct { internal *azcore.Client } -// NewNamingModelClient creates a new instance of [NamingModelClient]. -func (client *NamingClient) NewNamingModelClient() *NamingModelClient { - return &NamingModelClient{ +// NewNamingClientModelClient creates a new instance of [NamingClientModelClient]. +func (client *NamingClient) NewNamingClientModelClient() *NamingClientModelClient { + return &NamingClientModelClient{ internal: client.internal, } } diff --git a/packages/typespec-go/test/cadlranch/client/naminggroup/zz_namingmodel_client.go b/packages/typespec-go/test/cadlranch/client/naminggroup/zz_namingclientmodel_client.go similarity index 57% rename from packages/typespec-go/test/cadlranch/client/naminggroup/zz_namingmodel_client.go rename to packages/typespec-go/test/cadlranch/client/naminggroup/zz_namingclientmodel_client.go index dd39f3069..0e93a6ba6 100644 --- a/packages/typespec-go/test/cadlranch/client/naminggroup/zz_namingmodel_client.go +++ b/packages/typespec-go/test/cadlranch/client/naminggroup/zz_namingclientmodel_client.go @@ -12,38 +12,39 @@ import ( "net/http" ) -// NamingModelClient contains the methods for the NamingModel group. -// Don't use this type directly, use [NamingClient.NewNamingModelClient] instead. -type NamingModelClient struct { +// NamingClientModelClient contains the methods for the NamingClientModel group. +// Don't use this type directly, use [NamingClient.NewNamingClientModelClient] instead. +type NamingClientModelClient struct { internal *azcore.Client } // Client - // If the operation fails it returns an *azcore.ResponseError type. -// - options - NamingModelClientClientOptions contains the optional parameters for the NamingModelClient.Client method. -func (client *NamingModelClient) Client(ctx context.Context, body ClientModel, options *NamingModelClientClientOptions) (NamingModelClientClientResponse, error) { +// - options - NamingClientModelClientClientOptions contains the optional parameters for the NamingClientModelClient.Client +// method. +func (client *NamingClientModelClient) Client(ctx context.Context, body ClientModel, options *NamingClientModelClientClientOptions) (NamingClientModelClientClientResponse, error) { var err error - const operationName = "NamingModelClient.Client" + const operationName = "NamingClientModelClient.Client" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.clientCreateRequest(ctx, body, options) if err != nil { - return NamingModelClientClientResponse{}, err + return NamingClientModelClientClientResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return NamingModelClientClientResponse{}, err + return NamingClientModelClientClientResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) - return NamingModelClientClientResponse{}, err + return NamingClientModelClientClientResponse{}, err } - return NamingModelClientClientResponse{}, nil + return NamingClientModelClientClientResponse{}, nil } // clientCreateRequest creates the Client request. -func (client *NamingModelClient) clientCreateRequest(ctx context.Context, body ClientModel, _ *NamingModelClientClientOptions) (*policy.Request, error) { +func (client *NamingClientModelClient) clientCreateRequest(ctx context.Context, body ClientModel, _ *NamingClientModelClientClientOptions) (*policy.Request, error) { urlPath := "/client/naming/model/client" req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath)) if err != nil { @@ -58,30 +59,31 @@ func (client *NamingModelClient) clientCreateRequest(ctx context.Context, body C // Language - // If the operation fails it returns an *azcore.ResponseError type. -// - options - NamingModelClientLanguageOptions contains the optional parameters for the NamingModelClient.Language method. -func (client *NamingModelClient) Language(ctx context.Context, body GoModel, options *NamingModelClientLanguageOptions) (NamingModelClientLanguageResponse, error) { +// - options - NamingClientModelClientLanguageOptions contains the optional parameters for the NamingClientModelClient.Language +// method. +func (client *NamingClientModelClient) Language(ctx context.Context, body GoModel, options *NamingClientModelClientLanguageOptions) (NamingClientModelClientLanguageResponse, error) { var err error - const operationName = "NamingModelClient.Language" + const operationName = "NamingClientModelClient.Language" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.languageCreateRequest(ctx, body, options) if err != nil { - return NamingModelClientLanguageResponse{}, err + return NamingClientModelClientLanguageResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return NamingModelClientLanguageResponse{}, err + return NamingClientModelClientLanguageResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) - return NamingModelClientLanguageResponse{}, err + return NamingClientModelClientLanguageResponse{}, err } - return NamingModelClientLanguageResponse{}, nil + return NamingClientModelClientLanguageResponse{}, nil } // languageCreateRequest creates the Language request. -func (client *NamingModelClient) languageCreateRequest(ctx context.Context, body GoModel, _ *NamingModelClientLanguageOptions) (*policy.Request, error) { +func (client *NamingClientModelClient) languageCreateRequest(ctx context.Context, body GoModel, _ *NamingClientModelClientLanguageOptions) (*policy.Request, error) { urlPath := "/client/naming/model/language" req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath)) if err != nil { diff --git a/packages/typespec-go/test/cadlranch/client/naminggroup/zz_options.go b/packages/typespec-go/test/cadlranch/client/naminggroup/zz_options.go index 02229696f..0c5c7dbe6 100644 --- a/packages/typespec-go/test/cadlranch/client/naminggroup/zz_options.go +++ b/packages/typespec-go/test/cadlranch/client/naminggroup/zz_options.go @@ -25,28 +25,28 @@ type NamingClientLanguageOptions struct { // placeholder for future optional parameters } -// NamingClientParameterOptions contains the optional parameters for the NamingClient.Parameter method. -type NamingClientParameterOptions struct { +// NamingClientModelClientClientOptions contains the optional parameters for the NamingClientModelClient.Client method. +type NamingClientModelClientClientOptions struct { // placeholder for future optional parameters } -// NamingClientRequestOptions contains the optional parameters for the NamingClient.Request method. -type NamingClientRequestOptions struct { +// NamingClientModelClientLanguageOptions contains the optional parameters for the NamingClientModelClient.Language method. +type NamingClientModelClientLanguageOptions struct { // placeholder for future optional parameters } -// NamingClientResponseOptions contains the optional parameters for the NamingClient.Response method. -type NamingClientResponseOptions struct { +// NamingClientParameterOptions contains the optional parameters for the NamingClient.Parameter method. +type NamingClientParameterOptions struct { // placeholder for future optional parameters } -// NamingModelClientClientOptions contains the optional parameters for the NamingModelClient.Client method. -type NamingModelClientClientOptions struct { +// NamingClientRequestOptions contains the optional parameters for the NamingClient.Request method. +type NamingClientRequestOptions struct { // placeholder for future optional parameters } -// NamingModelClientLanguageOptions contains the optional parameters for the NamingModelClient.Language method. -type NamingModelClientLanguageOptions struct { +// NamingClientResponseOptions contains the optional parameters for the NamingClient.Response method. +type NamingClientResponseOptions struct { // placeholder for future optional parameters } diff --git a/packages/typespec-go/test/cadlranch/client/naminggroup/zz_responses.go b/packages/typespec-go/test/cadlranch/client/naminggroup/zz_responses.go index f5eb148dd..39d86dd29 100644 --- a/packages/typespec-go/test/cadlranch/client/naminggroup/zz_responses.go +++ b/packages/typespec-go/test/cadlranch/client/naminggroup/zz_responses.go @@ -24,6 +24,16 @@ type NamingClientLanguageResponse struct { // placeholder for future response values } +// NamingClientModelClientClientResponse contains the response from method NamingClientModelClient.Client. +type NamingClientModelClientClientResponse struct { + // placeholder for future response values +} + +// NamingClientModelClientLanguageResponse contains the response from method NamingClientModelClient.Language. +type NamingClientModelClientLanguageResponse struct { + // placeholder for future response values +} + // NamingClientParameterResponse contains the response from method NamingClient.Parameter. type NamingClientParameterResponse struct { // placeholder for future response values @@ -39,16 +49,6 @@ type NamingClientResponseResponse struct { DefaultName *string } -// NamingModelClientClientResponse contains the response from method NamingModelClient.Client. -type NamingModelClientClientResponse struct { - // placeholder for future response values -} - -// NamingModelClientLanguageResponse contains the response from method NamingModelClient.Language. -type NamingModelClientLanguageResponse struct { - // placeholder for future response values -} - // NamingUnionEnumClientUnionEnumMemberNameResponse contains the response from method NamingUnionEnumClient.UnionEnumMemberName. type NamingUnionEnumClientUnionEnumMemberNameResponse struct { // placeholder for future response values diff --git a/packages/typespec-go/test/cadlranch/payload/multipartgroup/fake/zz_multipartformdata_server.go b/packages/typespec-go/test/cadlranch/payload/multipartgroup/fake/zz_multipartformdata_server.go index 5e8af92b4..b1d0da32a 100644 --- a/packages/typespec-go/test/cadlranch/payload/multipartgroup/fake/zz_multipartformdata_server.go +++ b/packages/typespec-go/test/cadlranch/payload/multipartgroup/fake/zz_multipartformdata_server.go @@ -237,11 +237,9 @@ func (m *MultiPartFormDataServerTransport) dispatchBinaryArrayParts(req *http.Re if err != nil { return nil, err } - body.Pictures = append(body.Pictures, streaming.MultipartContent{ - Body: streaming.NopCloser(bytes.NewReader(content)), - ContentType: part.Header.Get("Content-Type"), - Filename: part.FileName(), - }) + body.Pictures.Body = streaming.NopCloser(bytes.NewReader(content)) + body.Pictures.ContentType = part.Header.Get("Content-Type") + body.Pictures.Filename = part.FileName() default: return nil, fmt.Errorf("unexpected part %s", fn) } @@ -353,11 +351,9 @@ func (m *MultiPartFormDataServerTransport) dispatchComplex(req *http.Request) (* if err != nil { return nil, err } - body.Pictures = append(body.Pictures, streaming.MultipartContent{ - Body: streaming.NopCloser(bytes.NewReader(content)), - ContentType: part.Header.Get("Content-Type"), - Filename: part.FileName(), - }) + body.Pictures.Body = streaming.NopCloser(bytes.NewReader(content)) + body.Pictures.ContentType = part.Header.Get("Content-Type") + body.Pictures.Filename = part.FileName() case "previousAddresses": content, err = io.ReadAll(part) if err != nil { diff --git a/packages/typespec-go/test/cadlranch/payload/multipartgroup/zz_models.go b/packages/typespec-go/test/cadlranch/payload/multipartgroup/zz_models.go index bd36fd1c0..67d190d19 100644 --- a/packages/typespec-go/test/cadlranch/payload/multipartgroup/zz_models.go +++ b/packages/typespec-go/test/cadlranch/payload/multipartgroup/zz_models.go @@ -16,7 +16,7 @@ type BinaryArrayPartsRequest struct { ID string // REQUIRED - Pictures []streaming.MultipartContent + Pictures streaming.MultipartContent } type ComplexPartsRequest struct { @@ -27,10 +27,10 @@ type ComplexPartsRequest struct { ID string // REQUIRED - Pictures []streaming.MultipartContent + Pictures streaming.MultipartContent // REQUIRED - PreviousAddresses []Address + PreviousAddresses Address // REQUIRED ProfileImage streaming.MultipartContent @@ -38,7 +38,7 @@ type ComplexPartsRequest struct { type JSONArrayPartsRequest struct { // REQUIRED - PreviousAddresses []Address + PreviousAddresses Address // REQUIRED ProfileImage streaming.MultipartContent From da1d32c90accd874b729791d119590bae7532216 Mon Sep 17 00:00:00 2001 From: tadelesh Date: Tue, 30 Jul 2024 10:53:33 +0800 Subject: [PATCH 2/2] bump to tcgc 0.44.3 --- common/config/rush/pnpm-lock.yaml | 14 +++++++------- packages/typespec-go/package.json | 2 +- .../fake/zz_multipartformdata_server.go | 16 ++++++++++------ .../payload/multipartgroup/zz_models.go | 8 ++++---- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 2c71821a1..a59976258 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -206,8 +206,8 @@ importers: specifier: '>=0.44.0 <1.0.0' version: 0.44.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0) '@azure-tools/typespec-client-generator-core': - specifier: 0.44.2 - version: 0.44.2(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) + specifier: 0.44.3 + version: 0.44.3(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) '@typespec/compiler': specifier: 0.58.1 version: 0.58.1 @@ -238,7 +238,7 @@ importers: version: 0.34.9(@azure-tools/cadl-ranch-expect@0.14.1)(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) '@azure-tools/typespec-autorest': specifier: 0.44.1 - version: 0.44.1(@azure-tools/typespec-azure-core@0.44.0)(@azure-tools/typespec-azure-resource-manager@0.44.0)(@azure-tools/typespec-client-generator-core@0.44.2)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) + version: 0.44.1(@azure-tools/typespec-azure-core@0.44.0)(@azure-tools/typespec-azure-resource-manager@0.44.0)(@azure-tools/typespec-client-generator-core@0.44.3)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) '@azure-tools/typespec-azure-resource-manager': specifier: 0.44.0 version: 0.44.0(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) @@ -516,7 +516,7 @@ packages: engines: {node: '>=10.12.0'} dev: false - /@azure-tools/typespec-autorest@0.44.1(@azure-tools/typespec-azure-core@0.44.0)(@azure-tools/typespec-azure-resource-manager@0.44.0)(@azure-tools/typespec-client-generator-core@0.44.2)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): + /@azure-tools/typespec-autorest@0.44.1(@azure-tools/typespec-azure-core@0.44.0)(@azure-tools/typespec-azure-resource-manager@0.44.0)(@azure-tools/typespec-client-generator-core@0.44.3)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): resolution: {integrity: sha512-lw/iM659GuFgckDeRFFu0vx6wGBy814n+mjzbpi0Qwjvj8/hYULSjpty9P4WBDE30rYCUde1pWX5nK6TnwhOkQ==} engines: {node: '>=18.0.0'} peerDependencies: @@ -531,7 +531,7 @@ packages: dependencies: '@azure-tools/typespec-azure-core': 0.44.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/rest@0.58.0) '@azure-tools/typespec-azure-resource-manager': 0.44.0(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) - '@azure-tools/typespec-client-generator-core': 0.44.2(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) + '@azure-tools/typespec-client-generator-core': 0.44.3(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0) '@typespec/compiler': 0.58.1 '@typespec/http': 0.58.0(@typespec/compiler@0.58.1) '@typespec/openapi': 0.58.0(@typespec/compiler@0.58.1)(@typespec/http@0.58.0) @@ -572,8 +572,8 @@ packages: pluralize: 8.0.0 dev: true - /@azure-tools/typespec-client-generator-core@0.44.2(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): - resolution: {integrity: sha512-eIClpMxjMYxNeyYpdnD3BfWbPiDP0e7waTvBc5V1JQmFGKvh8H9dNeO4IaBqJ/O7WSDtuxweDmSUviZdBvuYNA==} + /@azure-tools/typespec-client-generator-core@0.44.3(@azure-tools/typespec-azure-core@0.44.0)(@typespec/compiler@0.58.1)(@typespec/http@0.58.0)(@typespec/openapi@0.58.0)(@typespec/rest@0.58.0)(@typespec/versioning@0.58.0): + resolution: {integrity: sha512-HXjxQs7ELrTuIDqOjlYhP4rM4AXb143klbiM8dkEGtqNBRCk77gVCGYVH1M3kWKAEs0dQKhzoUukscqRsfELuw==} engines: {node: '>=18.0.0'} peerDependencies: '@azure-tools/typespec-azure-core': ~0.44.0 diff --git a/packages/typespec-go/package.json b/packages/typespec-go/package.json index 9dc52a810..e332a3544 100644 --- a/packages/typespec-go/package.json +++ b/packages/typespec-go/package.json @@ -66,7 +66,7 @@ "@azure-tools/codegen": "~2.9.2", "@azure-tools/linq": "~3.1.0", "@azure-tools/typespec-azure-core": ">=0.44.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": "0.44.2", + "@azure-tools/typespec-client-generator-core": "0.44.3", "@typespec/compiler": "0.58.1", "@typespec/http": "0.58.0", "@typespec/rest": "0.58.0", diff --git a/packages/typespec-go/test/cadlranch/payload/multipartgroup/fake/zz_multipartformdata_server.go b/packages/typespec-go/test/cadlranch/payload/multipartgroup/fake/zz_multipartformdata_server.go index b1d0da32a..5e8af92b4 100644 --- a/packages/typespec-go/test/cadlranch/payload/multipartgroup/fake/zz_multipartformdata_server.go +++ b/packages/typespec-go/test/cadlranch/payload/multipartgroup/fake/zz_multipartformdata_server.go @@ -237,9 +237,11 @@ func (m *MultiPartFormDataServerTransport) dispatchBinaryArrayParts(req *http.Re if err != nil { return nil, err } - body.Pictures.Body = streaming.NopCloser(bytes.NewReader(content)) - body.Pictures.ContentType = part.Header.Get("Content-Type") - body.Pictures.Filename = part.FileName() + body.Pictures = append(body.Pictures, streaming.MultipartContent{ + Body: streaming.NopCloser(bytes.NewReader(content)), + ContentType: part.Header.Get("Content-Type"), + Filename: part.FileName(), + }) default: return nil, fmt.Errorf("unexpected part %s", fn) } @@ -351,9 +353,11 @@ func (m *MultiPartFormDataServerTransport) dispatchComplex(req *http.Request) (* if err != nil { return nil, err } - body.Pictures.Body = streaming.NopCloser(bytes.NewReader(content)) - body.Pictures.ContentType = part.Header.Get("Content-Type") - body.Pictures.Filename = part.FileName() + body.Pictures = append(body.Pictures, streaming.MultipartContent{ + Body: streaming.NopCloser(bytes.NewReader(content)), + ContentType: part.Header.Get("Content-Type"), + Filename: part.FileName(), + }) case "previousAddresses": content, err = io.ReadAll(part) if err != nil { diff --git a/packages/typespec-go/test/cadlranch/payload/multipartgroup/zz_models.go b/packages/typespec-go/test/cadlranch/payload/multipartgroup/zz_models.go index 67d190d19..bd36fd1c0 100644 --- a/packages/typespec-go/test/cadlranch/payload/multipartgroup/zz_models.go +++ b/packages/typespec-go/test/cadlranch/payload/multipartgroup/zz_models.go @@ -16,7 +16,7 @@ type BinaryArrayPartsRequest struct { ID string // REQUIRED - Pictures streaming.MultipartContent + Pictures []streaming.MultipartContent } type ComplexPartsRequest struct { @@ -27,10 +27,10 @@ type ComplexPartsRequest struct { ID string // REQUIRED - Pictures streaming.MultipartContent + Pictures []streaming.MultipartContent // REQUIRED - PreviousAddresses Address + PreviousAddresses []Address // REQUIRED ProfileImage streaming.MultipartContent @@ -38,7 +38,7 @@ type ComplexPartsRequest struct { type JSONArrayPartsRequest struct { // REQUIRED - PreviousAddresses Address + PreviousAddresses []Address // REQUIRED ProfileImage streaming.MultipartContent