diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7020897ca819..dc3a923e56da 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1634,6 +1634,9 @@ sdk/managedops/arm-managedops/ @qiaozha @MaryGao @JialinHuang803 # PRLabel: %Mgmt sdk/containerregistry/arm-containerregistrytasks/ @qiaozha @MaryGao @JialinHuang803 +# PRLabel: %Mgmt +sdk/artifactsigning/arm-artifactsigning/ @qiaozha @MaryGao @JialinHuang803 + ########### # Config ########### diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index cb8c9bebfce7..20ef18dd999e 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -59,6 +59,9 @@ https://learn.microsoft.com/javascript/api/@azure/arm-edgeactions?view=azure-nod https://learn.microsoft.com/javascript/api/@azure/arm-dell-storage https://learn.microsoft.com/javascript/api/@azure/arm-managedops?view=azure-node-preview https://learn.microsoft.com/javascript/api/@azure/arm-containerregistrytasks?view=azure-node-preview +https://learn.microsoft.com/javascript/api/@azure/arm-artifactsigning?view=azure-node-preview +https://learn.microsoft.com/javascript/api/@azure/arm-artifactsigning https://www.npmjs.com/package/@azure/arm-managedops https://www.npmjs.com/package/@azure/arm-edgeactions https://www.npmjs.com/package/@azure/arm-containerregistrytasks +https://www.npmjs.com/package/@azure/arm-artifactsigning \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index be10f86683fc..01135499762b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2177,6 +2177,88 @@ importers: specifier: catalog:testing version: 4.0.18(@opentelemetry/api@1.9.0)(@types/node@20.19.33)(@vitest/browser-playwright@4.0.18)(tsx@4.21.0)(yaml@2.8.2) + sdk/artifactsigning/arm-artifactsigning: + dependencies: + '@azure-rest/core-client': + specifier: ^2.3.1 + version: link:../../core/core-client-rest + '@azure/abort-controller': + specifier: ^2.1.2 + version: link:../../core/abort-controller + '@azure/core-auth': + specifier: ^1.9.0 + version: link:../../core/core-auth + '@azure/core-lro': + specifier: ^3.1.0 + version: link:../../core/core-lro + '@azure/core-rest-pipeline': + specifier: ^1.20.0 + version: link:../../core/core-rest-pipeline + '@azure/core-util': + specifier: ^1.12.0 + version: link:../../core/core-util + '@azure/logger': + specifier: ^1.2.0 + version: link:../../core/logger + tslib: + specifier: ^2.8.1 + version: 2.8.1 + devDependencies: + '@azure-tools/test-credential': + specifier: workspace:^ + version: link:../../test-utils/test-credential + '@azure-tools/test-recorder': + specifier: workspace:^ + version: link:../../test-utils/recorder + '@azure-tools/test-utils-vitest': + specifier: workspace:^ + version: link:../../test-utils/test-utils-vitest + '@azure/dev-tool': + specifier: workspace:^ + version: link:../../../common/tools/dev-tool + '@azure/eslint-plugin-azure-sdk': + specifier: workspace:^ + version: link:../../../common/tools/eslint-plugin-azure-sdk + '@azure/identity': + specifier: catalog:internal + version: 4.13.0 + '@types/node': + specifier: 'catalog:' + version: 20.19.33 + '@vitest/browser-playwright': + specifier: catalog:testing + version: 4.0.18(playwright@1.58.2)(vite@7.3.1(@types/node@20.19.33)(tsx@4.21.0)(yaml@2.8.2))(vitest@4.0.18) + '@vitest/coverage-istanbul': + specifier: catalog:testing + version: 4.0.18(vitest@4.0.18) + cross-env: + specifier: 'catalog:' + version: 10.1.0 + dotenv: + specifier: catalog:testing + version: 16.6.1 + eslint: + specifier: 'catalog:' + version: 9.39.2 + playwright: + specifier: catalog:testing + version: 1.58.2 + prettier: + specifier: 'catalog:' + version: 3.8.1 + rimraf: + specifier: 'catalog:' + version: 6.1.2 + tshy: + specifier: 'catalog:' + version: 3.1.3 + typescript: + specifier: 'catalog:' + version: 5.9.3 + vitest: + specifier: catalog:testing + version: 4.0.18(@opentelemetry/api@1.9.0)(@types/node@20.19.33)(@vitest/browser-playwright@4.0.18)(tsx@4.21.0)(yaml@2.8.2) + sdk/astro/arm-astro: dependencies: '@azure/abort-controller': diff --git a/sdk/artifactsigning/arm-artifactsigning/CHANGELOG.md b/sdk/artifactsigning/arm-artifactsigning/CHANGELOG.md new file mode 100644 index 000000000000..c83e3416026d --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 1.0.0 (2026-02-11) + +### Features Added + +Initial release of the @azure/arm-artifactsigning package diff --git a/sdk/artifactsigning/arm-artifactsigning/LICENSE b/sdk/artifactsigning/arm-artifactsigning/LICENSE new file mode 100644 index 000000000000..63447fd8bbbf --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/artifactsigning/arm-artifactsigning/README.md b/sdk/artifactsigning/arm-artifactsigning/README.md new file mode 100644 index 000000000000..924f11eb3b7d --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/README.md @@ -0,0 +1,115 @@ +# Azure CodeSigningManagement client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure CodeSigningManagement client. + +Code Signing resource provider api. + +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/artifactsigning/arm-artifactsigning) +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-artifactsigning) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-artifactsigning) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/artifactsigning/arm-artifactsigning/samples) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-artifactsigning` package + +Install the Azure CodeSigningManagement client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-artifactsigning +``` + +### Create and authenticate a `CodeSigningClient` + +To create a client object to access the Azure CodeSigningManagement API, you will need the `endpoint` of your Azure CodeSigningManagement resource and a `credential`. The Azure CodeSigningManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure CodeSigningManagement resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure CodeSigningManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). + +For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +Using Node.js and Node-like environments, you can use the `DefaultAzureCredential` class to authenticate the client. + +```ts snippet:ReadmeSampleCreateClient_Node +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new CodeSigningClient(new DefaultAzureCredential(), subscriptionId); +``` + +For browser environments, use the `InteractiveBrowserCredential` from the `@azure/identity` package to authenticate. + +```ts snippet:ReadmeSampleCreateClient_Browser +import { InteractiveBrowserCredential } from "@azure/identity"; +import { CodeSigningClient } from "@azure/arm-artifactsigning"; + +const credential = new InteractiveBrowserCredential({ + tenantId: "", + clientId: "", +}); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new CodeSigningClient(credential, subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### CodeSigningClient + +`CodeSigningClient` is the primary interface for developers using the Azure CodeSigningManagement client library. Explore the methods on this client object to understand the different features of the Azure CodeSigningManagement service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```ts snippet:SetLogLevel +import { setLogLevel } from "@azure/logger"; + +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/artifactsigning/arm-artifactsigning/samples) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/artifactsigning/arm-artifactsigning/api-extractor.json b/sdk/artifactsigning/arm-artifactsigning/api-extractor.json new file mode 100644 index 000000000000..870d6d399477 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/api-extractor.json @@ -0,0 +1 @@ +{ "extends": "../../../api-extractor-base.json" } diff --git a/sdk/artifactsigning/arm-artifactsigning/eslint.config.mjs b/sdk/artifactsigning/arm-artifactsigning/eslint.config.mjs new file mode 100644 index 000000000000..6d2f8a5914c3 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/eslint.config.mjs @@ -0,0 +1,14 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default azsdkEslint.config([ + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn", + }, + }, +]); diff --git a/sdk/artifactsigning/arm-artifactsigning/metadata.json b/sdk/artifactsigning/arm-artifactsigning/metadata.json new file mode 100644 index 000000000000..056ac09d5bb5 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/metadata.json @@ -0,0 +1,60 @@ +{ + "apiVersion": "2025-10-13", + "emitterVersion": "0.49.0", + "crossLanguageDefinitions": { + "CrossLanguagePackageId": "Microsoft.CodeSigning", + "CrossLanguageDefinitionId": { + "@azure/arm-artifactsigning!OperationListResult:interface": "Azure.ResourceManager.CommonTypes.OperationListResult", + "@azure/arm-artifactsigning!Operation:interface": "Azure.ResourceManager.CommonTypes.Operation", + "@azure/arm-artifactsigning!OperationDisplay:interface": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "@azure/arm-artifactsigning!ErrorResponse:interface": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "@azure/arm-artifactsigning!ErrorDetail:interface": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "@azure/arm-artifactsigning!ErrorAdditionalInfo:interface": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "@azure/arm-artifactsigning!CodeSigningAccount:interface": "Microsoft.CodeSigning.CodeSigningAccount", + "@azure/arm-artifactsigning!CodeSigningAccountProperties:interface": "Microsoft.CodeSigning.CodeSigningAccountProperties", + "@azure/arm-artifactsigning!AccountSku:interface": "Microsoft.CodeSigning.AccountSku", + "@azure/arm-artifactsigning!TrackedResource:interface": "Azure.ResourceManager.CommonTypes.TrackedResource", + "@azure/arm-artifactsigning!Resource:interface": "Azure.ResourceManager.CommonTypes.Resource", + "@azure/arm-artifactsigning!SystemData:interface": "Azure.ResourceManager.CommonTypes.SystemData", + "@azure/arm-artifactsigning!CodeSigningAccountPatch:interface": "Microsoft.CodeSigning.CodeSigningAccountPatch", + "@azure/arm-artifactsigning!CodeSigningAccountPatchProperties:interface": "Microsoft.CodeSigning.CodeSigningAccountPatchProperties", + "@azure/arm-artifactsigning!AccountSkuPatch:interface": "Microsoft.CodeSigning.AccountSkuPatch", + "@azure/arm-artifactsigning!ArmOperationStatusResourceProvisioningState:interface": "Azure.ResourceManager.ArmOperationStatus", + "@azure/arm-artifactsigning!CodeSigningAccountListResult:interface": "Azure.ResourceManager.ResourceListResult", + "@azure/arm-artifactsigning!CheckNameAvailability:interface": "Microsoft.CodeSigning.CheckNameAvailability", + "@azure/arm-artifactsigning!CheckNameAvailabilityResult:interface": "Microsoft.CodeSigning.CheckNameAvailabilityResult", + "@azure/arm-artifactsigning!CertificateProfile:interface": "Microsoft.CodeSigning.CertificateProfile", + "@azure/arm-artifactsigning!CertificateProfileProperties:interface": "Microsoft.CodeSigning.CertificateProfileProperties", + "@azure/arm-artifactsigning!Certificate:interface": "Microsoft.CodeSigning.Certificate", + "@azure/arm-artifactsigning!Revocation:interface": "Microsoft.CodeSigning.Revocation", + "@azure/arm-artifactsigning!ProxyResource:interface": "Azure.ResourceManager.CommonTypes.ProxyResource", + "@azure/arm-artifactsigning!CertificateProfileListResult:interface": "Azure.ResourceManager.ResourceListResult", + "@azure/arm-artifactsigning!RevokeCertificate:interface": "Microsoft.CodeSigning.RevokeCertificate", + "@azure/arm-artifactsigning!KnownOrigin:enum": "Azure.ResourceManager.CommonTypes.Origin", + "@azure/arm-artifactsigning!KnownActionType:enum": "Azure.ResourceManager.CommonTypes.ActionType", + "@azure/arm-artifactsigning!KnownSkuName:enum": "Microsoft.CodeSigning.SkuName", + "@azure/arm-artifactsigning!KnownProvisioningState:enum": "Microsoft.CodeSigning.ProvisioningState", + "@azure/arm-artifactsigning!KnowncreatedByType:enum": "Azure.ResourceManager.CommonTypes.createdByType", + "@azure/arm-artifactsigning!KnownResourceProvisioningState:enum": "Azure.ResourceManager.ResourceProvisioningState", + "@azure/arm-artifactsigning!KnownNameUnavailabilityReason:enum": "Microsoft.CodeSigning.NameUnavailabilityReason", + "@azure/arm-artifactsigning!KnownProfileType:enum": "Microsoft.CodeSigning.ProfileType", + "@azure/arm-artifactsigning!KnownCertificateProfileStatus:enum": "Microsoft.CodeSigning.CertificateProfileStatus", + "@azure/arm-artifactsigning!KnownCertificateStatus:enum": "Microsoft.CodeSigning.CertificateStatus", + "@azure/arm-artifactsigning!KnownRevocationStatus:enum": "Microsoft.CodeSigning.RevocationStatus", + "@azure/arm-artifactsigning!KnownVersions:enum": "Microsoft.CodeSigning.Versions", + "@azure/arm-artifactsigning!CertificateProfilesOperations#revokeCertificate:member": "Microsoft.CodeSigning.CertificateProfiles.revokeCertificate", + "@azure/arm-artifactsigning!CertificateProfilesOperations#listByCodeSigningAccount:member": "Microsoft.CodeSigning.CertificateProfiles.listByCodeSigningAccount", + "@azure/arm-artifactsigning!CertificateProfilesOperations#delete:member": "Microsoft.CodeSigning.CertificateProfiles.delete", + "@azure/arm-artifactsigning!CertificateProfilesOperations#create:member": "Microsoft.CodeSigning.CertificateProfiles.create", + "@azure/arm-artifactsigning!CertificateProfilesOperations#get:member": "Microsoft.CodeSigning.CertificateProfiles.get", + "@azure/arm-artifactsigning!CodeSigningAccountsOperations#checkNameAvailability:member": "Microsoft.CodeSigning.CodeSigningAccounts.checkNameAvailability", + "@azure/arm-artifactsigning!CodeSigningAccountsOperations#listBySubscription:member": "Microsoft.CodeSigning.CodeSigningAccounts.listBySubscription", + "@azure/arm-artifactsigning!CodeSigningAccountsOperations#listByResourceGroup:member": "Microsoft.CodeSigning.CodeSigningAccounts.listByResourceGroup", + "@azure/arm-artifactsigning!CodeSigningAccountsOperations#delete:member": "Microsoft.CodeSigning.CodeSigningAccounts.delete", + "@azure/arm-artifactsigning!CodeSigningAccountsOperations#update:member": "Microsoft.CodeSigning.CodeSigningAccounts.update", + "@azure/arm-artifactsigning!CodeSigningAccountsOperations#create:member": "Microsoft.CodeSigning.CodeSigningAccounts.create", + "@azure/arm-artifactsigning!CodeSigningAccountsOperations#get:member": "Microsoft.CodeSigning.CodeSigningAccounts.get", + "@azure/arm-artifactsigning!OperationsOperations#list:member": "Azure.ResourceManager.Operations.list" + } + } +} diff --git a/sdk/artifactsigning/arm-artifactsigning/package.json b/sdk/artifactsigning/arm-artifactsigning/package.json new file mode 100644 index 000000000000..72436621cd0d --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/package.json @@ -0,0 +1,235 @@ +{ + "name": "@azure/arm-artifactsigning", + "version": "1.0.0", + "description": "A generated SDK for CodeSigningClient.", + "engines": { + "node": ">=20.0.0" + }, + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./api/certificateProfiles": "./src/api/certificateProfiles/index.ts", + "./api/codeSigningAccounts": "./src/api/codeSigningAccounts/index.ts", + "./api/operations": "./src/api/operations/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false, + "project": "../../../tsconfig.src.build.json" + }, + "type": "module", + "browser": "./dist/browser/index.js", + "react-native": "./dist/react-native/index.js", + "keywords": [ + "node", + "azure", + "cloud", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "files": [ + "dist/", + "!dist/**/*.d.*ts.map", + "README.md", + "LICENSE" + ], + "sdk-type": "mgmt", + "repository": "github:Azure/azure-sdk-for-js", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/artifactsigning/arm-artifactsigning/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/codeSigningContext.ts", + "prefix": "userAgentInfo" + } + ] + }, + "dependencies": { + "@azure/core-util": "^1.12.0", + "@azure-rest/core-client": "^2.3.1", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.9.0", + "@azure/core-lro": "^3.1.0", + "@azure/core-rest-pipeline": "^1.20.0", + "@azure/logger": "^1.2.0", + "tslib": "^2.8.1" + }, + "devDependencies": { + "@azure-tools/test-credential": "workspace:^", + "@azure-tools/test-recorder": "workspace:^", + "@azure-tools/test-utils-vitest": "workspace:^", + "@azure/dev-tool": "workspace:^", + "tshy": "catalog:", + "@azure/eslint-plugin-azure-sdk": "workspace:^", + "@azure/identity": "catalog:internal", + "@types/node": "catalog:", + "cross-env": "catalog:", + "eslint": "catalog:", + "prettier": "catalog:", + "rimraf": "catalog:", + "@vitest/browser-playwright": "catalog:testing", + "@vitest/coverage-istanbul": "catalog:testing", + "dotenv": "catalog:testing", + "playwright": "catalog:testing", + "typescript": "catalog:", + "vitest": "catalog:testing" + }, + "scripts": { + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "extract-api": "rimraf review && dev-tool run extract-api", + "pack": "pnpm pack 2>&1", + "lint": "echo skipped", + "lint:fix": "echo skipped", + "build:samples": "tsc -p tsconfig.samples.json && dev-tool samples publish -f", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "execute:samples": "dev-tool samples run samples-dev", + "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "generate:client": "echo skipped", + "test:browser": "dev-tool run build-test && dev-tool run test:vitest --browser", + "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", + "test:node": "dev-tool run test:vitest", + "test:node:esm": "dev-tool run test:vitest --esm", + "test": "npm run test:node && npm run test:browser", + "update-snippets": "dev-tool run update-snippets" + }, + "//sampleConfiguration": { + "productName": "@azure/arm-artifactsigning", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/arm-artifactsigning?view=azure-node-preview" + }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "react-native": { + "types": "./dist/react-native/index.d.ts", + "default": "./dist/react-native/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./api": { + "browser": { + "types": "./dist/browser/api/index.d.ts", + "default": "./dist/browser/api/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/index.d.ts", + "default": "./dist/react-native/api/index.js" + }, + "import": { + "types": "./dist/esm/api/index.d.ts", + "default": "./dist/esm/api/index.js" + }, + "require": { + "types": "./dist/commonjs/api/index.d.ts", + "default": "./dist/commonjs/api/index.js" + } + }, + "./api/certificateProfiles": { + "browser": { + "types": "./dist/browser/api/certificateProfiles/index.d.ts", + "default": "./dist/browser/api/certificateProfiles/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/certificateProfiles/index.d.ts", + "default": "./dist/react-native/api/certificateProfiles/index.js" + }, + "import": { + "types": "./dist/esm/api/certificateProfiles/index.d.ts", + "default": "./dist/esm/api/certificateProfiles/index.js" + }, + "require": { + "types": "./dist/commonjs/api/certificateProfiles/index.d.ts", + "default": "./dist/commonjs/api/certificateProfiles/index.js" + } + }, + "./api/codeSigningAccounts": { + "browser": { + "types": "./dist/browser/api/codeSigningAccounts/index.d.ts", + "default": "./dist/browser/api/codeSigningAccounts/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/codeSigningAccounts/index.d.ts", + "default": "./dist/react-native/api/codeSigningAccounts/index.js" + }, + "import": { + "types": "./dist/esm/api/codeSigningAccounts/index.d.ts", + "default": "./dist/esm/api/codeSigningAccounts/index.js" + }, + "require": { + "types": "./dist/commonjs/api/codeSigningAccounts/index.d.ts", + "default": "./dist/commonjs/api/codeSigningAccounts/index.js" + } + }, + "./api/operations": { + "browser": { + "types": "./dist/browser/api/operations/index.d.ts", + "default": "./dist/browser/api/operations/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/operations/index.d.ts", + "default": "./dist/react-native/api/operations/index.js" + }, + "import": { + "types": "./dist/esm/api/operations/index.d.ts", + "default": "./dist/esm/api/operations/index.js" + }, + "require": { + "types": "./dist/commonjs/api/operations/index.d.ts", + "default": "./dist/commonjs/api/operations/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" +} diff --git a/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-api-certificateProfiles-node.api.md b/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-api-certificateProfiles-node.api.md new file mode 100644 index 000000000000..2aaacdc424e1 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-api-certificateProfiles-node.api.md @@ -0,0 +1,51 @@ +## API Report File for "@azure/arm-artifactsigning" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: CodeSigningContext, resourceGroupName: string, accountName: string, profileName: string, options?: CertificateProfilesDeleteOptionalParams): PollerLike, void>; + +// @public +export interface CertificateProfilesCreateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface CertificateProfilesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface CertificateProfilesGetOptionalParams extends OperationOptions { +} + +// @public +export interface CertificateProfilesListByCodeSigningAccountOptionalParams extends OperationOptions { +} + +// @public +export interface CertificateProfilesRevokeCertificateOptionalParams extends OperationOptions { +} + +// @public +export function create(context: CodeSigningContext, resourceGroupName: string, accountName: string, profileName: string, resource: CertificateProfile, options?: CertificateProfilesCreateOptionalParams): PollerLike, CertificateProfile>; + +// @public +export function get(context: CodeSigningContext, resourceGroupName: string, accountName: string, profileName: string, options?: CertificateProfilesGetOptionalParams): Promise; + +// @public +export function listByCodeSigningAccount(context: CodeSigningContext, resourceGroupName: string, accountName: string, options?: CertificateProfilesListByCodeSigningAccountOptionalParams): PagedAsyncIterableIterator; + +// @public +export function revokeCertificate(context: CodeSigningContext, resourceGroupName: string, accountName: string, profileName: string, body: RevokeCertificate, options?: CertificateProfilesRevokeCertificateOptionalParams): Promise; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-api-codeSigningAccounts-node.api.md b/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-api-codeSigningAccounts-node.api.md new file mode 100644 index 000000000000..d7e221eafcc1 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-api-codeSigningAccounts-node.api.md @@ -0,0 +1,66 @@ +## API Report File for "@azure/arm-artifactsigning" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: CodeSigningContext, resourceGroupName: string, accountName: string, options?: CodeSigningAccountsDeleteOptionalParams): PollerLike, void>; + +// @public +export function checkNameAvailability(context: CodeSigningContext, body: CheckNameAvailability, options?: CodeSigningAccountsCheckNameAvailabilityOptionalParams): Promise; + +// @public +export interface CodeSigningAccountsCheckNameAvailabilityOptionalParams extends OperationOptions { +} + +// @public +export interface CodeSigningAccountsCreateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface CodeSigningAccountsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface CodeSigningAccountsGetOptionalParams extends OperationOptions { +} + +// @public +export interface CodeSigningAccountsListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface CodeSigningAccountsListBySubscriptionOptionalParams extends OperationOptions { +} + +// @public +export interface CodeSigningAccountsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function create(context: CodeSigningContext, resourceGroupName: string, accountName: string, resource: CodeSigningAccount, options?: CodeSigningAccountsCreateOptionalParams): PollerLike, CodeSigningAccount>; + +// @public +export function get(context: CodeSigningContext, resourceGroupName: string, accountName: string, options?: CodeSigningAccountsGetOptionalParams): Promise; + +// @public +export function listByResourceGroup(context: CodeSigningContext, resourceGroupName: string, options?: CodeSigningAccountsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listBySubscription(context: CodeSigningContext, options?: CodeSigningAccountsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + +// @public +export function update(context: CodeSigningContext, resourceGroupName: string, accountName: string, properties: CodeSigningAccountPatch, options?: CodeSigningAccountsUpdateOptionalParams): PollerLike, CodeSigningAccount>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-api-node.api.md b/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-api-node.api.md new file mode 100644 index 000000000000..553d6ddab210 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-api-node.api.md @@ -0,0 +1,28 @@ +## API Report File for "@azure/arm-artifactsigning" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { TokenCredential } from '@azure/core-auth'; + +// @public +export interface CodeSigningClientOptionalParams extends ClientOptions { + apiVersion?: string; + cloudSetting?: AzureSupportedClouds; +} + +// @public +export interface CodeSigningContext extends Client { + apiVersion?: string; + subscriptionId: string; +} + +// @public +export function createCodeSigning(credential: TokenCredential, subscriptionId: string, options?: CodeSigningClientOptionalParams): CodeSigningContext; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-api-operations-node.api.md b/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-api-operations-node.api.md new file mode 100644 index 000000000000..c15a5f6a9949 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-api-operations-node.api.md @@ -0,0 +1,19 @@ +## API Report File for "@azure/arm-artifactsigning" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { Client } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; + +// @public +export function list(context: CodeSigningContext, options?: OperationsListOptionalParams): PagedAsyncIterableIterator; + +// @public +export interface OperationsListOptionalParams extends OperationOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-models-node.api.md b/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-models-node.api.md new file mode 100644 index 000000000000..bd2e7605b9de --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-models-node.api.md @@ -0,0 +1,277 @@ +## API Report File for "@azure/arm-artifactsigning" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// @public +export interface AccountSku { + name: SkuName; +} + +// @public +export interface AccountSkuPatch { + name?: SkuName; +} + +// @public +export type ActionType = string; + +// @public +export interface Certificate { + createdDate?: string; + enhancedKeyUsage?: string; + expiryDate?: string; + revocation?: Revocation; + serialNumber?: string; + status?: CertificateStatus; + subjectName?: string; + thumbprint?: string; +} + +// @public +export interface CertificateProfile extends ProxyResource { + properties?: CertificateProfileProperties; +} + +// @public +export interface CertificateProfileProperties { + readonly certificates?: Certificate[]; + identityValidationId: string; + includeCity?: boolean; + includeCountry?: boolean; + includePostalCode?: boolean; + includeState?: boolean; + includeStreetAddress?: boolean; + profileType: ProfileType; + readonly provisioningState?: ProvisioningState; + readonly status?: CertificateProfileStatus; +} + +// @public +export type CertificateProfileStatus = string; + +// @public +export type CertificateStatus = string; + +// @public +export interface CheckNameAvailability { + name: string; + type: string; +} + +// @public +export interface CheckNameAvailabilityResult { + readonly message?: string; + readonly nameAvailable?: boolean; + readonly reason?: NameUnavailabilityReason; +} + +// @public +export interface CodeSigningAccount extends TrackedResource { + properties?: CodeSigningAccountProperties; +} + +// @public +export interface CodeSigningAccountPatch { + properties?: CodeSigningAccountPatchProperties; + tags?: Record; +} + +// @public +export interface CodeSigningAccountPatchProperties { + sku?: AccountSkuPatch; +} + +// @public +export interface CodeSigningAccountProperties { + readonly accountUri?: string; + readonly provisioningState?: ProvisioningState; + sku?: AccountSku; +} + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: any; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownCertificateProfileStatus { + Active = "Active", + Disabled = "Disabled", + Suspended = "Suspended" +} + +// @public +export enum KnownCertificateStatus { + Active = "Active", + Expired = "Expired", + Revoked = "Revoked" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownNameUnavailabilityReason { + AccountNameInvalid = "AccountNameInvalid", + AlreadyExists = "AlreadyExists" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownProfileType { + PrivateTrust = "PrivateTrust", + PrivateTrustCIPolicy = "PrivateTrustCIPolicy", + PublicTrust = "PublicTrust", + PublicTrustTest = "PublicTrustTest", + VBSEnclave = "VBSEnclave" +} + +// @public +export enum KnownProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded", + Updating = "Updating" +} + +// @public +export enum KnownRevocationStatus { + Failed = "Failed", + InProgress = "InProgress", + Succeeded = "Succeeded" +} + +// @public +export enum KnownSkuName { + Basic = "Basic", + Premium = "Premium" +} + +// @public +export enum KnownVersions { + V20251013 = "2025-10-13" +} + +// @public +export type NameUnavailabilityReason = string; + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export type Origin = string; + +// @public +export type ProfileType = string; + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface Revocation { + effectiveAt?: Date; + failureReason?: string; + reason?: string; + remarks?: string; + requestedAt?: Date; + status?: RevocationStatus; +} + +// @public +export type RevocationStatus = string; + +// @public +export interface RevokeCertificate { + effectiveAt: Date; + reason: string; + remarks?: string; + serialNumber: string; + thumbprint: string; +} + +// @public +export type SkuName = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-node.api.md b/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-node.api.md new file mode 100644 index 000000000000..ac4de90805a1 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/review/arm-artifactsigning-node.api.md @@ -0,0 +1,420 @@ +## API Report File for "@azure/arm-artifactsigning" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { AbortSignalLike } from '@azure/abort-controller'; +import type { ClientOptions } from '@azure-rest/core-client'; +import type { OperationOptions } from '@azure-rest/core-client'; +import type { OperationState } from '@azure/core-lro'; +import type { PathUncheckedResponse } from '@azure-rest/core-client'; +import type { Pipeline } from '@azure/core-rest-pipeline'; +import type { PollerLike } from '@azure/core-lro'; +import type { TokenCredential } from '@azure/core-auth'; + +// @public +export interface AccountSku { + name: SkuName; +} + +// @public +export interface AccountSkuPatch { + name?: SkuName; +} + +// @public +export type ActionType = string; + +// @public +export enum AzureClouds { + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT" +} + +// @public +export type AzureSupportedClouds = `${AzureClouds}`; + +// @public +export interface Certificate { + createdDate?: string; + enhancedKeyUsage?: string; + expiryDate?: string; + revocation?: Revocation; + serialNumber?: string; + status?: CertificateStatus; + subjectName?: string; + thumbprint?: string; +} + +// @public +export interface CertificateProfile extends ProxyResource { + properties?: CertificateProfileProperties; +} + +// @public +export interface CertificateProfileProperties { + readonly certificates?: Certificate[]; + identityValidationId: string; + includeCity?: boolean; + includeCountry?: boolean; + includePostalCode?: boolean; + includeState?: boolean; + includeStreetAddress?: boolean; + profileType: ProfileType; + readonly provisioningState?: ProvisioningState; + readonly status?: CertificateProfileStatus; +} + +// @public +export interface CertificateProfilesCreateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface CertificateProfilesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface CertificateProfilesGetOptionalParams extends OperationOptions { +} + +// @public +export interface CertificateProfilesListByCodeSigningAccountOptionalParams extends OperationOptions { +} + +// @public +export interface CertificateProfilesOperations { + create: (resourceGroupName: string, accountName: string, profileName: string, resource: CertificateProfile, options?: CertificateProfilesCreateOptionalParams) => PollerLike, CertificateProfile>; + delete: (resourceGroupName: string, accountName: string, profileName: string, options?: CertificateProfilesDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, accountName: string, profileName: string, options?: CertificateProfilesGetOptionalParams) => Promise; + listByCodeSigningAccount: (resourceGroupName: string, accountName: string, options?: CertificateProfilesListByCodeSigningAccountOptionalParams) => PagedAsyncIterableIterator; + revokeCertificate: (resourceGroupName: string, accountName: string, profileName: string, body: RevokeCertificate, options?: CertificateProfilesRevokeCertificateOptionalParams) => Promise; +} + +// @public +export interface CertificateProfilesRevokeCertificateOptionalParams extends OperationOptions { +} + +// @public +export type CertificateProfileStatus = string; + +// @public +export type CertificateStatus = string; + +// @public +export interface CheckNameAvailability { + name: string; + type: string; +} + +// @public +export interface CheckNameAvailabilityResult { + readonly message?: string; + readonly nameAvailable?: boolean; + readonly reason?: NameUnavailabilityReason; +} + +// @public +export interface CodeSigningAccount extends TrackedResource { + properties?: CodeSigningAccountProperties; +} + +// @public +export interface CodeSigningAccountPatch { + properties?: CodeSigningAccountPatchProperties; + tags?: Record; +} + +// @public +export interface CodeSigningAccountPatchProperties { + sku?: AccountSkuPatch; +} + +// @public +export interface CodeSigningAccountProperties { + readonly accountUri?: string; + readonly provisioningState?: ProvisioningState; + sku?: AccountSku; +} + +// @public +export interface CodeSigningAccountsCheckNameAvailabilityOptionalParams extends OperationOptions { +} + +// @public +export interface CodeSigningAccountsCreateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface CodeSigningAccountsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface CodeSigningAccountsGetOptionalParams extends OperationOptions { +} + +// @public +export interface CodeSigningAccountsListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface CodeSigningAccountsListBySubscriptionOptionalParams extends OperationOptions { +} + +// @public +export interface CodeSigningAccountsOperations { + checkNameAvailability: (body: CheckNameAvailability, options?: CodeSigningAccountsCheckNameAvailabilityOptionalParams) => Promise; + create: (resourceGroupName: string, accountName: string, resource: CodeSigningAccount, options?: CodeSigningAccountsCreateOptionalParams) => PollerLike, CodeSigningAccount>; + delete: (resourceGroupName: string, accountName: string, options?: CodeSigningAccountsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, accountName: string, options?: CodeSigningAccountsGetOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: CodeSigningAccountsListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: CodeSigningAccountsListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, accountName: string, properties: CodeSigningAccountPatch, options?: CodeSigningAccountsUpdateOptionalParams) => PollerLike, CodeSigningAccount>; +} + +// @public +export interface CodeSigningAccountsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public (undocumented) +export class CodeSigningClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: CodeSigningClientOptionalParams); + readonly certificateProfiles: CertificateProfilesOperations; + readonly codeSigningAccounts: CodeSigningAccountsOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; +} + +// @public +export interface CodeSigningClientOptionalParams extends ClientOptions { + apiVersion?: string; + cloudSetting?: AzureSupportedClouds; +} + +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: any; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownCertificateProfileStatus { + Active = "Active", + Disabled = "Disabled", + Suspended = "Suspended" +} + +// @public +export enum KnownCertificateStatus { + Active = "Active", + Expired = "Expired", + Revoked = "Revoked" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownNameUnavailabilityReason { + AccountNameInvalid = "AccountNameInvalid", + AlreadyExists = "AlreadyExists" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownProfileType { + PrivateTrust = "PrivateTrust", + PrivateTrustCIPolicy = "PrivateTrustCIPolicy", + PublicTrust = "PublicTrust", + PublicTrustTest = "PublicTrustTest", + VBSEnclave = "VBSEnclave" +} + +// @public +export enum KnownProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded", + Updating = "Updating" +} + +// @public +export enum KnownRevocationStatus { + Failed = "Failed", + InProgress = "InProgress", + Succeeded = "Succeeded" +} + +// @public +export enum KnownSkuName { + Basic = "Basic", + Premium = "Premium" +} + +// @public +export enum KnownVersions { + V20251013 = "2025-10-13" +} + +// @public +export type NameUnavailabilityReason = string; + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface OperationsListOptionalParams extends OperationOptions { +} + +// @public +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export type Origin = string; + +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + +// @public +export type ProfileType = string; + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export function restorePoller(client: CodeSigningClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; + +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} + +// @public +export interface Revocation { + effectiveAt?: Date; + failureReason?: string; + reason?: string; + remarks?: string; + requestedAt?: Date; + status?: RevocationStatus; +} + +// @public +export type RevocationStatus = string; + +// @public +export interface RevokeCertificate { + effectiveAt: Date; + reason: string; + remarks?: string; + serialNumber: string; + thumbprint: string; +} + +// @public +export type SkuName = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/artifactsigning/arm-artifactsigning/sample.env b/sdk/artifactsigning/arm-artifactsigning/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesCreateSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesCreateSample.ts new file mode 100644 index 000000000000..b0396de8d86c --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesCreateSample.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a certificate profile. + * + * @summary create a certificate profile. + * x-ms-original-file: 2025-10-13/CertificateProfiles_Create.json + */ +async function createACertificateProfile(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.certificateProfiles.create( + "MyResourceGroup", + "MyAccount", + "profileA", + { + properties: { + profileType: "PublicTrust", + identityValidationId: "00000000-1234-5678-3333-444444444444", + includePostalCode: true, + includeStreetAddress: false, + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await createACertificateProfile(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesDeleteSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesDeleteSample.ts new file mode 100644 index 000000000000..32cd39414034 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a certificate profile. + * + * @summary delete a certificate profile. + * x-ms-original-file: 2025-10-13/CertificateProfiles_Delete.json + */ +async function deleteACertificateProfile(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + await client.certificateProfiles.delete("MyResourceGroup", "MyAccount", "profileA"); +} + +async function main(): Promise { + await deleteACertificateProfile(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesGetSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesGetSample.ts new file mode 100644 index 000000000000..4cc83b451dc6 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get details of a certificate profile. + * + * @summary get details of a certificate profile. + * x-ms-original-file: 2025-10-13/CertificateProfiles_Get.json + */ +async function getDetailsOfACertificateProfile(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.certificateProfiles.get("MyResourceGroup", "MyAccount", "profileA"); + console.log(result); +} + +async function main(): Promise { + await getDetailsOfACertificateProfile(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesListByCodeSigningAccountSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesListByCodeSigningAccountSample.ts new file mode 100644 index 000000000000..f6c6eb6c9639 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesListByCodeSigningAccountSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list certificate profiles under an artifact signing account. + * + * @summary list certificate profiles under an artifact signing account. + * x-ms-original-file: 2025-10-13/CertificateProfiles_ListByCodeSigningAccount.json + */ +async function listCertificateProfilesUnderAnArtifactSigningAccount(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.certificateProfiles.listByCodeSigningAccount( + "MyResourceGroup", + "MyAccount", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listCertificateProfilesUnderAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesRevokeCertificateSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesRevokeCertificateSample.ts new file mode 100644 index 000000000000..59d7bd1f13eb --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/certificateProfilesRevokeCertificateSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to revoke a certificate under a certificate profile. + * + * @summary revoke a certificate under a certificate profile. + * x-ms-original-file: 2025-10-13/CertificateProfiles_RevokeCertificate.json + */ +async function revokeACertificateUnderACertificateProfile(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + await client.certificateProfiles.revokeCertificate("MyResourceGroup", "MyAccount", "profileA", { + effectiveAt: new Date("2023-11-12T23:40:25+00:00"), + reason: "KeyCompromised", + remarks: "test", + serialNumber: "xxxxxxxxxxxxxxxxxx", + thumbprint: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + }); +} + +async function main(): Promise { + await revokeACertificateUnderACertificateProfile(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsCheckNameAvailabilitySample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..9f76743f4aae --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsCheckNameAvailabilitySample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to checks if the artifact signing account name is valid and is not already in use. + * + * @summary checks if the artifact signing account name is valid and is not already in use. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_CheckNameAvailability.json + */ +async function checksIfTheArtifactSigningAccountNameIsAvailable(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.codeSigningAccounts.checkNameAvailability({ + type: "Microsoft.CodeSigning/codeSigningAccounts", + name: "sample-account", + }); + console.log(result); +} + +async function main(): Promise { + await checksIfTheArtifactSigningAccountNameIsAvailable(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsCreateSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsCreateSample.ts new file mode 100644 index 000000000000..cb775e3b5a2c --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsCreateSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create an artifact Signing Account. + * + * @summary create an artifact Signing Account. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Create.json + */ +async function createAnArtifactSigningAccount(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.codeSigningAccounts.create("MyResourceGroup", "MyAccount", { + location: "westus", + properties: { sku: { name: "Basic" } }, + }); + console.log(result); +} + +async function main(): Promise { + await createAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsDeleteSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsDeleteSample.ts new file mode 100644 index 000000000000..1c0aa120bd4f --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete an artifact signing account. + * + * @summary delete an artifact signing account. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Delete.json + */ +async function deleteAnArtifactSigningAccount(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + await client.codeSigningAccounts.delete("MyResourceGroup", "MyAccount"); +} + +async function main(): Promise { + await deleteAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsGetSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsGetSample.ts new file mode 100644 index 000000000000..0e5fa6a06a4c --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get an artifact Signing Account. + * + * @summary get an artifact Signing Account. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Get.json + */ +async function getAnArtifactSigningAccount(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.codeSigningAccounts.get("MyResourceGroup", "MyAccount"); + console.log(result); +} + +async function main(): Promise { + await getAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsListByResourceGroupSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsListByResourceGroupSample.ts new file mode 100644 index 000000000000..89b2c48436a7 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists artifact signing accounts within a resource group. + * + * @summary lists artifact signing accounts within a resource group. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_ListByResourceGroup.json + */ +async function listsArtifactSigningAccountsWithinAResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.codeSigningAccounts.listByResourceGroup("MyResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listsArtifactSigningAccountsWithinAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsListBySubscriptionSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsListBySubscriptionSample.ts new file mode 100644 index 000000000000..e681e1d083f0 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists artifact signing accounts within a subscription. + * + * @summary lists artifact signing accounts within a subscription. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_ListBySubscription.json + */ +async function listsArtifactSigningAccountsWithinASubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.codeSigningAccounts.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listsArtifactSigningAccountsWithinASubscription(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsUpdateSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsUpdateSample.ts new file mode 100644 index 000000000000..ec00a8c2bbd1 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/codeSigningAccountsUpdateSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update an artifact signing account. + * + * @summary update an artifact signing account. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Update.json + */ +async function updateAnArtifactSigningAccount(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.codeSigningAccounts.update("MyResourceGroup", "MyAccount", { + tags: { key1: "value1" }, + }); + console.log(result); +} + +async function main(): Promise { + await updateAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples-dev/operationsListSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..3776a4edb59b --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples-dev/operationsListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2025-10-13/Operations_List.json + */ +async function listArtifactSigningAccountOperations(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new CodeSigningClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.operations.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listArtifactSigningAccountOperations(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/README.md b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/README.md new file mode 100644 index 000000000000..9572ba8c9ee1 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/README.md @@ -0,0 +1,74 @@ +# @azure/arm-artifactsigning client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for @azure/arm-artifactsigning in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [certificateProfilesCreateSample.js][certificateprofilescreatesample] | create a certificate profile. x-ms-original-file: 2025-10-13/CertificateProfiles_Create.json | +| [certificateProfilesDeleteSample.js][certificateprofilesdeletesample] | delete a certificate profile. x-ms-original-file: 2025-10-13/CertificateProfiles_Delete.json | +| [certificateProfilesGetSample.js][certificateprofilesgetsample] | get details of a certificate profile. x-ms-original-file: 2025-10-13/CertificateProfiles_Get.json | +| [certificateProfilesListByCodeSigningAccountSample.js][certificateprofileslistbycodesigningaccountsample] | list certificate profiles under an artifact signing account. x-ms-original-file: 2025-10-13/CertificateProfiles_ListByCodeSigningAccount.json | +| [certificateProfilesRevokeCertificateSample.js][certificateprofilesrevokecertificatesample] | revoke a certificate under a certificate profile. x-ms-original-file: 2025-10-13/CertificateProfiles_RevokeCertificate.json | +| [codeSigningAccountsCheckNameAvailabilitySample.js][codesigningaccountschecknameavailabilitysample] | checks if the artifact signing account name is valid and is not already in use. x-ms-original-file: 2025-10-13/CodeSigningAccounts_CheckNameAvailability.json | +| [codeSigningAccountsCreateSample.js][codesigningaccountscreatesample] | create an artifact Signing Account. x-ms-original-file: 2025-10-13/CodeSigningAccounts_Create.json | +| [codeSigningAccountsDeleteSample.js][codesigningaccountsdeletesample] | delete an artifact signing account. x-ms-original-file: 2025-10-13/CodeSigningAccounts_Delete.json | +| [codeSigningAccountsGetSample.js][codesigningaccountsgetsample] | get an artifact Signing Account. x-ms-original-file: 2025-10-13/CodeSigningAccounts_Get.json | +| [codeSigningAccountsListByResourceGroupSample.js][codesigningaccountslistbyresourcegroupsample] | lists artifact signing accounts within a resource group. x-ms-original-file: 2025-10-13/CodeSigningAccounts_ListByResourceGroup.json | +| [codeSigningAccountsListBySubscriptionSample.js][codesigningaccountslistbysubscriptionsample] | lists artifact signing accounts within a subscription. x-ms-original-file: 2025-10-13/CodeSigningAccounts_ListBySubscription.json | +| [codeSigningAccountsUpdateSample.js][codesigningaccountsupdatesample] | update an artifact signing account. x-ms-original-file: 2025-10-13/CodeSigningAccounts_Update.json | +| [operationsListSample.js][operationslistsample] | list the operations for the provider x-ms-original-file: 2025-10-13/Operations_List.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node certificateProfilesCreateSample.js +``` + +Alternatively, run a single sample with the required environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +node certificateProfilesCreateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[certificateprofilescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesCreateSample.js +[certificateprofilesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesDeleteSample.js +[certificateprofilesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesGetSample.js +[certificateprofileslistbycodesigningaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesListByCodeSigningAccountSample.js +[certificateprofilesrevokecertificatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesRevokeCertificateSample.js +[codesigningaccountschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsCheckNameAvailabilitySample.js +[codesigningaccountscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsCreateSample.js +[codesigningaccountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsDeleteSample.js +[codesigningaccountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsGetSample.js +[codesigningaccountslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsListByResourceGroupSample.js +[codesigningaccountslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsListBySubscriptionSample.js +[codesigningaccountsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsUpdateSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/operationsListSample.js +[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-artifactsigning?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/artifactsigning/arm-artifactsigning/README.md diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesCreateSample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesCreateSample.js new file mode 100644 index 000000000000..e339d813267c --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesCreateSample.js @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to create a certificate profile. + * + * @summary create a certificate profile. + * x-ms-original-file: 2025-10-13/CertificateProfiles_Create.json + */ +async function createACertificateProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.certificateProfiles.create( + "MyResourceGroup", + "MyAccount", + "profileA", + { + properties: { + profileType: "PublicTrust", + identityValidationId: "00000000-1234-5678-3333-444444444444", + includePostalCode: true, + includeStreetAddress: false, + }, + }, + ); + console.log(result); +} + +async function main() { + await createACertificateProfile(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesDeleteSample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesDeleteSample.js new file mode 100644 index 000000000000..73018ee8681b --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete a certificate profile. + * + * @summary delete a certificate profile. + * x-ms-original-file: 2025-10-13/CertificateProfiles_Delete.json + */ +async function deleteACertificateProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + await client.certificateProfiles.delete("MyResourceGroup", "MyAccount", "profileA"); +} + +async function main() { + await deleteACertificateProfile(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesGetSample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesGetSample.js new file mode 100644 index 000000000000..1edf74ff6473 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get details of a certificate profile. + * + * @summary get details of a certificate profile. + * x-ms-original-file: 2025-10-13/CertificateProfiles_Get.json + */ +async function getDetailsOfACertificateProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.certificateProfiles.get("MyResourceGroup", "MyAccount", "profileA"); + console.log(result); +} + +async function main() { + await getDetailsOfACertificateProfile(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesListByCodeSigningAccountSample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesListByCodeSigningAccountSample.js new file mode 100644 index 000000000000..c07cfc61f56e --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesListByCodeSigningAccountSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list certificate profiles under an artifact signing account. + * + * @summary list certificate profiles under an artifact signing account. + * x-ms-original-file: 2025-10-13/CertificateProfiles_ListByCodeSigningAccount.json + */ +async function listCertificateProfilesUnderAnArtifactSigningAccount() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.certificateProfiles.listByCodeSigningAccount( + "MyResourceGroup", + "MyAccount", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listCertificateProfilesUnderAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesRevokeCertificateSample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesRevokeCertificateSample.js new file mode 100644 index 000000000000..09655af74c31 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/certificateProfilesRevokeCertificateSample.js @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to revoke a certificate under a certificate profile. + * + * @summary revoke a certificate under a certificate profile. + * x-ms-original-file: 2025-10-13/CertificateProfiles_RevokeCertificate.json + */ +async function revokeACertificateUnderACertificateProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + await client.certificateProfiles.revokeCertificate("MyResourceGroup", "MyAccount", "profileA", { + effectiveAt: new Date("2023-11-12T23:40:25+00:00"), + reason: "KeyCompromised", + remarks: "test", + serialNumber: "xxxxxxxxxxxxxxxxxx", + thumbprint: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + }); +} + +async function main() { + await revokeACertificateUnderACertificateProfile(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsCheckNameAvailabilitySample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..207207e507a9 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsCheckNameAvailabilitySample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to checks if the artifact signing account name is valid and is not already in use. + * + * @summary checks if the artifact signing account name is valid and is not already in use. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_CheckNameAvailability.json + */ +async function checksIfTheArtifactSigningAccountNameIsAvailable() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.codeSigningAccounts.checkNameAvailability({ + type: "Microsoft.CodeSigning/codeSigningAccounts", + name: "sample-account", + }); + console.log(result); +} + +async function main() { + await checksIfTheArtifactSigningAccountNameIsAvailable(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsCreateSample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsCreateSample.js new file mode 100644 index 000000000000..b7543effb512 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsCreateSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to create an artifact Signing Account. + * + * @summary create an artifact Signing Account. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Create.json + */ +async function createAnArtifactSigningAccount() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.codeSigningAccounts.create("MyResourceGroup", "MyAccount", { + location: "westus", + properties: { sku: { name: "Basic" } }, + }); + console.log(result); +} + +async function main() { + await createAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsDeleteSample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsDeleteSample.js new file mode 100644 index 000000000000..4ab4f31406a6 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete an artifact signing account. + * + * @summary delete an artifact signing account. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Delete.json + */ +async function deleteAnArtifactSigningAccount() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + await client.codeSigningAccounts.delete("MyResourceGroup", "MyAccount"); +} + +async function main() { + await deleteAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsGetSample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsGetSample.js new file mode 100644 index 000000000000..301e22237816 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get an artifact Signing Account. + * + * @summary get an artifact Signing Account. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Get.json + */ +async function getAnArtifactSigningAccount() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.codeSigningAccounts.get("MyResourceGroup", "MyAccount"); + console.log(result); +} + +async function main() { + await getAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsListByResourceGroupSample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsListByResourceGroupSample.js new file mode 100644 index 000000000000..911928f6cb94 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsListByResourceGroupSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists artifact signing accounts within a resource group. + * + * @summary lists artifact signing accounts within a resource group. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_ListByResourceGroup.json + */ +async function listsArtifactSigningAccountsWithinAResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.codeSigningAccounts.listByResourceGroup("MyResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listsArtifactSigningAccountsWithinAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsListBySubscriptionSample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsListBySubscriptionSample.js new file mode 100644 index 000000000000..0d07f85c4f23 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsListBySubscriptionSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists artifact signing accounts within a subscription. + * + * @summary lists artifact signing accounts within a subscription. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_ListBySubscription.json + */ +async function listsArtifactSigningAccountsWithinASubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.codeSigningAccounts.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listsArtifactSigningAccountsWithinASubscription(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsUpdateSample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsUpdateSample.js new file mode 100644 index 000000000000..d09863409c23 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/codeSigningAccountsUpdateSample.js @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to update an artifact signing account. + * + * @summary update an artifact signing account. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Update.json + */ +async function updateAnArtifactSigningAccount() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.codeSigningAccounts.update("MyResourceGroup", "MyAccount", { + tags: { key1: "value1" }, + }); + console.log(result); +} + +async function main() { + await updateAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/operationsListSample.js b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/operationsListSample.js new file mode 100644 index 000000000000..e700619036a6 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/operationsListSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { CodeSigningClient } = require("@azure/arm-artifactsigning"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2025-10-13/Operations_List.json + */ +async function listArtifactSigningAccountOperations() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new CodeSigningClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.operations.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listArtifactSigningAccountOperations(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/package.json b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/package.json new file mode 100644 index 000000000000..ccfdf2c9fa64 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/package.json @@ -0,0 +1,36 @@ +{ + "name": "@azure-samples/arm-artifactsigning-js", + "private": true, + "version": "1.0.0", + "description": "@azure/arm-artifactsigning client library samples for JavaScript", + "engines": { + "node": ">=20.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/artifactsigning/arm-artifactsigning" + }, + "keywords": [ + "node", + "azure", + "cloud", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/artifactsigning/arm-artifactsigning", + "dependencies": { + "@azure/arm-artifactsigning": "latest", + "dotenv": "latest", + "@azure/identity": "^4.13.0" + }, + "devDependencies": { + "cross-env": "latest" + } +} diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/sample.env b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/javascript/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/README.md b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/README.md new file mode 100644 index 000000000000..753ede682dd9 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/README.md @@ -0,0 +1,87 @@ +# @azure/arm-artifactsigning client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for @azure/arm-artifactsigning in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [certificateProfilesCreateSample.ts][certificateprofilescreatesample] | create a certificate profile. x-ms-original-file: 2025-10-13/CertificateProfiles_Create.json | +| [certificateProfilesDeleteSample.ts][certificateprofilesdeletesample] | delete a certificate profile. x-ms-original-file: 2025-10-13/CertificateProfiles_Delete.json | +| [certificateProfilesGetSample.ts][certificateprofilesgetsample] | get details of a certificate profile. x-ms-original-file: 2025-10-13/CertificateProfiles_Get.json | +| [certificateProfilesListByCodeSigningAccountSample.ts][certificateprofileslistbycodesigningaccountsample] | list certificate profiles under an artifact signing account. x-ms-original-file: 2025-10-13/CertificateProfiles_ListByCodeSigningAccount.json | +| [certificateProfilesRevokeCertificateSample.ts][certificateprofilesrevokecertificatesample] | revoke a certificate under a certificate profile. x-ms-original-file: 2025-10-13/CertificateProfiles_RevokeCertificate.json | +| [codeSigningAccountsCheckNameAvailabilitySample.ts][codesigningaccountschecknameavailabilitysample] | checks if the artifact signing account name is valid and is not already in use. x-ms-original-file: 2025-10-13/CodeSigningAccounts_CheckNameAvailability.json | +| [codeSigningAccountsCreateSample.ts][codesigningaccountscreatesample] | create an artifact Signing Account. x-ms-original-file: 2025-10-13/CodeSigningAccounts_Create.json | +| [codeSigningAccountsDeleteSample.ts][codesigningaccountsdeletesample] | delete an artifact signing account. x-ms-original-file: 2025-10-13/CodeSigningAccounts_Delete.json | +| [codeSigningAccountsGetSample.ts][codesigningaccountsgetsample] | get an artifact Signing Account. x-ms-original-file: 2025-10-13/CodeSigningAccounts_Get.json | +| [codeSigningAccountsListByResourceGroupSample.ts][codesigningaccountslistbyresourcegroupsample] | lists artifact signing accounts within a resource group. x-ms-original-file: 2025-10-13/CodeSigningAccounts_ListByResourceGroup.json | +| [codeSigningAccountsListBySubscriptionSample.ts][codesigningaccountslistbysubscriptionsample] | lists artifact signing accounts within a subscription. x-ms-original-file: 2025-10-13/CodeSigningAccounts_ListBySubscription.json | +| [codeSigningAccountsUpdateSample.ts][codesigningaccountsupdatesample] | update an artifact signing account. x-ms-original-file: 2025-10-13/CodeSigningAccounts_Update.json | +| [operationsListSample.ts][operationslistsample] | list the operations for the provider x-ms-original-file: 2025-10-13/Operations_List.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/certificateProfilesCreateSample.js +``` + +Alternatively, run a single sample with the required environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +node dist/certificateProfilesCreateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[certificateprofilescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesCreateSample.ts +[certificateprofilesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesDeleteSample.ts +[certificateprofilesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesGetSample.ts +[certificateprofileslistbycodesigningaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesListByCodeSigningAccountSample.ts +[certificateprofilesrevokecertificatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesRevokeCertificateSample.ts +[codesigningaccountschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsCheckNameAvailabilitySample.ts +[codesigningaccountscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsCreateSample.ts +[codesigningaccountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsDeleteSample.ts +[codesigningaccountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsGetSample.ts +[codesigningaccountslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsListByResourceGroupSample.ts +[codesigningaccountslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsListBySubscriptionSample.ts +[codesigningaccountsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsUpdateSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/operationsListSample.ts +[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-artifactsigning?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/artifactsigning/arm-artifactsigning/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/package.json b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/package.json new file mode 100644 index 000000000000..f1465da6206f --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/package.json @@ -0,0 +1,43 @@ +{ + "name": "@azure-samples/arm-artifactsigning-ts", + "private": true, + "version": "1.0.0", + "description": "@azure/arm-artifactsigning client library samples for TypeScript", + "engines": { + "node": ">=20.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/artifactsigning/arm-artifactsigning" + }, + "keywords": [ + "node", + "azure", + "cloud", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/artifactsigning/arm-artifactsigning", + "dependencies": { + "@azure/arm-artifactsigning": "latest", + "dotenv": "latest", + "@azure/identity": "^4.13.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "cross-env": "latest", + "rimraf": "latest", + "typescript": "~5.9.3" + } +} diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/sample.env b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesCreateSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesCreateSample.ts new file mode 100644 index 000000000000..b0396de8d86c --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesCreateSample.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a certificate profile. + * + * @summary create a certificate profile. + * x-ms-original-file: 2025-10-13/CertificateProfiles_Create.json + */ +async function createACertificateProfile(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.certificateProfiles.create( + "MyResourceGroup", + "MyAccount", + "profileA", + { + properties: { + profileType: "PublicTrust", + identityValidationId: "00000000-1234-5678-3333-444444444444", + includePostalCode: true, + includeStreetAddress: false, + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await createACertificateProfile(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesDeleteSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesDeleteSample.ts new file mode 100644 index 000000000000..32cd39414034 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a certificate profile. + * + * @summary delete a certificate profile. + * x-ms-original-file: 2025-10-13/CertificateProfiles_Delete.json + */ +async function deleteACertificateProfile(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + await client.certificateProfiles.delete("MyResourceGroup", "MyAccount", "profileA"); +} + +async function main(): Promise { + await deleteACertificateProfile(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesGetSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesGetSample.ts new file mode 100644 index 000000000000..4cc83b451dc6 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get details of a certificate profile. + * + * @summary get details of a certificate profile. + * x-ms-original-file: 2025-10-13/CertificateProfiles_Get.json + */ +async function getDetailsOfACertificateProfile(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.certificateProfiles.get("MyResourceGroup", "MyAccount", "profileA"); + console.log(result); +} + +async function main(): Promise { + await getDetailsOfACertificateProfile(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesListByCodeSigningAccountSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesListByCodeSigningAccountSample.ts new file mode 100644 index 000000000000..f6c6eb6c9639 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesListByCodeSigningAccountSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list certificate profiles under an artifact signing account. + * + * @summary list certificate profiles under an artifact signing account. + * x-ms-original-file: 2025-10-13/CertificateProfiles_ListByCodeSigningAccount.json + */ +async function listCertificateProfilesUnderAnArtifactSigningAccount(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.certificateProfiles.listByCodeSigningAccount( + "MyResourceGroup", + "MyAccount", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listCertificateProfilesUnderAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesRevokeCertificateSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesRevokeCertificateSample.ts new file mode 100644 index 000000000000..59d7bd1f13eb --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/certificateProfilesRevokeCertificateSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to revoke a certificate under a certificate profile. + * + * @summary revoke a certificate under a certificate profile. + * x-ms-original-file: 2025-10-13/CertificateProfiles_RevokeCertificate.json + */ +async function revokeACertificateUnderACertificateProfile(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + await client.certificateProfiles.revokeCertificate("MyResourceGroup", "MyAccount", "profileA", { + effectiveAt: new Date("2023-11-12T23:40:25+00:00"), + reason: "KeyCompromised", + remarks: "test", + serialNumber: "xxxxxxxxxxxxxxxxxx", + thumbprint: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + }); +} + +async function main(): Promise { + await revokeACertificateUnderACertificateProfile(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsCheckNameAvailabilitySample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..9f76743f4aae --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsCheckNameAvailabilitySample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to checks if the artifact signing account name is valid and is not already in use. + * + * @summary checks if the artifact signing account name is valid and is not already in use. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_CheckNameAvailability.json + */ +async function checksIfTheArtifactSigningAccountNameIsAvailable(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.codeSigningAccounts.checkNameAvailability({ + type: "Microsoft.CodeSigning/codeSigningAccounts", + name: "sample-account", + }); + console.log(result); +} + +async function main(): Promise { + await checksIfTheArtifactSigningAccountNameIsAvailable(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsCreateSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsCreateSample.ts new file mode 100644 index 000000000000..cb775e3b5a2c --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsCreateSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create an artifact Signing Account. + * + * @summary create an artifact Signing Account. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Create.json + */ +async function createAnArtifactSigningAccount(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.codeSigningAccounts.create("MyResourceGroup", "MyAccount", { + location: "westus", + properties: { sku: { name: "Basic" } }, + }); + console.log(result); +} + +async function main(): Promise { + await createAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsDeleteSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsDeleteSample.ts new file mode 100644 index 000000000000..1c0aa120bd4f --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete an artifact signing account. + * + * @summary delete an artifact signing account. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Delete.json + */ +async function deleteAnArtifactSigningAccount(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + await client.codeSigningAccounts.delete("MyResourceGroup", "MyAccount"); +} + +async function main(): Promise { + await deleteAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsGetSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsGetSample.ts new file mode 100644 index 000000000000..0e5fa6a06a4c --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get an artifact Signing Account. + * + * @summary get an artifact Signing Account. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Get.json + */ +async function getAnArtifactSigningAccount(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.codeSigningAccounts.get("MyResourceGroup", "MyAccount"); + console.log(result); +} + +async function main(): Promise { + await getAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsListByResourceGroupSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsListByResourceGroupSample.ts new file mode 100644 index 000000000000..89b2c48436a7 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists artifact signing accounts within a resource group. + * + * @summary lists artifact signing accounts within a resource group. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_ListByResourceGroup.json + */ +async function listsArtifactSigningAccountsWithinAResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.codeSigningAccounts.listByResourceGroup("MyResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listsArtifactSigningAccountsWithinAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsListBySubscriptionSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsListBySubscriptionSample.ts new file mode 100644 index 000000000000..e681e1d083f0 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists artifact signing accounts within a subscription. + * + * @summary lists artifact signing accounts within a subscription. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_ListBySubscription.json + */ +async function listsArtifactSigningAccountsWithinASubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.codeSigningAccounts.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listsArtifactSigningAccountsWithinASubscription(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsUpdateSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsUpdateSample.ts new file mode 100644 index 000000000000..ec00a8c2bbd1 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/codeSigningAccountsUpdateSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update an artifact signing account. + * + * @summary update an artifact signing account. + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Update.json + */ +async function updateAnArtifactSigningAccount(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-1111-2222-3333-444444444444"; + const client = new CodeSigningClient(credential, subscriptionId); + const result = await client.codeSigningAccounts.update("MyResourceGroup", "MyAccount", { + tags: { key1: "value1" }, + }); + console.log(result); +} + +async function main(): Promise { + await updateAnArtifactSigningAccount(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/operationsListSample.ts b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..3776a4edb59b --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/src/operationsListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "@azure/arm-artifactsigning"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2025-10-13/Operations_List.json + */ +async function listArtifactSigningAccountOperations(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new CodeSigningClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.operations.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listArtifactSigningAccountOperations(); +} + +main().catch(console.error); diff --git a/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/tsconfig.json b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/tsconfig.json new file mode 100644 index 000000000000..400db87cf648 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/samples/v1/typescript/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "ES2023", + "module": "commonjs", + "lib": [], + "importHelpers": true, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "moduleResolution": "node10", + "esModuleInterop": true, + "outDir": "./dist", + "resolveJsonModule": true + }, + "include": [ + "./src" + ] +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/api/certificateProfiles/index.ts b/sdk/artifactsigning/arm-artifactsigning/src/api/certificateProfiles/index.ts new file mode 100644 index 000000000000..185ea5891197 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/api/certificateProfiles/index.ts @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { revokeCertificate, listByCodeSigningAccount, $delete, create, get } from "./operations.js"; +export { + CertificateProfilesRevokeCertificateOptionalParams, + CertificateProfilesListByCodeSigningAccountOptionalParams, + CertificateProfilesDeleteOptionalParams, + CertificateProfilesCreateOptionalParams, + CertificateProfilesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/artifactsigning/arm-artifactsigning/src/api/certificateProfiles/operations.ts b/sdk/artifactsigning/arm-artifactsigning/src/api/certificateProfiles/operations.ts new file mode 100644 index 000000000000..4b8e047f49d7 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/api/certificateProfiles/operations.ts @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CodeSigningContext as Client } from "../index.js"; +import type { + CertificateProfile, + _CertificateProfileListResult, + RevokeCertificate, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + certificateProfileSerializer, + certificateProfileDeserializer, + _certificateProfileListResultDeserializer, + revokeCertificateSerializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + CertificateProfilesRevokeCertificateOptionalParams, + CertificateProfilesListByCodeSigningAccountOptionalParams, + CertificateProfilesDeleteOptionalParams, + CertificateProfilesCreateOptionalParams, + CertificateProfilesGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _revokeCertificateSend( + context: Client, + resourceGroupName: string, + accountName: string, + profileName: string, + body: RevokeCertificate, + options: CertificateProfilesRevokeCertificateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}/revokeCertificate{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + accountName: accountName, + profileName: profileName, + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + body: revokeCertificateSerializer(body), + }); +} + +export async function _revokeCertificateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["204"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Revoke a certificate under a certificate profile. */ +export async function revokeCertificate( + context: Client, + resourceGroupName: string, + accountName: string, + profileName: string, + body: RevokeCertificate, + options: CertificateProfilesRevokeCertificateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _revokeCertificateSend( + context, + resourceGroupName, + accountName, + profileName, + body, + options, + ); + return _revokeCertificateDeserialize(result); +} + +export function _listByCodeSigningAccountSend( + context: Client, + resourceGroupName: string, + accountName: string, + options: CertificateProfilesListByCodeSigningAccountOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + accountName: accountName, + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByCodeSigningAccountDeserialize( + result: PathUncheckedResponse, +): Promise<_CertificateProfileListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _certificateProfileListResultDeserializer(result.body); +} + +/** List certificate profiles under an artifact signing account. */ +export function listByCodeSigningAccount( + context: Client, + resourceGroupName: string, + accountName: string, + options: CertificateProfilesListByCodeSigningAccountOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByCodeSigningAccountSend(context, resourceGroupName, accountName, options), + _listByCodeSigningAccountDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-10-13" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + accountName: string, + profileName: string, + options: CertificateProfilesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + accountName: accountName, + profileName: profileName, + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a certificate profile. */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + accountName: string, + profileName: string, + options: CertificateProfilesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, accountName, profileName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-10-13", + }) as PollerLike, void>; +} + +export function _createSend( + context: Client, + resourceGroupName: string, + accountName: string, + profileName: string, + resource: CertificateProfile, + options: CertificateProfilesCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + accountName: accountName, + profileName: profileName, + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: certificateProfileSerializer(resource), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return certificateProfileDeserializer(result.body); +} + +/** Create a certificate profile. */ +export function create( + context: Client, + resourceGroupName: string, + accountName: string, + profileName: string, + resource: CertificateProfile, + options: CertificateProfilesCreateOptionalParams = { requestOptions: {} }, +): PollerLike, CertificateProfile> { + return getLongRunningPoller(context, _createDeserialize, ["200", "201", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createSend(context, resourceGroupName, accountName, profileName, resource, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2025-10-13", + }) as PollerLike, CertificateProfile>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + accountName: string, + profileName: string, + options: CertificateProfilesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + accountName: accountName, + profileName: profileName, + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return certificateProfileDeserializer(result.body); +} + +/** Get details of a certificate profile. */ +export async function get( + context: Client, + resourceGroupName: string, + accountName: string, + profileName: string, + options: CertificateProfilesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, accountName, profileName, options); + return _getDeserialize(result); +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/api/certificateProfiles/options.ts b/sdk/artifactsigning/arm-artifactsigning/src/api/certificateProfiles/options.ts new file mode 100644 index 000000000000..4d539b453bff --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/api/certificateProfiles/options.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface CertificateProfilesRevokeCertificateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CertificateProfilesListByCodeSigningAccountOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CertificateProfilesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface CertificateProfilesCreateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface CertificateProfilesGetOptionalParams extends OperationOptions {} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/api/codeSigningAccounts/index.ts b/sdk/artifactsigning/arm-artifactsigning/src/api/codeSigningAccounts/index.ts new file mode 100644 index 000000000000..f9401fd13c3f --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/api/codeSigningAccounts/index.ts @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + checkNameAvailability, + listBySubscription, + listByResourceGroup, + $delete, + update, + create, + get, +} from "./operations.js"; +export { + CodeSigningAccountsCheckNameAvailabilityOptionalParams, + CodeSigningAccountsListBySubscriptionOptionalParams, + CodeSigningAccountsListByResourceGroupOptionalParams, + CodeSigningAccountsDeleteOptionalParams, + CodeSigningAccountsUpdateOptionalParams, + CodeSigningAccountsCreateOptionalParams, + CodeSigningAccountsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/artifactsigning/arm-artifactsigning/src/api/codeSigningAccounts/operations.ts b/sdk/artifactsigning/arm-artifactsigning/src/api/codeSigningAccounts/operations.ts new file mode 100644 index 000000000000..7555291398dc --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/api/codeSigningAccounts/operations.ts @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CodeSigningContext as Client } from "../index.js"; +import type { + CodeSigningAccount, + CodeSigningAccountPatch, + _CodeSigningAccountListResult, + CheckNameAvailability, + CheckNameAvailabilityResult, +} from "../../models/models.js"; +import { + errorResponseDeserializer, + codeSigningAccountSerializer, + codeSigningAccountDeserializer, + codeSigningAccountPatchSerializer, + _codeSigningAccountListResultDeserializer, + checkNameAvailabilitySerializer, + checkNameAvailabilityResultDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { + CodeSigningAccountsCheckNameAvailabilityOptionalParams, + CodeSigningAccountsListBySubscriptionOptionalParams, + CodeSigningAccountsListByResourceGroupOptionalParams, + CodeSigningAccountsDeleteOptionalParams, + CodeSigningAccountsUpdateOptionalParams, + CodeSigningAccountsCreateOptionalParams, + CodeSigningAccountsGetOptionalParams, +} from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +export function _checkNameAvailabilitySend( + context: Client, + body: CheckNameAvailability, + options: CodeSigningAccountsCheckNameAvailabilityOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/checkNameAvailability{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: checkNameAvailabilitySerializer(body), + }); +} + +export async function _checkNameAvailabilityDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return checkNameAvailabilityResultDeserializer(result.body); +} + +/** Checks if the artifact signing account name is valid and is not already in use. */ +export async function checkNameAvailability( + context: Client, + body: CheckNameAvailability, + options: CodeSigningAccountsCheckNameAvailabilityOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _checkNameAvailabilitySend(context, body, options); + return _checkNameAvailabilityDeserialize(result); +} + +export function _listBySubscriptionSend( + context: Client, + options: CodeSigningAccountsListBySubscriptionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/codeSigningAccounts{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_CodeSigningAccountListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _codeSigningAccountListResultDeserializer(result.body); +} + +/** Lists artifact signing accounts within a subscription. */ +export function listBySubscription( + context: Client, + options: CodeSigningAccountsListBySubscriptionOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listBySubscriptionSend(context, options), + _listBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-10-13" }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: CodeSigningAccountsListByResourceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_CodeSigningAccountListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _codeSigningAccountListResultDeserializer(result.body); +} + +/** Lists artifact signing accounts within a resource group. */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: CodeSigningAccountsListByResourceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-10-13" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + accountName: string, + options: CodeSigningAccountsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + accountName: accountName, + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete an artifact signing account. */ +/** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ +export function $delete( + context: Client, + resourceGroupName: string, + accountName: string, + options: CodeSigningAccountsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _$deleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => _$deleteSend(context, resourceGroupName, accountName, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-10-13", + }) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + accountName: string, + properties: CodeSigningAccountPatch, + options: CodeSigningAccountsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + accountName: accountName, + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: codeSigningAccountPatchSerializer(properties), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return codeSigningAccountDeserializer(result.body); +} + +/** Update an artifact signing account. */ +export function update( + context: Client, + resourceGroupName: string, + accountName: string, + properties: CodeSigningAccountPatch, + options: CodeSigningAccountsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, CodeSigningAccount> { + return getLongRunningPoller(context, _updateDeserialize, ["200", "202", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend(context, resourceGroupName, accountName, properties, options), + resourceLocationConfig: "location", + apiVersion: context.apiVersion ?? "2025-10-13", + }) as PollerLike, CodeSigningAccount>; +} + +export function _createSend( + context: Client, + resourceGroupName: string, + accountName: string, + resource: CodeSigningAccount, + options: CodeSigningAccountsCreateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + accountName: accountName, + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { accept: "application/json", ...options.requestOptions?.headers }, + body: codeSigningAccountSerializer(resource), + }); +} + +export async function _createDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201", "202"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return codeSigningAccountDeserializer(result.body); +} + +/** Create an artifact Signing Account. */ +export function create( + context: Client, + resourceGroupName: string, + accountName: string, + resource: CodeSigningAccount, + options: CodeSigningAccountsCreateOptionalParams = { requestOptions: {} }, +): PollerLike, CodeSigningAccount> { + return getLongRunningPoller(context, _createDeserialize, ["200", "201", "202"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createSend(context, resourceGroupName, accountName, resource, options), + resourceLocationConfig: "azure-async-operation", + apiVersion: context.apiVersion ?? "2025-10-13", + }) as PollerLike, CodeSigningAccount>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + accountName: string, + options: CodeSigningAccountsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + accountName: accountName, + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _getDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return codeSigningAccountDeserializer(result.body); +} + +/** Get an artifact Signing Account. */ +export async function get( + context: Client, + resourceGroupName: string, + accountName: string, + options: CodeSigningAccountsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, accountName, options); + return _getDeserialize(result); +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/api/codeSigningAccounts/options.ts b/sdk/artifactsigning/arm-artifactsigning/src/api/codeSigningAccounts/options.ts new file mode 100644 index 000000000000..e071ac316d26 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/api/codeSigningAccounts/options.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface CodeSigningAccountsCheckNameAvailabilityOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CodeSigningAccountsListBySubscriptionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CodeSigningAccountsListByResourceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface CodeSigningAccountsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface CodeSigningAccountsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface CodeSigningAccountsCreateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface CodeSigningAccountsGetOptionalParams extends OperationOptions {} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/api/codeSigningContext.ts b/sdk/artifactsigning/arm-artifactsigning/src/api/codeSigningContext.ts new file mode 100644 index 000000000000..654b32debb95 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/api/codeSigningContext.ts @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import type { AzureSupportedClouds } from "../static-helpers/cloudSettingHelpers.js"; +import { getArmEndpoint } from "../static-helpers/cloudSettingHelpers.js"; +import type { Client, ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; +import type { TokenCredential } from "@azure/core-auth"; + +/** Code Signing resource provider api. */ +export interface CodeSigningContext extends Client { + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Optional parameters for the client. */ +export interface CodeSigningClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; + /** Specifies the Azure cloud environment for the client. */ + cloudSetting?: AzureSupportedClouds; +} + +/** Code Signing resource provider api. */ +export function createCodeSigning( + credential: TokenCredential, + subscriptionId: string, + options: CodeSigningClientOptionalParams = {}, +): CodeSigningContext { + const endpointUrl = + options.endpoint ?? getArmEndpoint(options.cloudSetting) ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-artifactsigning/1.0.0`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`] }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + const apiVersion = options.apiVersion; + return { ...clientContext, apiVersion, subscriptionId } as CodeSigningContext; +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/api/index.ts b/sdk/artifactsigning/arm-artifactsigning/src/api/index.ts new file mode 100644 index 000000000000..19aa5f76c698 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + createCodeSigning, + CodeSigningContext, + CodeSigningClientOptionalParams, +} from "./codeSigningContext.js"; diff --git a/sdk/artifactsigning/arm-artifactsigning/src/api/operations/index.ts b/sdk/artifactsigning/arm-artifactsigning/src/api/operations/index.ts new file mode 100644 index 000000000000..24a804d14fcf --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/api/operations/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { list } from "./operations.js"; +export { OperationsListOptionalParams } from "./options.js"; diff --git a/sdk/artifactsigning/arm-artifactsigning/src/api/operations/operations.ts b/sdk/artifactsigning/arm-artifactsigning/src/api/operations/operations.ts new file mode 100644 index 000000000000..474b47a93c70 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/api/operations/operations.ts @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CodeSigningContext as Client } from "../index.js"; +import type { _OperationListResult, Operation } from "../../models/models.js"; +import { + _operationListResultDeserializer, + errorResponseDeserializer, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { buildPagedAsyncIterator } from "../../static-helpers/pagingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import type { OperationsListOptionalParams } from "./options.js"; +import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; + +export function _listSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/providers/Microsoft.CodeSigning/operations{?api%2Dversion}", + { + "api%2Dversion": context.apiVersion ?? "2025-10-13", + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context.path(path).get({ + ...operationOptionsToRequestParameters(options), + headers: { accept: "application/json", ...options.requestOptions?.headers }, + }); +} + +export async function _listDeserialize( + result: PathUncheckedResponse, +): Promise<_OperationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _operationListResultDeserializer(result.body); +} + +/** List the operations for the provider */ +export function list( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink", apiVersion: context.apiVersion ?? "2025-10-13" }, + ); +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/api/operations/options.ts b/sdk/artifactsigning/arm-artifactsigning/src/api/operations/options.ts new file mode 100644 index 000000000000..b9a3fd9758a3 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/api/operations/options.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/classic/certificateProfiles/index.ts b/sdk/artifactsigning/arm-artifactsigning/src/classic/certificateProfiles/index.ts new file mode 100644 index 000000000000..7c42d39d3123 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/classic/certificateProfiles/index.ts @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CodeSigningContext } from "../../api/codeSigningContext.js"; +import { + revokeCertificate, + listByCodeSigningAccount, + $delete, + create, + get, +} from "../../api/certificateProfiles/operations.js"; +import type { + CertificateProfilesRevokeCertificateOptionalParams, + CertificateProfilesListByCodeSigningAccountOptionalParams, + CertificateProfilesDeleteOptionalParams, + CertificateProfilesCreateOptionalParams, + CertificateProfilesGetOptionalParams, +} from "../../api/certificateProfiles/options.js"; +import type { CertificateProfile, RevokeCertificate } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a CertificateProfiles operations. */ +export interface CertificateProfilesOperations { + /** Revoke a certificate under a certificate profile. */ + revokeCertificate: ( + resourceGroupName: string, + accountName: string, + profileName: string, + body: RevokeCertificate, + options?: CertificateProfilesRevokeCertificateOptionalParams, + ) => Promise; + /** List certificate profiles under an artifact signing account. */ + listByCodeSigningAccount: ( + resourceGroupName: string, + accountName: string, + options?: CertificateProfilesListByCodeSigningAccountOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a certificate profile. */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + accountName: string, + profileName: string, + options?: CertificateProfilesDeleteOptionalParams, + ) => PollerLike, void>; + /** Create a certificate profile. */ + create: ( + resourceGroupName: string, + accountName: string, + profileName: string, + resource: CertificateProfile, + options?: CertificateProfilesCreateOptionalParams, + ) => PollerLike, CertificateProfile>; + /** Get details of a certificate profile. */ + get: ( + resourceGroupName: string, + accountName: string, + profileName: string, + options?: CertificateProfilesGetOptionalParams, + ) => Promise; +} + +function _getCertificateProfiles(context: CodeSigningContext) { + return { + revokeCertificate: ( + resourceGroupName: string, + accountName: string, + profileName: string, + body: RevokeCertificate, + options?: CertificateProfilesRevokeCertificateOptionalParams, + ) => revokeCertificate(context, resourceGroupName, accountName, profileName, body, options), + listByCodeSigningAccount: ( + resourceGroupName: string, + accountName: string, + options?: CertificateProfilesListByCodeSigningAccountOptionalParams, + ) => listByCodeSigningAccount(context, resourceGroupName, accountName, options), + delete: ( + resourceGroupName: string, + accountName: string, + profileName: string, + options?: CertificateProfilesDeleteOptionalParams, + ) => $delete(context, resourceGroupName, accountName, profileName, options), + create: ( + resourceGroupName: string, + accountName: string, + profileName: string, + resource: CertificateProfile, + options?: CertificateProfilesCreateOptionalParams, + ) => create(context, resourceGroupName, accountName, profileName, resource, options), + get: ( + resourceGroupName: string, + accountName: string, + profileName: string, + options?: CertificateProfilesGetOptionalParams, + ) => get(context, resourceGroupName, accountName, profileName, options), + }; +} + +export function _getCertificateProfilesOperations( + context: CodeSigningContext, +): CertificateProfilesOperations { + return { + ..._getCertificateProfiles(context), + }; +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/classic/codeSigningAccounts/index.ts b/sdk/artifactsigning/arm-artifactsigning/src/classic/codeSigningAccounts/index.ts new file mode 100644 index 000000000000..44b1f667f556 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/classic/codeSigningAccounts/index.ts @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CodeSigningContext } from "../../api/codeSigningContext.js"; +import { + checkNameAvailability, + listBySubscription, + listByResourceGroup, + $delete, + update, + create, + get, +} from "../../api/codeSigningAccounts/operations.js"; +import type { + CodeSigningAccountsCheckNameAvailabilityOptionalParams, + CodeSigningAccountsListBySubscriptionOptionalParams, + CodeSigningAccountsListByResourceGroupOptionalParams, + CodeSigningAccountsDeleteOptionalParams, + CodeSigningAccountsUpdateOptionalParams, + CodeSigningAccountsCreateOptionalParams, + CodeSigningAccountsGetOptionalParams, +} from "../../api/codeSigningAccounts/options.js"; +import type { + CodeSigningAccount, + CodeSigningAccountPatch, + CheckNameAvailability, + CheckNameAvailabilityResult, +} from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import type { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a CodeSigningAccounts operations. */ +export interface CodeSigningAccountsOperations { + /** Checks if the artifact signing account name is valid and is not already in use. */ + checkNameAvailability: ( + body: CheckNameAvailability, + options?: CodeSigningAccountsCheckNameAvailabilityOptionalParams, + ) => Promise; + /** Lists artifact signing accounts within a subscription. */ + listBySubscription: ( + options?: CodeSigningAccountsListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists artifact signing accounts within a resource group. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: CodeSigningAccountsListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete an artifact signing account. */ + /** + * @fixme delete is a reserved word that cannot be used as an operation name. + * Please add @clientName("clientName") or @clientName("", "javascript") + * to the operation to override the generated name. + */ + delete: ( + resourceGroupName: string, + accountName: string, + options?: CodeSigningAccountsDeleteOptionalParams, + ) => PollerLike, void>; + /** Update an artifact signing account. */ + update: ( + resourceGroupName: string, + accountName: string, + properties: CodeSigningAccountPatch, + options?: CodeSigningAccountsUpdateOptionalParams, + ) => PollerLike, CodeSigningAccount>; + /** Create an artifact Signing Account. */ + create: ( + resourceGroupName: string, + accountName: string, + resource: CodeSigningAccount, + options?: CodeSigningAccountsCreateOptionalParams, + ) => PollerLike, CodeSigningAccount>; + /** Get an artifact Signing Account. */ + get: ( + resourceGroupName: string, + accountName: string, + options?: CodeSigningAccountsGetOptionalParams, + ) => Promise; +} + +function _getCodeSigningAccounts(context: CodeSigningContext) { + return { + checkNameAvailability: ( + body: CheckNameAvailability, + options?: CodeSigningAccountsCheckNameAvailabilityOptionalParams, + ) => checkNameAvailability(context, body, options), + listBySubscription: (options?: CodeSigningAccountsListBySubscriptionOptionalParams) => + listBySubscription(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: CodeSigningAccountsListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + accountName: string, + options?: CodeSigningAccountsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, accountName, options), + update: ( + resourceGroupName: string, + accountName: string, + properties: CodeSigningAccountPatch, + options?: CodeSigningAccountsUpdateOptionalParams, + ) => update(context, resourceGroupName, accountName, properties, options), + create: ( + resourceGroupName: string, + accountName: string, + resource: CodeSigningAccount, + options?: CodeSigningAccountsCreateOptionalParams, + ) => create(context, resourceGroupName, accountName, resource, options), + get: ( + resourceGroupName: string, + accountName: string, + options?: CodeSigningAccountsGetOptionalParams, + ) => get(context, resourceGroupName, accountName, options), + }; +} + +export function _getCodeSigningAccountsOperations( + context: CodeSigningContext, +): CodeSigningAccountsOperations { + return { + ..._getCodeSigningAccounts(context), + }; +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/classic/index.ts b/sdk/artifactsigning/arm-artifactsigning/src/classic/index.ts new file mode 100644 index 000000000000..e8c360f8327b --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/classic/index.ts @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { CertificateProfilesOperations } from "./certificateProfiles/index.js"; +export { CodeSigningAccountsOperations } from "./codeSigningAccounts/index.js"; +export { OperationsOperations } from "./operations/index.js"; diff --git a/sdk/artifactsigning/arm-artifactsigning/src/classic/operations/index.ts b/sdk/artifactsigning/arm-artifactsigning/src/classic/operations/index.ts new file mode 100644 index 000000000000..7e4026c77a96 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/classic/operations/index.ts @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CodeSigningContext } from "../../api/codeSigningContext.js"; +import { list } from "../../api/operations/operations.js"; +import type { OperationsListOptionalParams } from "../../api/operations/options.js"; +import type { Operation } from "../../models/models.js"; +import type { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** List the operations for the provider */ + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +function _getOperations(context: CodeSigningContext) { + return { + list: (options?: OperationsListOptionalParams) => list(context, options), + }; +} + +export function _getOperationsOperations(context: CodeSigningContext): OperationsOperations { + return { + ..._getOperations(context), + }; +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/codeSigningClient.ts b/sdk/artifactsigning/arm-artifactsigning/src/codeSigningClient.ts new file mode 100644 index 000000000000..cb220832f3c9 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/codeSigningClient.ts @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CodeSigningContext, CodeSigningClientOptionalParams } from "./api/index.js"; +import { createCodeSigning } from "./api/index.js"; +import type { CertificateProfilesOperations } from "./classic/certificateProfiles/index.js"; +import { _getCertificateProfilesOperations } from "./classic/certificateProfiles/index.js"; +import type { CodeSigningAccountsOperations } from "./classic/codeSigningAccounts/index.js"; +import { _getCodeSigningAccountsOperations } from "./classic/codeSigningAccounts/index.js"; +import type { OperationsOperations } from "./classic/operations/index.js"; +import { _getOperationsOperations } from "./classic/operations/index.js"; +import type { TokenCredential } from "@azure/core-auth"; +import type { Pipeline } from "@azure/core-rest-pipeline"; + +export { CodeSigningClientOptionalParams } from "./api/codeSigningContext.js"; + +export class CodeSigningClient { + private _client: CodeSigningContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** Code Signing resource provider api. */ + constructor( + credential: TokenCredential, + subscriptionId: string, + options: CodeSigningClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createCodeSigning(credential, subscriptionId, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.certificateProfiles = _getCertificateProfilesOperations(this._client); + this.codeSigningAccounts = _getCodeSigningAccountsOperations(this._client); + this.operations = _getOperationsOperations(this._client); + } + + /** The operation groups for certificateProfiles */ + public readonly certificateProfiles: CertificateProfilesOperations; + /** The operation groups for codeSigningAccounts */ + public readonly codeSigningAccounts: CodeSigningAccountsOperations; + /** The operation groups for operations */ + public readonly operations: OperationsOperations; +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/index.ts b/sdk/artifactsigning/arm-artifactsigning/src/index.ts new file mode 100644 index 000000000000..f9fbcd0c580e --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/index.ts @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzureClouds, AzureSupportedClouds } from "./static-helpers/cloudSettingHelpers.js"; +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; + +export { CodeSigningClient } from "./codeSigningClient.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + CodeSigningAccount, + CodeSigningAccountProperties, + AccountSku, + KnownSkuName, + SkuName, + KnownProvisioningState, + ProvisioningState, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + CodeSigningAccountPatch, + CodeSigningAccountPatchProperties, + AccountSkuPatch, + CheckNameAvailability, + CheckNameAvailabilityResult, + KnownNameUnavailabilityReason, + NameUnavailabilityReason, + CertificateProfile, + CertificateProfileProperties, + KnownProfileType, + ProfileType, + KnownCertificateProfileStatus, + CertificateProfileStatus, + Certificate, + KnownCertificateStatus, + CertificateStatus, + Revocation, + KnownRevocationStatus, + RevocationStatus, + ProxyResource, + RevokeCertificate, + KnownVersions, +} from "./models/index.js"; +export { CodeSigningClientOptionalParams } from "./api/index.js"; +export { + CertificateProfilesRevokeCertificateOptionalParams, + CertificateProfilesListByCodeSigningAccountOptionalParams, + CertificateProfilesDeleteOptionalParams, + CertificateProfilesCreateOptionalParams, + CertificateProfilesGetOptionalParams, +} from "./api/certificateProfiles/index.js"; +export { + CodeSigningAccountsCheckNameAvailabilityOptionalParams, + CodeSigningAccountsListBySubscriptionOptionalParams, + CodeSigningAccountsListByResourceGroupOptionalParams, + CodeSigningAccountsDeleteOptionalParams, + CodeSigningAccountsUpdateOptionalParams, + CodeSigningAccountsCreateOptionalParams, + CodeSigningAccountsGetOptionalParams, +} from "./api/codeSigningAccounts/index.js"; +export { OperationsListOptionalParams } from "./api/operations/index.js"; +export { + CertificateProfilesOperations, + CodeSigningAccountsOperations, + OperationsOperations, +} from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; +export { AzureClouds, AzureSupportedClouds }; diff --git a/sdk/artifactsigning/arm-artifactsigning/src/logger.ts b/sdk/artifactsigning/arm-artifactsigning/src/logger.ts new file mode 100644 index 000000000000..54209055d238 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-artifactsigning"); diff --git a/sdk/artifactsigning/arm-artifactsigning/src/models/index.ts b/sdk/artifactsigning/arm-artifactsigning/src/models/index.ts new file mode 100644 index 000000000000..9274197e049d --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/models/index.ts @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + CodeSigningAccount, + CodeSigningAccountProperties, + AccountSku, + KnownSkuName, + SkuName, + KnownProvisioningState, + ProvisioningState, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + CodeSigningAccountPatch, + CodeSigningAccountPatchProperties, + AccountSkuPatch, + CheckNameAvailability, + CheckNameAvailabilityResult, + KnownNameUnavailabilityReason, + NameUnavailabilityReason, + CertificateProfile, + CertificateProfileProperties, + KnownProfileType, + ProfileType, + KnownCertificateProfileStatus, + CertificateProfileStatus, + Certificate, + KnownCertificateStatus, + CertificateStatus, + Revocation, + KnownRevocationStatus, + RevocationStatus, + ProxyResource, + RevokeCertificate, + KnownVersions, +} from "./models.js"; diff --git a/sdk/artifactsigning/arm-artifactsigning/src/models/models.ts b/sdk/artifactsigning/arm-artifactsigning/src/models/models.ts new file mode 100644 index 000000000000..34d38c2956ad --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/models/models.ts @@ -0,0 +1,834 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * This file contains only generated model types and their (de)serializers. + * Disable the following rules for internal models with '_' prefix and deserializers which require 'any' for raw JSON input. + */ +/* eslint-disable @typescript-eslint/naming-convention */ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface _OperationListResult { + /** The Operation items on this page */ + value: Operation[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _operationListResultDeserializer(item: any): _OperationListResult { + return { + value: operationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDeserializer(item); + }); +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ + readonly name?: string; + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ + readonly origin?: Origin; + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ + readonly actionType?: ActionType; +} + +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + actionType: item["actionType"], + }; +} + +/** Localized display information for an operation. */ +export interface OperationDisplay { + /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ + readonly provider?: string; + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ + readonly resource?: string; + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ + readonly operation?: string; + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ + readonly description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ +export enum KnownOrigin { + /** Indicates the operation is initiated by a user. */ + User = "user", + /** Indicates the operation is initiated by a system. */ + System = "system", + /** Indicates the operation is initiated by a user or system. */ + UserSystem = "user,system", +} + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user**: Indicates the operation is initiated by a user. \ + * **system**: Indicates the operation is initiated by a system. \ + * **user,system**: Indicates the operation is initiated by a user or system. + */ +export type Origin = string; + +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +export enum KnownActionType { + /** Actions are for internal-only APIs. */ + Internal = "Internal", +} + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal**: Actions are for internal-only APIs. + */ +export type ActionType = string; + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +export function errorResponseDeserializer(item: any): ErrorResponse { + return { + error: !item["error"] ? item["error"] : errorDetailDeserializer(item["error"]), + }; +} + +/** The error detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorDetail[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] ? item["details"] : errorDetailArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorDetailArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorDetailDeserializer(item); + }); +} + +export function errorAdditionalInfoArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: any; +} + +export function errorAdditionalInfoDeserializer(item: any): ErrorAdditionalInfo { + return { + type: item["type"], + info: item["info"], + }; +} + +/** Artifact signing account resource. */ +export interface CodeSigningAccount extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: CodeSigningAccountProperties; +} + +export function codeSigningAccountSerializer(item: CodeSigningAccount): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : codeSigningAccountPropertiesSerializer(item["properties"]), + }; +} + +export function codeSigningAccountDeserializer(item: any): CodeSigningAccount { + return { + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : codeSigningAccountPropertiesDeserializer(item["properties"]), + }; +} + +/** Properties of the artifact signing account. */ +export interface CodeSigningAccountProperties { + /** The URI of the artifact signing account which is used during signing files. */ + readonly accountUri?: string; + /** SKU of the artifact signing account. */ + sku?: AccountSku; + /** Status of the current operation on artifact signing account. */ + readonly provisioningState?: ProvisioningState; +} + +export function codeSigningAccountPropertiesSerializer(item: CodeSigningAccountProperties): any { + return { sku: !item["sku"] ? item["sku"] : accountSkuSerializer(item["sku"]) }; +} + +export function codeSigningAccountPropertiesDeserializer(item: any): CodeSigningAccountProperties { + return { + accountUri: item["accountUri"], + sku: !item["sku"] ? item["sku"] : accountSkuDeserializer(item["sku"]), + provisioningState: item["provisioningState"], + }; +} + +/** SKU of the artifact signing account. */ +export interface AccountSku { + /** Name of the SKU. */ + name: SkuName; +} + +export function accountSkuSerializer(item: AccountSku): any { + return { name: item["name"] }; +} + +export function accountSkuDeserializer(item: any): AccountSku { + return { + name: item["name"], + }; +} + +/** Name of the sku. */ +export enum KnownSkuName { + /** Basic sku. */ + Basic = "Basic", + /** Premium sku. */ + Premium = "Premium", +} + +/** + * Name of the sku. \ + * {@link KnownSkuName} can be used interchangeably with SkuName, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Basic**: Basic sku. \ + * **Premium**: Premium sku. + */ +export type SkuName = string; + +/** The status of the current operation. */ +export enum KnownProvisioningState { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", + /** Updating in progress. */ + Updating = "Updating", + /** Deletion in progress. */ + Deleting = "Deleting", + /** Resource creation started. */ + Accepted = "Accepted", +} + +/** + * The status of the current operation. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Resource has been created. \ + * **Failed**: Resource creation failed. \ + * **Canceled**: Resource creation was canceled. \ + * **Updating**: Updating in progress. \ + * **Deleting**: Deletion in progress. \ + * **Accepted**: Resource creation started. + */ +export type ProvisioningState = string; + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: !item["tags"] + ? item["tags"] + : Object.fromEntries(Object.entries(item["tags"]).map(([k, p]: [string, any]) => [k, p])), + location: item["location"], + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** Parameters for creating or updating an artifact signing account. */ +export interface CodeSigningAccountPatch { + /** Resource tags. */ + tags?: Record; + /** Properties of the artifact signing account. */ + properties?: CodeSigningAccountPatchProperties; +} + +export function codeSigningAccountPatchSerializer(item: CodeSigningAccountPatch): any { + return { + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : codeSigningAccountPatchPropertiesSerializer(item["properties"]), + }; +} + +/** Properties of the artifact signing account. */ +export interface CodeSigningAccountPatchProperties { + /** SKU of the artifact signing account. */ + sku?: AccountSkuPatch; +} + +export function codeSigningAccountPatchPropertiesSerializer( + item: CodeSigningAccountPatchProperties, +): any { + return { sku: !item["sku"] ? item["sku"] : accountSkuPatchSerializer(item["sku"]) }; +} + +/** SKU of the artifact signing account. */ +export interface AccountSkuPatch { + /** Name of the SKU. */ + name?: SkuName; +} + +export function accountSkuPatchSerializer(item: AccountSkuPatch): any { + return { name: item["name"] }; +} + +/** The response of a CodeSigningAccount list operation. */ +export interface _CodeSigningAccountListResult { + /** The CodeSigningAccount items on this page */ + value: CodeSigningAccount[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _codeSigningAccountListResultDeserializer( + item: any, +): _CodeSigningAccountListResult { + return { + value: codeSigningAccountArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function codeSigningAccountArraySerializer(result: Array): any[] { + return result.map((item) => { + return codeSigningAccountSerializer(item); + }); +} + +export function codeSigningAccountArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return codeSigningAccountDeserializer(item); + }); +} + +/** The parameters used to check the availability of the artifact signing account name. */ +export interface CheckNameAvailability { + /** The type of the resource, "Microsoft.CodeSigning/codeSigningAccounts". */ + type: string; + /** Artifact signing account name. */ + name: string; +} + +export function checkNameAvailabilitySerializer(item: CheckNameAvailability): any { + return { type: item["type"], name: item["name"] }; +} + +/** The CheckNameAvailability operation response. */ +export interface CheckNameAvailabilityResult { + /** A boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or is invalid and cannot be used. */ + readonly nameAvailable?: boolean; + /** The reason that an artifact signing account name could not be used. The Reason element is only returned if nameAvailable is false. */ + readonly reason?: NameUnavailabilityReason; + /** An error message explaining the Reason value in more detail. */ + readonly message?: string; +} + +export function checkNameAvailabilityResultDeserializer(item: any): CheckNameAvailabilityResult { + return { + nameAvailable: item["nameAvailable"], + reason: item["reason"], + message: item["message"], + }; +} + +/** The reason that an artifact signing account name could not be used. The Reason element is only returned if nameAvailable is false. */ +export enum KnownNameUnavailabilityReason { + /** Account name is invalid */ + AccountNameInvalid = "AccountNameInvalid", + /** Account name already exists */ + AlreadyExists = "AlreadyExists", +} + +/** + * The reason that an artifact signing account name could not be used. The Reason element is only returned if nameAvailable is false. \ + * {@link KnownNameUnavailabilityReason} can be used interchangeably with NameUnavailabilityReason, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AccountNameInvalid**: Account name is invalid \ + * **AlreadyExists**: Account name already exists + */ +export type NameUnavailabilityReason = string; + +/** Certificate profile resource. */ +export interface CertificateProfile extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: CertificateProfileProperties; +} + +export function certificateProfileSerializer(item: CertificateProfile): any { + return { + properties: !item["properties"] + ? item["properties"] + : certificateProfilePropertiesSerializer(item["properties"]), + }; +} + +export function certificateProfileDeserializer(item: any): CertificateProfile { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : certificateProfilePropertiesDeserializer(item["properties"]), + }; +} + +/** Properties of the certificate profile. */ +export interface CertificateProfileProperties { + /** Profile type of the certificate. */ + profileType: ProfileType; + /** Whether to include STREET in the certificate subject name. */ + includeStreetAddress?: boolean; + /** Whether to include L in the certificate subject name. Applicable only for private trust, private trust ci profile types */ + includeCity?: boolean; + /** Whether to include S in the certificate subject name. Applicable only for private trust, private trust ci profile types */ + includeState?: boolean; + /** Whether to include C in the certificate subject name. Applicable only for private trust, private trust ci profile types */ + includeCountry?: boolean; + /** Whether to include PC in the certificate subject name. */ + includePostalCode?: boolean; + /** Identity validation id used for the certificate subject name. */ + identityValidationId: string; + /** Status of the current operation on certificate profile. */ + readonly provisioningState?: ProvisioningState; + /** Status of the certificate profile. */ + readonly status?: CertificateProfileStatus; + /** List of renewed certificates. */ + readonly certificates?: Certificate[]; +} + +export function certificateProfilePropertiesSerializer(item: CertificateProfileProperties): any { + return { + profileType: item["profileType"], + includeStreetAddress: item["includeStreetAddress"], + includeCity: item["includeCity"], + includeState: item["includeState"], + includeCountry: item["includeCountry"], + includePostalCode: item["includePostalCode"], + identityValidationId: item["identityValidationId"], + }; +} + +export function certificateProfilePropertiesDeserializer(item: any): CertificateProfileProperties { + return { + profileType: item["profileType"], + includeStreetAddress: item["includeStreetAddress"], + includeCity: item["includeCity"], + includeState: item["includeState"], + includeCountry: item["includeCountry"], + includePostalCode: item["includePostalCode"], + identityValidationId: item["identityValidationId"], + provisioningState: item["provisioningState"], + status: item["status"], + certificates: !item["certificates"] + ? item["certificates"] + : certificateArrayDeserializer(item["certificates"]), + }; +} + +/** Type of the certificate */ +export enum KnownProfileType { + /** Used for signing files which are distributed publicly. */ + PublicTrust = "PublicTrust", + /** Used for signing files which are distributed internally within organization or group boundary. */ + PrivateTrust = "PrivateTrust", + /** Used for signing CI policy files. */ + PrivateTrustCIPolicy = "PrivateTrustCIPolicy", + /** Used for signing files which are run in secure vbs enclave. */ + VBSEnclave = "VBSEnclave", + /** Used for signing files for testing purpose. */ + PublicTrustTest = "PublicTrustTest", +} + +/** + * Type of the certificate \ + * {@link KnownProfileType} can be used interchangeably with ProfileType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **PublicTrust**: Used for signing files which are distributed publicly. \ + * **PrivateTrust**: Used for signing files which are distributed internally within organization or group boundary. \ + * **PrivateTrustCIPolicy**: Used for signing CI policy files. \ + * **VBSEnclave**: Used for signing files which are run in secure vbs enclave. \ + * **PublicTrustTest**: Used for signing files for testing purpose. + */ +export type ProfileType = string; + +/** Status of the certificate profiles. */ +export enum KnownCertificateProfileStatus { + /** The certificate profile is active. */ + Active = "Active", + /** The certificate profile is disabled. */ + Disabled = "Disabled", + /** The certificate profile is suspended. */ + Suspended = "Suspended", +} + +/** + * Status of the certificate profiles. \ + * {@link KnownCertificateProfileStatus} can be used interchangeably with CertificateProfileStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: The certificate profile is active. \ + * **Disabled**: The certificate profile is disabled. \ + * **Suspended**: The certificate profile is suspended. + */ +export type CertificateProfileStatus = string; + +export function certificateArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return certificateDeserializer(item); + }); +} + +/** Properties of the certificate. */ +export interface Certificate { + /** Serial number of the certificate. */ + serialNumber?: string; + /** Enhanced key usage of the certificate. */ + enhancedKeyUsage?: string; + /** Subject name of the certificate. */ + subjectName?: string; + /** Thumbprint of the certificate. */ + thumbprint?: string; + /** Certificate created date. */ + createdDate?: string; + /** Certificate expiry date. */ + expiryDate?: string; + /** Status of the certificate. */ + status?: CertificateStatus; + /** Revocations history of a certificate. */ + revocation?: Revocation; +} + +export function certificateDeserializer(item: any): Certificate { + return { + serialNumber: item["serialNumber"], + enhancedKeyUsage: item["enhancedKeyUsage"], + subjectName: item["subjectName"], + thumbprint: item["thumbprint"], + createdDate: item["createdDate"], + expiryDate: item["expiryDate"], + status: item["status"], + revocation: !item["revocation"] + ? item["revocation"] + : revocationDeserializer(item["revocation"]), + }; +} + +/** Status of the certificate */ +export enum KnownCertificateStatus { + /** The certificate is active. */ + Active = "Active", + /** The certificate is expired. */ + Expired = "Expired", + /** The certificate is revoked. */ + Revoked = "Revoked", +} + +/** + * Status of the certificate \ + * {@link KnownCertificateStatus} can be used interchangeably with CertificateStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: The certificate is active. \ + * **Expired**: The certificate is expired. \ + * **Revoked**: The certificate is revoked. + */ +export type CertificateStatus = string; + +/** Revocation details of the certificate. */ +export interface Revocation { + /** The timestamp when the revocation is requested. */ + requestedAt?: Date; + /** The timestamp when the revocation is effective. */ + effectiveAt?: Date; + /** Reason for revocation. */ + reason?: string; + /** Remarks for the revocation. */ + remarks?: string; + /** Status of the revocation. */ + status?: RevocationStatus; + /** Reason for the revocation failure. */ + failureReason?: string; +} + +export function revocationDeserializer(item: any): Revocation { + return { + requestedAt: !item["requestedAt"] ? item["requestedAt"] : new Date(item["requestedAt"]), + effectiveAt: !item["effectiveAt"] ? item["effectiveAt"] : new Date(item["effectiveAt"]), + reason: item["reason"], + remarks: item["remarks"], + status: item["status"], + failureReason: item["failureReason"], + }; +} + +/** Revocation status of the certificate. */ +export enum KnownRevocationStatus { + /** Certificate revocation succeeded. */ + Succeeded = "Succeeded", + /** Certificate revocation is in progress. */ + InProgress = "InProgress", + /** Certificate revocation failed. */ + Failed = "Failed", +} + +/** + * Revocation status of the certificate. \ + * {@link KnownRevocationStatus} can be used interchangeably with RevocationStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Certificate revocation succeeded. \ + * **InProgress**: Certificate revocation is in progress. \ + * **Failed**: Certificate revocation failed. + */ +export type RevocationStatus = string; + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceSerializer(item: ProxyResource): any { + return item; +} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** The response of a CertificateProfile list operation. */ +export interface _CertificateProfileListResult { + /** The CertificateProfile items on this page */ + value: CertificateProfile[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _certificateProfileListResultDeserializer( + item: any, +): _CertificateProfileListResult { + return { + value: certificateProfileArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function certificateProfileArraySerializer(result: Array): any[] { + return result.map((item) => { + return certificateProfileSerializer(item); + }); +} + +export function certificateProfileArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return certificateProfileDeserializer(item); + }); +} + +/** Defines the certificate revocation properties. */ +export interface RevokeCertificate { + /** Serial number of the certificate. */ + serialNumber: string; + /** Thumbprint of the certificate. */ + thumbprint: string; + /** The timestamp when the revocation is effective. */ + effectiveAt: Date; + /** Reason for the revocation. */ + reason: string; + /** Remarks for the revocation. */ + remarks?: string; +} + +export function revokeCertificateSerializer(item: RevokeCertificate): any { + return { + serialNumber: item["serialNumber"], + thumbprint: item["thumbprint"], + effectiveAt: item["effectiveAt"].toISOString(), + reason: item["reason"], + remarks: item["remarks"], + }; +} + +/** The available API versions. */ +export enum KnownVersions { + /** 2025-10-13 */ + V20251013 = "2025-10-13", +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/restorePollerHelpers.ts b/sdk/artifactsigning/arm-artifactsigning/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..bee63cda7cc4 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/restorePollerHelpers.ts @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { CodeSigningClient } from "./codeSigningClient.js"; +import { _$deleteDeserialize, _createDeserialize } from "./api/certificateProfiles/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeCodeSigningAccounts, + _updateDeserialize, + _createDeserialize as _createDeserializeCodeSigningAccounts, +} from "./api/codeSigningAccounts/operations.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import type { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; +import type { PollerLike, OperationState, ResourceLocationConfig } from "@azure/core-lro"; +import { deserializeState } from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: CodeSigningClient, + serializedState: string, + sourceOperation: (...args: any[]) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + const apiVersion = getApiVersionFromUrl(initialRequestUrl); + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + apiVersion, + }, + ); +} + +interface DeserializationHelper { + deserializer: (result: PathUncheckedResponse) => Promise; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}": + { deserializer: _$deleteDeserialize, expectedStatuses: ["202", "204", "200"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}": + { deserializer: _createDeserialize, expectedStatuses: ["200", "201", "202"] }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}": + { + deserializer: _$deleteDeserializeCodeSigningAccounts, + expectedStatuses: ["202", "204", "200"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}": + { deserializer: _updateDeserialize, expectedStatuses: ["200", "202", "201"] }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}": + { + deserializer: _createDeserializeCodeSigningAccounts, + expectedStatuses: ["200", "201", "202"], + }, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): DeserializationHelper | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: DeserializationHelper | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} + +function getApiVersionFromUrl(urlStr: string): string | undefined { + const url = new URL(urlStr); + return url.searchParams.get("api-version") ?? undefined; +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/static-helpers/cloudSettingHelpers.ts b/sdk/artifactsigning/arm-artifactsigning/src/static-helpers/cloudSettingHelpers.ts new file mode 100644 index 000000000000..613112c6e397 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/static-helpers/cloudSettingHelpers.ts @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * An enum to describe Azure Cloud environments. + * @enum {string} + */ +export enum AzureClouds { + /** Azure public cloud, which is the default cloud for Azure SDKs. */ + AZURE_PUBLIC_CLOUD = "AZURE_PUBLIC_CLOUD", + /** Azure China cloud */ + AZURE_CHINA_CLOUD = "AZURE_CHINA_CLOUD", + /** Azure US government cloud */ + AZURE_US_GOVERNMENT = "AZURE_US_GOVERNMENT", +} + +/** The supported values for cloud setting as a string literal type */ +export type AzureSupportedClouds = `${AzureClouds}`; + +/** + * Gets the Azure Resource Manager endpoint URL for the specified cloud setting. + * @param cloudSetting - The Azure cloud environment setting. Use one of the AzureClouds enum values. + * @returns The ARM endpoint URL for the specified cloud, or undefined if cloudSetting is undefined. + * @throws {Error} Throws an error if an unknown cloud setting is provided. + */ +export function getArmEndpoint(cloudSetting?: AzureSupportedClouds): string | undefined { + if (cloudSetting === undefined) { + return undefined; + } + const cloudEndpoints: Record = { + AZURE_CHINA_CLOUD: "https://management.chinacloudapi.cn/", + AZURE_US_GOVERNMENT: "https://management.usgovcloudapi.net/", + AZURE_PUBLIC_CLOUD: "https://management.azure.com/", + }; + if (cloudSetting in cloudEndpoints) { + return cloudEndpoints[cloudSetting]; + } else { + throw new Error( + `Unknown cloud setting: ${cloudSetting}. Please refer to the enum AzureClouds for possible values.`, + ); + } +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/static-helpers/pagingHelpers.ts b/sdk/artifactsigning/arm-artifactsigning/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..9258ba95eda8 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; + nextLinkMethod?: "GET" | "POST"; + apiVersion?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const nextLinkMethod = options.nextLinkMethod ?? "GET"; + const apiVersion = options.apiVersion; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + let result; + if (pageLink === undefined) { + result = await getInitialResponse(); + } else { + const resolvedPageLink = apiVersion ? addApiVersionToUrl(pageLink, apiVersion) : pageLink; + result = + nextLinkMethod === "POST" + ? await client.pathUnchecked(resolvedPageLink).post() + : await client.pathUnchecked(resolvedPageLink).get(); + } + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} + +/** + * Adds the api-version query parameter on a URL if it's not present. + * @param url - the URL to modify + * @param apiVersion - the API version to set + * @returns - the URL with the api-version query parameter set + */ +function addApiVersionToUrl(url: string, apiVersion: string): string { + // The base URL is only used for parsing and won't appear in the returned URL + const urlObj = new URL(url, "https://microsoft.com"); + if (!urlObj.searchParams.get("api-version")) { + // Append one if there is no apiVersion + return `${url}${ + Array.from(urlObj.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + return url; +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/static-helpers/pollingHelpers.ts b/sdk/artifactsigning/arm-artifactsigning/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..8e36a866edcc --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + OperationResponse, +} from "@azure/core-lro"; +import { createHttpPoller } from "@azure/core-lro"; + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; +import type { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; + /** + * The api-version of the LRO + */ + apiVersion?: string; +} +export function getLongRunningPoller( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse, apiVersion } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error("Either restoreFrom or getInitialResponse must be specified"); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error("getInitialResponse is required when initializing a new poller"); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + const pollingPath = apiVersion ? addApiVersionToUrl(path, apiVersion) : path; + response = await client.pathUnchecked(pollingPath).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} + +/** + * Adds the api-version query parameter on a URL if it's not present. + * @param url - the URL to modify + * @param apiVersion - the API version to set + * @returns - the URL with the api-version query parameter set + */ +function addApiVersionToUrl(url: string, apiVersion: string): string { + // The base URL is only used for parsing and won't appear in the returned URL + const urlObj = new URL(url, "https://microsoft.com"); + if (!urlObj.searchParams.get("api-version")) { + // Append one if there is no apiVersion + return `${url}${ + Array.from(urlObj.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + return url; +} diff --git a/sdk/artifactsigning/arm-artifactsigning/src/static-helpers/urlTemplate.ts b/sdk/artifactsigning/arm-artifactsigning/src/static-helpers/urlTemplate.ts new file mode 100644 index 000000000000..c7109898692a --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/src/static-helpers/urlTemplate.ts @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +// --------------------- +// interfaces +// --------------------- +interface ValueOptions { + isFirst: boolean; // is first value in the expression + op?: string; // operator + varValue?: any; // variable value + varName?: string; // variable name + modifier?: string; // modifier e.g * + reserved?: boolean; // if true we'll keep reserved words with not encoding +} + +export interface UrlTemplateOptions { + // if set to true, reserved characters will not be encoded + allowReserved?: boolean; +} + +// --------------------- +// helpers +// --------------------- +function encodeComponent(val: string, reserved?: boolean, op?: string): string { + return (reserved ?? op === "+") || op === "#" + ? encodeReservedComponent(val) + : encodeRFC3986URIComponent(val); +} + +function encodeReservedComponent(str: string): string { + return str + .split(/(%[0-9A-Fa-f]{2})/g) + .map((part) => (!/%[0-9A-Fa-f]/.test(part) ? encodeURI(part) : part)) + .join(""); +} + +function encodeRFC3986URIComponent(str: string): string { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`, + ); +} + +function isDefined(val: any): boolean { + return val !== undefined && val !== null; +} + +function getNamedAndIfEmpty(op?: string): [boolean, string] { + return [!!op && [";", "?", "&"].includes(op), !!op && ["?", "&"].includes(op) ? "=" : ""]; +} + +function getFirstOrSep(op?: string, isFirst = false): string { + if (isFirst) { + return !op || op === "+" ? "" : op; + } else if (!op || op === "+" || op === "#") { + return ","; + } else if (op === "?") { + return "&"; + } else { + return op; + } +} + +function getExpandedValue(option: ValueOptions): string { + let isFirst = option.isFirst; + const { op, varName, varValue: value, reserved } = option; + const vals: string[] = []; + const [named, ifEmpty] = getNamedAndIfEmpty(op); + + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + // prepare the following parts: separator, varName, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (named && varName) { + vals.push(`${encodeURIComponent(varName)}`); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + const val = value[key]; + if (!isDefined(val)) { + continue; + } + // prepare the following parts: separator, key, value + vals.push(`${getFirstOrSep(op, isFirst)}`); + if (key) { + vals.push(`${encodeURIComponent(key)}`); + if (named && val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + vals.push(encodeComponent(val, reserved, op)); + isFirst = false; + } + } + return vals.join(""); +} + +function getNonExpandedValue(option: ValueOptions): string | undefined { + const { op, varName, varValue: value, isFirst, reserved } = option; + const vals: string[] = []; + const first = getFirstOrSep(op, isFirst); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + if (named && varName) { + vals.push(encodeComponent(varName, reserved, op)); + if (value === "") { + if (!ifEmpty) { + vals.push(ifEmpty); + } + return !vals.join("") ? undefined : `${first}${vals.join("")}`; + } + vals.push("="); + } + + const items = []; + if (Array.isArray(value)) { + for (const val of value.filter(isDefined)) { + items.push(encodeComponent(val, reserved, op)); + } + } else if (typeof value === "object") { + for (const key of Object.keys(value)) { + if (!isDefined(value[key])) { + continue; + } + items.push(encodeRFC3986URIComponent(key)); + items.push(encodeComponent(value[key], reserved, op)); + } + } + vals.push(items.join(",")); + return !vals.join(",") ? undefined : `${first}${vals.join("")}`; +} + +function getVarValue(option: ValueOptions): string | undefined { + const { op, varName, modifier, isFirst, reserved, varValue: value } = option; + + if (!isDefined(value)) { + return undefined; + } else if (["string", "number", "boolean"].includes(typeof value)) { + let val = value.toString(); + const [named, ifEmpty] = getNamedAndIfEmpty(op); + const vals: string[] = [getFirstOrSep(op, isFirst)]; + if (named && varName) { + // No need to encode varName considering it is already encoded + vals.push(varName); + if (val === "") { + vals.push(ifEmpty); + } else { + vals.push("="); + } + } + if (modifier && modifier !== "*") { + val = val.substring(0, parseInt(modifier, 10)); + } + vals.push(encodeComponent(val, reserved, op)); + return vals.join(""); + } else if (modifier === "*") { + return getExpandedValue(option); + } else { + return getNonExpandedValue(option); + } +} + +// --------------------------------------------------------------------------------------------------- +// This is an implementation of RFC 6570 URI Template: https://datatracker.ietf.org/doc/html/rfc6570. +// --------------------------------------------------------------------------------------------------- +export function expandUrlTemplate( + template: string, + context: Record, + option?: UrlTemplateOptions, +): string { + const result = template.replace(/\{([^{}]+)\}|([^{}]+)/g, (_, expr, text) => { + if (!expr) { + return encodeReservedComponent(text); + } + let op; + if (["+", "#", ".", "/", ";", "?", "&"].includes(expr[0])) { + op = expr[0]; + expr = expr.slice(1); + } + const varList = expr.split(/,/g); + const result = []; + for (const varSpec of varList) { + const varMatch = /([^:*]*)(?::(\d+)|(\*))?/.exec(varSpec); + if (!varMatch || !varMatch[1]) { + continue; + } + const varValue = getVarValue({ + isFirst: result.length === 0, + op, + varValue: context[varMatch[1]], + varName: varMatch[1], + modifier: varMatch[2] || varMatch[3], + reserved: option?.allowReserved, + }); + if (varValue) { + result.push(varValue); + } + } + return result.join(""); + }); + + return normalizeUnreserved(result); +} + +/** + * Normalize an expanded URI by decoding percent-encoded unreserved characters. + * RFC 3986 unreserved: "-" / "." / "~" + */ +function normalizeUnreserved(uri: string): string { + return uri.replace(/%([0-9A-Fa-f]{2})/g, (match, hex) => { + const char = String.fromCharCode(parseInt(hex, 16)); + // Decode only if it's unreserved + if (/[\-.~]/.test(char)) { + return char; + } + return match; // leave other encodings intact + }); +} diff --git a/sdk/artifactsigning/arm-artifactsigning/test/public/sampleTest.spec.ts b/sdk/artifactsigning/arm-artifactsigning/test/public/sampleTest.spec.ts new file mode 100644 index 000000000000..19cf10ee4956 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/test/public/sampleTest.spec.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +// import { Recorder } from "@azure-tools/test-recorder"; +// import { createRecorder } from "./utils/recordedClient.js"; +import { + assert, + // beforeEach, + // afterEach, + it, + describe, +} from "vitest"; + +describe("My test", () => { + // let recorder: Recorder; + + // beforeEach(async function(ctx) { + // recorder = await createRecorder(ctx); + // }); + + // afterEach(async function() { + // await recorder.stop(); + // ); + + it("sample test", async function () { + assert.equal(1, 1); + }); +}); diff --git a/sdk/artifactsigning/arm-artifactsigning/test/public/utils/recordedClient.ts b/sdk/artifactsigning/arm-artifactsigning/test/public/utils/recordedClient.ts new file mode 100644 index 000000000000..285e4643c45e --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/test/public/utils/recordedClient.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder"; +import { Recorder } from "@azure-tools/test-recorder"; + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id", +}; + +const recorderEnvSetup: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables, +}; + +/** + * creates the recorder and reads the environment variables from the `.env` file. + * Should be called first in the test suite to make sure environment variables are + * read before they are being used. + */ +export async function createRecorder(context: VitestTestContext): Promise { + const recorder = new Recorder(context); + await recorder.start(recorderEnvSetup); + return recorder; +} diff --git a/sdk/artifactsigning/arm-artifactsigning/test/snippets.spec.ts b/sdk/artifactsigning/arm-artifactsigning/test/snippets.spec.ts new file mode 100644 index 000000000000..b26a8d65412f --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/test/snippets.spec.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { CodeSigningClient } from "../src/index.js"; +import { DefaultAzureCredential, InteractiveBrowserCredential } from "@azure/identity"; +import { setLogLevel } from "@azure/logger"; +import { describe, it } from "vitest"; + +describe("snippets", () => { + it("ReadmeSampleCreateClient_Node", async () => { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new CodeSigningClient(new DefaultAzureCredential(), subscriptionId); + }); + + it("ReadmeSampleCreateClient_Browser", async () => { + const credential = new InteractiveBrowserCredential({ + tenantId: "", + clientId: "", + }); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new CodeSigningClient(credential, subscriptionId); + }); + + it("SetLogLevel", async () => { + setLogLevel("info"); + }); +}); diff --git a/sdk/artifactsigning/arm-artifactsigning/tsconfig.browser.config.json b/sdk/artifactsigning/arm-artifactsigning/tsconfig.browser.config.json new file mode 100644 index 000000000000..bc115d27a2a2 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/tsconfig.browser.config.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.browser.base.json", + "compilerOptions": { + "paths": { + "@azure/arm-artifactsigning": ["./dist/browser/index.d.ts"], + "@azure/arm-artifactsigning/*": ["./dist/browser/*"], + "$internal/*": ["./dist/browser/*"] + } + } +} diff --git a/sdk/artifactsigning/arm-artifactsigning/tsconfig.json b/sdk/artifactsigning/arm-artifactsigning/tsconfig.json new file mode 100644 index 000000000000..0e57dbd186e5 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/tsconfig.json @@ -0,0 +1,16 @@ +{ + "references": [ + { + "path": "./tsconfig.src.json" + }, + { + "path": "./tsconfig.samples.json" + }, + { + "path": "./tsconfig.test.json" + }, + { + "path": "./tsconfig.snippets.json" + } + ] +} diff --git a/sdk/artifactsigning/arm-artifactsigning/tsconfig.samples.json b/sdk/artifactsigning/arm-artifactsigning/tsconfig.samples.json new file mode 100644 index 000000000000..aa2473406a1c --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/arm-artifactsigning": ["./dist/esm"] + } + } +} diff --git a/sdk/artifactsigning/arm-artifactsigning/tsconfig.snippets.json b/sdk/artifactsigning/arm-artifactsigning/tsconfig.snippets.json new file mode 100644 index 000000000000..6f3148b5ed97 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/tsconfig.snippets.json @@ -0,0 +1,3 @@ +{ + "extends": ["../../../tsconfig.snippets.base.json"] +} diff --git a/sdk/artifactsigning/arm-artifactsigning/tsconfig.src.json b/sdk/artifactsigning/arm-artifactsigning/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/artifactsigning/arm-artifactsigning/tsconfig.test.json b/sdk/artifactsigning/arm-artifactsigning/tsconfig.test.json new file mode 100644 index 000000000000..42798ad68913 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/tsconfig.test.json @@ -0,0 +1,14 @@ +{ + "references": [ + { + "path": "./tsconfig.test.node.json" + }, + { + "path": "./tsconfig.browser.config.json" + } + ], + "compilerOptions": { + "composite": true + }, + "files": [] +} diff --git a/sdk/artifactsigning/arm-artifactsigning/tsconfig.test.node.json b/sdk/artifactsigning/arm-artifactsigning/tsconfig.test.node.json new file mode 100644 index 000000000000..888dde9601da --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/tsconfig.test.node.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.test.node.base.json", + "compilerOptions": { + "paths": { + "@azure/arm-artifactsigning": ["./src/index.ts"], + "@azure/arm-artifactsigning/*": ["./src/*"], + "$internal/*": ["./src/*"] + } + } +} diff --git a/sdk/artifactsigning/arm-artifactsigning/tsp-location.yaml b/sdk/artifactsigning/arm-artifactsigning/tsp-location.yaml new file mode 100644 index 000000000000..98197b250642 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/codesigning/CodeSigning.Management +commit: 095b67fa70bf85a51667949506fe090e987d2475 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/artifactsigning/arm-artifactsigning/vitest.browser.config.ts b/sdk/artifactsigning/arm-artifactsigning/vitest.browser.config.ts new file mode 100644 index 000000000000..72964f281efe --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/vitest.browser.config.ts @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import viteConfig from "../../../vitest.browser.shared.config.ts"; + +export default viteConfig; diff --git a/sdk/artifactsigning/arm-artifactsigning/vitest.config.ts b/sdk/artifactsigning/arm-artifactsigning/vitest.config.ts new file mode 100644 index 000000000000..0dfa15cc4498 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/vitest.config.ts @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import viteConfig from "../../../vitest.shared.config.ts"; + +export default viteConfig; diff --git a/sdk/artifactsigning/arm-artifactsigning/vitest.esm.config.ts b/sdk/artifactsigning/arm-artifactsigning/vitest.esm.config.ts new file mode 100644 index 000000000000..5e9735e9b144 --- /dev/null +++ b/sdk/artifactsigning/arm-artifactsigning/vitest.esm.config.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { mergeConfig } from "vitest/config"; +import vitestConfig from "./vitest.config.ts"; +import vitestEsmConfig from "../../../vitest.esm.shared.config.ts"; + +export default mergeConfig(vitestConfig, vitestEsmConfig); diff --git a/sdk/artifactsigning/ci.mgmt.yml b/sdk/artifactsigning/ci.mgmt.yml new file mode 100644 index 000000000000..ba9790b63859 --- /dev/null +++ b/sdk/artifactsigning/ci.mgmt.yml @@ -0,0 +1,35 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/artifactsigning/arm-artifactsigning + - sdk/artifactsigning/ci.mgmt.yml +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/artifactsigning/arm-artifactsigning + - sdk/artifactsigning/ci.mgmt.yml +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: artifactsigning + Artifacts: + - name: azure-arm-artifactsigning + safeName: azurearmartifactsigning