diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index cbc86cf746a4..ad84f04074b7 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1644,6 +1644,9 @@ sdk/workloadorchestration/arm-workloadorchestration/ @qiaozha @MaryGao # PRLabel: %Mgmt sdk/compute/arm-computerecommender/ @qiaozha @MaryGao +# PRLabel: %Mgmt +sdk/compute/arm-compute-disk/ @qiaozha @MaryGao + ########### # Config ########### diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index acbe40086fa3..756507fb593a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6048,6 +6048,88 @@ importers: specifier: catalog:testing version: 4.0.9(@types/debug@4.1.12)(@types/node@20.19.25)(@vitest/browser-playwright@4.0.9)(jsdom@16.7.0)(msw@2.7.3(@types/node@20.19.25)(typescript@5.9.3))(terser@5.39.0)(tsx@4.20.6)(yaml@2.8.1) + sdk/compute/arm-compute-disk: + 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.11.1 + '@types/node': + specifier: 'catalog:' + version: 20.19.25 + '@vitest/browser-playwright': + specifier: catalog:testing + version: 4.0.9(msw@2.7.3(@types/node@20.19.25)(typescript@5.9.3))(playwright@1.56.1)(vite@7.2.2(@types/node@20.19.25)(terser@5.39.0)(tsx@4.20.6)(yaml@2.8.1))(vitest@4.0.9) + '@vitest/coverage-istanbul': + specifier: catalog:testing + version: 4.0.9(vitest@4.0.9) + cross-env: + specifier: 'catalog:' + version: 7.0.3 + dotenv: + specifier: catalog:testing + version: 16.6.1 + eslint: + specifier: 'catalog:' + version: 9.39.1 + playwright: + specifier: catalog:testing + version: 1.56.1 + prettier: + specifier: 'catalog:' + version: 3.6.2 + rimraf: + specifier: 'catalog:' + version: 6.1.0 + tshy: + specifier: 'catalog:' + version: 3.1.0 + typescript: + specifier: 'catalog:' + version: 5.9.3 + vitest: + specifier: catalog:testing + version: 4.0.9(@types/debug@4.1.12)(@types/node@20.19.25)(@vitest/browser-playwright@4.0.9)(jsdom@16.7.0)(msw@2.7.3(@types/node@20.19.25)(typescript@5.9.3))(terser@5.39.0)(tsx@4.20.6)(yaml@2.8.1) + sdk/compute/arm-compute-profile-2020-09-01-hybrid: dependencies: '@azure/abort-controller': diff --git a/sdk/compute/arm-compute-disk/CHANGELOG.md b/sdk/compute/arm-compute-disk/CHANGELOG.md new file mode 100644 index 000000000000..876e4d411faf --- /dev/null +++ b/sdk/compute/arm-compute-disk/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 1.0.0-beta.1 (2025-11-18) + +### Features Added + +This is the first stable version with the package of @azure/arm-compute-disk diff --git a/sdk/compute/arm-compute-disk/LICENSE b/sdk/compute/arm-compute-disk/LICENSE new file mode 100644 index 000000000000..63447fd8bbbf --- /dev/null +++ b/sdk/compute/arm-compute-disk/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/compute/arm-compute-disk/README.md b/sdk/compute/arm-compute-disk/README.md new file mode 100644 index 000000000000..3fed25264ba9 --- /dev/null +++ b/sdk/compute/arm-compute-disk/README.md @@ -0,0 +1,115 @@ +# Azure Compute client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Compute client. + +Compute Client + +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/compute/arm-compute-disk) +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-compute-disk) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-compute-disk) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/compute/arm-compute-disk/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-compute-disk` package + +Install the Azure Compute client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-compute-disk +``` + +### Create and authenticate a `ComputeClient` + +To create a client object to access the Azure Compute API, you will need the `endpoint` of your Azure Compute resource and a `credential`. The Azure Compute client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Compute 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/master/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 Compute** 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 { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new ComputeClient(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 { ComputeClient } from "@azure/arm-compute-disk"; + +const credential = new InteractiveBrowserCredential({ + tenantId: "", + clientId: "", +}); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new ComputeClient(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 + +### ComputeClient + +`ComputeClient` is the primary interface for developers using the Azure Compute client library. Explore the methods on this client object to understand the different features of the Azure Compute 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/compute/arm-compute-disk/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/compute/arm-compute-disk/api-extractor.json b/sdk/compute/arm-compute-disk/api-extractor.json new file mode 100644 index 000000000000..870d6d399477 --- /dev/null +++ b/sdk/compute/arm-compute-disk/api-extractor.json @@ -0,0 +1 @@ +{ "extends": "../../../api-extractor-base.json" } diff --git a/sdk/compute/arm-compute-disk/eslint.config.mjs b/sdk/compute/arm-compute-disk/eslint.config.mjs new file mode 100644 index 000000000000..6d2f8a5914c3 --- /dev/null +++ b/sdk/compute/arm-compute-disk/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/compute/arm-compute-disk/metadata.json b/sdk/compute/arm-compute-disk/metadata.json new file mode 100644 index 000000000000..f7330acc8e31 --- /dev/null +++ b/sdk/compute/arm-compute-disk/metadata.json @@ -0,0 +1,139 @@ +{ + "apiVersion": "2025-01-02", + "emitterVersion": "0.46.1", + "crossLanguageDefinitions": { + "CrossLanguagePackageId": "Microsoft.Compute", + "CrossLanguageDefinitionId": { + "@azure/arm-compute-disk!Disk:interface": "Microsoft.Compute.Disk", + "@azure/arm-compute-disk!DiskProperties:interface": "Microsoft.Compute.DiskProperties", + "@azure/arm-compute-disk!DiskPurchasePlan:interface": "Microsoft.Compute.DiskPurchasePlan", + "@azure/arm-compute-disk!SupportedCapabilities:interface": "Microsoft.Compute.SupportedCapabilities", + "@azure/arm-compute-disk!CreationData:interface": "Microsoft.Compute.CreationData", + "@azure/arm-compute-disk!ImageDiskReference:interface": "Microsoft.Compute.ImageDiskReference", + "@azure/arm-compute-disk!EncryptionSettingsCollection:interface": "Microsoft.Compute.EncryptionSettingsCollection", + "@azure/arm-compute-disk!EncryptionSettingsElement:interface": "Microsoft.Compute.EncryptionSettingsElement", + "@azure/arm-compute-disk!KeyVaultAndSecretReference:interface": "Microsoft.Compute.KeyVaultAndSecretReference", + "@azure/arm-compute-disk!SourceVault:interface": "Microsoft.Compute.SourceVault", + "@azure/arm-compute-disk!KeyVaultAndKeyReference:interface": "Microsoft.Compute.KeyVaultAndKeyReference", + "@azure/arm-compute-disk!Encryption:interface": "Microsoft.Compute.Encryption", + "@azure/arm-compute-disk!ShareInfoElement:interface": "Microsoft.Compute.ShareInfoElement", + "@azure/arm-compute-disk!PropertyUpdatesInProgress:interface": "Microsoft.Compute.PropertyUpdatesInProgress", + "@azure/arm-compute-disk!DiskSecurityProfile:interface": "Microsoft.Compute.DiskSecurityProfile", + "@azure/arm-compute-disk!AvailabilityPolicy:interface": "Microsoft.Compute.AvailabilityPolicy", + "@azure/arm-compute-disk!DiskSku:interface": "Microsoft.Compute.DiskSku", + "@azure/arm-compute-disk!ExtendedLocation:interface": "Microsoft.Compute.ExtendedLocation", + "@azure/arm-compute-disk!TrackedResource:interface": "Azure.ResourceManager.CommonTypes.TrackedResource", + "@azure/arm-compute-disk!Resource:interface": "Azure.ResourceManager.CommonTypes.Resource", + "@azure/arm-compute-disk!SystemData:interface": "Azure.ResourceManager.CommonTypes.SystemData", + "@azure/arm-compute-disk!CloudError:interface": "Microsoft.Compute.CloudError", + "@azure/arm-compute-disk!ApiError:interface": "Microsoft.Compute.ApiError", + "@azure/arm-compute-disk!ApiErrorBase:interface": "Microsoft.Compute.ApiErrorBase", + "@azure/arm-compute-disk!InnerError:interface": "Microsoft.Compute.InnerError", + "@azure/arm-compute-disk!ArmOperationStatusResourceProvisioningState:interface": "Azure.ResourceManager.ArmOperationStatus", + "@azure/arm-compute-disk!ErrorDetail:interface": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "@azure/arm-compute-disk!ErrorAdditionalInfo:interface": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "@azure/arm-compute-disk!DiskUpdate:interface": "Microsoft.Compute.DiskUpdate", + "@azure/arm-compute-disk!DiskUpdateProperties:interface": "Microsoft.Compute.DiskUpdateProperties", + "@azure/arm-compute-disk!DiskList:interface": "Microsoft.Compute.DiskList", + "@azure/arm-compute-disk!GrantAccessData:interface": "Microsoft.Compute.GrantAccessData", + "@azure/arm-compute-disk!AccessUri:interface": "Microsoft.Compute.AccessUri", + "@azure/arm-compute-disk!DiskAccess:interface": "Microsoft.Compute.DiskAccess", + "@azure/arm-compute-disk!DiskAccessProperties:interface": "Microsoft.Compute.DiskAccessProperties", + "@azure/arm-compute-disk!PrivateEndpointConnection:interface": "Microsoft.Compute.PrivateEndpointConnection", + "@azure/arm-compute-disk!PrivateEndpointConnectionProperties:interface": "Microsoft.Compute.PrivateEndpointConnectionProperties", + "@azure/arm-compute-disk!PrivateEndpoint:interface": "Microsoft.Compute.PrivateEndpoint", + "@azure/arm-compute-disk!PrivateLinkServiceConnectionState:interface": "Microsoft.Compute.PrivateLinkServiceConnectionState", + "@azure/arm-compute-disk!ProxyResource:interface": "Azure.ResourceManager.CommonTypes.ProxyResource", + "@azure/arm-compute-disk!DiskAccessUpdate:interface": "Microsoft.Compute.DiskAccessUpdate", + "@azure/arm-compute-disk!DiskAccessList:interface": "Microsoft.Compute.DiskAccessList", + "@azure/arm-compute-disk!PrivateLinkResourceListResult:interface": "Microsoft.Compute.PrivateLinkResourceListResult", + "@azure/arm-compute-disk!PrivateLinkResource:interface": "Microsoft.Compute.PrivateLinkResource", + "@azure/arm-compute-disk!PrivateLinkResourceProperties:interface": "Microsoft.Compute.PrivateLinkResourceProperties", + "@azure/arm-compute-disk!PrivateEndpointConnectionListResult:interface": "Microsoft.Compute.PrivateEndpointConnectionListResult", + "@azure/arm-compute-disk!DiskEncryptionSet:interface": "Microsoft.Compute.DiskEncryptionSet", + "@azure/arm-compute-disk!EncryptionSetProperties:interface": "Microsoft.Compute.EncryptionSetProperties", + "@azure/arm-compute-disk!KeyForDiskEncryptionSet:interface": "Microsoft.Compute.KeyForDiskEncryptionSet", + "@azure/arm-compute-disk!EncryptionSetIdentity:interface": "Microsoft.Compute.EncryptionSetIdentity", + "@azure/arm-compute-disk!UserAssignedIdentitiesValue:interface": "Microsoft.Compute.UserAssignedIdentitiesValue", + "@azure/arm-compute-disk!DiskEncryptionSetUpdate:interface": "Microsoft.Compute.DiskEncryptionSetUpdate", + "@azure/arm-compute-disk!DiskEncryptionSetUpdateProperties:interface": "Microsoft.Compute.DiskEncryptionSetUpdateProperties", + "@azure/arm-compute-disk!DiskEncryptionSetList:interface": "Microsoft.Compute.DiskEncryptionSetList", + "@azure/arm-compute-disk!ResourceUriList:interface": "Microsoft.Compute.ResourceUriList", + "@azure/arm-compute-disk!Snapshot:interface": "Microsoft.Compute.Snapshot", + "@azure/arm-compute-disk!SnapshotProperties:interface": "Microsoft.Compute.SnapshotProperties", + "@azure/arm-compute-disk!CopyCompletionError:interface": "Microsoft.Compute.CopyCompletionError", + "@azure/arm-compute-disk!SnapshotSku:interface": "Microsoft.Compute.SnapshotSku", + "@azure/arm-compute-disk!SnapshotUpdate:interface": "Microsoft.Compute.SnapshotUpdate", + "@azure/arm-compute-disk!SnapshotUpdateProperties:interface": "Microsoft.Compute.SnapshotUpdateProperties", + "@azure/arm-compute-disk!SnapshotList:interface": "Microsoft.Compute.SnapshotList", + "@azure/arm-compute-disk!DiskRestorePoint:interface": "Microsoft.Compute.DiskRestorePoint", + "@azure/arm-compute-disk!DiskRestorePointProperties:interface": "Microsoft.Compute.DiskRestorePointProperties", + "@azure/arm-compute-disk!DiskRestorePointList:interface": "Microsoft.Compute.DiskRestorePointList", + "@azure/arm-compute-disk!KnownOperatingSystemTypes:enum": "Microsoft.Compute.OperatingSystemTypes", + "@azure/arm-compute-disk!KnownHyperVGeneration:enum": "Microsoft.Compute.HyperVGeneration", + "@azure/arm-compute-disk!KnownArchitecture:enum": "Microsoft.Compute.Architecture", + "@azure/arm-compute-disk!KnownSupportedSecurityOption:enum": "Microsoft.Compute.SupportedSecurityOption", + "@azure/arm-compute-disk!KnownDiskCreateOption:enum": "Microsoft.Compute.DiskCreateOption", + "@azure/arm-compute-disk!KnownProvisionedBandwidthCopyOption:enum": "Microsoft.Compute.ProvisionedBandwidthCopyOption", + "@azure/arm-compute-disk!KnownDiskState:enum": "Microsoft.Compute.DiskState", + "@azure/arm-compute-disk!KnownEncryptionType:enum": "Microsoft.Compute.EncryptionType", + "@azure/arm-compute-disk!KnownNetworkAccessPolicy:enum": "Microsoft.Compute.NetworkAccessPolicy", + "@azure/arm-compute-disk!KnownDiskSecurityTypes:enum": "Microsoft.Compute.DiskSecurityTypes", + "@azure/arm-compute-disk!KnownPublicNetworkAccess:enum": "Microsoft.Compute.PublicNetworkAccess", + "@azure/arm-compute-disk!KnownDataAccessAuthMode:enum": "Microsoft.Compute.DataAccessAuthMode", + "@azure/arm-compute-disk!KnownAvailabilityPolicyDiskDelay:enum": "Microsoft.Compute.AvailabilityPolicyDiskDelay", + "@azure/arm-compute-disk!KnownDiskStorageAccountTypes:enum": "Microsoft.Compute.DiskStorageAccountTypes", + "@azure/arm-compute-disk!KnownExtendedLocationTypes:enum": "Microsoft.Compute.ExtendedLocationTypes", + "@azure/arm-compute-disk!KnowncreatedByType:enum": "Azure.ResourceManager.CommonTypes.createdByType", + "@azure/arm-compute-disk!KnownResourceProvisioningState:enum": "Azure.ResourceManager.ResourceProvisioningState", + "@azure/arm-compute-disk!KnownAccessLevel:enum": "Microsoft.Compute.AccessLevel", + "@azure/arm-compute-disk!KnownFileFormat:enum": "Microsoft.Compute.FileFormat", + "@azure/arm-compute-disk!KnownPrivateEndpointServiceConnectionStatus:enum": "Microsoft.Compute.PrivateEndpointServiceConnectionStatus", + "@azure/arm-compute-disk!KnownPrivateEndpointConnectionProvisioningState:enum": "Microsoft.Compute.PrivateEndpointConnectionProvisioningState", + "@azure/arm-compute-disk!KnownDiskEncryptionSetType:enum": "Microsoft.Compute.DiskEncryptionSetType", + "@azure/arm-compute-disk!KnownDiskEncryptionSetIdentityType:enum": "Microsoft.Compute.DiskEncryptionSetIdentityType", + "@azure/arm-compute-disk!KnownCopyCompletionErrorReason:enum": "Microsoft.Compute.CopyCompletionErrorReason", + "@azure/arm-compute-disk!KnownSnapshotAccessState:enum": "Microsoft.Compute.SnapshotAccessState", + "@azure/arm-compute-disk!KnownSnapshotStorageAccountTypes:enum": "Microsoft.Compute.SnapshotStorageAccountTypes", + "@azure/arm-compute-disk!KnownVersions:enum": "Microsoft.Compute.Versions", + "@azure/arm-compute-disk!DiskRestorePointOperations#revokeAccess:member": "Microsoft.Compute.DiskRestorePoints.revokeAccess", + "@azure/arm-compute-disk!DiskRestorePointOperations#grantAccess:member": "Microsoft.Compute.DiskRestorePoints.grantAccess", + "@azure/arm-compute-disk!DiskRestorePointOperations#listByRestorePoint:member": "Microsoft.Compute.DiskRestorePoints.listByRestorePoint", + "@azure/arm-compute-disk!DiskRestorePointOperations#get:member": "Microsoft.Compute.DiskRestorePoints.get", + "@azure/arm-compute-disk!SnapshotsOperations#revokeAccess:member": "Microsoft.Compute.Snapshots.revokeAccess", + "@azure/arm-compute-disk!SnapshotsOperations#grantAccess:member": "Microsoft.Compute.Snapshots.grantAccess", + "@azure/arm-compute-disk!SnapshotsOperations#list:member": "Microsoft.Compute.Snapshots.list", + "@azure/arm-compute-disk!SnapshotsOperations#listByResourceGroup:member": "Microsoft.Compute.Snapshots.listByResourceGroup", + "@azure/arm-compute-disk!SnapshotsOperations#delete:member": "Microsoft.Compute.Snapshots.delete", + "@azure/arm-compute-disk!SnapshotsOperations#update:member": "Microsoft.Compute.Snapshots.update", + "@azure/arm-compute-disk!SnapshotsOperations#createOrUpdate:member": "Microsoft.Compute.Snapshots.createOrUpdate", + "@azure/arm-compute-disk!SnapshotsOperations#get:member": "Microsoft.Compute.Snapshots.get", + "@azure/arm-compute-disk!DiskEncryptionSetsOperations#listAssociatedResources:member": "Microsoft.Compute.DiskEncryptionSets.listAssociatedResources", + "@azure/arm-compute-disk!DiskEncryptionSetsOperations#list:member": "Microsoft.Compute.DiskEncryptionSets.list", + "@azure/arm-compute-disk!DiskEncryptionSetsOperations#listByResourceGroup:member": "Microsoft.Compute.DiskEncryptionSets.listByResourceGroup", + "@azure/arm-compute-disk!DiskEncryptionSetsOperations#delete:member": "Microsoft.Compute.DiskEncryptionSets.delete", + "@azure/arm-compute-disk!DiskEncryptionSetsOperations#update:member": "Microsoft.Compute.DiskEncryptionSets.update", + "@azure/arm-compute-disk!DiskEncryptionSetsOperations#createOrUpdate:member": "Microsoft.Compute.DiskEncryptionSets.createOrUpdate", + "@azure/arm-compute-disk!DiskEncryptionSetsOperations#get:member": "Microsoft.Compute.DiskEncryptionSets.get", + "@azure/arm-compute-disk!DiskAccessesOperations#listPrivateEndpointConnections:member": "Microsoft.Compute.PrivateEndpointConnections.listPrivateEndpointConnections", + "@azure/arm-compute-disk!DiskAccessesOperations#deleteAPrivateEndpointConnection:member": "Microsoft.Compute.PrivateEndpointConnections.deleteAPrivateEndpointConnection", + "@azure/arm-compute-disk!DiskAccessesOperations#updateAPrivateEndpointConnection:member": "Microsoft.Compute.PrivateEndpointConnections.updateAPrivateEndpointConnection", + "@azure/arm-compute-disk!DiskAccessesOperations#getAPrivateEndpointConnection:member": "Microsoft.Compute.PrivateEndpointConnections.getAPrivateEndpointConnection", + "@azure/arm-compute-disk!DiskAccessesOperations#getPrivateLinkResources:member": "Microsoft.Compute.DiskAccesses.getPrivateLinkResources", + "@azure/arm-compute-disk!DiskAccessesOperations#list:member": "Microsoft.Compute.DiskAccesses.list", + "@azure/arm-compute-disk!DiskAccessesOperations#listByResourceGroup:member": "Microsoft.Compute.DiskAccesses.listByResourceGroup", + "@azure/arm-compute-disk!DiskAccessesOperations#delete:member": "Microsoft.Compute.DiskAccesses.delete", + "@azure/arm-compute-disk!DiskAccessesOperations#update:member": "Microsoft.Compute.DiskAccesses.update", + "@azure/arm-compute-disk!DiskAccessesOperations#createOrUpdate:member": "Microsoft.Compute.DiskAccesses.createOrUpdate", + "@azure/arm-compute-disk!DiskAccessesOperations#get:member": "Microsoft.Compute.DiskAccesses.get", + "@azure/arm-compute-disk!DisksOperations#revokeAccess:member": "Microsoft.Compute.Disks.revokeAccess", + "@azure/arm-compute-disk!DisksOperations#grantAccess:member": "Microsoft.Compute.Disks.grantAccess", + "@azure/arm-compute-disk!DisksOperations#list:member": "Microsoft.Compute.Disks.list", + "@azure/arm-compute-disk!DisksOperations#listByResourceGroup:member": "Microsoft.Compute.Disks.listByResourceGroup", + "@azure/arm-compute-disk!DisksOperations#delete:member": "Microsoft.Compute.Disks.delete", + "@azure/arm-compute-disk!DisksOperations#update:member": "Microsoft.Compute.Disks.update", + "@azure/arm-compute-disk!DisksOperations#createOrUpdate:member": "Microsoft.Compute.Disks.createOrUpdate", + "@azure/arm-compute-disk!DisksOperations#get:member": "Microsoft.Compute.Disks.get" + } + } +} diff --git a/sdk/compute/arm-compute-disk/package.json b/sdk/compute/arm-compute-disk/package.json new file mode 100644 index 000000000000..e1c8554d61cf --- /dev/null +++ b/sdk/compute/arm-compute-disk/package.json @@ -0,0 +1,273 @@ +{ + "name": "@azure/arm-compute-disk", + "version": "1.0.0-beta.1", + "description": "A generated SDK for ComputeClient.", + "engines": { + "node": ">=20.0.0" + }, + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./api": "./src/api/index.ts", + "./api/diskRestorePoint": "./src/api/diskRestorePoint/index.ts", + "./api/snapshots": "./src/api/snapshots/index.ts", + "./api/diskEncryptionSets": "./src/api/diskEncryptionSets/index.ts", + "./api/diskAccesses": "./src/api/diskAccesses/index.ts", + "./api/disks": "./src/api/disks/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/compute/arm-compute-disk/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/computeContext.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": "echo skipped", + "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-compute-disk", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/arm-compute-disk?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/diskRestorePoint": { + "browser": { + "types": "./dist/browser/api/diskRestorePoint/index.d.ts", + "default": "./dist/browser/api/diskRestorePoint/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/diskRestorePoint/index.d.ts", + "default": "./dist/react-native/api/diskRestorePoint/index.js" + }, + "import": { + "types": "./dist/esm/api/diskRestorePoint/index.d.ts", + "default": "./dist/esm/api/diskRestorePoint/index.js" + }, + "require": { + "types": "./dist/commonjs/api/diskRestorePoint/index.d.ts", + "default": "./dist/commonjs/api/diskRestorePoint/index.js" + } + }, + "./api/snapshots": { + "browser": { + "types": "./dist/browser/api/snapshots/index.d.ts", + "default": "./dist/browser/api/snapshots/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/snapshots/index.d.ts", + "default": "./dist/react-native/api/snapshots/index.js" + }, + "import": { + "types": "./dist/esm/api/snapshots/index.d.ts", + "default": "./dist/esm/api/snapshots/index.js" + }, + "require": { + "types": "./dist/commonjs/api/snapshots/index.d.ts", + "default": "./dist/commonjs/api/snapshots/index.js" + } + }, + "./api/diskEncryptionSets": { + "browser": { + "types": "./dist/browser/api/diskEncryptionSets/index.d.ts", + "default": "./dist/browser/api/diskEncryptionSets/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/diskEncryptionSets/index.d.ts", + "default": "./dist/react-native/api/diskEncryptionSets/index.js" + }, + "import": { + "types": "./dist/esm/api/diskEncryptionSets/index.d.ts", + "default": "./dist/esm/api/diskEncryptionSets/index.js" + }, + "require": { + "types": "./dist/commonjs/api/diskEncryptionSets/index.d.ts", + "default": "./dist/commonjs/api/diskEncryptionSets/index.js" + } + }, + "./api/diskAccesses": { + "browser": { + "types": "./dist/browser/api/diskAccesses/index.d.ts", + "default": "./dist/browser/api/diskAccesses/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/diskAccesses/index.d.ts", + "default": "./dist/react-native/api/diskAccesses/index.js" + }, + "import": { + "types": "./dist/esm/api/diskAccesses/index.d.ts", + "default": "./dist/esm/api/diskAccesses/index.js" + }, + "require": { + "types": "./dist/commonjs/api/diskAccesses/index.d.ts", + "default": "./dist/commonjs/api/diskAccesses/index.js" + } + }, + "./api/disks": { + "browser": { + "types": "./dist/browser/api/disks/index.d.ts", + "default": "./dist/browser/api/disks/index.js" + }, + "react-native": { + "types": "./dist/react-native/api/disks/index.d.ts", + "default": "./dist/react-native/api/disks/index.js" + }, + "import": { + "types": "./dist/esm/api/disks/index.d.ts", + "default": "./dist/esm/api/disks/index.js" + }, + "require": { + "types": "./dist/commonjs/api/disks/index.d.ts", + "default": "./dist/commonjs/api/disks/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/compute/arm-compute-disk/review/arm-compute-disk-api-diskAccesses-node.api.md b/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-diskAccesses-node.api.md new file mode 100644 index 000000000000..4367e3f2a862 --- /dev/null +++ b/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-diskAccesses-node.api.md @@ -0,0 +1,96 @@ +## API Report File for "@azure/arm-compute-disk" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: ComputeDiskContext, resourceGroupName: string, diskAccessName: string, options?: DiskAccessesDeleteOptionalParams): PollerLike, void>; + +// @public +export function createOrUpdate(context: ComputeDiskContext, resourceGroupName: string, diskAccessName: string, diskAccess: DiskAccess, options?: DiskAccessesCreateOrUpdateOptionalParams): PollerLike, DiskAccess>; + +// @public +export function deleteAPrivateEndpointConnection(context: ComputeDiskContext, resourceGroupName: string, diskAccessName: string, privateEndpointConnectionName: string, options?: DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams): PollerLike, void>; + +// @public +export interface DiskAccessesCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskAccessesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskAccessesGetAPrivateEndpointConnectionOptionalParams extends OperationOptions { +} + +// @public +export interface DiskAccessesGetOptionalParams extends OperationOptions { +} + +// @public +export interface DiskAccessesGetPrivateLinkResourcesOptionalParams extends OperationOptions { +} + +// @public +export interface DiskAccessesListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface DiskAccessesListOptionalParams extends OperationOptions { +} + +// @public +export interface DiskAccessesListPrivateEndpointConnectionsOptionalParams extends OperationOptions { +} + +// @public +export interface DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskAccessesUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function get(context: ComputeDiskContext, resourceGroupName: string, diskAccessName: string, options?: DiskAccessesGetOptionalParams): Promise; + +// @public +export function getAPrivateEndpointConnection(context: ComputeDiskContext, resourceGroupName: string, diskAccessName: string, privateEndpointConnectionName: string, options?: DiskAccessesGetAPrivateEndpointConnectionOptionalParams): Promise; + +// @public +export function getPrivateLinkResources(context: ComputeDiskContext, resourceGroupName: string, diskAccessName: string, options?: DiskAccessesGetPrivateLinkResourcesOptionalParams): Promise; + +// @public +export function list(context: ComputeDiskContext, options?: DiskAccessesListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listByResourceGroup(context: ComputeDiskContext, resourceGroupName: string, options?: DiskAccessesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listPrivateEndpointConnections(context: ComputeDiskContext, resourceGroupName: string, diskAccessName: string, options?: DiskAccessesListPrivateEndpointConnectionsOptionalParams): PagedAsyncIterableIterator; + +// @public +export function update(context: ComputeDiskContext, resourceGroupName: string, diskAccessName: string, diskAccess: DiskAccessUpdate, options?: DiskAccessesUpdateOptionalParams): PollerLike, DiskAccess>; + +// @public +export function updateAPrivateEndpointConnection(context: ComputeDiskContext, resourceGroupName: string, diskAccessName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams): PollerLike, PrivateEndpointConnection>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-diskEncryptionSets-node.api.md b/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-diskEncryptionSets-node.api.md new file mode 100644 index 000000000000..86b262c711d3 --- /dev/null +++ b/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-diskEncryptionSets-node.api.md @@ -0,0 +1,66 @@ +## API Report File for "@azure/arm-compute-disk" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: ComputeDiskContext, resourceGroupName: string, diskEncryptionSetName: string, options?: DiskEncryptionSetsDeleteOptionalParams): PollerLike, void>; + +// @public +export function createOrUpdate(context: ComputeDiskContext, resourceGroupName: string, diskEncryptionSetName: string, diskEncryptionSet: DiskEncryptionSet, options?: DiskEncryptionSetsCreateOrUpdateOptionalParams): PollerLike, DiskEncryptionSet>; + +// @public +export interface DiskEncryptionSetsCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskEncryptionSetsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskEncryptionSetsGetOptionalParams extends OperationOptions { +} + +// @public +export interface DiskEncryptionSetsListAssociatedResourcesOptionalParams extends OperationOptions { +} + +// @public +export interface DiskEncryptionSetsListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface DiskEncryptionSetsListOptionalParams extends OperationOptions { +} + +// @public +export interface DiskEncryptionSetsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function get(context: ComputeDiskContext, resourceGroupName: string, diskEncryptionSetName: string, options?: DiskEncryptionSetsGetOptionalParams): Promise; + +// @public +export function list(context: ComputeDiskContext, options?: DiskEncryptionSetsListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listAssociatedResources(context: ComputeDiskContext, resourceGroupName: string, diskEncryptionSetName: string, options?: DiskEncryptionSetsListAssociatedResourcesOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listByResourceGroup(context: ComputeDiskContext, resourceGroupName: string, options?: DiskEncryptionSetsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function update(context: ComputeDiskContext, resourceGroupName: string, diskEncryptionSetName: string, diskEncryptionSet: DiskEncryptionSetUpdate, options?: DiskEncryptionSetsUpdateOptionalParams): PollerLike, DiskEncryptionSet>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-diskRestorePoint-node.api.md b/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-diskRestorePoint-node.api.md new file mode 100644 index 000000000000..d98858ee6ead --- /dev/null +++ b/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-diskRestorePoint-node.api.md @@ -0,0 +1,44 @@ +## API Report File for "@azure/arm-compute-disk" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; + +// @public +export interface DiskRestorePointGetOptionalParams extends OperationOptions { +} + +// @public +export interface DiskRestorePointGrantAccessOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskRestorePointListByRestorePointOptionalParams extends OperationOptions { +} + +// @public +export interface DiskRestorePointRevokeAccessOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function get(context: ComputeDiskContext, resourceGroupName: string, restorePointCollectionName: string, vmRestorePointName: string, diskRestorePointName: string, options?: DiskRestorePointGetOptionalParams): Promise; + +// @public +export function grantAccess(context: ComputeDiskContext, resourceGroupName: string, restorePointCollectionName: string, vmRestorePointName: string, diskRestorePointName: string, grantAccessData: GrantAccessData, options?: DiskRestorePointGrantAccessOptionalParams): PollerLike, AccessUri>; + +// @public +export function listByRestorePoint(context: ComputeDiskContext, resourceGroupName: string, restorePointCollectionName: string, vmRestorePointName: string, options?: DiskRestorePointListByRestorePointOptionalParams): PagedAsyncIterableIterator; + +// @public +export function revokeAccess(context: ComputeDiskContext, resourceGroupName: string, restorePointCollectionName: string, vmRestorePointName: string, diskRestorePointName: string, options?: DiskRestorePointRevokeAccessOptionalParams): PollerLike, void>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-disks-node.api.md b/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-disks-node.api.md new file mode 100644 index 000000000000..fde1a1ff2533 --- /dev/null +++ b/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-disks-node.api.md @@ -0,0 +1,75 @@ +## API Report File for "@azure/arm-compute-disk" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: ComputeDiskContext, resourceGroupName: string, diskName: string, options?: DisksDeleteOptionalParams): PollerLike, void>; + +// @public +export function createOrUpdate(context: ComputeDiskContext, resourceGroupName: string, diskName: string, disk: Disk, options?: DisksCreateOrUpdateOptionalParams): PollerLike, Disk>; + +// @public +export interface DisksCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DisksDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DisksGetOptionalParams extends OperationOptions { +} + +// @public +export interface DisksGrantAccessOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DisksListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface DisksListOptionalParams extends OperationOptions { +} + +// @public +export interface DisksRevokeAccessOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DisksUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function get(context: ComputeDiskContext, resourceGroupName: string, diskName: string, options?: DisksGetOptionalParams): Promise; + +// @public +export function grantAccess(context: ComputeDiskContext, resourceGroupName: string, diskName: string, grantAccessData: GrantAccessData, options?: DisksGrantAccessOptionalParams): PollerLike, AccessUri>; + +// @public +export function list(context: ComputeDiskContext, options?: DisksListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listByResourceGroup(context: ComputeDiskContext, resourceGroupName: string, options?: DisksListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function revokeAccess(context: ComputeDiskContext, resourceGroupName: string, diskName: string, options?: DisksRevokeAccessOptionalParams): PollerLike, void>; + +// @public +export function update(context: ComputeDiskContext, resourceGroupName: string, diskName: string, disk: DiskUpdate, options?: DisksUpdateOptionalParams): PollerLike, Disk>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-node.api.md b/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-node.api.md new file mode 100644 index 000000000000..6a9559b5a5eb --- /dev/null +++ b/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-node.api.md @@ -0,0 +1,28 @@ +## API Report File for "@azure/arm-compute-disk" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { ClientOptions } from '@azure-rest/core-client'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export interface ComputeDiskClientOptionalParams extends ClientOptions { + apiVersion?: string; + cloudSetting?: AzureSupportedClouds; +} + +// @public +export interface ComputeDiskContext extends Client { + apiVersion: string; + subscriptionId: string; +} + +// @public +export function createComputeDisk(credential: TokenCredential, subscriptionId: string, options?: ComputeDiskClientOptionalParams): ComputeDiskContext; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-snapshots-node.api.md b/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-snapshots-node.api.md new file mode 100644 index 000000000000..5baae8def449 --- /dev/null +++ b/sdk/compute/arm-compute-disk/review/arm-compute-disk-api-snapshots-node.api.md @@ -0,0 +1,75 @@ +## API Report File for "@azure/arm-compute-disk" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Client } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PollerLike } from '@azure/core-lro'; + +// @public +export function $delete(context: ComputeDiskContext, resourceGroupName: string, snapshotName: string, options?: SnapshotsDeleteOptionalParams): PollerLike, void>; + +// @public +export function createOrUpdate(context: ComputeDiskContext, resourceGroupName: string, snapshotName: string, snapshot: Snapshot, options?: SnapshotsCreateOrUpdateOptionalParams): PollerLike, Snapshot>; + +// @public +export function get(context: ComputeDiskContext, resourceGroupName: string, snapshotName: string, options?: SnapshotsGetOptionalParams): Promise; + +// @public +export function grantAccess(context: ComputeDiskContext, resourceGroupName: string, snapshotName: string, grantAccessData: GrantAccessData, options?: SnapshotsGrantAccessOptionalParams): PollerLike, AccessUri>; + +// @public +export function list(context: ComputeDiskContext, options?: SnapshotsListOptionalParams): PagedAsyncIterableIterator; + +// @public +export function listByResourceGroup(context: ComputeDiskContext, resourceGroupName: string, options?: SnapshotsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + +// @public +export function revokeAccess(context: ComputeDiskContext, resourceGroupName: string, snapshotName: string, options?: SnapshotsRevokeAccessOptionalParams): PollerLike, void>; + +// @public +export interface SnapshotsCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface SnapshotsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface SnapshotsGetOptionalParams extends OperationOptions { +} + +// @public +export interface SnapshotsGrantAccessOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface SnapshotsListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface SnapshotsListOptionalParams extends OperationOptions { +} + +// @public +export interface SnapshotsRevokeAccessOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface SnapshotsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export function update(context: ComputeDiskContext, resourceGroupName: string, snapshotName: string, snapshot: SnapshotUpdate, options?: SnapshotsUpdateOptionalParams): PollerLike, Snapshot>; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/compute/arm-compute-disk/review/arm-compute-disk-models-node.api.md b/sdk/compute/arm-compute-disk/review/arm-compute-disk-models-node.api.md new file mode 100644 index 000000000000..ff502a511170 --- /dev/null +++ b/sdk/compute/arm-compute-disk/review/arm-compute-disk-models-node.api.md @@ -0,0 +1,861 @@ +## API Report File for "@azure/arm-compute-disk" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// @public +export type AccessLevel = string; + +// @public +export interface AccessUri { + readonly accessSAS?: string; + readonly securityDataAccessSAS?: string; + readonly securityMetadataAccessSAS?: string; +} + +// @public +export interface ApiError { + code?: string; + details?: ApiErrorBase[]; + innererror?: InnerError; + message?: string; + target?: string; +} + +// @public +export interface ApiErrorBase { + code?: string; + message?: string; + target?: string; +} + +// @public +export type Architecture = string; + +// @public +export interface AvailabilityPolicy { + actionOnDiskDelay?: AvailabilityPolicyDiskDelay; +} + +// @public +export type AvailabilityPolicyDiskDelay = string; + +// @public +export interface CloudError { + error?: ApiError; +} + +// @public +export interface CopyCompletionError { + errorCode: CopyCompletionErrorReason; + errorMessage: string; +} + +// @public +export type CopyCompletionErrorReason = string; + +// @public +export type CreatedByType = string; + +// @public +export interface CreationData { + createOption: DiskCreateOption; + elasticSanResourceId?: string; + galleryImageReference?: ImageDiskReference; + imageReference?: ImageDiskReference; + instantAccessDurationMinutes?: number; + logicalSectorSize?: number; + performancePlus?: boolean; + provisionedBandwidthCopySpeed?: ProvisionedBandwidthCopyOption; + securityDataUri?: string; + securityMetadataUri?: string; + sourceResourceId?: string; + readonly sourceUniqueId?: string; + sourceUri?: string; + storageAccountId?: string; + uploadSizeBytes?: number; +} + +// @public +export type DataAccessAuthMode = string; + +// @public +export interface Disk extends TrackedResource { + availabilityPolicy?: AvailabilityPolicy; + burstingEnabled?: boolean; + readonly burstingEnabledTime?: Date; + completionPercent?: number; + creationData?: CreationData; + dataAccessAuthMode?: DataAccessAuthMode; + diskAccessId?: string; + diskIopsReadOnly?: number; + diskIopsReadWrite?: number; + diskMBpsReadOnly?: number; + diskMBpsReadWrite?: number; + readonly diskSizeBytes?: number; + diskSizeGB?: number; + readonly diskState?: DiskState; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + extendedLocation?: ExtendedLocation; + hyperVGeneration?: HyperVGeneration; + readonly lastOwnershipUpdateTime?: Date; + readonly managedBy?: string; + readonly managedByExtended?: string[]; + maxShares?: number; + networkAccessPolicy?: NetworkAccessPolicy; + optimizedForFrequentAttach?: boolean; + osType?: OperatingSystemTypes; + readonly propertyUpdatesInProgress?: PropertyUpdatesInProgress; + readonly provisioningState?: string; + publicNetworkAccess?: PublicNetworkAccess; + purchasePlan?: DiskPurchasePlan; + securityProfile?: DiskSecurityProfile; + readonly shareInfo?: ShareInfoElement[]; + sku?: DiskSku; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + tier?: string; + readonly timeCreated?: Date; + readonly uniqueId?: string; + zones?: string[]; +} + +// @public +export interface DiskAccess extends TrackedResource { + extendedLocation?: ExtendedLocation; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + readonly provisioningState?: string; + readonly timeCreated?: Date; +} + +// @public +export interface DiskAccessProperties { + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + readonly provisioningState?: string; + readonly timeCreated?: Date; +} + +// @public +export interface DiskAccessUpdate { + tags?: Record; +} + +// @public +export type DiskCreateOption = string; + +// @public +export interface DiskEncryptionSet extends TrackedResource { + activeKey?: KeyForDiskEncryptionSet; + readonly autoKeyRotationError?: ApiError; + encryptionType?: DiskEncryptionSetType; + federatedClientId?: string; + identity?: EncryptionSetIdentity; + readonly lastKeyRotationTimestamp?: Date; + readonly previousKeys?: KeyForDiskEncryptionSet[]; + readonly provisioningState?: string; + rotationToLatestKeyVersionEnabled?: boolean; +} + +// @public +export type DiskEncryptionSetIdentityType = string; + +// @public +export type DiskEncryptionSetType = string; + +// @public +export interface DiskEncryptionSetUpdate { + activeKey?: KeyForDiskEncryptionSet; + encryptionType?: DiskEncryptionSetType; + federatedClientId?: string; + identity?: EncryptionSetIdentity; + rotationToLatestKeyVersionEnabled?: boolean; + tags?: Record; +} + +// @public +export interface DiskEncryptionSetUpdateProperties { + activeKey?: KeyForDiskEncryptionSet; + encryptionType?: DiskEncryptionSetType; + federatedClientId?: string; + rotationToLatestKeyVersionEnabled?: boolean; +} + +// @public +export interface DiskProperties { + availabilityPolicy?: AvailabilityPolicy; + burstingEnabled?: boolean; + readonly burstingEnabledTime?: Date; + completionPercent?: number; + creationData?: CreationData; + dataAccessAuthMode?: DataAccessAuthMode; + diskAccessId?: string; + diskIopsReadOnly?: number; + diskIopsReadWrite?: number; + diskMBpsReadOnly?: number; + diskMBpsReadWrite?: number; + readonly diskSizeBytes?: number; + diskSizeGB?: number; + readonly diskState?: DiskState; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + hyperVGeneration?: HyperVGeneration; + readonly lastOwnershipUpdateTime?: Date; + maxShares?: number; + networkAccessPolicy?: NetworkAccessPolicy; + optimizedForFrequentAttach?: boolean; + osType?: OperatingSystemTypes; + readonly propertyUpdatesInProgress?: PropertyUpdatesInProgress; + readonly provisioningState?: string; + publicNetworkAccess?: PublicNetworkAccess; + purchasePlan?: DiskPurchasePlan; + securityProfile?: DiskSecurityProfile; + readonly shareInfo?: ShareInfoElement[]; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + tier?: string; + readonly timeCreated?: Date; + readonly uniqueId?: string; +} + +// @public +export interface DiskPurchasePlan { + name: string; + product: string; + promotionCode?: string; + publisher: string; +} + +// @public +export interface DiskRestorePoint extends ProxyResource { + completionPercent?: number; + diskAccessId?: string; + readonly encryption?: Encryption; + readonly familyId?: string; + hyperVGeneration?: HyperVGeneration; + readonly logicalSectorSize?: number; + networkAccessPolicy?: NetworkAccessPolicy; + readonly osType?: OperatingSystemTypes; + publicNetworkAccess?: PublicNetworkAccess; + purchasePlan?: DiskPurchasePlan; + readonly replicationState?: string; + securityProfile?: DiskSecurityProfile; + readonly sourceResourceId?: string; + readonly sourceResourceLocation?: string; + readonly sourceUniqueId?: string; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + readonly timeCreated?: Date; +} + +// @public +export interface DiskRestorePointProperties { + completionPercent?: number; + diskAccessId?: string; + readonly encryption?: Encryption; + readonly familyId?: string; + hyperVGeneration?: HyperVGeneration; + readonly logicalSectorSize?: number; + networkAccessPolicy?: NetworkAccessPolicy; + readonly osType?: OperatingSystemTypes; + publicNetworkAccess?: PublicNetworkAccess; + purchasePlan?: DiskPurchasePlan; + readonly replicationState?: string; + securityProfile?: DiskSecurityProfile; + readonly sourceResourceId?: string; + readonly sourceResourceLocation?: string; + readonly sourceUniqueId?: string; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + readonly timeCreated?: Date; +} + +// @public +export interface DiskSecurityProfile { + secureVMDiskEncryptionSetId?: string; + securityType?: DiskSecurityTypes; +} + +// @public +export type DiskSecurityTypes = string; + +// @public +export interface DiskSku { + name?: DiskStorageAccountTypes; + readonly tier?: string; +} + +// @public +export type DiskState = string; + +// @public +export type DiskStorageAccountTypes = string; + +// @public +export interface DiskUpdate { + availabilityPolicy?: AvailabilityPolicy; + burstingEnabled?: boolean; + dataAccessAuthMode?: DataAccessAuthMode; + diskAccessId?: string; + diskIopsReadOnly?: number; + diskIopsReadWrite?: number; + diskMBpsReadOnly?: number; + diskMBpsReadWrite?: number; + diskSizeGB?: number; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + maxShares?: number; + networkAccessPolicy?: NetworkAccessPolicy; + optimizedForFrequentAttach?: boolean; + osType?: OperatingSystemTypes; + readonly propertyUpdatesInProgress?: PropertyUpdatesInProgress; + publicNetworkAccess?: PublicNetworkAccess; + purchasePlan?: DiskPurchasePlan; + sku?: DiskSku; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + tags?: Record; + tier?: string; +} + +// @public +export interface DiskUpdateProperties { + availabilityPolicy?: AvailabilityPolicy; + burstingEnabled?: boolean; + dataAccessAuthMode?: DataAccessAuthMode; + diskAccessId?: string; + diskIopsReadOnly?: number; + diskIopsReadWrite?: number; + diskMBpsReadOnly?: number; + diskMBpsReadWrite?: number; + diskSizeGB?: number; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + maxShares?: number; + networkAccessPolicy?: NetworkAccessPolicy; + optimizedForFrequentAttach?: boolean; + osType?: OperatingSystemTypes; + readonly propertyUpdatesInProgress?: PropertyUpdatesInProgress; + publicNetworkAccess?: PublicNetworkAccess; + purchasePlan?: DiskPurchasePlan; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + tier?: string; +} + +// @public +export interface Encryption { + diskEncryptionSetId?: string; + type?: EncryptionType; +} + +// @public +export interface EncryptionSetIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type?: DiskEncryptionSetIdentityType; + userAssignedIdentities?: Record; +} + +// @public +export interface EncryptionSetProperties { + activeKey?: KeyForDiskEncryptionSet; + readonly autoKeyRotationError?: ApiError; + encryptionType?: DiskEncryptionSetType; + federatedClientId?: string; + readonly lastKeyRotationTimestamp?: Date; + readonly previousKeys?: KeyForDiskEncryptionSet[]; + readonly provisioningState?: string; + rotationToLatestKeyVersionEnabled?: boolean; +} + +// @public +export interface EncryptionSettingsCollection { + enabled: boolean; + encryptionSettings?: EncryptionSettingsElement[]; + encryptionSettingsVersion?: string; +} + +// @public +export interface EncryptionSettingsElement { + diskEncryptionKey?: KeyVaultAndSecretReference; + keyEncryptionKey?: KeyVaultAndKeyReference; +} + +// @public +export type EncryptionType = string; + +// @public +export interface ExtendedLocation { + name?: string; + type?: ExtendedLocationTypes; +} + +// @public +export type ExtendedLocationTypes = string; + +// @public +export type FileFormat = string; + +// @public +export interface GrantAccessData { + access: AccessLevel; + durationInSeconds: number; + fileFormat?: FileFormat; + getSecureVMGuestStateSAS?: boolean; +} + +// @public +export type HyperVGeneration = string; + +// @public +export interface ImageDiskReference { + communityGalleryImageId?: string; + id?: string; + lun?: number; + sharedGalleryImageId?: string; +} + +// @public +export interface InnerError { + errordetail?: string; + exceptiontype?: string; +} + +// @public +export interface KeyForDiskEncryptionSet { + keyUrl: string; + sourceVault?: SourceVault; +} + +// @public +export interface KeyVaultAndKeyReference { + keyUrl: string; + sourceVault: SourceVault; +} + +// @public +export interface KeyVaultAndSecretReference { + secretUrl: string; + sourceVault: SourceVault; +} + +// @public +export enum KnownAccessLevel { + None = "None", + Read = "Read", + Write = "Write" +} + +// @public +export enum KnownArchitecture { + Arm64 = "Arm64", + X64 = "x64" +} + +// @public +export enum KnownAvailabilityPolicyDiskDelay { + AutomaticReattach = "AutomaticReattach", + None = "None" +} + +// @public +export enum KnownCopyCompletionErrorReason { + CopySourceNotFound = "CopySourceNotFound" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownDataAccessAuthMode { + AzureActiveDirectory = "AzureActiveDirectory", + None = "None" +} + +// @public +export enum KnownDiskCreateOption { + Attach = "Attach", + Copy = "Copy", + CopyFromSanSnapshot = "CopyFromSanSnapshot", + CopyStart = "CopyStart", + Empty = "Empty", + FromImage = "FromImage", + Import = "Import", + ImportSecure = "ImportSecure", + Restore = "Restore", + Upload = "Upload", + UploadPreparedSecure = "UploadPreparedSecure" +} + +// @public +export enum KnownDiskEncryptionSetIdentityType { + None = "None", + SystemAssigned = "SystemAssigned", + SystemAssignedUserAssigned = "SystemAssigned, UserAssigned", + UserAssigned = "UserAssigned" +} + +// @public +export enum KnownDiskEncryptionSetType { + ConfidentialVmEncryptedWithCustomerKey = "ConfidentialVmEncryptedWithCustomerKey", + EncryptionAtRestWithCustomerKey = "EncryptionAtRestWithCustomerKey", + EncryptionAtRestWithPlatformAndCustomerKeys = "EncryptionAtRestWithPlatformAndCustomerKeys" +} + +// @public +export enum KnownDiskSecurityTypes { + ConfidentialVMDiskEncryptedWithCustomerKey = "ConfidentialVM_DiskEncryptedWithCustomerKey", + ConfidentialVMDiskEncryptedWithPlatformKey = "ConfidentialVM_DiskEncryptedWithPlatformKey", + ConfidentialVMNonPersistedTPM = "ConfidentialVM_NonPersistedTPM", + ConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey = "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", + TrustedLaunch = "TrustedLaunch" +} + +// @public +export enum KnownDiskState { + ActiveSAS = "ActiveSAS", + ActiveSASFrozen = "ActiveSASFrozen", + ActiveUpload = "ActiveUpload", + Attached = "Attached", + Frozen = "Frozen", + ReadyToUpload = "ReadyToUpload", + Reserved = "Reserved", + Unattached = "Unattached" +} + +// @public +export enum KnownDiskStorageAccountTypes { + PremiumLRS = "Premium_LRS", + PremiumV2LRS = "PremiumV2_LRS", + PremiumZRS = "Premium_ZRS", + StandardLRS = "Standard_LRS", + StandardSSDLRS = "StandardSSD_LRS", + StandardSSDZRS = "StandardSSD_ZRS", + UltraSSDLRS = "UltraSSD_LRS" +} + +// @public +export enum KnownEncryptionType { + EncryptionAtRestWithCustomerKey = "EncryptionAtRestWithCustomerKey", + EncryptionAtRestWithPlatformAndCustomerKeys = "EncryptionAtRestWithPlatformAndCustomerKeys", + EncryptionAtRestWithPlatformKey = "EncryptionAtRestWithPlatformKey" +} + +// @public +export enum KnownExtendedLocationTypes { + EdgeZone = "EdgeZone" +} + +// @public +export enum KnownFileFormat { + VHD = "VHD", + Vhdx = "VHDX" +} + +// @public +export enum KnownHyperVGeneration { + V1 = "V1", + V2 = "V2" +} + +// @public +export enum KnownNetworkAccessPolicy { + AllowAll = "AllowAll", + AllowPrivate = "AllowPrivate", + DenyAll = "DenyAll" +} + +// @public +export enum KnownPrivateEndpointConnectionProvisioningState { + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded" +} + +// @public +export enum KnownPrivateEndpointServiceConnectionStatus { + Approved = "Approved", + Pending = "Pending", + Rejected = "Rejected" +} + +// @public +export enum KnownProvisionedBandwidthCopyOption { + Enhanced = "Enhanced", + None = "None" +} + +// @public +export enum KnownPublicNetworkAccess { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownSnapshotAccessState { + Available = "Available", + AvailableWithInstantAccess = "AvailableWithInstantAccess", + InstantAccess = "InstantAccess", + Pending = "Pending", + Unknown = "Unknown" +} + +// @public +export enum KnownSnapshotStorageAccountTypes { + PremiumLRS = "Premium_LRS", + StandardLRS = "Standard_LRS", + StandardZRS = "Standard_ZRS" +} + +// @public +export enum KnownSupportedSecurityOption { + TrustedLaunchAndConfidentialVMSupported = "TrustedLaunchAndConfidentialVMSupported", + TrustedLaunchSupported = "TrustedLaunchSupported" +} + +// @public +export enum KnownVersions { + V20240302 = "2024-03-02", + V20250102 = "2025-01-02" +} + +// @public +export type NetworkAccessPolicy = string; + +// @public +export type OperatingSystemTypes = "Windows" | "Linux"; + +// @public +export interface PrivateEndpoint { + readonly id?: string; +} + +// @public +export interface PrivateEndpointConnection extends ProxyResource { + readonly privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +// @public +export interface PrivateEndpointConnectionProperties { + readonly privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +// @public +export type PrivateEndpointConnectionProvisioningState = string; + +// @public +export type PrivateEndpointServiceConnectionStatus = string; + +// @public +export interface PrivateLinkResource { + readonly groupId?: string; + readonly id?: string; + readonly name?: string; + readonly requiredMembers?: string[]; + requiredZoneNames?: string[]; + readonly type?: string; +} + +// @public +export interface PrivateLinkResourceListResult { + value?: PrivateLinkResource[]; +} + +// @public +export interface PrivateLinkResourceProperties { + readonly groupId?: string; + readonly requiredMembers?: string[]; + requiredZoneNames?: string[]; +} + +// @public +export interface PrivateLinkServiceConnectionState { + actionsRequired?: string; + description?: string; + status?: PrivateEndpointServiceConnectionStatus; +} + +// @public +export interface PropertyUpdatesInProgress { + targetTier?: string; +} + +// @public +export type ProvisionedBandwidthCopyOption = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export type PublicNetworkAccess = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface ShareInfoElement { + readonly vmUri?: string; +} + +// @public +export interface Snapshot extends TrackedResource { + completionPercent?: number; + copyCompletionError?: CopyCompletionError; + creationData?: CreationData; + dataAccessAuthMode?: DataAccessAuthMode; + diskAccessId?: string; + readonly diskSizeBytes?: number; + diskSizeGB?: number; + readonly diskState?: DiskState; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + extendedLocation?: ExtendedLocation; + hyperVGeneration?: HyperVGeneration; + incremental?: boolean; + readonly incrementalSnapshotFamilyId?: string; + readonly managedBy?: string; + networkAccessPolicy?: NetworkAccessPolicy; + osType?: OperatingSystemTypes; + readonly provisioningState?: string; + publicNetworkAccess?: PublicNetworkAccess; + purchasePlan?: DiskPurchasePlan; + securityProfile?: DiskSecurityProfile; + sku?: SnapshotSku; + readonly snapshotAccessState?: SnapshotAccessState; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + readonly timeCreated?: Date; + readonly uniqueId?: string; +} + +// @public +export type SnapshotAccessState = string; + +// @public +export interface SnapshotProperties { + completionPercent?: number; + copyCompletionError?: CopyCompletionError; + creationData?: CreationData; + dataAccessAuthMode?: DataAccessAuthMode; + diskAccessId?: string; + readonly diskSizeBytes?: number; + diskSizeGB?: number; + readonly diskState?: DiskState; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + hyperVGeneration?: HyperVGeneration; + incremental?: boolean; + readonly incrementalSnapshotFamilyId?: string; + networkAccessPolicy?: NetworkAccessPolicy; + osType?: OperatingSystemTypes; + readonly provisioningState?: string; + publicNetworkAccess?: PublicNetworkAccess; + purchasePlan?: DiskPurchasePlan; + securityProfile?: DiskSecurityProfile; + readonly snapshotAccessState?: SnapshotAccessState; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + readonly timeCreated?: Date; + readonly uniqueId?: string; +} + +// @public +export interface SnapshotSku { + name?: SnapshotStorageAccountTypes; + readonly tier?: string; +} + +// @public +export type SnapshotStorageAccountTypes = string; + +// @public +export interface SnapshotUpdate { + dataAccessAuthMode?: DataAccessAuthMode; + diskAccessId?: string; + diskSizeGB?: number; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + networkAccessPolicy?: NetworkAccessPolicy; + osType?: OperatingSystemTypes; + publicNetworkAccess?: PublicNetworkAccess; + sku?: SnapshotSku; + readonly snapshotAccessState?: SnapshotAccessState; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + tags?: Record; +} + +// @public +export interface SnapshotUpdateProperties { + dataAccessAuthMode?: DataAccessAuthMode; + diskAccessId?: string; + diskSizeGB?: number; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + networkAccessPolicy?: NetworkAccessPolicy; + osType?: OperatingSystemTypes; + publicNetworkAccess?: PublicNetworkAccess; + readonly snapshotAccessState?: SnapshotAccessState; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; +} + +// @public +export interface SourceVault { + id?: string; +} + +// @public +export interface SupportedCapabilities { + acceleratedNetwork?: boolean; + architecture?: Architecture; + diskControllerTypes?: string; + supportedSecurityOption?: SupportedSecurityOption; +} + +// @public +export type SupportedSecurityOption = 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; +} + +// @public +export interface UserAssignedIdentitiesValue { + readonly clientId?: string; + readonly principalId?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/compute/arm-compute-disk/review/arm-compute-disk-node.api.md b/sdk/compute/arm-compute-disk/review/arm-compute-disk-node.api.md new file mode 100644 index 000000000000..de034a33f466 --- /dev/null +++ b/sdk/compute/arm-compute-disk/review/arm-compute-disk-node.api.md @@ -0,0 +1,1089 @@ +## API Report File for "@azure/arm-compute-disk" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { AbortSignalLike } from '@azure/abort-controller'; +import { CancelOnProgress } from '@azure/core-lro'; +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { PollerLike } from '@azure/core-lro'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export type AccessLevel = string; + +// @public +export interface AccessUri { + readonly accessSAS?: string; + readonly securityDataAccessSAS?: string; + readonly securityMetadataAccessSAS?: string; +} + +// @public +export interface ApiError { + code?: string; + details?: ApiErrorBase[]; + innererror?: InnerError; + message?: string; + target?: string; +} + +// @public +export interface ApiErrorBase { + code?: string; + message?: string; + target?: string; +} + +// @public +export type Architecture = string; + +// @public +export interface AvailabilityPolicy { + actionOnDiskDelay?: AvailabilityPolicyDiskDelay; +} + +// @public +export type AvailabilityPolicyDiskDelay = 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 CloudError { + error?: ApiError; +} + +// @public (undocumented) +export class ComputeDiskClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: ComputeDiskClientOptionalParams); + readonly diskAccesses: DiskAccessesOperations; + readonly diskEncryptionSets: DiskEncryptionSetsOperations; + readonly diskRestorePoint: DiskRestorePointOperations; + readonly disks: DisksOperations; + readonly pipeline: Pipeline; + readonly snapshots: SnapshotsOperations; +} + +// @public +export interface ComputeDiskClientOptionalParams extends ClientOptions { + apiVersion?: string; + cloudSetting?: AzureSupportedClouds; +} + +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + +// @public +export interface CopyCompletionError { + errorCode: CopyCompletionErrorReason; + errorMessage: string; +} + +// @public +export type CopyCompletionErrorReason = string; + +// @public +export type CreatedByType = string; + +// @public +export interface CreationData { + createOption: DiskCreateOption; + elasticSanResourceId?: string; + galleryImageReference?: ImageDiskReference; + imageReference?: ImageDiskReference; + instantAccessDurationMinutes?: number; + logicalSectorSize?: number; + performancePlus?: boolean; + provisionedBandwidthCopySpeed?: ProvisionedBandwidthCopyOption; + securityDataUri?: string; + securityMetadataUri?: string; + sourceResourceId?: string; + readonly sourceUniqueId?: string; + sourceUri?: string; + storageAccountId?: string; + uploadSizeBytes?: number; +} + +// @public +export type DataAccessAuthMode = string; + +// @public +export interface Disk extends TrackedResource { + availabilityPolicy?: AvailabilityPolicy; + burstingEnabled?: boolean; + readonly burstingEnabledTime?: Date; + completionPercent?: number; + creationData?: CreationData; + dataAccessAuthMode?: DataAccessAuthMode; + diskAccessId?: string; + diskIopsReadOnly?: number; + diskIopsReadWrite?: number; + diskMBpsReadOnly?: number; + diskMBpsReadWrite?: number; + readonly diskSizeBytes?: number; + diskSizeGB?: number; + readonly diskState?: DiskState; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + extendedLocation?: ExtendedLocation; + hyperVGeneration?: HyperVGeneration; + readonly lastOwnershipUpdateTime?: Date; + readonly managedBy?: string; + readonly managedByExtended?: string[]; + maxShares?: number; + networkAccessPolicy?: NetworkAccessPolicy; + optimizedForFrequentAttach?: boolean; + osType?: OperatingSystemTypes; + readonly propertyUpdatesInProgress?: PropertyUpdatesInProgress; + readonly provisioningState?: string; + publicNetworkAccess?: PublicNetworkAccess; + purchasePlan?: DiskPurchasePlan; + securityProfile?: DiskSecurityProfile; + readonly shareInfo?: ShareInfoElement[]; + sku?: DiskSku; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + tier?: string; + readonly timeCreated?: Date; + readonly uniqueId?: string; + zones?: string[]; +} + +// @public +export interface DiskAccess extends TrackedResource { + extendedLocation?: ExtendedLocation; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + readonly provisioningState?: string; + readonly timeCreated?: Date; +} + +// @public +export interface DiskAccessesCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskAccessesDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskAccessesGetAPrivateEndpointConnectionOptionalParams extends OperationOptions { +} + +// @public +export interface DiskAccessesGetOptionalParams extends OperationOptions { +} + +// @public +export interface DiskAccessesGetPrivateLinkResourcesOptionalParams extends OperationOptions { +} + +// @public +export interface DiskAccessesListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface DiskAccessesListOptionalParams extends OperationOptions { +} + +// @public +export interface DiskAccessesListPrivateEndpointConnectionsOptionalParams extends OperationOptions { +} + +// @public +export interface DiskAccessesOperations { + // @deprecated (undocumented) + beginCreateOrUpdate: (resourceGroupName: string, diskAccessName: string, diskAccess: DiskAccess, options?: DiskAccessesCreateOrUpdateOptionalParams) => Promise, DiskAccess>>; + // @deprecated (undocumented) + beginCreateOrUpdateAndWait: (resourceGroupName: string, diskAccessName: string, diskAccess: DiskAccess, options?: DiskAccessesCreateOrUpdateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, diskAccessName: string, options?: DiskAccessesDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, diskAccessName: string, options?: DiskAccessesDeleteOptionalParams) => Promise; + // @deprecated (undocumented) + beginDeleteAPrivateEndpointConnection: (resourceGroupName: string, diskAccessName: string, privateEndpointConnectionName: string, options?: DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAPrivateEndpointConnectionAndWait: (resourceGroupName: string, diskAccessName: string, privateEndpointConnectionName: string, options?: DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams) => Promise; + // @deprecated (undocumented) + beginUpdate: (resourceGroupName: string, diskAccessName: string, diskAccess: DiskAccessUpdate, options?: DiskAccessesUpdateOptionalParams) => Promise, DiskAccess>>; + // @deprecated (undocumented) + beginUpdateAndWait: (resourceGroupName: string, diskAccessName: string, diskAccess: DiskAccessUpdate, options?: DiskAccessesUpdateOptionalParams) => Promise; + // @deprecated (undocumented) + beginUpdateAPrivateEndpointConnection: (resourceGroupName: string, diskAccessName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams) => Promise, PrivateEndpointConnection>>; + // @deprecated (undocumented) + beginUpdateAPrivateEndpointConnectionAndWait: (resourceGroupName: string, diskAccessName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, diskAccessName: string, diskAccess: DiskAccess, options?: DiskAccessesCreateOrUpdateOptionalParams) => PollerLike, DiskAccess>; + delete: (resourceGroupName: string, diskAccessName: string, options?: DiskAccessesDeleteOptionalParams) => PollerLike, void>; + deleteAPrivateEndpointConnection: (resourceGroupName: string, diskAccessName: string, privateEndpointConnectionName: string, options?: DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, diskAccessName: string, options?: DiskAccessesGetOptionalParams) => Promise; + getAPrivateEndpointConnection: (resourceGroupName: string, diskAccessName: string, privateEndpointConnectionName: string, options?: DiskAccessesGetAPrivateEndpointConnectionOptionalParams) => Promise; + getPrivateLinkResources: (resourceGroupName: string, diskAccessName: string, options?: DiskAccessesGetPrivateLinkResourcesOptionalParams) => Promise; + list: (options?: DiskAccessesListOptionalParams) => PagedAsyncIterableIterator; + listByResourceGroup: (resourceGroupName: string, options?: DiskAccessesListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listPrivateEndpointConnections: (resourceGroupName: string, diskAccessName: string, options?: DiskAccessesListPrivateEndpointConnectionsOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, diskAccessName: string, diskAccess: DiskAccessUpdate, options?: DiskAccessesUpdateOptionalParams) => PollerLike, DiskAccess>; + updateAPrivateEndpointConnection: (resourceGroupName: string, diskAccessName: string, privateEndpointConnectionName: string, privateEndpointConnection: PrivateEndpointConnection, options?: DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams) => PollerLike, PrivateEndpointConnection>; +} + +// @public +export interface DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskAccessesUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskAccessUpdate { + tags?: Record; +} + +// @public +export type DiskCreateOption = string; + +// @public +export interface DiskEncryptionSet extends TrackedResource { + activeKey?: KeyForDiskEncryptionSet; + readonly autoKeyRotationError?: ApiError; + encryptionType?: DiskEncryptionSetType; + federatedClientId?: string; + identity?: EncryptionSetIdentity; + readonly lastKeyRotationTimestamp?: Date; + readonly previousKeys?: KeyForDiskEncryptionSet[]; + readonly provisioningState?: string; + rotationToLatestKeyVersionEnabled?: boolean; +} + +// @public +export type DiskEncryptionSetIdentityType = string; + +// @public +export interface DiskEncryptionSetsCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskEncryptionSetsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskEncryptionSetsGetOptionalParams extends OperationOptions { +} + +// @public +export interface DiskEncryptionSetsListAssociatedResourcesOptionalParams extends OperationOptions { +} + +// @public +export interface DiskEncryptionSetsListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface DiskEncryptionSetsListOptionalParams extends OperationOptions { +} + +// @public +export interface DiskEncryptionSetsOperations { + // @deprecated (undocumented) + beginCreateOrUpdate: (resourceGroupName: string, diskEncryptionSetName: string, diskEncryptionSet: DiskEncryptionSet, options?: DiskEncryptionSetsCreateOrUpdateOptionalParams) => Promise, DiskEncryptionSet>>; + // @deprecated (undocumented) + beginCreateOrUpdateAndWait: (resourceGroupName: string, diskEncryptionSetName: string, diskEncryptionSet: DiskEncryptionSet, options?: DiskEncryptionSetsCreateOrUpdateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, diskEncryptionSetName: string, options?: DiskEncryptionSetsDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, diskEncryptionSetName: string, options?: DiskEncryptionSetsDeleteOptionalParams) => Promise; + // @deprecated (undocumented) + beginUpdate: (resourceGroupName: string, diskEncryptionSetName: string, diskEncryptionSet: DiskEncryptionSetUpdate, options?: DiskEncryptionSetsUpdateOptionalParams) => Promise, DiskEncryptionSet>>; + // @deprecated (undocumented) + beginUpdateAndWait: (resourceGroupName: string, diskEncryptionSetName: string, diskEncryptionSet: DiskEncryptionSetUpdate, options?: DiskEncryptionSetsUpdateOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, diskEncryptionSetName: string, diskEncryptionSet: DiskEncryptionSet, options?: DiskEncryptionSetsCreateOrUpdateOptionalParams) => PollerLike, DiskEncryptionSet>; + delete: (resourceGroupName: string, diskEncryptionSetName: string, options?: DiskEncryptionSetsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, diskEncryptionSetName: string, options?: DiskEncryptionSetsGetOptionalParams) => Promise; + list: (options?: DiskEncryptionSetsListOptionalParams) => PagedAsyncIterableIterator; + listAssociatedResources: (resourceGroupName: string, diskEncryptionSetName: string, options?: DiskEncryptionSetsListAssociatedResourcesOptionalParams) => PagedAsyncIterableIterator; + listByResourceGroup: (resourceGroupName: string, options?: DiskEncryptionSetsListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, diskEncryptionSetName: string, diskEncryptionSet: DiskEncryptionSetUpdate, options?: DiskEncryptionSetsUpdateOptionalParams) => PollerLike, DiskEncryptionSet>; +} + +// @public +export interface DiskEncryptionSetsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export type DiskEncryptionSetType = string; + +// @public +export interface DiskEncryptionSetUpdate { + activeKey?: KeyForDiskEncryptionSet; + encryptionType?: DiskEncryptionSetType; + federatedClientId?: string; + identity?: EncryptionSetIdentity; + rotationToLatestKeyVersionEnabled?: boolean; + tags?: Record; +} + +// @public +export interface DiskPurchasePlan { + name: string; + product: string; + promotionCode?: string; + publisher: string; +} + +// @public +export interface DiskRestorePoint extends ProxyResource { + completionPercent?: number; + diskAccessId?: string; + readonly encryption?: Encryption; + readonly familyId?: string; + hyperVGeneration?: HyperVGeneration; + readonly logicalSectorSize?: number; + networkAccessPolicy?: NetworkAccessPolicy; + readonly osType?: OperatingSystemTypes; + publicNetworkAccess?: PublicNetworkAccess; + purchasePlan?: DiskPurchasePlan; + readonly replicationState?: string; + securityProfile?: DiskSecurityProfile; + readonly sourceResourceId?: string; + readonly sourceResourceLocation?: string; + readonly sourceUniqueId?: string; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + readonly timeCreated?: Date; +} + +// @public +export interface DiskRestorePointGetOptionalParams extends OperationOptions { +} + +// @public +export interface DiskRestorePointGrantAccessOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskRestorePointListByRestorePointOptionalParams extends OperationOptions { +} + +// @public +export interface DiskRestorePointOperations { + // @deprecated (undocumented) + beginGrantAccess: (resourceGroupName: string, restorePointCollectionName: string, vmRestorePointName: string, diskRestorePointName: string, grantAccessData: GrantAccessData, options?: DiskRestorePointGrantAccessOptionalParams) => Promise, AccessUri>>; + // @deprecated (undocumented) + beginGrantAccessAndWait: (resourceGroupName: string, restorePointCollectionName: string, vmRestorePointName: string, diskRestorePointName: string, grantAccessData: GrantAccessData, options?: DiskRestorePointGrantAccessOptionalParams) => Promise; + // @deprecated (undocumented) + beginRevokeAccess: (resourceGroupName: string, restorePointCollectionName: string, vmRestorePointName: string, diskRestorePointName: string, options?: DiskRestorePointRevokeAccessOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginRevokeAccessAndWait: (resourceGroupName: string, restorePointCollectionName: string, vmRestorePointName: string, diskRestorePointName: string, options?: DiskRestorePointRevokeAccessOptionalParams) => Promise; + get: (resourceGroupName: string, restorePointCollectionName: string, vmRestorePointName: string, diskRestorePointName: string, options?: DiskRestorePointGetOptionalParams) => Promise; + grantAccess: (resourceGroupName: string, restorePointCollectionName: string, vmRestorePointName: string, diskRestorePointName: string, grantAccessData: GrantAccessData, options?: DiskRestorePointGrantAccessOptionalParams) => PollerLike, AccessUri>; + listByRestorePoint: (resourceGroupName: string, restorePointCollectionName: string, vmRestorePointName: string, options?: DiskRestorePointListByRestorePointOptionalParams) => PagedAsyncIterableIterator; + revokeAccess: (resourceGroupName: string, restorePointCollectionName: string, vmRestorePointName: string, diskRestorePointName: string, options?: DiskRestorePointRevokeAccessOptionalParams) => PollerLike, void>; +} + +// @public +export interface DiskRestorePointRevokeAccessOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DisksCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DisksDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskSecurityProfile { + secureVMDiskEncryptionSetId?: string; + securityType?: DiskSecurityTypes; +} + +// @public +export type DiskSecurityTypes = string; + +// @public +export interface DisksGetOptionalParams extends OperationOptions { +} + +// @public +export interface DisksGrantAccessOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskSku { + name?: DiskStorageAccountTypes; + readonly tier?: string; +} + +// @public +export interface DisksListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface DisksListOptionalParams extends OperationOptions { +} + +// @public +export interface DisksOperations { + // @deprecated (undocumented) + beginCreateOrUpdate: (resourceGroupName: string, diskName: string, disk: Disk, options?: DisksCreateOrUpdateOptionalParams) => Promise, Disk>>; + // @deprecated (undocumented) + beginCreateOrUpdateAndWait: (resourceGroupName: string, diskName: string, disk: Disk, options?: DisksCreateOrUpdateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, diskName: string, options?: DisksDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, diskName: string, options?: DisksDeleteOptionalParams) => Promise; + // @deprecated (undocumented) + beginGrantAccess: (resourceGroupName: string, diskName: string, grantAccessData: GrantAccessData, options?: DisksGrantAccessOptionalParams) => Promise, AccessUri>>; + // @deprecated (undocumented) + beginGrantAccessAndWait: (resourceGroupName: string, diskName: string, grantAccessData: GrantAccessData, options?: DisksGrantAccessOptionalParams) => Promise; + // @deprecated (undocumented) + beginRevokeAccess: (resourceGroupName: string, diskName: string, options?: DisksRevokeAccessOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginRevokeAccessAndWait: (resourceGroupName: string, diskName: string, options?: DisksRevokeAccessOptionalParams) => Promise; + // @deprecated (undocumented) + beginUpdate: (resourceGroupName: string, diskName: string, disk: DiskUpdate, options?: DisksUpdateOptionalParams) => Promise, Disk>>; + // @deprecated (undocumented) + beginUpdateAndWait: (resourceGroupName: string, diskName: string, disk: DiskUpdate, options?: DisksUpdateOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, diskName: string, disk: Disk, options?: DisksCreateOrUpdateOptionalParams) => PollerLike, Disk>; + delete: (resourceGroupName: string, diskName: string, options?: DisksDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, diskName: string, options?: DisksGetOptionalParams) => Promise; + grantAccess: (resourceGroupName: string, diskName: string, grantAccessData: GrantAccessData, options?: DisksGrantAccessOptionalParams) => PollerLike, AccessUri>; + list: (options?: DisksListOptionalParams) => PagedAsyncIterableIterator; + listByResourceGroup: (resourceGroupName: string, options?: DisksListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + revokeAccess: (resourceGroupName: string, diskName: string, options?: DisksRevokeAccessOptionalParams) => PollerLike, void>; + update: (resourceGroupName: string, diskName: string, disk: DiskUpdate, options?: DisksUpdateOptionalParams) => PollerLike, Disk>; +} + +// @public +export interface DisksRevokeAccessOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export type DiskState = string; + +// @public +export type DiskStorageAccountTypes = string; + +// @public +export interface DisksUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface DiskUpdate { + availabilityPolicy?: AvailabilityPolicy; + burstingEnabled?: boolean; + dataAccessAuthMode?: DataAccessAuthMode; + diskAccessId?: string; + diskIopsReadOnly?: number; + diskIopsReadWrite?: number; + diskMBpsReadOnly?: number; + diskMBpsReadWrite?: number; + diskSizeGB?: number; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + maxShares?: number; + networkAccessPolicy?: NetworkAccessPolicy; + optimizedForFrequentAttach?: boolean; + osType?: OperatingSystemTypes; + readonly propertyUpdatesInProgress?: PropertyUpdatesInProgress; + publicNetworkAccess?: PublicNetworkAccess; + purchasePlan?: DiskPurchasePlan; + sku?: DiskSku; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + tags?: Record; + tier?: string; +} + +// @public +export interface Encryption { + diskEncryptionSetId?: string; + type?: EncryptionType; +} + +// @public +export interface EncryptionSetIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type?: DiskEncryptionSetIdentityType; + userAssignedIdentities?: Record; +} + +// @public +export interface EncryptionSettingsCollection { + enabled: boolean; + encryptionSettings?: EncryptionSettingsElement[]; + encryptionSettingsVersion?: string; +} + +// @public +export interface EncryptionSettingsElement { + diskEncryptionKey?: KeyVaultAndSecretReference; + keyEncryptionKey?: KeyVaultAndKeyReference; +} + +// @public +export type EncryptionType = string; + +// @public +export interface ExtendedLocation { + name?: string; + type?: ExtendedLocationTypes; +} + +// @public +export type ExtendedLocationTypes = string; + +// @public +export type FileFormat = string; + +// @public +export interface GrantAccessData { + access: AccessLevel; + durationInSeconds: number; + fileFormat?: FileFormat; + getSecureVMGuestStateSAS?: boolean; +} + +// @public +export type HyperVGeneration = string; + +// @public +export interface ImageDiskReference { + communityGalleryImageId?: string; + id?: string; + lun?: number; + sharedGalleryImageId?: string; +} + +// @public +export interface InnerError { + errordetail?: string; + exceptiontype?: string; +} + +// @public +export interface KeyForDiskEncryptionSet { + keyUrl: string; + sourceVault?: SourceVault; +} + +// @public +export interface KeyVaultAndKeyReference { + keyUrl: string; + sourceVault: SourceVault; +} + +// @public +export interface KeyVaultAndSecretReference { + secretUrl: string; + sourceVault: SourceVault; +} + +// @public +export enum KnownAccessLevel { + None = "None", + Read = "Read", + Write = "Write" +} + +// @public +export enum KnownArchitecture { + Arm64 = "Arm64", + X64 = "x64" +} + +// @public +export enum KnownAvailabilityPolicyDiskDelay { + AutomaticReattach = "AutomaticReattach", + None = "None" +} + +// @public +export enum KnownCopyCompletionErrorReason { + CopySourceNotFound = "CopySourceNotFound" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownDataAccessAuthMode { + AzureActiveDirectory = "AzureActiveDirectory", + None = "None" +} + +// @public +export enum KnownDiskCreateOption { + Attach = "Attach", + Copy = "Copy", + CopyFromSanSnapshot = "CopyFromSanSnapshot", + CopyStart = "CopyStart", + Empty = "Empty", + FromImage = "FromImage", + Import = "Import", + ImportSecure = "ImportSecure", + Restore = "Restore", + Upload = "Upload", + UploadPreparedSecure = "UploadPreparedSecure" +} + +// @public +export enum KnownDiskEncryptionSetIdentityType { + None = "None", + SystemAssigned = "SystemAssigned", + SystemAssignedUserAssigned = "SystemAssigned, UserAssigned", + UserAssigned = "UserAssigned" +} + +// @public +export enum KnownDiskEncryptionSetType { + ConfidentialVmEncryptedWithCustomerKey = "ConfidentialVmEncryptedWithCustomerKey", + EncryptionAtRestWithCustomerKey = "EncryptionAtRestWithCustomerKey", + EncryptionAtRestWithPlatformAndCustomerKeys = "EncryptionAtRestWithPlatformAndCustomerKeys" +} + +// @public +export enum KnownDiskSecurityTypes { + ConfidentialVMDiskEncryptedWithCustomerKey = "ConfidentialVM_DiskEncryptedWithCustomerKey", + ConfidentialVMDiskEncryptedWithPlatformKey = "ConfidentialVM_DiskEncryptedWithPlatformKey", + ConfidentialVMNonPersistedTPM = "ConfidentialVM_NonPersistedTPM", + ConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey = "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", + TrustedLaunch = "TrustedLaunch" +} + +// @public +export enum KnownDiskState { + ActiveSAS = "ActiveSAS", + ActiveSASFrozen = "ActiveSASFrozen", + ActiveUpload = "ActiveUpload", + Attached = "Attached", + Frozen = "Frozen", + ReadyToUpload = "ReadyToUpload", + Reserved = "Reserved", + Unattached = "Unattached" +} + +// @public +export enum KnownDiskStorageAccountTypes { + PremiumLRS = "Premium_LRS", + PremiumV2LRS = "PremiumV2_LRS", + PremiumZRS = "Premium_ZRS", + StandardLRS = "Standard_LRS", + StandardSSDLRS = "StandardSSD_LRS", + StandardSSDZRS = "StandardSSD_ZRS", + UltraSSDLRS = "UltraSSD_LRS" +} + +// @public +export enum KnownEncryptionType { + EncryptionAtRestWithCustomerKey = "EncryptionAtRestWithCustomerKey", + EncryptionAtRestWithPlatformAndCustomerKeys = "EncryptionAtRestWithPlatformAndCustomerKeys", + EncryptionAtRestWithPlatformKey = "EncryptionAtRestWithPlatformKey" +} + +// @public +export enum KnownExtendedLocationTypes { + EdgeZone = "EdgeZone" +} + +// @public +export enum KnownFileFormat { + VHD = "VHD", + Vhdx = "VHDX" +} + +// @public +export enum KnownHyperVGeneration { + V1 = "V1", + V2 = "V2" +} + +// @public +export enum KnownNetworkAccessPolicy { + AllowAll = "AllowAll", + AllowPrivate = "AllowPrivate", + DenyAll = "DenyAll" +} + +// @public +export enum KnownPrivateEndpointConnectionProvisioningState { + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded" +} + +// @public +export enum KnownPrivateEndpointServiceConnectionStatus { + Approved = "Approved", + Pending = "Pending", + Rejected = "Rejected" +} + +// @public +export enum KnownProvisionedBandwidthCopyOption { + Enhanced = "Enhanced", + None = "None" +} + +// @public +export enum KnownPublicNetworkAccess { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownSnapshotAccessState { + Available = "Available", + AvailableWithInstantAccess = "AvailableWithInstantAccess", + InstantAccess = "InstantAccess", + Pending = "Pending", + Unknown = "Unknown" +} + +// @public +export enum KnownSnapshotStorageAccountTypes { + PremiumLRS = "Premium_LRS", + StandardLRS = "Standard_LRS", + StandardZRS = "Standard_ZRS" +} + +// @public +export enum KnownSupportedSecurityOption { + TrustedLaunchAndConfidentialVMSupported = "TrustedLaunchAndConfidentialVMSupported", + TrustedLaunchSupported = "TrustedLaunchSupported" +} + +// @public +export enum KnownVersions { + V20240302 = "2024-03-02", + V20250102 = "2025-01-02" +} + +// @public +export type NetworkAccessPolicy = string; + +// @public +export type OperatingSystemTypes = "Windows" | "Linux"; + +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + +// @public +export interface PrivateEndpoint { + readonly id?: string; +} + +// @public +export interface PrivateEndpointConnection extends ProxyResource { + readonly privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +// @public +export type PrivateEndpointConnectionProvisioningState = string; + +// @public +export type PrivateEndpointServiceConnectionStatus = string; + +// @public +export interface PrivateLinkResource { + readonly groupId?: string; + readonly id?: string; + readonly name?: string; + readonly requiredMembers?: string[]; + requiredZoneNames?: string[]; + readonly type?: string; +} + +// @public +export interface PrivateLinkResourceListResult { + value?: PrivateLinkResource[]; +} + +// @public +export interface PrivateLinkServiceConnectionState { + actionsRequired?: string; + description?: string; + status?: PrivateEndpointServiceConnectionStatus; +} + +// @public +export interface PropertyUpdatesInProgress { + targetTier?: string; +} + +// @public +export type ProvisionedBandwidthCopyOption = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export type PublicNetworkAccess = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export function restorePoller(client: ComputeDiskClient, 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 ShareInfoElement { + readonly vmUri?: string; +} + +// @public +export interface SimplePollerLike, TResult> { + getOperationState(): TState; + getResult(): TResult | undefined; + isDone(): boolean; + // @deprecated + isStopped(): boolean; + onProgress(callback: (state: TState) => void): CancelOnProgress; + poll(options?: { + abortSignal?: AbortSignalLike; + }): Promise; + pollUntilDone(pollOptions?: { + abortSignal?: AbortSignalLike; + }): Promise; + serialize(): Promise; + // @deprecated + stopPolling(): void; + submitted(): Promise; + // @deprecated + toString(): string; +} + +// @public +export interface Snapshot extends TrackedResource { + completionPercent?: number; + copyCompletionError?: CopyCompletionError; + creationData?: CreationData; + dataAccessAuthMode?: DataAccessAuthMode; + diskAccessId?: string; + readonly diskSizeBytes?: number; + diskSizeGB?: number; + readonly diskState?: DiskState; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + extendedLocation?: ExtendedLocation; + hyperVGeneration?: HyperVGeneration; + incremental?: boolean; + readonly incrementalSnapshotFamilyId?: string; + readonly managedBy?: string; + networkAccessPolicy?: NetworkAccessPolicy; + osType?: OperatingSystemTypes; + readonly provisioningState?: string; + publicNetworkAccess?: PublicNetworkAccess; + purchasePlan?: DiskPurchasePlan; + securityProfile?: DiskSecurityProfile; + sku?: SnapshotSku; + readonly snapshotAccessState?: SnapshotAccessState; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + readonly timeCreated?: Date; + readonly uniqueId?: string; +} + +// @public +export type SnapshotAccessState = string; + +// @public +export interface SnapshotsCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface SnapshotsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface SnapshotsGetOptionalParams extends OperationOptions { +} + +// @public +export interface SnapshotsGrantAccessOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface SnapshotSku { + name?: SnapshotStorageAccountTypes; + readonly tier?: string; +} + +// @public +export interface SnapshotsListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface SnapshotsListOptionalParams extends OperationOptions { +} + +// @public +export interface SnapshotsOperations { + // @deprecated (undocumented) + beginCreateOrUpdate: (resourceGroupName: string, snapshotName: string, snapshot: Snapshot, options?: SnapshotsCreateOrUpdateOptionalParams) => Promise, Snapshot>>; + // @deprecated (undocumented) + beginCreateOrUpdateAndWait: (resourceGroupName: string, snapshotName: string, snapshot: Snapshot, options?: SnapshotsCreateOrUpdateOptionalParams) => Promise; + // @deprecated (undocumented) + beginDelete: (resourceGroupName: string, snapshotName: string, options?: SnapshotsDeleteOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginDeleteAndWait: (resourceGroupName: string, snapshotName: string, options?: SnapshotsDeleteOptionalParams) => Promise; + // @deprecated (undocumented) + beginGrantAccess: (resourceGroupName: string, snapshotName: string, grantAccessData: GrantAccessData, options?: SnapshotsGrantAccessOptionalParams) => Promise, AccessUri>>; + // @deprecated (undocumented) + beginGrantAccessAndWait: (resourceGroupName: string, snapshotName: string, grantAccessData: GrantAccessData, options?: SnapshotsGrantAccessOptionalParams) => Promise; + // @deprecated (undocumented) + beginRevokeAccess: (resourceGroupName: string, snapshotName: string, options?: SnapshotsRevokeAccessOptionalParams) => Promise, void>>; + // @deprecated (undocumented) + beginRevokeAccessAndWait: (resourceGroupName: string, snapshotName: string, options?: SnapshotsRevokeAccessOptionalParams) => Promise; + // @deprecated (undocumented) + beginUpdate: (resourceGroupName: string, snapshotName: string, snapshot: SnapshotUpdate, options?: SnapshotsUpdateOptionalParams) => Promise, Snapshot>>; + // @deprecated (undocumented) + beginUpdateAndWait: (resourceGroupName: string, snapshotName: string, snapshot: SnapshotUpdate, options?: SnapshotsUpdateOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, snapshotName: string, snapshot: Snapshot, options?: SnapshotsCreateOrUpdateOptionalParams) => PollerLike, Snapshot>; + delete: (resourceGroupName: string, snapshotName: string, options?: SnapshotsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, snapshotName: string, options?: SnapshotsGetOptionalParams) => Promise; + grantAccess: (resourceGroupName: string, snapshotName: string, grantAccessData: GrantAccessData, options?: SnapshotsGrantAccessOptionalParams) => PollerLike, AccessUri>; + list: (options?: SnapshotsListOptionalParams) => PagedAsyncIterableIterator; + listByResourceGroup: (resourceGroupName: string, options?: SnapshotsListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + revokeAccess: (resourceGroupName: string, snapshotName: string, options?: SnapshotsRevokeAccessOptionalParams) => PollerLike, void>; + update: (resourceGroupName: string, snapshotName: string, snapshot: SnapshotUpdate, options?: SnapshotsUpdateOptionalParams) => PollerLike, Snapshot>; +} + +// @public +export interface SnapshotsRevokeAccessOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export type SnapshotStorageAccountTypes = string; + +// @public +export interface SnapshotsUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface SnapshotUpdate { + dataAccessAuthMode?: DataAccessAuthMode; + diskAccessId?: string; + diskSizeGB?: number; + encryption?: Encryption; + encryptionSettingsCollection?: EncryptionSettingsCollection; + networkAccessPolicy?: NetworkAccessPolicy; + osType?: OperatingSystemTypes; + publicNetworkAccess?: PublicNetworkAccess; + sku?: SnapshotSku; + readonly snapshotAccessState?: SnapshotAccessState; + supportedCapabilities?: SupportedCapabilities; + supportsHibernation?: boolean; + tags?: Record; +} + +// @public +export interface SourceVault { + id?: string; +} + +// @public +export interface SupportedCapabilities { + acceleratedNetwork?: boolean; + architecture?: Architecture; + diskControllerTypes?: string; + supportedSecurityOption?: SupportedSecurityOption; +} + +// @public +export type SupportedSecurityOption = 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; +} + +// @public +export interface UserAssignedIdentitiesValue { + readonly clientId?: string; + readonly principalId?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/compute/arm-compute-disk/sample.env b/sdk/compute/arm-compute-disk/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/compute/arm-compute-disk/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/README.md b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/README.md new file mode 100644 index 000000000000..0eae4c17b322 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/README.md @@ -0,0 +1,124 @@ +# @azure/arm-compute-disk client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for @azure/arm-compute-disk in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [diskAccessesCreateOrUpdateSample.js][diskaccessescreateorupdatesample] | creates or updates a disk access resource x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Create.json | +| [diskAccessesDeleteAPrivateEndpointConnectionSample.js][diskaccessesdeleteaprivateendpointconnectionsample] | deletes a private endpoint connection under a disk access resource. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json | +| [diskAccessesDeleteSample.js][diskaccessesdeletesample] | deletes a disk access resource. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Delete.json | +| [diskAccessesGetAPrivateEndpointConnectionSample.js][diskaccessesgetaprivateendpointconnectionsample] | gets information about a private endpoint connection under a disk access resource. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json | +| [diskAccessesGetPrivateLinkResourcesSample.js][diskaccessesgetprivatelinkresourcessample] | gets the private link resources possible under disk access resource x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json | +| [diskAccessesGetSample.js][diskaccessesgetsample] | gets information about a disk access resource. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Get.json | +| [diskAccessesListByResourceGroupSample.js][diskaccesseslistbyresourcegroupsample] | lists all the disk access resources under a resource group. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_ListByResourceGroup.json | +| [diskAccessesListPrivateEndpointConnectionsSample.js][diskaccesseslistprivateendpointconnectionssample] | list information about private endpoint connections under a disk access resource x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json | +| [diskAccessesListSample.js][diskaccesseslistsample] | lists all the disk access resources under a subscription. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_ListBySubscription.json | +| [diskAccessesUpdateAPrivateEndpointConnectionSample.js][diskaccessesupdateaprivateendpointconnectionsample] | approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private endpoint connection. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.json | +| [diskAccessesUpdateSample.js][diskaccessesupdatesample] | updates (patches) a disk access resource. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Update.json | +| [diskEncryptionSetsCreateOrUpdateSample.js][diskencryptionsetscreateorupdatesample] | creates or updates a disk encryption set x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Create.json | +| [diskEncryptionSetsDeleteSample.js][diskencryptionsetsdeletesample] | deletes a disk encryption set. x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json | +| [diskEncryptionSetsGetSample.js][diskencryptionsetsgetsample] | gets information about a disk encryption set. x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Get.json | +| [diskEncryptionSetsListAssociatedResourcesSample.js][diskencryptionsetslistassociatedresourcessample] | lists all resources that are encrypted with this disk encryption set. x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json | +| [diskEncryptionSetsListByResourceGroupSample.js][diskencryptionsetslistbyresourcegroupsample] | lists all the disk encryption sets under a resource group. x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json | +| [diskEncryptionSetsListSample.js][diskencryptionsetslistsample] | lists all the disk encryption sets under a subscription. x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json | +| [diskEncryptionSetsUpdateSample.js][diskencryptionsetsupdatesample] | updates (patches) a disk encryption set. x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Update.json | +| [diskRestorePointGetSample.js][diskrestorepointgetsample] | get disk restorePoint resource x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_Get.json | +| [diskRestorePointGrantAccessSample.js][diskrestorepointgrantaccesssample] | grants access to a diskRestorePoint. x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.json | +| [diskRestorePointListByRestorePointSample.js][diskrestorepointlistbyrestorepointsample] | lists diskRestorePoints under a vmRestorePoint. x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json | +| [diskRestorePointRevokeAccessSample.js][diskrestorepointrevokeaccesssample] | revokes access to a diskRestorePoint. x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json | +| [disksCreateOrUpdateSample.js][diskscreateorupdatesample] | creates or updates a disk. x-ms-original-file: 2025-01-02/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json | +| [disksDeleteSample.js][disksdeletesample] | deletes a disk. x-ms-original-file: 2025-01-02/diskExamples/Disk_Delete.json | +| [disksGetSample.js][disksgetsample] | gets information about a disk. x-ms-original-file: 2025-01-02/diskExamples/Disk_Get.json | +| [disksGrantAccessSample.js][disksgrantaccesssample] | grants access to a disk. x-ms-original-file: 2025-01-02/diskExamples/Disk_BeginGetAccess.json | +| [disksListByResourceGroupSample.js][diskslistbyresourcegroupsample] | lists all the disks under a resource group. x-ms-original-file: 2025-01-02/diskExamples/Disk_ListByResourceGroup.json | +| [disksListSample.js][diskslistsample] | lists all the disks under a subscription. x-ms-original-file: 2025-01-02/diskExamples/Disk_ListBySubscription.json | +| [disksRevokeAccessSample.js][disksrevokeaccesssample] | revokes access to a disk. x-ms-original-file: 2025-01-02/diskExamples/Disk_EndGetAccess.json | +| [disksUpdateSample.js][disksupdatesample] | updates (patches) a disk. x-ms-original-file: 2025-01-02/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json | +| [snapshotsCreateOrUpdateSample.js][snapshotscreateorupdatesample] | creates or updates a snapshot. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json | +| [snapshotsDeleteSample.js][snapshotsdeletesample] | deletes a snapshot. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Delete.json | +| [snapshotsGetSample.js][snapshotsgetsample] | gets information about a snapshot. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Get.json | +| [snapshotsGrantAccessSample.js][snapshotsgrantaccesssample] | grants access to a snapshot. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_BeginGetAccess.json | +| [snapshotsListByResourceGroupSample.js][snapshotslistbyresourcegroupsample] | lists snapshots under a resource group. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_ListByResourceGroup.json | +| [snapshotsListSample.js][snapshotslistsample] | lists snapshots under a subscription. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_ListBySubscription.json | +| [snapshotsRevokeAccessSample.js][snapshotsrevokeaccesssample] | revokes access to a snapshot. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_EndGetAccess.json | +| [snapshotsUpdateSample.js][snapshotsupdatesample] | updates (patches) a snapshot. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Update.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 diskAccessesCreateOrUpdateSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +node diskAccessesCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[diskaccessescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesCreateOrUpdateSample.js +[diskaccessesdeleteaprivateendpointconnectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesDeleteAPrivateEndpointConnectionSample.js +[diskaccessesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesDeleteSample.js +[diskaccessesgetaprivateendpointconnectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesGetAPrivateEndpointConnectionSample.js +[diskaccessesgetprivatelinkresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesGetPrivateLinkResourcesSample.js +[diskaccessesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesGetSample.js +[diskaccesseslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesListByResourceGroupSample.js +[diskaccesseslistprivateendpointconnectionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesListPrivateEndpointConnectionsSample.js +[diskaccesseslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesListSample.js +[diskaccessesupdateaprivateendpointconnectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesUpdateAPrivateEndpointConnectionSample.js +[diskaccessesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesUpdateSample.js +[diskencryptionsetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsCreateOrUpdateSample.js +[diskencryptionsetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsDeleteSample.js +[diskencryptionsetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsGetSample.js +[diskencryptionsetslistassociatedresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsListAssociatedResourcesSample.js +[diskencryptionsetslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsListByResourceGroupSample.js +[diskencryptionsetslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsListSample.js +[diskencryptionsetsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsUpdateSample.js +[diskrestorepointgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointGetSample.js +[diskrestorepointgrantaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointGrantAccessSample.js +[diskrestorepointlistbyrestorepointsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointListByRestorePointSample.js +[diskrestorepointrevokeaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointRevokeAccessSample.js +[diskscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksCreateOrUpdateSample.js +[disksdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksDeleteSample.js +[disksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksGetSample.js +[disksgrantaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksGrantAccessSample.js +[diskslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksListByResourceGroupSample.js +[diskslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksListSample.js +[disksrevokeaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksRevokeAccessSample.js +[disksupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksUpdateSample.js +[snapshotscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsCreateOrUpdateSample.js +[snapshotsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsDeleteSample.js +[snapshotsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsGetSample.js +[snapshotsgrantaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsGrantAccessSample.js +[snapshotslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsListByResourceGroupSample.js +[snapshotslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsListSample.js +[snapshotsrevokeaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsRevokeAccessSample.js +[snapshotsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsUpdateSample.js +[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-compute-disk?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/compute/arm-compute-disk/README.md diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesCreateOrUpdateSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesCreateOrUpdateSample.js new file mode 100644 index 000000000000..9e6768a4280a --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesCreateOrUpdateSample.js @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to creates or updates a disk access resource + * + * @summary creates or updates a disk access resource + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Create.json + */ +async function createADiskAccessResource() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.createOrUpdate("myResourceGroup", "myDiskAccess", { + location: "West US", + }); + console.log(result); +} + +async function main() { + await createADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesDeleteAPrivateEndpointConnectionSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesDeleteAPrivateEndpointConnectionSample.js new file mode 100644 index 000000000000..1921293fdec0 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesDeleteAPrivateEndpointConnectionSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes a private endpoint connection under a disk access resource. + * + * @summary deletes a private endpoint connection under a disk access resource. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json + */ +async function deleteAPrivateEndpointConnectionUnderADiskAccessResource() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.diskAccesses.deleteAPrivateEndpointConnection( + "myResourceGroup", + "myDiskAccess", + "myPrivateEndpointConnection", + ); +} + +async function main() { + await deleteAPrivateEndpointConnectionUnderADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesDeleteSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesDeleteSample.js new file mode 100644 index 000000000000..ecb715ea5b25 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes a disk access resource. + * + * @summary deletes a disk access resource. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Delete.json + */ +async function deleteADiskAccessResource() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.diskAccesses.delete("myResourceGroup", "myDiskAccess"); +} + +async function main() { + await deleteADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesGetAPrivateEndpointConnectionSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesGetAPrivateEndpointConnectionSample.js new file mode 100644 index 000000000000..ed7d41700587 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesGetAPrivateEndpointConnectionSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets information about a private endpoint connection under a disk access resource. + * + * @summary gets information about a private endpoint connection under a disk access resource. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json + */ +async function getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.getAPrivateEndpointConnection( + "myResourceGroup", + "myDiskAccess", + "myPrivateEndpointConnection", + ); + console.log(result); +} + +async function main() { + await getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesGetPrivateLinkResourcesSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesGetPrivateLinkResourcesSample.js new file mode 100644 index 000000000000..1f66c0f3f46e --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesGetPrivateLinkResourcesSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets the private link resources possible under disk access resource + * + * @summary gets the private link resources possible under disk access resource + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json + */ +async function listAllPossiblePrivateLinkResourcesUnderDiskAccessResource() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.getPrivateLinkResources( + "myResourceGroup", + "myDiskAccess", + ); + console.log(result); +} + +async function main() { + await listAllPossiblePrivateLinkResourcesUnderDiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesGetSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesGetSample.js new file mode 100644 index 000000000000..fd20c7feddf0 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesGetSample.js @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets information about a disk access resource. + * + * @summary gets information about a disk access resource. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Get.json + */ +async function getInformationAboutADiskAccessResource() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.get("myResourceGroup", "myDiskAccess"); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a disk access resource. + * + * @summary gets information about a disk access resource. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.json + */ +async function getInformationAboutADiskAccessResourceWithPrivateEndpoints() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.get("myResourceGroup", "myDiskAccess"); + console.log(result); +} + +async function main() { + await getInformationAboutADiskAccessResource(); + await getInformationAboutADiskAccessResourceWithPrivateEndpoints(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesListByResourceGroupSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesListByResourceGroupSample.js new file mode 100644 index 000000000000..23f87a8b5d4e --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesListByResourceGroupSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists all the disk access resources under a resource group. + * + * @summary lists all the disk access resources under a resource group. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_ListByResourceGroup.json + */ +async function listAllDiskAccessResourcesInAResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskAccesses.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAllDiskAccessResourcesInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesListPrivateEndpointConnectionsSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesListPrivateEndpointConnectionsSample.js new file mode 100644 index 000000000000..2e53e971b3ea --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesListPrivateEndpointConnectionsSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list information about private endpoint connections under a disk access resource + * + * @summary list information about private endpoint connections under a disk access resource + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json + */ +async function getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskAccesses.listPrivateEndpointConnections( + "myResourceGroup", + "myDiskAccess", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesListSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesListSample.js new file mode 100644 index 000000000000..4c6db43fbe54 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesListSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists all the disk access resources under a subscription. + * + * @summary lists all the disk access resources under a subscription. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_ListBySubscription.json + */ +async function listAllDiskAccessResourcesInASubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskAccesses.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAllDiskAccessResourcesInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesUpdateAPrivateEndpointConnectionSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesUpdateAPrivateEndpointConnectionSample.js new file mode 100644 index 000000000000..faf1252d1479 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesUpdateAPrivateEndpointConnectionSample.js @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private endpoint connection. + * + * @summary approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private endpoint connection. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.json + */ +async function approveAPrivateEndpointConnectionUnderADiskAccessResource() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.updateAPrivateEndpointConnection( + "myResourceGroup", + "myDiskAccess", + "myPrivateEndpointConnection", + { + properties: { + privateLinkServiceConnectionState: { + status: "Approved", + description: "Approving myPrivateEndpointConnection", + }, + }, + }, + ); + console.log(result); +} + +async function main() { + await approveAPrivateEndpointConnectionUnderADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesUpdateSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesUpdateSample.js new file mode 100644 index 000000000000..f4f61fa3968e --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskAccessesUpdateSample.js @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to updates (patches) a disk access resource. + * + * @summary updates (patches) a disk access resource. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Update.json + */ +async function updateADiskAccessResource() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.update("myResourceGroup", "myDiskAccess", { + tags: { department: "Development", project: "PrivateEndpoints" }, + }); + console.log(result); +} + +async function main() { + await updateADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsCreateOrUpdateSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsCreateOrUpdateSample.js new file mode 100644 index 000000000000..b0d05dbfc453 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsCreateOrUpdateSample.js @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to creates or updates a disk encryption set + * + * @summary creates or updates a disk encryption set + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Create.json + */ +async function createADiskEncryptionSet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.createOrUpdate( + "myResourceGroup", + "myDiskEncryptionSet", + { + location: "West US", + identity: { type: "SystemAssigned" }, + properties: { + activeKey: { + sourceVault: { + id: "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault", + }, + keyUrl: "https://myvmvault.vault-int.azure-int.net/keys/{key}", + }, + encryptionType: "EncryptionAtRestWithCustomerKey", + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk encryption set + * + * @summary creates or updates a disk encryption set + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.json + */ +async function createADiskEncryptionSetWithKeyVaultFromADifferentSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.createOrUpdate( + "myResourceGroup", + "myDiskEncryptionSet", + { + location: "West US", + identity: { type: "SystemAssigned" }, + properties: { + activeKey: { + keyUrl: "https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}", + }, + encryptionType: "EncryptionAtRestWithCustomerKey", + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk encryption set + * + * @summary creates or updates a disk encryption set + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.json + */ +async function createADiskEncryptionSetWithKeyVaultFromADifferentTenant() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.createOrUpdate( + "myResourceGroup", + "myDiskEncryptionSet", + { + location: "West US", + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}": + {}, + }, + }, + properties: { + activeKey: { + keyUrl: "https://myvaultdifferenttenant.vault-int.azure-int.net/keys/{key}", + }, + encryptionType: "EncryptionAtRestWithCustomerKey", + federatedClientId: "00000000-0000-0000-0000-000000000000", + }, + }, + ); + console.log(result); +} + +async function main() { + await createADiskEncryptionSet(); + await createADiskEncryptionSetWithKeyVaultFromADifferentSubscription(); + await createADiskEncryptionSetWithKeyVaultFromADifferentTenant(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsDeleteSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsDeleteSample.js new file mode 100644 index 000000000000..66156f01ae8d --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes a disk encryption set. + * + * @summary deletes a disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json + */ +async function deleteADiskEncryptionSet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.diskEncryptionSets.delete("myResourceGroup", "myDiskEncryptionSet"); +} + +async function main() { + await deleteADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsGetSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsGetSample.js new file mode 100644 index 000000000000..988e2ae64d88 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsGetSample.js @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets information about a disk encryption set. + * + * @summary gets information about a disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Get.json + */ +async function getInformationAboutADiskEncryptionSet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.get("myResourceGroup", "myDiskEncryptionSet"); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a disk encryption set. + * + * @summary gets information about a disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.json + */ +async function getInformationAboutADiskEncryptionSetWhenAutoKeyRotationFailed() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.get("myResourceGroup", "myDiskEncryptionSet"); + console.log(result); +} + +async function main() { + await getInformationAboutADiskEncryptionSet(); + await getInformationAboutADiskEncryptionSetWhenAutoKeyRotationFailed(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsListAssociatedResourcesSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsListAssociatedResourcesSample.js new file mode 100644 index 000000000000..a525da7bc914 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsListAssociatedResourcesSample.js @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists all resources that are encrypted with this disk encryption set. + * + * @summary lists all resources that are encrypted with this disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json + */ +async function listAllResourcesThatAreEncryptedWithThisDiskEncryptionSet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskEncryptionSets.listAssociatedResources( + "myResourceGroup", + "myDiskEncryptionSet", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAllResourcesThatAreEncryptedWithThisDiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsListByResourceGroupSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsListByResourceGroupSample.js new file mode 100644 index 000000000000..2406b5aaf8d8 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsListByResourceGroupSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists all the disk encryption sets under a resource group. + * + * @summary lists all the disk encryption sets under a resource group. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json + */ +async function listAllDiskEncryptionSetsInAResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskEncryptionSets.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAllDiskEncryptionSetsInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsListSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsListSample.js new file mode 100644 index 000000000000..7e4845cb38e3 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsListSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists all the disk encryption sets under a subscription. + * + * @summary lists all the disk encryption sets under a subscription. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json + */ +async function listAllDiskEncryptionSetsInASubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskEncryptionSets.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAllDiskEncryptionSetsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsUpdateSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsUpdateSample.js new file mode 100644 index 000000000000..6badb1d082ff --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskEncryptionSetsUpdateSample.js @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to updates (patches) a disk encryption set. + * + * @summary updates (patches) a disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Update.json + */ +async function updateADiskEncryptionSet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.update("myResourceGroup", "myDiskEncryptionSet", { + properties: { + activeKey: { + sourceVault: { + id: "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault", + }, + keyUrl: "https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion", + }, + encryptionType: "EncryptionAtRestWithCustomerKey", + }, + tags: { department: "Development", project: "Encryption" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk encryption set. + * + * @summary updates (patches) a disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.json + */ +async function updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueSucceeded() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.update("myResourceGroup", "myDiskEncryptionSet", { + identity: { type: "SystemAssigned" }, + properties: { + activeKey: { + keyUrl: "https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1", + }, + encryptionType: "EncryptionAtRestWithCustomerKey", + rotationToLatestKeyVersionEnabled: true, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk encryption set. + * + * @summary updates (patches) a disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.json + */ +async function updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueUpdating() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.update("myResourceGroup", "myDiskEncryptionSet", { + identity: { type: "SystemAssigned" }, + properties: { + activeKey: { + keyUrl: "https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1", + }, + encryptionType: "EncryptionAtRestWithCustomerKey", + rotationToLatestKeyVersionEnabled: true, + }, + }); + console.log(result); +} + +async function main() { + await updateADiskEncryptionSet(); + await updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueSucceeded(); + await updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueUpdating(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointGetSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointGetSample.js new file mode 100644 index 000000000000..c05c6fb7ba18 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointGetSample.js @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get disk restorePoint resource + * + * @summary get disk restorePoint resource + * x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_Get.json + */ +async function getAnIncrementalDiskRestorePointResource() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskRestorePoint.get( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + ); + console.log(result); +} + +/** + * This sample demonstrates how to get disk restorePoint resource + * + * @summary get disk restorePoint resource + * x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.json + */ +async function getAnIncrementalDiskRestorePointWhenSourceResourceIsFromADifferentRegion() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskRestorePoint.get( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + ); + console.log(result); +} + +async function main() { + await getAnIncrementalDiskRestorePointResource(); + await getAnIncrementalDiskRestorePointWhenSourceResourceIsFromADifferentRegion(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointGrantAccessSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointGrantAccessSample.js new file mode 100644 index 000000000000..069fc92bcd42 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointGrantAccessSample.js @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to grants access to a diskRestorePoint. + * + * @summary grants access to a diskRestorePoint. + * x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.json + */ +async function grantsAccessToADiskRestorePoint() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskRestorePoint.grantAccess( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + { access: "Read", durationInSeconds: 300, fileFormat: "VHDX" }, + ); + console.log(result); +} + +async function main() { + await grantsAccessToADiskRestorePoint(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointListByRestorePointSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointListByRestorePointSample.js new file mode 100644 index 000000000000..d2b38491372b --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointListByRestorePointSample.js @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists diskRestorePoints under a vmRestorePoint. + * + * @summary lists diskRestorePoints under a vmRestorePoint. + * x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json + */ +async function getAnIncrementalDiskRestorePointResource() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskRestorePoint.listByRestorePoint( + "myResourceGroup", + "rpc", + "vmrp", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await getAnIncrementalDiskRestorePointResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointRevokeAccessSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointRevokeAccessSample.js new file mode 100644 index 000000000000..ab3e5cd9e2eb --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/diskRestorePointRevokeAccessSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to revokes access to a diskRestorePoint. + * + * @summary revokes access to a diskRestorePoint. + * x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json + */ +async function revokesAccessToADiskRestorePoint() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.diskRestorePoint.revokeAccess( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + ); +} + +async function main() { + await revokesAccessToADiskRestorePoint(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksCreateOrUpdateSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksCreateOrUpdateSample.js new file mode 100644 index 000000000000..f994a5244797 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksCreateOrUpdateSample.js @@ -0,0 +1,662 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json + */ +async function createAManagedDiskWithAvailabilityPolicy() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Empty" }, + diskSizeGB: 1024, + availabilityPolicy: { actionOnDiskDelay: "AutomaticReattach" }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_ByCopyingASnapshot.json + */ +async function createAManagedDiskByCopyingASnapshot() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json + */ +async function createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { + createOption: "Import", + storageAccountId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json + */ +async function createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { + createOption: "Import", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json + */ +async function createAConfidentialVMSupportedDiskEncryptedWithCustomerManagedKey() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscriptionId}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + securityProfile: { + securityType: "ConfidentialVM_DiskEncryptedWithCustomerKey", + secureVMDiskEncryptionSetId: + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", + }, + creationData: { + createOption: "FromImage", + imageReference: { + id: "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0", + }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_Empty.json + */ +async function createAnEmptyManagedDisk() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { creationData: { createOption: "Empty" }, diskSizeGB: 200 }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromAPlatformImage.json + */ +async function createAManagedDiskFromAPlatformImage() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscriptionId}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + creationData: { + createOption: "FromImage", + imageReference: { + id: "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0", + }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json + */ +async function createAManagedDiskFromAnAzureComputeGalleryCommunityImage() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscriptionId}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + creationData: { + createOption: "FromImage", + galleryImageReference: { + communityGalleryImageId: + "/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0", + }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json + */ +async function createAManagedDiskFromAnAzureComputeGalleryDirectSharedImage() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscriptionId}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + creationData: { + createOption: "FromImage", + galleryImageReference: { + sharedGalleryImageId: + "/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0", + }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json + */ +async function createAManagedDiskFromAnAzureComputeGalleryImage() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscriptionId}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + creationData: { + createOption: "FromImage", + galleryImageReference: { + id: "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0", + }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json + */ +async function createAManagedDiskFromElasticSanVolumeSnapshot() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { + createOption: "CopyFromSanSnapshot", + elasticSanResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromAnExistingManagedDisk.json + */ +async function createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk2", { + location: "West US", + properties: { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromImportSecure.json + */ +async function createAManagedDiskFromImportSecureCreateOption() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + securityProfile: { + securityType: "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", + }, + creationData: { + createOption: "ImportSecure", + storageAccountId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + securityDataUri: "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.json + */ +async function createAManagedDiskFromImportSecureCreateOptionWithMetadataURIForConfidentialVM() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + securityProfile: { + securityType: "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", + }, + creationData: { + createOption: "ImportSecure", + storageAccountId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + securityDataUri: "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd", + securityMetadataUri: "https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromUploadPreparedSecure.json + */ +async function createAManagedDiskFromUploadPreparedSecureCreateOption() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + securityProfile: { securityType: "TrustedLaunch" }, + creationData: { + createOption: "UploadPreparedSecure", + uploadSizeBytes: 10737418752, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_InExtendedLocation.json + */ +async function createAnEmptyManagedDiskInExtendedLocation() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + extendedLocation: { type: "EdgeZone", name: "{edge-zone-id}" }, + properties: { creationData: { createOption: "Empty" }, diskSizeGB: 200 }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_PerformancePlus.json + */ +async function createAManagedDiskWithPerformancePlus() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Upload", performancePlus: true }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_UploadDisk.json + */ +async function createAManagedUploadDisk() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Upload", uploadSizeBytes: 10737418752 }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithDataAccessAuthMode.json + */ +async function createAManagedDiskWithDataAccessAuthMode() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + dataAccessAuthMode: "AzureActiveDirectory", + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithDiskAccess.json + */ +async function createAManagedDiskAndAssociateWithDiskAccessResource() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + networkAccessPolicy: "AllowPrivate", + diskAccessId: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}", + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithDiskEncryptionSet.json + */ +async function createAManagedDiskAndAssociateWithDiskEncryptionSet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + encryption: { + diskEncryptionSetId: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithLogicalSectorSize.json + */ +async function createAnUltraManagedDiskWithLogicalSectorSize512E() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + sku: { name: "UltraSSD_LRS" }, + properties: { + creationData: { createOption: "Empty", logicalSectorSize: 512 }, + diskSizeGB: 200, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json + */ +async function createAManagedDiskWithOptimizedForFrequentAttach() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + optimizedForFrequentAttach: true, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json + */ +async function createAManagedDiskWithPremiumV2AccountType() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myPremiumV2Disk", { + location: "West US", + sku: { name: "PremiumV2_LRS" }, + properties: { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + diskIopsReadWrite: 125, + diskMBpsReadWrite: 3000, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithSSDZRSAccountType.json + */ +async function createAManagedDiskWithSsdZrsAccountType() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + sku: { name: "Premium_ZRS" }, + properties: { creationData: { createOption: "Empty" }, diskSizeGB: 200 }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithSecurityProfile.json + */ +async function createAManagedDiskWithSecurityProfile() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "North Central US", + properties: { + osType: "Windows", + securityProfile: { securityType: "TrustedLaunch" }, + creationData: { + createOption: "FromImage", + imageReference: { + id: "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}", + }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json + */ +async function createAManagedDiskWithUltraAccountTypeWithReadOnlyPropertySet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myUltraReadOnlyDisk", { + location: "West US", + sku: { name: "UltraSSD_LRS" }, + properties: { + creationData: { createOption: "Empty", logicalSectorSize: 4096 }, + diskSizeGB: 200, + diskIopsReadWrite: 125, + diskMBpsReadWrite: 3000, + encryption: { type: "EncryptionAtRestWithPlatformKey" }, + }, + }); + console.log(result); +} + +async function main() { + await createAManagedDiskWithAvailabilityPolicy(); + await createAManagedDiskByCopyingASnapshot(); + await createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription(); + await createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription(); + await createAConfidentialVMSupportedDiskEncryptedWithCustomerManagedKey(); + await createAnEmptyManagedDisk(); + await createAManagedDiskFromAPlatformImage(); + await createAManagedDiskFromAnAzureComputeGalleryCommunityImage(); + await createAManagedDiskFromAnAzureComputeGalleryDirectSharedImage(); + await createAManagedDiskFromAnAzureComputeGalleryImage(); + await createAManagedDiskFromElasticSanVolumeSnapshot(); + await createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription(); + await createAManagedDiskFromImportSecureCreateOption(); + await createAManagedDiskFromImportSecureCreateOptionWithMetadataURIForConfidentialVM(); + await createAManagedDiskFromUploadPreparedSecureCreateOption(); + await createAnEmptyManagedDiskInExtendedLocation(); + await createAManagedDiskWithPerformancePlus(); + await createAManagedUploadDisk(); + await createAManagedDiskWithDataAccessAuthMode(); + await createAManagedDiskAndAssociateWithDiskAccessResource(); + await createAManagedDiskAndAssociateWithDiskEncryptionSet(); + await createAnUltraManagedDiskWithLogicalSectorSize512E(); + await createAManagedDiskWithOptimizedForFrequentAttach(); + await createAManagedDiskWithPremiumV2AccountType(); + await createAManagedDiskWithSsdZrsAccountType(); + await createAManagedDiskWithSecurityProfile(); + await createAManagedDiskWithUltraAccountTypeWithReadOnlyPropertySet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksDeleteSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksDeleteSample.js new file mode 100644 index 000000000000..17f7c0960902 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes a disk. + * + * @summary deletes a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Delete.json + */ +async function deleteAManagedDisk() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.disks.delete("myResourceGroup", "myDisk"); +} + +async function main() { + await deleteAManagedDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksGetSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksGetSample.js new file mode 100644 index 000000000000..24da98f407f6 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets information about a disk. + * + * @summary gets information about a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Get.json + */ +async function getInformationAboutAManagedDisk() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.get("myResourceGroup", "myManagedDisk"); + console.log(result); +} + +async function main() { + await getInformationAboutAManagedDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksGrantAccessSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksGrantAccessSample.js new file mode 100644 index 000000000000..4ec02f3ecd45 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksGrantAccessSample.js @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to grants access to a disk. + * + * @summary grants access to a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_BeginGetAccess.json + */ +async function getASasOnAManagedDisk() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.grantAccess("myResourceGroup", "myDisk", { + access: "Read", + durationInSeconds: 300, + fileFormat: "VHD", + }); + console.log(result); +} + +/** + * This sample demonstrates how to grants access to a disk. + * + * @summary grants access to a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_BeginGetAccess_WithVMGuestState.json + */ +async function getSasOnManagedDiskAndVMGuestState() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.grantAccess("myResourceGroup", "myDisk", { + access: "Read", + durationInSeconds: 300, + getSecureVMGuestStateSAS: true, + }); + console.log(result); +} + +/** + * This sample demonstrates how to grants access to a disk. + * + * @summary grants access to a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_BeginGetAccess_WithVMGuestStateAndVMMetadata.json + */ +async function getSasOnManagedDiskVMGuestStateAndVMMetadataForConfidentialVM() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.grantAccess("myResourceGroup", "myDisk", { + access: "Read", + durationInSeconds: 300, + getSecureVMGuestStateSAS: true, + }); + console.log(result); +} + +async function main() { + await getASasOnAManagedDisk(); + await getSasOnManagedDiskAndVMGuestState(); + await getSasOnManagedDiskVMGuestStateAndVMMetadataForConfidentialVM(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksListByResourceGroupSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksListByResourceGroupSample.js new file mode 100644 index 000000000000..bdf2d48469cf --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksListByResourceGroupSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists all the disks under a resource group. + * + * @summary lists all the disks under a resource group. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_ListByResourceGroup.json + */ +async function listAllManagedDisksInAResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.disks.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAllManagedDisksInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksListSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksListSample.js new file mode 100644 index 000000000000..0d4b3ad8c279 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksListSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists all the disks under a subscription. + * + * @summary lists all the disks under a subscription. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_ListBySubscription.json + */ +async function listAllManagedDisksInASubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.disks.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAllManagedDisksInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksRevokeAccessSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksRevokeAccessSample.js new file mode 100644 index 000000000000..8171a0120130 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksRevokeAccessSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to revokes access to a disk. + * + * @summary revokes access to a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_EndGetAccess.json + */ +async function revokeAccessToAManagedDisk() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.disks.revokeAccess("myResourceGroup", "myDisk"); +} + +async function main() { + await revokeAccessToAManagedDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksUpdateSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksUpdateSample.js new file mode 100644 index 000000000000..b263c44e4170 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/disksUpdateSample.js @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json + */ +async function createOrUpdateABurstingEnabledManagedDisk() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { diskSizeGB: 1024, burstingEnabled: true }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_AddAcceleratedNetworking.json + */ +async function updateAManagedDiskToAddAcceleratedNetworking() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { supportedCapabilities: { acceleratedNetwork: false } }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_AddDiskControllerTypes.json + */ +async function updateAManagedDiskWithDiskControllerTypes() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { supportedCapabilities: { diskControllerTypes: "SCSI" } }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_AddPurchasePlan.json + */ +async function updateAManagedDiskToAddPurchasePlan() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { + purchasePlan: { + name: "myPurchasePlanName", + publisher: "myPurchasePlanPublisher", + product: "myPurchasePlanProduct", + promotionCode: "myPurchasePlanPromotionCode", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_AddSupportsHibernation.json + */ +async function updateAManagedDiskToAddSupportsHibernation() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { supportsHibernation: true }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_ChangeTier.json + */ +async function updateAManagedDiskToChangeTier() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { tier: "P30" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_DisableBursting.json + */ +async function updateAManagedDiskToDisableBursting() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { burstingEnabled: false }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json + */ +async function updateAManagedDiskToDisableOptimizedForFrequentAttach() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { optimizedForFrequentAttach: false }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_RemoveDiskAccess.json + */ +async function updateManagedDiskToRemoveDiskAccessResourceAssociation() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { networkAccessPolicy: "AllowAll" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_ToAddArchitecture.json + */ +async function updateAManagedDiskToAddArchitecture() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { supportedCapabilities: { architecture: "Arm64" } }, + }); + console.log(result); +} + +async function main() { + await createOrUpdateABurstingEnabledManagedDisk(); + await updateAManagedDiskToAddAcceleratedNetworking(); + await updateAManagedDiskWithDiskControllerTypes(); + await updateAManagedDiskToAddPurchasePlan(); + await updateAManagedDiskToAddSupportsHibernation(); + await updateAManagedDiskToChangeTier(); + await updateAManagedDiskToDisableBursting(); + await updateAManagedDiskToDisableOptimizedForFrequentAttach(); + await updateManagedDiskToRemoveDiskAccessResourceAssociation(); + await updateAManagedDiskToAddArchitecture(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/package.json b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/package.json new file mode 100644 index 000000000000..a5284f77f0c9 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/package.json @@ -0,0 +1,36 @@ +{ + "name": "@azure-samples/arm-compute-disk-js-beta", + "private": true, + "version": "1.0.0", + "description": "@azure/arm-compute-disk client library samples for JavaScript (Beta)", + "engines": { + "node": ">=20.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/compute/arm-compute-disk" + }, + "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/compute/arm-compute-disk", + "dependencies": { + "@azure/arm-compute-disk": "next", + "dotenv": "latest", + "@azure/identity": "^4.11.1" + }, + "devDependencies": { + "cross-env": "latest" + } +} diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/sample.env b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsCreateOrUpdateSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsCreateOrUpdateSample.js new file mode 100644 index 000000000000..05e8fc2b2413 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsCreateOrUpdateSample.js @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ +async function createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot1", { + location: "West US", + properties: { + creationData: { + createOption: "Import", + storageAccountId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ +async function createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot1", { + location: "West US", + properties: { + creationData: { + createOption: "Import", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json + */ +async function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegionWithQuickerCopySpeed() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot2", { + location: "West US", + properties: { + creationData: { + createOption: "CopyStart", + sourceResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", + provisionedBandwidthCopySpeed: "Enhanced", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json + */ +async function createASnapshotFromAnElasticSanVolumeSnapshot() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot", { + location: "West US", + properties: { + creationData: { + createOption: "CopyFromSanSnapshot", + elasticSanResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json + */ +async function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot2", { + location: "West US", + properties: { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json + */ +async function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot2", { + location: "West US", + properties: { + creationData: { + createOption: "CopyStart", + sourceResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_InstantAccessSnapshot.json + */ +async function createASnapshotWhichCanBeInstantlyAccessable() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot2", { + location: "West US", + properties: { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1", + instantAccessDurationMinutes: 120, + }, + }, + }); + console.log(result); +} + +async function main() { + await createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription(); + await createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription(); + await createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegionWithQuickerCopySpeed(); + await createASnapshotFromAnElasticSanVolumeSnapshot(); + await createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription(); + await createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion(); + await createASnapshotWhichCanBeInstantlyAccessable(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsDeleteSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsDeleteSample.js new file mode 100644 index 000000000000..7d8c92af3f88 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to deletes a snapshot. + * + * @summary deletes a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Delete.json + */ +async function deleteASnapshot() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.snapshots.delete("myResourceGroup", "mySnapshot"); +} + +async function main() { + await deleteASnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsGetSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsGetSample.js new file mode 100644 index 000000000000..970c827af671 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsGetSample.js @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to gets information about a snapshot. + * + * @summary gets information about a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Get.json + */ +async function getInformationAboutASnapshot() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.get("myResourceGroup", "mySnapshot"); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a snapshot. + * + * @summary gets information about a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_GetIncrementalSnapshot.json + */ +async function getInformationAboutAnIncrementalSnapshot() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.get("myResourceGroup", "myIncrementalSnapshot"); + console.log(result); +} + +async function main() { + await getInformationAboutASnapshot(); + await getInformationAboutAnIncrementalSnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsGrantAccessSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsGrantAccessSample.js new file mode 100644 index 000000000000..216798f847e8 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsGrantAccessSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to grants access to a snapshot. + * + * @summary grants access to a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_BeginGetAccess.json + */ +async function getASasOnASnapshot() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.grantAccess("myResourceGroup", "mySnapshot", { + access: "Read", + durationInSeconds: 300, + fileFormat: "VHDX", + }); + console.log(result); +} + +async function main() { + await getASasOnASnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsListByResourceGroupSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsListByResourceGroupSample.js new file mode 100644 index 000000000000..d82226b2a223 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsListByResourceGroupSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists snapshots under a resource group. + * + * @summary lists snapshots under a resource group. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_ListByResourceGroup.json + */ +async function listAllSnapshotsInAResourceGroup() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.snapshots.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAllSnapshotsInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsListSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsListSample.js new file mode 100644 index 000000000000..883b24ab4085 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsListSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to lists snapshots under a subscription. + * + * @summary lists snapshots under a subscription. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_ListBySubscription.json + */ +async function listAllSnapshotsInASubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.snapshots.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await listAllSnapshotsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsRevokeAccessSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsRevokeAccessSample.js new file mode 100644 index 000000000000..450743430b21 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsRevokeAccessSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to revokes access to a snapshot. + * + * @summary revokes access to a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_EndGetAccess.json + */ +async function revokeAccessToASnapshot() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.snapshots.revokeAccess("myResourceGroup", "mySnapshot"); +} + +async function main() { + await revokeAccessToASnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsUpdateSample.js b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsUpdateSample.js new file mode 100644 index 000000000000..e3b47c1d4819 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/javascript/snapshotsUpdateSample.js @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { ComputeClient } = require("@azure/arm-compute-disk"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to updates (patches) a snapshot. + * + * @summary updates (patches) a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Update.json + */ +async function updateASnapshot() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.update("myResourceGroup", "mySnapshot", { + properties: { diskSizeGB: 20 }, + tags: { department: "Development", project: "UpdateSnapshots" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a snapshot. + * + * @summary updates (patches) a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.json + */ +async function updateASnapshotWithAcceleratedNetworking() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.update("myResourceGroup", "mySnapshot", { + properties: { + diskSizeGB: 20, + supportedCapabilities: { acceleratedNetwork: false }, + }, + tags: { department: "Development", project: "UpdateSnapshots" }, + }); + console.log(result); +} + +async function main() { + await updateASnapshot(); + await updateASnapshotWithAcceleratedNetworking(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/README.md b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/README.md new file mode 100644 index 000000000000..2357347e92c1 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/README.md @@ -0,0 +1,137 @@ +# @azure/arm-compute-disk client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for @azure/arm-compute-disk in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [diskAccessesCreateOrUpdateSample.ts][diskaccessescreateorupdatesample] | creates or updates a disk access resource x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Create.json | +| [diskAccessesDeleteAPrivateEndpointConnectionSample.ts][diskaccessesdeleteaprivateendpointconnectionsample] | deletes a private endpoint connection under a disk access resource. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json | +| [diskAccessesDeleteSample.ts][diskaccessesdeletesample] | deletes a disk access resource. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Delete.json | +| [diskAccessesGetAPrivateEndpointConnectionSample.ts][diskaccessesgetaprivateendpointconnectionsample] | gets information about a private endpoint connection under a disk access resource. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json | +| [diskAccessesGetPrivateLinkResourcesSample.ts][diskaccessesgetprivatelinkresourcessample] | gets the private link resources possible under disk access resource x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json | +| [diskAccessesGetSample.ts][diskaccessesgetsample] | gets information about a disk access resource. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Get.json | +| [diskAccessesListByResourceGroupSample.ts][diskaccesseslistbyresourcegroupsample] | lists all the disk access resources under a resource group. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_ListByResourceGroup.json | +| [diskAccessesListPrivateEndpointConnectionsSample.ts][diskaccesseslistprivateendpointconnectionssample] | list information about private endpoint connections under a disk access resource x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json | +| [diskAccessesListSample.ts][diskaccesseslistsample] | lists all the disk access resources under a subscription. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_ListBySubscription.json | +| [diskAccessesUpdateAPrivateEndpointConnectionSample.ts][diskaccessesupdateaprivateendpointconnectionsample] | approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private endpoint connection. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.json | +| [diskAccessesUpdateSample.ts][diskaccessesupdatesample] | updates (patches) a disk access resource. x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Update.json | +| [diskEncryptionSetsCreateOrUpdateSample.ts][diskencryptionsetscreateorupdatesample] | creates or updates a disk encryption set x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Create.json | +| [diskEncryptionSetsDeleteSample.ts][diskencryptionsetsdeletesample] | deletes a disk encryption set. x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json | +| [diskEncryptionSetsGetSample.ts][diskencryptionsetsgetsample] | gets information about a disk encryption set. x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Get.json | +| [diskEncryptionSetsListAssociatedResourcesSample.ts][diskencryptionsetslistassociatedresourcessample] | lists all resources that are encrypted with this disk encryption set. x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json | +| [diskEncryptionSetsListByResourceGroupSample.ts][diskencryptionsetslistbyresourcegroupsample] | lists all the disk encryption sets under a resource group. x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json | +| [diskEncryptionSetsListSample.ts][diskencryptionsetslistsample] | lists all the disk encryption sets under a subscription. x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json | +| [diskEncryptionSetsUpdateSample.ts][diskencryptionsetsupdatesample] | updates (patches) a disk encryption set. x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Update.json | +| [diskRestorePointGetSample.ts][diskrestorepointgetsample] | get disk restorePoint resource x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_Get.json | +| [diskRestorePointGrantAccessSample.ts][diskrestorepointgrantaccesssample] | grants access to a diskRestorePoint. x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.json | +| [diskRestorePointListByRestorePointSample.ts][diskrestorepointlistbyrestorepointsample] | lists diskRestorePoints under a vmRestorePoint. x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json | +| [diskRestorePointRevokeAccessSample.ts][diskrestorepointrevokeaccesssample] | revokes access to a diskRestorePoint. x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json | +| [disksCreateOrUpdateSample.ts][diskscreateorupdatesample] | creates or updates a disk. x-ms-original-file: 2025-01-02/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json | +| [disksDeleteSample.ts][disksdeletesample] | deletes a disk. x-ms-original-file: 2025-01-02/diskExamples/Disk_Delete.json | +| [disksGetSample.ts][disksgetsample] | gets information about a disk. x-ms-original-file: 2025-01-02/diskExamples/Disk_Get.json | +| [disksGrantAccessSample.ts][disksgrantaccesssample] | grants access to a disk. x-ms-original-file: 2025-01-02/diskExamples/Disk_BeginGetAccess.json | +| [disksListByResourceGroupSample.ts][diskslistbyresourcegroupsample] | lists all the disks under a resource group. x-ms-original-file: 2025-01-02/diskExamples/Disk_ListByResourceGroup.json | +| [disksListSample.ts][diskslistsample] | lists all the disks under a subscription. x-ms-original-file: 2025-01-02/diskExamples/Disk_ListBySubscription.json | +| [disksRevokeAccessSample.ts][disksrevokeaccesssample] | revokes access to a disk. x-ms-original-file: 2025-01-02/diskExamples/Disk_EndGetAccess.json | +| [disksUpdateSample.ts][disksupdatesample] | updates (patches) a disk. x-ms-original-file: 2025-01-02/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json | +| [snapshotsCreateOrUpdateSample.ts][snapshotscreateorupdatesample] | creates or updates a snapshot. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json | +| [snapshotsDeleteSample.ts][snapshotsdeletesample] | deletes a snapshot. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Delete.json | +| [snapshotsGetSample.ts][snapshotsgetsample] | gets information about a snapshot. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Get.json | +| [snapshotsGrantAccessSample.ts][snapshotsgrantaccesssample] | grants access to a snapshot. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_BeginGetAccess.json | +| [snapshotsListByResourceGroupSample.ts][snapshotslistbyresourcegroupsample] | lists snapshots under a resource group. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_ListByResourceGroup.json | +| [snapshotsListSample.ts][snapshotslistsample] | lists snapshots under a subscription. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_ListBySubscription.json | +| [snapshotsRevokeAccessSample.ts][snapshotsrevokeaccesssample] | revokes access to a snapshot. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_EndGetAccess.json | +| [snapshotsUpdateSample.ts][snapshotsupdatesample] | updates (patches) a snapshot. x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Update.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/diskAccessesCreateOrUpdateSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +node dist/diskAccessesCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[diskaccessescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesCreateOrUpdateSample.ts +[diskaccessesdeleteaprivateendpointconnectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesDeleteAPrivateEndpointConnectionSample.ts +[diskaccessesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesDeleteSample.ts +[diskaccessesgetaprivateendpointconnectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesGetAPrivateEndpointConnectionSample.ts +[diskaccessesgetprivatelinkresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesGetPrivateLinkResourcesSample.ts +[diskaccessesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesGetSample.ts +[diskaccesseslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesListByResourceGroupSample.ts +[diskaccesseslistprivateendpointconnectionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesListPrivateEndpointConnectionsSample.ts +[diskaccesseslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesListSample.ts +[diskaccessesupdateaprivateendpointconnectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesUpdateAPrivateEndpointConnectionSample.ts +[diskaccessesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesUpdateSample.ts +[diskencryptionsetscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsCreateOrUpdateSample.ts +[diskencryptionsetsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsDeleteSample.ts +[diskencryptionsetsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsGetSample.ts +[diskencryptionsetslistassociatedresourcessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsListAssociatedResourcesSample.ts +[diskencryptionsetslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsListByResourceGroupSample.ts +[diskencryptionsetslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsListSample.ts +[diskencryptionsetsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsUpdateSample.ts +[diskrestorepointgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointGetSample.ts +[diskrestorepointgrantaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointGrantAccessSample.ts +[diskrestorepointlistbyrestorepointsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointListByRestorePointSample.ts +[diskrestorepointrevokeaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointRevokeAccessSample.ts +[diskscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksCreateOrUpdateSample.ts +[disksdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksDeleteSample.ts +[disksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksGetSample.ts +[disksgrantaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksGrantAccessSample.ts +[diskslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksListByResourceGroupSample.ts +[diskslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksListSample.ts +[disksrevokeaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksRevokeAccessSample.ts +[disksupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksUpdateSample.ts +[snapshotscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsCreateOrUpdateSample.ts +[snapshotsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsDeleteSample.ts +[snapshotsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsGetSample.ts +[snapshotsgrantaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsGrantAccessSample.ts +[snapshotslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsListByResourceGroupSample.ts +[snapshotslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsListSample.ts +[snapshotsrevokeaccesssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsRevokeAccessSample.ts +[snapshotsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsUpdateSample.ts +[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-compute-disk?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/compute/arm-compute-disk/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/package.json b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/package.json new file mode 100644 index 000000000000..c5550804a81b --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/package.json @@ -0,0 +1,43 @@ +{ + "name": "@azure-samples/arm-compute-disk-ts-beta", + "private": true, + "version": "1.0.0", + "description": "@azure/arm-compute-disk client library samples for TypeScript (Beta)", + "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/compute/arm-compute-disk" + }, + "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/compute/arm-compute-disk", + "dependencies": { + "@azure/arm-compute-disk": "next", + "dotenv": "latest", + "@azure/identity": "^4.11.1" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "cross-env": "latest", + "rimraf": "latest", + "typescript": "~5.9.3" + } +} diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/sample.env b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesCreateOrUpdateSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..f541bddc60e6 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesCreateOrUpdateSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to creates or updates a disk access resource + * + * @summary creates or updates a disk access resource + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Create.json + */ +async function createADiskAccessResource(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.createOrUpdate("myResourceGroup", "myDiskAccess", { + location: "West US", + }); + console.log(result); +} + +async function main(): Promise { + await createADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesDeleteAPrivateEndpointConnectionSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesDeleteAPrivateEndpointConnectionSample.ts new file mode 100644 index 000000000000..7ffdca074617 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesDeleteAPrivateEndpointConnectionSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes a private endpoint connection under a disk access resource. + * + * @summary deletes a private endpoint connection under a disk access resource. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json + */ +async function deleteAPrivateEndpointConnectionUnderADiskAccessResource(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.diskAccesses.deleteAPrivateEndpointConnection( + "myResourceGroup", + "myDiskAccess", + "myPrivateEndpointConnection", + ); +} + +async function main(): Promise { + await deleteAPrivateEndpointConnectionUnderADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesDeleteSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesDeleteSample.ts new file mode 100644 index 000000000000..6451dd093fee --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes a disk access resource. + * + * @summary deletes a disk access resource. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Delete.json + */ +async function deleteADiskAccessResource(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.diskAccesses.delete("myResourceGroup", "myDiskAccess"); +} + +async function main(): Promise { + await deleteADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesGetAPrivateEndpointConnectionSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesGetAPrivateEndpointConnectionSample.ts new file mode 100644 index 000000000000..e0782d58cd01 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesGetAPrivateEndpointConnectionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information about a private endpoint connection under a disk access resource. + * + * @summary gets information about a private endpoint connection under a disk access resource. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json + */ +async function getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.getAPrivateEndpointConnection( + "myResourceGroup", + "myDiskAccess", + "myPrivateEndpointConnection", + ); + console.log(result); +} + +async function main(): Promise { + await getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesGetPrivateLinkResourcesSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesGetPrivateLinkResourcesSample.ts new file mode 100644 index 000000000000..b2073623756b --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesGetPrivateLinkResourcesSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets the private link resources possible under disk access resource + * + * @summary gets the private link resources possible under disk access resource + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json + */ +async function listAllPossiblePrivateLinkResourcesUnderDiskAccessResource(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.getPrivateLinkResources( + "myResourceGroup", + "myDiskAccess", + ); + console.log(result); +} + +async function main(): Promise { + await listAllPossiblePrivateLinkResourcesUnderDiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesGetSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesGetSample.ts new file mode 100644 index 000000000000..43e896950366 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesGetSample.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information about a disk access resource. + * + * @summary gets information about a disk access resource. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Get.json + */ +async function getInformationAboutADiskAccessResource(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.get("myResourceGroup", "myDiskAccess"); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a disk access resource. + * + * @summary gets information about a disk access resource. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.json + */ +async function getInformationAboutADiskAccessResourceWithPrivateEndpoints(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.get("myResourceGroup", "myDiskAccess"); + console.log(result); +} + +async function main(): Promise { + await getInformationAboutADiskAccessResource(); + await getInformationAboutADiskAccessResourceWithPrivateEndpoints(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesListByResourceGroupSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesListByResourceGroupSample.ts new file mode 100644 index 000000000000..6f6d98d1e6b9 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all the disk access resources under a resource group. + * + * @summary lists all the disk access resources under a resource group. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_ListByResourceGroup.json + */ +async function listAllDiskAccessResourcesInAResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskAccesses.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllDiskAccessResourcesInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesListPrivateEndpointConnectionsSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesListPrivateEndpointConnectionsSample.ts new file mode 100644 index 000000000000..c3818fe6a6d4 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesListPrivateEndpointConnectionsSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list information about private endpoint connections under a disk access resource + * + * @summary list information about private endpoint connections under a disk access resource + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json + */ +async function getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskAccesses.listPrivateEndpointConnections( + "myResourceGroup", + "myDiskAccess", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesListSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesListSample.ts new file mode 100644 index 000000000000..5521504340d8 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all the disk access resources under a subscription. + * + * @summary lists all the disk access resources under a subscription. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_ListBySubscription.json + */ +async function listAllDiskAccessResourcesInASubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskAccesses.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllDiskAccessResourcesInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesUpdateAPrivateEndpointConnectionSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesUpdateAPrivateEndpointConnectionSample.ts new file mode 100644 index 000000000000..338dd13a4bfa --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesUpdateAPrivateEndpointConnectionSample.ts @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private endpoint connection. + * + * @summary approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private endpoint connection. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.json + */ +async function approveAPrivateEndpointConnectionUnderADiskAccessResource(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.updateAPrivateEndpointConnection( + "myResourceGroup", + "myDiskAccess", + "myPrivateEndpointConnection", + { + properties: { + privateLinkServiceConnectionState: { + status: "Approved", + description: "Approving myPrivateEndpointConnection", + }, + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await approveAPrivateEndpointConnectionUnderADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesUpdateSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesUpdateSample.ts new file mode 100644 index 000000000000..4cfb2df70785 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskAccessesUpdateSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to updates (patches) a disk access resource. + * + * @summary updates (patches) a disk access resource. + * x-ms-original-file: 2025-01-02/diskAccessExamples/DiskAccess_Update.json + */ +async function updateADiskAccessResource(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskAccesses.update("myResourceGroup", "myDiskAccess", { + tags: { department: "Development", project: "PrivateEndpoints" }, + }); + console.log(result); +} + +async function main(): Promise { + await updateADiskAccessResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1af182def29a --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsCreateOrUpdateSample.ts @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to creates or updates a disk encryption set + * + * @summary creates or updates a disk encryption set + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Create.json + */ +async function createADiskEncryptionSet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.createOrUpdate( + "myResourceGroup", + "myDiskEncryptionSet", + { + location: "West US", + identity: { type: "SystemAssigned" }, + properties: { + activeKey: { + sourceVault: { + id: "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault", + }, + keyUrl: "https://myvmvault.vault-int.azure-int.net/keys/{key}", + }, + encryptionType: "EncryptionAtRestWithCustomerKey", + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk encryption set + * + * @summary creates or updates a disk encryption set + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.json + */ +async function createADiskEncryptionSetWithKeyVaultFromADifferentSubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.createOrUpdate( + "myResourceGroup", + "myDiskEncryptionSet", + { + location: "West US", + identity: { type: "SystemAssigned" }, + properties: { + activeKey: { + keyUrl: "https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}", + }, + encryptionType: "EncryptionAtRestWithCustomerKey", + }, + }, + ); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk encryption set + * + * @summary creates or updates a disk encryption set + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.json + */ +async function createADiskEncryptionSetWithKeyVaultFromADifferentTenant(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.createOrUpdate( + "myResourceGroup", + "myDiskEncryptionSet", + { + location: "West US", + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}": + {}, + }, + }, + properties: { + activeKey: { + keyUrl: "https://myvaultdifferenttenant.vault-int.azure-int.net/keys/{key}", + }, + encryptionType: "EncryptionAtRestWithCustomerKey", + federatedClientId: "00000000-0000-0000-0000-000000000000", + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await createADiskEncryptionSet(); + await createADiskEncryptionSetWithKeyVaultFromADifferentSubscription(); + await createADiskEncryptionSetWithKeyVaultFromADifferentTenant(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsDeleteSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsDeleteSample.ts new file mode 100644 index 000000000000..7ea50779ce10 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes a disk encryption set. + * + * @summary deletes a disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json + */ +async function deleteADiskEncryptionSet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.diskEncryptionSets.delete("myResourceGroup", "myDiskEncryptionSet"); +} + +async function main(): Promise { + await deleteADiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsGetSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsGetSample.ts new file mode 100644 index 000000000000..104ff3b8ad02 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsGetSample.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information about a disk encryption set. + * + * @summary gets information about a disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Get.json + */ +async function getInformationAboutADiskEncryptionSet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.get("myResourceGroup", "myDiskEncryptionSet"); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a disk encryption set. + * + * @summary gets information about a disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.json + */ +async function getInformationAboutADiskEncryptionSetWhenAutoKeyRotationFailed(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.get("myResourceGroup", "myDiskEncryptionSet"); + console.log(result); +} + +async function main(): Promise { + await getInformationAboutADiskEncryptionSet(); + await getInformationAboutADiskEncryptionSetWhenAutoKeyRotationFailed(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsListAssociatedResourcesSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsListAssociatedResourcesSample.ts new file mode 100644 index 000000000000..04df9def8f0b --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsListAssociatedResourcesSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all resources that are encrypted with this disk encryption set. + * + * @summary lists all resources that are encrypted with this disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json + */ +async function listAllResourcesThatAreEncryptedWithThisDiskEncryptionSet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskEncryptionSets.listAssociatedResources( + "myResourceGroup", + "myDiskEncryptionSet", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllResourcesThatAreEncryptedWithThisDiskEncryptionSet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsListByResourceGroupSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsListByResourceGroupSample.ts new file mode 100644 index 000000000000..0eeec1e67077 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all the disk encryption sets under a resource group. + * + * @summary lists all the disk encryption sets under a resource group. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json + */ +async function listAllDiskEncryptionSetsInAResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskEncryptionSets.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllDiskEncryptionSetsInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsListSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsListSample.ts new file mode 100644 index 000000000000..9f9773a8028a --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all the disk encryption sets under a subscription. + * + * @summary lists all the disk encryption sets under a subscription. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json + */ +async function listAllDiskEncryptionSetsInASubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskEncryptionSets.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllDiskEncryptionSetsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsUpdateSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsUpdateSample.ts new file mode 100644 index 000000000000..37d0956380bf --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskEncryptionSetsUpdateSample.ts @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to updates (patches) a disk encryption set. + * + * @summary updates (patches) a disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Update.json + */ +async function updateADiskEncryptionSet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.update("myResourceGroup", "myDiskEncryptionSet", { + properties: { + activeKey: { + sourceVault: { + id: "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault", + }, + keyUrl: "https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion", + }, + encryptionType: "EncryptionAtRestWithCustomerKey", + }, + tags: { department: "Development", project: "Encryption" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk encryption set. + * + * @summary updates (patches) a disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.json + */ +async function updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueSucceeded(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.update("myResourceGroup", "myDiskEncryptionSet", { + identity: { type: "SystemAssigned" }, + properties: { + activeKey: { + keyUrl: "https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1", + }, + encryptionType: "EncryptionAtRestWithCustomerKey", + rotationToLatestKeyVersionEnabled: true, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk encryption set. + * + * @summary updates (patches) a disk encryption set. + * x-ms-original-file: 2025-01-02/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.json + */ +async function updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueUpdating(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskEncryptionSets.update("myResourceGroup", "myDiskEncryptionSet", { + identity: { type: "SystemAssigned" }, + properties: { + activeKey: { + keyUrl: "https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1", + }, + encryptionType: "EncryptionAtRestWithCustomerKey", + rotationToLatestKeyVersionEnabled: true, + }, + }); + console.log(result); +} + +async function main(): Promise { + await updateADiskEncryptionSet(); + await updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueSucceeded(); + await updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueUpdating(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointGetSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointGetSample.ts new file mode 100644 index 000000000000..7127c3ea42da --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointGetSample.ts @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get disk restorePoint resource + * + * @summary get disk restorePoint resource + * x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_Get.json + */ +async function getAnIncrementalDiskRestorePointResource(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskRestorePoint.get( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + ); + console.log(result); +} + +/** + * This sample demonstrates how to get disk restorePoint resource + * + * @summary get disk restorePoint resource + * x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.json + */ +async function getAnIncrementalDiskRestorePointWhenSourceResourceIsFromADifferentRegion(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskRestorePoint.get( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + ); + console.log(result); +} + +async function main(): Promise { + await getAnIncrementalDiskRestorePointResource(); + await getAnIncrementalDiskRestorePointWhenSourceResourceIsFromADifferentRegion(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointGrantAccessSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointGrantAccessSample.ts new file mode 100644 index 000000000000..cf5c2abecaf0 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointGrantAccessSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to grants access to a diskRestorePoint. + * + * @summary grants access to a diskRestorePoint. + * x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.json + */ +async function grantsAccessToADiskRestorePoint(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.diskRestorePoint.grantAccess( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + { access: "Read", durationInSeconds: 300, fileFormat: "VHDX" }, + ); + console.log(result); +} + +async function main(): Promise { + await grantsAccessToADiskRestorePoint(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointListByRestorePointSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointListByRestorePointSample.ts new file mode 100644 index 000000000000..db2cd399dbfc --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointListByRestorePointSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists diskRestorePoints under a vmRestorePoint. + * + * @summary lists diskRestorePoints under a vmRestorePoint. + * x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json + */ +async function getAnIncrementalDiskRestorePointResource(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.diskRestorePoint.listByRestorePoint( + "myResourceGroup", + "rpc", + "vmrp", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await getAnIncrementalDiskRestorePointResource(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointRevokeAccessSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointRevokeAccessSample.ts new file mode 100644 index 000000000000..f9b919c1b41d --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/diskRestorePointRevokeAccessSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to revokes access to a diskRestorePoint. + * + * @summary revokes access to a diskRestorePoint. + * x-ms-original-file: 2025-01-02/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json + */ +async function revokesAccessToADiskRestorePoint(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.diskRestorePoint.revokeAccess( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + ); +} + +async function main(): Promise { + await revokesAccessToADiskRestorePoint(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksCreateOrUpdateSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksCreateOrUpdateSample.ts new file mode 100644 index 000000000000..eee254d38f33 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksCreateOrUpdateSample.ts @@ -0,0 +1,662 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json + */ +async function createAManagedDiskWithAvailabilityPolicy(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Empty" }, + diskSizeGB: 1024, + availabilityPolicy: { actionOnDiskDelay: "AutomaticReattach" }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_ByCopyingASnapshot.json + */ +async function createAManagedDiskByCopyingASnapshot(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json + */ +async function createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { + createOption: "Import", + storageAccountId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json + */ +async function createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { + createOption: "Import", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json + */ +async function createAConfidentialVMSupportedDiskEncryptedWithCustomerManagedKey(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscriptionId}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + securityProfile: { + securityType: "ConfidentialVM_DiskEncryptedWithCustomerKey", + secureVMDiskEncryptionSetId: + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", + }, + creationData: { + createOption: "FromImage", + imageReference: { + id: "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0", + }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_Empty.json + */ +async function createAnEmptyManagedDisk(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { creationData: { createOption: "Empty" }, diskSizeGB: 200 }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromAPlatformImage.json + */ +async function createAManagedDiskFromAPlatformImage(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscriptionId}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + creationData: { + createOption: "FromImage", + imageReference: { + id: "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0", + }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json + */ +async function createAManagedDiskFromAnAzureComputeGalleryCommunityImage(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscriptionId}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + creationData: { + createOption: "FromImage", + galleryImageReference: { + communityGalleryImageId: + "/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0", + }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json + */ +async function createAManagedDiskFromAnAzureComputeGalleryDirectSharedImage(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscriptionId}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + creationData: { + createOption: "FromImage", + galleryImageReference: { + sharedGalleryImageId: + "/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0", + }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json + */ +async function createAManagedDiskFromAnAzureComputeGalleryImage(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscriptionId}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + creationData: { + createOption: "FromImage", + galleryImageReference: { + id: "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0", + }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json + */ +async function createAManagedDiskFromElasticSanVolumeSnapshot(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { + createOption: "CopyFromSanSnapshot", + elasticSanResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromAnExistingManagedDisk.json + */ +async function createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk2", { + location: "West US", + properties: { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromImportSecure.json + */ +async function createAManagedDiskFromImportSecureCreateOption(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + securityProfile: { + securityType: "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", + }, + creationData: { + createOption: "ImportSecure", + storageAccountId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + securityDataUri: "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.json + */ +async function createAManagedDiskFromImportSecureCreateOptionWithMetadataURIForConfidentialVM(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + securityProfile: { + securityType: "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", + }, + creationData: { + createOption: "ImportSecure", + storageAccountId: + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + securityDataUri: "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd", + securityMetadataUri: "https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_FromUploadPreparedSecure.json + */ +async function createAManagedDiskFromUploadPreparedSecureCreateOption(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + osType: "Windows", + securityProfile: { securityType: "TrustedLaunch" }, + creationData: { + createOption: "UploadPreparedSecure", + uploadSizeBytes: 10737418752, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_InExtendedLocation.json + */ +async function createAnEmptyManagedDiskInExtendedLocation(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + extendedLocation: { type: "EdgeZone", name: "{edge-zone-id}" }, + properties: { creationData: { createOption: "Empty" }, diskSizeGB: 200 }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_PerformancePlus.json + */ +async function createAManagedDiskWithPerformancePlus(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Upload", performancePlus: true }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_UploadDisk.json + */ +async function createAManagedUploadDisk(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Upload", uploadSizeBytes: 10737418752 }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithDataAccessAuthMode.json + */ +async function createAManagedDiskWithDataAccessAuthMode(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + dataAccessAuthMode: "AzureActiveDirectory", + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithDiskAccess.json + */ +async function createAManagedDiskAndAssociateWithDiskAccessResource(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + networkAccessPolicy: "AllowPrivate", + diskAccessId: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}", + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithDiskEncryptionSet.json + */ +async function createAManagedDiskAndAssociateWithDiskEncryptionSet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + encryption: { + diskEncryptionSetId: + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithLogicalSectorSize.json + */ +async function createAnUltraManagedDiskWithLogicalSectorSize512E(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + sku: { name: "UltraSSD_LRS" }, + properties: { + creationData: { createOption: "Empty", logicalSectorSize: 512 }, + diskSizeGB: 200, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json + */ +async function createAManagedDiskWithOptimizedForFrequentAttach(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + properties: { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + optimizedForFrequentAttach: true, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json + */ +async function createAManagedDiskWithPremiumV2AccountType(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myPremiumV2Disk", { + location: "West US", + sku: { name: "PremiumV2_LRS" }, + properties: { + creationData: { createOption: "Empty" }, + diskSizeGB: 200, + diskIopsReadWrite: 125, + diskMBpsReadWrite: 3000, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithSSDZRSAccountType.json + */ +async function createAManagedDiskWithSsdZrsAccountType(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "West US", + sku: { name: "Premium_ZRS" }, + properties: { creationData: { createOption: "Empty" }, diskSizeGB: 200 }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithSecurityProfile.json + */ +async function createAManagedDiskWithSecurityProfile(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myDisk", { + location: "North Central US", + properties: { + osType: "Windows", + securityProfile: { securityType: "TrustedLaunch" }, + creationData: { + createOption: "FromImage", + imageReference: { + id: "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}", + }, + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a disk. + * + * @summary creates or updates a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json + */ +async function createAManagedDiskWithUltraAccountTypeWithReadOnlyPropertySet(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.createOrUpdate("myResourceGroup", "myUltraReadOnlyDisk", { + location: "West US", + sku: { name: "UltraSSD_LRS" }, + properties: { + creationData: { createOption: "Empty", logicalSectorSize: 4096 }, + diskSizeGB: 200, + diskIopsReadWrite: 125, + diskMBpsReadWrite: 3000, + encryption: { type: "EncryptionAtRestWithPlatformKey" }, + }, + }); + console.log(result); +} + +async function main(): Promise { + await createAManagedDiskWithAvailabilityPolicy(); + await createAManagedDiskByCopyingASnapshot(); + await createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription(); + await createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription(); + await createAConfidentialVMSupportedDiskEncryptedWithCustomerManagedKey(); + await createAnEmptyManagedDisk(); + await createAManagedDiskFromAPlatformImage(); + await createAManagedDiskFromAnAzureComputeGalleryCommunityImage(); + await createAManagedDiskFromAnAzureComputeGalleryDirectSharedImage(); + await createAManagedDiskFromAnAzureComputeGalleryImage(); + await createAManagedDiskFromElasticSanVolumeSnapshot(); + await createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription(); + await createAManagedDiskFromImportSecureCreateOption(); + await createAManagedDiskFromImportSecureCreateOptionWithMetadataURIForConfidentialVM(); + await createAManagedDiskFromUploadPreparedSecureCreateOption(); + await createAnEmptyManagedDiskInExtendedLocation(); + await createAManagedDiskWithPerformancePlus(); + await createAManagedUploadDisk(); + await createAManagedDiskWithDataAccessAuthMode(); + await createAManagedDiskAndAssociateWithDiskAccessResource(); + await createAManagedDiskAndAssociateWithDiskEncryptionSet(); + await createAnUltraManagedDiskWithLogicalSectorSize512E(); + await createAManagedDiskWithOptimizedForFrequentAttach(); + await createAManagedDiskWithPremiumV2AccountType(); + await createAManagedDiskWithSsdZrsAccountType(); + await createAManagedDiskWithSecurityProfile(); + await createAManagedDiskWithUltraAccountTypeWithReadOnlyPropertySet(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksDeleteSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksDeleteSample.ts new file mode 100644 index 000000000000..8bcbd608545c --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes a disk. + * + * @summary deletes a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Delete.json + */ +async function deleteAManagedDisk(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.disks.delete("myResourceGroup", "myDisk"); +} + +async function main(): Promise { + await deleteAManagedDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksGetSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksGetSample.ts new file mode 100644 index 000000000000..b53e1c6ccc88 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information about a disk. + * + * @summary gets information about a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Get.json + */ +async function getInformationAboutAManagedDisk(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.get("myResourceGroup", "myManagedDisk"); + console.log(result); +} + +async function main(): Promise { + await getInformationAboutAManagedDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksGrantAccessSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksGrantAccessSample.ts new file mode 100644 index 000000000000..b726058ebd21 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksGrantAccessSample.ts @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to grants access to a disk. + * + * @summary grants access to a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_BeginGetAccess.json + */ +async function getASasOnAManagedDisk(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.grantAccess("myResourceGroup", "myDisk", { + access: "Read", + durationInSeconds: 300, + fileFormat: "VHD", + }); + console.log(result); +} + +/** + * This sample demonstrates how to grants access to a disk. + * + * @summary grants access to a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_BeginGetAccess_WithVMGuestState.json + */ +async function getSasOnManagedDiskAndVMGuestState(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.grantAccess("myResourceGroup", "myDisk", { + access: "Read", + durationInSeconds: 300, + getSecureVMGuestStateSAS: true, + }); + console.log(result); +} + +/** + * This sample demonstrates how to grants access to a disk. + * + * @summary grants access to a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_BeginGetAccess_WithVMGuestStateAndVMMetadata.json + */ +async function getSasOnManagedDiskVMGuestStateAndVMMetadataForConfidentialVM(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.grantAccess("myResourceGroup", "myDisk", { + access: "Read", + durationInSeconds: 300, + getSecureVMGuestStateSAS: true, + }); + console.log(result); +} + +async function main(): Promise { + await getASasOnAManagedDisk(); + await getSasOnManagedDiskAndVMGuestState(); + await getSasOnManagedDiskVMGuestStateAndVMMetadataForConfidentialVM(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksListByResourceGroupSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksListByResourceGroupSample.ts new file mode 100644 index 000000000000..21920aa813c4 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all the disks under a resource group. + * + * @summary lists all the disks under a resource group. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_ListByResourceGroup.json + */ +async function listAllManagedDisksInAResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.disks.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllManagedDisksInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksListSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksListSample.ts new file mode 100644 index 000000000000..6e81490863a7 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists all the disks under a subscription. + * + * @summary lists all the disks under a subscription. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_ListBySubscription.json + */ +async function listAllManagedDisksInASubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.disks.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllManagedDisksInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksRevokeAccessSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksRevokeAccessSample.ts new file mode 100644 index 000000000000..2d3d9f490687 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksRevokeAccessSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to revokes access to a disk. + * + * @summary revokes access to a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_EndGetAccess.json + */ +async function revokeAccessToAManagedDisk(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.disks.revokeAccess("myResourceGroup", "myDisk"); +} + +async function main(): Promise { + await revokeAccessToAManagedDisk(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksUpdateSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksUpdateSample.ts new file mode 100644 index 000000000000..876bfe9f94aa --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/disksUpdateSample.ts @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json + */ +async function createOrUpdateABurstingEnabledManagedDisk(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { diskSizeGB: 1024, burstingEnabled: true }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_AddAcceleratedNetworking.json + */ +async function updateAManagedDiskToAddAcceleratedNetworking(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { supportedCapabilities: { acceleratedNetwork: false } }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_AddDiskControllerTypes.json + */ +async function updateAManagedDiskWithDiskControllerTypes(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { supportedCapabilities: { diskControllerTypes: "SCSI" } }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_AddPurchasePlan.json + */ +async function updateAManagedDiskToAddPurchasePlan(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { + purchasePlan: { + name: "myPurchasePlanName", + publisher: "myPurchasePlanPublisher", + product: "myPurchasePlanProduct", + promotionCode: "myPurchasePlanPromotionCode", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_AddSupportsHibernation.json + */ +async function updateAManagedDiskToAddSupportsHibernation(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { supportsHibernation: true }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_ChangeTier.json + */ +async function updateAManagedDiskToChangeTier(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { tier: "P30" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_DisableBursting.json + */ +async function updateAManagedDiskToDisableBursting(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { burstingEnabled: false }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json + */ +async function updateAManagedDiskToDisableOptimizedForFrequentAttach(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { optimizedForFrequentAttach: false }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_RemoveDiskAccess.json + */ +async function updateManagedDiskToRemoveDiskAccessResourceAssociation(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { networkAccessPolicy: "AllowAll" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a disk. + * + * @summary updates (patches) a disk. + * x-ms-original-file: 2025-01-02/diskExamples/Disk_Update_ToAddArchitecture.json + */ +async function updateAManagedDiskToAddArchitecture(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.disks.update("myResourceGroup", "myDisk", { + properties: { supportedCapabilities: { architecture: "Arm64" } }, + }); + console.log(result); +} + +async function main(): Promise { + await createOrUpdateABurstingEnabledManagedDisk(); + await updateAManagedDiskToAddAcceleratedNetworking(); + await updateAManagedDiskWithDiskControllerTypes(); + await updateAManagedDiskToAddPurchasePlan(); + await updateAManagedDiskToAddSupportsHibernation(); + await updateAManagedDiskToChangeTier(); + await updateAManagedDiskToDisableBursting(); + await updateAManagedDiskToDisableOptimizedForFrequentAttach(); + await updateManagedDiskToRemoveDiskAccessResourceAssociation(); + await updateAManagedDiskToAddArchitecture(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsCreateOrUpdateSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..6c79d087c3b0 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsCreateOrUpdateSample.ts @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ +async function createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot1", { + location: "West US", + properties: { + creationData: { + createOption: "Import", + storageAccountId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ +async function createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot1", { + location: "West US", + properties: { + creationData: { + createOption: "Import", + sourceUri: "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json + */ +async function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegionWithQuickerCopySpeed(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot2", { + location: "West US", + properties: { + creationData: { + createOption: "CopyStart", + sourceResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", + provisionedBandwidthCopySpeed: "Enhanced", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json + */ +async function createASnapshotFromAnElasticSanVolumeSnapshot(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot", { + location: "West US", + properties: { + creationData: { + createOption: "CopyFromSanSnapshot", + elasticSanResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json + */ +async function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot2", { + location: "West US", + properties: { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json + */ +async function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot2", { + location: "West US", + properties: { + creationData: { + createOption: "CopyStart", + sourceResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", + }, + }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to creates or updates a snapshot. + * + * @summary creates or updates a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Create_InstantAccessSnapshot.json + */ +async function createASnapshotWhichCanBeInstantlyAccessable(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.createOrUpdate("myResourceGroup", "mySnapshot2", { + location: "West US", + properties: { + creationData: { + createOption: "Copy", + sourceResourceId: + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1", + instantAccessDurationMinutes: 120, + }, + }, + }); + console.log(result); +} + +async function main(): Promise { + await createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription(); + await createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription(); + await createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegionWithQuickerCopySpeed(); + await createASnapshotFromAnElasticSanVolumeSnapshot(); + await createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription(); + await createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion(); + await createASnapshotWhichCanBeInstantlyAccessable(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsDeleteSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsDeleteSample.ts new file mode 100644 index 000000000000..895f09672825 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to deletes a snapshot. + * + * @summary deletes a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Delete.json + */ +async function deleteASnapshot(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.snapshots.delete("myResourceGroup", "mySnapshot"); +} + +async function main(): Promise { + await deleteASnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsGetSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsGetSample.ts new file mode 100644 index 000000000000..712a503d8cc1 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsGetSample.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to gets information about a snapshot. + * + * @summary gets information about a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Get.json + */ +async function getInformationAboutASnapshot(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.get("myResourceGroup", "mySnapshot"); + console.log(result); +} + +/** + * This sample demonstrates how to gets information about a snapshot. + * + * @summary gets information about a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_GetIncrementalSnapshot.json + */ +async function getInformationAboutAnIncrementalSnapshot(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.get("myResourceGroup", "myIncrementalSnapshot"); + console.log(result); +} + +async function main(): Promise { + await getInformationAboutASnapshot(); + await getInformationAboutAnIncrementalSnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsGrantAccessSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsGrantAccessSample.ts new file mode 100644 index 000000000000..d5eff6a7b79a --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsGrantAccessSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to grants access to a snapshot. + * + * @summary grants access to a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_BeginGetAccess.json + */ +async function getASasOnASnapshot(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.grantAccess("myResourceGroup", "mySnapshot", { + access: "Read", + durationInSeconds: 300, + fileFormat: "VHDX", + }); + console.log(result); +} + +async function main(): Promise { + await getASasOnASnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsListByResourceGroupSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsListByResourceGroupSample.ts new file mode 100644 index 000000000000..c8f87c1405c9 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsListByResourceGroupSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists snapshots under a resource group. + * + * @summary lists snapshots under a resource group. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_ListByResourceGroup.json + */ +async function listAllSnapshotsInAResourceGroup(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.snapshots.listByResourceGroup("myResourceGroup")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllSnapshotsInAResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsListSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsListSample.ts new file mode 100644 index 000000000000..8babe9e4a4e8 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to lists snapshots under a subscription. + * + * @summary lists snapshots under a subscription. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_ListBySubscription.json + */ +async function listAllSnapshotsInASubscription(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const resArray = new Array(); + for await (const item of client.snapshots.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await listAllSnapshotsInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsRevokeAccessSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsRevokeAccessSample.ts new file mode 100644 index 000000000000..788e76282845 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsRevokeAccessSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to revokes access to a snapshot. + * + * @summary revokes access to a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_EndGetAccess.json + */ +async function revokeAccessToASnapshot(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + await client.snapshots.revokeAccess("myResourceGroup", "mySnapshot"); +} + +async function main(): Promise { + await revokeAccessToASnapshot(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsUpdateSample.ts b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsUpdateSample.ts new file mode 100644 index 000000000000..e12207d654d2 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/src/snapshotsUpdateSample.ts @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } from "@azure/arm-compute-disk"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to updates (patches) a snapshot. + * + * @summary updates (patches) a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Update.json + */ +async function updateASnapshot(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.update("myResourceGroup", "mySnapshot", { + properties: { diskSizeGB: 20 }, + tags: { department: "Development", project: "UpdateSnapshots" }, + }); + console.log(result); +} + +/** + * This sample demonstrates how to updates (patches) a snapshot. + * + * @summary updates (patches) a snapshot. + * x-ms-original-file: 2025-01-02/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.json + */ +async function updateASnapshotWithAcceleratedNetworking(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "{subscription-id}"; + const client = new ComputeClient(credential, subscriptionId); + const result = await client.snapshots.update("myResourceGroup", "mySnapshot", { + properties: { + diskSizeGB: 20, + supportedCapabilities: { acceleratedNetwork: false }, + }, + tags: { department: "Development", project: "UpdateSnapshots" }, + }); + console.log(result); +} + +async function main(): Promise { + await updateASnapshot(); + await updateASnapshotWithAcceleratedNetworking(); +} + +main().catch(console.error); diff --git a/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/tsconfig.json b/sdk/compute/arm-compute-disk/samples/v1-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..400db87cf648 --- /dev/null +++ b/sdk/compute/arm-compute-disk/samples/v1-beta/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/compute/arm-compute-disk/src/api/computeDiskContext.ts b/sdk/compute/arm-compute-disk/src/api/computeDiskContext.ts new file mode 100644 index 000000000000..f909e2902816 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/computeDiskContext.ts @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import { + AzureSupportedClouds, + getArmEndpoint, +} from "../static-helpers/cloudSettingHelpers.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { TokenCredential } from "@azure/core-auth"; + +/** Compute Client */ +export interface ComputeDiskContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; +} + +/** Optional parameters for the client. */ +export interface ComputeDiskClientOptionalParams 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; +} + +/** Compute Client */ +export function createComputeDisk( + credential: TokenCredential, + subscriptionId: string, + options: ComputeDiskClientOptionalParams = {}, +): ComputeDiskContext { + const endpointUrl = + options.endpoint ?? + getArmEndpoint(options.cloudSetting) ?? + "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-compute-disk/1.0.0-beta.1`; + 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); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + const apiVersion = options.apiVersion ?? "2025-01-02"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return { ...clientContext, apiVersion, subscriptionId } as ComputeDiskContext; +} diff --git a/sdk/compute/arm-compute-disk/src/api/diskAccesses/index.ts b/sdk/compute/arm-compute-disk/src/api/diskAccesses/index.ts new file mode 100644 index 000000000000..08b2514da39d --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/diskAccesses/index.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + listPrivateEndpointConnections, + deleteAPrivateEndpointConnection, + updateAPrivateEndpointConnection, + getAPrivateEndpointConnection, + getPrivateLinkResources, + list, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "./operations.js"; +export { + DiskAccessesListPrivateEndpointConnectionsOptionalParams, + DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams, + DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams, + DiskAccessesGetAPrivateEndpointConnectionOptionalParams, + DiskAccessesGetPrivateLinkResourcesOptionalParams, + DiskAccessesListOptionalParams, + DiskAccessesListByResourceGroupOptionalParams, + DiskAccessesDeleteOptionalParams, + DiskAccessesUpdateOptionalParams, + DiskAccessesCreateOrUpdateOptionalParams, + DiskAccessesGetOptionalParams, +} from "./options.js"; diff --git a/sdk/compute/arm-compute-disk/src/api/diskAccesses/operations.ts b/sdk/compute/arm-compute-disk/src/api/diskAccesses/operations.ts new file mode 100644 index 000000000000..c6db961d068f --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/diskAccesses/operations.ts @@ -0,0 +1,777 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeDiskContext as Client } from "../index.js"; +import { + cloudErrorDeserializer, + DiskAccess, + diskAccessSerializer, + diskAccessDeserializer, + PrivateEndpointConnection, + privateEndpointConnectionSerializer, + privateEndpointConnectionDeserializer, + DiskAccessUpdate, + diskAccessUpdateSerializer, + _DiskAccessList, + _diskAccessListDeserializer, + PrivateLinkResourceListResult, + privateLinkResourceListResultDeserializer, + _PrivateEndpointConnectionListResult, + _privateEndpointConnectionListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + DiskAccessesListPrivateEndpointConnectionsOptionalParams, + DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams, + DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams, + DiskAccessesGetAPrivateEndpointConnectionOptionalParams, + DiskAccessesGetPrivateLinkResourcesOptionalParams, + DiskAccessesListOptionalParams, + DiskAccessesListByResourceGroupOptionalParams, + DiskAccessesDeleteOptionalParams, + DiskAccessesUpdateOptionalParams, + DiskAccessesCreateOrUpdateOptionalParams, + DiskAccessesGetOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listPrivateEndpointConnectionsSend( + context: Client, + resourceGroupName: string, + diskAccessName: string, + options: DiskAccessesListPrivateEndpointConnectionsOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskAccessName: diskAccessName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listPrivateEndpointConnectionsDeserialize( + result: PathUncheckedResponse, +): Promise<_PrivateEndpointConnectionListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return _privateEndpointConnectionListResultDeserializer(result.body); +} + +/** List information about private endpoint connections under a disk access resource */ +export function listPrivateEndpointConnections( + context: Client, + resourceGroupName: string, + diskAccessName: string, + options: DiskAccessesListPrivateEndpointConnectionsOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listPrivateEndpointConnectionsSend( + context, + resourceGroupName, + diskAccessName, + options, + ), + _listPrivateEndpointConnectionsDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _deleteAPrivateEndpointConnectionSend( + context: Client, + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + options: DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskAccessName: diskAccessName, + privateEndpointConnectionName: privateEndpointConnectionName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _deleteAPrivateEndpointConnectionDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return; +} + +/** Deletes a private endpoint connection under a disk access resource. */ +export function deleteAPrivateEndpointConnection( + context: Client, + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + options: DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams = { + requestOptions: {}, + }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _deleteAPrivateEndpointConnectionDeserialize, + ["200", "202", "204", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _deleteAPrivateEndpointConnectionSend( + context, + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _updateAPrivateEndpointConnectionSend( + context: Client, + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options: DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskAccessName: diskAccessName, + privateEndpointConnectionName: privateEndpointConnectionName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: privateEndpointConnectionSerializer(privateEndpointConnection), + }); +} + +export async function _updateAPrivateEndpointConnectionDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return privateEndpointConnectionDeserializer(result.body); +} + +/** Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private endpoint connection. */ +export function updateAPrivateEndpointConnection( + context: Client, + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options: DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams = { + requestOptions: {}, + }, +): PollerLike< + OperationState, + PrivateEndpointConnection +> { + return getLongRunningPoller( + context, + _updateAPrivateEndpointConnectionDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateAPrivateEndpointConnectionSend( + context, + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + privateEndpointConnection, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike< + OperationState, + PrivateEndpointConnection + >; +} + +export function _getAPrivateEndpointConnectionSend( + context: Client, + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + options: DiskAccessesGetAPrivateEndpointConnectionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskAccessName: diskAccessName, + privateEndpointConnectionName: privateEndpointConnectionName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getAPrivateEndpointConnectionDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return privateEndpointConnectionDeserializer(result.body); +} + +/** Gets information about a private endpoint connection under a disk access resource. */ +export async function getAPrivateEndpointConnection( + context: Client, + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + options: DiskAccessesGetAPrivateEndpointConnectionOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getAPrivateEndpointConnectionSend( + context, + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + options, + ); + return _getAPrivateEndpointConnectionDeserialize(result); +} + +export function _getPrivateLinkResourcesSend( + context: Client, + resourceGroupName: string, + diskAccessName: string, + options: DiskAccessesGetPrivateLinkResourcesOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privatelinkresources{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskAccessName: diskAccessName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _getPrivateLinkResourcesDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return privateLinkResourceListResultDeserializer(result.body); +} + +/** Gets the private link resources possible under disk access resource */ +export async function getPrivateLinkResources( + context: Client, + resourceGroupName: string, + diskAccessName: string, + options: DiskAccessesGetPrivateLinkResourcesOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _getPrivateLinkResourcesSend( + context, + resourceGroupName, + diskAccessName, + options, + ); + return _getPrivateLinkResourcesDeserialize(result); +} + +export function _listSend( + context: Client, + options: DiskAccessesListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + 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<_DiskAccessList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return _diskAccessListDeserializer(result.body); +} + +/** Lists all the disk access resources under a subscription. */ +export function list( + context: Client, + options: DiskAccessesListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: DiskAccessesListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + 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<_DiskAccessList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return _diskAccessListDeserializer(result.body); +} + +/** Lists all the disk access resources under a resource group. */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: DiskAccessesListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + diskAccessName: string, + options: DiskAccessesDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskAccessName: diskAccessName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return; +} + +/** Deletes a disk access resource. */ +/** + * @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, + diskAccessName: string, + options: DiskAccessesDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["200", "202", "204", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, diskAccessName, options), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccessUpdate, + options: DiskAccessesUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskAccessName: diskAccessName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: diskAccessUpdateSerializer(diskAccess), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return diskAccessDeserializer(result.body); +} + +/** Updates (patches) a disk access resource. */ +export function update( + context: Client, + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccessUpdate, + options: DiskAccessesUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, DiskAccess> { + return getLongRunningPoller( + context, + _updateDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend( + context, + resourceGroupName, + diskAccessName, + diskAccess, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, DiskAccess>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccess, + options: DiskAccessesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskAccessName: diskAccessName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: diskAccessSerializer(diskAccess), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return diskAccessDeserializer(result.body); +} + +/** Creates or updates a disk access resource */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccess, + options: DiskAccessesCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, DiskAccess> { + return getLongRunningPoller( + context, + _createOrUpdateDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + diskAccessName, + diskAccess, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, DiskAccess>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + diskAccessName: string, + options: DiskAccessesGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskAccessName: diskAccessName, + "api%2Dversion": context.apiVersion, + }, + { + 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 = cloudErrorDeserializer(result.body); + throw error; + } + + return diskAccessDeserializer(result.body); +} + +/** Gets information about a disk access resource. */ +export async function get( + context: Client, + resourceGroupName: string, + diskAccessName: string, + options: DiskAccessesGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + diskAccessName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/compute/arm-compute-disk/src/api/diskAccesses/options.ts b/sdk/compute/arm-compute-disk/src/api/diskAccesses/options.ts new file mode 100644 index 000000000000..a867a348008d --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/diskAccesses/options.ts @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DiskAccessesListPrivateEndpointConnectionsOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiskAccessesGetAPrivateEndpointConnectionOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DiskAccessesGetPrivateLinkResourcesOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DiskAccessesListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DiskAccessesListByResourceGroupOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DiskAccessesDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiskAccessesUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiskAccessesCreateOrUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiskAccessesGetOptionalParams extends OperationOptions {} diff --git a/sdk/compute/arm-compute-disk/src/api/diskEncryptionSets/index.ts b/sdk/compute/arm-compute-disk/src/api/diskEncryptionSets/index.ts new file mode 100644 index 000000000000..61a39032d82f --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/diskEncryptionSets/index.ts @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + listAssociatedResources, + list, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "./operations.js"; +export { + DiskEncryptionSetsListAssociatedResourcesOptionalParams, + DiskEncryptionSetsListOptionalParams, + DiskEncryptionSetsListByResourceGroupOptionalParams, + DiskEncryptionSetsDeleteOptionalParams, + DiskEncryptionSetsUpdateOptionalParams, + DiskEncryptionSetsCreateOrUpdateOptionalParams, + DiskEncryptionSetsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/compute/arm-compute-disk/src/api/diskEncryptionSets/operations.ts b/sdk/compute/arm-compute-disk/src/api/diskEncryptionSets/operations.ts new file mode 100644 index 000000000000..3e4281330cc0 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/diskEncryptionSets/operations.ts @@ -0,0 +1,492 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeDiskContext as Client } from "../index.js"; +import { + cloudErrorDeserializer, + DiskEncryptionSet, + diskEncryptionSetSerializer, + diskEncryptionSetDeserializer, + DiskEncryptionSetUpdate, + diskEncryptionSetUpdateSerializer, + _DiskEncryptionSetList, + _diskEncryptionSetListDeserializer, + _ResourceUriList, + _resourceUriListDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + DiskEncryptionSetsListAssociatedResourcesOptionalParams, + DiskEncryptionSetsListOptionalParams, + DiskEncryptionSetsListByResourceGroupOptionalParams, + DiskEncryptionSetsDeleteOptionalParams, + DiskEncryptionSetsUpdateOptionalParams, + DiskEncryptionSetsCreateOrUpdateOptionalParams, + DiskEncryptionSetsGetOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _listAssociatedResourcesSend( + context: Client, + resourceGroupName: string, + diskEncryptionSetName: string, + options: DiskEncryptionSetsListAssociatedResourcesOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskEncryptionSetName: diskEncryptionSetName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listAssociatedResourcesDeserialize( + result: PathUncheckedResponse, +): Promise<_ResourceUriList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return _resourceUriListDeserializer(result.body); +} + +/** Lists all resources that are encrypted with this disk encryption set. */ +export function listAssociatedResources( + context: Client, + resourceGroupName: string, + diskEncryptionSetName: string, + options: DiskEncryptionSetsListAssociatedResourcesOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listAssociatedResourcesSend( + context, + resourceGroupName, + diskEncryptionSetName, + options, + ), + _listAssociatedResourcesDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listSend( + context: Client, + options: DiskEncryptionSetsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + 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<_DiskEncryptionSetList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return _diskEncryptionSetListDeserializer(result.body); +} + +/** Lists all the disk encryption sets under a subscription. */ +export function list( + context: Client, + options: DiskEncryptionSetsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: DiskEncryptionSetsListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + 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<_DiskEncryptionSetList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return _diskEncryptionSetListDeserializer(result.body); +} + +/** Lists all the disk encryption sets under a resource group. */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: DiskEncryptionSetsListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + diskEncryptionSetName: string, + options: DiskEncryptionSetsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskEncryptionSetName: diskEncryptionSetName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return; +} + +/** Deletes a disk encryption set. */ +/** + * @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, + diskEncryptionSetName: string, + options: DiskEncryptionSetsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["200", "202", "204", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend( + context, + resourceGroupName, + diskEncryptionSetName, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSetUpdate, + options: DiskEncryptionSetsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskEncryptionSetName: diskEncryptionSetName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: diskEncryptionSetUpdateSerializer(diskEncryptionSet), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return diskEncryptionSetDeserializer(result.body); +} + +/** Updates (patches) a disk encryption set. */ +export function update( + context: Client, + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSetUpdate, + options: DiskEncryptionSetsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, DiskEncryptionSet> { + return getLongRunningPoller( + context, + _updateDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend( + context, + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, DiskEncryptionSet>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSet, + options: DiskEncryptionSetsCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskEncryptionSetName: diskEncryptionSetName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: diskEncryptionSetSerializer(diskEncryptionSet), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return diskEncryptionSetDeserializer(result.body); +} + +/** Creates or updates a disk encryption set */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSet, + options: DiskEncryptionSetsCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): PollerLike, DiskEncryptionSet> { + return getLongRunningPoller( + context, + _createOrUpdateDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, DiskEncryptionSet>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + diskEncryptionSetName: string, + options: DiskEncryptionSetsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskEncryptionSetName: diskEncryptionSetName, + "api%2Dversion": context.apiVersion, + }, + { + 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 = cloudErrorDeserializer(result.body); + throw error; + } + + return diskEncryptionSetDeserializer(result.body); +} + +/** Gets information about a disk encryption set. */ +export async function get( + context: Client, + resourceGroupName: string, + diskEncryptionSetName: string, + options: DiskEncryptionSetsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + diskEncryptionSetName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/compute/arm-compute-disk/src/api/diskEncryptionSets/options.ts b/sdk/compute/arm-compute-disk/src/api/diskEncryptionSets/options.ts new file mode 100644 index 000000000000..7e4f6d95df81 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/diskEncryptionSets/options.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DiskEncryptionSetsListAssociatedResourcesOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DiskEncryptionSetsListOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DiskEncryptionSetsListByResourceGroupOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DiskEncryptionSetsDeleteOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiskEncryptionSetsUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiskEncryptionSetsCreateOrUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiskEncryptionSetsGetOptionalParams extends OperationOptions {} diff --git a/sdk/compute/arm-compute-disk/src/api/diskRestorePoint/index.ts b/sdk/compute/arm-compute-disk/src/api/diskRestorePoint/index.ts new file mode 100644 index 000000000000..82926fc24bff --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/diskRestorePoint/index.ts @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + revokeAccess, + grantAccess, + listByRestorePoint, + get, +} from "./operations.js"; +export { + DiskRestorePointRevokeAccessOptionalParams, + DiskRestorePointGrantAccessOptionalParams, + DiskRestorePointListByRestorePointOptionalParams, + DiskRestorePointGetOptionalParams, +} from "./options.js"; diff --git a/sdk/compute/arm-compute-disk/src/api/diskRestorePoint/operations.ts b/sdk/compute/arm-compute-disk/src/api/diskRestorePoint/operations.ts new file mode 100644 index 000000000000..e753ee0655a2 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/diskRestorePoint/operations.ts @@ -0,0 +1,323 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeDiskContext as Client } from "../index.js"; +import { + cloudErrorDeserializer, + GrantAccessData, + grantAccessDataSerializer, + AccessUri, + accessUriDeserializer, + DiskRestorePoint, + diskRestorePointDeserializer, + _DiskRestorePointList, + _diskRestorePointListDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + DiskRestorePointRevokeAccessOptionalParams, + DiskRestorePointGrantAccessOptionalParams, + DiskRestorePointListByRestorePointOptionalParams, + DiskRestorePointGetOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _revokeAccessSend( + context: Client, + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + options: DiskRestorePointRevokeAccessOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + restorePointCollectionName: restorePointCollectionName, + vmRestorePointName: vmRestorePointName, + diskRestorePointName: diskRestorePointName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _revokeAccessDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return; +} + +/** Revokes access to a diskRestorePoint. */ +export function revokeAccess( + context: Client, + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + options: DiskRestorePointRevokeAccessOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _revokeAccessDeserialize, + ["202", "200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _revokeAccessSend( + context, + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _grantAccessSend( + context: Client, + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + grantAccessData: GrantAccessData, + options: DiskRestorePointGrantAccessOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + restorePointCollectionName: restorePointCollectionName, + vmRestorePointName: vmRestorePointName, + diskRestorePointName: diskRestorePointName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: grantAccessDataSerializer(grantAccessData), + }); +} + +export async function _grantAccessDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return accessUriDeserializer(result.body); +} + +/** Grants access to a diskRestorePoint. */ +export function grantAccess( + context: Client, + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + grantAccessData: GrantAccessData, + options: DiskRestorePointGrantAccessOptionalParams = { requestOptions: {} }, +): PollerLike, AccessUri> { + return getLongRunningPoller( + context, + _grantAccessDeserialize, + ["202", "200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _grantAccessSend( + context, + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, AccessUri>; +} + +export function _listByRestorePointSend( + context: Client, + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + options: DiskRestorePointListByRestorePointOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + restorePointCollectionName: restorePointCollectionName, + vmRestorePointName: vmRestorePointName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + }); +} + +export async function _listByRestorePointDeserialize( + result: PathUncheckedResponse, +): Promise<_DiskRestorePointList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return _diskRestorePointListDeserializer(result.body); +} + +/** Lists diskRestorePoints under a vmRestorePoint. */ +export function listByRestorePoint( + context: Client, + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + options: DiskRestorePointListByRestorePointOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _listByRestorePointSend( + context, + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + options, + ), + _listByRestorePointDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _getSend( + context: Client, + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + options: DiskRestorePointGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + restorePointCollectionName: restorePointCollectionName, + vmRestorePointName: vmRestorePointName, + diskRestorePointName: diskRestorePointName, + "api%2Dversion": context.apiVersion, + }, + { + 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 = cloudErrorDeserializer(result.body); + throw error; + } + + return diskRestorePointDeserializer(result.body); +} + +/** Get disk restorePoint resource */ +export async function get( + context: Client, + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + options: DiskRestorePointGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/compute/arm-compute-disk/src/api/diskRestorePoint/options.ts b/sdk/compute/arm-compute-disk/src/api/diskRestorePoint/options.ts new file mode 100644 index 000000000000..ebfa0935d7b9 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/diskRestorePoint/options.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DiskRestorePointRevokeAccessOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiskRestorePointGrantAccessOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DiskRestorePointListByRestorePointOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DiskRestorePointGetOptionalParams extends OperationOptions {} diff --git a/sdk/compute/arm-compute-disk/src/api/disks/index.ts b/sdk/compute/arm-compute-disk/src/api/disks/index.ts new file mode 100644 index 000000000000..a452ac1f4b64 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/disks/index.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + revokeAccess, + grantAccess, + list, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "./operations.js"; +export { + DisksRevokeAccessOptionalParams, + DisksGrantAccessOptionalParams, + DisksListOptionalParams, + DisksListByResourceGroupOptionalParams, + DisksDeleteOptionalParams, + DisksUpdateOptionalParams, + DisksCreateOrUpdateOptionalParams, + DisksGetOptionalParams, +} from "./options.js"; diff --git a/sdk/compute/arm-compute-disk/src/api/disks/operations.ts b/sdk/compute/arm-compute-disk/src/api/disks/operations.ts new file mode 100644 index 000000000000..b699ff54ff5e --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/disks/operations.ts @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeDiskContext as Client } from "../index.js"; +import { + Disk, + diskSerializer, + diskDeserializer, + cloudErrorDeserializer, + DiskUpdate, + diskUpdateSerializer, + _DiskList, + _diskListDeserializer, + GrantAccessData, + grantAccessDataSerializer, + AccessUri, + accessUriDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + DisksRevokeAccessOptionalParams, + DisksGrantAccessOptionalParams, + DisksListOptionalParams, + DisksListByResourceGroupOptionalParams, + DisksDeleteOptionalParams, + DisksUpdateOptionalParams, + DisksCreateOrUpdateOptionalParams, + DisksGetOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _revokeAccessSend( + context: Client, + resourceGroupName: string, + diskName: string, + options: DisksRevokeAccessOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskName: diskName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _revokeAccessDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return; +} + +/** Revokes access to a disk. */ +export function revokeAccess( + context: Client, + resourceGroupName: string, + diskName: string, + options: DisksRevokeAccessOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _revokeAccessDeserialize, + ["202", "200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _revokeAccessSend(context, resourceGroupName, diskName, options), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _grantAccessSend( + context: Client, + resourceGroupName: string, + diskName: string, + grantAccessData: GrantAccessData, + options: DisksGrantAccessOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskName: diskName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: grantAccessDataSerializer(grantAccessData), + }); +} + +export async function _grantAccessDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return accessUriDeserializer(result.body); +} + +/** Grants access to a disk. */ +export function grantAccess( + context: Client, + resourceGroupName: string, + diskName: string, + grantAccessData: GrantAccessData, + options: DisksGrantAccessOptionalParams = { requestOptions: {} }, +): PollerLike, AccessUri> { + return getLongRunningPoller( + context, + _grantAccessDeserialize, + ["202", "200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _grantAccessSend( + context, + resourceGroupName, + diskName, + grantAccessData, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, AccessUri>; +} + +export function _listSend( + context: Client, + options: DisksListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + 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<_DiskList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return _diskListDeserializer(result.body); +} + +/** Lists all the disks under a subscription. */ +export function list( + context: Client, + options: DisksListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: DisksListByResourceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + 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<_DiskList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return _diskListDeserializer(result.body); +} + +/** Lists all the disks under a resource group. */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: DisksListByResourceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + diskName: string, + options: DisksDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskName: diskName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return; +} + +/** Deletes a disk. */ +/** + * @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, + diskName: string, + options: DisksDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["200", "202", "204", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, diskName, options), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + diskName: string, + disk: DiskUpdate, + options: DisksUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskName: diskName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: diskUpdateSerializer(disk), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return diskDeserializer(result.body); +} + +/** Updates (patches) a disk. */ +export function update( + context: Client, + resourceGroupName: string, + diskName: string, + disk: DiskUpdate, + options: DisksUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Disk> { + return getLongRunningPoller( + context, + _updateDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend(context, resourceGroupName, diskName, disk, options), + resourceLocationConfig: "location", + }, + ) as PollerLike, Disk>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + diskName: string, + disk: Disk, + options: DisksCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskName: diskName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: diskSerializer(disk), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return diskDeserializer(result.body); +} + +/** Creates or updates a disk. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + diskName: string, + disk: Disk, + options: DisksCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Disk> { + return getLongRunningPoller( + context, + _createOrUpdateDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + diskName, + disk, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, Disk>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + diskName: string, + options: DisksGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + diskName: diskName, + "api%2Dversion": context.apiVersion, + }, + { + 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 = cloudErrorDeserializer(result.body); + throw error; + } + + return diskDeserializer(result.body); +} + +/** Gets information about a disk. */ +export async function get( + context: Client, + resourceGroupName: string, + diskName: string, + options: DisksGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend(context, resourceGroupName, diskName, options); + return _getDeserialize(result); +} diff --git a/sdk/compute/arm-compute-disk/src/api/disks/options.ts b/sdk/compute/arm-compute-disk/src/api/disks/options.ts new file mode 100644 index 000000000000..b861a458ad1b --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/disks/options.ts @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface DisksRevokeAccessOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DisksGrantAccessOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DisksListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface DisksListByResourceGroupOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface DisksDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DisksUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DisksCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface DisksGetOptionalParams extends OperationOptions {} diff --git a/sdk/compute/arm-compute-disk/src/api/index.ts b/sdk/compute/arm-compute-disk/src/api/index.ts new file mode 100644 index 000000000000..1bfbd7345fe9 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + createComputeDisk, + ComputeDiskContext, + ComputeDiskClientOptionalParams, +} from "./computeDiskContext.js"; diff --git a/sdk/compute/arm-compute-disk/src/api/snapshots/index.ts b/sdk/compute/arm-compute-disk/src/api/snapshots/index.ts new file mode 100644 index 000000000000..58084352bb5a --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/snapshots/index.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + revokeAccess, + grantAccess, + list, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "./operations.js"; +export { + SnapshotsRevokeAccessOptionalParams, + SnapshotsGrantAccessOptionalParams, + SnapshotsListOptionalParams, + SnapshotsListByResourceGroupOptionalParams, + SnapshotsDeleteOptionalParams, + SnapshotsUpdateOptionalParams, + SnapshotsCreateOrUpdateOptionalParams, + SnapshotsGetOptionalParams, +} from "./options.js"; diff --git a/sdk/compute/arm-compute-disk/src/api/snapshots/operations.ts b/sdk/compute/arm-compute-disk/src/api/snapshots/operations.ts new file mode 100644 index 000000000000..5b9b933aa831 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/snapshots/operations.ts @@ -0,0 +1,544 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeDiskContext as Client } from "../index.js"; +import { + cloudErrorDeserializer, + GrantAccessData, + grantAccessDataSerializer, + AccessUri, + accessUriDeserializer, + Snapshot, + snapshotSerializer, + snapshotDeserializer, + SnapshotUpdate, + snapshotUpdateSerializer, + _SnapshotList, + _snapshotListDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { expandUrlTemplate } from "../../static-helpers/urlTemplate.js"; +import { + SnapshotsRevokeAccessOptionalParams, + SnapshotsGrantAccessOptionalParams, + SnapshotsListOptionalParams, + SnapshotsListByResourceGroupOptionalParams, + SnapshotsDeleteOptionalParams, + SnapshotsUpdateOptionalParams, + SnapshotsCreateOrUpdateOptionalParams, + SnapshotsGetOptionalParams, +} from "./options.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _revokeAccessSend( + context: Client, + resourceGroupName: string, + snapshotName: string, + options: SnapshotsRevokeAccessOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + snapshotName: snapshotName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _revokeAccessDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return; +} + +/** Revokes access to a snapshot. */ +export function revokeAccess( + context: Client, + resourceGroupName: string, + snapshotName: string, + options: SnapshotsRevokeAccessOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _revokeAccessDeserialize, + ["202", "200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _revokeAccessSend(context, resourceGroupName, snapshotName, options), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _grantAccessSend( + context: Client, + resourceGroupName: string, + snapshotName: string, + grantAccessData: GrantAccessData, + options: SnapshotsGrantAccessOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + snapshotName: snapshotName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .post({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: grantAccessDataSerializer(grantAccessData), + }); +} + +export async function _grantAccessDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return accessUriDeserializer(result.body); +} + +/** Grants access to a snapshot. */ +export function grantAccess( + context: Client, + resourceGroupName: string, + snapshotName: string, + grantAccessData: GrantAccessData, + options: SnapshotsGrantAccessOptionalParams = { requestOptions: {} }, +): PollerLike, AccessUri> { + return getLongRunningPoller( + context, + _grantAccessDeserialize, + ["202", "200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _grantAccessSend( + context, + resourceGroupName, + snapshotName, + grantAccessData, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, AccessUri>; +} + +export function _listSend( + context: Client, + options: SnapshotsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + "api%2Dversion": context.apiVersion, + }, + { + 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<_SnapshotList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return _snapshotListDeserializer(result.body); +} + +/** Lists snapshots under a subscription. */ +export function list( + context: Client, + options: SnapshotsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listSend(context, options), + _listDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _listByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: SnapshotsListByResourceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + "api%2Dversion": context.apiVersion, + }, + { + 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<_SnapshotList> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return _snapshotListDeserializer(result.body); +} + +/** Lists snapshots under a resource group. */ +export function listByResourceGroup( + context: Client, + resourceGroupName: string, + options: SnapshotsListByResourceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _listByResourceGroupSend(context, resourceGroupName, options), + _listByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _$deleteSend( + context: Client, + resourceGroupName: string, + snapshotName: string, + options: SnapshotsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + snapshotName: snapshotName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _$deleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "204", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return; +} + +/** Deletes a snapshot. */ +/** + * @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, + snapshotName: string, + options: SnapshotsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _$deleteDeserialize, + ["200", "202", "204", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _$deleteSend(context, resourceGroupName, snapshotName, options), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _updateSend( + context: Client, + resourceGroupName: string, + snapshotName: string, + snapshot: SnapshotUpdate, + options: SnapshotsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + snapshotName: snapshotName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: snapshotUpdateSerializer(snapshot), + }); +} + +export async function _updateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return snapshotDeserializer(result.body); +} + +/** Updates (patches) a snapshot. */ +export function update( + context: Client, + resourceGroupName: string, + snapshotName: string, + snapshot: SnapshotUpdate, + options: SnapshotsUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Snapshot> { + return getLongRunningPoller( + context, + _updateDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _updateSend( + context, + resourceGroupName, + snapshotName, + snapshot, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, Snapshot>; +} + +export function _createOrUpdateSend( + context: Client, + resourceGroupName: string, + snapshotName: string, + snapshot: Snapshot, + options: SnapshotsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + snapshotName: snapshotName, + "api%2Dversion": context.apiVersion, + }, + { + allowReserved: options?.requestOptions?.skipUrlEncoding, + }, + ); + return context + .path(path) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + body: snapshotSerializer(snapshot), + }); +} + +export async function _createOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "202", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = cloudErrorDeserializer(result.body); + throw error; + } + + return snapshotDeserializer(result.body); +} + +/** Creates or updates a snapshot. */ +export function createOrUpdate( + context: Client, + resourceGroupName: string, + snapshotName: string, + snapshot: Snapshot, + options: SnapshotsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Snapshot> { + return getLongRunningPoller( + context, + _createOrUpdateDeserialize, + ["200", "202", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _createOrUpdateSend( + context, + resourceGroupName, + snapshotName, + snapshot, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, Snapshot>; +} + +export function _getSend( + context: Client, + resourceGroupName: string, + snapshotName: string, + options: SnapshotsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + const path = expandUrlTemplate( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}{?api%2Dversion}", + { + subscriptionId: context.subscriptionId, + resourceGroupName: resourceGroupName, + snapshotName: snapshotName, + "api%2Dversion": context.apiVersion, + }, + { + 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 = cloudErrorDeserializer(result.body); + throw error; + } + + return snapshotDeserializer(result.body); +} + +/** Gets information about a snapshot. */ +export async function get( + context: Client, + resourceGroupName: string, + snapshotName: string, + options: SnapshotsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _getSend( + context, + resourceGroupName, + snapshotName, + options, + ); + return _getDeserialize(result); +} diff --git a/sdk/compute/arm-compute-disk/src/api/snapshots/options.ts b/sdk/compute/arm-compute-disk/src/api/snapshots/options.ts new file mode 100644 index 000000000000..65bdd54ab27e --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/api/snapshots/options.ts @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface SnapshotsRevokeAccessOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface SnapshotsGrantAccessOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface SnapshotsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface SnapshotsListByResourceGroupOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface SnapshotsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface SnapshotsUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface SnapshotsCreateOrUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface SnapshotsGetOptionalParams extends OperationOptions {} diff --git a/sdk/compute/arm-compute-disk/src/classic/diskAccesses/index.ts b/sdk/compute/arm-compute-disk/src/classic/diskAccesses/index.ts new file mode 100644 index 000000000000..26ab8edd5708 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/classic/diskAccesses/index.ts @@ -0,0 +1,454 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeDiskContext } from "../../api/computeDiskContext.js"; +import { + listPrivateEndpointConnections, + deleteAPrivateEndpointConnection, + updateAPrivateEndpointConnection, + getAPrivateEndpointConnection, + getPrivateLinkResources, + list, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "../../api/diskAccesses/operations.js"; +import { + DiskAccessesListPrivateEndpointConnectionsOptionalParams, + DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams, + DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams, + DiskAccessesGetAPrivateEndpointConnectionOptionalParams, + DiskAccessesGetPrivateLinkResourcesOptionalParams, + DiskAccessesListOptionalParams, + DiskAccessesListByResourceGroupOptionalParams, + DiskAccessesDeleteOptionalParams, + DiskAccessesUpdateOptionalParams, + DiskAccessesCreateOrUpdateOptionalParams, + DiskAccessesGetOptionalParams, +} from "../../api/diskAccesses/options.js"; +import { + DiskAccess, + PrivateEndpointConnection, + DiskAccessUpdate, + PrivateLinkResourceListResult, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { + SimplePollerLike, + getSimplePoller, +} from "../../static-helpers/simplePollerHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a DiskAccesses operations. */ +export interface DiskAccessesOperations { + /** List information about private endpoint connections under a disk access resource */ + listPrivateEndpointConnections: ( + resourceGroupName: string, + diskAccessName: string, + options?: DiskAccessesListPrivateEndpointConnectionsOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes a private endpoint connection under a disk access resource. */ + deleteAPrivateEndpointConnection: ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + options?: DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams, + ) => PollerLike, void>; + /** @deprecated use deleteAPrivateEndpointConnection instead */ + beginDeleteAPrivateEndpointConnection: ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + options?: DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams, + ) => Promise, void>>; + /** @deprecated use deleteAPrivateEndpointConnection instead */ + beginDeleteAPrivateEndpointConnectionAndWait: ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + options?: DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams, + ) => Promise; + /** Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private endpoint connection. */ + updateAPrivateEndpointConnection: ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams, + ) => PollerLike< + OperationState, + PrivateEndpointConnection + >; + /** @deprecated use updateAPrivateEndpointConnection instead */ + beginUpdateAPrivateEndpointConnection: ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams, + ) => Promise< + SimplePollerLike< + OperationState, + PrivateEndpointConnection + > + >; + /** @deprecated use updateAPrivateEndpointConnection instead */ + beginUpdateAPrivateEndpointConnectionAndWait: ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams, + ) => Promise; + /** Gets information about a private endpoint connection under a disk access resource. */ + getAPrivateEndpointConnection: ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + options?: DiskAccessesGetAPrivateEndpointConnectionOptionalParams, + ) => Promise; + /** Gets the private link resources possible under disk access resource */ + getPrivateLinkResources: ( + resourceGroupName: string, + diskAccessName: string, + options?: DiskAccessesGetPrivateLinkResourcesOptionalParams, + ) => Promise; + /** Lists all the disk access resources under a subscription. */ + list: ( + options?: DiskAccessesListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists all the disk access resources under a resource group. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: DiskAccessesListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes a disk access resource. */ + /** + * @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, + diskAccessName: string, + options?: DiskAccessesDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + diskAccessName: string, + options?: DiskAccessesDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + diskAccessName: string, + options?: DiskAccessesDeleteOptionalParams, + ) => Promise; + /** Updates (patches) a disk access resource. */ + update: ( + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccessUpdate, + options?: DiskAccessesUpdateOptionalParams, + ) => PollerLike, DiskAccess>; + /** @deprecated use update instead */ + beginUpdate: ( + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccessUpdate, + options?: DiskAccessesUpdateOptionalParams, + ) => Promise, DiskAccess>>; + /** @deprecated use update instead */ + beginUpdateAndWait: ( + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccessUpdate, + options?: DiskAccessesUpdateOptionalParams, + ) => Promise; + /** Creates or updates a disk access resource */ + createOrUpdate: ( + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccess, + options?: DiskAccessesCreateOrUpdateOptionalParams, + ) => PollerLike, DiskAccess>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdate: ( + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccess, + options?: DiskAccessesCreateOrUpdateOptionalParams, + ) => Promise, DiskAccess>>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdateAndWait: ( + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccess, + options?: DiskAccessesCreateOrUpdateOptionalParams, + ) => Promise; + /** Gets information about a disk access resource. */ + get: ( + resourceGroupName: string, + diskAccessName: string, + options?: DiskAccessesGetOptionalParams, + ) => Promise; +} + +function _getDiskAccesses(context: ComputeDiskContext) { + return { + listPrivateEndpointConnections: ( + resourceGroupName: string, + diskAccessName: string, + options?: DiskAccessesListPrivateEndpointConnectionsOptionalParams, + ) => + listPrivateEndpointConnections( + context, + resourceGroupName, + diskAccessName, + options, + ), + deleteAPrivateEndpointConnection: ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + options?: DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams, + ) => + deleteAPrivateEndpointConnection( + context, + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + options, + ), + beginDeleteAPrivateEndpointConnection: async ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + options?: DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams, + ) => { + const poller = deleteAPrivateEndpointConnection( + context, + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAPrivateEndpointConnectionAndWait: async ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + options?: DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams, + ) => { + return await deleteAPrivateEndpointConnection( + context, + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + options, + ); + }, + updateAPrivateEndpointConnection: ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams, + ) => + updateAPrivateEndpointConnection( + context, + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + privateEndpointConnection, + options, + ), + beginUpdateAPrivateEndpointConnection: async ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams, + ) => { + const poller = updateAPrivateEndpointConnection( + context, + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + privateEndpointConnection, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginUpdateAPrivateEndpointConnectionAndWait: async ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + privateEndpointConnection: PrivateEndpointConnection, + options?: DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams, + ) => { + return await updateAPrivateEndpointConnection( + context, + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + privateEndpointConnection, + options, + ); + }, + getAPrivateEndpointConnection: ( + resourceGroupName: string, + diskAccessName: string, + privateEndpointConnectionName: string, + options?: DiskAccessesGetAPrivateEndpointConnectionOptionalParams, + ) => + getAPrivateEndpointConnection( + context, + resourceGroupName, + diskAccessName, + privateEndpointConnectionName, + options, + ), + getPrivateLinkResources: ( + resourceGroupName: string, + diskAccessName: string, + options?: DiskAccessesGetPrivateLinkResourcesOptionalParams, + ) => + getPrivateLinkResources( + context, + resourceGroupName, + diskAccessName, + options, + ), + list: (options?: DiskAccessesListOptionalParams) => list(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: DiskAccessesListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + diskAccessName: string, + options?: DiskAccessesDeleteOptionalParams, + ) => $delete(context, resourceGroupName, diskAccessName, options), + beginDelete: async ( + resourceGroupName: string, + diskAccessName: string, + options?: DiskAccessesDeleteOptionalParams, + ) => { + const poller = $delete( + context, + resourceGroupName, + diskAccessName, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + diskAccessName: string, + options?: DiskAccessesDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, diskAccessName, options); + }, + update: ( + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccessUpdate, + options?: DiskAccessesUpdateOptionalParams, + ) => + update(context, resourceGroupName, diskAccessName, diskAccess, options), + beginUpdate: async ( + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccessUpdate, + options?: DiskAccessesUpdateOptionalParams, + ) => { + const poller = update( + context, + resourceGroupName, + diskAccessName, + diskAccess, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginUpdateAndWait: async ( + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccessUpdate, + options?: DiskAccessesUpdateOptionalParams, + ) => { + return await update( + context, + resourceGroupName, + diskAccessName, + diskAccess, + options, + ); + }, + createOrUpdate: ( + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccess, + options?: DiskAccessesCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + diskAccessName, + diskAccess, + options, + ), + beginCreateOrUpdate: async ( + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccess, + options?: DiskAccessesCreateOrUpdateOptionalParams, + ) => { + const poller = createOrUpdate( + context, + resourceGroupName, + diskAccessName, + diskAccess, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateOrUpdateAndWait: async ( + resourceGroupName: string, + diskAccessName: string, + diskAccess: DiskAccess, + options?: DiskAccessesCreateOrUpdateOptionalParams, + ) => { + return await createOrUpdate( + context, + resourceGroupName, + diskAccessName, + diskAccess, + options, + ); + }, + get: ( + resourceGroupName: string, + diskAccessName: string, + options?: DiskAccessesGetOptionalParams, + ) => get(context, resourceGroupName, diskAccessName, options), + }; +} + +export function _getDiskAccessesOperations( + context: ComputeDiskContext, +): DiskAccessesOperations { + return { + ..._getDiskAccesses(context), + }; +} diff --git a/sdk/compute/arm-compute-disk/src/classic/diskEncryptionSets/index.ts b/sdk/compute/arm-compute-disk/src/classic/diskEncryptionSets/index.ts new file mode 100644 index 000000000000..c82c177c5bed --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/classic/diskEncryptionSets/index.ts @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeDiskContext } from "../../api/computeDiskContext.js"; +import { + listAssociatedResources, + list, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "../../api/diskEncryptionSets/operations.js"; +import { + DiskEncryptionSetsListAssociatedResourcesOptionalParams, + DiskEncryptionSetsListOptionalParams, + DiskEncryptionSetsListByResourceGroupOptionalParams, + DiskEncryptionSetsDeleteOptionalParams, + DiskEncryptionSetsUpdateOptionalParams, + DiskEncryptionSetsCreateOrUpdateOptionalParams, + DiskEncryptionSetsGetOptionalParams, +} from "../../api/diskEncryptionSets/options.js"; +import { + DiskEncryptionSet, + DiskEncryptionSetUpdate, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { + SimplePollerLike, + getSimplePoller, +} from "../../static-helpers/simplePollerHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a DiskEncryptionSets operations. */ +export interface DiskEncryptionSetsOperations { + /** Lists all resources that are encrypted with this disk encryption set. */ + listAssociatedResources: ( + resourceGroupName: string, + diskEncryptionSetName: string, + options?: DiskEncryptionSetsListAssociatedResourcesOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists all the disk encryption sets under a subscription. */ + list: ( + options?: DiskEncryptionSetsListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists all the disk encryption sets under a resource group. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: DiskEncryptionSetsListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes a disk encryption set. */ + /** + * @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, + diskEncryptionSetName: string, + options?: DiskEncryptionSetsDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + diskEncryptionSetName: string, + options?: DiskEncryptionSetsDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + diskEncryptionSetName: string, + options?: DiskEncryptionSetsDeleteOptionalParams, + ) => Promise; + /** Updates (patches) a disk encryption set. */ + update: ( + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSetUpdate, + options?: DiskEncryptionSetsUpdateOptionalParams, + ) => PollerLike, DiskEncryptionSet>; + /** @deprecated use update instead */ + beginUpdate: ( + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSetUpdate, + options?: DiskEncryptionSetsUpdateOptionalParams, + ) => Promise< + SimplePollerLike, DiskEncryptionSet> + >; + /** @deprecated use update instead */ + beginUpdateAndWait: ( + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSetUpdate, + options?: DiskEncryptionSetsUpdateOptionalParams, + ) => Promise; + /** Creates or updates a disk encryption set */ + createOrUpdate: ( + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSet, + options?: DiskEncryptionSetsCreateOrUpdateOptionalParams, + ) => PollerLike, DiskEncryptionSet>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdate: ( + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSet, + options?: DiskEncryptionSetsCreateOrUpdateOptionalParams, + ) => Promise< + SimplePollerLike, DiskEncryptionSet> + >; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdateAndWait: ( + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSet, + options?: DiskEncryptionSetsCreateOrUpdateOptionalParams, + ) => Promise; + /** Gets information about a disk encryption set. */ + get: ( + resourceGroupName: string, + diskEncryptionSetName: string, + options?: DiskEncryptionSetsGetOptionalParams, + ) => Promise; +} + +function _getDiskEncryptionSets(context: ComputeDiskContext) { + return { + listAssociatedResources: ( + resourceGroupName: string, + diskEncryptionSetName: string, + options?: DiskEncryptionSetsListAssociatedResourcesOptionalParams, + ) => + listAssociatedResources( + context, + resourceGroupName, + diskEncryptionSetName, + options, + ), + list: (options?: DiskEncryptionSetsListOptionalParams) => + list(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: DiskEncryptionSetsListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + diskEncryptionSetName: string, + options?: DiskEncryptionSetsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, diskEncryptionSetName, options), + beginDelete: async ( + resourceGroupName: string, + diskEncryptionSetName: string, + options?: DiskEncryptionSetsDeleteOptionalParams, + ) => { + const poller = $delete( + context, + resourceGroupName, + diskEncryptionSetName, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + diskEncryptionSetName: string, + options?: DiskEncryptionSetsDeleteOptionalParams, + ) => { + return await $delete( + context, + resourceGroupName, + diskEncryptionSetName, + options, + ); + }, + update: ( + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSetUpdate, + options?: DiskEncryptionSetsUpdateOptionalParams, + ) => + update( + context, + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet, + options, + ), + beginUpdate: async ( + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSetUpdate, + options?: DiskEncryptionSetsUpdateOptionalParams, + ) => { + const poller = update( + context, + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginUpdateAndWait: async ( + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSetUpdate, + options?: DiskEncryptionSetsUpdateOptionalParams, + ) => { + return await update( + context, + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet, + options, + ); + }, + createOrUpdate: ( + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSet, + options?: DiskEncryptionSetsCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet, + options, + ), + beginCreateOrUpdate: async ( + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSet, + options?: DiskEncryptionSetsCreateOrUpdateOptionalParams, + ) => { + const poller = createOrUpdate( + context, + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateOrUpdateAndWait: async ( + resourceGroupName: string, + diskEncryptionSetName: string, + diskEncryptionSet: DiskEncryptionSet, + options?: DiskEncryptionSetsCreateOrUpdateOptionalParams, + ) => { + return await createOrUpdate( + context, + resourceGroupName, + diskEncryptionSetName, + diskEncryptionSet, + options, + ); + }, + get: ( + resourceGroupName: string, + diskEncryptionSetName: string, + options?: DiskEncryptionSetsGetOptionalParams, + ) => get(context, resourceGroupName, diskEncryptionSetName, options), + }; +} + +export function _getDiskEncryptionSetsOperations( + context: ComputeDiskContext, +): DiskEncryptionSetsOperations { + return { + ..._getDiskEncryptionSets(context), + }; +} diff --git a/sdk/compute/arm-compute-disk/src/classic/diskRestorePoint/index.ts b/sdk/compute/arm-compute-disk/src/classic/diskRestorePoint/index.ts new file mode 100644 index 000000000000..ea1a15a46982 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/classic/diskRestorePoint/index.ts @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeDiskContext } from "../../api/computeDiskContext.js"; +import { + revokeAccess, + grantAccess, + listByRestorePoint, + get, +} from "../../api/diskRestorePoint/operations.js"; +import { + DiskRestorePointRevokeAccessOptionalParams, + DiskRestorePointGrantAccessOptionalParams, + DiskRestorePointListByRestorePointOptionalParams, + DiskRestorePointGetOptionalParams, +} from "../../api/diskRestorePoint/options.js"; +import { + GrantAccessData, + AccessUri, + DiskRestorePoint, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { + SimplePollerLike, + getSimplePoller, +} from "../../static-helpers/simplePollerHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a DiskRestorePoint operations. */ +export interface DiskRestorePointOperations { + /** Revokes access to a diskRestorePoint. */ + revokeAccess: ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + options?: DiskRestorePointRevokeAccessOptionalParams, + ) => PollerLike, void>; + /** @deprecated use revokeAccess instead */ + beginRevokeAccess: ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + options?: DiskRestorePointRevokeAccessOptionalParams, + ) => Promise, void>>; + /** @deprecated use revokeAccess instead */ + beginRevokeAccessAndWait: ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + options?: DiskRestorePointRevokeAccessOptionalParams, + ) => Promise; + /** Grants access to a diskRestorePoint. */ + grantAccess: ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + grantAccessData: GrantAccessData, + options?: DiskRestorePointGrantAccessOptionalParams, + ) => PollerLike, AccessUri>; + /** @deprecated use grantAccess instead */ + beginGrantAccess: ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + grantAccessData: GrantAccessData, + options?: DiskRestorePointGrantAccessOptionalParams, + ) => Promise, AccessUri>>; + /** @deprecated use grantAccess instead */ + beginGrantAccessAndWait: ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + grantAccessData: GrantAccessData, + options?: DiskRestorePointGrantAccessOptionalParams, + ) => Promise; + /** Lists diskRestorePoints under a vmRestorePoint. */ + listByRestorePoint: ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + options?: DiskRestorePointListByRestorePointOptionalParams, + ) => PagedAsyncIterableIterator; + /** Get disk restorePoint resource */ + get: ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + options?: DiskRestorePointGetOptionalParams, + ) => Promise; +} + +function _getDiskRestorePoint(context: ComputeDiskContext) { + return { + revokeAccess: ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + options?: DiskRestorePointRevokeAccessOptionalParams, + ) => + revokeAccess( + context, + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + options, + ), + beginRevokeAccess: async ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + options?: DiskRestorePointRevokeAccessOptionalParams, + ) => { + const poller = revokeAccess( + context, + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginRevokeAccessAndWait: async ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + options?: DiskRestorePointRevokeAccessOptionalParams, + ) => { + return await revokeAccess( + context, + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + options, + ); + }, + grantAccess: ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + grantAccessData: GrantAccessData, + options?: DiskRestorePointGrantAccessOptionalParams, + ) => + grantAccess( + context, + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData, + options, + ), + beginGrantAccess: async ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + grantAccessData: GrantAccessData, + options?: DiskRestorePointGrantAccessOptionalParams, + ) => { + const poller = grantAccess( + context, + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginGrantAccessAndWait: async ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + grantAccessData: GrantAccessData, + options?: DiskRestorePointGrantAccessOptionalParams, + ) => { + return await grantAccess( + context, + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + grantAccessData, + options, + ); + }, + listByRestorePoint: ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + options?: DiskRestorePointListByRestorePointOptionalParams, + ) => + listByRestorePoint( + context, + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + options, + ), + get: ( + resourceGroupName: string, + restorePointCollectionName: string, + vmRestorePointName: string, + diskRestorePointName: string, + options?: DiskRestorePointGetOptionalParams, + ) => + get( + context, + resourceGroupName, + restorePointCollectionName, + vmRestorePointName, + diskRestorePointName, + options, + ), + }; +} + +export function _getDiskRestorePointOperations( + context: ComputeDiskContext, +): DiskRestorePointOperations { + return { + ..._getDiskRestorePoint(context), + }; +} diff --git a/sdk/compute/arm-compute-disk/src/classic/disks/index.ts b/sdk/compute/arm-compute-disk/src/classic/disks/index.ts new file mode 100644 index 000000000000..fd0178ee2401 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/classic/disks/index.ts @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeDiskContext } from "../../api/computeDiskContext.js"; +import { + revokeAccess, + grantAccess, + list, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "../../api/disks/operations.js"; +import { + DisksRevokeAccessOptionalParams, + DisksGrantAccessOptionalParams, + DisksListOptionalParams, + DisksListByResourceGroupOptionalParams, + DisksDeleteOptionalParams, + DisksUpdateOptionalParams, + DisksCreateOrUpdateOptionalParams, + DisksGetOptionalParams, +} from "../../api/disks/options.js"; +import { + Disk, + DiskUpdate, + GrantAccessData, + AccessUri, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { + SimplePollerLike, + getSimplePoller, +} from "../../static-helpers/simplePollerHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Disks operations. */ +export interface DisksOperations { + /** Revokes access to a disk. */ + revokeAccess: ( + resourceGroupName: string, + diskName: string, + options?: DisksRevokeAccessOptionalParams, + ) => PollerLike, void>; + /** @deprecated use revokeAccess instead */ + beginRevokeAccess: ( + resourceGroupName: string, + diskName: string, + options?: DisksRevokeAccessOptionalParams, + ) => Promise, void>>; + /** @deprecated use revokeAccess instead */ + beginRevokeAccessAndWait: ( + resourceGroupName: string, + diskName: string, + options?: DisksRevokeAccessOptionalParams, + ) => Promise; + /** Grants access to a disk. */ + grantAccess: ( + resourceGroupName: string, + diskName: string, + grantAccessData: GrantAccessData, + options?: DisksGrantAccessOptionalParams, + ) => PollerLike, AccessUri>; + /** @deprecated use grantAccess instead */ + beginGrantAccess: ( + resourceGroupName: string, + diskName: string, + grantAccessData: GrantAccessData, + options?: DisksGrantAccessOptionalParams, + ) => Promise, AccessUri>>; + /** @deprecated use grantAccess instead */ + beginGrantAccessAndWait: ( + resourceGroupName: string, + diskName: string, + grantAccessData: GrantAccessData, + options?: DisksGrantAccessOptionalParams, + ) => Promise; + /** Lists all the disks under a subscription. */ + list: (options?: DisksListOptionalParams) => PagedAsyncIterableIterator; + /** Lists all the disks under a resource group. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: DisksListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes a disk. */ + /** + * @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, + diskName: string, + options?: DisksDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + diskName: string, + options?: DisksDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + diskName: string, + options?: DisksDeleteOptionalParams, + ) => Promise; + /** Updates (patches) a disk. */ + update: ( + resourceGroupName: string, + diskName: string, + disk: DiskUpdate, + options?: DisksUpdateOptionalParams, + ) => PollerLike, Disk>; + /** @deprecated use update instead */ + beginUpdate: ( + resourceGroupName: string, + diskName: string, + disk: DiskUpdate, + options?: DisksUpdateOptionalParams, + ) => Promise, Disk>>; + /** @deprecated use update instead */ + beginUpdateAndWait: ( + resourceGroupName: string, + diskName: string, + disk: DiskUpdate, + options?: DisksUpdateOptionalParams, + ) => Promise; + /** Creates or updates a disk. */ + createOrUpdate: ( + resourceGroupName: string, + diskName: string, + disk: Disk, + options?: DisksCreateOrUpdateOptionalParams, + ) => PollerLike, Disk>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdate: ( + resourceGroupName: string, + diskName: string, + disk: Disk, + options?: DisksCreateOrUpdateOptionalParams, + ) => Promise, Disk>>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdateAndWait: ( + resourceGroupName: string, + diskName: string, + disk: Disk, + options?: DisksCreateOrUpdateOptionalParams, + ) => Promise; + /** Gets information about a disk. */ + get: ( + resourceGroupName: string, + diskName: string, + options?: DisksGetOptionalParams, + ) => Promise; +} + +function _getDisks(context: ComputeDiskContext) { + return { + revokeAccess: ( + resourceGroupName: string, + diskName: string, + options?: DisksRevokeAccessOptionalParams, + ) => revokeAccess(context, resourceGroupName, diskName, options), + beginRevokeAccess: async ( + resourceGroupName: string, + diskName: string, + options?: DisksRevokeAccessOptionalParams, + ) => { + const poller = revokeAccess( + context, + resourceGroupName, + diskName, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginRevokeAccessAndWait: async ( + resourceGroupName: string, + diskName: string, + options?: DisksRevokeAccessOptionalParams, + ) => { + return await revokeAccess(context, resourceGroupName, diskName, options); + }, + grantAccess: ( + resourceGroupName: string, + diskName: string, + grantAccessData: GrantAccessData, + options?: DisksGrantAccessOptionalParams, + ) => + grantAccess( + context, + resourceGroupName, + diskName, + grantAccessData, + options, + ), + beginGrantAccess: async ( + resourceGroupName: string, + diskName: string, + grantAccessData: GrantAccessData, + options?: DisksGrantAccessOptionalParams, + ) => { + const poller = grantAccess( + context, + resourceGroupName, + diskName, + grantAccessData, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginGrantAccessAndWait: async ( + resourceGroupName: string, + diskName: string, + grantAccessData: GrantAccessData, + options?: DisksGrantAccessOptionalParams, + ) => { + return await grantAccess( + context, + resourceGroupName, + diskName, + grantAccessData, + options, + ); + }, + list: (options?: DisksListOptionalParams) => list(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: DisksListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + diskName: string, + options?: DisksDeleteOptionalParams, + ) => $delete(context, resourceGroupName, diskName, options), + beginDelete: async ( + resourceGroupName: string, + diskName: string, + options?: DisksDeleteOptionalParams, + ) => { + const poller = $delete(context, resourceGroupName, diskName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + diskName: string, + options?: DisksDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, diskName, options); + }, + update: ( + resourceGroupName: string, + diskName: string, + disk: DiskUpdate, + options?: DisksUpdateOptionalParams, + ) => update(context, resourceGroupName, diskName, disk, options), + beginUpdate: async ( + resourceGroupName: string, + diskName: string, + disk: DiskUpdate, + options?: DisksUpdateOptionalParams, + ) => { + const poller = update( + context, + resourceGroupName, + diskName, + disk, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginUpdateAndWait: async ( + resourceGroupName: string, + diskName: string, + disk: DiskUpdate, + options?: DisksUpdateOptionalParams, + ) => { + return await update(context, resourceGroupName, diskName, disk, options); + }, + createOrUpdate: ( + resourceGroupName: string, + diskName: string, + disk: Disk, + options?: DisksCreateOrUpdateOptionalParams, + ) => createOrUpdate(context, resourceGroupName, diskName, disk, options), + beginCreateOrUpdate: async ( + resourceGroupName: string, + diskName: string, + disk: Disk, + options?: DisksCreateOrUpdateOptionalParams, + ) => { + const poller = createOrUpdate( + context, + resourceGroupName, + diskName, + disk, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateOrUpdateAndWait: async ( + resourceGroupName: string, + diskName: string, + disk: Disk, + options?: DisksCreateOrUpdateOptionalParams, + ) => { + return await createOrUpdate( + context, + resourceGroupName, + diskName, + disk, + options, + ); + }, + get: ( + resourceGroupName: string, + diskName: string, + options?: DisksGetOptionalParams, + ) => get(context, resourceGroupName, diskName, options), + }; +} + +export function _getDisksOperations( + context: ComputeDiskContext, +): DisksOperations { + return { + ..._getDisks(context), + }; +} diff --git a/sdk/compute/arm-compute-disk/src/classic/index.ts b/sdk/compute/arm-compute-disk/src/classic/index.ts new file mode 100644 index 000000000000..974de884a91d --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/classic/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { DiskAccessesOperations } from "./diskAccesses/index.js"; +export { DiskEncryptionSetsOperations } from "./diskEncryptionSets/index.js"; +export { DiskRestorePointOperations } from "./diskRestorePoint/index.js"; +export { DisksOperations } from "./disks/index.js"; +export { SnapshotsOperations } from "./snapshots/index.js"; diff --git a/sdk/compute/arm-compute-disk/src/classic/snapshots/index.ts b/sdk/compute/arm-compute-disk/src/classic/snapshots/index.ts new file mode 100644 index 000000000000..a35b417bcbba --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/classic/snapshots/index.ts @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeDiskContext } from "../../api/computeDiskContext.js"; +import { + revokeAccess, + grantAccess, + list, + listByResourceGroup, + $delete, + update, + createOrUpdate, + get, +} from "../../api/snapshots/operations.js"; +import { + SnapshotsRevokeAccessOptionalParams, + SnapshotsGrantAccessOptionalParams, + SnapshotsListOptionalParams, + SnapshotsListByResourceGroupOptionalParams, + SnapshotsDeleteOptionalParams, + SnapshotsUpdateOptionalParams, + SnapshotsCreateOrUpdateOptionalParams, + SnapshotsGetOptionalParams, +} from "../../api/snapshots/options.js"; +import { + GrantAccessData, + AccessUri, + Snapshot, + SnapshotUpdate, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { + SimplePollerLike, + getSimplePoller, +} from "../../static-helpers/simplePollerHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a Snapshots operations. */ +export interface SnapshotsOperations { + /** Revokes access to a snapshot. */ + revokeAccess: ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsRevokeAccessOptionalParams, + ) => PollerLike, void>; + /** @deprecated use revokeAccess instead */ + beginRevokeAccess: ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsRevokeAccessOptionalParams, + ) => Promise, void>>; + /** @deprecated use revokeAccess instead */ + beginRevokeAccessAndWait: ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsRevokeAccessOptionalParams, + ) => Promise; + /** Grants access to a snapshot. */ + grantAccess: ( + resourceGroupName: string, + snapshotName: string, + grantAccessData: GrantAccessData, + options?: SnapshotsGrantAccessOptionalParams, + ) => PollerLike, AccessUri>; + /** @deprecated use grantAccess instead */ + beginGrantAccess: ( + resourceGroupName: string, + snapshotName: string, + grantAccessData: GrantAccessData, + options?: SnapshotsGrantAccessOptionalParams, + ) => Promise, AccessUri>>; + /** @deprecated use grantAccess instead */ + beginGrantAccessAndWait: ( + resourceGroupName: string, + snapshotName: string, + grantAccessData: GrantAccessData, + options?: SnapshotsGrantAccessOptionalParams, + ) => Promise; + /** Lists snapshots under a subscription. */ + list: ( + options?: SnapshotsListOptionalParams, + ) => PagedAsyncIterableIterator; + /** Lists snapshots under a resource group. */ + listByResourceGroup: ( + resourceGroupName: string, + options?: SnapshotsListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Deletes a snapshot. */ + /** + * @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, + snapshotName: string, + options?: SnapshotsDeleteOptionalParams, + ) => PollerLike, void>; + /** @deprecated use delete instead */ + beginDelete: ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsDeleteOptionalParams, + ) => Promise, void>>; + /** @deprecated use delete instead */ + beginDeleteAndWait: ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsDeleteOptionalParams, + ) => Promise; + /** Updates (patches) a snapshot. */ + update: ( + resourceGroupName: string, + snapshotName: string, + snapshot: SnapshotUpdate, + options?: SnapshotsUpdateOptionalParams, + ) => PollerLike, Snapshot>; + /** @deprecated use update instead */ + beginUpdate: ( + resourceGroupName: string, + snapshotName: string, + snapshot: SnapshotUpdate, + options?: SnapshotsUpdateOptionalParams, + ) => Promise, Snapshot>>; + /** @deprecated use update instead */ + beginUpdateAndWait: ( + resourceGroupName: string, + snapshotName: string, + snapshot: SnapshotUpdate, + options?: SnapshotsUpdateOptionalParams, + ) => Promise; + /** Creates or updates a snapshot. */ + createOrUpdate: ( + resourceGroupName: string, + snapshotName: string, + snapshot: Snapshot, + options?: SnapshotsCreateOrUpdateOptionalParams, + ) => PollerLike, Snapshot>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdate: ( + resourceGroupName: string, + snapshotName: string, + snapshot: Snapshot, + options?: SnapshotsCreateOrUpdateOptionalParams, + ) => Promise, Snapshot>>; + /** @deprecated use createOrUpdate instead */ + beginCreateOrUpdateAndWait: ( + resourceGroupName: string, + snapshotName: string, + snapshot: Snapshot, + options?: SnapshotsCreateOrUpdateOptionalParams, + ) => Promise; + /** Gets information about a snapshot. */ + get: ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsGetOptionalParams, + ) => Promise; +} + +function _getSnapshots(context: ComputeDiskContext) { + return { + revokeAccess: ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsRevokeAccessOptionalParams, + ) => revokeAccess(context, resourceGroupName, snapshotName, options), + beginRevokeAccess: async ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsRevokeAccessOptionalParams, + ) => { + const poller = revokeAccess( + context, + resourceGroupName, + snapshotName, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginRevokeAccessAndWait: async ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsRevokeAccessOptionalParams, + ) => { + return await revokeAccess( + context, + resourceGroupName, + snapshotName, + options, + ); + }, + grantAccess: ( + resourceGroupName: string, + snapshotName: string, + grantAccessData: GrantAccessData, + options?: SnapshotsGrantAccessOptionalParams, + ) => + grantAccess( + context, + resourceGroupName, + snapshotName, + grantAccessData, + options, + ), + beginGrantAccess: async ( + resourceGroupName: string, + snapshotName: string, + grantAccessData: GrantAccessData, + options?: SnapshotsGrantAccessOptionalParams, + ) => { + const poller = grantAccess( + context, + resourceGroupName, + snapshotName, + grantAccessData, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginGrantAccessAndWait: async ( + resourceGroupName: string, + snapshotName: string, + grantAccessData: GrantAccessData, + options?: SnapshotsGrantAccessOptionalParams, + ) => { + return await grantAccess( + context, + resourceGroupName, + snapshotName, + grantAccessData, + options, + ); + }, + list: (options?: SnapshotsListOptionalParams) => list(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: SnapshotsListByResourceGroupOptionalParams, + ) => listByResourceGroup(context, resourceGroupName, options), + delete: ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsDeleteOptionalParams, + ) => $delete(context, resourceGroupName, snapshotName, options), + beginDelete: async ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsDeleteOptionalParams, + ) => { + const poller = $delete(context, resourceGroupName, snapshotName, options); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginDeleteAndWait: async ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsDeleteOptionalParams, + ) => { + return await $delete(context, resourceGroupName, snapshotName, options); + }, + update: ( + resourceGroupName: string, + snapshotName: string, + snapshot: SnapshotUpdate, + options?: SnapshotsUpdateOptionalParams, + ) => update(context, resourceGroupName, snapshotName, snapshot, options), + beginUpdate: async ( + resourceGroupName: string, + snapshotName: string, + snapshot: SnapshotUpdate, + options?: SnapshotsUpdateOptionalParams, + ) => { + const poller = update( + context, + resourceGroupName, + snapshotName, + snapshot, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginUpdateAndWait: async ( + resourceGroupName: string, + snapshotName: string, + snapshot: SnapshotUpdate, + options?: SnapshotsUpdateOptionalParams, + ) => { + return await update( + context, + resourceGroupName, + snapshotName, + snapshot, + options, + ); + }, + createOrUpdate: ( + resourceGroupName: string, + snapshotName: string, + snapshot: Snapshot, + options?: SnapshotsCreateOrUpdateOptionalParams, + ) => + createOrUpdate( + context, + resourceGroupName, + snapshotName, + snapshot, + options, + ), + beginCreateOrUpdate: async ( + resourceGroupName: string, + snapshotName: string, + snapshot: Snapshot, + options?: SnapshotsCreateOrUpdateOptionalParams, + ) => { + const poller = createOrUpdate( + context, + resourceGroupName, + snapshotName, + snapshot, + options, + ); + await poller.submitted(); + return getSimplePoller(poller); + }, + beginCreateOrUpdateAndWait: async ( + resourceGroupName: string, + snapshotName: string, + snapshot: Snapshot, + options?: SnapshotsCreateOrUpdateOptionalParams, + ) => { + return await createOrUpdate( + context, + resourceGroupName, + snapshotName, + snapshot, + options, + ); + }, + get: ( + resourceGroupName: string, + snapshotName: string, + options?: SnapshotsGetOptionalParams, + ) => get(context, resourceGroupName, snapshotName, options), + }; +} + +export function _getSnapshotsOperations( + context: ComputeDiskContext, +): SnapshotsOperations { + return { + ..._getSnapshots(context), + }; +} diff --git a/sdk/compute/arm-compute-disk/src/computeDiskClient.ts b/sdk/compute/arm-compute-disk/src/computeDiskClient.ts new file mode 100644 index 000000000000..751a6e2e10aa --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/computeDiskClient.ts @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + createComputeDisk, + ComputeDiskContext, + ComputeDiskClientOptionalParams, +} from "./api/index.js"; +import { + DiskAccessesOperations, + _getDiskAccessesOperations, +} from "./classic/diskAccesses/index.js"; +import { + DiskEncryptionSetsOperations, + _getDiskEncryptionSetsOperations, +} from "./classic/diskEncryptionSets/index.js"; +import { + DiskRestorePointOperations, + _getDiskRestorePointOperations, +} from "./classic/diskRestorePoint/index.js"; +import { DisksOperations, _getDisksOperations } from "./classic/disks/index.js"; +import { + SnapshotsOperations, + _getSnapshotsOperations, +} from "./classic/snapshots/index.js"; +import { TokenCredential } from "@azure/core-auth"; +import { Pipeline } from "@azure/core-rest-pipeline"; + +export { ComputeDiskClientOptionalParams } from "./api/computeDiskContext.js"; + +export class ComputeDiskClient { + private _client: ComputeDiskContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** Compute Client */ + constructor( + credential: TokenCredential, + subscriptionId: string, + options: ComputeDiskClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createComputeDisk(credential, subscriptionId, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.diskRestorePoint = _getDiskRestorePointOperations(this._client); + this.snapshots = _getSnapshotsOperations(this._client); + this.diskEncryptionSets = _getDiskEncryptionSetsOperations(this._client); + this.diskAccesses = _getDiskAccessesOperations(this._client); + this.disks = _getDisksOperations(this._client); + } + + /** The operation groups for diskRestorePoint */ + public readonly diskRestorePoint: DiskRestorePointOperations; + /** The operation groups for snapshots */ + public readonly snapshots: SnapshotsOperations; + /** The operation groups for diskEncryptionSets */ + public readonly diskEncryptionSets: DiskEncryptionSetsOperations; + /** The operation groups for diskAccesses */ + public readonly diskAccesses: DiskAccessesOperations; + /** The operation groups for disks */ + public readonly disks: DisksOperations; +} diff --git a/sdk/compute/arm-compute-disk/src/index.ts b/sdk/compute/arm-compute-disk/src/index.ts new file mode 100644 index 000000000000..7d1e2a068eb7 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/index.ts @@ -0,0 +1,181 @@ +// 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 { ComputeDiskClient } from "./computeDiskClient.js"; +export { SimplePollerLike } from "./static-helpers/simplePollerHelpers.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + Disk, + // DiskProperties, + OperatingSystemTypes, + KnownHyperVGeneration, + HyperVGeneration, + DiskPurchasePlan, + SupportedCapabilities, + KnownArchitecture, + Architecture, + KnownSupportedSecurityOption, + SupportedSecurityOption, + CreationData, + KnownDiskCreateOption, + DiskCreateOption, + ImageDiskReference, + KnownProvisionedBandwidthCopyOption, + ProvisionedBandwidthCopyOption, + EncryptionSettingsCollection, + EncryptionSettingsElement, + KeyVaultAndSecretReference, + SourceVault, + KeyVaultAndKeyReference, + KnownDiskState, + DiskState, + Encryption, + KnownEncryptionType, + EncryptionType, + ShareInfoElement, + KnownNetworkAccessPolicy, + NetworkAccessPolicy, + PropertyUpdatesInProgress, + DiskSecurityProfile, + KnownDiskSecurityTypes, + DiskSecurityTypes, + KnownPublicNetworkAccess, + PublicNetworkAccess, + KnownDataAccessAuthMode, + DataAccessAuthMode, + AvailabilityPolicy, + KnownAvailabilityPolicyDiskDelay, + AvailabilityPolicyDiskDelay, + DiskSku, + KnownDiskStorageAccountTypes, + DiskStorageAccountTypes, + ExtendedLocation, + KnownExtendedLocationTypes, + ExtendedLocationTypes, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + CloudError, + ApiError, + ApiErrorBase, + InnerError, + DiskUpdate, + // DiskUpdateProperties, + GrantAccessData, + KnownAccessLevel, + AccessLevel, + KnownFileFormat, + FileFormat, + AccessUri, + DiskAccess, + // DiskAccessProperties, + PrivateEndpointConnection, + // PrivateEndpointConnectionProperties, + PrivateEndpoint, + PrivateLinkServiceConnectionState, + KnownPrivateEndpointServiceConnectionStatus, + PrivateEndpointServiceConnectionStatus, + KnownPrivateEndpointConnectionProvisioningState, + PrivateEndpointConnectionProvisioningState, + ProxyResource, + DiskAccessUpdate, + PrivateLinkResourceListResult, + PrivateLinkResource, + // PrivateLinkResourceProperties, + DiskEncryptionSet, + // EncryptionSetProperties, + KnownDiskEncryptionSetType, + DiskEncryptionSetType, + KeyForDiskEncryptionSet, + EncryptionSetIdentity, + KnownDiskEncryptionSetIdentityType, + DiskEncryptionSetIdentityType, + UserAssignedIdentitiesValue, + DiskEncryptionSetUpdate, + // DiskEncryptionSetUpdateProperties, + Snapshot, + // SnapshotProperties, + CopyCompletionError, + KnownCopyCompletionErrorReason, + CopyCompletionErrorReason, + KnownSnapshotAccessState, + SnapshotAccessState, + SnapshotSku, + KnownSnapshotStorageAccountTypes, + SnapshotStorageAccountTypes, + SnapshotUpdate, + // SnapshotUpdateProperties, + DiskRestorePoint, + // DiskRestorePointProperties, + KnownVersions, +} from "./models/index.js"; +export { ComputeDiskClientOptionalParams } from "./api/index.js"; +export { + DiskAccessesListPrivateEndpointConnectionsOptionalParams, + DiskAccessesDeleteAPrivateEndpointConnectionOptionalParams, + DiskAccessesUpdateAPrivateEndpointConnectionOptionalParams, + DiskAccessesGetAPrivateEndpointConnectionOptionalParams, + DiskAccessesGetPrivateLinkResourcesOptionalParams, + DiskAccessesListOptionalParams, + DiskAccessesListByResourceGroupOptionalParams, + DiskAccessesDeleteOptionalParams, + DiskAccessesUpdateOptionalParams, + DiskAccessesCreateOrUpdateOptionalParams, + DiskAccessesGetOptionalParams, +} from "./api/diskAccesses/index.js"; +export { + DiskEncryptionSetsListAssociatedResourcesOptionalParams, + DiskEncryptionSetsListOptionalParams, + DiskEncryptionSetsListByResourceGroupOptionalParams, + DiskEncryptionSetsDeleteOptionalParams, + DiskEncryptionSetsUpdateOptionalParams, + DiskEncryptionSetsCreateOrUpdateOptionalParams, + DiskEncryptionSetsGetOptionalParams, +} from "./api/diskEncryptionSets/index.js"; +export { + DiskRestorePointRevokeAccessOptionalParams, + DiskRestorePointGrantAccessOptionalParams, + DiskRestorePointListByRestorePointOptionalParams, + DiskRestorePointGetOptionalParams, +} from "./api/diskRestorePoint/index.js"; +export { + DisksRevokeAccessOptionalParams, + DisksGrantAccessOptionalParams, + DisksListOptionalParams, + DisksListByResourceGroupOptionalParams, + DisksDeleteOptionalParams, + DisksUpdateOptionalParams, + DisksCreateOrUpdateOptionalParams, + DisksGetOptionalParams, +} from "./api/disks/index.js"; +export { + SnapshotsRevokeAccessOptionalParams, + SnapshotsGrantAccessOptionalParams, + SnapshotsListOptionalParams, + SnapshotsListByResourceGroupOptionalParams, + SnapshotsDeleteOptionalParams, + SnapshotsUpdateOptionalParams, + SnapshotsCreateOrUpdateOptionalParams, + SnapshotsGetOptionalParams, +} from "./api/snapshots/index.js"; +export { + DiskAccessesOperations, + DiskEncryptionSetsOperations, + DiskRestorePointOperations, + DisksOperations, + SnapshotsOperations, +} from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; +export { AzureClouds, AzureSupportedClouds }; diff --git a/sdk/compute/arm-compute-disk/src/logger.ts b/sdk/compute/arm-compute-disk/src/logger.ts new file mode 100644 index 000000000000..5eddf1c46b23 --- /dev/null +++ b/sdk/compute/arm-compute-disk/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-compute-disk"); diff --git a/sdk/compute/arm-compute-disk/src/models/index.ts b/sdk/compute/arm-compute-disk/src/models/index.ts new file mode 100644 index 000000000000..f40b6b705178 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/models/index.ts @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + Disk, + DiskProperties, + OperatingSystemTypes, + KnownHyperVGeneration, + HyperVGeneration, + DiskPurchasePlan, + SupportedCapabilities, + KnownArchitecture, + Architecture, + KnownSupportedSecurityOption, + SupportedSecurityOption, + CreationData, + KnownDiskCreateOption, + DiskCreateOption, + ImageDiskReference, + KnownProvisionedBandwidthCopyOption, + ProvisionedBandwidthCopyOption, + EncryptionSettingsCollection, + EncryptionSettingsElement, + KeyVaultAndSecretReference, + SourceVault, + KeyVaultAndKeyReference, + KnownDiskState, + DiskState, + Encryption, + KnownEncryptionType, + EncryptionType, + ShareInfoElement, + KnownNetworkAccessPolicy, + NetworkAccessPolicy, + PropertyUpdatesInProgress, + DiskSecurityProfile, + KnownDiskSecurityTypes, + DiskSecurityTypes, + KnownPublicNetworkAccess, + PublicNetworkAccess, + KnownDataAccessAuthMode, + DataAccessAuthMode, + AvailabilityPolicy, + KnownAvailabilityPolicyDiskDelay, + AvailabilityPolicyDiskDelay, + DiskSku, + KnownDiskStorageAccountTypes, + DiskStorageAccountTypes, + ExtendedLocation, + KnownExtendedLocationTypes, + ExtendedLocationTypes, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + CloudError, + ApiError, + ApiErrorBase, + InnerError, + DiskUpdate, + DiskUpdateProperties, + GrantAccessData, + KnownAccessLevel, + AccessLevel, + KnownFileFormat, + FileFormat, + AccessUri, + DiskAccess, + DiskAccessProperties, + PrivateEndpointConnection, + PrivateEndpointConnectionProperties, + PrivateEndpoint, + PrivateLinkServiceConnectionState, + KnownPrivateEndpointServiceConnectionStatus, + PrivateEndpointServiceConnectionStatus, + KnownPrivateEndpointConnectionProvisioningState, + PrivateEndpointConnectionProvisioningState, + ProxyResource, + DiskAccessUpdate, + PrivateLinkResourceListResult, + PrivateLinkResource, + PrivateLinkResourceProperties, + DiskEncryptionSet, + EncryptionSetProperties, + KnownDiskEncryptionSetType, + DiskEncryptionSetType, + KeyForDiskEncryptionSet, + EncryptionSetIdentity, + KnownDiskEncryptionSetIdentityType, + DiskEncryptionSetIdentityType, + UserAssignedIdentitiesValue, + DiskEncryptionSetUpdate, + DiskEncryptionSetUpdateProperties, + Snapshot, + SnapshotProperties, + CopyCompletionError, + KnownCopyCompletionErrorReason, + CopyCompletionErrorReason, + KnownSnapshotAccessState, + SnapshotAccessState, + SnapshotSku, + KnownSnapshotStorageAccountTypes, + SnapshotStorageAccountTypes, + SnapshotUpdate, + SnapshotUpdateProperties, + DiskRestorePoint, + DiskRestorePointProperties, + KnownVersions, +} from "./models.js"; diff --git a/sdk/compute/arm-compute-disk/src/models/models.ts b/sdk/compute/arm-compute-disk/src/models/models.ts new file mode 100644 index 000000000000..77a1a25cbd97 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/models/models.ts @@ -0,0 +1,2936 @@ +// 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 */ +/** Disk resource. */ +export interface Disk extends TrackedResource { + /** A relative URI containing the ID of the VM that has the disk attached. */ + readonly managedBy?: string; + /** List of relative URIs containing the IDs of the VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. */ + readonly managedByExtended?: string[]; + /** The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. */ + sku?: DiskSku; + /** The Logical zone list for Disk. */ + zones?: string[]; + /** The extended location where the disk will be created. Extended location cannot be changed. */ + extendedLocation?: ExtendedLocation; + /** The time when the disk was created. */ + readonly timeCreated?: Date; + /** The Operating System type. */ + osType?: OperatingSystemTypes; + /** The hypervisor generation of the Virtual Machine. Applicable to OS disks only. */ + hyperVGeneration?: HyperVGeneration; + /** Purchase plan information for the the image from which the OS disk was created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer} */ + purchasePlan?: DiskPurchasePlan; + /** List of supported capabilities for the image from which the OS disk was created. */ + supportedCapabilities?: SupportedCapabilities; + /** Disk source information. CreationData information cannot be changed after the disk has been created. */ + creationData?: CreationData; + /** If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. */ + diskSizeGB?: number; + /** The size of the disk in bytes. This field is read only. */ + readonly diskSizeBytes?: number; + /** Unique Guid identifying the resource. */ + readonly uniqueId?: string; + /** Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. */ + encryptionSettingsCollection?: EncryptionSettingsCollection; + /** The disk provisioning state. */ + readonly provisioningState?: string; + /** The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. */ + diskIopsReadWrite?: number; + /** The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. */ + diskMBpsReadWrite?: number; + /** The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. */ + diskIopsReadOnly?: number; + /** The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. */ + diskMBpsReadOnly?: number; + /** The state of the disk. */ + readonly diskState?: DiskState; + /** Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. */ + encryption?: Encryption; + /** The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. */ + maxShares?: number; + /** Details of the list of all VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. */ + readonly shareInfo?: ShareInfoElement[]; + /** Policy for accessing the disk via network. */ + networkAccessPolicy?: NetworkAccessPolicy; + /** ARM id of the DiskAccess resource for using private endpoints on disks. */ + diskAccessId?: string; + /** Latest time when bursting was last enabled on a disk. */ + readonly burstingEnabledTime?: Date; + /** Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. */ + tier?: string; + /** Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. */ + burstingEnabled?: boolean; + /** Properties of the disk for which update is pending. */ + readonly propertyUpdatesInProgress?: PropertyUpdatesInProgress; + /** Indicates the OS on a disk supports hibernation. */ + supportsHibernation?: boolean; + /** Contains the security related information for the resource. */ + securityProfile?: DiskSecurityProfile; + /** Percentage complete for the background copy when a resource is created via the CopyStart operation. */ + completionPercent?: number; + /** Policy for controlling export on the disk. */ + publicNetworkAccess?: PublicNetworkAccess; + /** Additional authentication requirements when exporting or uploading to a disk or snapshot. */ + dataAccessAuthMode?: DataAccessAuthMode; + /** Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times a day) by detached from one virtual machine and attached to another. This property should not be set for disks that are not detached and attached frequently as it causes the disks to not align with the fault domain of the virtual machine. */ + optimizedForFrequentAttach?: boolean; + /** The UTC time when the ownership state of the disk was last changed i.e., the time the disk was last attached or detached from a VM or the time when the VM to which the disk was attached was deallocated or started. */ + readonly lastOwnershipUpdateTime?: Date; + /** Determines how platform treats disk failures */ + availabilityPolicy?: AvailabilityPolicy; +} + +export function diskSerializer(item: Disk): any { + return { + tags: item["tags"], + location: item["location"], + properties: diskPropertiesSerializer(item), + sku: !item["sku"] ? item["sku"] : diskSkuSerializer(item["sku"]), + zones: !item["zones"] + ? item["zones"] + : item["zones"].map((p: any) => { + return p; + }), + extendedLocation: !item["extendedLocation"] + ? item["extendedLocation"] + : extendedLocationSerializer(item["extendedLocation"]), + }; +} + +export function diskDeserializer(item: any): Disk { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : diskPropertiesDeserializer(item["properties"])), + managedBy: item["managedBy"], + managedByExtended: !item["managedByExtended"] + ? item["managedByExtended"] + : item["managedByExtended"].map((p: any) => { + return p; + }), + sku: !item["sku"] ? item["sku"] : diskSkuDeserializer(item["sku"]), + zones: !item["zones"] + ? item["zones"] + : item["zones"].map((p: any) => { + return p; + }), + extendedLocation: !item["extendedLocation"] + ? item["extendedLocation"] + : extendedLocationDeserializer(item["extendedLocation"]), + }; +} + +/** Disk resource properties. */ +export interface DiskProperties { + /** The time when the disk was created. */ + readonly timeCreated?: Date; + /** The Operating System type. */ + osType?: OperatingSystemTypes; + /** The hypervisor generation of the Virtual Machine. Applicable to OS disks only. */ + hyperVGeneration?: HyperVGeneration; + /** Purchase plan information for the the image from which the OS disk was created. E.g. - {name: 2019-Datacenter, publisher: MicrosoftWindowsServer, product: WindowsServer} */ + purchasePlan?: DiskPurchasePlan; + /** List of supported capabilities for the image from which the OS disk was created. */ + supportedCapabilities?: SupportedCapabilities; + /** Disk source information. CreationData information cannot be changed after the disk has been created. */ + creationData?: CreationData; + /** If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. */ + diskSizeGB?: number; + /** The size of the disk in bytes. This field is read only. */ + readonly diskSizeBytes?: number; + /** Unique Guid identifying the resource. */ + readonly uniqueId?: string; + /** Encryption settings collection used for Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. */ + encryptionSettingsCollection?: EncryptionSettingsCollection; + /** The disk provisioning state. */ + readonly provisioningState?: string; + /** The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. */ + diskIopsReadWrite?: number; + /** The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. */ + diskMBpsReadWrite?: number; + /** The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. */ + diskIopsReadOnly?: number; + /** The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. */ + diskMBpsReadOnly?: number; + /** The state of the disk. */ + readonly diskState?: DiskState; + /** Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. */ + encryption?: Encryption; + /** The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. */ + maxShares?: number; + /** Details of the list of all VMs that have the disk attached. maxShares should be set to a value greater than one for disks to allow attaching them to multiple VMs. */ + readonly shareInfo?: ShareInfoElement[]; + /** Policy for accessing the disk via network. */ + networkAccessPolicy?: NetworkAccessPolicy; + /** ARM id of the DiskAccess resource for using private endpoints on disks. */ + diskAccessId?: string; + /** Latest time when bursting was last enabled on a disk. */ + readonly burstingEnabledTime?: Date; + /** Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. */ + tier?: string; + /** Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. */ + burstingEnabled?: boolean; + /** Properties of the disk for which update is pending. */ + readonly propertyUpdatesInProgress?: PropertyUpdatesInProgress; + /** Indicates the OS on a disk supports hibernation. */ + supportsHibernation?: boolean; + /** Contains the security related information for the resource. */ + securityProfile?: DiskSecurityProfile; + /** Percentage complete for the background copy when a resource is created via the CopyStart operation. */ + completionPercent?: number; + /** Policy for controlling export on the disk. */ + publicNetworkAccess?: PublicNetworkAccess; + /** Additional authentication requirements when exporting or uploading to a disk or snapshot. */ + dataAccessAuthMode?: DataAccessAuthMode; + /** Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times a day) by detached from one virtual machine and attached to another. This property should not be set for disks that are not detached and attached frequently as it causes the disks to not align with the fault domain of the virtual machine. */ + optimizedForFrequentAttach?: boolean; + /** The UTC time when the ownership state of the disk was last changed i.e., the time the disk was last attached or detached from a VM or the time when the VM to which the disk was attached was deallocated or started. */ + readonly lastOwnershipUpdateTime?: Date; + /** Determines how platform treats disk failures */ + availabilityPolicy?: AvailabilityPolicy; +} + +export function diskPropertiesSerializer(item: DiskProperties): any { + return { + osType: item["osType"], + hyperVGeneration: item["hyperVGeneration"], + purchasePlan: !item["purchasePlan"] + ? item["purchasePlan"] + : diskPurchasePlanSerializer(item["purchasePlan"]), + supportedCapabilities: !item["supportedCapabilities"] + ? item["supportedCapabilities"] + : supportedCapabilitiesSerializer(item["supportedCapabilities"]), + creationData: !item["creationData"] + ? item["creationData"] + : creationDataSerializer(item["creationData"]), + diskSizeGB: item["diskSizeGB"], + encryptionSettingsCollection: !item["encryptionSettingsCollection"] + ? item["encryptionSettingsCollection"] + : encryptionSettingsCollectionSerializer( + item["encryptionSettingsCollection"], + ), + diskIOPSReadWrite: item["diskIopsReadWrite"], + diskMBpsReadWrite: item["diskMBpsReadWrite"], + diskIOPSReadOnly: item["diskIopsReadOnly"], + diskMBpsReadOnly: item["diskMBpsReadOnly"], + encryption: !item["encryption"] + ? item["encryption"] + : encryptionSerializer(item["encryption"]), + maxShares: item["maxShares"], + networkAccessPolicy: item["networkAccessPolicy"], + diskAccessId: item["diskAccessId"], + tier: item["tier"], + burstingEnabled: item["burstingEnabled"], + supportsHibernation: item["supportsHibernation"], + securityProfile: !item["securityProfile"] + ? item["securityProfile"] + : diskSecurityProfileSerializer(item["securityProfile"]), + completionPercent: item["completionPercent"], + publicNetworkAccess: item["publicNetworkAccess"], + dataAccessAuthMode: item["dataAccessAuthMode"], + optimizedForFrequentAttach: item["optimizedForFrequentAttach"], + availabilityPolicy: !item["availabilityPolicy"] + ? item["availabilityPolicy"] + : availabilityPolicySerializer(item["availabilityPolicy"]), + }; +} + +export function diskPropertiesDeserializer(item: any): DiskProperties { + return { + timeCreated: !item["timeCreated"] + ? item["timeCreated"] + : new Date(item["timeCreated"]), + osType: item["osType"], + hyperVGeneration: item["hyperVGeneration"], + purchasePlan: !item["purchasePlan"] + ? item["purchasePlan"] + : diskPurchasePlanDeserializer(item["purchasePlan"]), + supportedCapabilities: !item["supportedCapabilities"] + ? item["supportedCapabilities"] + : supportedCapabilitiesDeserializer(item["supportedCapabilities"]), + creationData: creationDataDeserializer(item["creationData"]), + diskSizeGB: item["diskSizeGB"], + diskSizeBytes: item["diskSizeBytes"], + uniqueId: item["uniqueId"], + encryptionSettingsCollection: !item["encryptionSettingsCollection"] + ? item["encryptionSettingsCollection"] + : encryptionSettingsCollectionDeserializer( + item["encryptionSettingsCollection"], + ), + provisioningState: item["provisioningState"], + diskIopsReadWrite: item["diskIOPSReadWrite"], + diskMBpsReadWrite: item["diskMBpsReadWrite"], + diskIopsReadOnly: item["diskIOPSReadOnly"], + diskMBpsReadOnly: item["diskMBpsReadOnly"], + diskState: item["diskState"], + encryption: !item["encryption"] + ? item["encryption"] + : encryptionDeserializer(item["encryption"]), + maxShares: item["maxShares"], + shareInfo: !item["shareInfo"] + ? item["shareInfo"] + : shareInfoElementArrayDeserializer(item["shareInfo"]), + networkAccessPolicy: item["networkAccessPolicy"], + diskAccessId: item["diskAccessId"], + burstingEnabledTime: !item["burstingEnabledTime"] + ? item["burstingEnabledTime"] + : new Date(item["burstingEnabledTime"]), + tier: item["tier"], + burstingEnabled: item["burstingEnabled"], + propertyUpdatesInProgress: !item["propertyUpdatesInProgress"] + ? item["propertyUpdatesInProgress"] + : propertyUpdatesInProgressDeserializer( + item["propertyUpdatesInProgress"], + ), + supportsHibernation: item["supportsHibernation"], + securityProfile: !item["securityProfile"] + ? item["securityProfile"] + : diskSecurityProfileDeserializer(item["securityProfile"]), + completionPercent: item["completionPercent"], + publicNetworkAccess: item["publicNetworkAccess"], + dataAccessAuthMode: item["dataAccessAuthMode"], + optimizedForFrequentAttach: item["optimizedForFrequentAttach"], + lastOwnershipUpdateTime: !item["LastOwnershipUpdateTime"] + ? item["LastOwnershipUpdateTime"] + : new Date(item["LastOwnershipUpdateTime"]), + availabilityPolicy: !item["availabilityPolicy"] + ? item["availabilityPolicy"] + : availabilityPolicyDeserializer(item["availabilityPolicy"]), + }; +} + +/** The Operating System type. */ +export type OperatingSystemTypes = "Windows" | "Linux"; + +/** The hypervisor generation of the Virtual Machine. Applicable to OS disks only. */ +export enum KnownHyperVGeneration { + /** V1 */ + V1 = "V1", + /** V2 */ + V2 = "V2", +} + +/** + * The hypervisor generation of the Virtual Machine. Applicable to OS disks only. \ + * {@link KnownHyperVGeneration} can be used interchangeably with HyperVGeneration, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **V1** \ + * **V2** + */ +export type HyperVGeneration = string; + +/** Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. */ +export interface DiskPurchasePlan { + /** The plan ID. */ + name: string; + /** The publisher ID. */ + publisher: string; + /** Specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. */ + product: string; + /** The Offer Promotion Code. */ + promotionCode?: string; +} + +export function diskPurchasePlanSerializer(item: DiskPurchasePlan): any { + return { + name: item["name"], + publisher: item["publisher"], + product: item["product"], + promotionCode: item["promotionCode"], + }; +} + +export function diskPurchasePlanDeserializer(item: any): DiskPurchasePlan { + return { + name: item["name"], + publisher: item["publisher"], + product: item["product"], + promotionCode: item["promotionCode"], + }; +} + +/** List of supported capabilities persisted on the disk resource for VM use. */ +export interface SupportedCapabilities { + /** The disk controllers that an OS disk supports. If set it can be SCSI or SCSI, NVME or NVME, SCSI. */ + diskControllerTypes?: string; + /** True if the image from which the OS disk is created supports accelerated networking. */ + acceleratedNetwork?: boolean; + /** CPU architecture supported by an OS disk. */ + architecture?: Architecture; + /** Refers to the security capability of the disk supported to create a Trusted launch or Confidential VM */ + supportedSecurityOption?: SupportedSecurityOption; +} + +export function supportedCapabilitiesSerializer( + item: SupportedCapabilities, +): any { + return { + diskControllerTypes: item["diskControllerTypes"], + acceleratedNetwork: item["acceleratedNetwork"], + architecture: item["architecture"], + supportedSecurityOption: item["supportedSecurityOption"], + }; +} + +export function supportedCapabilitiesDeserializer( + item: any, +): SupportedCapabilities { + return { + diskControllerTypes: item["diskControllerTypes"], + acceleratedNetwork: item["acceleratedNetwork"], + architecture: item["architecture"], + supportedSecurityOption: item["supportedSecurityOption"], + }; +} + +/** CPU architecture supported by an OS disk. */ +export enum KnownArchitecture { + /** x64 */ + X64 = "x64", + /** Arm64 */ + Arm64 = "Arm64", +} + +/** + * CPU architecture supported by an OS disk. \ + * {@link KnownArchitecture} can be used interchangeably with Architecture, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **x64** \ + * **Arm64** + */ +export type Architecture = string; + +/** Refers to the security capability of the disk supported to create a Trusted launch or Confidential VM */ +export enum KnownSupportedSecurityOption { + /** The disk supports creating Trusted Launch VMs. */ + TrustedLaunchSupported = "TrustedLaunchSupported", + /** The disk supports creating both Trusted Launch and Confidential VMs. */ + TrustedLaunchAndConfidentialVMSupported = "TrustedLaunchAndConfidentialVMSupported", +} + +/** + * Refers to the security capability of the disk supported to create a Trusted launch or Confidential VM \ + * {@link KnownSupportedSecurityOption} can be used interchangeably with SupportedSecurityOption, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **TrustedLaunchSupported**: The disk supports creating Trusted Launch VMs. \ + * **TrustedLaunchAndConfidentialVMSupported**: The disk supports creating both Trusted Launch and Confidential VMs. + */ +export type SupportedSecurityOption = string; + +/** Data used when creating a disk. */ +export interface CreationData { + /** This enumerates the possible sources of a disk's creation. */ + createOption: DiskCreateOption; + /** Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk. */ + storageAccountId?: string; + /** Disk source information for PIR or user images. */ + imageReference?: ImageDiskReference; + /** Required if creating from a Gallery Image. The id/sharedGalleryImageId/communityGalleryImageId of the ImageDiskReference will be the ARM id of the shared galley image version from which to create a disk. */ + galleryImageReference?: ImageDiskReference; + /** If createOption is Import, this is the URI of a blob to be imported into a managed disk. */ + sourceUri?: string; + /** If createOption is Copy, this is the ARM id of the source snapshot or disk. */ + sourceResourceId?: string; + /** If this field is set, this is the unique id identifying the source of this resource. */ + readonly sourceUniqueId?: string; + /** If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer). */ + uploadSizeBytes?: number; + /** Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default. */ + logicalSectorSize?: number; + /** If createOption is ImportSecure, this is the URI of a blob to be imported into VM guest state. */ + securityDataUri?: string; + /** If createOption is ImportSecure, this is the URI of a blob to be imported into VM metadata for Confidential VM. */ + securityMetadataUri?: string; + /** Set this flag to true to get a boost on the performance target of the disk deployed, see here on the respective performance target. This flag can only be set on disk creation time and cannot be disabled after enabled. */ + performancePlus?: boolean; + /** Required if createOption is CopyFromSanSnapshot. This is the ARM id of the source elastic san volume snapshot. */ + elasticSanResourceId?: string; + /** If this field is set on a snapshot and createOption is CopyStart, the snapshot will be copied at a quicker speed. */ + provisionedBandwidthCopySpeed?: ProvisionedBandwidthCopyOption; + /** For snapshots created from Premium SSD v2 or Ultra disk, this property determines the time in minutes the snapshot is retained for instant access to enable faster restore. */ + instantAccessDurationMinutes?: number; +} + +export function creationDataSerializer(item: CreationData): any { + return { + createOption: item["createOption"], + storageAccountId: item["storageAccountId"], + imageReference: !item["imageReference"] + ? item["imageReference"] + : imageDiskReferenceSerializer(item["imageReference"]), + galleryImageReference: !item["galleryImageReference"] + ? item["galleryImageReference"] + : imageDiskReferenceSerializer(item["galleryImageReference"]), + sourceUri: item["sourceUri"], + sourceResourceId: item["sourceResourceId"], + uploadSizeBytes: item["uploadSizeBytes"], + logicalSectorSize: item["logicalSectorSize"], + securityDataUri: item["securityDataUri"], + securityMetadataUri: item["securityMetadataUri"], + performancePlus: item["performancePlus"], + elasticSanResourceId: item["elasticSanResourceId"], + provisionedBandwidthCopySpeed: item["provisionedBandwidthCopySpeed"], + instantAccessDurationMinutes: item["instantAccessDurationMinutes"], + }; +} + +export function creationDataDeserializer(item: any): CreationData { + return { + createOption: item["createOption"], + storageAccountId: item["storageAccountId"], + imageReference: !item["imageReference"] + ? item["imageReference"] + : imageDiskReferenceDeserializer(item["imageReference"]), + galleryImageReference: !item["galleryImageReference"] + ? item["galleryImageReference"] + : imageDiskReferenceDeserializer(item["galleryImageReference"]), + sourceUri: item["sourceUri"], + sourceResourceId: item["sourceResourceId"], + sourceUniqueId: item["sourceUniqueId"], + uploadSizeBytes: item["uploadSizeBytes"], + logicalSectorSize: item["logicalSectorSize"], + securityDataUri: item["securityDataUri"], + securityMetadataUri: item["securityMetadataUri"], + performancePlus: item["performancePlus"], + elasticSanResourceId: item["elasticSanResourceId"], + provisionedBandwidthCopySpeed: item["provisionedBandwidthCopySpeed"], + instantAccessDurationMinutes: item["instantAccessDurationMinutes"], + }; +} + +/** This enumerates the possible sources of a disk's creation. */ +export enum KnownDiskCreateOption { + /** Create an empty data disk of a size given by diskSizeGB. */ + Empty = "Empty", + /** Disk will be attached to a VM. */ + Attach = "Attach", + /** Create a new disk from a platform image specified by the given imageReference or galleryImageReference. */ + FromImage = "FromImage", + /** Create a disk by importing from a blob specified by a sourceUri in a storage account specified by storageAccountId. */ + Import = "Import", + /** Create a new disk or snapshot by copying from a disk or snapshot specified by the given sourceResourceId. */ + Copy = "Copy", + /** Create a new disk by copying from a backup recovery point. */ + Restore = "Restore", + /** Create a new disk by obtaining a write token and using it to directly upload the contents of the disk. */ + Upload = "Upload", + /** Create a new disk by using a deep copy process, where the resource creation is considered complete only after all data has been copied from the source. */ + CopyStart = "CopyStart", + /** Similar to Import create option. Create a new Trusted Launch VM or Confidential VM supported disk by importing additional blobs for VM guest state specified by securityDataUri and VM metadata specified by securityMetadataUri in storage account specified by storageAccountId. The VM metadata is optional and only required for certain Confidential VM configurations and not required for Trusted Launch VM. */ + ImportSecure = "ImportSecure", + /** Similar to Upload create option. Create a new Trusted Launch VM or Confidential VM supported disk and upload using write token in disk, VM guest state and VM metadata. The VM metadata is optional and only required for certain Confidential VM configurations and not required for Trusted Launch VM. */ + UploadPreparedSecure = "UploadPreparedSecure", + /** Create a new disk by exporting from elastic san volume snapshot */ + CopyFromSanSnapshot = "CopyFromSanSnapshot", +} + +/** + * This enumerates the possible sources of a disk's creation. \ + * {@link KnownDiskCreateOption} can be used interchangeably with DiskCreateOption, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Empty**: Create an empty data disk of a size given by diskSizeGB. \ + * **Attach**: Disk will be attached to a VM. \ + * **FromImage**: Create a new disk from a platform image specified by the given imageReference or galleryImageReference. \ + * **Import**: Create a disk by importing from a blob specified by a sourceUri in a storage account specified by storageAccountId. \ + * **Copy**: Create a new disk or snapshot by copying from a disk or snapshot specified by the given sourceResourceId. \ + * **Restore**: Create a new disk by copying from a backup recovery point. \ + * **Upload**: Create a new disk by obtaining a write token and using it to directly upload the contents of the disk. \ + * **CopyStart**: Create a new disk by using a deep copy process, where the resource creation is considered complete only after all data has been copied from the source. \ + * **ImportSecure**: Similar to Import create option. Create a new Trusted Launch VM or Confidential VM supported disk by importing additional blobs for VM guest state specified by securityDataUri and VM metadata specified by securityMetadataUri in storage account specified by storageAccountId. The VM metadata is optional and only required for certain Confidential VM configurations and not required for Trusted Launch VM. \ + * **UploadPreparedSecure**: Similar to Upload create option. Create a new Trusted Launch VM or Confidential VM supported disk and upload using write token in disk, VM guest state and VM metadata. The VM metadata is optional and only required for certain Confidential VM configurations and not required for Trusted Launch VM. \ + * **CopyFromSanSnapshot**: Create a new disk by exporting from elastic san volume snapshot + */ +export type DiskCreateOption = string; + +/** The source image used for creating the disk. */ +export interface ImageDiskReference { + /** A relative uri containing either a Platform Image Repository, user image, or Azure Compute Gallery image reference. */ + id?: string; + /** A relative uri containing a direct shared Azure Compute Gallery image reference. */ + sharedGalleryImageId?: string; + /** A relative uri containing a community Azure Compute Gallery image reference. */ + communityGalleryImageId?: string; + /** If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. */ + lun?: number; +} + +export function imageDiskReferenceSerializer(item: ImageDiskReference): any { + return { + id: item["id"], + sharedGalleryImageId: item["sharedGalleryImageId"], + communityGalleryImageId: item["communityGalleryImageId"], + lun: item["lun"], + }; +} + +export function imageDiskReferenceDeserializer(item: any): ImageDiskReference { + return { + id: item["id"], + sharedGalleryImageId: item["sharedGalleryImageId"], + communityGalleryImageId: item["communityGalleryImageId"], + lun: item["lun"], + }; +} + +/** If this field is set on a snapshot and createOption is CopyStart, the snapshot will be copied at a quicker speed. */ +export enum KnownProvisionedBandwidthCopyOption { + /** None */ + None = "None", + /** Enhanced */ + Enhanced = "Enhanced", +} + +/** + * If this field is set on a snapshot and createOption is CopyStart, the snapshot will be copied at a quicker speed. \ + * {@link KnownProvisionedBandwidthCopyOption} can be used interchangeably with ProvisionedBandwidthCopyOption, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **Enhanced** + */ +export type ProvisionedBandwidthCopyOption = string; + +/** Encryption settings for disk or snapshot */ +export interface EncryptionSettingsCollection { + /** Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. */ + enabled: boolean; + /** A collection of encryption settings, one for each disk volume. */ + encryptionSettings?: EncryptionSettingsElement[]; + /** Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption. */ + encryptionSettingsVersion?: string; +} + +export function encryptionSettingsCollectionSerializer( + item: EncryptionSettingsCollection, +): any { + return { + enabled: item["enabled"], + encryptionSettings: !item["encryptionSettings"] + ? item["encryptionSettings"] + : encryptionSettingsElementArraySerializer(item["encryptionSettings"]), + encryptionSettingsVersion: item["encryptionSettingsVersion"], + }; +} + +export function encryptionSettingsCollectionDeserializer( + item: any, +): EncryptionSettingsCollection { + return { + enabled: item["enabled"], + encryptionSettings: !item["encryptionSettings"] + ? item["encryptionSettings"] + : encryptionSettingsElementArrayDeserializer(item["encryptionSettings"]), + encryptionSettingsVersion: item["encryptionSettingsVersion"], + }; +} + +export function encryptionSettingsElementArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return encryptionSettingsElementSerializer(item); + }); +} + +export function encryptionSettingsElementArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return encryptionSettingsElementDeserializer(item); + }); +} + +/** Encryption settings for one disk volume. */ +export interface EncryptionSettingsElement { + /** Key Vault Secret Url and vault id of the disk encryption key */ + diskEncryptionKey?: KeyVaultAndSecretReference; + /** Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key. */ + keyEncryptionKey?: KeyVaultAndKeyReference; +} + +export function encryptionSettingsElementSerializer( + item: EncryptionSettingsElement, +): any { + return { + diskEncryptionKey: !item["diskEncryptionKey"] + ? item["diskEncryptionKey"] + : keyVaultAndSecretReferenceSerializer(item["diskEncryptionKey"]), + keyEncryptionKey: !item["keyEncryptionKey"] + ? item["keyEncryptionKey"] + : keyVaultAndKeyReferenceSerializer(item["keyEncryptionKey"]), + }; +} + +export function encryptionSettingsElementDeserializer( + item: any, +): EncryptionSettingsElement { + return { + diskEncryptionKey: !item["diskEncryptionKey"] + ? item["diskEncryptionKey"] + : keyVaultAndSecretReferenceDeserializer(item["diskEncryptionKey"]), + keyEncryptionKey: !item["keyEncryptionKey"] + ? item["keyEncryptionKey"] + : keyVaultAndKeyReferenceDeserializer(item["keyEncryptionKey"]), + }; +} + +/** Key Vault Secret Url and vault id of the encryption key */ +export interface KeyVaultAndSecretReference { + /** Resource id of the KeyVault containing the key or secret */ + sourceVault: SourceVault; + /** Url pointing to a key or secret in KeyVault */ + secretUrl: string; +} + +export function keyVaultAndSecretReferenceSerializer( + item: KeyVaultAndSecretReference, +): any { + return { + sourceVault: sourceVaultSerializer(item["sourceVault"]), + secretUrl: item["secretUrl"], + }; +} + +export function keyVaultAndSecretReferenceDeserializer( + item: any, +): KeyVaultAndSecretReference { + return { + sourceVault: sourceVaultDeserializer(item["sourceVault"]), + secretUrl: item["secretUrl"], + }; +} + +/** The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} */ +export interface SourceVault { + /** Resource Id */ + id?: string; +} + +export function sourceVaultSerializer(item: SourceVault): any { + return { id: item["id"] }; +} + +export function sourceVaultDeserializer(item: any): SourceVault { + return { + id: item["id"], + }; +} + +/** Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encryptionKey */ +export interface KeyVaultAndKeyReference { + /** Resource id of the KeyVault containing the key or secret */ + sourceVault: SourceVault; + /** Url pointing to a key or secret in KeyVault */ + keyUrl: string; +} + +export function keyVaultAndKeyReferenceSerializer( + item: KeyVaultAndKeyReference, +): any { + return { + sourceVault: sourceVaultSerializer(item["sourceVault"]), + keyUrl: item["keyUrl"], + }; +} + +export function keyVaultAndKeyReferenceDeserializer( + item: any, +): KeyVaultAndKeyReference { + return { + sourceVault: sourceVaultDeserializer(item["sourceVault"]), + keyUrl: item["keyUrl"], + }; +} + +/** This enumerates the possible state of the disk. */ +export enum KnownDiskState { + /** The disk is not being used and can be attached to a VM. */ + Unattached = "Unattached", + /** The disk is currently attached to a running VM. */ + Attached = "Attached", + /** The disk is attached to a stopped-deallocated VM. */ + Reserved = "Reserved", + /** The disk is attached to a VM which is in hibernated state. */ + Frozen = "Frozen", + /** The disk currently has an Active SAS Uri associated with it. */ + ActiveSAS = "ActiveSAS", + /** The disk is attached to a VM in hibernated state and has an active SAS URI associated with it. */ + ActiveSASFrozen = "ActiveSASFrozen", + /** A disk is ready to be created by upload by requesting a write token. */ + ReadyToUpload = "ReadyToUpload", + /** A disk is created for upload and a write token has been issued for uploading to it. */ + ActiveUpload = "ActiveUpload", +} + +/** + * This enumerates the possible state of the disk. \ + * {@link KnownDiskState} can be used interchangeably with DiskState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unattached**: The disk is not being used and can be attached to a VM. \ + * **Attached**: The disk is currently attached to a running VM. \ + * **Reserved**: The disk is attached to a stopped-deallocated VM. \ + * **Frozen**: The disk is attached to a VM which is in hibernated state. \ + * **ActiveSAS**: The disk currently has an Active SAS Uri associated with it. \ + * **ActiveSASFrozen**: The disk is attached to a VM in hibernated state and has an active SAS URI associated with it. \ + * **ReadyToUpload**: A disk is ready to be created by upload by requesting a write token. \ + * **ActiveUpload**: A disk is created for upload and a write token has been issued for uploading to it. + */ +export type DiskState = string; + +/** Encryption at rest settings for disk or snapshot */ +export interface Encryption { + /** ResourceId of the disk encryption set to use for enabling encryption at rest. */ + diskEncryptionSetId?: string; + /** The type of key used to encrypt the data of the disk. */ + type?: EncryptionType; +} + +export function encryptionSerializer(item: Encryption): any { + return { + diskEncryptionSetId: item["diskEncryptionSetId"], + type: item["type"], + }; +} + +export function encryptionDeserializer(item: any): Encryption { + return { + diskEncryptionSetId: item["diskEncryptionSetId"], + type: item["type"], + }; +} + +/** The type of key used to encrypt the data of the disk. */ +export enum KnownEncryptionType { + /** Disk is encrypted at rest with Platform managed key. It is the default encryption type. This is not a valid encryption type for disk encryption sets. */ + EncryptionAtRestWithPlatformKey = "EncryptionAtRestWithPlatformKey", + /** Disk is encrypted at rest with Customer managed key that can be changed and revoked by a customer. */ + EncryptionAtRestWithCustomerKey = "EncryptionAtRestWithCustomerKey", + /** Disk is encrypted at rest with 2 layers of encryption. One of the keys is Customer managed and the other key is Platform managed. */ + EncryptionAtRestWithPlatformAndCustomerKeys = "EncryptionAtRestWithPlatformAndCustomerKeys", +} + +/** + * The type of key used to encrypt the data of the disk. \ + * {@link KnownEncryptionType} can be used interchangeably with EncryptionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **EncryptionAtRestWithPlatformKey**: Disk is encrypted at rest with Platform managed key. It is the default encryption type. This is not a valid encryption type for disk encryption sets. \ + * **EncryptionAtRestWithCustomerKey**: Disk is encrypted at rest with Customer managed key that can be changed and revoked by a customer. \ + * **EncryptionAtRestWithPlatformAndCustomerKeys**: Disk is encrypted at rest with 2 layers of encryption. One of the keys is Customer managed and the other key is Platform managed. + */ +export type EncryptionType = string; + +export function shareInfoElementArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return shareInfoElementDeserializer(item); + }); +} + +/** model interface ShareInfoElement */ +export interface ShareInfoElement { + /** A relative URI containing the ID of the VM that has the disk attached. */ + readonly vmUri?: string; +} + +export function shareInfoElementDeserializer(item: any): ShareInfoElement { + return { + vmUri: item["vmUri"], + }; +} + +/** Policy for accessing the disk via network. */ +export enum KnownNetworkAccessPolicy { + /** The disk can be exported or uploaded to from any network. */ + AllowAll = "AllowAll", + /** The disk can be exported or uploaded to using a DiskAccess resource's private endpoints. */ + AllowPrivate = "AllowPrivate", + /** The disk cannot be exported. */ + DenyAll = "DenyAll", +} + +/** + * Policy for accessing the disk via network. \ + * {@link KnownNetworkAccessPolicy} can be used interchangeably with NetworkAccessPolicy, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AllowAll**: The disk can be exported or uploaded to from any network. \ + * **AllowPrivate**: The disk can be exported or uploaded to using a DiskAccess resource's private endpoints. \ + * **DenyAll**: The disk cannot be exported. + */ +export type NetworkAccessPolicy = string; + +/** Properties of the disk for which update is pending. */ +export interface PropertyUpdatesInProgress { + /** The target performance tier of the disk if a tier change operation is in progress. */ + targetTier?: string; +} + +export function propertyUpdatesInProgressDeserializer( + item: any, +): PropertyUpdatesInProgress { + return { + targetTier: item["targetTier"], + }; +} + +/** Contains the security related information for the resource. */ +export interface DiskSecurityProfile { + /** Specifies the SecurityType of the VM. Applicable for OS disks only. */ + securityType?: DiskSecurityTypes; + /** ResourceId of the disk encryption set associated to Confidential VM supported disk encrypted with customer managed key */ + secureVMDiskEncryptionSetId?: string; +} + +export function diskSecurityProfileSerializer(item: DiskSecurityProfile): any { + return { + securityType: item["securityType"], + secureVMDiskEncryptionSetId: item["secureVMDiskEncryptionSetId"], + }; +} + +export function diskSecurityProfileDeserializer( + item: any, +): DiskSecurityProfile { + return { + securityType: item["securityType"], + secureVMDiskEncryptionSetId: item["secureVMDiskEncryptionSetId"], + }; +} + +/** Specifies the SecurityType of the VM. Applicable for OS disks only. */ +export enum KnownDiskSecurityTypes { + /** Trusted Launch provides security features such as secure boot and virtual Trusted Platform Module (vTPM) */ + TrustedLaunch = "TrustedLaunch", + /** Indicates Confidential VM disk with only VM guest state encrypted */ + ConfidentialVMVmguestStateOnlyEncryptedWithPlatformKey = "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey", + /** Indicates Confidential VM disk with both OS disk and VM guest state encrypted with a platform managed key */ + ConfidentialVMDiskEncryptedWithPlatformKey = "ConfidentialVM_DiskEncryptedWithPlatformKey", + /** Indicates Confidential VM disk with both OS disk and VM guest state encrypted with a customer managed key */ + ConfidentialVMDiskEncryptedWithCustomerKey = "ConfidentialVM_DiskEncryptedWithCustomerKey", + /** Indicates Confidential VM disk with a ephemeral vTPM. vTPM state is not persisted across VM reboots. */ + ConfidentialVMNonPersistedTPM = "ConfidentialVM_NonPersistedTPM", +} + +/** + * Specifies the SecurityType of the VM. Applicable for OS disks only. \ + * {@link KnownDiskSecurityTypes} can be used interchangeably with DiskSecurityTypes, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **TrustedLaunch**: Trusted Launch provides security features such as secure boot and virtual Trusted Platform Module (vTPM) \ + * **ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey**: Indicates Confidential VM disk with only VM guest state encrypted \ + * **ConfidentialVM_DiskEncryptedWithPlatformKey**: Indicates Confidential VM disk with both OS disk and VM guest state encrypted with a platform managed key \ + * **ConfidentialVM_DiskEncryptedWithCustomerKey**: Indicates Confidential VM disk with both OS disk and VM guest state encrypted with a customer managed key \ + * **ConfidentialVM_NonPersistedTPM**: Indicates Confidential VM disk with a ephemeral vTPM. vTPM state is not persisted across VM reboots. + */ +export type DiskSecurityTypes = string; + +/** Policy for controlling export on the disk. */ +export enum KnownPublicNetworkAccess { + /** You can generate a SAS URI to access the underlying data of the disk publicly on the internet when NetworkAccessPolicy is set to AllowAll. You can access the data via the SAS URI only from your trusted Azure VNET when NetworkAccessPolicy is set to AllowPrivate. */ + Enabled = "Enabled", + /** You cannot access the underlying data of the disk publicly on the internet even when NetworkAccessPolicy is set to AllowAll. You can access the data via the SAS URI only from your trusted Azure VNET when NetworkAccessPolicy is set to AllowPrivate. */ + Disabled = "Disabled", +} + +/** + * Policy for controlling export on the disk. \ + * {@link KnownPublicNetworkAccess} can be used interchangeably with PublicNetworkAccess, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled**: You can generate a SAS URI to access the underlying data of the disk publicly on the internet when NetworkAccessPolicy is set to AllowAll. You can access the data via the SAS URI only from your trusted Azure VNET when NetworkAccessPolicy is set to AllowPrivate. \ + * **Disabled**: You cannot access the underlying data of the disk publicly on the internet even when NetworkAccessPolicy is set to AllowAll. You can access the data via the SAS URI only from your trusted Azure VNET when NetworkAccessPolicy is set to AllowPrivate. + */ +export type PublicNetworkAccess = string; + +/** Additional authentication requirements when exporting or uploading to a disk or snapshot. */ +export enum KnownDataAccessAuthMode { + /** When export/upload URL is used, the system checks if the user has an identity in Azure Active Directory and has necessary permissions to export/upload the data. Please refer to aka.ms/DisksAzureADAuth. */ + AzureActiveDirectory = "AzureActiveDirectory", + /** No additional authentication would be performed when accessing export/upload URL. */ + None = "None", +} + +/** + * Additional authentication requirements when exporting or uploading to a disk or snapshot. \ + * {@link KnownDataAccessAuthMode} can be used interchangeably with DataAccessAuthMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AzureActiveDirectory**: When export\/upload URL is used, the system checks if the user has an identity in Azure Active Directory and has necessary permissions to export\/upload the data. Please refer to aka.ms\/DisksAzureADAuth. \ + * **None**: No additional authentication would be performed when accessing export\/upload URL. + */ +export type DataAccessAuthMode = string; + +/** In the case of an availability or connectivity issue with the data disk, specify the behavior of your VM */ +export interface AvailabilityPolicy { + /** Determines on how to handle disks with slow I/O. */ + actionOnDiskDelay?: AvailabilityPolicyDiskDelay; +} + +export function availabilityPolicySerializer(item: AvailabilityPolicy): any { + return { actionOnDiskDelay: item["actionOnDiskDelay"] }; +} + +export function availabilityPolicyDeserializer(item: any): AvailabilityPolicy { + return { + actionOnDiskDelay: item["actionOnDiskDelay"], + }; +} + +/** Determines on how to handle disks with slow I/O. */ +export enum KnownAvailabilityPolicyDiskDelay { + /** Defaults to behavior without av policy specified, which is VM restart upon slow disk io. */ + None = "None", + /** Upon a disk io failure or slow response, try detaching then reattaching the disk. */ + AutomaticReattach = "AutomaticReattach", +} + +/** + * Determines on how to handle disks with slow I/O. \ + * {@link KnownAvailabilityPolicyDiskDelay} can be used interchangeably with AvailabilityPolicyDiskDelay, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None**: Defaults to behavior without av policy specified, which is VM restart upon slow disk io. \ + * **AutomaticReattach**: Upon a disk io failure or slow response, try detaching then reattaching the disk. + */ +export type AvailabilityPolicyDiskDelay = string; + +/** The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. */ +export interface DiskSku { + /** The sku name. */ + name?: DiskStorageAccountTypes; + /** The sku tier. */ + readonly tier?: string; +} + +export function diskSkuSerializer(item: DiskSku): any { + return { name: item["name"] }; +} + +export function diskSkuDeserializer(item: any): DiskSku { + return { + name: item["name"], + tier: item["tier"], + }; +} + +/** The sku name. */ +export enum KnownDiskStorageAccountTypes { + /** Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent access. */ + StandardLRS = "Standard_LRS", + /** Premium SSD locally redundant storage. Best for production and performance sensitive workloads. */ + PremiumLRS = "Premium_LRS", + /** Standard SSD locally redundant storage. Best for web servers, lightly used enterprise applications and dev/test. */ + StandardSSDLRS = "StandardSSD_LRS", + /** Ultra SSD locally redundant storage. Best for IO-intensive workloads such as SAP HANA, top tier databases (for example, SQL, Oracle), and other transaction-heavy workloads. */ + UltraSSDLRS = "UltraSSD_LRS", + /** Premium SSD zone redundant storage. Best for the production workloads that need storage resiliency against zone failures. */ + PremiumZRS = "Premium_ZRS", + /** Standard SSD zone redundant storage. Best for web servers, lightly used enterprise applications and dev/test that need storage resiliency against zone failures. */ + StandardSSDZRS = "StandardSSD_ZRS", + /** Premium SSD v2 locally redundant storage. Best for production and performance-sensitive workloads that consistently require low latency and high IOPS and throughput. */ + PremiumV2LRS = "PremiumV2_LRS", +} + +/** + * The sku name. \ + * {@link KnownDiskStorageAccountTypes} can be used interchangeably with DiskStorageAccountTypes, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Standard_LRS**: Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent access. \ + * **Premium_LRS**: Premium SSD locally redundant storage. Best for production and performance sensitive workloads. \ + * **StandardSSD_LRS**: Standard SSD locally redundant storage. Best for web servers, lightly used enterprise applications and dev\/test. \ + * **UltraSSD_LRS**: Ultra SSD locally redundant storage. Best for IO-intensive workloads such as SAP HANA, top tier databases (for example, SQL, Oracle), and other transaction-heavy workloads. \ + * **Premium_ZRS**: Premium SSD zone redundant storage. Best for the production workloads that need storage resiliency against zone failures. \ + * **StandardSSD_ZRS**: Standard SSD zone redundant storage. Best for web servers, lightly used enterprise applications and dev\/test that need storage resiliency against zone failures. \ + * **PremiumV2_LRS**: Premium SSD v2 locally redundant storage. Best for production and performance-sensitive workloads that consistently require low latency and high IOPS and throughput. + */ +export type DiskStorageAccountTypes = string; + +/** The complex type of the extended location. */ +export interface ExtendedLocation { + /** The name of the extended location. */ + name?: string; + /** The type of the extended location. */ + type?: ExtendedLocationTypes; +} + +export function extendedLocationSerializer(item: ExtendedLocation): any { + return { name: item["name"], type: item["type"] }; +} + +export function extendedLocationDeserializer(item: any): ExtendedLocation { + return { + name: item["name"], + type: item["type"], + }; +} + +/** The type of extendedLocation. */ +export enum KnownExtendedLocationTypes { + /** EdgeZone */ + EdgeZone = "EdgeZone", +} + +/** + * The type of extendedLocation. \ + * {@link KnownExtendedLocationTypes} can be used interchangeably with ExtendedLocationTypes, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **EdgeZone** + */ +export type ExtendedLocationTypes = 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"], + 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; + +/** An error response from the Compute service. */ +export interface CloudError { + /** Api error. */ + error?: ApiError; +} + +export function cloudErrorDeserializer(item: any): CloudError { + return { + error: !item["error"] ? item["error"] : apiErrorDeserializer(item["error"]), + }; +} + +/** Api error. */ +export interface ApiError { + /** The Api error details */ + details?: ApiErrorBase[]; + /** The Api inner error */ + innererror?: InnerError; + /** The error code. */ + code?: string; + /** The target of the particular error. */ + target?: string; + /** The error message. */ + message?: string; +} + +export function apiErrorDeserializer(item: any): ApiError { + return { + details: !item["details"] + ? item["details"] + : apiErrorBaseArrayDeserializer(item["details"]), + innererror: !item["innererror"] + ? item["innererror"] + : innerErrorDeserializer(item["innererror"]), + code: item["code"], + target: item["target"], + message: item["message"], + }; +} + +export function apiErrorBaseArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return apiErrorBaseDeserializer(item); + }); +} + +/** Api error base. */ +export interface ApiErrorBase { + /** The error code. */ + code?: string; + /** The target of the particular error. */ + target?: string; + /** The error message. */ + message?: string; +} + +export function apiErrorBaseDeserializer(item: any): ApiErrorBase { + return { + code: item["code"], + target: item["target"], + message: item["message"], + }; +} + +/** Inner error details. */ +export interface InnerError { + /** The exception type. */ + exceptiontype?: string; + /** The internal error message or exception dump. */ + errordetail?: string; +} + +export function innerErrorDeserializer(item: any): InnerError { + return { + exceptiontype: item["exceptiontype"], + errordetail: item["errordetail"], + }; +} + +/** Disk update resource. */ +export interface DiskUpdate { + /** Resource tags */ + tags?: Record; + /** The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS. */ + sku?: DiskSku; + /** the Operating System type. */ + osType?: OperatingSystemTypes; + /** If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. */ + diskSizeGB?: number; + /** Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. */ + encryptionSettingsCollection?: EncryptionSettingsCollection; + /** The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. */ + diskIopsReadWrite?: number; + /** The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. */ + diskMBpsReadWrite?: number; + /** The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. */ + diskIopsReadOnly?: number; + /** The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. */ + diskMBpsReadOnly?: number; + /** The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. */ + maxShares?: number; + /** Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. */ + encryption?: Encryption; + /** Policy for accessing the disk via network. */ + networkAccessPolicy?: NetworkAccessPolicy; + /** ARM id of the DiskAccess resource for using private endpoints on disks. */ + diskAccessId?: string; + /** Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. */ + tier?: string; + /** Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. */ + burstingEnabled?: boolean; + /** Purchase plan information to be added on the OS disk */ + purchasePlan?: DiskPurchasePlan; + /** List of supported capabilities to be added on the OS disk. */ + supportedCapabilities?: SupportedCapabilities; + /** Properties of the disk for which update is pending. */ + readonly propertyUpdatesInProgress?: PropertyUpdatesInProgress; + /** Indicates the OS on a disk supports hibernation. */ + supportsHibernation?: boolean; + /** Policy for controlling export on the disk. */ + publicNetworkAccess?: PublicNetworkAccess; + /** Additional authentication requirements when exporting or uploading to a disk or snapshot. */ + dataAccessAuthMode?: DataAccessAuthMode; + /** Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times a day) by detached from one virtual machine and attached to another. This property should not be set for disks that are not detached and attached frequently as it causes the disks to not align with the fault domain of the virtual machine. */ + optimizedForFrequentAttach?: boolean; + /** Determines how platform treats disk failures */ + availabilityPolicy?: AvailabilityPolicy; +} + +export function diskUpdateSerializer(item: DiskUpdate): any { + return { + properties: diskUpdatePropertiesSerializer(item), + tags: item["tags"], + sku: !item["sku"] ? item["sku"] : diskSkuSerializer(item["sku"]), + }; +} + +/** Disk resource update properties. */ +export interface DiskUpdateProperties { + /** the Operating System type. */ + osType?: OperatingSystemTypes; + /** If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. */ + diskSizeGB?: number; + /** Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. */ + encryptionSettingsCollection?: EncryptionSettingsCollection; + /** The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes. */ + diskIopsReadWrite?: number; + /** The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. */ + diskMBpsReadWrite?: number; + /** The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes. */ + diskIopsReadOnly?: number; + /** The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10. */ + diskMBpsReadOnly?: number; + /** The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time. */ + maxShares?: number; + /** Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. */ + encryption?: Encryption; + /** Policy for accessing the disk via network. */ + networkAccessPolicy?: NetworkAccessPolicy; + /** ARM id of the DiskAccess resource for using private endpoints on disks. */ + diskAccessId?: string; + /** Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/en-us/pricing/details/managed-disks/. Does not apply to Ultra disks. */ + tier?: string; + /** Set to true to enable bursting beyond the provisioned performance target of the disk. Bursting is disabled by default. Does not apply to Ultra disks. */ + burstingEnabled?: boolean; + /** Purchase plan information to be added on the OS disk */ + purchasePlan?: DiskPurchasePlan; + /** List of supported capabilities to be added on the OS disk. */ + supportedCapabilities?: SupportedCapabilities; + /** Properties of the disk for which update is pending. */ + readonly propertyUpdatesInProgress?: PropertyUpdatesInProgress; + /** Indicates the OS on a disk supports hibernation. */ + supportsHibernation?: boolean; + /** Policy for controlling export on the disk. */ + publicNetworkAccess?: PublicNetworkAccess; + /** Additional authentication requirements when exporting or uploading to a disk or snapshot. */ + dataAccessAuthMode?: DataAccessAuthMode; + /** Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times a day) by detached from one virtual machine and attached to another. This property should not be set for disks that are not detached and attached frequently as it causes the disks to not align with the fault domain of the virtual machine. */ + optimizedForFrequentAttach?: boolean; + /** Determines how platform treats disk failures */ + availabilityPolicy?: AvailabilityPolicy; +} + +export function diskUpdatePropertiesSerializer( + item: DiskUpdateProperties, +): any { + return { + osType: item["osType"], + diskSizeGB: item["diskSizeGB"], + encryptionSettingsCollection: !item["encryptionSettingsCollection"] + ? item["encryptionSettingsCollection"] + : encryptionSettingsCollectionSerializer( + item["encryptionSettingsCollection"], + ), + diskIOPSReadWrite: item["diskIopsReadWrite"], + diskMBpsReadWrite: item["diskMBpsReadWrite"], + diskIOPSReadOnly: item["diskIopsReadOnly"], + diskMBpsReadOnly: item["diskMBpsReadOnly"], + maxShares: item["maxShares"], + encryption: !item["encryption"] + ? item["encryption"] + : encryptionSerializer(item["encryption"]), + networkAccessPolicy: item["networkAccessPolicy"], + diskAccessId: item["diskAccessId"], + tier: item["tier"], + burstingEnabled: item["burstingEnabled"], + purchasePlan: !item["purchasePlan"] + ? item["purchasePlan"] + : diskPurchasePlanSerializer(item["purchasePlan"]), + supportedCapabilities: !item["supportedCapabilities"] + ? item["supportedCapabilities"] + : supportedCapabilitiesSerializer(item["supportedCapabilities"]), + supportsHibernation: item["supportsHibernation"], + publicNetworkAccess: item["publicNetworkAccess"], + dataAccessAuthMode: item["dataAccessAuthMode"], + optimizedForFrequentAttach: item["optimizedForFrequentAttach"], + availabilityPolicy: !item["availabilityPolicy"] + ? item["availabilityPolicy"] + : availabilityPolicySerializer(item["availabilityPolicy"]), + }; +} + +/** The List Disks operation response. */ +export interface _DiskList { + /** The Disk items on this page */ + value: Disk[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _diskListDeserializer(item: any): _DiskList { + return { + value: diskArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function diskArraySerializer(result: Array): any[] { + return result.map((item) => { + return diskSerializer(item); + }); +} + +export function diskArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return diskDeserializer(item); + }); +} + +/** Data used for requesting a SAS. */ +export interface GrantAccessData { + /** The Access Level, accepted values include None, Read, Write. */ + access: AccessLevel; + /** Time duration in seconds until the SAS access expires. */ + durationInSeconds: number; + /** Set this flag to true to get additional SAS for VM guest state */ + getSecureVMGuestStateSAS?: boolean; + /** Used to specify the file format when making request for SAS on a VHDX file format snapshot */ + fileFormat?: FileFormat; +} + +export function grantAccessDataSerializer(item: GrantAccessData): any { + return { + access: item["access"], + durationInSeconds: item["durationInSeconds"], + getSecureVMGuestStateSAS: item["getSecureVMGuestStateSAS"], + fileFormat: item["fileFormat"], + }; +} + +/** The Access Level, accepted values include None, Read, Write. */ +export enum KnownAccessLevel { + /** None */ + None = "None", + /** Read */ + Read = "Read", + /** Write */ + Write = "Write", +} + +/** + * The Access Level, accepted values include None, Read, Write. \ + * {@link KnownAccessLevel} can be used interchangeably with AccessLevel, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **Read** \ + * **Write** + */ +export type AccessLevel = string; + +/** Used to specify the file format when making request for SAS on a VHDX file format snapshot */ +export enum KnownFileFormat { + /** A VHD file is a disk image file in the Virtual Hard Disk file format. */ + VHD = "VHD", + /** A VHDX file is a disk image file in the Virtual Hard Disk v2 file format. */ + Vhdx = "VHDX", +} + +/** + * Used to specify the file format when making request for SAS on a VHDX file format snapshot \ + * {@link KnownFileFormat} can be used interchangeably with FileFormat, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **VHD**: A VHD file is a disk image file in the Virtual Hard Disk file format. \ + * **VHDX**: A VHDX file is a disk image file in the Virtual Hard Disk v2 file format. + */ +export type FileFormat = string; + +/** A disk access SAS uri. */ +export interface AccessUri { + /** A SAS uri for accessing a disk. */ + readonly accessSAS?: string; + /** A SAS uri for accessing a VM guest state. */ + readonly securityDataAccessSAS?: string; + /** A SAS uri for accessing a VM metadata. */ + readonly securityMetadataAccessSAS?: string; +} + +export function accessUriDeserializer(item: any): AccessUri { + return { + accessSAS: item["accessSAS"], + securityDataAccessSAS: item["securityDataAccessSAS"], + securityMetadataAccessSAS: item["securityMetadataAccessSAS"], + }; +} + +/** disk access resource. */ +export interface DiskAccess extends TrackedResource { + /** The extended location where the disk access will be created. Extended location cannot be changed. */ + extendedLocation?: ExtendedLocation; + /** A readonly collection of private endpoint connections created on the disk. Currently only one endpoint connection is supported. */ + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + /** The disk access resource provisioning state. */ + readonly provisioningState?: string; + /** The time when the disk access was created. */ + readonly timeCreated?: Date; +} + +export function diskAccessSerializer(item: DiskAccess): any { + return { + tags: item["tags"], + location: item["location"], + properties: diskAccessPropertiesSerializer(item), + extendedLocation: !item["extendedLocation"] + ? item["extendedLocation"] + : extendedLocationSerializer(item["extendedLocation"]), + }; +} + +export function diskAccessDeserializer(item: any): DiskAccess { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : diskAccessPropertiesDeserializer(item["properties"])), + extendedLocation: !item["extendedLocation"] + ? item["extendedLocation"] + : extendedLocationDeserializer(item["extendedLocation"]), + }; +} + +/** model interface DiskAccessProperties */ +export interface DiskAccessProperties { + /** A readonly collection of private endpoint connections created on the disk. Currently only one endpoint connection is supported. */ + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + /** The disk access resource provisioning state. */ + readonly provisioningState?: string; + /** The time when the disk access was created. */ + readonly timeCreated?: Date; +} + +export function diskAccessPropertiesSerializer( + item: DiskAccessProperties, +): any { + return item; +} + +export function diskAccessPropertiesDeserializer( + item: any, +): DiskAccessProperties { + return { + privateEndpointConnections: !item["privateEndpointConnections"] + ? item["privateEndpointConnections"] + : privateEndpointConnectionArrayDeserializer( + item["privateEndpointConnections"], + ), + provisioningState: item["provisioningState"], + timeCreated: !item["timeCreated"] + ? item["timeCreated"] + : new Date(item["timeCreated"]), + }; +} + +export function privateEndpointConnectionArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return privateEndpointConnectionSerializer(item); + }); +} + +export function privateEndpointConnectionArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return privateEndpointConnectionDeserializer(item); + }); +} + +/** The Private Endpoint Connection resource. */ +export interface PrivateEndpointConnection extends ProxyResource { + /** The resource of private end point. */ + readonly privateEndpoint?: PrivateEndpoint; + /** A collection of information about the state of the connection between DiskAccess and Virtual Network. */ + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + /** The provisioning state of the private endpoint connection resource. */ + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +export function privateEndpointConnectionSerializer( + item: PrivateEndpointConnection, +): any { + return { properties: privateEndpointConnectionPropertiesSerializer(item) }; +} + +export function privateEndpointConnectionDeserializer( + item: any, +): PrivateEndpointConnection { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : privateEndpointConnectionPropertiesDeserializer(item["properties"])), + }; +} + +/** Properties of the PrivateEndpointConnectProperties. */ +export interface PrivateEndpointConnectionProperties { + /** The resource of private end point. */ + readonly privateEndpoint?: PrivateEndpoint; + /** A collection of information about the state of the connection between DiskAccess and Virtual Network. */ + privateLinkServiceConnectionState: PrivateLinkServiceConnectionState; + /** The provisioning state of the private endpoint connection resource. */ + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +} + +export function privateEndpointConnectionPropertiesSerializer( + item: PrivateEndpointConnectionProperties, +): any { + return { + privateLinkServiceConnectionState: + privateLinkServiceConnectionStateSerializer( + item["privateLinkServiceConnectionState"], + ), + }; +} + +export function privateEndpointConnectionPropertiesDeserializer( + item: any, +): PrivateEndpointConnectionProperties { + return { + privateEndpoint: !item["privateEndpoint"] + ? item["privateEndpoint"] + : privateEndpointDeserializer(item["privateEndpoint"]), + privateLinkServiceConnectionState: + privateLinkServiceConnectionStateDeserializer( + item["privateLinkServiceConnectionState"], + ), + provisioningState: item["provisioningState"], + }; +} + +/** The Private Endpoint resource. */ +export interface PrivateEndpoint { + /** The ARM identifier for Private Endpoint */ + readonly id?: string; +} + +export function privateEndpointDeserializer(item: any): PrivateEndpoint { + return { + id: item["id"], + }; +} + +/** A collection of information about the state of the connection between service consumer and provider. */ +export interface PrivateLinkServiceConnectionState { + /** Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. */ + status?: PrivateEndpointServiceConnectionStatus; + /** The reason for approval/rejection of the connection. */ + description?: string; + /** A message indicating if changes on the service provider require any updates on the consumer. */ + actionsRequired?: string; +} + +export function privateLinkServiceConnectionStateSerializer( + item: PrivateLinkServiceConnectionState, +): any { + return { + status: item["status"], + description: item["description"], + actionsRequired: item["actionsRequired"], + }; +} + +export function privateLinkServiceConnectionStateDeserializer( + item: any, +): PrivateLinkServiceConnectionState { + return { + status: item["status"], + description: item["description"], + actionsRequired: item["actionsRequired"], + }; +} + +/** The private endpoint connection status. */ +export enum KnownPrivateEndpointServiceConnectionStatus { + /** Pending */ + Pending = "Pending", + /** Approved */ + Approved = "Approved", + /** Rejected */ + Rejected = "Rejected", +} + +/** + * The private endpoint connection status. \ + * {@link KnownPrivateEndpointServiceConnectionStatus} can be used interchangeably with PrivateEndpointServiceConnectionStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Pending** \ + * **Approved** \ + * **Rejected** + */ +export type PrivateEndpointServiceConnectionStatus = string; + +/** The current provisioning state. */ +export enum KnownPrivateEndpointConnectionProvisioningState { + /** Succeeded */ + Succeeded = "Succeeded", + /** Creating */ + Creating = "Creating", + /** Deleting */ + Deleting = "Deleting", + /** Failed */ + Failed = "Failed", +} + +/** + * The current provisioning state. \ + * {@link KnownPrivateEndpointConnectionProvisioningState} can be used interchangeably with PrivateEndpointConnectionProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Creating** \ + * **Deleting** \ + * **Failed** + */ +export type PrivateEndpointConnectionProvisioningState = 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"]), + }; +} + +/** Used for updating a disk access resource. */ +export interface DiskAccessUpdate { + /** Resource tags */ + tags?: Record; +} + +export function diskAccessUpdateSerializer(item: DiskAccessUpdate): any { + return { tags: item["tags"] }; +} + +/** The List disk access operation response. */ +export interface _DiskAccessList { + /** The DiskAccess items on this page */ + value: DiskAccess[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _diskAccessListDeserializer(item: any): _DiskAccessList { + return { + value: diskAccessArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function diskAccessArraySerializer(result: Array): any[] { + return result.map((item) => { + return diskAccessSerializer(item); + }); +} + +export function diskAccessArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return diskAccessDeserializer(item); + }); +} + +/** A list of private link resources */ +export interface PrivateLinkResourceListResult { + /** Array of private link resources */ + value?: PrivateLinkResource[]; +} + +export function privateLinkResourceListResultDeserializer( + item: any, +): PrivateLinkResourceListResult { + return { + value: !item["value"] + ? item["value"] + : privateLinkResourceArrayDeserializer(item["value"]), + }; +} + +export function privateLinkResourceArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return privateLinkResourceDeserializer(item); + }); +} + +/** A private link resource */ +export interface PrivateLinkResource { + /** private link resource Id */ + readonly id?: string; + /** private link resource name */ + readonly name?: string; + /** private link resource type */ + readonly type?: string; + /** The private link resource group id. */ + readonly groupId?: string; + /** The private link resource required member names. */ + readonly requiredMembers?: string[]; + /** The private link resource DNS zone name. */ + requiredZoneNames?: string[]; +} + +export function privateLinkResourceDeserializer( + item: any, +): PrivateLinkResource { + return { + ...(!item["properties"] + ? item["properties"] + : privateLinkResourcePropertiesDeserializer(item["properties"])), + id: item["id"], + name: item["name"], + type: item["type"], + }; +} + +/** Properties of a private link resource. */ +export interface PrivateLinkResourceProperties { + /** The private link resource group id. */ + readonly groupId?: string; + /** The private link resource required member names. */ + readonly requiredMembers?: string[]; + /** The private link resource DNS zone name. */ + requiredZoneNames?: string[]; +} + +export function privateLinkResourcePropertiesDeserializer( + item: any, +): PrivateLinkResourceProperties { + return { + groupId: item["groupId"], + requiredMembers: !item["requiredMembers"] + ? item["requiredMembers"] + : item["requiredMembers"].map((p: any) => { + return p; + }), + requiredZoneNames: !item["requiredZoneNames"] + ? item["requiredZoneNames"] + : item["requiredZoneNames"].map((p: any) => { + return p; + }), + }; +} + +/** A list of private link resources */ +export interface _PrivateEndpointConnectionListResult { + /** The PrivateEndpointConnection items on this page */ + value: PrivateEndpointConnection[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _privateEndpointConnectionListResultDeserializer( + item: any, +): _PrivateEndpointConnectionListResult { + return { + value: privateEndpointConnectionArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +/** disk encryption set resource. */ +export interface DiskEncryptionSet extends TrackedResource { + /** The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. */ + identity?: EncryptionSetIdentity; + /** The type of key used to encrypt the data of the disk. */ + encryptionType?: DiskEncryptionSetType; + /** The key vault key which is currently used by this disk encryption set. */ + activeKey?: KeyForDiskEncryptionSet; + /** A readonly collection of key vault keys previously used by this disk encryption set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. */ + readonly previousKeys?: KeyForDiskEncryptionSet[]; + /** The disk encryption set provisioning state. */ + readonly provisioningState?: string; + /** Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. */ + rotationToLatestKeyVersionEnabled?: boolean; + /** The time when the active key of this disk encryption set was updated. */ + readonly lastKeyRotationTimestamp?: Date; + /** The error that was encountered during auto-key rotation. If an error is present, then auto-key rotation will not be attempted until the error on this disk encryption set is fixed. */ + readonly autoKeyRotationError?: ApiError; + /** Multi-tenant application client id to access key vault in a different tenant. Setting the value to 'None' will clear the property. */ + federatedClientId?: string; +} + +export function diskEncryptionSetSerializer(item: DiskEncryptionSet): any { + return { + tags: item["tags"], + location: item["location"], + properties: encryptionSetPropertiesSerializer(item), + identity: !item["identity"] + ? item["identity"] + : encryptionSetIdentitySerializer(item["identity"]), + }; +} + +export function diskEncryptionSetDeserializer(item: any): DiskEncryptionSet { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : encryptionSetPropertiesDeserializer(item["properties"])), + identity: !item["identity"] + ? item["identity"] + : encryptionSetIdentityDeserializer(item["identity"]), + }; +} + +/** model interface EncryptionSetProperties */ +export interface EncryptionSetProperties { + /** The type of key used to encrypt the data of the disk. */ + encryptionType?: DiskEncryptionSetType; + /** The key vault key which is currently used by this disk encryption set. */ + activeKey?: KeyForDiskEncryptionSet; + /** A readonly collection of key vault keys previously used by this disk encryption set while a key rotation is in progress. It will be empty if there is no ongoing key rotation. */ + readonly previousKeys?: KeyForDiskEncryptionSet[]; + /** The disk encryption set provisioning state. */ + readonly provisioningState?: string; + /** Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. */ + rotationToLatestKeyVersionEnabled?: boolean; + /** The time when the active key of this disk encryption set was updated. */ + readonly lastKeyRotationTimestamp?: Date; + /** The error that was encountered during auto-key rotation. If an error is present, then auto-key rotation will not be attempted until the error on this disk encryption set is fixed. */ + readonly autoKeyRotationError?: ApiError; + /** Multi-tenant application client id to access key vault in a different tenant. Setting the value to 'None' will clear the property. */ + federatedClientId?: string; +} + +export function encryptionSetPropertiesSerializer( + item: EncryptionSetProperties, +): any { + return { + encryptionType: item["encryptionType"], + activeKey: !item["activeKey"] + ? item["activeKey"] + : keyForDiskEncryptionSetSerializer(item["activeKey"]), + rotationToLatestKeyVersionEnabled: + item["rotationToLatestKeyVersionEnabled"], + federatedClientId: item["federatedClientId"], + }; +} + +export function encryptionSetPropertiesDeserializer( + item: any, +): EncryptionSetProperties { + return { + encryptionType: item["encryptionType"], + activeKey: !item["activeKey"] + ? item["activeKey"] + : keyForDiskEncryptionSetDeserializer(item["activeKey"]), + previousKeys: !item["previousKeys"] + ? item["previousKeys"] + : keyForDiskEncryptionSetArrayDeserializer(item["previousKeys"]), + provisioningState: item["provisioningState"], + rotationToLatestKeyVersionEnabled: + item["rotationToLatestKeyVersionEnabled"], + lastKeyRotationTimestamp: !item["lastKeyRotationTimestamp"] + ? item["lastKeyRotationTimestamp"] + : new Date(item["lastKeyRotationTimestamp"]), + autoKeyRotationError: !item["autoKeyRotationError"] + ? item["autoKeyRotationError"] + : apiErrorDeserializer(item["autoKeyRotationError"]), + federatedClientId: item["federatedClientId"], + }; +} + +/** The type of key used to encrypt the data of the disk. */ +export enum KnownDiskEncryptionSetType { + /** Resource using diskEncryptionSet would be encrypted at rest with Customer managed key that can be changed and revoked by a customer. */ + EncryptionAtRestWithCustomerKey = "EncryptionAtRestWithCustomerKey", + /** Resource using diskEncryptionSet would be encrypted at rest with two layers of encryption. One of the keys is Customer managed and the other key is Platform managed. */ + EncryptionAtRestWithPlatformAndCustomerKeys = "EncryptionAtRestWithPlatformAndCustomerKeys", + /** Confidential VM supported disk and VM guest state would be encrypted with customer managed key. */ + ConfidentialVmEncryptedWithCustomerKey = "ConfidentialVmEncryptedWithCustomerKey", +} + +/** + * The type of key used to encrypt the data of the disk. \ + * {@link KnownDiskEncryptionSetType} can be used interchangeably with DiskEncryptionSetType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **EncryptionAtRestWithCustomerKey**: Resource using diskEncryptionSet would be encrypted at rest with Customer managed key that can be changed and revoked by a customer. \ + * **EncryptionAtRestWithPlatformAndCustomerKeys**: Resource using diskEncryptionSet would be encrypted at rest with two layers of encryption. One of the keys is Customer managed and the other key is Platform managed. \ + * **ConfidentialVmEncryptedWithCustomerKey**: Confidential VM supported disk and VM guest state would be encrypted with customer managed key. + */ +export type DiskEncryptionSetType = string; + +/** Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots */ +export interface KeyForDiskEncryptionSet { + /** Resource id of the KeyVault containing the key or secret. This property is optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption Set subscription. */ + sourceVault?: SourceVault; + /** Fully versioned Key Url pointing to a key in KeyVault. Version segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. */ + keyUrl: string; +} + +export function keyForDiskEncryptionSetSerializer( + item: KeyForDiskEncryptionSet, +): any { + return { + sourceVault: !item["sourceVault"] + ? item["sourceVault"] + : sourceVaultSerializer(item["sourceVault"]), + keyUrl: item["keyUrl"], + }; +} + +export function keyForDiskEncryptionSetDeserializer( + item: any, +): KeyForDiskEncryptionSet { + return { + sourceVault: !item["sourceVault"] + ? item["sourceVault"] + : sourceVaultDeserializer(item["sourceVault"]), + keyUrl: item["keyUrl"], + }; +} + +export function keyForDiskEncryptionSetArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return keyForDiskEncryptionSetSerializer(item); + }); +} + +export function keyForDiskEncryptionSetArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return keyForDiskEncryptionSetDeserializer(item); + }); +} + +/** The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. */ +export interface EncryptionSetIdentity { + /** The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys. */ + type?: DiskEncryptionSetIdentityType; + /** The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) identity */ + readonly principalId?: string; + /** The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a systemAssigned(implicit) identity */ + readonly tenantId?: string; + /** The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ + userAssignedIdentities?: Record; +} + +export function encryptionSetIdentitySerializer( + item: EncryptionSetIdentity, +): any { + return { + type: item["type"], + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : userAssignedIdentitiesValueRecordSerializer( + item["userAssignedIdentities"], + ), + }; +} + +export function encryptionSetIdentityDeserializer( + item: any, +): EncryptionSetIdentity { + return { + type: item["type"], + principalId: item["principalId"], + tenantId: item["tenantId"], + userAssignedIdentities: !item["userAssignedIdentities"] + ? item["userAssignedIdentities"] + : userAssignedIdentitiesValueRecordDeserializer( + item["userAssignedIdentities"], + ), + }; +} + +/** The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys. */ +export enum KnownDiskEncryptionSetIdentityType { + /** SystemAssigned */ + SystemAssigned = "SystemAssigned", + /** UserAssigned */ + UserAssigned = "UserAssigned", + /** SystemAssigned, UserAssigned */ + SystemAssignedUserAssigned = "SystemAssigned, UserAssigned", + /** None */ + None = "None", +} + +/** + * The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys. \ + * {@link KnownDiskEncryptionSetIdentityType} can be used interchangeably with DiskEncryptionSetIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **SystemAssigned** \ + * **UserAssigned** \ + * **SystemAssigned, UserAssigned** \ + * **None** + */ +export type DiskEncryptionSetIdentityType = string; + +export function userAssignedIdentitiesValueRecordSerializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : userAssignedIdentitiesValueSerializer(item[key]); + }); + return result; +} + +export function userAssignedIdentitiesValueRecordDeserializer( + item: Record, +): Record { + const result: Record = {}; + Object.keys(item).map((key) => { + result[key] = !item[key] + ? item[key] + : userAssignedIdentitiesValueDeserializer(item[key]); + }); + return result; +} + +/** model interface UserAssignedIdentitiesValue */ +export interface UserAssignedIdentitiesValue { + /** The principal id of user assigned identity. */ + readonly principalId?: string; + /** The client id of user assigned identity. */ + readonly clientId?: string; +} + +export function userAssignedIdentitiesValueSerializer( + item: UserAssignedIdentitiesValue, +): any { + return item; +} + +export function userAssignedIdentitiesValueDeserializer( + item: any, +): UserAssignedIdentitiesValue { + return { + principalId: item["principalId"], + clientId: item["clientId"], + }; +} + +/** disk encryption set update resource. */ +export interface DiskEncryptionSetUpdate { + /** Resource tags */ + tags?: Record; + /** The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks. */ + identity?: EncryptionSetIdentity; + /** The type of key used to encrypt the data of the disk. */ + encryptionType?: DiskEncryptionSetType; + /** Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots */ + activeKey?: KeyForDiskEncryptionSet; + /** Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. */ + rotationToLatestKeyVersionEnabled?: boolean; + /** Multi-tenant application client id to access key vault in a different tenant. Setting the value to 'None' will clear the property. */ + federatedClientId?: string; +} + +export function diskEncryptionSetUpdateSerializer( + item: DiskEncryptionSetUpdate, +): any { + return { + properties: diskEncryptionSetUpdatePropertiesSerializer(item), + tags: item["tags"], + identity: !item["identity"] + ? item["identity"] + : encryptionSetIdentitySerializer(item["identity"]), + }; +} + +/** disk encryption set resource update properties. */ +export interface DiskEncryptionSetUpdateProperties { + /** The type of key used to encrypt the data of the disk. */ + encryptionType?: DiskEncryptionSetType; + /** Key Vault Key Url to be used for server side encryption of Managed Disks and Snapshots */ + activeKey?: KeyForDiskEncryptionSet; + /** Set this flag to true to enable auto-updating of this disk encryption set to the latest key version. */ + rotationToLatestKeyVersionEnabled?: boolean; + /** Multi-tenant application client id to access key vault in a different tenant. Setting the value to 'None' will clear the property. */ + federatedClientId?: string; +} + +export function diskEncryptionSetUpdatePropertiesSerializer( + item: DiskEncryptionSetUpdateProperties, +): any { + return { + encryptionType: item["encryptionType"], + activeKey: !item["activeKey"] + ? item["activeKey"] + : keyForDiskEncryptionSetSerializer(item["activeKey"]), + rotationToLatestKeyVersionEnabled: + item["rotationToLatestKeyVersionEnabled"], + federatedClientId: item["federatedClientId"], + }; +} + +/** The List disk encryption set operation response. */ +export interface _DiskEncryptionSetList { + /** The DiskEncryptionSet items on this page */ + value: DiskEncryptionSet[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _diskEncryptionSetListDeserializer( + item: any, +): _DiskEncryptionSetList { + return { + value: diskEncryptionSetArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function diskEncryptionSetArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return diskEncryptionSetSerializer(item); + }); +} + +export function diskEncryptionSetArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return diskEncryptionSetDeserializer(item); + }); +} + +/** The List resources which are encrypted with the disk encryption set. */ +export interface _ResourceUriList { + /** A list of IDs or Owner IDs of resources which are encrypted with the disk encryption set. */ + value: string[]; + /** The uri to fetch the next page of encrypted resources. Call ListNext() with this to fetch the next page of encrypted resources. */ + nextLink?: string; +} + +export function _resourceUriListDeserializer(item: any): _ResourceUriList { + return { + value: item["value"].map((p: any) => { + return p; + }), + nextLink: item["nextLink"], + }; +} + +/** Snapshot resource. */ +export interface Snapshot extends TrackedResource { + /** Unused. Always Null. */ + readonly managedBy?: string; + /** The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot */ + sku?: SnapshotSku; + /** The extended location where the snapshot will be created. Extended location cannot be changed. */ + extendedLocation?: ExtendedLocation; + /** The time when the snapshot was created. */ + readonly timeCreated?: Date; + /** The Operating System type. */ + osType?: OperatingSystemTypes; + /** The hypervisor generation of the Virtual Machine. Applicable to OS disks only. */ + hyperVGeneration?: HyperVGeneration; + /** Purchase plan information for the image from which the source disk for the snapshot was originally created. */ + purchasePlan?: DiskPurchasePlan; + /** List of supported capabilities for the image from which the source disk from the snapshot was originally created. */ + supportedCapabilities?: SupportedCapabilities; + /** Disk source information. CreationData information cannot be changed after the disk has been created. */ + creationData?: CreationData; + /** If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. */ + diskSizeGB?: number; + /** The size of the disk in bytes. This field is read only. */ + readonly diskSizeBytes?: number; + /** The state of the snapshot. */ + readonly diskState?: DiskState; + /** Unique Guid identifying the resource. */ + readonly uniqueId?: string; + /** Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. */ + encryptionSettingsCollection?: EncryptionSettingsCollection; + /** The disk provisioning state. */ + readonly provisioningState?: string; + /** Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. */ + incremental?: boolean; + /** Incremental snapshots for a disk share an incremental snapshot family id. The Get Page Range Diff API can only be called on incremental snapshots with the same family id. */ + readonly incrementalSnapshotFamilyId?: string; + /** Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. */ + encryption?: Encryption; + /** Policy for accessing the disk via network. */ + networkAccessPolicy?: NetworkAccessPolicy; + /** ARM id of the DiskAccess resource for using private endpoints on disks. */ + diskAccessId?: string; + /** Contains the security related information for the resource. */ + securityProfile?: DiskSecurityProfile; + /** Indicates the OS on a snapshot supports hibernation. */ + supportsHibernation?: boolean; + /** Policy for controlling export on the disk. */ + publicNetworkAccess?: PublicNetworkAccess; + /** Percentage complete for the background copy when a resource is created via the CopyStart operation. */ + completionPercent?: number; + /** Indicates the error details if the background copy of a resource created via the CopyStart operation fails. */ + copyCompletionError?: CopyCompletionError; + /** Additional authentication requirements when exporting or uploading to a disk or snapshot. */ + dataAccessAuthMode?: DataAccessAuthMode; + /** The state of snapshot which determines the access availability of the snapshot. */ + readonly snapshotAccessState?: SnapshotAccessState; +} + +export function snapshotSerializer(item: Snapshot): any { + return { + tags: item["tags"], + location: item["location"], + properties: snapshotPropertiesSerializer(item), + sku: !item["sku"] ? item["sku"] : snapshotSkuSerializer(item["sku"]), + extendedLocation: !item["extendedLocation"] + ? item["extendedLocation"] + : extendedLocationSerializer(item["extendedLocation"]), + }; +} + +export function snapshotDeserializer(item: any): Snapshot { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : snapshotPropertiesDeserializer(item["properties"])), + managedBy: item["managedBy"], + sku: !item["sku"] ? item["sku"] : snapshotSkuDeserializer(item["sku"]), + extendedLocation: !item["extendedLocation"] + ? item["extendedLocation"] + : extendedLocationDeserializer(item["extendedLocation"]), + }; +} + +/** Snapshot resource properties. */ +export interface SnapshotProperties { + /** The time when the snapshot was created. */ + readonly timeCreated?: Date; + /** The Operating System type. */ + osType?: OperatingSystemTypes; + /** The hypervisor generation of the Virtual Machine. Applicable to OS disks only. */ + hyperVGeneration?: HyperVGeneration; + /** Purchase plan information for the image from which the source disk for the snapshot was originally created. */ + purchasePlan?: DiskPurchasePlan; + /** List of supported capabilities for the image from which the source disk from the snapshot was originally created. */ + supportedCapabilities?: SupportedCapabilities; + /** Disk source information. CreationData information cannot be changed after the disk has been created. */ + creationData?: CreationData; + /** If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. */ + diskSizeGB?: number; + /** The size of the disk in bytes. This field is read only. */ + readonly diskSizeBytes?: number; + /** The state of the snapshot. */ + readonly diskState?: DiskState; + /** Unique Guid identifying the resource. */ + readonly uniqueId?: string; + /** Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. */ + encryptionSettingsCollection?: EncryptionSettingsCollection; + /** The disk provisioning state. */ + readonly provisioningState?: string; + /** Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed. */ + incremental?: boolean; + /** Incremental snapshots for a disk share an incremental snapshot family id. The Get Page Range Diff API can only be called on incremental snapshots with the same family id. */ + readonly incrementalSnapshotFamilyId?: string; + /** Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. */ + encryption?: Encryption; + /** Policy for accessing the disk via network. */ + networkAccessPolicy?: NetworkAccessPolicy; + /** ARM id of the DiskAccess resource for using private endpoints on disks. */ + diskAccessId?: string; + /** Contains the security related information for the resource. */ + securityProfile?: DiskSecurityProfile; + /** Indicates the OS on a snapshot supports hibernation. */ + supportsHibernation?: boolean; + /** Policy for controlling export on the disk. */ + publicNetworkAccess?: PublicNetworkAccess; + /** Percentage complete for the background copy when a resource is created via the CopyStart operation. */ + completionPercent?: number; + /** Indicates the error details if the background copy of a resource created via the CopyStart operation fails. */ + copyCompletionError?: CopyCompletionError; + /** Additional authentication requirements when exporting or uploading to a disk or snapshot. */ + dataAccessAuthMode?: DataAccessAuthMode; + /** The state of snapshot which determines the access availability of the snapshot. */ + readonly snapshotAccessState?: SnapshotAccessState; +} + +export function snapshotPropertiesSerializer(item: SnapshotProperties): any { + return { + osType: item["osType"], + hyperVGeneration: item["hyperVGeneration"], + purchasePlan: !item["purchasePlan"] + ? item["purchasePlan"] + : diskPurchasePlanSerializer(item["purchasePlan"]), + supportedCapabilities: !item["supportedCapabilities"] + ? item["supportedCapabilities"] + : supportedCapabilitiesSerializer(item["supportedCapabilities"]), + creationData: !item["creationData"] + ? item["creationData"] + : creationDataSerializer(item["creationData"]), + diskSizeGB: item["diskSizeGB"], + encryptionSettingsCollection: !item["encryptionSettingsCollection"] + ? item["encryptionSettingsCollection"] + : encryptionSettingsCollectionSerializer( + item["encryptionSettingsCollection"], + ), + incremental: item["incremental"], + encryption: !item["encryption"] + ? item["encryption"] + : encryptionSerializer(item["encryption"]), + networkAccessPolicy: item["networkAccessPolicy"], + diskAccessId: item["diskAccessId"], + securityProfile: !item["securityProfile"] + ? item["securityProfile"] + : diskSecurityProfileSerializer(item["securityProfile"]), + supportsHibernation: item["supportsHibernation"], + publicNetworkAccess: item["publicNetworkAccess"], + completionPercent: item["completionPercent"], + copyCompletionError: !item["copyCompletionError"] + ? item["copyCompletionError"] + : copyCompletionErrorSerializer(item["copyCompletionError"]), + dataAccessAuthMode: item["dataAccessAuthMode"], + }; +} + +export function snapshotPropertiesDeserializer(item: any): SnapshotProperties { + return { + timeCreated: !item["timeCreated"] + ? item["timeCreated"] + : new Date(item["timeCreated"]), + osType: item["osType"], + hyperVGeneration: item["hyperVGeneration"], + purchasePlan: !item["purchasePlan"] + ? item["purchasePlan"] + : diskPurchasePlanDeserializer(item["purchasePlan"]), + supportedCapabilities: !item["supportedCapabilities"] + ? item["supportedCapabilities"] + : supportedCapabilitiesDeserializer(item["supportedCapabilities"]), + creationData: creationDataDeserializer(item["creationData"]), + diskSizeGB: item["diskSizeGB"], + diskSizeBytes: item["diskSizeBytes"], + diskState: item["diskState"], + uniqueId: item["uniqueId"], + encryptionSettingsCollection: !item["encryptionSettingsCollection"] + ? item["encryptionSettingsCollection"] + : encryptionSettingsCollectionDeserializer( + item["encryptionSettingsCollection"], + ), + provisioningState: item["provisioningState"], + incremental: item["incremental"], + incrementalSnapshotFamilyId: item["incrementalSnapshotFamilyId"], + encryption: !item["encryption"] + ? item["encryption"] + : encryptionDeserializer(item["encryption"]), + networkAccessPolicy: item["networkAccessPolicy"], + diskAccessId: item["diskAccessId"], + securityProfile: !item["securityProfile"] + ? item["securityProfile"] + : diskSecurityProfileDeserializer(item["securityProfile"]), + supportsHibernation: item["supportsHibernation"], + publicNetworkAccess: item["publicNetworkAccess"], + completionPercent: item["completionPercent"], + copyCompletionError: !item["copyCompletionError"] + ? item["copyCompletionError"] + : copyCompletionErrorDeserializer(item["copyCompletionError"]), + dataAccessAuthMode: item["dataAccessAuthMode"], + snapshotAccessState: item["snapshotAccessState"], + }; +} + +/** Indicates the error details if the background copy of a resource created via the CopyStart operation fails. */ +export interface CopyCompletionError { + /** Indicates the error code if the background copy of a resource created via the CopyStart operation fails. */ + errorCode: CopyCompletionErrorReason; + /** Indicates the error message if the background copy of a resource created via the CopyStart operation fails. */ + errorMessage: string; +} + +export function copyCompletionErrorSerializer(item: CopyCompletionError): any { + return { errorCode: item["errorCode"], errorMessage: item["errorMessage"] }; +} + +export function copyCompletionErrorDeserializer( + item: any, +): CopyCompletionError { + return { + errorCode: item["errorCode"], + errorMessage: item["errorMessage"], + }; +} + +/** Indicates the error code if the background copy of a resource created via the CopyStart operation fails. */ +export enum KnownCopyCompletionErrorReason { + /** Indicates that the source snapshot was deleted while the background copy of the resource created via CopyStart operation was in progress. */ + CopySourceNotFound = "CopySourceNotFound", +} + +/** + * Indicates the error code if the background copy of a resource created via the CopyStart operation fails. \ + * {@link KnownCopyCompletionErrorReason} can be used interchangeably with CopyCompletionErrorReason, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **CopySourceNotFound**: Indicates that the source snapshot was deleted while the background copy of the resource created via CopyStart operation was in progress. + */ +export type CopyCompletionErrorReason = string; + +/** The state of snapshot which determines the access availability of the snapshot. */ +export enum KnownSnapshotAccessState { + /** Default value. */ + Unknown = "Unknown", + /** The snapshot cannot be used for restore, copy or download to offline. */ + Pending = "Pending", + /** The snapshot can be used for restore, copy to different region, and download to offline. */ + Available = "Available", + /** The snapshot can be used for restoring disks with fast performance but cannot be copied or downloaded. */ + InstantAccess = "InstantAccess", + /** The snapshot can be used for restoring disks with fast performance, copied and downloaded. */ + AvailableWithInstantAccess = "AvailableWithInstantAccess", +} + +/** + * The state of snapshot which determines the access availability of the snapshot. \ + * {@link KnownSnapshotAccessState} can be used interchangeably with SnapshotAccessState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown**: Default value. \ + * **Pending**: The snapshot cannot be used for restore, copy or download to offline. \ + * **Available**: The snapshot can be used for restore, copy to different region, and download to offline. \ + * **InstantAccess**: The snapshot can be used for restoring disks with fast performance but cannot be copied or downloaded. \ + * **AvailableWithInstantAccess**: The snapshot can be used for restoring disks with fast performance, copied and downloaded. + */ +export type SnapshotAccessState = string; + +/** The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot */ +export interface SnapshotSku { + /** The sku name. */ + name?: SnapshotStorageAccountTypes; + /** The sku tier. */ + readonly tier?: string; +} + +export function snapshotSkuSerializer(item: SnapshotSku): any { + return { name: item["name"] }; +} + +export function snapshotSkuDeserializer(item: any): SnapshotSku { + return { + name: item["name"], + tier: item["tier"], + }; +} + +/** The sku name. */ +export enum KnownSnapshotStorageAccountTypes { + /** Standard HDD locally redundant storage */ + StandardLRS = "Standard_LRS", + /** Premium SSD locally redundant storage */ + PremiumLRS = "Premium_LRS", + /** Standard zone redundant storage */ + StandardZRS = "Standard_ZRS", +} + +/** + * The sku name. \ + * {@link KnownSnapshotStorageAccountTypes} can be used interchangeably with SnapshotStorageAccountTypes, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Standard_LRS**: Standard HDD locally redundant storage \ + * **Premium_LRS**: Premium SSD locally redundant storage \ + * **Standard_ZRS**: Standard zone redundant storage + */ +export type SnapshotStorageAccountTypes = string; + +/** Snapshot update resource. */ +export interface SnapshotUpdate { + /** Resource tags */ + tags?: Record; + /** The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot */ + sku?: SnapshotSku; + /** the Operating System type. */ + osType?: OperatingSystemTypes; + /** If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. */ + diskSizeGB?: number; + /** Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. */ + encryptionSettingsCollection?: EncryptionSettingsCollection; + /** Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. */ + encryption?: Encryption; + /** Policy for accessing the disk via network. */ + networkAccessPolicy?: NetworkAccessPolicy; + /** ARM id of the DiskAccess resource for using private endpoints on disks. */ + diskAccessId?: string; + /** Indicates the OS on a snapshot supports hibernation. */ + supportsHibernation?: boolean; + /** Policy for controlling export on the disk. */ + publicNetworkAccess?: PublicNetworkAccess; + /** Additional authentication requirements when exporting or uploading to a disk or snapshot. */ + dataAccessAuthMode?: DataAccessAuthMode; + /** List of supported capabilities for the image from which the OS disk was created. */ + supportedCapabilities?: SupportedCapabilities; + /** The state of snapshot which determines the access availability of the snapshot. */ + readonly snapshotAccessState?: SnapshotAccessState; +} + +export function snapshotUpdateSerializer(item: SnapshotUpdate): any { + return { + properties: snapshotUpdatePropertiesSerializer(item), + tags: item["tags"], + sku: !item["sku"] ? item["sku"] : snapshotSkuSerializer(item["sku"]), + }; +} + +/** Snapshot resource update properties. */ +export interface SnapshotUpdateProperties { + /** the Operating System type. */ + osType?: OperatingSystemTypes; + /** If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. */ + diskSizeGB?: number; + /** Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot. */ + encryptionSettingsCollection?: EncryptionSettingsCollection; + /** Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. */ + encryption?: Encryption; + /** Policy for accessing the disk via network. */ + networkAccessPolicy?: NetworkAccessPolicy; + /** ARM id of the DiskAccess resource for using private endpoints on disks. */ + diskAccessId?: string; + /** Indicates the OS on a snapshot supports hibernation. */ + supportsHibernation?: boolean; + /** Policy for controlling export on the disk. */ + publicNetworkAccess?: PublicNetworkAccess; + /** Additional authentication requirements when exporting or uploading to a disk or snapshot. */ + dataAccessAuthMode?: DataAccessAuthMode; + /** List of supported capabilities for the image from which the OS disk was created. */ + supportedCapabilities?: SupportedCapabilities; + /** The state of snapshot which determines the access availability of the snapshot. */ + readonly snapshotAccessState?: SnapshotAccessState; +} + +export function snapshotUpdatePropertiesSerializer( + item: SnapshotUpdateProperties, +): any { + return { + osType: item["osType"], + diskSizeGB: item["diskSizeGB"], + encryptionSettingsCollection: !item["encryptionSettingsCollection"] + ? item["encryptionSettingsCollection"] + : encryptionSettingsCollectionSerializer( + item["encryptionSettingsCollection"], + ), + encryption: !item["encryption"] + ? item["encryption"] + : encryptionSerializer(item["encryption"]), + networkAccessPolicy: item["networkAccessPolicy"], + diskAccessId: item["diskAccessId"], + supportsHibernation: item["supportsHibernation"], + publicNetworkAccess: item["publicNetworkAccess"], + dataAccessAuthMode: item["dataAccessAuthMode"], + supportedCapabilities: !item["supportedCapabilities"] + ? item["supportedCapabilities"] + : supportedCapabilitiesSerializer(item["supportedCapabilities"]), + }; +} + +/** The List Snapshots operation response. */ +export interface _SnapshotList { + /** A list of snapshots. */ + value: Snapshot[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _snapshotListDeserializer(item: any): _SnapshotList { + return { + value: snapshotArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function snapshotArraySerializer(result: Array): any[] { + return result.map((item) => { + return snapshotSerializer(item); + }); +} + +export function snapshotArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return snapshotDeserializer(item); + }); +} + +/** Properties of disk restore point */ +export interface DiskRestorePoint extends ProxyResource { + /** The timestamp of restorePoint creation */ + readonly timeCreated?: Date; + /** arm id of source disk or source disk restore point. */ + readonly sourceResourceId?: string; + /** The Operating System type. */ + readonly osType?: OperatingSystemTypes; + /** The hypervisor generation of the Virtual Machine. Applicable to OS disks only. */ + hyperVGeneration?: HyperVGeneration; + /** Purchase plan information for the the image from which the OS disk was created. */ + purchasePlan?: DiskPurchasePlan; + /** List of supported capabilities for the image from which the OS disk was created. */ + supportedCapabilities?: SupportedCapabilities; + /** id of the backing snapshot's MIS family */ + readonly familyId?: string; + /** unique incarnation id of the source disk */ + readonly sourceUniqueId?: string; + /** Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. */ + readonly encryption?: Encryption; + /** Indicates the OS on a disk supports hibernation. */ + supportsHibernation?: boolean; + /** Policy for accessing the disk via network. */ + networkAccessPolicy?: NetworkAccessPolicy; + /** Policy for controlling export on the disk. */ + publicNetworkAccess?: PublicNetworkAccess; + /** ARM id of the DiskAccess resource for using private endpoints on disks. */ + diskAccessId?: string; + /** Percentage complete for the background copy of disk restore point when source resource is from a different region. */ + completionPercent?: number; + /** Replication state of disk restore point when source resource is from a different region. */ + readonly replicationState?: string; + /** Location of source disk or source disk restore point when source resource is from a different region. */ + readonly sourceResourceLocation?: string; + /** Contains the security related information for the resource. */ + securityProfile?: DiskSecurityProfile; + /** Logical sector size in bytes for disk restore points of UltraSSD_LRS and PremiumV2_LRS disks. Supported values are 512 and 4096. 4096 is the default. */ + readonly logicalSectorSize?: number; +} + +export function diskRestorePointDeserializer(item: any): DiskRestorePoint { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + ...(!item["properties"] + ? item["properties"] + : diskRestorePointPropertiesDeserializer(item["properties"])), + }; +} + +/** Properties of an incremental disk restore point */ +export interface DiskRestorePointProperties { + /** The timestamp of restorePoint creation */ + readonly timeCreated?: Date; + /** arm id of source disk or source disk restore point. */ + readonly sourceResourceId?: string; + /** The Operating System type. */ + readonly osType?: OperatingSystemTypes; + /** The hypervisor generation of the Virtual Machine. Applicable to OS disks only. */ + hyperVGeneration?: HyperVGeneration; + /** Purchase plan information for the the image from which the OS disk was created. */ + purchasePlan?: DiskPurchasePlan; + /** List of supported capabilities for the image from which the OS disk was created. */ + supportedCapabilities?: SupportedCapabilities; + /** id of the backing snapshot's MIS family */ + readonly familyId?: string; + /** unique incarnation id of the source disk */ + readonly sourceUniqueId?: string; + /** Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys. */ + readonly encryption?: Encryption; + /** Indicates the OS on a disk supports hibernation. */ + supportsHibernation?: boolean; + /** Policy for accessing the disk via network. */ + networkAccessPolicy?: NetworkAccessPolicy; + /** Policy for controlling export on the disk. */ + publicNetworkAccess?: PublicNetworkAccess; + /** ARM id of the DiskAccess resource for using private endpoints on disks. */ + diskAccessId?: string; + /** Percentage complete for the background copy of disk restore point when source resource is from a different region. */ + completionPercent?: number; + /** Replication state of disk restore point when source resource is from a different region. */ + readonly replicationState?: string; + /** Location of source disk or source disk restore point when source resource is from a different region. */ + readonly sourceResourceLocation?: string; + /** Contains the security related information for the resource. */ + securityProfile?: DiskSecurityProfile; + /** Logical sector size in bytes for disk restore points of UltraSSD_LRS and PremiumV2_LRS disks. Supported values are 512 and 4096. 4096 is the default. */ + readonly logicalSectorSize?: number; +} + +export function diskRestorePointPropertiesDeserializer( + item: any, +): DiskRestorePointProperties { + return { + timeCreated: !item["timeCreated"] + ? item["timeCreated"] + : new Date(item["timeCreated"]), + sourceResourceId: item["sourceResourceId"], + osType: item["osType"], + hyperVGeneration: item["hyperVGeneration"], + purchasePlan: !item["purchasePlan"] + ? item["purchasePlan"] + : diskPurchasePlanDeserializer(item["purchasePlan"]), + supportedCapabilities: !item["supportedCapabilities"] + ? item["supportedCapabilities"] + : supportedCapabilitiesDeserializer(item["supportedCapabilities"]), + familyId: item["familyId"], + sourceUniqueId: item["sourceUniqueId"], + encryption: !item["encryption"] + ? item["encryption"] + : encryptionDeserializer(item["encryption"]), + supportsHibernation: item["supportsHibernation"], + networkAccessPolicy: item["networkAccessPolicy"], + publicNetworkAccess: item["publicNetworkAccess"], + diskAccessId: item["diskAccessId"], + completionPercent: item["completionPercent"], + replicationState: item["replicationState"], + sourceResourceLocation: item["sourceResourceLocation"], + securityProfile: !item["securityProfile"] + ? item["securityProfile"] + : diskSecurityProfileDeserializer(item["securityProfile"]), + logicalSectorSize: item["logicalSectorSize"], + }; +} + +/** The List Disk Restore Points operation response. */ +export interface _DiskRestorePointList { + /** The DiskRestorePoint items on this page */ + value: DiskRestorePoint[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _diskRestorePointListDeserializer( + item: any, +): _DiskRestorePointList { + return { + value: diskRestorePointArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function diskRestorePointArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return diskRestorePointDeserializer(item); + }); +} + +/** The available API versions. */ +export enum KnownVersions { + /** The 2024-03-02 API version. */ + V20240302 = "2024-03-02", + /** The 2025-01-02 API version. */ + V20250102 = "2025-01-02", +} diff --git a/sdk/compute/arm-compute-disk/src/restorePollerHelpers.ts b/sdk/compute/arm-compute-disk/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..39bcf7a045bd --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/restorePollerHelpers.ts @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeDiskClient } from "./computeDiskClient.js"; +import { + _revokeAccessDeserialize, + _grantAccessDeserialize, +} from "./api/diskRestorePoint/operations.js"; +import { + _revokeAccessDeserialize as _revokeAccessDeserializeSnapshots, + _grantAccessDeserialize as _grantAccessDeserializeSnapshots, + _$deleteDeserialize, + _updateDeserialize, + _createOrUpdateDeserialize, +} from "./api/snapshots/operations.js"; +import { + _$deleteDeserialize as _$deleteDeserializeDiskEncryptionSets, + _updateDeserialize as _updateDeserializeDiskEncryptionSets, + _createOrUpdateDeserialize as _createOrUpdateDeserializeDiskEncryptionSets, +} from "./api/diskEncryptionSets/operations.js"; +import { + _deleteAPrivateEndpointConnectionDeserialize, + _updateAPrivateEndpointConnectionDeserialize, + _$deleteDeserialize as _$deleteDeserializeDiskAccesses, + _updateDeserialize as _updateDeserializeDiskAccesses, + _createOrUpdateDeserialize as _createOrUpdateDeserializeDiskAccesses, +} from "./api/diskAccesses/operations.js"; +import { + _revokeAccessDeserialize as _revokeAccessDeserializeDisks, + _grantAccessDeserialize as _grantAccessDeserializeDisks, + _$deleteDeserialize as _$deleteDeserializeDisks, + _updateDeserialize as _updateDeserializeDisks, + _createOrUpdateDeserialize as _createOrUpdateDeserializeDisks, +} from "./api/disks/operations.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import { + OperationOptions, + PathUncheckedResponse, +} from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; +import { + PollerLike, + OperationState, + deserializeState, + ResourceLocationConfig, +} 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: ComputeDiskClient, + 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}.`, + ); + } + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + }, + ); +} + +interface DeserializationHelper { + deserializer: (result: PathUncheckedResponse) => Promise; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess": + { + deserializer: _revokeAccessDeserialize, + expectedStatuses: ["202", "200", "201"], + }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess": + { + deserializer: _grantAccessDeserialize, + expectedStatuses: ["202", "200", "201"], + }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess": + { + deserializer: _revokeAccessDeserializeSnapshots, + expectedStatuses: ["202", "200", "201"], + }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess": + { + deserializer: _grantAccessDeserializeSnapshots, + expectedStatuses: ["202", "200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}": + { + deserializer: _$deleteDeserialize, + expectedStatuses: ["200", "202", "204", "201"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}": + { + deserializer: _updateDeserialize, + expectedStatuses: ["200", "202", "201"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}": + { + deserializer: _createOrUpdateDeserialize, + expectedStatuses: ["200", "202", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}": + { + deserializer: _$deleteDeserializeDiskEncryptionSets, + expectedStatuses: ["200", "202", "204", "201"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}": + { + deserializer: _updateDeserializeDiskEncryptionSets, + expectedStatuses: ["200", "202", "201"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}": + { + deserializer: _createOrUpdateDeserializeDiskEncryptionSets, + expectedStatuses: ["200", "202", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}": + { + deserializer: _deleteAPrivateEndpointConnectionDeserialize, + expectedStatuses: ["200", "202", "204", "201"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}": + { + deserializer: _updateAPrivateEndpointConnectionDeserialize, + expectedStatuses: ["200", "202", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}": + { + deserializer: _$deleteDeserializeDiskAccesses, + expectedStatuses: ["200", "202", "204", "201"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}": + { + deserializer: _updateDeserializeDiskAccesses, + expectedStatuses: ["200", "202", "201"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}": + { + deserializer: _createOrUpdateDeserializeDiskAccesses, + expectedStatuses: ["200", "202", "201"], + }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess": + { + deserializer: _revokeAccessDeserializeDisks, + expectedStatuses: ["202", "200", "201"], + }, + "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess": + { + deserializer: _grantAccessDeserializeDisks, + expectedStatuses: ["202", "200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}": + { + deserializer: _$deleteDeserializeDisks, + expectedStatuses: ["200", "202", "204", "201"], + }, + "PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}": + { + deserializer: _updateDeserializeDisks, + expectedStatuses: ["200", "202", "201"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}": + { + deserializer: _createOrUpdateDeserializeDisks, + expectedStatuses: ["200", "202", "201"], + }, +}; + +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); +} diff --git a/sdk/compute/arm-compute-disk/src/static-helpers/cloudSettingHelpers.ts b/sdk/compute/arm-compute-disk/src/static-helpers/cloudSettingHelpers.ts new file mode 100644 index 000000000000..2c70bfe5ec34 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/static-helpers/cloudSettingHelpers.ts @@ -0,0 +1,44 @@ +// 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/compute/arm-compute-disk/src/static-helpers/pagingHelpers.ts b/sdk/compute/arm-compute-disk/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..aec673f04396 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + Client, + createRestError, + PathUncheckedResponse, +} 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< + TElement, + TPage, + TPageSettings + >; + /** + * 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"; +} + +/** + * 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 pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : nextLinkMethod === "POST" + ? await client.pathUnchecked(pageLink).post() + : await client.pathUnchecked(pageLink).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< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + 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, + ); + } +} diff --git a/sdk/compute/arm-compute-disk/src/static-helpers/pollingHelpers.ts b/sdk/compute/arm-compute-disk/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..2edbf783be53 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + createHttpPoller, + OperationResponse, +} from "@azure/core-lro"; + +import { + Client, + PathUncheckedResponse, + createRestError, +} from "@azure-rest/core-client"; +import { 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; +} +export function getLongRunningPoller< + TResponse extends PathUncheckedResponse, + TResult = void, +>( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse } = 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 { + response = await client.pathUnchecked(path).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, + }, + }; +} diff --git a/sdk/compute/arm-compute-disk/src/static-helpers/simplePollerHelpers.ts b/sdk/compute/arm-compute-disk/src/static-helpers/simplePollerHelpers.ts new file mode 100644 index 000000000000..ce2c3bc31c5d --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/static-helpers/simplePollerHelpers.ts @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { PollerLike, OperationState, CancelOnProgress } from "@azure/core-lro"; +import { AbortSignalLike } from "@azure/abort-controller"; + +/** + * A simple poller that can be used to poll a long running operation. + */ +export interface SimplePollerLike< + TState extends OperationState, + TResult, +> { + /** + * Returns true if the poller has finished polling. + */ + isDone(): boolean; + /** + * Returns the state of the operation. + */ + getOperationState(): TState; + /** + * Returns the result value of the operation, + * regardless of the state of the poller. + * It can return undefined or an incomplete form of the final TResult value + * depending on the implementation. + */ + getResult(): TResult | undefined; + /** + * Returns a promise that will resolve once a single polling request finishes. + * It does this by calling the update method of the Poller's operation. + */ + poll(options?: { abortSignal?: AbortSignalLike }): Promise; + /** + * Returns a promise that will resolve once the underlying operation is completed. + */ + pollUntilDone(pollOptions?: { + abortSignal?: AbortSignalLike; + }): Promise; + /** + * Invokes the provided callback after each polling is completed, + * sending the current state of the poller's operation. + * + * It returns a method that can be used to stop receiving updates on the given callback function. + */ + onProgress(callback: (state: TState) => void): CancelOnProgress; + + /** + * Returns a promise that could be used for serialized version of the poller's operation + * by invoking the operation's serialize method. + */ + serialize(): Promise; + + /** + * Wait the poller to be submitted. + */ + submitted(): Promise; + + /** + * Returns a string representation of the poller's operation. Similar to serialize but returns a string. + * @deprecated Use serialize() instead. + */ + toString(): string; + + /** + * Stops the poller from continuing to poll. Please note this will only stop the client-side polling + * @deprecated Use abortSignal to stop polling instead. + */ + stopPolling(): void; + + /** + * Returns true if the poller is stopped. + * @deprecated Use abortSignal status to track this instead. + */ + isStopped(): boolean; +} + +/** + * Create the deprecated SimplePollerLike from PollerLike + * @param poller PollerLike to convert + * @returns SimplePollerLike + */ +export function getSimplePoller( + poller: PollerLike, TResult>, +): SimplePollerLike, TResult> { + const simplePoller: SimplePollerLike, TResult> = { + isDone() { + return poller.isDone; + }, + isStopped() { + throw new Error( + "isStopped is deprecated. Use abortSignal status to track this instead.", + ); + }, + getOperationState() { + if (!poller.operationState) { + throw new Error( + "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", + ); + } + return poller.operationState; + }, + getResult() { + return poller.result; + }, + toString() { + if (!poller.operationState) { + throw new Error( + "Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().", + ); + } + return JSON.stringify({ + state: poller.operationState, + }); + }, + stopPolling() { + throw new Error( + "stopPolling is deprecated. Use abortSignal to stop polling instead.", + ); + }, + onProgress: poller.onProgress, + poll: poller.poll, + pollUntilDone: poller.pollUntilDone, + serialize: poller.serialize, + submitted: poller.submitted, + }; + return simplePoller; +} diff --git a/sdk/compute/arm-compute-disk/src/static-helpers/urlTemplate.ts b/sdk/compute/arm-compute-disk/src/static-helpers/urlTemplate.ts new file mode 100644 index 000000000000..7c24aabcbc65 --- /dev/null +++ b/sdk/compute/arm-compute-disk/src/static-helpers/urlTemplate.ts @@ -0,0 +1,230 @@ +// 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/compute/arm-compute-disk/test/public/sampleTest.spec.ts b/sdk/compute/arm-compute-disk/test/public/sampleTest.spec.ts new file mode 100644 index 000000000000..19cf10ee4956 --- /dev/null +++ b/sdk/compute/arm-compute-disk/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/compute/arm-compute-disk/test/public/utils/recordedClient.ts b/sdk/compute/arm-compute-disk/test/public/utils/recordedClient.ts new file mode 100644 index 000000000000..285e4643c45e --- /dev/null +++ b/sdk/compute/arm-compute-disk/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/compute/arm-compute-disk/test/snippets.spec.ts b/sdk/compute/arm-compute-disk/test/snippets.spec.ts new file mode 100644 index 000000000000..09504b5933e8 --- /dev/null +++ b/sdk/compute/arm-compute-disk/test/snippets.spec.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ComputeClient } 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 ComputeClient(new DefaultAzureCredential(), subscriptionId); + }); + + it("ReadmeSampleCreateClient_Browser", async () => { + const credential = new InteractiveBrowserCredential({ + tenantId: "", + clientId: "", + }); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new ComputeClient(credential, subscriptionId); + }); + + it("SetLogLevel", async () => { + setLogLevel("info"); + }); +}); diff --git a/sdk/compute/arm-compute-disk/tsconfig.browser.config.json b/sdk/compute/arm-compute-disk/tsconfig.browser.config.json new file mode 100644 index 000000000000..85d80c4abc54 --- /dev/null +++ b/sdk/compute/arm-compute-disk/tsconfig.browser.config.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.browser.base.json", + "compilerOptions": { + "paths": { + "@azure/arm-compute-disk": ["./dist/browser/index.d.ts"], + "@azure/arm-compute-disk/*": ["./dist/browser/*"], + "$internal/*": ["./dist/browser/*"] + } + } +} diff --git a/sdk/compute/arm-compute-disk/tsconfig.json b/sdk/compute/arm-compute-disk/tsconfig.json new file mode 100644 index 000000000000..0e57dbd186e5 --- /dev/null +++ b/sdk/compute/arm-compute-disk/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/compute/arm-compute-disk/tsconfig.samples.json b/sdk/compute/arm-compute-disk/tsconfig.samples.json new file mode 100644 index 000000000000..af052ca4a421 --- /dev/null +++ b/sdk/compute/arm-compute-disk/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/arm-compute-disk": ["./dist/esm"] + } + } +} diff --git a/sdk/compute/arm-compute-disk/tsconfig.snippets.json b/sdk/compute/arm-compute-disk/tsconfig.snippets.json new file mode 100644 index 000000000000..6f3148b5ed97 --- /dev/null +++ b/sdk/compute/arm-compute-disk/tsconfig.snippets.json @@ -0,0 +1,3 @@ +{ + "extends": ["../../../tsconfig.snippets.base.json"] +} diff --git a/sdk/compute/arm-compute-disk/tsconfig.src.json b/sdk/compute/arm-compute-disk/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/compute/arm-compute-disk/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/compute/arm-compute-disk/tsconfig.test.json b/sdk/compute/arm-compute-disk/tsconfig.test.json new file mode 100644 index 000000000000..42798ad68913 --- /dev/null +++ b/sdk/compute/arm-compute-disk/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/compute/arm-compute-disk/tsconfig.test.node.json b/sdk/compute/arm-compute-disk/tsconfig.test.node.json new file mode 100644 index 000000000000..96d0ebc4d6a6 --- /dev/null +++ b/sdk/compute/arm-compute-disk/tsconfig.test.node.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.test.node.base.json", + "compilerOptions": { + "paths": { + "@azure/arm-compute-disk": ["./src/index.ts"], + "@azure/arm-compute-disk/*": ["./src/*"], + "$internal/*": ["./src/*"] + } + } +} diff --git a/sdk/compute/arm-compute-disk/tsp-location.yaml b/sdk/compute/arm-compute-disk/tsp-location.yaml new file mode 100644 index 000000000000..41af0446ad83 --- /dev/null +++ b/sdk/compute/arm-compute-disk/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/compute/Disk.Management +commit: 4edef13d40eed977f3466172c3e5174142df8624 +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/compute/Common.Management diff --git a/sdk/compute/arm-compute-disk/vitest.browser.config.ts b/sdk/compute/arm-compute-disk/vitest.browser.config.ts new file mode 100644 index 000000000000..72964f281efe --- /dev/null +++ b/sdk/compute/arm-compute-disk/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/compute/arm-compute-disk/vitest.config.ts b/sdk/compute/arm-compute-disk/vitest.config.ts new file mode 100644 index 000000000000..0dfa15cc4498 --- /dev/null +++ b/sdk/compute/arm-compute-disk/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/compute/arm-compute-disk/vitest.esm.config.ts b/sdk/compute/arm-compute-disk/vitest.esm.config.ts new file mode 100644 index 000000000000..5e9735e9b144 --- /dev/null +++ b/sdk/compute/arm-compute-disk/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/compute/ci.mgmt.yml b/sdk/compute/ci.mgmt.yml index 663861db5c36..15bae64a6637 100644 --- a/sdk/compute/ci.mgmt.yml +++ b/sdk/compute/ci.mgmt.yml @@ -15,6 +15,7 @@ trigger: - sdk/compute/arm-compute-profile-2020-09-01-hybrid - sdk/compute/arm-compute-rest - sdk/compute/arm-computerecommender + - sdk/compute/arm-compute-disk pr: branches: include: @@ -31,6 +32,7 @@ pr: - sdk/compute/arm-compute-profile-2020-09-01-hybrid - sdk/compute/arm-compute-rest - sdk/compute/arm-computerecommender + - sdk/compute/arm-compute-disk extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -44,3 +46,5 @@ extends: safeName: azurerestarmcompute - name: azure-arm-computerecommender safeName: azurearmcomputerecommender + - name: azure-arm-compute-disk + safeName: azurearmcomputedisk